:root { color-scheme:light; --bg:#f5f6f8; --card:#fff; --ink:#1d2330; --muted:#6b7280; --line:#e3e6eb; --accent:#2563eb; --warn:#fff7db; --warn-line:#f0c34e;
  --head:#1d2330; --topbar:#11151d; --hover:#f0f5ff; --img-bg:#eee; --track:#e8ebf0; --chip:#eef2f8; --flash:#e0ecff; --flash-line:#9bbcf5; --badge:#1d2330; --input:#fff; --drop-line:#b8c0cc; --err:#b91c1c; --ok-bg:#e9f8ef; --ok-line:#4caf72; --ok-ink:#15803d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme:dark; --bg:#12151b; --card:#1b2029; --ink:#e6e9ef; --muted:#9aa3b2; --line:#2e3542; --accent:#3b82f6; --warn:#3a3214; --warn-line:#a8862a;
    --head:#0d1016; --topbar:#080a0e; --hover:#1e2a40; --img-bg:#262c37; --track:#262c37; --chip:#252b36; --flash:#1d2b45; --flash-line:#36548a; --badge:#3b4453; --input:#141820; --drop-line:#465061; --err:#f87171; --ok-bg:#16301f; --ok-line:#2f7d4c; --ok-ink:#4ade80; }
}
:root[data-theme="dark"] { color-scheme:dark; --bg:#12151b; --card:#1b2029; --ink:#e6e9ef; --muted:#9aa3b2; --line:#2e3542; --accent:#3b82f6; --warn:#3a3214; --warn-line:#a8862a;
  --head:#0d1016; --topbar:#080a0e; --hover:#1e2a40; --img-bg:#262c37; --track:#262c37; --chip:#252b36; --flash:#1d2b45; --flash-line:#36548a; --badge:#3b4453; --input:#141820; --drop-line:#465061; --err:#f87171; --ok-bg:#16301f; --ok-line:#2f7d4c; --ok-ink:#4ade80; }
* { box-sizing: border-box; }
body { margin:0; font-family: "Segoe UI", system-ui, sans-serif; background:var(--bg); color:var(--ink); }
.top { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:12px 24px; background:var(--head); color:#fff; }
.topbar { background:var(--topbar); color:#cbd2dc; font-size:13px; padding:5px 24px; display:flex; justify-content:flex-end; }
.topbar-right { display:flex; align-items:center; gap:18px; }
.tb-theme { display:flex; align-items:center; gap:6px; }
.topbar select { width:auto; padding:2px 6px; font-size:13px; background:#1f2530; color:#e6e9ef; border-color:#3a4252; }
.langs { display:flex; border:1px solid #3a4252; border-radius:6px; overflow:hidden; }
.langs a { color:#cbd2dc; text-decoration:none; padding:2px 10px; font-weight:600; }
.langs a + a { border-left:1px solid #3a4252; }
.langs a:hover { background:#1f2530; color:#fff; }
.langs a.active { background:var(--accent); color:#fff; }
.brand { color:#fff; text-decoration:none; font-weight:600; font-size:18px; }
.dest { font-size:13px; opacity:.75; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
main { max-width:1200px; margin:24px auto; padding:0 16px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:20px 24px; margin-bottom:20px; }
h1 { margin:0 0 8px; font-size:22px; } h2 { margin:0 0 10px; font-size:17px; }
.muted { color:var(--muted); } .small { font-size:12px; }
.warn { background:var(--warn); border:1px solid var(--warn-line); padding:8px 12px; border-radius:6px; }
.err { color:var(--err); }
.flash { background:var(--flash); border:1px solid var(--flash-line); padding:10px 14px; border-radius:6px; margin-bottom:16px; }
.hidden { display:none !important; }
.drop { display:block; border:2px dashed var(--drop-line); border-radius:10px; padding:36px; text-align:center; cursor:pointer; margin:14px 0; transition:.15s; }
.drop.over, .drop:hover { border-color:var(--accent); background:var(--hover); }
.drop input { display:none; }
.thumbs { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.thumbs img { width:64px; height:64px; object-fit:cover; border-radius:4px; }
.check { display:block; margin:8px 0 14px; }
.btn { display:inline-block; background:var(--accent); color:#fff; border:0; border-radius:6px; padding:10px 18px; font-size:15px; cursor:pointer; text-decoration:none; }
.btn:disabled { opacity:.5; cursor:wait; }
.btn.ghost { background:transparent; color:var(--ink); border:1px solid var(--line); }
.cats { columns:2; margin:0; padding-left:18px; font-size:14px; } .cats li { margin-bottom:4px; break-inside:avoid; }
.toolbar { margin-top:8px; display:flex; flex-wrap:wrap; align-items:center; gap:12px 16px; }
.toolbar .btn { padding:7px 16px; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:14px; }
.item { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:10px; display:flex; flex-direction:column; gap:6px; }
.item.low { border-color:var(--warn-line); background:var(--warn); }
.item img { width:100%; height:170px; object-fit:cover; border-radius:6px; background:var(--img-bg); }
.name { font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
select { width:100%; padding:6px; font-size:14px; border-radius:6px; border:1px solid var(--line); background:var(--input); color:var(--ink); }
.toolbar select { width:auto; }
.meta { display:flex; gap:6px; align-items:flex-start; }
.badge { background:var(--badge); color:#fff; border-radius:10px; padding:1px 7px; font-size:12px; flex:none; }
.actions { margin:20px 0; display:flex; gap:10px; }
table { width:100%; border-collapse:collapse; font-size:14px; margin-top:14px; }
th, td { text-align:left; padding:6px 8px; border-bottom:1px solid var(--line); }
td .small { word-break:break-all; }
.summary { padding-left:18px; }
@media (max-width:640px) { .cats { columns:1; } }
.bar { position:relative; height:26px; background:var(--track); border-radius:13px; overflow:hidden; margin:14px 0 10px; }
.fill { height:100%; width:0; background:linear-gradient(90deg,#2563eb,#3b82f6); transition:width .4s ease; }
.bar-label { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:600; color:var(--ink); }
.stats { display:flex; flex-wrap:wrap; gap:8px 22px; font-size:14px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.chip { background:var(--chip); border:1px solid var(--line); border-radius:12px; padding:2px 10px; font-size:12px; }
.live .item img { height:120px; }
.live { grid-template-columns:repeat(auto-fill, minmax(160px, 1fr)); }

code { background:var(--chip); padding:0 4px; border-radius:4px; }
@media (max-width:640px) { .topbar, .top { padding-left:16px; padding-right:16px; } }

/* ---------- folder principal */
.destcard { border-width:2px; border-color:var(--warn-line); }
.destcard.ok { border-color:var(--ok-line); }
.destcard.bad { border-color:var(--err); }
.destcard.attention { animation:pulse 1.2s ease-in-out 3; }
@keyframes pulse { 50% { box-shadow:0 0 0 6px color-mix(in srgb, var(--warn-line) 45%, transparent); } }
.dest-warn { background:var(--warn); border:1px solid var(--warn-line); border-radius:8px; padding:10px 14px; margin-bottom:16px; }
.dest-warn p { margin:4px 0 0; }
.destcard.ok .dest-warn { background:var(--ok-bg); border-color:var(--ok-line); }
.dest-body { display:grid; grid-template-columns:minmax(220px, 300px) 1fr; gap:20px; align-items:start; }
@media (max-width:760px) { .dest-body { grid-template-columns:1fr; } }
.explorer { margin:0; border:1px solid var(--line); border-radius:8px; background:var(--input); font-size:13px; overflow:hidden; }
.ex-bar { display:flex; align-items:center; gap:5px; padding:6px 10px; background:var(--chip); border-bottom:1px solid var(--line); }
.ex-bar i { width:9px; height:9px; border-radius:50%; background:var(--drop-line); }
.ex-bar em { margin-left:auto; font-style:normal; font-size:11px; color:var(--muted); }
.ex-row { padding:3px 10px 3px 30px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ex-row.ex-root { padding-left:10px; background:var(--hover); display:flex; gap:6px; align-items:center; }
.ex-pick { margin-left:auto; color:var(--accent); font-weight:600; font-size:12px; }
.explorer figcaption { padding:6px 10px 8px; border-top:1px solid var(--line); }
.dest-input { display:flex; gap:8px; margin-top:6px; flex-wrap:wrap; }
.dest-input input { flex:1 1 260px; min-width:0; padding:8px 10px; font-size:14px; border-radius:6px; border:1px solid var(--line); background:var(--input); color:var(--ink); font-family:Consolas, monospace; }
.dest-input .btn { padding:8px 14px; font-size:14px; }
.dest-status { margin:10px 0 0; font-size:14px; }
.destcard.ok .dest-status { color:var(--ok-ink); }
.destcard.bad .dest-status { color:var(--err); }
.browser { margin-top:12px; border:1px solid var(--line); border-radius:8px; padding:10px; }
.br-head { display:flex; gap:8px; align-items:center; margin-bottom:6px; }
.br-head code { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.btn.sm { padding:4px 10px; font-size:13px; }
.okline { color:var(--ok-ink); margin-bottom:6px; }
.br-list { max-height:260px; overflow:auto; display:flex; flex-direction:column; }
.br-item { text-align:left; background:none; border:0; border-radius:4px; padding:5px 8px; font-size:14px; color:var(--ink); cursor:pointer; }
.br-item:hover { background:var(--hover); }
label.disabled { opacity:.55; }
#needfolder { margin-left:10px; }

/* ---------- grupuri similare / existente */
.note { background:var(--chip); border:1px solid var(--line); border-radius:6px; padding:8px 12px; margin:8px 0; font-size:14px; }
.imgwrap { position:relative; display:block; }
.stack-badge { position:absolute; right:6px; top:6px; background:var(--accent); color:#fff; font-weight:700; font-size:13px; border-radius:12px; padding:2px 9px; }
.item.has-group { box-shadow:4px 4px 0 -1px var(--card), 4px 4px 0 0 var(--line), 8px 8px 0 -1px var(--card), 8px 8px 0 0 var(--line); }
.simgroup { border-top:1px dashed var(--line); padding-top:6px; display:flex; flex-direction:column; gap:5px; }
.simthumbs { display:flex; flex-wrap:wrap; gap:4px; }
.simthumbs img { width:44px; height:44px; object-fit:cover; border-radius:4px; }
.simnames { word-break:break-word; }
.existing { grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); }
.item.done { opacity:.7; }
.item.done img { height:100px; }
.item .path { word-break:break-all; }

/* ---------- pagina principală pe două coloane */
main.wide { max-width:1500px; }
.split { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); gap:20px; align-items:start; }
.pane-right { position:sticky; top:16px; }
@media (max-width:980px) { .split { grid-template-columns:1fr; } .pane-right { position:static; } }
.split .dest-body { grid-template-columns:1fr; }
.split .explorer { max-width:340px; }
.step { display:flex; align-items:center; gap:10px; font-size:18px; font-weight:600; margin-bottom:12px; }
.step .num { width:28px; height:28px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:var(--accent); color:#fff; font-size:15px; flex:none; }
.destcard.ok .step .num { background:var(--ok-line); }
.step-ok { display:none; color:var(--ok-ink); }
.destcard.ok .step-ok { display:inline; }
.pane-right .card > h1 { display:none; }
.lockmsg { background:var(--chip); border:1px dashed var(--drop-line); border-radius:8px; padding:10px 14px; margin-bottom:12px; font-size:14px; }
.pane-right.locked form, .pane-right.locked .card > p { opacity:.45; pointer-events:none; filter:grayscale(.6); }
.pane-right.locked .step .num { background:var(--drop-line); }

/* ---------- pagina principală încape pe un ecran, fără derulare */
@media (min-width:981px) {
  body.fit { height:100vh; display:flex; flex-direction:column; overflow:hidden; }
  body.fit main { flex:1; min-height:0; width:100%; margin:14px auto; display:flex; flex-direction:column; }
  body.fit .flash { margin-bottom:10px; }
  body.fit .split { flex:1; min-height:0; }
  body.fit .pane { height:100%; min-height:0; display:flex; flex-direction:column; gap:14px; }
  body.fit .pane .card { margin:0; padding:16px 20px; }
  body.fit .pane-right { position:static; }
  body.fit .pane-right .card { flex:1; min-height:0; display:flex; flex-direction:column; }
  body.fit #upform { flex:1; min-height:0; display:flex; flex-direction:column; }
  body.fit .drop { padding:26px; margin:10px 0; }
  body.fit .thumbs { flex:1; min-height:0; overflow-y:auto; align-content:flex-start; }
  body.fit .check { margin:6px 0 10px; }
  /* stânga: folderul + exemplul unul lângă altul, categoriile ca etichete compacte */
  body.fit .destcard { flex:none; }
  body.fit .dest-warn { margin-bottom:12px; padding:8px 12px; font-size:14px; }
  body.fit .split .dest-body { grid-template-columns:220px minmax(0, 1fr); gap:16px; }
  body.fit .ex-row { padding-top:2px; padding-bottom:2px; }
  body.fit .step { margin-bottom:10px; }
  body.fit .browser { position:relative; }
  body.fit .br-list { max-height:180px; }
  body.fit .cats-card { flex:1; min-height:0; display:flex; flex-direction:column; }
  body.fit .cats-card h2 { flex:none; }
  body.fit .cats { columns:auto; display:flex; flex-wrap:wrap; gap:6px; padding:0; list-style:none; overflow-y:auto; min-height:0; align-content:flex-start; }
  body.fit .cats li { margin:0; background:var(--chip); border:1px solid var(--line); border-radius:12px; padding:3px 10px; font-size:13px; cursor:help; }
  body.fit .cats li .muted { display:none; }
}
@media (min-width:981px) and (max-height:760px) {
  body.fit .explorer { display:none; }
  body.fit .split .dest-body { grid-template-columns:1fr; }
  body.fit .dest-warn p { display:none; }
}
body { overflow-x:hidden; }
@media (min-width:981px) {
  body.fit .drop { flex:1 1 auto; min-height:110px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; }
  body.fit .thumbs { flex:0 1 auto; max-height:40%; }
  body.fit .thumbs:empty { display:none; }
}

/* ---------- pagina de analiză: listă paginată + previzualizare */
.prog-split { display:grid; grid-template-columns:minmax(0, 1fr) minmax(300px, 34%); gap:20px; align-items:start; }
.prog-main { display:flex; flex-direction:column; gap:14px; min-width:0; }
.prog-main .card, .prog-preview { margin:0; }
.prog-row { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.prog-row .actions { margin:0; }
.prog-head .bar { margin:8px 0; }
.list-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px; }
.list-head h2 { margin:0; }
.pager { display:flex; gap:4px; align-items:center; flex-wrap:wrap; }
.pager button { min-width:32px; padding:4px 8px; border:1px solid var(--line); background:var(--card); color:var(--ink); border-radius:6px; cursor:pointer; font-size:13px; }
.pager button.cur { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
.pager button:disabled { opacity:.4; cursor:default; }
.pager span { color:var(--muted); padding:0 2px; }
.live { grid-template-columns:repeat(auto-fill, minmax(165px, 1fr)); align-content:start; }
.live .item { cursor:pointer; transition:border-color .15s, transform .15s; }
.live .item:hover { border-color:var(--accent); }
.live .item.sel { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent); }
.live .det { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.35; min-height:2.7em; }
.prog-preview { display:flex; flex-direction:column; }
.pv-empty { margin:auto; text-align:center; padding:40px 10px; }
.pv { display:flex; flex-direction:column; gap:8px; min-height:0; height:100%; }
.pv a { display:block; flex:1; min-height:0; }
.pv img { width:100%; height:100%; max-height:62vh; object-fit:contain; background:var(--img-bg); border-radius:8px; }
.pv-name { font-weight:600; word-break:break-all; }
.pv-meta { display:flex; gap:8px; align-items:center; }
.pv-cat { font-weight:700; color:var(--accent); }
.pv-det { font-size:15px; line-height:1.45; }
@media (min-width:981px) {
  body.fit .prog-split { flex:1; min-height:0; align-items:stretch; }
  body.fit .prog-main { min-height:0; }
  body.fit .prog-list { flex:1; min-height:0; display:flex; flex-direction:column; padding:14px 18px; }
  body.fit .prog-list .live { flex:1; min-height:0; overflow:hidden; }
  body.fit .prog-head { padding:14px 20px; }
  body.fit .prog-head h1 { font-size:20px; }
  body.fit .prog-preview { min-height:0; }
}
@media (max-width:980px) { .prog-split { grid-template-columns:1fr; } }
.live { grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px; }
.live .item { padding:8px; gap:4px; }
.live .item img { height:100px; }

/* ---------- paginare comună (analiză, verificare, rezultat) */
.pg-hide { display:none !important; }
.pager { gap:5px; }
.pager button { min-width:38px; height:34px; padding:4px 10px; font-size:14px; font-weight:600; }
.pager .pg-info { margin-left:8px; font-size:13px; color:var(--muted); white-space:nowrap; }
.ph-row { display:flex; align-items:center; gap:10px 20px; flex-wrap:wrap; }
.ph-row h1 { margin:0; font-size:20px; margin-right:auto; }
.ph-row .actions, .ph-row .toolbar { margin:0; }
.ph-row2 { display:flex; align-items:center; justify-content:space-between; gap:8px 16px; flex-wrap:wrap; }
.ph-row2 .chips { margin:0; }
.bar.slim { height:18px; margin:10px 0 8px; } .bar.slim .bar-label { font-size:11px; }
.prog-head p { margin:6px 0 0; }
.notes { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.notes .note { margin:0; padding:4px 10px; font-size:13px; }
.pv-page { margin-left:auto; background:var(--chip); border:1px solid var(--line); color:var(--ink); border-radius:12px; padding:2px 10px; font-size:12px; cursor:pointer; }
.pv-page:hover { border-color:var(--accent); }
.rv .item img { height:110px; }
.rv .item select { padding:4px; font-size:13px; }
.rv .pv-open { cursor:pointer; }
.rv .item { cursor:default; }
.rv .meta { align-items:center; justify-content:space-between; }
.rv .keep { display:flex; gap:4px; align-items:center; }
.exists-tag { color:var(--muted); font-weight:600; }
#pv-sim { word-break:break-word; }
.tablebox { min-height:0; }
@media (min-width:981px) {
  body.fit #copyform { flex:1; min-height:0; display:flex; flex-direction:column; }
  body.fit #copyform .grid { flex:1; min-height:0; overflow:hidden; }
  body.fit .result-card { flex:1; min-height:0; display:flex; flex-direction:column; margin:0; }
  body.fit .tablebox { flex:1; overflow:hidden; }
}
.rv .item img { height:88px; }
.rv .keep { white-space:nowrap; }
.prog-head .notes .note { padding:3px 8px; font-size:12px; }

/* bara de pagini întinsă pe toată lățimea, până la titlul listei */
.list-head h2 { flex:none; white-space:nowrap; }
.list-head .pager { flex:1; min-width:0; flex-wrap:nowrap; justify-content:flex-end; overflow:hidden; }
.pager .pg-nums { display:flex; gap:5px; align-items:center; flex:1; justify-content:center; }
.pager button { flex:none; }
.list-head .pager { justify-content:flex-start; }
.pager .pg-nums { flex:0 0 auto; margin:0 auto; }
.list-head h2 { margin-right:12px; }

/* alegerea categoriei din previzualizare */
.pv-choose { display:flex; flex-direction:column; gap:4px; margin-top:auto; padding-top:10px; border-top:1px solid var(--line); font-size:13px; color:var(--muted); }
.pv-choose select { font-size:15px; padding:7px 8px; color:var(--ink); }
#pv-saved { min-height:1.2em; }
.pv-ev { word-break:break-word; }
.pv-ev b { font-family:Consolas, monospace; font-weight:600; }

/* JSON-ul modelului (debugging) */
.pv-raw { font-size:12px; border:1px solid var(--line); border-radius:6px; padding:4px 8px; }
.pv-raw summary { cursor:pointer; color:var(--muted); }
.pv-raw pre { margin:6px 0 2px; max-height:22vh; overflow:auto; white-space:pre-wrap; word-break:break-word;
  font-family:Consolas, monospace; font-size:12px; background:var(--input); padding:6px; border-radius:4px; }
.pv-meta2:empty { display:none; }

/* ---------- autentificare */
.auth-card { max-width:420px; margin:40px auto; }
.auth-card h1 { margin-bottom:10px; }
.auth-form { display:flex; flex-direction:column; gap:12px; max-width:380px; margin-top:12px; }
.auth-form label { display:flex; flex-direction:column; gap:4px; font-size:14px; }
.auth-form label.check { flex-direction:row; align-items:center; gap:8px; margin:0; }
.auth-form input:not([type=checkbox]) { padding:9px 10px; font-size:15px; border-radius:6px; border:1px solid var(--line); background:var(--input); color:var(--ink); }
.auth-form .btn { align-self:flex-start; }
.auth-err { background:color-mix(in srgb, var(--err) 12%, transparent); border:1px solid var(--err); color:var(--err); padding:8px 12px; border-radius:6px; }
.pw { position:relative; display:flex; }
.pw input { flex:1; padding-right:38px !important; }
.pw-eye { position:absolute; right:4px; top:50%; transform:translateY(-50%); background:none; border:0; cursor:pointer; font-size:16px; opacity:.6; }
.tb-user a { color:#e6e9ef; text-decoration:none; font-weight:600; }
.tb-user a:hover { text-decoration:underline; }
.tb-logout { margin:0; }
.tb-logout button { background:none; border:1px solid #3a4252; color:#cbd2dc; border-radius:6px; padding:2px 10px; font-size:13px; cursor:pointer; }
.tb-logout button:hover { color:#fff; border-color:#cbd2dc; }
.acct { max-width:760px; margin:0 auto; }
.acct table form { margin:0; }

/* folderul principal ales în browser + copierea */
.dest-name { margin:10px 0 0; font-size:15px; word-break:break-all; }
.copybox { margin-top:8px; border:1px solid var(--line); border-radius:8px; padding:8px 12px; background:var(--chip); }
.copybox .bar { margin:6px 0 2px; }
