/* ==========================================================
   ERP Nusantara — UI stylesheet (no external dependencies)
   ========================================================== */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5; --surface-3: #e8ebf0;
  --border: #e2e5ea; --border-strong: #cfd4dc;
  --text: #18212d; --text-2: #3b4656; --muted: #6b7686; --faint: #9aa3b1;
  --primary: #0f766e; --primary-hover: #0b5f58; --primary-soft: #e3f3f1; --primary-text: #0b5f58;
  --accent: #b45309;
  --ok: #15803d; --ok-soft: #e5f5ea; --warn: #b45309; --warn-soft: #fdf1e1; --bad: #c62828; --bad-soft: #fde8e8; --info: #1d4ed8; --info-soft: #e6edfd;
  --violet: #6d28d9; --violet-soft: #efe8fd;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06); --shadow: 0 1px 3px rgba(16,24,40,.08), 0 4px 12px rgba(16,24,40,.05); --shadow-lg: 0 12px 40px rgba(16,24,40,.18);
  --radius: 10px; --radius-sm: 7px; --radius-lg: 14px;
  --side-w: 252px; --top-h: 58px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1318; --surface: #151b22; --surface-2: #1b232c; --surface-3: #232d38;
  --border: #27313c; --border-strong: #354250;
  --text: #e7eaef; --text-2: #c5ccd6; --muted: #95a0ae; --faint: #6f7b89;
  --primary: #2bb5a6; --primary-hover: #39c9b9; --primary-soft: #12302d; --primary-text: #5fd8ca;
  --ok: #4ade80; --ok-soft: #12301e; --warn: #f59e0b; --warn-soft: #33260f; --bad: #f87171; --bad-soft: #3a1719; --info: #7aa2ff; --info-soft: #172443;
  --violet: #b199ff; --violet-soft: #251d3d;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3); --shadow-lg: 0 14px 44px rgba(0,0,0,.55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; } .grow { flex: 1; } .hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 8px; }
.sp-between { justify-content: space-between; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.i.sm { width: 15px; height: 15px; } svg.i.lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- layout ---------- */
#app { background: linear-gradient(to right, var(--surface) var(--side-w), transparent 0); display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); min-height: var(--top-h); }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #14b8a6); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; overflow: hidden; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand .name { font-weight: 700; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .sub { font-size: 11.5px; color: var(--muted); }
.side-search { margin: 10px 12px 4px; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); cursor: pointer; background: var(--surface-2); font-size: 13px; }
.side-search kbd { margin-left: auto; }
.nav { flex: 1; overflow-y: auto; padding: 6px 8px 16px; scrollbar-width: thin; }
.nav-group { margin-top: 2px; }
.nav-head, .nav-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 8px; border: 0; background: none; color: var(--text-2); cursor: pointer; text-align: left; font-size: 13.5px; }
.nav-head:hover, .nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-head .chev { margin-left: auto; transition: transform .15s; color: var(--faint); }
.nav-group.open > .nav-head .chev { transform: rotate(90deg); }
.nav-items { display: none; padding: 2px 0 6px 18px; }
.nav-group.open > .nav-items { display: block; }
.nav-items .nav-link { font-size: 13px; padding: 6px 10px; color: var(--muted); }
.nav-link.active, .nav-head.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.side-foot { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--violet-soft); color: var(--violet); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 22px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; overflow: hidden; white-space: nowrap; }
.topbar .crumbs b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; }
.content { padding: 22px 26px 60px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head .desc { color: var(--muted); margin-top: 4px; max-width: 760px; font-size: 13.5px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 550; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--primary-hover); }
:root[data-theme="dark"] .btn.primary { color: #06201d; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.icon { width: 36px; padding: 0; } .btn.icon.sm { width: 30px; }
.btn .count { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; line-height: 17px; }
.btn-group { display: inline-flex; } .btn-group .btn { border-radius: 0; } .btn-group .btn:first-child { border-radius: 8px 0 0 8px; } .btn-group .btn:last-child { border-radius: 0 8px 8px 0; } .btn-group .btn + .btn { margin-left: -1px; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--muted); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-h h3 { flex: 1; }
.card-b { padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); cursor: default; position: relative; overflow: hidden; }
.kpi.link { cursor: pointer; } .kpi.link:hover { border-color: var(--primary); }
.kpi .lbl { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.kpi .val { font-size: 21px; font-weight: 750; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .delta { font-size: 12px; font-weight: 650; }
.kpi .delta.up { color: var(--ok); } .kpi .delta.down { color: var(--bad); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: .0; }
.kpi.warn::before { background: var(--warn); opacity: 1; } .kpi.bad::before { background: var(--bad); opacity: 1; } .kpi.ok::before { background: var(--ok); opacity: .7; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.st-draft { background: var(--surface-3); color: var(--muted); }
.st-confirmed, .st-submitted, .st-open { background: var(--info-soft); color: var(--info); }
.st-posted, .st-active { background: var(--violet-soft); color: var(--violet); }
.st-partial { background: var(--warn-soft); color: var(--warn); }
.st-paid, .st-done, .st-approved, .st-closed-ok, .st-good { background: var(--ok-soft); color: var(--ok); }
.st-cancelled, .st-rejected, .st-major, .st-lost, .st-overdue { background: var(--bad-soft); color: var(--bad); }
.st-closed, .st-disposed, .st-hold { background: var(--surface-3); color: var(--text-2); }
.st-minor { background: var(--warn-soft); color: var(--warn); }

/* ---------- forms ---------- */
.fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f.c2 { grid-column: span 2; } .f.c3 { grid-column: 1 / -1; }
.f > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.f > label .req { color: var(--bad); }
.f .help { font-size: 12px; color: var(--muted); }
.f .err { font-size: 12px; color: var(--bad); font-weight: 550; }
.f.has-err .inp { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.inp { height: 38px; width: 100%; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); transition: border-color .12s, box-shadow .12s; min-width: 0; }
textarea.inp { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.inp[readonly], .inp:disabled { background: var(--surface-2); color: var(--text-2); }
.inp.num { text-align: right; }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.ro-val { min-height: 38px; display: flex; align-items: center; padding: 0 2px; font-weight: 550; color: var(--text); word-break: break-word; }
.ro-val.multiline { white-space: pre-wrap; align-items: flex-start; padding-top: 8px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 38px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }
.tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-3); color: var(--muted); font-size: 10.5px; font-weight: 800; cursor: help; position: relative; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 280px; background: #111827; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 450; line-height: 1.4; z-index: 90; white-space: normal; box-shadow: var(--shadow-lg); }

/* combobox */
.combo { position: relative; }
.combo .inp { padding-right: 30px; }
.combo .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--faint); cursor: pointer; padding: 4px; display: none; }
.combo.has-val .clear { display: block; }
.dd { position: fixed; z-index: 120; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; padding: 4px; min-width: 240px; }
.dd .opt { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.dd .opt .s { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.dd .opt.hl, .dd .opt:hover { background: var(--primary-soft); }
.dd .opt.create { color: var(--primary-text); font-weight: 600; border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; }
.dd .empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.tbl th.num, .lines th.num { text-align: right; }
.tbl th.sortable { cursor: pointer; user-select: none; } .tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr.click { cursor: pointer; } .tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .lvl1 td:first-child { padding-left: 28px; } .tbl .lvl2 td:first-child { padding-left: 44px; }
.tbl tr.bold td { font-weight: 700; } .tbl tr.head td { background: var(--surface-2); font-weight: 700; color: var(--text-2); }
.tbl tr.total td { border-top: 1.5px solid var(--border-strong); }
.tbl td.neg { color: var(--bad); }
.list-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.searchbox { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.searchbox .inp { padding-left: 34px; } .searchbox svg { position: absolute; left: 10px; top: 10px; color: var(--faint); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 550; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--surface-2); } .chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .chip.on { color: #06201d; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.empty-state { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty-state .ill { width: 64px; height: 64px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

/* lines grid */
.lines { width: 100%; border-collapse: separate; border-spacing: 0; }
.lines th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 650; padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.lines td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines td .inp { height: 34px; border-color: transparent; background: transparent; padding: 0 8px; }
.lines td .inp:hover { border-color: var(--border); }
.lines td .inp:focus { border-color: var(--primary); background: var(--surface); }
.lines td .cell-ro { height: 34px; display: flex; align-items: center; padding: 0 8px; font-variant-numeric: tabular-nums; }
.lines td.num .cell-ro { justify-content: flex-end; }
.lines .rownum { color: var(--faint); font-size: 12px; text-align: center; width: 30px; padding-top: 13px; }
.lines .del { opacity: 0; } .lines tr:hover .del { opacity: 1; }
.lines .sub { font-size: 11.5px; color: var(--muted); padding: 0 8px 4px; }
.lines-foot { display: flex; gap: 8px; padding: 10px 6px; align-items: center; flex-wrap: wrap; }
.totals { margin-left: auto; min-width: 300px; }
.totals .tr { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; font-variant-numeric: tabular-nums; }
.totals .tr.big { font-size: 17px; font-weight: 750; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; }
.totals .tr.due { color: var(--bad); font-weight: 700; }
.terbilang { font-style: italic; color: var(--muted); font-size: 12.5px; margin-top: 6px; max-width: 520px; }

/* doc header & flow */
.doc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-head .t { flex: 1; min-width: 240px; }
.doc-head .t .kicker { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.flow { display: flex; align-items: center; gap: 0; margin: 0 0 14px; flex-wrap: wrap; }
.flow .step { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.flow .step .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 11px; background: var(--surface); }
.flow .step.done { color: var(--ok); } .flow .step.done .dot { border-color: var(--ok); background: var(--ok); color: #fff; }
.flow .step.cur { color: var(--primary-text); } .flow .step.cur .dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.flow .bar { width: 46px; height: 2px; background: var(--border-strong); margin: 0 8px; } .flow .bar.done { background: var(--ok); }
.callout { display: flex; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--info-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); font-size: 13px; align-items: flex-start; }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.callout.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.callout svg { margin-top: 1px; }
.related { display: flex; flex-wrap: wrap; gap: 6px; }
.related a { flex-wrap: wrap; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.related a:hover { text-decoration: none; border-color: var(--primary); }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.form-layout.full { grid-template-columns: minmax(0, 1fr); }
.side-panel .card-b { font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: 0; } .kv .k { color: var(--muted); } .kv .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tab { padding: 11px 14px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--primary-text); border-bottom-color: var(--primary); }
.adv-toggle { font-size: 12.5px; color: var(--primary-text); cursor: pointer; background: none; border: 0; padding: 0; font-weight: 600; }

/* ---------- modal / toast / menu ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 20, 28, .45); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .14s; border: 1px solid var(--border); }
.modal.wide { width: min(880px, 100%); } .modal.xl { width: min(1100px, 100%); }
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal .mh h2 { flex: 1; }
.modal .mb { padding: 18px 20px; overflow-y: auto; }
.modal .mf { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #1f2937; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .16s; }
.toast.ok svg { color: #4ade80; } .toast.err svg { color: #f87171; } .toast.warn svg { color: #fbbf24; }
.menu { position: fixed; z-index: 130; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 210px; }
.menu button, .menu a { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu .danger { color: var(--bad); }

/* palette */
.palette { width: min(640px, 100%); align-self: start; margin-top: 10vh; }
.palette .inp { height: 50px; border: 0; border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; font-size: 16px; padding: 0 18px; box-shadow: none !important; }
.palette .res { max-height: 55vh; overflow-y: auto; padding: 6px; }
.palette .sec { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 8px 10px 4px; font-weight: 700; }
.palette .it { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.palette .it.hl { background: var(--primary-soft); }
.palette .it .s { margin-left: auto; color: var(--muted); font-size: 12px; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.hbar .bar { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.hbar .bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--primary); }
.setup-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.setup-step { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13px; background: var(--surface); }
.setup-step:hover { border-color: var(--primary); }
.setup-step .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; color: #fff; }
.setup-step.done { color: var(--muted); text-decoration: line-through; } .setup-step.done .ck { background: var(--ok); border-color: var(--ok); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.quick button { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; font-weight: 600; font-size: 13px; color: var(--text); }
.quick button:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.quick button .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.task { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.task:last-child { border-bottom: 0; } .task:hover { color: var(--primary-text); }
.task .n { min-width: 26px; height: 22px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 12px; display: grid; place-items: center; padding: 0 6px; }

/* reports */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.rep-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; display: flex; gap: 12px; }
.rep-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.rep-card .ic { width: 36px; height: 36px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.rep-card b { display: block; margin-bottom: 2px; }
.params { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.params .f { min-width: 170px; }
.rep-head { text-align: center; padding: 18px 16px 6px; } .rep-head .co { font-weight: 700; } .rep-head h2 { margin-top: 2px; }

/* POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 14px; height: calc(100vh - var(--top-h) - 44px); }
.pos .left, .pos .right { display: flex; flex-direction: column; min-height: 0; }
.pos .items { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; padding: 2px; }
.pos .item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; min-height: 104px; transition: border-color .1s, transform .05s; }
.pos .item:hover { border-color: var(--primary); } .pos .item:active { transform: scale(.98); }
.pos .item .nm { font-weight: 600; font-size: 13px; line-height: 1.3; flex: 1; }
.pos .item .pr { font-weight: 750; color: var(--primary-text); }
.pos .item .stk { font-size: 11.5px; color: var(--muted); } .pos .item .stk.low { color: var(--bad); }
.cart { flex: 1; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.cart-line .nm { font-weight: 600; font-size: 13.5px; }
.qty-ctl { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.qty-ctl button { width: 30px; height: 30px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 16px; }
.qty-ctl input { width: 52px; height: 30px; border: 0; text-align: center; background: var(--surface); }
.pay-big { height: 56px; font-size: 18px; font-weight: 750; }
.cash-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cash-quick .btn { height: 44px; }
.receipt { font-family: var(--mono); font-size: 12px; width: 300px; margin: 0 auto; color: #000; background: #fff; padding: 12px; }
.receipt .c { text-align: center; } .receipt .r { display: flex; justify-content: space-between; gap: 8px; } .receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(1200px 600px at 10% 10%, #14b8a6 0%, #0f766e 40%, #0b3b37 100%); color: #e6fffb; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 34px; color: #fff; max-width: 480px; } .login-art p { max-width: 460px; opacity: .9; font-size: 15px; }
.login-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; } .login-art li { display: flex; gap: 10px; align-items: center; }
.login-box { display: grid; place-items: center; padding: 30px; }
.login-box form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }

/* print */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }
  .no-print { display: none !important; }
}
.pdoc { color: #111; font: 12.5px/1.45 var(--font); background: #fff; }
.pdoc .ph { display: flex; gap: 16px; align-items: flex-start; border-bottom: 2px solid #0f766e; padding-bottom: 10px; margin-bottom: 14px; }
.pdoc .ph img { max-height: 58px; max-width: 160px; object-fit: contain; }
.pdoc .ph .co { flex: 1; } .pdoc .ph .co b { font-size: 16px; }
.pdoc .ph .dt { text-align: right; } .pdoc .ph .dt h1 { font-size: 20px; color: #0f766e; letter-spacing: .03em; }
.pdoc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
.pdoc .box { border: 1px solid #d5d9df; border-radius: 6px; padding: 8px 10px; }
.pdoc .box .l { font-size: 10.5px; text-transform: uppercase; color: #555; letter-spacing: .04em; }
.pdoc table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.pdoc th { background: #eef3f2; text-align: left; font-size: 11px; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid #b9c2c8; }
.pdoc td { padding: 6px 8px; border-bottom: 1px solid #e3e6ea; vertical-align: top; }
.pdoc .tot { margin-left: auto; width: 300px; } .pdoc .tot .tr { display: flex; justify-content: space-between; padding: 3px 0; } .pdoc .tot .big { font-weight: 800; font-size: 14px; border-top: 1px solid #333; margin-top: 4px; padding-top: 6px; }
.pdoc .sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 34px; text-align: center; } .pdoc .sign div { padding-top: 60px; border-bottom: 1px solid #333; }
.pdoc .sign span { display: block; margin-top: 4px; font-size: 11.5px; }
.pdoc .foot { margin-top: 18px; font-size: 11.5px; color: #444; }
.pdoc .pb { page-break-after: always; }
.pdoc .wm { color: #c62828; font-weight: 800; border: 2px solid #c62828; padding: 2px 8px; display: inline-block; transform: rotate(-4deg); }


/* manual & privacy */
.doc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.doc-toc { position: sticky; top: calc(var(--top-h) + 14px); max-height: calc(100vh - var(--top-h) - 30px); overflow-y: auto; }
.doc-links { display: flex; flex-direction: column; margin-top: 10px; }
.doc-links a { padding: 6px 10px; border-radius: 7px; color: var(--text-2); font-size: 13px; text-decoration: none; }
.doc-links a:hover { background: var(--surface-2); }
.doc-links a.on { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.doc-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.doc-sec { scroll-margin-top: calc(var(--top-h) + 14px); }
.doc-text { font-size: 14.5px; line-height: 1.7; max-width: 860px; }
.doc-text p { margin: 0 0 12px; }
.doc-text h3 { margin: 20px 0 8px; font-size: 15px; }
.doc-text h3:first-child { margin-top: 0; }
.doc-text ul, .doc-text ol { margin: 0 0 12px; padding-left: 22px; }
.doc-text li { margin: 4px 0; }
.doc-steps li::marker { font-weight: 700; color: var(--primary-text); }
.doc-text .callout { margin: 8px 0 14px; font-size: 13.5px; line-height: 1.6; }
.doc-table { border: 1px solid var(--border); margin: 6px 0 14px; }
.doc-table td { vertical-align: top; font-size: 13.5px; line-height: 1.55; }
.doc-key { font: 12.5px var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.doc-print h1 { font-size: 22px; margin-bottom: 6px; } .doc-print h2 { font-size: 16px; margin: 18px 0 6px; color: #0f766e; } .doc-print h3 { font-size: 13.5px; margin: 12px 0 4px; }
.doc-print p, .doc-print li { font-size: 12px; line-height: 1.55; } .doc-print .callout { border: 1px solid #ccc; padding: 6px 8px; margin: 6px 0; font-size: 11.5px; } .doc-print .callout svg { display: none; }
@media (max-width: 860px) { .doc-layout { grid-template-columns: 1fr; } .doc-toc { position: static; max-height: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; background: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px 16px 60px; }
  .topbar { padding: 0 12px; }
  .fgrid { grid-template-columns: 1fr; } .f.c2, .f.c3 { grid-column: auto; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; height: auto; } .pos .items { max-height: 50vh; }
  .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; }
  .totals { min-width: 0; width: 100%; }
  .hide-sm { display: none !important; }
  .page-head .actions { width: 100%; }
}
