/* ==========================================================================
   AdsMonitor — design tokens
   Sistem de design (Faza 1, aprobat 2026-08-16) — stil Tesla/Apple: fundal
   neutru aproape negru (dark, implicit) sau alb pur (light), UN singur
   accent (verde-menta, continuare a brand-ului existent, nu o rebranduire),
   rosu/galben rezervate STRICT pentru alerte reale. Toate numele de
   variabile raman neschimbate fata de inainte — doar valorile s-au
   actualizat — ca sa nu fie nevoie sa se atinga restul acestui fisier.

   Signature: every row/card carries a colored "signal rail" on its leading
   edge (profit / loss / watch / neutral) so health reads before the numbers
   do. Figures are set in a monospace data face with tabular numerals so
   columns of spend/ROAS line up like a ledger and can be scanned, not read.
   ========================================================================== */

/* Refresh vizual (2026-10-18, cerut: „dark mode, dar cu mai multa viata, o pata de culoare").
   Aceleasi nume de variabile, valori noi. Fundalul e un albastru-petrol foarte inchis (nu negru
   neutru), luminat discret din colturile de sus de doua lumini colorate. Pe langa verdele-menta
   al brand-ului apar doua accente de „interfata": --accent-iris (violet) si --accent-sky (azur).
   Ele coloreaza DOAR cromul (meniul, cardurile cu cifre, antetele de tabel) — niciodata cifrele,
   ca sa nu se confunde cu semnalele: verde = castig, rosu = pierdere, galben = atentie raman
   rezervate. Textul e Manrope cu cifre tabulare, deci coloanele de bani se aliniaza. */
:root {
  /* --- surfaces & ink (light) --- */
  --bg: #f1f4f7;
  --surface: #ffffff;
  --surface-sunken: #ebf0f4;
  --ink: #111a20;
  --ink-soft: #4f5f69;
  --ink-faint: #82919a;
  --border: #dfe6eb;
  --border-strong: #c9d3da;

  /* --- brand / accent (unic — folosit STRICT pe actiuni primare + cifre pozitive) --- */
  --brand: #0e8f5f;
  --brand-strong: #0b7550;
  --brand-wash: #e3f4ec;
  --on-brand: #ffffff;

  /* --- accente de interfata (crom, nu semnal) + luminile din fundal --- */
  --accent-iris: #6a55e0;
  --accent-sky: #0b8fc6;
  --accent-mint: #0e9f6a;
  --accent-iris-wash: rgba(106, 85, 224, 0.1);
  --glow-a: rgba(106, 85, 224, 0.10);
  --glow-b: rgba(14, 159, 106, 0.09);
  --brand-gradient: linear-gradient(135deg, #12a873 0%, #0e9aa8 100%);
  --mark-gradient: linear-gradient(135deg, #12a873 0%, #0b8fc6 55%, #6a55e0 100%);

  /* --- signal colors: the four states every row can be in --- */
  --profit: var(--brand);
  --profit-wash: var(--brand-wash);
  --loss: #c23a2c;
  --loss-wash: #fbeae8;
  --warning: #a06f11;
  --warning-wash: #faf1de;
  --neutral: #6b706b;
  --neutral-wash: #edf1ee;

  /* --- final-stop: a family-level hard stop, deliberately heavier than --loss --- */
  --stop-final: #8f1d12;
  --stop-final-wash: #f5ddd8;

  /* --- action semantics --- */
  --constructive: var(--brand);
  --constructive-hover: var(--brand-strong);
  --destructive: var(--loss);
  --destructive-hover: #a12f22;
  --destructive-wash: var(--loss-wash);

  /* --- type: O SINGURA familie (Manrope) pentru titluri, text SI cifre — cifrele folosesc
     varianta tabulara (tnum), deci se aliniaza in coloane ca un registru. --font-display ramane
     ca variabila distincta doar pentru compatibilitate. --font-num e pentru cifrele mari si
     tabelele de bani; --font-mono ramane doar pentru texte tehnice (comenzi, coduri). --- */
  --font-display: "Manrope", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-body: "Manrope", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-num: "Manrope", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* --- shape & motion --- */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(18, 26, 22, 0.04), 0 8px 24px -12px rgba(18, 26, 22, 0.12);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --control-h: 40px;

  --sidebar-w: 236px;
  --topbar-h: 58px;
  --bottom-nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090f14;
    --surface: #10191f;
    --surface-sunken: #16222a;
    --ink: #eef4f7;
    --ink-soft: #9db0ba;
    --ink-faint: #687c87;
    --border: #1d2b34;
    --border-strong: #2a3b46;

    --brand: #34e0a1;
    --brand-strong: #4de8b0;
    --brand-wash: rgba(52, 224, 161, 0.1);
    --on-brand: #04130d;

    --accent-iris: #a593ff;
    --accent-sky: #4cc9f0;
    --accent-mint: #34e0a1;
    --accent-iris-wash: rgba(165, 147, 255, 0.16);
    --glow-a: rgba(130, 110, 255, 0.32);
    --glow-b: rgba(52, 224, 161, 0.17);
    --brand-gradient: linear-gradient(135deg, #3be6a6 0%, #2fd0d6 100%);
    --mark-gradient: linear-gradient(135deg, #34e0a1 0%, #4cc9f0 50%, #a593ff 100%);

    --profit: var(--brand);
    --profit-wash: var(--brand-wash);
    --loss: #ef6a5c;
    --loss-wash: rgba(239, 106, 92, 0.12);
    --warning: #e6b155;
    --warning-wash: rgba(230, 177, 85, 0.12);
    --neutral: #9aa49f;
    --neutral-wash: rgba(154, 164, 159, 0.12);

    --stop-final: #ff5245;
    --stop-final-wash: rgba(255, 82, 69, 0.18);

    --constructive: var(--brand);
    --constructive-hover: var(--brand-strong);
    --destructive: var(--loss);
    --destructive-hover: #f4857a;
    --destructive-wash: var(--loss-wash);

    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.035) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.7);
  }
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background-color: var(--bg);
  /* doua lumini colorate din partea de sus — „pata de culoare" a intregii platforme; fixe, deci
     raman pe loc la derulare si nu se repeta pe paginile lungi */
  background-image:
    radial-gradient(1100px 640px at 95% -14%, var(--glow-a), transparent 64%),
    radial-gradient(900px 560px at 22% -20%, var(--glow-b), transparent 62%),
    radial-gradient(800px 600px at 60% 120%, color-mix(in srgb, var(--accent-sky) 9%, transparent), transparent 65%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0 0 6px;
}

h1 { font-size: 1.75rem; font-weight: 750; letter-spacing: -0.025em; }
h2 { font-size: 1.15rem; font-weight: 700; margin-top: 36px; margin-bottom: 12px; }
h3 { font-size: 0.98rem; font-weight: 700; }

/* subtitlul de sub titlul paginii (primul .hint dupa h1) — respira, nu se lipeste de continut */
.content > h1 + p.hint, .content > h1 + .hint { margin-bottom: 22px; max-width: 72ch; }

p { margin: 0 0 12px; }

a { color: var(--brand); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

::selection { background: var(--brand-wash); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.mono, .num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   App shell — sidebar on desktop, bottom tab bar on phone
   ========================================================================== */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  /* sidebar-ul e semi-transparent: luminile colorate ale fundalului trec usor prin el */
  background:
    linear-gradient(180deg, var(--accent-iris-wash) 0%, transparent 220px),
    color-mix(in srgb, var(--surface) 82%, transparent);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 0 18px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 22px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--mark-gradient);
  box-shadow: 0 6px 18px -6px rgba(76, 201, 240, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark svg { width: 16px; height: 16px; }

.nav-items { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }

/* Selectorul de magazin (base.html) — vizibil doar cand contul vede mai multe magazine */
.store-select { display: flex; flex-direction: column; gap: 4px; }
.store-select-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.store-select select {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  cursor: pointer;
}
.store-select select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.store-select-sidebar { padding: 0 20px 18px; }
.store-select-mobile { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.8; }

.nav-link:hover { background: var(--surface-sunken); color: var(--ink); }

/* pagina curenta: fundal tentat + o bara scurta de semnal pe margine, acelasi limbaj ca randurile din tabele */
.nav-link.active {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-iris) 26%, transparent) 0%, color-mix(in srgb, var(--accent-sky) 10%, transparent) 100%);
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-iris) 22%, transparent);
}
.nav-link.active svg { color: var(--accent-iris); opacity: 1; }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-mint), var(--accent-iris));
}

.nav-footer { margin-top: auto; padding: 14px 12px 0; }

.nav-link.logout { color: var(--destructive); }
.nav-link.logout:hover { background: var(--destructive-wash); }

.content {
  flex: 1;
  min-width: 0;
  padding: 34px 36px 72px;
  max-width: 1800px;
}

.topbar-mobile { display: none; }
.bottom-nav { display: none; }

/* ==========================================================================
   Buttons
   ========================================================================== */

button, .btn {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
  background: var(--surface-sunken);
  color: var(--ink);
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* constructive — the "yes, grow this" action: solid brand fill */
button.primary, .btn-constructive {
  background: var(--constructive);
  color: var(--on-brand);
  border-color: var(--constructive);
}
button.primary:hover, .btn-constructive:hover { background: var(--constructive-hover); border-color: var(--constructive-hover); }
button.primary, .btn-constructive {
  background: var(--brand-gradient);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 8px 22px -10px color-mix(in srgb, var(--brand) 80%, transparent);
}
button.primary:hover, .btn-constructive:hover { filter: brightness(1.08); background: var(--brand-gradient); border-color: transparent; }

/* destructive — the "stop / undo" action: outlined, not filled, so it never
   reads as the default choice; deliberately quieter than the constructive fill */
button.danger, .btn-destructive {
  background: transparent;
  color: var(--destructive);
  border-color: color-mix(in srgb, var(--destructive) 35%, transparent);
}
button.danger:hover, .btn-destructive:hover { background: var(--destructive-wash); border-color: var(--destructive); }

button.secondary, .btn-ghost, a.secondary {
  background: var(--surface);
  color: var(--ink-soft);
  border-color: var(--border-strong);
}
/* link stilizat ca buton (ex. „Descarca raport (Excel)") */
a.secondary {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}
a.secondary:hover { background: var(--surface-sunken); color: var(--ink); }
a.small.secondary { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
button.secondary:hover, .btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }

button.small, .btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }

/* ==========================================================================
   Cards & stat tiles
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  max-width: 720px;
  box-shadow: var(--shadow-card);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card { background: linear-gradient(180deg, color-mix(in srgb, var(--accent-sky) 4%, transparent) 0%, transparent 140px), var(--surface); }

/* Dialog de confirmare in-page (2026-08-17) — inlocuieste native confirm()/alert(), care
   blocheaza complet fila in unele medii de automatizare a browser-ului (extensia Claude in
   Chrome confirmat) si, mai general, sunt greu de stilizat/testat. showConfirmDialog() din
   generator.js construieste acest markup dinamic — clasele de mai jos doar il stilizeaza,
   reutilizand .card/button.primary/button.secondary de mai sus, nimic nou din punct de vedere
   vizual. z-index 100, peste orice alt element fixed din pagina (bottom-nav/topbar la 20-30). */
.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 10, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.confirm-dialog-box {
  max-width: 440px;
  width: 100%;
}
.confirm-dialog-message {
  white-space: pre-wrap;
  margin: 0 0 20px;
  line-height: 1.5;
}
.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Setari — fiecare produs e un .card cu 6 sectiuni <details> (nativ HTML, colapsate implicit,
   zero JS pentru extindere/colapsare — acelasi element deja folosit o data in generator.js).
   Continutul unei sectiuni colapsate ramane in DOM (doar ascuns), deci Salveaza citeste corect
   toate campurile indiferent ce sectiuni erau extinse la momentul apasarii.

   Clasa e prefixata cu "settings-" (NU ".product-card" simplu) — exista deja un ".product-card"
   folosit de pagina Azi (today.js/today.html, cardurile de performanta per produs, cu propriile
   reguli .product-card-green/yellow/red/title/row/tabs mai jos in acest fisier) — refolosirea
   numelui simplu ar fi facut ca acele reguli sa se aplice accidental si aici (background/border-
   top colorat/padding diferit), coliziune de namespace, nu doar o suprapunere inofensiva. */
.settings-product-card details {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}
.settings-product-card details:first-of-type { border-top: none; padding-top: 4px; }
.settings-product-card details[open] { padding-bottom: 14px; }
.settings-product-card summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}
.settings-product-card summary:hover { color: var(--brand); }
.settings-product-card details > *:not(summary):first-of-type { margin-top: 12px; }
.settings-product-card-actions { display: flex; gap: 8px; margin-top: 16px; }

/* Dropdown "Selecteaza produs" -> arata DOAR cardul produsului ales, restul raman in DOM cu
   [hidden] (vezi showProductCard() in settings.js) — datele necompletate/nesalvate din alt
   produs nu se pierd la navigare intre carduri, doar se ascund vizual.
   Verificat: NICIUN fix suplimentar de specificitate nu e necesar aici (spre deosebire de
   .field[hidden]/.grid-2[hidden] mai sus, care aveau nevoie de el) — nici .card, nici
   .settings-product-card nu declara propriul `display`, deci UA stylesheet-ul (`[hidden] {
   display: none }`) ramane necontestat de vreo regula author cu specificitate egala. */

/* Generator Reclame unificat — dropdown "Tip reclama" arata o singura sectiune o data.
   Sectiunile inactive raman in DOM (display:none), nu sterse — starea din formulare nu se
   pierde la comutare intre tab-uri. Tranzitie simpla la afisare, nu bruscata. */
.generator-top { margin-bottom: 20px; }
.generator-section { display: none; }
.generator-section.active {
  display: block;
  animation: generator-fade-in 0.2s ease;
}
@keyframes generator-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

/* Product Hub — cele doua blocuri Meta/Real stau unul langa altul (jumatate de latime), unde
   auto-fit cu minmax(140px,1fr) lasa o celula goala pe randul cu numar impar de cifre (5 tile-uri
   in ~450px => 3 coloane, ultimul rand cu 2 tile-uri + 1 gol). 2 coloane fixe evita golul. */
.stat-strip.is-compact { grid-template-columns: repeat(2, 1fr); }

/* Fiecare card cu cifra primeste o culoare de accent dupa pozitie (violet, azur, menta, apoi
   din nou) — aceeasi ordine pe Azi, Rapoarte si Produse (Spend, Conversii, Revenue, ROAS, CPA),
   deci aceeasi cifra are aceeasi culoare peste tot. Culoarea sta pe lumina din colt, pe bulina
   de langa eticheta si pe linia de sus; cifra ramane alba (sau verde/rosu cand are semnal). */
.stat-tile {
  --tile-accent: var(--accent-iris);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(320px 170px at 0% 0%, color-mix(in srgb, var(--tile-accent) 26%, transparent), transparent 72%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--tile-accent) 22%, var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.stat-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--tile-accent), transparent 90%);
}
.stat-tile:nth-child(3n+2) { --tile-accent: var(--accent-sky); }
.stat-tile:nth-child(3n+3) { --tile-accent: var(--accent-mint); }

.stat-tile .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.stat-tile .stat-label::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tile-accent);
  box-shadow: 0 0 10px var(--tile-accent);
  margin-right: 8px;
  vertical-align: 1px;
}

.stat-tile .stat-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
}

.stat-tile.is-profit .stat-value { color: var(--profit); }
.stat-tile.is-loss .stat-value { color: var(--loss); }
/* profit / pierdere estimata pe card si in tabelul cu magazine (2026-11-08) */
.product-card-row.is-profit strong, td.is-profit { color: var(--profit); }
.product-card-row.is-loss strong, td.is-loss { color: var(--loss); }
.text-profit { color: var(--profit); }
.text-loss { color: var(--loss); }

.stat-tile.is-text .stat-value {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
}

.status-value { display: inline-flex; align-items: center; }

/* ==========================================================================
   Forms
   ========================================================================== */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.grid-2[hidden] { display: none; } /* .grid-2 {display:grid} altfel bate stilul UA implicit pt [hidden], acelasi caz ca .field[hidden] mai jos */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.grid-2 .field { margin-bottom: 0; }
.field[hidden] { display: none; } /* .field {display:flex} altfel bate stilul UA implicit pt [hidden] */

label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }

input[type=text], input[type=number], input[type=password], input[type=date], input[type=time],
input[type=email], input[type=search], input[type=url], select, textarea {
  padding: 9px 12px;
  min-height: var(--control-h);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input[type=date], input[type=time] { color-scheme: light dark; }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) { border-color: var(--ink-faint); }
textarea { min-height: 0; }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--brand); }

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-wash);
}

textarea.text-box { margin-bottom: 8px; resize: vertical; }

.audio-tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.audio-tag-btn { font-family: var(--font-mono); }

/* Variante de text per segment (Hook/Body/CTA) — Video Clasic, vezi generator.js */
.segment-variant-controls { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.variant-count-input { width: 56px; }
.variant-tab-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.variant-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  background: var(--surface);
}
.variant-tab.active { border-color: var(--brand); background: var(--brand-wash); }
.variant-tab input[type="checkbox"] { margin: 0; }
.variant-tab-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.82rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-tab.active .variant-tab-btn { color: var(--brand); font-weight: 600; }

.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.checkbox input { width: auto; }

.notice {
  background: var(--warning-wash);
  border: 1px solid var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--warning);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0 0 14px;
}

.notice.notice-success {
  background: var(--profit-wash);
  border-color: var(--profit);
  color: var(--profit);
}

.notice.notice-error {
  background: var(--loss-wash);
  border-color: var(--loss);
  color: var(--loss);
}

.hint { color: var(--ink-faint); font-weight: 400; font-size: 0.83rem; }

.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.drop-zone.drag-over { border-color: var(--brand); background: var(--brand-wash); }
.drop-zone.uploading { opacity: 0.6; }
.link-like { color: var(--brand); text-decoration: underline; font-weight: 600; }

.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

/* Preview-uri de imagine ale persoanei (Generator UGC, Pas 0) — o singura regula pentru
   ambele stari (generata / confirmata), ca sa nu poata diverge din nou (bug: preview-ul
   de upload manual nu avea limitare si se intindea pe tot ecranul). max-height, nu doar
   max-width — o poza foarte inalta (portret de telefon) tot trebuie plafonata pe verticala. */
.ugc-persona-preview {
  max-width: 320px;
  max-height: 420px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
}

.ref-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.ref-thumb { position: relative; width: 84px; height: 84px; }
.ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}
.ref-thumb-selected img { border: 3px solid var(--brand); }
.ref-thumb .ref-thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--destructive, #c0392b);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Legare produse Shopify <-> product_key (Setari, Pasul 4 integrare Shopify) — randuri
   orizontale ca .voice-picker-row, dar fara starea "selected" (aici nu alegi UNUL, poti
   confirma/sterge oricate legaturi independent). */
.shopify-links, .shopify-suggestions { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.shopify-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}
.shopify-link-row img, .shopify-link-row .shopify-link-noimg {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.shopify-link-row .shopify-link-title { flex: 1; font-size: 0.9rem; }
.shopify-link-row .shopify-link-meta { font-size: 0.78rem; color: var(--ink-soft); }
.shopify-suggestions { margin-top: 10px; }
.shopify-suggestions .shopify-link-row { border: 1px dashed var(--border); background: transparent; }

/* Pasul 0 UGC/Hibrid — toggle "Full AI" / "Cu produsul real", vezi generator.js */
/* Comutator cu 2-3 optiuni (ex. Rapoarte: Raport general / per produs / Profit) — aceeasi sina
   segmentata ca selectorul de perioada: optiunea aleasa e ridicata, cu text plin. */
.persona-mode-toggle {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  padding: 3px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.persona-mode-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.persona-mode-btn:hover { color: var(--ink); }
.persona-mode-btn.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-iris) 24%, var(--surface)), color-mix(in srgb, var(--accent-sky) 12%, var(--surface)));
  border-color: color-mix(in srgb, var(--accent-iris) 40%, transparent);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.persona-mode-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.persona-product-photo-thumb img { border-color: var(--border); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.persona-product-photo-thumb.selected img { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-wash); }

.progress-panel { margin-top: 24px; }
.progress-panel ul { list-style: none; padding: 0; font-family: var(--font-mono); font-size: 0.82rem; }
.progress-panel li { padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--ink-soft); }

/* ==========================================================================
   Tables — dense on desktop, real cards on phone (not a shrunk table)
   ========================================================================== */

/* Tabelul sta intr-un chenar rotunjit (.table-wrap) — colturile se taie curat, iar pe ecrane
   inguste tabelul deruleaza in interiorul chenarului, nu impinge pagina lateral. */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  margin-bottom: 8px;
}
.table-wrap > table { border: none; border-radius: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

th, td {
  text-align: left;
  padding: 12px 9px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  white-space: normal;
  vertical-align: top;
}
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }

th {
  background: var(--surface-sunken);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--ink-soft);
  white-space: nowrap;
  vertical-align: bottom;
}

/* antetul tabelului: o singura banda colorata pe tot randul (nu cate un gradient pe fiecare celula) */
thead tr {
  background:
    linear-gradient(90deg, var(--accent-iris-wash), color-mix(in srgb, var(--accent-sky) 7%, transparent) 60%, transparent),
    var(--surface-sunken);
}
thead th { background: transparent; }

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s var(--ease); }
tbody tr:hover td { background: var(--surface-sunken); }

/* numbers stay on one line so columns of figures line up; prose columns
   (family/campaign name, reason, recommendation) wrap so the table fits
   without horizontal scroll instead of forcing every column wide */
td.num, td.mono, td.nowrap { white-space: nowrap; }

/* signal rail — the leading edge tells you profit/loss before you read a digit */
table.signal-table tbody tr { border-left: 4px solid transparent; }
table.signal-table tbody tr.signal-profit { border-left-color: var(--profit); background: var(--profit-wash); background: color-mix(in srgb, var(--profit-wash) 55%, transparent); }
table.signal-table tbody tr.signal-loss { border-left-color: var(--loss); background: var(--loss-wash); background: color-mix(in srgb, var(--loss-wash) 55%, transparent); }
table.signal-table tbody tr.signal-warning { border-left-color: var(--warning); background: var(--warning-wash); background: color-mix(in srgb, var(--warning-wash) 55%, transparent); }
table.signal-table tbody tr.signal-neutral { border-left-color: var(--border-strong); }

/* locked rows are set aside from the automatic kill/restart flow — a muted,
   dashed treatment that reads as "parked" regardless of the profit/loss rail */
table.signal-table tbody tr.row-locked {
  border-left-color: var(--ink-faint);
  border-left-style: dashed;
  background: var(--surface-sunken);
}
table.signal-table tbody tr.row-locked td { opacity: 0.8; }

/* final-stop rows: a family that hit the hard-stop rules (report.evaluate_family_shutdown) —
   deliberately a heavier, darker rail than the regular loss red so it reads as a distinct,
   more severe signal at a glance. Wins over .signal-loss since it's declared after it. */
table.signal-table tbody tr.row-final-stop {
  border-left-color: var(--stop-final);
  border-left-width: 6px;
  background: var(--stop-final-wash);
  background: color-mix(in srgb, var(--stop-final-wash) 55%, transparent);
}

.lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-faint);
  margin-top: 3px;
}

.family-verdict {
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.35;
}
.family-verdict-stop { color: var(--stop-final); }
.family-verdict-warn { color: var(--warning); }
.family-verdict-stable { color: var(--profit); }

td.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* pe desktop: numele familiei/campaniei nu se mai rupe pe 3-4 randuri */
@media (min-width: 881px) {
  table td.card-title { min-width: 160px; font-weight: 600; overflow-wrap: anywhere; }
}

/* Interval personalizat (Rapoarte): cele doua date + butonul pe acelasi rand */
.period-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.period-custom .field { margin-bottom: 0; flex: 0 1 230px; }
@media (max-width: 880px) { .period-custom .field { flex: 1 1 140px; } .period-custom button { flex: 1 1 100%; } }

/* visually discouraged but still clickable — the extra confirm step lives in JS, not here */
.btn-muted-disabled {
  background: transparent;
  color: var(--ink-faint);
  border-color: var(--border);
}
.btn-muted-disabled:hover { background: var(--surface-sunken); color: var(--ink-soft); }

.mini-chart { font-family: var(--font-num); font-size: 0.76rem; color: var(--ink-faint); white-space: normal; margin-top: 6px; line-height: 1.45; }

/* ==========================================================================
   Recommendation cards (Campanii azi)
   ========================================================================== */

.recommendations { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }

.recommendation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recommendation-card.tier-profit { border-left-color: var(--profit); }
.recommendation-card.tier-loss { border-left-color: var(--loss); }
.recommendation-card.tier-warning { border-left-color: var(--warning); }

.recommendation-card .rec-message { font-size: 0.92rem; line-height: 1.5; color: var(--ink); }
.recommendation-card .rec-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 880px) {
  .recommendation-card .rec-actions { flex-direction: column; }
  .recommendation-card .rec-actions button { width: 100%; }
}

/* ==========================================================================
   Product cards + day verdict (Campanii azi — analiza pe produs)
   ========================================================================== */

.product-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.product-card-green { border-top-color: var(--profit); background: color-mix(in srgb, var(--profit-wash) 35%, var(--surface)); }
.product-card-yellow { border-top-color: var(--warning); background: color-mix(in srgb, var(--warning-wash) 35%, var(--surface)); }
.product-card-red { border-top-color: var(--loss); background: color-mix(in srgb, var(--loss-wash) 35%, var(--surface)); }
/* neutral = fara cheltuiala atribuita, deci fara verdict de performanta (nu "slab") */
.product-card-neutral { border-top-color: var(--border-strong); background: var(--surface); }

.product-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 10px;
}

.product-card-row {
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.product-card-row span {
  font-weight: 600;
  color: var(--ink-faint);
  font-size: 0.78rem;
  margin-right: 4px;
}

.product-card-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.product-card-tab {
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
}

.product-card-tab.active {
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
}

.product-card-compare {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-style: italic;
  margin-top: 6px;
}

.product-card-diagnostics { margin-top: 10px; }

.product-card-diagnostic {
  font-size: 0.82rem;
  color: var(--ink);
  padding: 7px 0;
  border-top: 1px dashed var(--border);
  line-height: 1.5;
}

.diagnostic-verdict {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--destructive-wash);
  color: var(--destructive);
  margin-right: 6px;
  white-space: nowrap;
}

.day-verdict {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 14px;
}

.day-verdict-profit { background: var(--profit-wash); color: var(--profit); }
.day-verdict-loss { background: var(--loss-wash); color: var(--loss); }

/* ==========================================================================
   Tags & chips
   ========================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.tag-profit { background: var(--profit-wash); color: var(--profit); }
.tag-loss { background: var(--loss-wash); color: var(--loss); }
.tag-warning { background: var(--warning-wash); color: var(--warning); }
.tag-neutral { background: var(--neutral-wash); color: var(--neutral); }

.category-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.category-heading .count { color: var(--ink-faint); font-family: var(--font-num); font-weight: 500; font-size: 0.95rem; }

.keyword-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 180px; }
.keyword-chip {
  background: var(--surface-sunken);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.keyword-chip button {
  background: none;
  border: none;
  padding: 2px 4px;
  color: var(--ink-faint);
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  font-size: 0.9rem;
}
.keyword-chip button:hover { color: var(--destructive); }
.keyword-add-input { width: 96px; padding: 5px 10px; border: 1px dashed var(--border-strong); border-radius: var(--radius-pill); font-size: 0.8rem; background: transparent; }

/* ==========================================================================
   Status indicators (settings page)
   ========================================================================== */

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-faint);
  margin-right: 7px;
  flex-shrink: 0;
}

.status-ok { color: var(--profit); }
.status-ok .status-dot { background: var(--profit); box-shadow: 0 0 0 3px var(--profit-wash); }
.status-bad { color: var(--loss); }
.status-bad .status-dot { background: var(--loss); box-shadow: 0 0 0 3px var(--loss-wash); }

/* ==========================================================================
   Misc: sync bar, period selector, totals
   ========================================================================== */

.sync-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  flex-wrap: wrap;
}

/* Selector de perioada = un singur control segmentat: o sina adancita, optiunea aleasa ridicata
   deasupra ei. Acelasi aspect pentru link-uri (Rapoarte) si pentru butoane (.today-period). */
.period-selector, .today-period, .segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 100%;
  flex-wrap: wrap;
}
.period-selector { margin-bottom: 20px; }
.period-selector a, .today-period .persona-mode-btn, .segmented .persona-mode-btn {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.3;
}
.period-selector a:hover, .today-period .persona-mode-btn:hover:not(.active), .segmented .persona-mode-btn:hover:not(.active) { color: var(--ink); background: transparent; }
.period-selector a.active, .today-period .persona-mode-btn.active, .segmented .persona-mode-btn.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-iris) 24%, var(--surface)), color-mix(in srgb, var(--accent-sky) 12%, var(--surface)));
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 1px color-mix(in srgb, var(--accent-iris) 40%, transparent);
}
.period-selector a.active::before, .today-period .persona-mode-btn.active::before, .segmented .persona-mode-btn.active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
  margin-right: 7px;
  vertical-align: 2px;
}

.totals { margin-top: 24px; max-width: none; }

/* ==========================================================================
   Asistent — chat
   ========================================================================== */

.chat-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chat-page-header .hint { max-width: 560px; }

.chat-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: min(640px, calc(100vh - 260px));
  min-height: 380px;
  overflow: hidden;
}

.chat-shell.is-disabled { opacity: 0.65; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-empty {
  margin: auto;
  max-width: 320px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant { justify-content: flex-start; }

.chat-bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.55;
}

.chat-msg-user .chat-bubble {
  background: var(--brand);
  color: var(--on-brand);
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant .chat-bubble {
  background: var(--surface-sunken);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.chat-bubble-error {
  background: var(--destructive-wash) !important;
  color: var(--destructive) !important;
}

.chat-bubble-thinking {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-faint);
  font-style: italic;
}

.chat-thinking-dots { display: inline-flex; gap: 3px; }
.chat-thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: chatThinkBounce 1.2s infinite ease-in-out;
}
.chat-thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatThinkBounce {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.chat-bullet { display: inline-block; }

.chat-suggested {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.chip-suggestion {
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.chip-suggestion:hover:not(:disabled) {
  background: var(--brand-wash);
  color: var(--brand-strong);
  border-color: var(--brand);
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.chat-textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  background: var(--surface);
  color: var(--ink);
}

.chat-textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-wash);
}

.chat-send-btn { flex-shrink: 0; }

.chat-usage {
  margin-top: 10px;
  text-align: right;
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.chat-truncated-note {
  align-self: center;
  font-size: 0.72rem;
  color: var(--ink-faint);
  background: var(--surface-sunken);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

@media (max-width: 880px) {
  .chat-shell { height: min(560px, calc(100vh - 300px)); }
  .chat-bubble { max-width: 88%; }
}

/* ==========================================================================
   Login
   ========================================================================== */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--bg);
  padding: 20px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 40px 36px;
  border-radius: var(--radius-lg);
  width: 340px;
  max-width: 100%;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.login-box .brand-mark { margin: 0 auto 18px; width: 44px; height: 44px; border-radius: 12px; }
.login-box .brand-mark svg { width: 22px; height: 22px; }
.login-box h1 { margin-top: 0; }
.login-box form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.login-box button { margin-top: 2px; }
.login-box .error {
  color: var(--destructive);
  font-size: 0.85rem;
  background: var(--destructive-wash);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Responsive: phone gets a bottom tab bar + card-style data rows,
   not a table squeezed down to fit
   ========================================================================== */

@media (max-width: 880px) {
  .layout { flex-direction: column; }
  .sidebar { display: none; }

  .topbar-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 16px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .topbar-mobile .brand-mark { width: 26px; height: 26px; border-radius: 7px; }
  .topbar-mobile .brand-mark svg { width: 14px; height: 14px; }
  .topbar-mobile .brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1rem; letter-spacing: -0.02em; }
  .topbar-mobile .topbar-logout {
    margin-left: auto;
    display: flex;
    color: var(--ink-faint);
  }
  .topbar-mobile .topbar-logout svg { width: 19px; height: 19px; }
  .topbar-mobile .store-select-mobile { display: flex; margin-left: auto; min-width: 0; flex: 0 1 180px; }
  .topbar-mobile .store-select-mobile .store-select-label { display: none; }
  .topbar-mobile .store-select-mobile select { padding: 5px 8px; font-size: 0.82rem; }
  .topbar-mobile .store-select-mobile + .topbar-logout { margin-left: 4px; }

  .content { padding: 22px 16px calc(var(--bottom-nav-h) + 40px); max-width: 100%; }

  /* Bara de jos are cate un buton pentru FIECARE pagina la care contul are acces (pot fi 10+).
     Inainte era o grila fixa de 5 coloane — restul paginilor cadeau pe randuri ascunse sub ecran.
     Acum e un sir orizontal care se deruleaza cu degetul; pagina curenta e adusa in vizor din
     base.html, iar marginea din dreapta se estompeaza ca semn ca mai sunt butoane. */
  .bottom-nav {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 30;
    padding: 0 4px env(safe-area-inset-bottom);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .bottom-nav::-webkit-scrollbar { display: none; }

  .bottom-nav a {
    flex: 0 0 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 2px;
    color: var(--ink-faint);
    text-decoration: none;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    min-width: 0;
  }

  .bottom-nav a svg { width: 22px; height: 22px; padding: 3px 12px; box-sizing: content-box; border-radius: var(--radius-pill); }
  .bottom-nav a.active { color: var(--ink); }
  .bottom-nav a.active svg { color: var(--accent-iris); background: var(--accent-iris-wash); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-iris) 25%, transparent); }

  .grid-2 { grid-template-columns: 1fr; }
  .card { max-width: 100%; }

  h1 { font-size: 1.375rem; }

  .stat-strip { grid-template-columns: repeat(2, 1fr); }

  /* --- table -> card transform --- */
  .table-wrap.responsive-cards { overflow-x: visible; border: none; background: transparent; box-shadow: none; border-radius: 0; }

  table.responsive-cards { border: none; background: transparent; }
  table.responsive-cards thead { display: none; }

  table.responsive-cards tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  table.responsive-cards tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 6px 14px;
    box-shadow: var(--shadow-card);
  }

  table.responsive-cards.signal-table tr.signal-profit { border-left-color: var(--profit); background: var(--profit-wash); background: color-mix(in srgb, var(--profit-wash) 45%, var(--surface)); }
  table.responsive-cards.signal-table tr.signal-loss { border-left-color: var(--loss); background: var(--loss-wash); background: color-mix(in srgb, var(--loss-wash) 45%, var(--surface)); }
  table.responsive-cards.signal-table tr.signal-warning { border-left-color: var(--warning); background: var(--warning-wash); background: color-mix(in srgb, var(--warning-wash) 45%, var(--surface)); }
  table.responsive-cards.signal-table tr.row-final-stop { border-left-color: var(--stop-final); border-left-width: 6px; background: var(--stop-final-wash); background: color-mix(in srgb, var(--stop-final-wash) 45%, var(--surface)); }

  table.responsive-cards td, table.responsive-cards td:first-child, table.responsive-cards td:last-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    white-space: normal;
    text-align: right;
  }

  table.responsive-cards td:last-child { border-bottom: none; }

  table.responsive-cards td::before {
    content: attr(data-label);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-faint);
    text-align: left;
    flex-shrink: 0;
  }

  /* primary identifying cell (name/family) reads as a card title, not a row */
  table.responsive-cards td.card-title {
    padding-top: 14px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    justify-content: flex-start;
    text-align: left;
  }
  table.responsive-cards td.card-title::before { display: none; }

  table.responsive-cards td.actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 14px;
    text-align: left;
  }
  table.responsive-cards td.actions::before { display: none; }
  table.responsive-cards td.actions button { width: 100%; }
  /* extra breathing room before the destructive action so a thumb scrolling
     past the constructive button can't clip it by accident */
  table.responsive-cards td.actions button.danger { margin-top: 6px; }
}

@media (max-width: 420px) {
  .content { padding: 16px 12px 96px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Video (biblioteca B-roll, generator, rezultate)
   ========================================================================== */

.broll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.broll-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.broll-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--surface-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
}

.broll-thumb img, .broll-thumb video { width: 100%; height: 100%; object-fit: cover; }
.broll-thumb-empty { color: var(--ink-faint); font-size: 0.78rem; padding: 8px; text-align: center; }

.broll-meta { padding: 8px 10px; }
.broll-filename {
  font-size: 0.76rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.broll-filename .badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brand-wash);
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 600;
  margin-right: 4px;
}

.broll-card button, .broll-actions { margin: 0 10px 10px; }
.broll-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.broll-actions a { flex: 1 1 calc(50% - 6px); min-width: 0; text-align: center; }

.broll-card-selectable { cursor: pointer; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.broll-card-selectable:hover { border-color: var(--brand); }
.broll-card-selectable.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-wash); }

.broll-order-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--font-num);
  font-size: 0.76rem;
  font-weight: 600;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pagina Rezultate — toolbar + grupare produs/tip, vezi video_results.js */
.results-toolbar { max-width: none; margin-bottom: 20px; }
.results-toolbar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.results-toolbar-row + .results-toolbar-row { margin-top: 12px; }
.results-toolbar-spacer { flex: 1; }

.results-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.results-filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.results-filter-label select { max-width: 200px; }

.results-product-group { max-width: none; margin-bottom: 20px; }
.results-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.results-group-header strong { font-size: 1.05rem; }

.results-type-group + .results-type-group { margin-top: 18px; }
.results-type-header { margin-bottom: 8px; }
.results-type-header .results-select-all { font-weight: 600; color: var(--ink-soft); font-size: 0.82rem; }

/* .broll-card e inclus aici pentru selectia multipla din Biblioteca B-roll — acelasi checkbox
   plutitor ca in pagina Rezultate, vezi broll.js */
.result-card, .broll-card { position: relative; }
.result-card-select {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 3px;
  box-shadow: var(--shadow-card);
  display: flex;
}
.result-card-select input { margin: 0; }

.upload-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-sunken);
  border-radius: var(--radius-pill);
  margin-left: 12px;
  overflow: hidden;
}
.upload-progress-fill { height: 100%; background: var(--brand); width: 0%; transition: width 0.15s var(--ease); }
.file-list li.upload-done .upload-progress-fill { background: var(--profit); }
.file-list li.upload-error .upload-progress-fill { background: var(--loss); }

.job-progress-bar {
  height: 10px;
  background: var(--surface-sunken);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 10px 0 6px;
}
.job-progress-fill { height: 100%; background: var(--brand); width: 0%; transition: width 0.4s var(--ease); }

.voice-speed-row { display: flex; align-items: center; gap: 10px; }
.voice-speed-row input[type="range"] { flex: 1; }
.voice-speed-row span { min-width: 46px; }

.voice-picker { position: relative; }
.voice-picker-toggle { width: 100%; text-align: left; }
.voice-picker-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
}

.voice-picker-group {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-faint);
  padding: 8px 10px 4px;
}

.voice-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.voice-picker-row:hover { background: var(--surface-sunken); }
.voice-picker-row.selected { background: var(--brand-wash); }
.voice-picker-row .voice-name { flex: 1; }
.voice-star {
  background: none;
  border: none;
  padding: 0;
  font-size: 1.05rem;
  color: var(--warning);
  cursor: pointer;
  line-height: 1;
}
.voice-star:hover { transform: scale(1.15); }

.voice-picker-row-wrap + .voice-picker-row-wrap { margin-top: 2px; }
.voice-settings-panel {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 10px 8px 34px;
  cursor: default;
}
.voice-setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--ink-faint);
  cursor: default;
}
.voice-setting-label { min-width: 58px; }
.voice-setting-row input[type="range"] { flex: 1; height: 14px; }
.voice-setting-value { min-width: 32px; text-align: right; }

/* ===== Calcul per comanda / Test produs (order_calc.html) ===== */
.oc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.oc-table th, .oc-table td { padding: 8px 10px; border-bottom: 1px solid var(--border, #e3e8e5); text-align: left; }
.oc-table th { font-size: 0.76rem; color: var(--ink-soft); }
.oc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.oc-table tr.oc-revenue td { font-weight: 600; }
.oc-table tr.oc-total td { font-weight: 700; border-top: 2px solid var(--border, #e3e8e5); }
/* tabelul de rezultat are 7 coloane — .card global e limitat la 720px, prea ingust aici;
   largirea e scoped la pagina asta, restul aplicatiei ramane neatins */
#ocResults .card { max-width: 1100px; }
.oc-ok { color: var(--profit); font-weight: 600; }
.oc-fail { color: var(--loss); font-weight: 700; }

/* Setari -> Magazine (stores_admin.js) */
.stores-list { display: grid; gap: 12px; }
.store-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; }
.store-card-head .hint { overflow-wrap: anywhere; min-width: 0; }
.stores-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.stores-form input[readonly] { color: var(--ink-soft); background: var(--surface-sunken); }
.store-command { display: inline-block; max-width: 100%; overflow-wrap: anywhere; user-select: all; }
.stores-form .checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }

/* Comutatorul Meta / TikTok / Toate (pagina Azi, Rapoarte) si eticheta de platforma pe rand */
.platform-toggle[hidden], .platform-toggle [hidden] { display: none; }
.platform-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-right: 4px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: 1px;
  background: var(--surface-sunken);
  color: var(--ink-soft);
}
.platform-badge.platform-meta { background: var(--brand-wash); color: var(--brand); }
.platform-badge.platform-tiktok { background: var(--warning-wash); color: var(--warning); }
.tiktok-box { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.tiktok-box summary { cursor: pointer; }
.launch-defaults-row { display: grid; grid-template-columns: 70px repeat(2, minmax(140px, 220px)); gap: 0 14px; align-items: center; }
@media (max-width: 560px) { .launch-defaults-row { grid-template-columns: 1fr 1fr; } .launch-defaults-row > strong { grid-column: 1 / -1; margin-top: 8px; } }
.tiktok-steps { padding-left: 18px; line-height: 1.7; }
.tiktok-errors { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.tiktok-mode-field { max-width: 640px; } .praguri-tabs { margin-bottom: 14px; }

/* Meniul pe grupuri (2026-10-21): titluri mici intre sectiuni, link-uri putin mai compacte. */
.nav-items { gap: 0; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group + .nav-group { margin-top: 10px; }
.nav-group-label {
  padding: 6px 10px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.nav-group .nav-link { padding: 7px 10px; font-size: 0.88rem; }

/* Conturi de reclame in pagina Azi (16.11.2026) */
#accountsStrip { margin: 12px 0; }
.accounts-head { font-weight: 600; margin-bottom: 6px; }
.accounts-row { display: flex; flex-wrap: wrap; gap: 8px; }
.account-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 12px; border: 1px solid var(--border, #d0d5dd); border-radius: 10px;
  background: var(--surface, #fff); color: inherit; cursor: pointer; text-align: left; min-width: 150px;
}
.account-chip.active { border-color: var(--brand); background: var(--brand-wash); }
.account-name { font-weight: 600; font-size: 0.92rem; }
.account-sub { font-size: 0.8rem; opacity: 0.8; }
.account-warn { font-size: 0.75rem; color: var(--warning); }
.account-main { font-size: 0.7rem; font-weight: 500; padding: 0 6px; border-radius: 6px;
  background: var(--brand-wash); color: var(--brand); }
.account-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 6px; margin-right: 4px;
  border-radius: 6px; background: var(--warning-wash); color: var(--warning); vertical-align: middle;
}
/* 17.11.2026: unde poate pune reclame media buyerul */
.account-chip { min-width: 220px; max-width: 300px; }
.account-chip.cannot-run { opacity: 0.75; border-style: dashed; }
.account-run { font-size: 0.78rem; font-weight: 600; }
.account-run.ok { color: var(--profit); }
.account-run.no { color: var(--loss); }
.accounts-ready { margin: 2px 0 8px; }
