:root {
  --bg: #f5f5f4;
  --panel: #ffffff;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --brand: #111827;
  --accent: #2563eb;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- bara de sus */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px; height: 52px;
}
.logo { font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.logo span { opacity: .55; font-weight: 500; }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; color: rgba(255,255,255,.7); padding: 8px 12px; border-radius: 8px;
  cursor: pointer; white-space: nowrap; position: relative;
}
.tab:hover { color: #fff; background: rgba(255,255,255,.08); }
.tab.active { color: #111827; background: #fff; font-weight: 600; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: #f59e0b; color: #111; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.logout { color: rgba(255,255,255,.7); text-decoration: none; font-size: 13px; white-space: nowrap; }
.logout:hover { color: #fff; }

/* ---------- banner fidelitate */
.reward-banner {
  display: none; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--warn-bg); color: #78350f; border-bottom: 1px solid #fcd34d;
  padding: 10px 16px; font-weight: 500;
}
.reward-banner.show { display: flex; }
.reward-banner .names { font-weight: 700; }

/* ---------- pagini */
main { padding: 16px; max-width: 1800px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.spacer { flex: 1; }

.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px;
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: #d6d3d1; background: #fafaf9; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: #1f2937; }
.btn.success { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.success:hover { background: #15803d; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: default; }

.search {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 220px; background: var(--panel);
}
#parcelFilter { min-width: 0; flex: 0 1 220px; }
.search:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 11px; cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .count { opacity: .6; font-size: 12px; }

.selbar {
  display: none; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius); padding: 8px 10px; margin-bottom: 10px;
}
.selbar.show { display: flex; }
.selbar strong { margin-right: 4px; }

.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pchip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; border: 2px solid transparent; font-variant-numeric: tabular-nums;
}
.pchip.active { border-color: var(--ink); }
.pchip .n { font-weight: 500; opacity: .75; }

.grid-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

/* ---------- carduri statistici */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .value.pos { color: var(--ok); }

/* ---------- colete */
.parcels { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.parcel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.parcel-top { padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.parcel-top input[type=color] { width: 34px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 6px; }
.parcel-awb { font-weight: 700; font-size: 15px; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 4px; width: 100%; font-variant-numeric: tabular-nums; }
.parcel-awb:hover { border-color: var(--line); }
.parcel-body { padding: 0 12px 10px; flex: 1; }
.parcel-body ul { margin: 6px 0 0; padding-left: 18px; color: #44403c; font-size: 13px; max-height: 160px; overflow: auto; }
.parcel-foot { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.pill { white-space: nowrap; font-size: 12px; border-radius: 999px; padding: 2px 9px; font-weight: 600; }
.pill.on-way { background: #e0e7ff; color: #3730a3; }
.pill.arrived { background: var(--ok-bg); color: #166534; }
.muted { color: var(--muted); }

/* ---------- Tabulator ajustari */
.tabulator { font-size: 13px; border: 0; background: var(--panel); }
.tabulator .tabulator-header { background: #fafaf9; border-bottom: 1px solid var(--line); }
.tabulator .tabulator-header .tabulator-col { background: #fafaf9; border-right: 1px solid var(--line); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 7px 8px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { white-space: normal; line-height: 1.2; }
.tabulator .tabulator-header .tabulator-col.gift-col { background: #fef3c7; }
.tabulator-row .tabulator-cell { padding: 6px 8px; border-right: 1px solid #f0efee; }
.tabulator-row { border-bottom: 1px solid #f0efee; }
.tabulator-row.tabulator-row-even { background: #fcfcfb; }
.tabulator-row.tabulator-selected { background: #dbeafe !important; }
.tabulator-row .tabulator-cell.tabulator-editing { border: 2px solid var(--accent); padding: 4px 6px; }
.tabulator-row .tabulator-cell.editable-cell { cursor: text; }
.tabulator .tabulator-tableholder .tabulator-placeholder span { color: var(--muted); font-weight: 500; font-size: 14px; }
.tabulator-row.tabulator-group { background: #eef2f7; border-top: 1px solid #dbe3ee; font-weight: 600; padding: 7px 10px; }
.tabulator-row.tabulator-group span { color: var(--muted); font-weight: 500; margin-left: 8px; }
.num { font-variant-numeric: tabular-nums; }
.cell-link { text-decoration: none; margin-left: 6px; font-size: 12px; }
.awb-chip { display: inline-block; padding: 1px 7px; border-radius: 5px; font-weight: 600; font-size: 12px; }
.status-tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.status-tag[data-s="Precomandă"] { background: #f3f4f6; color: #374151; }
.status-tag[data-s="În drum"] { background: #e0e7ff; color: #3730a3; }
.status-tag[data-s="Ajuns la mine"] { background: #fef3c7; color: #92400e; }
.status-tag[data-s="Trimis clientului"] { background: #dcfce7; color: #166534; }
.status-tag[data-s="Stoc"] { background: #f5f5f4; color: #57534e; border: 1px dashed #d6d3d1; }
.status-tag[data-s="Vândut"] { background: #111827; color: #fff; }
.progress { display: flex; align-items: center; gap: 8px; }
.progress .bar { flex: 1; height: 8px; background: #f0efee; border-radius: 6px; overflow: hidden; min-width: 60px; }
.progress .bar i { display: block; height: 100%; background: var(--accent); }
.progress.due .bar i { background: #f59e0b; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }

/* ---------- modale */
.modal-back { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 60px 16px 16px; overflow: auto; }
.modal-back.show { display: flex; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { font-size: 17px; margin: 0; padding: 16px 18px 0; }
.modal .body { padding: 14px 18px; display: grid; gap: 12px; }
.modal .foot { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.field { display: grid; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.gift { font-size: 40px; text-align: center; }
.big-msg { text-align: center; font-size: 16px; }

/* ---------- toast */
.toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: #111827; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; pointer-events: auto; animation: pop .15s ease-out; }
.toast.err { background: var(--danger); }
.toast.ok { background: #14532d; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

/* ---------- setari / backup */
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { margin: 0 0 12px; color: var(--muted); }
.filelist { list-style: none; padding: 0; margin: 0; max-height: 360px; overflow: auto; }
.filelist li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 700px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .logo { display: none; }
  main { padding: 10px; }
  .search { min-width: 0; flex: 1; }
  .row2 { grid-template-columns: 1fr; }
  #statusChips, #loyaltyChips, #parcelChips, #stockChips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  #statusChips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
}
.tabulator-row .tabulator-cell.gift-col { background: rgba(254,243,199,.45); }

/* ---------- adaugare rapida */
.quickadd { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; margin-bottom: 10px; box-shadow: var(--shadow); }
.quickadd input:not([type=checkbox]) { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-width: 0; flex: 1 1 140px; background: #fff; }
.quickadd input.qa-small { flex: 0 1 90px; }
.quickadd input.qa-mid { flex: 1 1 130px; }
.quickadd input:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }
.qa-title { font-weight: 600; font-size: 13px; padding: 0 4px; white-space: nowrap; }
.qa-check { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; white-space: nowrap; }
.tabulator-row.ghost-row { background: #fcfcfb !important; }
.tabulator-row.ghost-row .tabulator-cell { color: var(--muted); }
.ghost-hint { color: #a8a29e; font-style: italic; }
.nb-tag { font-size: 11px; font-weight: 700; background: #fee2e2; color: #991b1b; padding: 1px 6px; border-radius: 5px; }
.orig-client { color: #9a3412; font-weight: 600; }
.track-line { font-size: 12px; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: #f5f5f4; }
.track-line b { color: var(--ink); }
.steps { margin: 0 0 12px; padding-left: 18px; color: #44403c; font-size: 13px; }
.steps li { margin-bottom: 3px; }
.set-flag { font-weight: 500; color: var(--ok); }
.svc-status { font-size: 12px; color: var(--muted); margin-top: 8px; }
.svc-status .e { color: var(--danger); }
code { background: #f5f5f4; padding: 1px 5px; border-radius: 4px; }
@media (max-width: 700px) {
  .quickadd input:not([type=checkbox]) { flex: 1 1 45%; }
  .qa-title { width: 100%; }
}

/* ---------- furnizor */
.stat .value.debt { color: #b91c1c; }
.calc-list { display: grid; gap: 6px; max-height: 52vh; overflow: auto; padding-right: 4px; }
.calc-item { display: grid; grid-template-columns: 1fr 96px; gap: 8px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; }
.calc-item.filled { background: #f0fdf4; border-color: #bbf7d0; }
.calc-item .who { font-weight: 600; }
.calc-item .what { font-size: 12px; color: var(--muted); }
.calc-item input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
.calc-total { display: flex; justify-content: space-between; align-items: baseline; background: #111827; color: #fff; border-radius: 10px; padding: 10px 14px; }
.calc-total b { font-size: 22px; font-variant-numeric: tabular-nums; }
.calc-total span { opacity: .75; font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.modal.wide { max-width: 640px; }

.ship-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; font-size: 13px; }
.ship-row label { font-weight: 600; font-size: 12px; }
.ship-input { width: 90px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; text-align: right; }

/* ---------- comutator Fidelitate / Toti clientii */
.seg { display: inline-flex; background: #e7e5e4; border-radius: 10px; padding: 3px; margin-bottom: 12px; gap: 2px; }
.seg-b { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; color: #44403c; }
.seg-b.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.reward-note { background: var(--warn-bg); color: #78350f; border: 1px solid #fcd34d; border-radius: var(--radius); padding: 9px 12px; margin-bottom: 10px; font-size: 13px; }
.reward-note button { margin-left: 8px; }

/* ---------- anuleaza / refa */
.hist { display: flex; gap: 4px; }
.hbtn { background: rgba(255,255,255,.1); color: #fff; border: 0; width: 34px; height: 32px; border-radius: 8px; font-size: 17px; cursor: pointer; }
.hbtn:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.hbtn:disabled { opacity: .3; cursor: default; }
.badge.muted-badge { background: rgba(255,255,255,.25); color: #fff; }
.tab.active .badge.muted-badge { background: #e7e5e4; color: #111; }

/* ---------- de facut */
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.todo-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.todo-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.todo-list li .t { flex: 1; min-width: 0; }
.todo-list li .t b { display: block; }
.todo-list li .t span { color: var(--muted); }
.todo-list li .age { font-weight: 700; color: #b91c1c; white-space: nowrap; font-size: 12px; }
.todo-list .empty { color: var(--ok); border: 0; }
.count-pill { font-size: 12px; background: #f5f5f4; border-radius: 999px; padding: 1px 8px; margin-left: 4px; color: var(--muted); }
.days-input { width: 58px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font: inherit; }
@media (max-width: 700px) { .hbtn { width: 30px; } }

.deliv-opts { display: grid; gap: 6px; }
.deliv-opts .btn { justify-content: flex-start; padding: 10px 12px; }
.tabulator-row.tabulator-group { background: #fdf2f8; border-top: 2px solid #fbcfe8; color: #831843; }
.tabulator-row.tabulator-group:last-of-type { background: #f5f5f4; color: var(--ink); border-top-color: var(--line); }
.loc-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }

/* ---------- acelasi client, fisa produs, telefon */
.same-client { color: inherit; opacity: .75; font-weight: 700; padding-left: 10px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.sheet-actions .btn { flex: 1 1 auto; justify-content: center; padding: 10px 12px; }
.qa-check.big { font-size: 15px; gap: 8px; }
.qa-check.big input { width: 20px; height: 20px; }
.mobile-only { display: none; }
@media (max-width: 799px) {
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }
  .quickadd { display: none; }
  .quickadd.open { display: flex; }
  .modal { border-radius: 14px 14px 0 0; }
  .modal-back { padding: 30px 0 0; align-items: flex-end; }
  .modal .body { max-height: 72vh; max-height: calc(100dvh - 190px); overflow: auto; }
  .field input, .field select, .field textarea { font-size: 16px; padding: 10px 12px; }  /* 16px = iPhone nu mai face zoom */
  .quickadd input:not([type=checkbox]) { font-size: 16px; }
  .search { font-size: 16px; }
  .tabulator-row .tabulator-cell { padding: 10px 8px; }
  .page-head h1 { font-size: 18px; }
}
.track-line.track-done { background: #dcfce7; color: #166534; }

/* ---------- stoc: alegere rapida loc */
.loc-pick { display: flex; gap: 4px; }
.loc-pick button { font: inherit; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 999px; border: 2px solid; background: #fff; color: #44403c; cursor: pointer; }
.loc-pick button.on { box-shadow: 0 1px 3px rgba(0,0,0,.15); }
@media (max-width: 799px) { .loc-pick button { padding: 7px 8px; } }
.tick { display: inline-flex; width: 24px; height: 24px; border: 2px solid #d6d3d1; border-radius: 6px; align-items: center; justify-content: center; font-weight: 800; color: #fff; cursor: pointer; }
.tick.on { background: var(--ok); border-color: var(--ok); }
.ret-tag { display: inline-block; background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 5px; white-space: nowrap; vertical-align: middle; }
.stock-lbl { opacity: .85; }
.orig-tag { display: inline-block; background: #f5f5f4; color: #44403c; border: 1px solid #d6d3d1; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 5px; white-space: nowrap; vertical-align: middle; }
.loc-pick.dots { gap: 8px; align-items: center; }
.dot-btn { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #fff !important; box-shadow: 0 0 0 1px #d6d3d1; padding: 0 !important; opacity: .45; }
.dot-btn.on { opacity: 1; box-shadow: 0 0 0 2px #111827; }
#stockGrid .tabulator-cell[tabulator-field="_prod"] { white-space: normal; line-height: 1.3; }
.box-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.box-row input { width: 70px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; font-size: 16px; }
.ship-result { display: grid; gap: 6px; background: #f5f5f4; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.verdict { font-weight: 700; padding: 6px 10px; border-radius: 8px; }
.verdict.ok { background: #dcfce7; color: #166534; }
.verdict.bad { background: #fee2e2; color: #991b1b; }
.verdict.good { background: #dbeafe; color: #1e40af; }
#addBox { justify-self: start; }

/* ================================================================
   ASPECT EXCEL (foaia de pe telefon + bara verde)
   ================================================================ */
:root { --xl: #217346; --xl-dark: #185c37; --xl-grid: #e1e1e1; --xl-head: #f3f3f3; --xl-sel: #e8f2ec; }
html, body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.topbar { background: var(--xl); }
.tab.active { color: var(--xl-dark); }

.xl { display: flex; flex-direction: column; background: #fff; overflow: hidden; }
.xl-fbar { display: flex; align-items: center; gap: 0; border-bottom: 1px solid #d4d4d4; background: #fff; flex: none; height: 38px; }
.xl-ref { width: 58px; flex: none; text-align: center; font-size: 13px; color: #444; border-right: 1px solid #d4d4d4; height: 100%; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.xl-fx { font-style: italic; font-family: Georgia, serif; color: #888; padding: 0 8px; border-right: 1px solid #e5e5e5; height: 100%; display: flex; align-items: center; }
.xl-fin { flex: 1; min-width: 0; border: 0; padding: 0 10px; height: 100%; font-size: 16px; outline: none; background: #fff; }
.xl-fin:focus { box-shadow: inset 0 -2px 0 var(--xl); }
.xl-fin[readonly] { color: #888; }
.xl-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; position: relative; }
.xl { --z: 1; }
.xl-t { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: calc(13px * var(--z)); }
.xl-t th, .xl-t td { border-right: 1px solid var(--xl-grid); border-bottom: 1px solid var(--xl-grid); padding: 0 calc(6px * var(--z)); height: calc(34px * var(--z)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background-clip: padding-box; }
.xl-t td { background-color: #fff; }
.xl-t thead th { position: sticky; top: 0; z-index: 3; background: var(--xl-head); color: #333; font-weight: 600; font-size: calc(11.5px * var(--z)); height: calc(40px * var(--z)); padding: 2px calc(5px * var(--z)); white-space: normal; line-height: 1.15; vertical-align: bottom; text-align: left; border-bottom: 1px solid #c8c8c8; cursor: pointer; user-select: none; }
.xl-t thead th .xl-letter { display: block; font-size: calc(10px * var(--z)); color: #8a8a8a; font-weight: 500; letter-spacing: .3px; }
.xl-t thead th .xl-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.xl-t thead th:active { background: #e2e2e2; }
.xl-t .xl-corner { position: sticky; left: 0; top: 0; z-index: 5; background: var(--xl-head); border-right: 1px solid #c8c8c8; }
.xl-t .xl-corner::after { content: ""; position: absolute; right: 3px; bottom: 3px; border: 5px solid transparent; border-right-color: #b5b5b5; border-bottom-color: #b5b5b5; }
.xl-t td.xl-rn { position: sticky; left: 0; z-index: 2; background: var(--xl-head); color: #666; text-align: center; font-size: calc(11.5px * var(--z)); padding: 0; border-right: 1px solid #c8c8c8; font-variant-numeric: tabular-nums; cursor: pointer; }
.xl-t .xl-frz { position: sticky; left: calc(34px * var(--z)); z-index: 1; box-shadow: 1px 0 0 #c8c8c8; }
.xl-t thead th.xl-frz { z-index: 4; }
.xl-t tr.xl-sel td { background-color: var(--xl-sel) !important; }
.xl-t tr.xl-sel td.xl-rn { background: var(--xl) !important; color: #fff; font-weight: 700; }
.xl-t tr.xl-sel td.xl-frz[style*="background"] { box-shadow: inset 0 0 0 999px rgba(33,115,70,.12), 1px 0 0 #c8c8c8; }
.xl-t td.xl-act { box-shadow: inset 0 0 0 2px var(--xl) !important; position: relative; }
.xl-t td.xl-act::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 6px; height: 6px; background: var(--xl); border: 1px solid #fff; }
.xl-t td.xl-frz.xl-act { position: sticky; }
.xl-t td.xl-editing { padding: 0; box-shadow: inset 0 0 0 2px var(--xl) !important; overflow: visible; }
.xl-in { display: block; width: 100%; height: calc(34px * var(--z) - 1px); max-height: calc(34px * var(--z) - 1px); border: 0; outline: none; padding: 0 6px; margin: 0; font-size: 16px; line-height: 1; background: #fff; border-radius: 0; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
select.xl-in { font-size: 15px; }
.xl-t tr.xl-grp td { height: calc(30px * var(--z)); background: #fdf2f8; color: #831843; font-weight: 700; border-bottom: 1px solid #fbcfe8; cursor: pointer; padding: 0; overflow: visible; }
.xl-t tr.xl-grp td.xl-rn { background: #fce7f3; border-right-color: #fbcfe8; }
.xl-t tr.xl-grp .xl-grp-in { position: sticky; left: calc(34px * var(--z) + 8px); display: inline-block; padding: 0 8px; white-space: nowrap; }
.xl-t tr.xl-grp .xl-grp-in span { color: #9d174d; opacity: .7; font-weight: 500; margin-left: 8px; font-size: 12px; }
.xl-t tr.xl-grp[data-g="~rest"] td { background: var(--xl-head); color: #333; border-bottom-color: var(--xl-grid); }
.xl-t tr.xl-grp[data-g="~rest"] .xl-grp-in span { color: #666; }
.xl-t tr.xl-grp.closed .xl-caret { display: inline-block; transform: rotate(-90deg); }
.xl-caret { display: inline-block; transition: transform .15s; font-size: 11px; }
.xl-t td.xl-empty { text-align: center; color: var(--muted); height: 80px; white-space: normal; }
.xl-t tr.ghost-row td:not(.xl-rn) { background: #fff; }
.xl-t tr.ghost-row td.xl-rn { color: #b5b5b5; }
.xl-t .btn.small { padding: 4px 8px; }
.xl-t .tick { width: calc(22px * var(--z)); height: calc(22px * var(--z)); font-size: calc(13px * var(--z)); }
.xl-t .loc-pick.dots { gap: calc(7px * var(--z)); height: 100%; }
.xl-t .dot-btn { width: calc(22px * var(--z)); height: calc(22px * var(--z)); border-width: calc(3px * var(--z)) !important; }
.xl-t .btn.small { font-size: calc(12px * var(--z)); }
.xl-t .loc-tag, .xl-t .ret-tag, .xl-t .orig-tag, .xl-t .awb-chip { font-size: calc(11px * var(--z)); }
.xl-zoom { display: flex; align-items: center; height: 100%; border-left: 1px solid #e5e5e5; flex: none; }
.xl-zoom button { border: 0; background: none; height: 100%; min-width: 34px; font-size: 20px; color: #333; padding: 0 6px; cursor: pointer; }
.xl-zoom button.xl-zpct { font-size: 12px; min-width: 42px; color: #666; font-variant-numeric: tabular-nums; }
.xl-zoom button:active { background: #eee; }

/* bara de actiuni pentru randurile selectate (sus pe calculator, jos pe telefon) */
.selbar .one-only { display: none; }
.selbar.one .one-only { display: inline-flex; }
.selbar.one .many-only { display: none; }

/* coloane: meniul de la antet + lista */
.col-menu .btn { justify-content: flex-start; padding: 11px 12px; }
.col-list { display: grid; gap: 2px; max-height: 50vh; overflow: auto; }
.col-list label { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid #f0efee; }
.col-list input { width: 20px; height: 20px; accent-color: var(--xl); }
.col-list .tag { font-size: 11px; color: var(--muted); margin-left: auto; }

/* zona de urgenta */
.card.danger-zone { border-color: #fecaca; background: #fffafa; }
.card.danger-zone h3 { color: #b91c1c; }
.btn.danger-solid { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger-solid:hover { background: #b91c1c; }

/* ---------------------------------------------------------------- TELEFON: ca aplicatia Excel */
@media (max-width: 799px) {
  body { font-size: 15px; }
  .topbar { height: 46px; padding: 0 8px 0 12px; gap: 8px; position: sticky; }
  .topbar .logo { display: block; font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .logo span { opacity: .8; }
  .hbtn { width: 38px; height: 34px; font-size: 19px; background: rgba(255,255,255,.14); }
  .logout { font-size: 12px; padding: 6px 4px; }
  /* tab-urile devin foi Excel, jos */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #f0f0f0; border-top: 1px solid #c8c8c8; gap: 0;
    padding: 0 0 env(safe-area-inset-bottom); height: calc(44px + env(safe-area-inset-bottom)); flex: none; align-items: stretch; }
  .tab { color: #444; border-radius: 0; padding: 0 14px; font-size: 14px; border-right: 1px solid #d6d6d6; height: 44px; }
  .tab:hover { background: none; color: #444; }
  .tab.active { background: #fff; color: var(--xl); font-weight: 700; box-shadow: inset 0 -3px 0 var(--xl); }
  .badge.muted-badge { background: #f59e0b; color: #111; }
  main { padding: 0 0 calc(50px + env(safe-area-inset-bottom)); }
  .page-head { padding: 8px 10px 0; margin-bottom: 6px; }
  .page-head .sub { font-size: 12px; }
  .page > .toolbar { padding: 0 10px; margin-bottom: 6px; gap: 6px; }
  .card .toolbar { gap: 6px; }
  .page > .stats, .page > .reward-note, .page > .seg, .page > .parcels, .page > .cards2, .page > .todo-grid, .page > .quickadd { margin-left: 10px; margin-right: 10px; }
  .grid-wrap { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  /* pagini cu foaie: fara titlu mare (numele e pe tab-ul de jos) */
  .sheet-page .page-head h1 { display: none; }
  .sheet-page .page-head { padding-top: 6px; }
  #page-orders .page-head, #page-stock .page-head { display: none; }
  .ribbon { display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: #fff; border-bottom: 1px solid #e5e5e5; overflow-x: auto; scrollbar-width: none; }
  .ribbon::-webkit-scrollbar { display: none; }
  .ribbon .btn { padding: 7px 10px; flex: none; }
  .ribbon .search { min-width: 120px; flex: 1 1 120px; padding: 7px 10px; }
  .ribbon select.search { flex: 0 1 120px; min-width: 96px; max-width: 150px; }
  .ribbon .chips { flex-wrap: nowrap; }
  .chipline { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 6px 8px; background: #fafafa; border-bottom: 1px solid #e5e5e5; }
  .chipline::-webkit-scrollbar { display: none; }
  .chipline .chip { flex: none; padding: 4px 10px; font-size: 13px; }
  #page-orders .toolbar, #page-stock .toolbar { display: contents; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .stat { padding: 8px 10px; }
  .stat .value { font-size: 17px; }
  /* bara de selectie: deasupra foilor */
  .selbar { position: fixed; left: 0; right: 0; bottom: calc(44px + env(safe-area-inset-bottom)); z-index: 29; margin: 0; border-radius: 0;
    background: #fff; border: 0; border-top: 2px solid var(--xl); box-shadow: 0 -4px 14px rgba(0,0,0,.12);
    flex-wrap: nowrap; overflow-x: auto; padding: 8px; scrollbar-width: none; }
  .selbar::-webkit-scrollbar { display: none; }
  .selbar .btn.small { padding: 9px 11px; font-size: 13.5px; border-radius: 9px; flex: none; }
  .selbar strong { flex: none; font-size: 13px; color: var(--xl-dark); }
  .selbar .spacer { display: none; }
  .quickadd { margin: 8px 10px; }
  .toasts { bottom: calc(110px + env(safe-area-inset-bottom)); }
  .modal-back { z-index: 50; }
}
@media (min-width: 800px) {
  .ribbon { display: contents; }
  .chipline { display: contents; }
}

@media (max-width: 799px) {
  main:has(.sheet-page.active) { padding-bottom: 0; }
  .chipline .chips { align-items: center; }
  .chipline .muted { white-space: nowrap; padding-right: 8px; }
  .chipline .chip { height: 30px; }
  .ribbon #parcelFilter { flex: 0 0 104px; width: 104px; padding: 7px 4px; font-size: 14px; }
  .sheet-page .page-head .sub { display: none; }
  .sheet-page .page-head { gap: 6px; }
  .sheet-page .page-head .btn, .sheet-page .page-head .search { padding: 6px 10px; font-size: 14px; }
  .sheet-page .page-head .toolbar { padding: 0; margin: 0; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .sheet-page > .stats { display: flex; overflow-x: auto; scrollbar-width: none; padding: 0 10px; margin: 0 0 6px; gap: 6px; }
  .sheet-page > .stats::-webkit-scrollbar { display: none; }
  .sheet-page > .stats .stat { flex: none; min-width: 118px; padding: 6px 10px; box-shadow: none; }
  .sheet-page > .stats .stat .label { font-size: 11px; white-space: nowrap; }
  .sheet-page > .stats .stat .value { font-size: 16px; white-space: nowrap; }
  .sheet-page > .seg { margin: 6px 10px; }
  .sheet-page .seg-b { padding: 5px 10px; font-size: 14px; }
  .sheet-page > .reward-note { margin: 0 10px 6px; padding: 6px 10px; }
}
.xl-empty-in { position: sticky; left: 0; padding: 24px 16px; white-space: normal; text-align: center; box-sizing: border-box; }
@media (max-width: 799px) { #colsBtn .lbl, #stockNames .lbl, #stockSite .lbl, #stockMenu .lbl { display: none; } }
.selbar .sold-only { display: none; }
.selbar.sold > .btn:not(.sold-only):not(#selClear) { display: none; }
.selbar.sold .sold-only { display: inline-flex; }

/* ---------- nume aranjate (AI), editor de liste, optiuni */
.ai-cell { background: #f3e8ff !important; box-shadow: inset 0 -2px 0 #a78bfa; }
.ai-dot { font-size: 11px; margin-right: 3px; }
.prev-name { color: #6b21a8; text-decoration: line-through; text-decoration-color: rgba(107,33,168,.35); font-size: .95em; }
.full-name { color: #374151; user-select: all; }
.names-chip.active { background: #7c3aed; border-color: #7c3aed; }
.names-btn { border-color: #c4b5fd; color: #6d28d9; background: #faf5ff; }
.le-list { display: grid; gap: 6px; max-height: 55vh; overflow: auto; }
.le-row { display: flex; align-items: center; gap: 6px; }
.le-row .le-name { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 16px; }
.le-row input[type=color] { width: 38px; height: 38px; border: 0; padding: 0; background: none; flex: none; }
.le-move { display: flex; flex-direction: column; gap: 2px; }
.le-move .btn.small { padding: 0 6px; font-size: 10px; line-height: 16px; }
.le-tag { font-size: 11px; background: #fee2e2; color: #b91c1c; border-radius: 5px; padding: 1px 6px; }
.opt-prev { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.pill-opt { background: #fdf2f8; color: #831843; border: 1px solid #fbcfe8; border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.site-btn { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.site-sum { font-size: 15px; }
.site-warn { background: #f3e8ff; color: #6b21a8; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.site-list { margin: 6px 0; padding-left: 20px; max-height: 30vh; overflow: auto; font-size: 13px; }
details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.qa-orig { font-size: 14px; }
.qa-q { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 10px; padding: 10px 12px; color: #78350f; }
.qa-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.qa-opts .btn { padding: 8px 12px; font-size: 14px; }
.q-btn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.q-text { color: #92400e; font-size: .95em; }
.q-chip.active { background: #d97706; border-color: #d97706; }
.chip.ok-all { background: #dcfce7; border-color: #86efac; color: #166534; font-weight: 600; }
.rules-list { display: grid; gap: 4px; max-height: 55vh; overflow: auto; }
.rule-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.rule-p { color: #6b21a8; }
@media (max-width: 799px) { .rule-row { grid-template-columns: 1fr auto; } .rule-row > span:nth-child(2) { grid-column: 1; } }

/* ---------- Excel online -> aplicatie */
.excel-banner { position: sticky; top: 52px; z-index: 19; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  background: #fef3c7; color: #78350f; border-bottom: 1px solid #fcd34d; padding: 8px 12px; font-size: 14px; }
.excel-banner[hidden] { display: none; }
@media (max-width: 799px) { .excel-banner { top: 46px; font-size: 13px; padding: 6px 10px; } }
.modal h4 { margin: 8px 0 2px; font-size: 14px; }
.xc-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.xc-item input[type=checkbox] { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.xc-item.conflict { background: #fff7ed; border-radius: 8px; padding: 8px; }
.xc-f { font-size: 13px; color: #44403c; margin-top: 2px; }
.xc-f > span:first-child { color: var(--muted); }
.xc-f s { color: #a8a29e; }
.xc-f label { margin-right: 10px; white-space: nowrap; }

/* ---------------- story-uri Instagram */
.story-btn { border-color: #f9a8d4; color: #be185d; background: #fdf2f8; }
.st-top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: 14px; }
.st-y { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); min-width: 180px; }
.st-y input { width: 100%; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.st-tile { position: relative; border-radius: 10px; overflow: hidden; background: #27272a; aspect-ratio: 9 / 16; cursor: pointer;
  outline: 3px solid transparent; outline-offset: -3px; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.st-tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .45; transition: opacity .15s; -webkit-touch-callout: none; }
.st-tile.sel { outline-color: #217346; }
.st-tile.sel img { opacity: 1; }
.st-chk { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.45); color: transparent; font-size: 14px; border: 2px solid #fff; }
.st-tile.sel .st-chk { background: #217346; color: #fff; }
.st-cam { position: absolute; top: 4px; left: 4px; border: 0; background: rgba(0,0,0,.45); border-radius: 8px; font-size: 15px; padding: 4px 6px; line-height: 1; }
.st-miss { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; font-size: 12px; background: rgba(0,0,0,.35); }
.st-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11px; line-height: 1.2; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-name b { float: right; margin-left: 4px; }
.st-help { font-size: 12px; }

.site-alert { font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }

.tc-deliv .btn.on { background: #217346; color: #fff; border-color: #217346; }
.deliv-opts.tc-deliv { display: flex; flex-wrap: wrap; gap: 6px; }
.deliv-opts.tc-deliv .btn { width: auto; flex: none; padding: 7px 12px; font-size: 14px; border-radius: 999px; justify-content: center; }

.cn-who { font-weight: 600; } .cn-who.ret { color: #b91c1c; } .cn-note { color: #57534e; }

/* ---------- Diverse */
.misc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.db-form { display: grid; grid-template-columns: 1fr 110px; gap: 8px; margin: 8px 0 4px; }
.db-form input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; min-width: 0; }
.db-form input[name=note] { grid-column: 1 / -1; }
.db-form .btn { grid-column: 1 / -1; }
.nt-form { display: grid; gap: 8px; margin: 8px 0 4px; }
.nt-form textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; font-family: inherit; resize: vertical; }
.misc-list { list-style: none; margin: 6px 0 0; padding: 0; }
.misc-list li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.misc-list li .t { flex: 1; min-width: 0; display: grid; }
.misc-list li .t span { font-size: 12.5px; color: var(--muted); }
.db-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.misc-list.paid li { opacity: .7; }
.db-paid { margin-top: 10px; }
.db-paid summary { cursor: pointer; color: var(--muted); font-size: 13.5px; padding: 6px 0; }
.nt-text { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; resize: none; padding: 4px 2px; line-height: 1.4; overflow: hidden; }
.nt-text:focus { outline: 2px solid #217346; border-radius: 6px; background: #fff; }
.misc-list li.done .nt-text { text-decoration: line-through; color: var(--muted); }
.misc-list li.pinned { background: #fffbeb; }
.misc-list li input[type=checkbox] { width: 20px; height: 20px; accent-color: #217346; flex: none; }
.misc-list .btn.on { background: #fde68a; border-color: #f59e0b; }

.od-steps li { margin-bottom: 10px; }
.od-url { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }

/* 💾 cat salveaza in fundal */
.hbtn.busy { animation: fs-pulse 1s ease-in-out infinite; }
@keyframes fs-pulse { 50% { opacity: .35; } }
