*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0d13;
  --surface: #161923;
  --surface2: #1e2230;
  --surface3: #272c3d;
  --border: #2b304530;
  --border-solid: #2e3348;
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --accent-glow: rgba(108, 99, 255, .35);
  --text: #edeef3;
  --muted: #8b90a7;
  --muted-soft: #666c85;
  --green: #34d399;
  --red: #f87171;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.24), 0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-pop: 0 12px 32px -8px rgba(0,0,0,.55);
  --ease: cubic-bezier(.4,0,.2,1);
}

html { scrollbar-color: var(--surface3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-soft); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(108,99,255,.16), transparent 60%),
    radial-gradient(900px 460px at 100% 0%, rgba(167,139,250,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; }

/* --- topbar --- */

.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,13,19,.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-solid);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  min-width: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }
.topbar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 10px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px;
  box-shadow: 0 4px 14px -4px var(--accent-glow);
}
.topbar-title { font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-username { font-size: 13px; font-weight: 700; color: var(--text); }

.ghost-btn {
  background: transparent; color: var(--muted); border: 1px solid var(--border-solid);
  font-weight: 600;
}
.ghost-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--muted-soft); }

.kurs-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; font-size: 13px; font-weight: 800;
  padding: 9px 16px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 16px -4px var(--accent-glow);
  transition: transform .12s var(--ease), box-shadow .15s var(--ease);
}
.kurs-link-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px -4px var(--accent-glow); }
.kurs-link-btn:active { transform: translateY(0) scale(.98); }

/* --- login screen --- */

.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 65px); padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 36px 30px 30px;
  text-align: center;
}
.login-logo {
  width: 48px; height: 48px; margin: 0 auto 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff; letter-spacing: -.02em;
  box-shadow: 0 8px 24px -6px var(--accent-glow);
}
.login-card h1 { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -.01em; }
.login-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.login-card input { margin-bottom: 10px; }
.login-card button { width: 100%; margin-top: 6px; padding: 12px 18px; }

/* --- layout --- */

.container { max-width: 860px; margin: 0 auto; padding: 28px 16px 70px; }

.tab-bar {
  display: inline-flex; gap: 2px; margin-bottom: 20px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-solid); border-radius: 999px;
}
.tab-btn {
  background: transparent; color: var(--muted); font-weight: 700; font-size: 13px;
  padding: 8px 18px; border-radius: 999px; border: none;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.tab-btn:hover { background: var(--surface2); color: var(--text); }
.tab-btn.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.tab-btn.active:hover { background: linear-gradient(135deg, var(--accent), var(--accent2)); }

.danger-btn { background: var(--red); }
.danger-btn:hover { background: #ff8a8a; }

.stage {
  background: var(--surface);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 22px;
  margin-bottom: 18px;
  transition: border-color .2s var(--ease);
}
.stage h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }

.video-wrapper {
  width: 100%; max-width: 860px; margin: 0 auto;
  aspect-ratio: 16 / 9; position: relative; border-radius: var(--radius-md); overflow: hidden;
}
.video-wrapper iframe { position: absolute; inset: 0; }

.stage-danger {
  border-color: rgba(248,113,113,.25);
  background: linear-gradient(180deg, rgba(248,113,113,.06), var(--surface) 60%);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.stage-danger strong { font-size: .95rem; }

.section-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.step-badge {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  background: var(--surface3); border: 1px solid var(--border-solid);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: var(--accent2);
}
.section-header h2 { margin-bottom: 2px; }
.section-subtitle { font-size: 12.5px; color: var(--muted); }
.section-footer { margin-top: 16px; }

.two-cols { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 541px) { .two-cols { flex-direction: row; } .two-cols > * { flex: 1; } }

.zone-label { margin-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.dropzone {
  border: 1.5px dashed var(--border-solid);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.dropzone:hover { border-color: var(--muted-soft); background: var(--surface2); }
.dropzone-icon { width: 26px; height: 26px; color: var(--muted-soft); transition: color .18s var(--ease); }
.dropzone.dragover { border-color: var(--accent2); color: var(--accent2); background: rgba(167,139,250,.06); }
.dropzone.dragover .dropzone-icon { color: var(--accent2); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.badge-queued { background: rgba(139,144,167,.15); color: var(--muted); }
.badge-processing { background: rgba(167,139,250,.15); color: var(--accent2); }
.badge-done { background: rgba(52,211,153,.15); color: var(--green); }
.badge-error { background: rgba(248,113,113,.15); color: var(--red); }

.error-box {
  background: rgba(248,113,113,.07);
  border: 1px solid rgba(248,113,113,.22);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  color: #fca5a5;
  margin-top: 8px;
  text-align: left;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px; background: var(--surface2);
  border-bottom: 1px solid var(--border-solid); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); font-weight: 700;
}
th:first-child { border-top-left-radius: var(--radius-sm); }
th:last-child { border-top-right-radius: var(--radius-sm); }
td { padding: 12px; border-bottom: 1px solid var(--border-solid); color: #ccd0e0; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: rgba(255,255,255,.02); }
tr:last-child td { border-bottom: none; }

button {
  font-family: inherit; font-size: 13px; font-weight: 700;
  background: var(--accent); color: #fff; border: none;
  padding: 10px 18px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
button:hover { background: var(--accent2); }
button:active { transform: scale(.98); }
button:disabled { background: var(--surface3); color: var(--muted); cursor: not-allowed; transform: none; }
button:focus-visible, input:focus-visible, .tab-btn:focus-visible, .dropzone:focus-visible {
  outline: 2px solid var(--accent2); outline-offset: 2px;
}

input[type="text"], input[type="password"] {
  font-family: inherit; font-size: 14px;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border-solid); border-radius: var(--radius-sm); padding: 11px 13px;
  width: 100%;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none; border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(167,139,250,.16);
}
input::placeholder { color: var(--muted-soft); }

textarea {
  font-family: inherit; font-size: 14px;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border-solid); border-radius: var(--radius-sm); padding: 11px 13px;
  width: 100%; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(167,139,250,.16); }
textarea::placeholder { color: var(--muted-soft); }

.platform-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.bulk-url-cell {
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; color: var(--muted);
}
.bulk-failed-item {
  font-size: 12.5px; color: #fca5a5; margin-top: 6px;
  padding: 8px 10px; background: rgba(248,113,113,.07); border: 1px solid rgba(248,113,113,.22);
  border-radius: var(--radius-sm);
}

.upload-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.upload-item {
  background: var(--surface2); border: 1px solid var(--border-solid);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
.upload-item-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.upload-item-name {
  font-size: 12px; color: #ccd0e0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.upload-progress-track {
  height: 5px; border-radius: 999px; background: var(--border-solid); overflow: hidden;
}
.upload-progress-fill {
  height: 100%; width: 0%; background: var(--accent); border-radius: 999px;
  transition: width .15s ease;
}
.upload-item.upload-error .upload-progress-fill { background: var(--red); }
.upload-item.upload-done .upload-progress-fill { background: var(--green); }

.history-section-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.history-section-header h2 { margin-bottom: 0; }

.download-all-btn {
  background: var(--surface3); color: var(--text); font-size: 12px; font-weight: 700;
  padding: 8px 14px; border-radius: var(--radius-sm); white-space: nowrap; flex-shrink: 0;
  text-decoration: none; border: 1px solid var(--border-solid);
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.download-all-btn:hover { background: var(--surface2); border-color: var(--muted-soft); }

.history-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.history-tile {
  cursor: pointer; border: 1px solid var(--border-solid); border-radius: var(--radius-md);
  overflow: hidden; background: var(--surface2);
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.history-tile:hover { border-color: var(--accent2); transform: translateY(-2px); }
.history-tile video { width: 100%; height: 90px; object-fit: cover; display: block; pointer-events: none; background: #000; }
.history-tile-label {
  display: block; padding: 7px 9px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,5,10,.82);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-content {
  background: var(--surface); border: 1px solid var(--border-solid); border-radius: var(--radius-lg); padding: 18px;
  max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-pop);
}
.modal-content video { max-width: 100%; max-height: 70vh; border-radius: var(--radius-sm); background: #000; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; }
.modal-actions a { color: var(--accent2); font-size: 13px; font-weight: 700; text-decoration: none; }
.modal-actions a:hover { text-decoration: underline; }
.modal-close-btn { background: var(--surface3); color: var(--text); }
.modal-close-btn:hover { background: var(--surface2); }

.reassign-cell { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.reassign-cell select {
  font-family: inherit; font-size: 12px;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border-solid); border-radius: var(--radius-sm); padding: 7px 8px;
  width: 100%;
}
.reassign-cell button { padding: 6px 12px; font-size: 12px; align-self: flex-start; }

/* ══════════════════════════════════════════════════════════════════════
   Studio — Praca + Generuj z ElevenLabs + Historia (jedno narzędzie)
   ══════════════════════════════════════════════════════════════════════ */
.studio-hero {
  position: relative; display: flex; align-items: center; gap: 18px;
  padding: 28px 26px; margin-bottom: 20px; border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 200px at 15% 0%, rgba(108,99,255,.22), transparent 60%),
    radial-gradient(500px 220px at 90% 100%, rgba(167,139,250,.16), transparent 60%),
    linear-gradient(180deg, #14162080, #0d0f1680);
  border: 1px solid var(--border-solid);
  overflow: hidden;
}
.studio-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.035) 50%, transparent 60%);
}
.studio-hero-badge {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 24px -6px var(--accent-glow);
}
.studio-hero-title {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px;
  background: linear-gradient(135deg, #fff, #cfcbff 60%, var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.studio-hero-subtitle { font-size: 13px; color: var(--muted); max-width: 480px; }
.studio-help-btn {
  margin-left: auto; flex-shrink: 0; background: rgba(255,255,255,.06); color: var(--text);
  border: 1px solid var(--border-solid); font-size: 12px; font-weight: 700;
  padding: 9px 16px; border-radius: 999px; white-space: nowrap;
}
.studio-help-btn:hover { background: rgba(255,255,255,.1); }
.studio-video { margin-bottom: 20px; border: 1px solid var(--border-solid); box-shadow: var(--shadow-card); }

.studio-subnav {
  display: inline-flex; gap: 3px; padding: 4px; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border-solid); border-radius: 999px;
}
.studio-subnav-btn {
  display: flex; align-items: center; gap: 7px; background: transparent; color: var(--muted);
  font-weight: 700; font-size: 13px; padding: 9px 20px; border-radius: 999px; border: none;
  transition: color .15s var(--ease), background .15s var(--ease);
}
.studio-subnav-btn:hover { background: var(--surface2); color: var(--text); }
.studio-subnav-btn.active {
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 4px 18px -4px var(--accent-glow);
}

.studio-card {
  position: relative; background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 24px 22px; margin-bottom: 18px;
  overflow: hidden;
}
.studio-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167,139,250,.5), transparent);
}
.studio-card-danger {
  border-color: rgba(248,113,113,.25);
  background: linear-gradient(180deg, rgba(248,113,113,.06), var(--surface) 60%);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.studio-step-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.studio-step-num {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(108,99,255,.25), rgba(167,139,250,.25));
  border: 1px solid rgba(167,139,250,.3); color: var(--accent2);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.studio-step-header h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 2px; }
.studio-card-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 16px; }

.studio-dropzone {
  padding: 40px 20px; border-radius: var(--radius-lg);
  background: radial-gradient(400px 160px at 50% 0%, rgba(108,99,255,.06), transparent 70%);
}
.studio-dropzone .dropzone-icon { width: 34px; height: 34px; }

.row-list { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface2); border: 1px solid var(--border-solid); border-radius: var(--radius-md);
  padding: 12px 14px; transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.row-card:hover { border-color: var(--muted-soft); transform: translateY(-1px); }
.row-card-icon {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
  background: var(--surface3); display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.row-card-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.row-card-title { font-size: 13px; font-weight: 700; color: var(--text); }
.row-card-meta { font-size: 11.5px; color: var(--muted); }
.row-card-status { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.row-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.row-card-actions a, .row-card-actions button {
  font-size: 11.5px; padding: 6px 12px; font-weight: 700; border-radius: 999px;
}
.row-card-reassign {
  width: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-solid);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.row-card-reassign select {
  font-family: inherit; font-size: 12px; background: var(--surface3); color: var(--text);
  border: 1px solid var(--border-solid); border-radius: var(--radius-sm); padding: 7px 10px;
}
.row-card-reassign button { font-size: 11.5px; padding: 7px 14px; }

.studio-history-section { margin-bottom: 22px; }
.studio-history-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px;
}
.studio-history-tile {
  position: relative; cursor: pointer; border: 1px solid var(--border-solid); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface2); transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.studio-history-tile:hover { border-color: var(--accent2); transform: translateY(-3px); box-shadow: 0 12px 28px -10px var(--accent-glow); }
.studio-history-tile video { width: 100%; aspect-ratio: 9/12; object-fit: cover; display: block; pointer-events: none; background: #000; }
.studio-history-tile::after {
  content: '▶'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; background: rgba(0,0,0,.25); opacity: 0; transition: opacity .15s ease;
}
.studio-history-tile:hover::after { opacity: 1; }
.studio-history-tile-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; font-size: 12px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent); z-index: 1;
}

/* ══════════════════════════════════════════════════════════════════════
   DNA Produktu + Klonowanie Reklam
   ══════════════════════════════════════════════════════════════════════ */
.dna-subheading { font-size: .95rem; font-weight: 700; margin: 20px 0 12px; color: var(--text); }

.dna-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.dna-card {
  position: relative; width: 160px; border-radius: var(--radius-md); overflow: hidden;
  background: var(--surface2); border: 1.5px solid var(--border-solid); cursor: pointer;
  transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.dna-card:hover { border-color: var(--muted-soft); transform: translateY(-2px); }
.dna-card.selected { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(167,139,250,.16); }
.dna-card-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface3);
}
.dna-card-thumb-placeholder {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--surface3); font-size: 34px;
}
.dna-card-body { padding: 9px 10px; display: flex; flex-direction: column; gap: 6px; }
.dna-card-title {
  font-size: 12.5px; font-weight: 700; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.dna-card-delete {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; padding: 0;
  border-radius: 50%; border: none; background: rgba(4,5,10,.65); color: #ccc;
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease, background .15s ease;
}
.dna-card:hover .dna-card-delete { opacity: 1; }
.dna-card-delete:hover { background: rgba(220,38,38,.85); color: #fff; }
.dna-card-view {
  font-size: 11px; padding: 4px 0; background: none; color: var(--accent2); text-align: left;
  font-weight: 700;
}
.dna-card-view:hover { background: none; color: #fff; text-decoration: underline; }
.dna-card-step {
  display: block; font-size: 10.5px; color: var(--accent2); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  animation: dnaStepPulse 1.6s ease-in-out infinite;
}
@keyframes dnaStepPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.dna-card-new {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed var(--border-solid); color: var(--muted); aspect-ratio: .82;
  background: transparent;
}
.dna-card-new:hover { border-color: var(--accent2); color: var(--accent2); background: rgba(167,139,250,.05); }
.dna-card-new-icon { font-size: 26px; font-weight: 300; line-height: 1; }

#ad-clone-product-photos-grid.dna-grid { gap: 8px; }
.photo-thumb {
  width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid var(--border-solid);
  display: block;
}
.photo-thumb-wrap { position: relative; width: 64px; height: 64px; }
.photo-thumb-remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0;
  border-radius: 50%; border: none; background: #e5484d; color: #fff;
  font-size: 11px; line-height: 20px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.photo-thumb-remove:hover { background: #ff6369; }

.brief-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.brief-card {
  background: var(--surface2); border: 1px solid var(--border-solid); border-radius: var(--radius-md);
  overflow: hidden; display: flex; flex-direction: column;
}
.brief-card-thumb { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; background: var(--surface3); }
.brief-card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.brief-badge-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.brief-word-count { font-size: 11px; color: var(--muted); margin-left: auto; }
.brief-card-body input[type="text"], .brief-card-body textarea {
  font-size: 13px; padding: 8px 10px;
}
.brief-approve-row {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  padding-top: 2px;
}
.brief-approve-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent2); }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.result-card {
  background: var(--surface2); border: 1px solid var(--border-solid); border-radius: var(--radius-md);
  overflow: hidden; display: flex; flex-direction: column;
}
.result-card-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface3); }
.result-card-placeholder {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--surface3); color: var(--muted); font-size: 12px; text-align: center; padding: 10px;
}
.result-card-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.result-card-headline {
  font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-weight: 600;
}
.result-card-body a {
  align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--accent2);
  text-decoration: none; padding: 4px 10px; border-radius: 999px;
  background: rgba(167,139,250,.1); border: 1px solid rgba(167,139,250,.22);
}
.result-card-body a:hover { background: rgba(167,139,250,.18); }

/* ══════════════════════════════════════════════════════════════════════
   AI Image Generator — ported 1:1 (minus draw mode) from dropai-tools NET
   ══════════════════════════════════════════════════════════════════════ */
#tab-ai-images {
  position: fixed; inset: 0; z-index: 200;
  background: #0a0a0a; color: #e0e0e0;
  display: none; flex-direction: column;
  font-family: inherit;
}
#tab-ai-images.show { display: flex; }
.aig-back {
  position: fixed; top: 14px; left: 14px; z-index: 215;
  width: 36px; height: 36px; padding: 0; border-radius: 8px; border: none;
  background: #141414; color: #999; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.aig-back:hover { background: #1e1e1e; color: #fff; }
.aig-back svg { width: 18px; height: 18px; flex-shrink: 0; }
#tab-ai-images .aig-split { display: flex; overflow: hidden; flex: 1; }
#tab-ai-images .aig-panel { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-width: 0; }
#tab-ai-images .aig-panel-scroll { flex: 1; overflow-y: auto; padding: 60px 20px 180px; }

/* Empty state */
#tab-ai-images .aig-empty {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  position: fixed; top: 56px; bottom: 140px; left: 0; right: 0;
  gap: 20px; color: #555; user-select: none;
}
#tab-ai-images .aig-empty.show { display: flex; }
.aig-empty-logo {
  width: 100px; height: 100px; border-radius: 28px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; box-shadow: 0 8px 40px rgba(15,52,96,.3);
}
.aig-empty h2 { color: #ccc; font-size: 20px; font-weight: 600; margin: 0; letter-spacing: .5px; }
.aig-empty p { color: #555; font-size: 13px; margin: 0; text-align: center; line-height: 1.6; max-width: 300px; }

/* Flat grid */
.aig-flat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; width: 100%; }
.aig-cell { position: relative; overflow: hidden; background: #141414; aspect-ratio: 1; cursor: pointer; user-select: none; }
.aig-cell img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .4s ease; }
.aig-cell:hover img { transform: scale(1.03); }
.aig-cell-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.35) 45%, transparent 70%);
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.aig-cell:hover .aig-cell-overlay { opacity: 1; pointer-events: auto; }
.aig-cell-prompt {
  font-size: 11px; line-height: 1.4; color: #e8e8e8;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 8px;
}
.aig-cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.aig-cell-btn {
  width: 28px; height: 28px; padding: 0; border-radius: 7px;
  background: rgba(255,255,255,0.14); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s ease;
}
.aig-cell-btn:hover { background: rgba(255,255,255,0.24); transform: scale(1.08); }
.aig-cell-btn.danger:hover { background: rgba(220,38,38,0.8); }
.aig-cell-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Skeleton (generating) cell */
.aig-cell.skel { position: relative; background: #111; overflow: hidden; }
.aig-cell.skel::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 0%, transparent 30%, rgba(200,244,0,0.055) 43%, rgba(200,244,0,0.13) 50%, rgba(200,244,0,0.055) 57%, transparent 70%, transparent 100%);
  animation: aigWaveShimmer 2s ease-in-out infinite;
}
@keyframes aigWaveShimmer { 0% { transform: translateX(-160%); } 100% { transform: translateX(160%); } }
@keyframes aigFadeIn { from { opacity: 0; } to { opacity: 1; } }
.aig-cell.skel .aig-cell-skel-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #444; font-size: 10px; letter-spacing: .5px; z-index: 1;
}

/* Error cell — spans full row */
.aig-cell-error {
  grid-column: 1 / -1; background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.18);
  padding: 12px 16px; color: #fca5a5; font-size: 13px; line-height: 1.5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.aig-cell-error-text { flex: 1; }
.aig-cell-error .aig-cell-btn { flex-shrink: 0; }

/* Floating chat bar */
.aig-chatbar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  width: 72vw; max-width: 880px; z-index: 210;
  background: #1e1e1e; border: 1px solid rgba(255,255,255,0.06); border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.aig-cb-refs { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 2px 0; }
.aig-cb-refs:empty { display: none; }
.aig-cb-refs .aig-ref-thumb {
  position: relative; width: 44px; height: 44px; border-radius: 8px; overflow: hidden;
  background: #0e0e0e; border: 1px solid rgba(255,255,255,0.08); cursor: grab; transition: opacity .15s, outline .15s;
}
.aig-cb-refs .aig-ref-thumb.drag-over { outline: 2px solid #c8f400; opacity: .8; }
.aig-cb-refs .aig-ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.aig-cb-refs .aig-ref-x {
  position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; border-radius: 50%;
  background: #0a0a0a; color: #bbb; font-size: 11px; line-height: 18px; text-align: center;
  cursor: pointer; border: 1px solid #2a2a2a;
}
.aig-cb-refs .aig-ref-x:hover { background: #c00; color: #fff; }

.aig-cb-input { display: flex; align-items: center; gap: 8px; }
.aig-cb-upload {
  width: 36px; height: 36px; padding: 0; border-radius: 10px; background: #262626; border: 1px solid rgba(255,255,255,0.04);
  color: #999; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s ease;
}
.aig-cb-upload:hover { background: #2e2e2e; color: #ddd; }
.aig-cb-upload svg { width: 16px; height: 16px; flex-shrink: 0; }
#tab-ai-images .aig-cb-textarea {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: #e8e8e8; font-size: 14px; line-height: 1.4; font-family: inherit; resize: none;
  min-height: 24px; max-height: 120px; padding: 6px 2px;
}
#tab-ai-images .aig-cb-textarea::placeholder { color: #555; }
.aig-cb-generate {
  flex-shrink: 0; padding: 8px 18px; height: 36px; border-radius: 10px;
  background: #c8f400; color: #0a0a0a; font-weight: 700; font-size: 13px; letter-spacing: .3px;
  border: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 0 0 1px rgba(200,244,0,0.25), 0 0 18px rgba(200,244,0,0.18), 0 0 32px rgba(200,244,0,0.08);
  transition: all .18s ease;
}
.aig-cb-generate:hover:not(:disabled) {
  background: #d4ff1a; transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(200,244,0,0.4), 0 0 26px rgba(200,244,0,0.3), 0 0 46px rgba(200,244,0,0.16);
}
.aig-cb-generate:active:not(:disabled) { transform: translateY(0); }
.aig-cb-generate:disabled { opacity: .55; cursor: wait; }
.aig-cb-generate svg { width: 14px; height: 14px; flex-shrink: 0; }

.aig-cb-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 2px 0; }
.aig-chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; background: #242424; border: 1px solid rgba(255,255,255,0.05);
  color: #aaa; font-size: 12px; cursor: pointer; transition: all .15s ease; line-height: 1;
}
.aig-chip:hover { background: #2c2c2c; color: #e0e0e0; border-color: rgba(255,255,255,0.1); }
.aig-chip.active { background: rgba(200,244,0,0.09); color: #c8f400; border-color: rgba(200,244,0,0.22); }
.aig-chip svg { width: 12px; height: 12px; stroke-width: 2; flex-shrink: 0; }
.aig-chip-count {
  display: inline-flex; align-items: center; gap: 0; background: #242424; border: 1px solid rgba(255,255,255,0.05);
  border-radius: 999px; padding: 0; overflow: hidden; color: #aaa; font-size: 12px; line-height: 1;
}
.aig-chip-count button { background: none; border: none; color: #888; width: 26px; height: 26px; padding: 0; cursor: pointer; font-size: 14px; transition: all .15s ease; }
.aig-chip-count button:hover { background: #2c2c2c; color: #fff; }
.aig-chip-count .val { padding: 0 8px; color: #ccc; min-width: 30px; text-align: center; }

.aig-dropdown {
  position: absolute; bottom: calc(100% + 8px); top: auto; left: 0; right: auto;
  background: #141414; border: 1px solid #222; border-radius: 10px;
  padding: 4px; min-width: 160px; z-index: 210; display: none; box-shadow: 0 -4px 24px rgba(0,0,0,.6);
}
.aig-dropdown.show { display: block; }
.aig-dropdown-item { padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 12px; color: #888; transition: all .1s; }
.aig-dropdown-item:hover { background: #1e1e1e; color: #fff; }
.aig-dropdown-item.active { color: #a8d844; font-weight: 600; }

/* Lightbox */
.aig-lightbox {
  position: fixed; inset: 0; z-index: 260; background: rgba(0,0,0,.95);
  display: none; align-items: center; justify-content: center;
}
.aig-lightbox.open { display: flex; }
.aig-lightbox img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.aig-lb-close { position: absolute; top: 16px; right: 20px; background: none; border: none; color: #666; font-size: 28px; cursor: pointer; z-index: 2; }
.aig-lb-close:hover { color: #fff; }
.aig-lb-close svg { width: 24px; height: 24px; flex-shrink: 0; }
.aig-lb-nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.aig-lb-actions button svg { width: 16px; height: 16px; flex-shrink: 0; }
.aig-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(20,20,20,.9); border: 1px solid #333; border-radius: 50%;
  width: 44px; height: 44px; padding: 0; display: flex; align-items: center; justify-content: center;
  color: #888; font-size: 20px; cursor: pointer; z-index: 2; transition: all .2s;
}
.aig-lb-nav:hover { background: #222; color: #fff; border-color: #555; }
.aig-lb-prev { left: 16px; }
.aig-lb-next { right: 16px; }
.aig-lb-actions {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; background: rgba(14,14,14,.95); border: 1px solid #222;
  border-radius: 14px; padding: 8px 16px;
}
.aig-lb-actions button {
  width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid #222;
  background: rgba(30,30,30,.9); color: #999; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.aig-lb-actions button:hover { background: #333; border-color: #555; color: #fff; }
.aig-lb-actions button.fav-active { color: #f59e0b; border-color: #f59e0b; }

@media (max-width: 768px) {
  .aig-flat-grid { grid-template-columns: repeat(2, 1fr); gap: 2px; }
  .aig-chatbar { width: calc(100% - 20px); max-width: none; bottom: 10px; padding: 8px 10px; border-radius: 16px; }
  .aig-cb-generate { padding: 0; width: 36px; border-radius: 10px; }
  .aig-cb-generate span { display: none; }
  .aig-cb-chips { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding-bottom: 2px; }
  .aig-cb-chips::-webkit-scrollbar { display: none; }
  .aig-chip, .aig-chip-count { flex-shrink: 0; }
  #tab-ai-images .aig-panel-scroll { padding-bottom: 170px !important; }
}

/* --- MCP token tab ------------------------------------------------------ */
.mcp-token-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.mcp-token-row input { flex: 1; font-family: "SFMono-Regular", Consolas, monospace; }
.mcp-token-row button { flex-shrink: 0; }
#tab-mcp pre {
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border-solid); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; overflow-x: auto; margin: 6px 0 14px;
  white-space: pre-wrap; word-break: break-all;
}

