:root {
  color-scheme: light dark;
  --page: #fbf6f9; --surface: #ffffff; --wash: #f8eef4; --ink: #2a1122; --ink2: #6b4a5f; --muted: #7d6072;
  --line: #f0e3eb; --axis: #d9c6d2; --accent: #b5126e; --accent-ink: #a81468; --accent-tint: #fde7f3; --on-accent: #ffffff; --grad: linear-gradient(120deg, #c2187f, #9d1c6b);
  --side: #4a1438; --side-ink: #ecd9e5; --side-active: rgba(255, 255, 255, .12); --gold: #edc07a; --shadow: 0 1px 2px rgba(74, 20, 56, .05), 0 8px 24px rgba(74, 20, 56, .06);
  --good: #006300; --good-t: #e3f4e4; --warn: #7a5200; --warn-t: #fdf1da; --bad: #b42323; --bad-t: #fde8e8; --info: #6d2a8c; --info-t: #f3e8f9;
  --s1: #c2187f; --s2: #d99a2b; --st-good: #0ca30c; --st-warn: #fab219; --st-bad: #d03b3b; --st-neutral: #b3a2ad;
  --t-indigo: #b5126e; --t-indigo-b: #fde7f3; --t-violet: #6d2a5e; --t-violet-b: #f4e6f0; --t-teal: #7a5200; --t-teal-b: #fbf0dc; --t-sky: #9d1c6b; --t-sky-b: #fbeaf4; --t-amber: #7a5200; --t-amber-b: #fdf1da; --t-rose: #b42323; --t-rose-b: #fde8e8; --t-emerald: #0b6b45; --t-emerald-b: #e0f5ea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #140b12; --surface: #1f1320; --wash: #2e1e2c; --ink: #f5edf2; --ink2: #cdbac7; --muted: #ad98a7;
    --line: #3a2836; --axis: #4e3a49; --accent: #f7a8d8; --accent-ink: #f9c0e2; --accent-tint: #43213a; --on-accent: #2a0b20; --grad: linear-gradient(120deg, #f7a8d8, #edc07a);
    --side: #1a0c16; --side-ink: #d8c5d2; --shadow: none;
    --good: #6fd08e; --good-t: #17331f; --warn: #f0c681; --warn-t: #3a2c10; --bad: #f28b8b; --bad-t: #3d1c1c; --info: #d9b4ec; --info-t: #33203f;
    --s1: #d6409f; --s2: #b9852a; --st-neutral: #6f5f6a;
    --t-indigo: #f9c0e2; --t-indigo-b: #43213a; --t-violet: #e7c6dd; --t-violet-b: #3b2234; --t-teal: #f0c681; --t-teal-b: #3a2c10; --t-sky: #f7a8d8; --t-sky-b: #40203a; --t-amber: #f0c681; --t-amber-b: #3a2c10; --t-rose: #f7a8a8; --t-rose-b: #47192a; --t-emerald: #a7f3d0; --t-emerald-b: #0f3b2c;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 15px; line-height: 1.3; font-weight: 650; }
h3 { font-size: 14px; }
a { color: var(--accent-ink); }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 30; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.neg { color: var(--bad); }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ell-2 { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kerangka */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100dvh; }
.nav { position: sticky; top: 0; align-self: start; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; background: linear-gradient(180deg, #3a0f2e 0%, #5a1a47 70%, #6d2251 100%); }
.brand { display: flex; justify-content: center; background: #fff; border-radius: 14px; padding: 10px; margin-bottom: 14px; }
.brand img { display: block; width: 100%; height: auto; max-height: 96px; object-fit: contain; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 var(--gold); }
.nav a[hidden] { display: none; }
.nav :focus-visible { outline-color: #fff; }
main { padding: 28px; max-width: 1320px; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }

.head { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; justify-content: space-between; }
.head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; }
label.f.inline { grid-auto-flow: column; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); }
label.f.inline select { min-width: 150px; min-height: 38px; color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-width: 0; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 10px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.card-head p { margin-top: 1px; }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .l { color: var(--ink2); font-size: 13px; font-weight: 500; }
.kpi .v { font-size: 23px; font-weight: 700; line-height: 1.25; margin-top: 4px; overflow-wrap: anywhere; letter-spacing: -.01em; }
.kpi .s { color: var(--ink2); font-size: 13px; margin-top: 4px; }
.kpi.hero { background: linear-gradient(125deg, #4a1438, #b5126e); border-color: transparent; color: #fff; }
.kpi.hero .l, .kpi.hero .s { color: #fde7f3; }
.kpi.hero .hint { color: #fde7f3; }
.kpi.hero .v.neg { color: #ffb4b4; }
.grid-a { display: grid; gap: 16px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 550; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--wash); }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.1); background: var(--grad); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.btn.link { border: 0; background: none; padding: 0 4px; color: var(--accent-ink); }
.th-btn { all: unset; cursor: pointer; font: inherit; color: inherit; }
.th-btn:focus-visible { outline: 2px solid var(--accent); border-radius: 3px; }
.th-btn:hover { color: var(--ink); }

.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; white-space: nowrap; text-decoration: none; color: var(--ink2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--accent-ink); border-color: var(--accent); }
.count { font-size: 12px; padding: 0 7px; border-radius: 999px; background: var(--wash); color: var(--ink2); font-weight: 600; }
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.strip > div { display: grid; gap: 1px; padding: 10px 16px; border-left: 1px solid var(--line); min-width: 0; }
.strip > div:first-child { border-left: 0; }
.strip span { font-size: 13px; color: var(--ink2); }
.strip strong { font-size: 15px; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.dense th, table.dense td { padding: 9px 10px; font-size: 14px; }
th, table.dense th { font-size: 13px; color: var(--ink2); font-weight: 600; white-space: nowrap; }
th.num { text-align: right; }
tbody tr:hover { background: color-mix(in srgb, var(--wash) 50%, transparent); }
tr.total td { font-weight: 700; border-top: 1px solid var(--ink2); border-bottom: 0; }
tr.sub td { font-weight: 650; }
.pl td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl tbody tr:hover { background: none; }

.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--wash); color: var(--ink2); }
.badge.good { background: var(--good-t); color: var(--good); }
.badge.warn { background: var(--warn-t); color: var(--warn); }
.badge.bad { background: var(--bad-t); color: var(--bad); }
.badge.info { background: var(--info-t); color: var(--info); }
.note { padding: 11px 14px; border-radius: 10px; background: var(--info-t); color: var(--ink); font-size: 14px; }
.note.warn { background: var(--warn-t); }
.note.bad { background: var(--bad-t); }

/* Grafik dan indikator */
.meter { display: block; height: 6px; border-radius: 3px; background: var(--wash); overflow: hidden; margin-top: 4px; min-width: 56px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.meter.bad i { background: var(--st-bad); }
.st-good { background: var(--st-good); } .st-warn { background: var(--st-warn); } .st-bad { background: var(--st-bad); }
.st-neutral { background: var(--st-neutral); } .st-s1 { background: var(--s1); } .st-s2 { background: var(--s2); }
.stackbar { display: flex; gap: 2px; height: 12px; margin-bottom: 12px; }
.stackbar span { min-width: 4px; }
.stackbar span:first-child { border-radius: 4px 0 0 4px; }
.stackbar span:last-child { border-radius: 0 4px 4px 0; }
.stackbar span:only-child { border-radius: 4px; }
.legend { display: grid; gap: 6px; font-size: 14px; }
.legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; gap: 8px; align-items: center; }
.legend li > i { width: 10px; height: 10px; border-radius: 3px; }
.legend li > .muted { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.legend li > strong { font-variant-numeric: tabular-nums; }
.legend.inline { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 10px; color: var(--ink2); font-size: 13px; }
.legend.inline li { display: flex; gap: 6px; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 10px; align-items: baseline; font-size: 14px; }
.hbar .track { grid-column: 1 / -1; }
.cols { display: grid; grid-template-columns: 60px minmax(0, 1fr); height: 232px; }
.cols-y { position: relative; height: 200px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cols-y span { position: absolute; right: 8px; transform: translateY(-50%); white-space: nowrap; }
.cols-plot { position: relative; display: flex; height: 200px; gap: 2px; }
.cols-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.cols-zero { position: absolute; left: 0; right: 0; height: 1px; background: var(--axis); z-index: 1; }
.col { --bw: min(22px, 38%); position: relative; flex: 1 1 0; min-width: 0; height: 100%; border-radius: 4px; outline-offset: -2px; }
.col:hover { background: color-mix(in srgb, var(--wash) 70%, transparent); }
.col-bars { position: absolute; inset: 0; }
.col-bars i { position: absolute; display: block; width: var(--bw); border-radius: 4px 4px 0 0; }
.col-bars i.neg { border-radius: 0 0 4px 4px; }
.col-bars i:first-child:not(:last-child) { left: calc(50% - var(--bw) - 1px); }
.col-bars i:last-child:not(:first-child) { left: calc(50% + 1px); }
.col-bars i:only-child { left: calc(50% - var(--bw) / 2); }
.col-x { position: absolute; top: calc(100% + 8px); left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); }
#tip { position: fixed; z-index: 60; max-width: 280px; padding: 8px 11px; border-radius: 8px; background: var(--ink); color: var(--page); font-size: 13px; line-height: 1.45; white-space: pre-line; pointer-events: none; font-variant-numeric: tabular-nums; }
#tip[hidden] { display: none; }

.alerts { display: grid; gap: 2px; }
.alerts a { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; padding: 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; align-items: start; }
.alerts a:hover { background: var(--wash); }
.alerts .badge { justify-self: start; }
.alert-t small { display: block; font-size: 12px; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--good); font-weight: 550; }

/* Daftar */
.list { display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: space-between; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: 100%; text-align: left; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
button.row, a.row { cursor: pointer; }
button.row:hover, a.row:hover { background: var(--wash); }
.row .main { min-width: 0; flex: 1 1 220px; }
.row .t { font-weight: 650; }
.row .right { text-align: right; margin-left: auto; }
.ev-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ev-card { display: grid; gap: 10px; color: inherit; text-decoration: none; }
.ev-card:hover { border-color: var(--accent); }
.ev-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ev-name { font-weight: 700; font-size: 16px; line-height: 1.3; }
.ev-figs { display: grid; grid-template-columns: 1.4fr .8fr 1.2fr; gap: 8px; padding: 10px 0; border-block: 1px solid var(--line); }
.ev-figs > div { display: grid; min-width: 0; align-content: start; }
.ev-figs strong { overflow-wrap: anywhere; }
.ev-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.who { display: inline-flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink2); display: grid; gap: 14px; justify-items: center; }

/* Form */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input[type=search] { flex: 1 1 200px; }
input, select, textarea { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--axis); border-radius: 10px; background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); flex: none; }
textarea { min-height: 72px; }
label.f { display: grid; gap: 4px; font-weight: 550; font-size: 14px; min-width: 0; }
label.f small { font-weight: 400; color: var(--ink2); font-size: 12px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }

dialog { width: min(640px, calc(100vw - 48px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(0, 0, 0, .28); overflow: hidden; }
dialog.lg { width: min(780px, calc(100vw - 48px)); }
dialog.sm { width: min(440px, calc(100vw - 48px)); }
dialog[open] { display: flex; flex-direction: column; }
dialog:focus { outline: none; }
dialog::backdrop { background: rgba(8, 20, 18, .55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dlg { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.dlg-head { flex: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 64px; padding: 12px 16px 12px 24px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.dlg-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; padding: 20px 24px; }
.dlg-body .table-wrap { margin: 0; padding: 0; }
.dlg-foot { flex: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.foot-l, .foot-r { display: flex; flex-wrap: wrap; gap: 8px; }
.foot-r { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.form-sec { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.form-sec + .form-sec { padding-top: 18px; border-top: 1px solid var(--line); }
.sec-t h3 { font-size: 15px; font-weight: 650; }
.lb { font-weight: 550; }
.req { color: var(--bad); }
.rp { position: relative; display: block; }
.rp i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--ink2); font-size: 14px; pointer-events: none; }
.rp input { padding-left: 36px; }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn.ghost:hover { background: var(--wash); color: var(--ink); }
.btn.danger-solid { background: var(--st-bad); border-color: var(--st-bad); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); background: var(--st-bad); }
.tier + .tier .lb, .cat + .cat .lb, .item-row + .item-row .lb { display: none; }

/* Baris pesanan dan status */
.order-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(0, 1.1fr) 150px; gap: 8px 20px; align-items: start; }
.oc { display: grid; gap: 3px; justify-items: start; min-width: 0; }
.oc-r { justify-items: end; text-align: right; }
.oc-l { display: block; font-size: 12px; color: var(--ink2); font-weight: 600; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px 14px; background: var(--wash); border-radius: 12px; }
.status-grid .badge:not(.good):not(.warn):not(.bad):not(.info) { background: var(--surface); }
.status-grid > div { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.tl { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; counter-reset: none; }
.tl li { position: relative; display: grid; gap: 2px; justify-items: center; text-align: center; font-size: 13px; min-width: 0; }
.tl li::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.tl li:first-child::before { display: none; }
.tl li.on::before { background: var(--accent); }
.tl .dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--axis); color: var(--on-accent); }
.tl .dot .ic { width: 14px; height: 14px; stroke-width: 3; }
.tl li.on .dot { background: var(--accent); border-color: var(--accent); }
.tl li.part .dot { border-color: var(--st-warn); background: var(--warn-t); }
.tl-l { font-weight: 600; margin-top: 4px; }
.tl-d { color: var(--ink2); font-size: 12px; }
form.stack { display: grid; gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; display: grid; gap: 10px; min-width: 0; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.tier { display: grid; grid-template-columns: 1fr 1fr 100px 1fr 42px; gap: 6px; align-items: end; }
.tier .from { min-height: 42px; display: flex; align-items: center; padding: 0 10px; background: var(--wash); border-radius: 10px; font-size: 14px; overflow: hidden; white-space: nowrap; }
.cat { display: grid; grid-template-columns: 1.4fr 100px 1fr 42px; gap: 6px; align-items: end; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 42px; gap: 6px; align-items: end; }
.icon { width: 42px; min-height: 42px; padding: 0; }
.err { color: var(--bad); font-size: 14px; font-weight: 550; }
.preview { font-size: 14px; padding: 9px 11px; background: var(--accent-tint); border-radius: 10px; }
.shop-store { margin-top: 4px; font-weight: 650; color: var(--ink2); font-size: 13px; }
.inv-acts { flex-basis: 100%; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 10px 14px; border-radius: 10px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }

/* Invoice selalu berlatar putih seperti kertas, termasuk pada mode gelap. */
.inv-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: center; }
.invoice { width: 100%; max-width: 794px; background: #fff; color: #17201d; border: 1px solid var(--line); border-radius: 10px; padding: 36px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; font-size: 14px; box-shadow: var(--shadow); }
.invoice tbody tr:hover { background: none; }
.inv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-bottom: 16px; border-bottom: 3px solid #edc07a; }
.inv-biz { font-size: 18px; font-weight: 700; }
.inv-title { text-align: right; margin-left: auto; color: #47524d; font-size: 13px; }
.inv-word { font-size: 24px; font-weight: 800; letter-spacing: .04em; color: #b5126e; }
.inv-status { display: inline-block; margin-top: 6px; padding: 2px 10px; border: 1px solid #17201d; border-radius: 999px; font-weight: 700; color: #17201d; }
.inv-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.inv-l { font-size: 12px; font-weight: 700; color: #47524d; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.inv-to { font-weight: 700; font-size: 15px; }
.inv-pre { white-space: pre-line; overflow-wrap: anywhere; }
.inv-table th { color: #47524d; }
.inv-table td, .inv-table th { border-color: #dde2dc; padding: 8px 6px; }
.inv-table th { border-bottom-color: #17201d; }
.inv-note { font-size: 12px; color: #47524d; }
.inv-totals { width: min(340px, 100%); margin-left: auto; }
.inv-totals td { padding: 5px 6px; border: 0; }
.inv-totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-totals .sub td { font-weight: 700; border-top: 1px solid #dde2dc; }
.inv-totals .grand td { font-weight: 800; font-size: 15px; background: #fde7f3; }
.inv-sec { break-inside: avoid; }
.inv-pay { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 2px 0; }
.inv-pay-box { padding: 12px; background: #fdf6e9; border-radius: 8px; }
.inv-foot { text-align: center; color: #47524d; font-size: 13px; padding-top: 12px; border-top: 1px solid #dde2dc; }

/* Identitas warna */
.tile { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; }
.tile .ic { width: 18px; height: 18px; }
.t-indigo { background: var(--t-indigo-b); color: var(--t-indigo); } .t-violet { background: var(--t-violet-b); color: var(--t-violet); } .t-teal { background: var(--t-teal-b); color: var(--t-teal); }
.t-sky { background: var(--t-sky-b); color: var(--t-sky); } .t-amber { background: var(--t-amber-b); color: var(--t-amber); } .t-rose { background: var(--t-rose-b); color: var(--t-rose); } .t-emerald { background: var(--t-emerald-b); color: var(--t-emerald); }
.t-hero { background: rgba(237, 192, 122, .22); color: var(--gold); }
.kpi { position: relative; }
.kpi > .tile { position: absolute; top: 14px; right: 14px; }
.kpi .l { padding-right: 42px; min-height: 20px; }
.card-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.card:hover { box-shadow: 0 2px 4px rgba(17, 24, 39, .05), 0 12px 32px rgba(30, 27, 75, .08); }
.tabs a .ic { width: 16px; height: 16px; }
.tabs a[aria-current="page"] .ic { color: var(--accent); }
.user-box { margin-top: auto; display: grid; grid-template-columns: 34px minmax(0, 1fr) 40px; gap: 8px; align-items: center; padding: 10px 6px 2px; border-top: 1px solid rgba(255, 255, 255, .14); color: #fff; }
.user-box:empty { display: none; }
.user-box .btn.ghost { color: var(--side-ink); }
.user-box .btn.ghost:hover { background: var(--side-active); color: #fff; }
.who-t { display: grid; justify-items: start; gap: 2px; min-width: 0; font-size: 13px; }
.who-t strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.role.owner { background: var(--gold); color: #3a2200; }
.role.admin { background: #fde7f3; color: #8a1057; }
.topbar { display: none; }
.perm { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.perm .ic { width: 14px; height: 14px; stroke-width: 3; }
.perm.yes { background: var(--good-t); color: var(--good); }
.perm.no { background: var(--wash); color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.logo-field { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.logo-box { width: 132px; height: 72px; display: grid; place-items: center; border: 1px dashed var(--axis); border-radius: 12px; background: #fff; color: #6b7280; flex: none; overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-side { display: grid; gap: 6px; flex: 1 1 220px; min-width: 0; }
.inv-logo { display: block; max-width: 180px; max-height: 64px; object-fit: contain; object-position: left center; margin-bottom: 8px; }
.code-box { padding: 14px; border-radius: 12px; background: var(--wash); text-align: center; font: 700 20px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; overflow-wrap: anywhere; user-select: all; }
.btn.wide { width: 100%; min-height: 46px; }
body.auth .shell { display: block; padding: 0; }
body.auth .nav, body.auth .topbar { display: none; }
body.auth main { padding: 0; max-width: none; }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1000px 500px at 12% 0%, rgba(255, 102, 196, .35), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(237, 192, 122, .3), transparent 60%), linear-gradient(135deg, #3a0f2e, #5a1a47 60%, #6d2251); }
.auth-card { width: min(440px, 100%); display: grid; gap: 16px; padding: 28px; border-radius: 20px; background: var(--surface); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.auth-brand { display: grid; justify-items: center; gap: 8px; text-align: center; }
.auth-brand img { display: block; width: min(240px, 80%); height: auto; background: #fff; border-radius: 14px; padding: 8px; }

.sync { all: unset; cursor: pointer; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sync:focus-visible { outline: 2px solid #fff; border-radius: 3px; }
.sync.ok { color: #6ee7b7; } .sync.warn { color: #fcd34d; } .sync.bad { color: #fca5a5; }

.hint { display: inline-flex; vertical-align: -2px; margin-left: 5px; color: var(--muted); cursor: help; border-radius: 50%; }
.hint .ic { width: 14px; height: 14px; }
.crumb { display: flex; gap: 6px; font-size: 13px; color: var(--ink2); margin-bottom: -8px; }
.crumb a { color: var(--accent-ink); text-decoration: none; font-weight: 550; }
.crumb a:hover { text-decoration: underline; }
.tab-help { font-size: 14px; color: var(--ink2); margin-top: -6px; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; }
.chip { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--t-teal-b); color: var(--t-teal); white-space: nowrap; }
.setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.setup a { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 12px; height: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.setup a:hover { border-color: var(--accent); background: var(--accent-tint); }
.setup strong { display: block; font-size: 14px; }
.setup small { display: block; font-size: 13px; }
.setup .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--axis); color: var(--on-accent); }
.setup .dot .ic { width: 14px; height: 14px; stroke-width: 3; }
.setup .on .dot { background: var(--accent); border-color: var(--accent); }
.setup .on strong { color: var(--ink2); }
.app-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
body.auth .app-foot { display: none; }

.global { position: relative; }
#searchResults { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; max-height: 60vh; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(42, 17, 34, .18); }
#searchResults[hidden] { display: none; }
.sr-row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: center; width: 100%; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.sr-row:hover, .sr-row:focus-visible { background: var(--wash); outline: 2px solid var(--accent); }
.sr-row small { display: block; font-size: 13px; }
.sr-row .badge { justify-self: start; }
.sr-empty { padding: 8px; }
.field-err { display: block; color: var(--bad) !important; font-size: 13px !important; font-weight: 550 !important; }
[aria-invalid="true"] { border-color: var(--bad) !important; box-shadow: 0 0 0 1px var(--bad); }
.toast-btn { all: unset; cursor: pointer; font-weight: 700; text-decoration: underline; margin-left: 10px; }
.toast-btn:focus-visible { outline: 2px solid currentColor; border-radius: 3px; }
.skeleton { display: grid; gap: 14px; }
.skeleton i { display: block; height: 96px; border-radius: 14px; background: var(--wash); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.order-line { display: flex; align-items: stretch; gap: 8px; }
.order-line .row { flex: 1 1 auto; min-width: 0; }
.pick { align-self: center; width: 22px !important; height: 22px !important; }
.bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--accent-tint); position: sticky; top: 8px; z-index: 5; }
.more { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: center; padding: 10px 0 0; }
.qty { display: grid; grid-template-columns: 38px minmax(44px, 1fr) 38px; gap: 4px; }
.qty .btn.icon { width: 38px; font-size: 18px; }
.qty input { text-align: center; padding-inline: 4px; }
.item-row { grid-template-columns: minmax(0, 1fr) 140px 42px; }
.wa-box summary, .fx summary, .proof summary, .chart-data summary { cursor: pointer; font-size: 14px; font-weight: 550; color: var(--accent-ink); }
.wa-box { align-self: end; padding-bottom: 8px; }
.wa-box[open] { display: grid; gap: 6px; }
.fx { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.fx[open] summary { margin-bottom: 8px; }
.chart-data { margin-top: 10px; }
.chart-data .table-wrap { margin-top: 8px; }
.proof summary { font-weight: 500; font-size: 13px; text-align: right; }
.proof img { display: block; max-width: 220px; max-height: 280px; margin-top: 6px; border-radius: 8px; border: 1px solid var(--line); }
.proof-field { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.inv-pay-box { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; }
.inv-qr { width: 110px; height: 110px; object-fit: contain; background: #fff; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (pointer: coarse) { .btn.sm { min-height: 40px; } }

.pub-card { width: min(560px, 100%); }
.auth-wrap.pub { align-items: start; }
.pub-list { display: grid; gap: 8px; }
.pub-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.pub-item .qty { width: 140px; }
.pub-sum { display: grid; gap: 6px; }
.pub-sum li { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.code-link { overflow-wrap: anywhere; }
.tl.tl3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inbox { border-color: var(--accent); }
.inbox-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--line); }

.mfa-qr { width: 190px; height: 190px; background: #fff; padding: 8px; border-radius: 10px; justify-self: center; }
.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; vertical-align: middle; margin-right: 8px; }
.thumb.lg { width: 56px; height: 56px; margin-right: 0; }
.pub-item { flex-wrap: nowrap; }
.pub-name { flex: 1 1 auto; min-width: 0; }
.pub-item .qty { flex: none; }
@media (max-width: 420px) { .pub-item { flex-wrap: wrap; } }

.sync { min-height: 24px; }
.th-btn { display: inline-flex; align-items: center; min-height: 24px; }
.row a.t { display: inline-flex; align-items: center; min-height: 24px; }

/* Tablet: menu menjadi rail agar konten lebih lega */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-a { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 22px; }
}
@media (min-width: 761px) and (max-width: 1024px) {
  .shell { grid-template-columns: 88px minmax(0, 1fr); }
  .brand { padding: 6px; }
  .nav { padding: 14px 8px; }
  .nav a { flex-direction: column; justify-content: center; gap: 4px; min-height: 60px; padding: 4px 2px; font-size: 12px; text-align: center; }
  .nav a[aria-current="page"] { box-shadow: none; }
  .user-box { grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 8px 0 0; }
  .user-box .who-t { display: none; }
  .user-box .avatar { display: grid; }
}
@media (max-width: 760px) {
  .shell { display: block; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .user-box { display: none; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; color: #fff; background: linear-gradient(110deg, #3a0f2e, #5a1a47 60%, #6d2251); position: sticky; top: 0; z-index: 9; }
  .topbar img { border-radius: 8px; background: #fff; }
  .top-user { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .top-user .avatar { display: none; }
  .top-user .who-t { justify-items: end; }
  .top-user .btn.ghost { color: #fff; }
  .nav { background: linear-gradient(90deg, #3a0f2e, #5a1a47 60%, #6d2251); }
  .nav { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); z-index: 10; }
  .brand { display: none; }
  .nav a { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 2px; padding: 2px; font-size: 12px; min-height: 54px; }
  .nav a[aria-current="page"] { box-shadow: none; }
  main { padding: 16px; }
  h1 { font-size: 21px; }
  .grid2, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 18px; }
  .kpi .l { min-height: 38px; }
  .kpi.hero .l { min-height: 0; }
  .kpi > .tile { width: 30px; height: 30px; top: 12px; right: 12px; }
  .kpi > .tile .ic { width: 15px; height: 15px; }
  .kpi.hero { grid-column: 1 / -1; }
  .kpi.hero .v { font-size: 26px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .tabs a { padding: 10px 9px; font-size: 14px; }
  .count { display: none; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip > div { border-left: 0; border-top: 1px solid var(--line); }
  .strip > div:first-child { grid-column: 1 / -1; border-top: 0; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  label.f.inline { grid-auto-flow: row; gap: 2px; }
  label.f.inline select { min-width: 0; }
  .ev-grid { grid-template-columns: minmax(0, 1fr); }
  dialog, dialog.lg, dialog.sm { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  dialog.sm { height: auto; max-height: 80dvh; width: calc(100vw - 32px); max-width: calc(100vw - 32px); margin: auto; border-radius: 16px; }
  .dlg-head { padding: 10px 8px 10px 16px; min-height: 56px; }
  .dlg-body { padding: 16px; }
  .dlg-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
  .order-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-row { grid-template-columns: minmax(0, 1fr) 42px; }
  .item-row > label:first-child { grid-column: 1 / -1; }
  .sr-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .order-row > .oc:first-child, .order-row > .oc-r { grid-column: 1 / -1; }
  .order-row > .oc-r { order: 1; justify-items: start; text-align: left; grid-template-columns: auto auto; column-gap: 10px; align-items: baseline; padding-top: 8px; border-top: 1px solid var(--line); }
  .tl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tl li { grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 10px; justify-items: start; text-align: left; align-items: center; padding-bottom: 12px; }
  .tl li::before { top: -50%; left: 11px; width: 2px; height: 100%; }
  .tl-l { margin-top: 0; }
  .tier { grid-template-columns: 1fr 1fr; padding: 10px; background: var(--wash); border-radius: 12px; }
  .tier + .tier .lb, .cat + .cat .lb, .item-row + .item-row .lb { display: inline; }
  .tier .del { grid-column: 2; justify-self: end; }
  .cat { grid-template-columns: 1fr 1fr; }
  .cat .wide { grid-column: 1 / -1; }
  .alerts a { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .cols { grid-template-columns: 52px minmax(0, 1fr); }
  .invoice { padding: 18px; font-size: 13px; }
  .inv-table td, .inv-table th { padding: 7px 3px; }
  .inv-table { font-size: 12px; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  .nav, .tabs, .head .actions, .btn, #toast, #tip, .no-print, .skip, .filters { display: none !important; }
  .shell { display: block; padding: 0; }
  main { padding: 0; max-width: none; display: block; }
  main > * { margin-bottom: 10px; }
  body { background: #fff; color: #000; }
  .card { break-inside: avoid; box-shadow: none; }
  .kpi.hero { background: #fff; color: #000; border-color: #999; }
  .tile, .user-box, .topbar { display: none !important; }
  .kpi.hero .l, .kpi.hero .s { color: #333; }
  .inv-wrap { display: block; }
  .invoice { max-width: none; border: 0; border-radius: 0; padding: 0; break-after: page; box-shadow: none; }
  .invoice:last-child { break-after: auto; }
  .invoice, .invoice * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (forced-colors: active) {
  .stackbar span, .col-bars i, .meter i, .legend li > i { forced-color-adjust: none; }
}
