:root {
  --bg: #f6f5f2; --card: #fff; --ink: #17181c; --mut: #5e6168; --line: #e4e2dd; --line2: #efede8;
  --gold: #d4af66; --gold-ink: #8a6420; --side: #17181c; --side2: #2a2c33;
  --red: #b42318; --red-bg: #fef3f2; --red-line: #f5c2bd; --amber: #8a5a00; --amber-bg: #fff8eb; --amber-line: #f3dca8;
  --green: #12805c; --green-bg: #e9f7f1; --blue: #23439e;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--gold-ink); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
.mut { color: var(--mut); } .sm { font-size: 13px; } .xs { font-size: 12px; } .b { font-weight: 600; } .r { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .sp { justify-content: space-between; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack > * + * { margin-top: 12px; }

/* layout */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--side); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 0 8px 20px; }
.brand i { width: 30px; height: 30px; border-radius: 8px; background: var(--gold); display: grid; place-items: center; color: var(--side); font-style: normal; font-weight: 800; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #c9cbd1; font-size: 14px; }
.nav a.on { background: var(--side2); color: #fff; }
.nav a .cnt { margin-left: auto; background: var(--gold); color: var(--side); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.side .foot { margin-top: auto; font-size: 12px; color: #8b8e96; padding: 8px; }
.main { flex: 1; min-width: 0; padding: 28px 32px 120px; max-width: 1180px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.back { font-size: 14px; color: var(--gold-ink); background: none; border: 0; padding: 0; cursor: pointer; }
.tabbar { display: none; }

@media (max-width: 899px) {
  .side { display: none; }
  .main { padding: calc(14px + var(--safe-t)) 14px calc(96px + var(--safe-b)); }
  h1 { font-size: 22px; }
  .tabbar { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--mut); padding: 4px 0; position: relative; }
  .tabbar a.on { color: var(--ink); font-weight: 600; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar .cnt { position: absolute; top: 0; left: 55%; background: var(--red); color: #fff; border-radius: 999px; font-size: 10px; padding: 0 5px; font-weight: 700; }
  .hide-m { display: none !important; }
}
@media (min-width: 900px) { .hide-d { display: none !important; } }

/* pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card.flat { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { font-size: 13px; color: var(--mut); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 9px; border: 1px solid #d6d3cc; background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.pr { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; min-height: 50px; font-size: 15px; }
.lnk { color: var(--gold-ink); font-weight: 600; font-size: 13px; background: none; border: 0; padding: 0; cursor: pointer; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { opacity: .65; margin-left: 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.c-gold { background: #f5ecd9; color: #6b4d14; } .c-blue { background: #e3eafb; color: #23439e; } .c-green { background: #e2f3ea; color: #1c6b45; }
.c-purple { background: #efe7fb; color: #5b2ea6; } .c-orange { background: #fdeadb; color: #9a4a0b; } .c-pink { background: #fbe4ee; color: #a3245a; }
.st { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #f0efec; color: var(--mut); }
.st.processing { background: #e8f0fe; color: #1d4ed8; } .st.on-hold { background: var(--amber-bg); color: var(--amber); } .st.completed { background: var(--green-bg); color: var(--green); }
.st.cancelled, .st.failed, .st.refused { background: var(--red-bg); color: var(--red); }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 14px; border: 1px solid; }
.alert.error { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.alert.warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.alert.info { background: #f1f4fb; border-color: #d9e1f2; color: #2c3f6b; }
.alert.ok { background: var(--green-bg); border-color: #bfe5d4; color: var(--green); }
.inp { width: 100%; height: 44px; border: 1px solid #d6d3cc; border-radius: 9px; padding: 0 12px; background: #fff; font-size: 16px; }
textarea.inp { height: auto; padding: 10px 12px; min-height: 90px; }
.inp:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
label.f { display: block; font-size: 13px; color: var(--mut); }
label.f > .inp, label.f > select { margin-top: 4px; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line2); cursor: pointer; }
.check:last-child { border-bottom: 0; }
.check input { width: 22px; height: 22px; accent-color: #1d6fe0; flex: none; margin: 0; }
input[type=checkbox] { accent-color: #1d6fe0; }
.search { position: relative; } .search .inp { padding-left: 38px; } .search svg { position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; color: var(--mut); }
.empty { text-align: center; color: var(--mut); padding: 40px 10px; }
.spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: s .7s linear infinite; display: inline-block; }
@keyframes s { to { transform: rotate(360deg); } }
.bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); transition: width .4s; }
.steps { display: flex; gap: 6px; margin: 10px 0 12px; } .steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); } .steps i.done { background: var(--green); } .steps i.on { background: var(--ink); }

/* order list */
.olist { display: flex; flex-direction: column; gap: 8px; }
.oc { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.oc.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.oc.err { background: var(--red-bg); border-color: var(--red-line); } .oc.warn { background: var(--amber-bg); border-color: var(--amber-line); }
.oc .cb { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.oc .num { font-weight: 700; } .oc .tot { font-weight: 700; white-space: nowrap; }
.oc .items { font-size: 13px; color: var(--mut); margin-top: 2px; }
.oc .flag { font-size: 13px; font-weight: 600; margin-top: 4px; }
.oc .flag.error { color: var(--red); } .oc .flag.warn { color: var(--amber); }
.ok-tick { color: var(--green); font-weight: 700; }
.selbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
@media (min-width: 900px) { .selbar { left: 232px; padding-left: 32px; padding-right: 32px; } }

/* order page */
.items-t { width: 100%; border-collapse: collapse; }
.items-t td { padding: 10px 0; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.items-t img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: #f0efec; display: block; }
.qty { display: inline-flex; align-items: center; border: 1px solid #d6d3cc; border-radius: 8px; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: #fff; font-size: 18px; cursor: pointer; }
.qty span { width: 30px; text-align: center; font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; } .kv > :nth-child(odd) { color: var(--mut); }
.two { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 1099px) { .two { grid-template-columns: 1fr; } }
.timeline { font-size: 13px; } .timeline div { padding: 6px 0; border-bottom: 1px solid var(--line2); }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(23, 24, 28, .45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 10px 18px calc(18px + var(--safe-b)); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: #c9c6bf; margin: 0 auto 12px; }
@media (min-width: 900px) { .sheet-bg { align-items: center; } .sheet { border-radius: 16px; padding: 22px; } .sheet .grab { display: none; } }
.toast { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); top: calc(14px + var(--safe-t)); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 92vw; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--red); }

/* tables (desktop lists) */
.tb { width: 100%; border-collapse: collapse; font-size: 14px; }
.tb th { text-align: left; font-weight: 600; font-size: 12px; color: var(--mut); padding: 10px 12px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.tb td { padding: 12px; border-bottom: 1px solid var(--line2); }
.tb tr:last-child td { border-bottom: 0; }
.prod { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line2); }
.prod img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #f0efec; flex: none; }
.var { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.stk { min-width: 34px; text-align: center; font-weight: 700; border-radius: 6px; padding: 2px 6px; background: #f0efec; }
.stk.zero { background: var(--red-bg); color: var(--red); } .stk.low { background: var(--amber-bg); color: var(--amber); }
.pdf { display: flex; align-items: center; gap: 12px; }
.pdf .ic { width: 42px; height: 42px; border-radius: 8px; background: #fdecea; color: var(--red); font-size: 11px; font-weight: 800; display: grid; place-items: center; flex: none; }
.big-ok { width: 54px; height: 54px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 28px; flex: none; }
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 18px; }
.ev { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line2); }
.ev:last-child { border-bottom: 0; }
.ev .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--gold); }
.ev .dot.ship-refused { background: var(--red); } .ev .dot.ship-delivered { background: var(--green); } .ev .dot.stock-low { background: var(--amber); } .ev .dot.batch-done { background: var(--blue); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d6d3cc; border-radius: 26px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); } .switch input:checked + span::before { transform: translateX(18px); }

/* 0.4: căsuțele Comenzi / La curier / Plată (ca în Nova), predată/nepredată, istoric client */
.boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.bx-g { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.bx-h { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--mut); margin: 0 0 4px 6px; }
.bx-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.bx { text-align: left; border: 0; background: none; border-radius: 8px; padding: 6px 8px; cursor: pointer; font: inherit; color: var(--ink); }
.bx:hover { background: var(--line2, #f4f4f5); }
.bx.on { background: var(--line2, #f4f4f5); box-shadow: inset 0 0 0 1px #a1a1aa; }
.bx b { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.bx span { display: block; font-size: 12px; line-height: 1.3; color: var(--mut); }
.bx.amber b { color: #b45309; } .bx.green b { color: #15803d; } .bx.red b { color: #b91c1c; } .bx.blue b { color: #1d4ed8; }
.hd { font-weight: 700; } .hd.nepred { color: var(--red); } .hd.pred { color: #15803d; } .hd.mut { color: var(--mut); }
.oc.struck .num, .oc.struck .items, .oc.struck .tot, .oc.struck .ell { text-decoration: line-through; }
.oc.struck.failed { background: var(--red-bg); border-color: var(--red-line); }
.oc.struck.cancelled { opacity: .75; }
.struck-t { text-decoration: line-through; }
.tag { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.tag.new-c { background: #111; color: #fff; } .tag.old-c { background: var(--red-bg); color: var(--red); }
.hist { margin-top: 8px; display: flex; flex-direction: column; }
.hist-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line2, #eee); color: inherit; text-decoration: none; }
.hist-r.struck .num, .hist-r.struck b { text-decoration: line-through; }
.items-t a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); }

/* 0.5: filtre, acțiuni în masă, etichete pe comenzi */
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.otag { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 7px; background: #eef0f3; color: #3f4652; }
.otag.arch { background: #f3ecdd; color: #7a5b16; }
.otag button { border: 0; background: none; padding: 0 0 0 4px; cursor: pointer; color: inherit; font: inherit; }
.act-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line2); background: #fff; font: inherit; font-size: 15px; text-align: left; cursor: pointer; color: var(--ink); }
.act-row:last-child { border-bottom: 0; }
.act-row:hover { background: #fafafa; }
.act-row:disabled { opacity: .45; cursor: default; }
.danger-t { color: var(--red); font-weight: 600; }
.st.returned, .st.refunded { background: var(--red-bg); color: var(--red); }
