/*
 * Gelondongan — tema "label bal & kertas kraft".
 * Krem kertas, tinta arang, oranye tali/label bal. Mobile-first (360–430 px),
 * tablet ≥ 768 px, sidebar ≥ 1024 px.
 */
:root {
    --paper: #f4efe6;
    --paper-deep: #ebe3d4;
    --card: #fffdf8;
    --card-2: #f3ede2;
    --ink: #1f2428;
    --ink-2: #545b60;
    --ink-3: #8a8f90;
    --line: #e1d8c6;
    --line-strong: #cfc3ad;
    --accent: #df5a26;
    --accent-ink: #ffffff;
    --accent-soft: #fbe4d8;
    --accent-deep: #b8441a;
    --tag: #1f2428;
    --tag-ink: #f7f1e6;
    --side-bg: #1f2428;
    --side-ink: #f7f1e6;
    --ok: #2e7a4d;
    --ok-soft: #e0efe4;
    --warn: #9a5b06;
    --warn-soft: #f9ecd2;
    --err: #b3261e;
    --err-soft: #fbe2dd;
    --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --display: "Bricolage Grotesque", "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
    --r: 16px;
    --r-sm: 11px;
    --shadow: 0 1px 0 rgba(31, 36, 40, .04), 0 6px 18px -10px rgba(31, 36, 40, .18);
    --shadow-lg: 0 18px 50px -20px rgba(31, 36, 40, .45);
    --nav-h: 66px;
    --side-w: 248px;
    --tap: 50px;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .18 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    color-scheme: light;
}

/* Tema gelap dipilih lewat data-theme (lihat partials/head). Default: terang. */
:root[data-theme="dark"] {
    --paper: #15130f;
    --paper-deep: #1b1814;
    --card: #1f1c17;
    --card-2: #29251e;
    --ink: #f2ece1;
    --ink-2: #b4ab9b;
    --ink-3: #82796b;
    --line: #353027;
    --line-strong: #4a4337;
    --accent: #f06a33;
    --accent-ink: #1a0e07;
    --accent-soft: #3b2216;
    --accent-deep: #ff8a57;
    --tag: #f2ece1;
    --tag-ink: #1f1c17;
    --side-bg: #0d0b08;
    --side-ink: #f2ece1;
    --ok: #74c792;
    --ok-soft: #1c2e22;
    --warn: #f0b955;
    --warn-soft: #33270f;
    --err: #f2897f;
    --err-soft: #3a1c18;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3);
    --shadow-lg: 0 18px 50px -20px rgba(0, 0, 0, .8);
    --grain: none;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper) var(--grain);
    color: var(--ink);
    font: 500 16px/1.5 var(--font);
    font-feature-settings: "tnum" 1, "cv11" 1;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
button, input, select { font: inherit; color: inherit; }
b, strong { font-weight: 700; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.neg { color: var(--err); }
.pos { color: var(--ok); }
.strike { text-decoration: line-through; color: var(--ink-3); }
.link { color: var(--accent-deep); font-weight: 700; text-decoration: none; }
.num { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.num small { font-family: var(--font); font-weight: 600; font-size: .75em; color: var(--ink-2); }
.kicker { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); }

/* ================= SHELL ================= */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
}
.topbar-inner { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 12px 0 16px; max-width: 1180px; margin: 0 auto; }
.topbar-mark { border-radius: 8px; }
.topbar-title { flex: 1; font-family: var(--display); font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
    display: inline-grid; place-items: center; flex: none;
    width: 42px; height: 42px; border: 0; border-radius: 12px;
    background: transparent; color: inherit; text-decoration: none; cursor: pointer; font-size: 1.25rem; font-weight: 700;
}
.icon-btn:hover { background: var(--card-2); }
.icon-btn-line { border: 1.5px solid var(--line-strong); background: var(--card); }

.avatar {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: none;
    background: var(--tag); color: var(--tag-ink); font-family: var(--display); font-weight: 800; font-size: .95rem;
}
.avatar-soft { background: var(--accent-soft); color: var(--accent-deep); }

.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-panel {
    position: absolute; right: 0; top: 50px; min-width: 210px; z-index: 30;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
    box-shadow: var(--shadow-lg); padding: 6px; display: grid; animation: pop .14s ease-out;
}
.usermenu-name { padding: 10px; font-weight: 800; border-bottom: 1px dashed var(--line-strong); margin-bottom: 4px; }
.usermenu-name small { display: block; color: var(--ink-2); font-weight: 600; }
.usermenu-panel a, .usermenu-panel button {
    display: block; width: 100%; text-align: left; padding: 11px 10px; border: 0; background: none; border-radius: 8px;
    text-decoration: none; cursor: pointer; font-weight: 600;
}
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--card-2); }

/* Pilihan tema: Terang / Gelap / Otomatis */
.theme-switch { display: grid; gap: 6px; padding: 8px 10px 10px; }
.theme-switch > span { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.theme-switch > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border-radius: 10px; background: var(--card-2); }
.theme-switch button,
.usermenu-panel .theme-switch button {
    min-height: 34px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent;
    font-size: .8rem; font-weight: 700; color: var(--ink-2); text-align: center; cursor: pointer;
}
.theme-switch button[aria-pressed=true],
.usermenu-panel .theme-switch button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.usermenu-panel .theme-switch { border-bottom: 1px dashed var(--line-strong); margin-bottom: 4px; }
.login-panel .theme-switch { padding: 0; justify-self: center; width: 100%; max-width: 280px; }

.sidebar { display: none; }

.page { max-width: 1180px; margin: 0 auto; padding: 16px 16px 28px; display: grid; gap: 14px; }

/* Bottom nav (HP & tablet) */
.bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    display: flex; justify-content: center; gap: 4px;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 0 8px env(safe-area-inset-bottom);
}
.bottomnav a {
    flex: 1; max-width: 150px; height: var(--nav-h);
    display: grid; place-items: center; align-content: center; gap: 3px;
    text-decoration: none; color: var(--ink-3); font-size: .74rem; font-weight: 700;
    -webkit-tap-highlight-color: transparent;
}
.bottomnav svg, .sidenav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav svg { padding: 3px 14px; width: 54px; height: 30px; border-radius: 999px; transition: background .15s; box-sizing: content-box; padding: 3px 0; }
.bottomnav a.active { color: var(--ink); }
.bottomnav a.active svg { background: var(--accent-soft); color: var(--accent-deep); stroke-width: 2.2; }

/* ================= BUTTONS ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 0 18px; border-radius: var(--r-sm);
    border: 1.5px solid transparent; font-weight: 800; letter-spacing: .005em; text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent; user-select: none;
    transition: transform .08s, background .15s, box-shadow .15s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 var(--accent-deep), 0 8px 18px -10px var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--card-2); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-dark { background: var(--tag); color: var(--tag-ink); }
.btn-danger { background: var(--err); color: #fff; }
.btn-lg { min-height: 56px; font-size: 1.06rem; border-radius: 14px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
    content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-secondary.is-busy::after, .btn-ghost.is-busy::after { border-color: var(--line); border-top-color: var(--accent); }

/* ================= CARDS & FORMS ================= */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card-title { font-family: var(--display); font-size: 1.08rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-title small { font-family: var(--font); font-weight: 600; color: var(--ink-2); font-size: .82rem; }
.note { margin: 12px 0 0; font-size: .82rem; color: var(--ink-2); padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.grid-2 { display: grid; gap: 14px; }

.form { display: grid; gap: 16px; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 16px; min-width: 0; }
.field { display: grid; gap: 7px; }
.field > span { font-weight: 700; font-size: .9rem; }
.field > span small { font-weight: 500; color: var(--ink-2); }
.field > small { color: var(--ink-2); }
input:not([type=checkbox]):not([type=radio]), select {
    width: 100%; min-height: var(--tap); padding: 11px 14px;
    border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--card); color: var(--ink);
    font-weight: 600; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--ink-3); font-weight: 500; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input:disabled, select:disabled { background: var(--card-2); color: var(--ink-2); }
.input-xl { font-family: var(--display); font-size: 2rem !important; font-weight: 800 !important; text-align: center; min-height: 68px !important; letter-spacing: -.01em; }
.check { display: flex; align-items: center; gap: 10px; font-size: .94rem; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.check-big { align-items: flex-start; padding: 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: var(--card-2); }
.check-big:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); }
.check-big input { width: 26px; height: 26px; }
.field-err { color: var(--err); font-size: .88rem; font-weight: 600; margin: 0; }

/* ================= FEEDBACK ================= */
.alert { padding: 13px 15px; border-radius: var(--r-sm); font-size: .93rem; font-weight: 600; border: 1px solid transparent; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-link { display: flex; justify-content: space-between; text-decoration: none; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 800; background: var(--card-2); color: var(--ink-2); white-space: nowrap; letter-spacing: .01em; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.empty {
    grid-column: 1 / -1; display: grid; justify-items: center; gap: 6px; text-align: center;
    padding: 32px 18px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); color: var(--ink-2);
}
.empty strong { font-family: var(--display); font-size: 1.1rem; color: var(--ink); }
.empty .btn { margin-top: 8px; }
.empty-inline { margin: 0; color: var(--ink-2); padding: 8px 0; }

/* ================= STATS (label gantung) ================= */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats-1 { grid-template-columns: 1fr; }
.stat {
    position: relative; min-width: 0;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
    padding: 14px 15px 13px; display: grid; align-content: start; gap: 2px; box-shadow: var(--shadow);
    animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.stats .stat:nth-child(2) { animation-delay: .05s; }
.stats .stat:nth-child(3) { animation-delay: .1s; }
.stats .stat:nth-child(4) { animation-delay: .15s; }
.stat-label { font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.stat-value { font-family: var(--display); font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 4px; overflow-wrap: anywhere; }
.stat-sub { font-size: .78rem; color: var(--ink-3); font-weight: 600; }

/* Kartu utama berbentuk label bal: gelap, ujung terpotong, lubang tali. */
.stat-tag {
    grid-column: 1 / -1;
    background: var(--tag); color: var(--tag-ink); border: 0;
    clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%);
    padding: 18px 18px 16px;
}
.stat-tag::before {
    content: ""; position: absolute; top: 14px; right: 16px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--paper); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tag-ink) 30%, transparent);
}
.stat-tag::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
    background: repeating-linear-gradient(90deg, var(--accent) 0 18px, transparent 18px 26px);
}
.stat-tag .stat-label, .stat-tag .stat-sub { color: color-mix(in srgb, var(--tag-ink) 70%, transparent); }
.stat-tag .stat-value { font-size: 3rem; }
.stat-accent { grid-column: 1 / -1; }
.stats-2 .stat-tag { grid-column: auto; }
.stats-2 .stat-tag .stat-value { font-size: 2.4rem; }
.stat-accent .stat-value { color: var(--accent-deep); font-size: 2.1rem; }

/* ================= LISTS ================= */
.list { display: grid; gap: 8px; }
.item {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm);
    padding: 12px 14px; text-decoration: none; min-height: 64px; box-shadow: var(--shadow);
    transition: border-color .15s, transform .08s;
}
a.item:hover { border-color: var(--line-strong); }
a.item:active { transform: scale(.995); background: var(--card-2); }
.item-main { display: grid; gap: 1px; min-width: 0; flex: 1; }
.item-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-side { display: grid; justify-items: end; gap: 1px; text-align: right; flex: none; }
.item-col { display: grid; gap: 8px; align-items: stretch; }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item-flat { border: 0; border-bottom: 1px dashed var(--line-strong); border-radius: 0; min-height: 46px; padding: 8px 0; box-shadow: none; justify-content: space-between; background: none; }
.item-flat:last-child { border-bottom: 0; }

/* Kode bal / nomor seperti label cetak */
.code {
    flex: none; font-family: var(--display); font-weight: 800; font-size: .92rem; letter-spacing: .02em;
    padding: 7px 10px 7px 14px; border-radius: 6px; position: relative;
    background: var(--accent-soft); color: var(--accent-deep);
}
.code::before { content: ""; position: absolute; left: 5px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: currentColor; opacity: .6; }
.code-done { background: var(--ok-soft); color: var(--ok); }
.item-main > .code { justify-self: start; margin-bottom: 4px; overflow: visible; }
.time { flex: none; font-family: var(--display); font-weight: 800; font-size: .95rem; color: var(--ink-2); width: 46px; }
.delta { flex: none; min-width: 52px; text-align: center; font-family: var(--display); font-weight: 800; padding: 6px 8px; border-radius: 8px; background: var(--card-2); }
.delta.neg { background: var(--err-soft); }
.delta.pos { background: var(--ok-soft); }
.opname-nums { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: .9rem; }
.opname-nums b { color: var(--ink); font-family: var(--display); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions > * { flex: 1; }
.row-actions form { display: flex; }
.row-actions form .btn { flex: 1; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.kv { margin: 0; display: grid; gap: 8px; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.kv dt { color: var(--ink-2); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; text-align: right; }
.kv-total { border-top: 1.5px dashed var(--line-strong); padding-top: 9px; margin-top: 2px; }
.kv-total dt { color: var(--ink); font-weight: 800; }
.kv-total dd { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 10px; font-weight: 600; }
.bar-row strong { font-family: var(--display); min-width: 92px; text-align: right; }
.bar { height: 10px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; animation: grow .7s .2s cubic-bezier(.2, .8, .2, 1) both; }

.cashier-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line-strong); }
.cashier-row:first-of-type { padding-top: 0; }
.cashier-row:last-child { border-bottom: 0; padding-bottom: 0; }
.cashier-body { flex: 1; min-width: 0; }
.cashier-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cashier-meta { font-size: .85rem; color: var(--ink-2); margin-top: 2px; }
.cashier-meta b { color: var(--ink); }

/* ================= BERANDA ================= */
.daybar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.daybar-label { display: grid; }
.daybar-label strong { font-family: var(--display); font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
/* Pemilih tanggal: ‹ [Hari ini] › */
.datenav {
    display: inline-flex; align-items: stretch; height: 46px; flex: none;
    background: var(--card); border: 1.5px solid var(--line-strong); border-radius: 13px; box-shadow: var(--shadow);
}
.datenav-step {
    display: grid; place-items: center; width: 44px; color: var(--ink); text-decoration: none; border-radius: 11px;
    -webkit-tap-highlight-color: transparent;
}
.datenav-step:hover { background: var(--card-2); }
.datenav-step[aria-disabled=true] { color: var(--ink-3); opacity: .45; pointer-events: none; }
.datenav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.datenav-pick {
    position: relative; display: flex; align-items: center; gap: 8px; padding: 0 14px; min-width: 128px; justify-content: center;
    border-left: 1.5px solid var(--line); border-right: 1.5px solid var(--line);
    font-weight: 800; white-space: nowrap; cursor: pointer;
}
.datenav-pick svg { width: 18px; height: 18px; stroke-width: 1.9; color: var(--accent-deep); }
.datenav-pick:hover { background: var(--card-2); }
.datenav-pick input[type=date] {
    position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0;
    opacity: 0; cursor: pointer; box-shadow: none;
}
.datenav-pick input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.datenav-pick:focus-within { box-shadow: 0 0 0 3px var(--accent-soft); }
.page > .datenav { display: flex; }
.page > .datenav .datenav-pick { flex: 1; }
@media (min-width: 768px) { .page > .datenav { display: inline-flex; justify-self: start; } }

.onboarding { display: grid; gap: 12px; background: var(--card) linear-gradient(135deg, var(--accent-soft), transparent 55%); border-color: var(--line-strong); }
.onboarding h2 { font-family: var(--display); font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.onboarding .btn { justify-self: start; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; }
.steps li::before {
    content: counter(s); grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
    background: var(--tag); color: var(--tag-ink); font-family: var(--display); font-weight: 800;
}
.steps span { color: var(--ink-2); font-size: .9rem; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-actions .btn:only-child { grid-column: 1 / -1; }

/* ================= STOK / RIWAYAT ================= */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 999px;
    text-decoration: none; font-weight: 700; font-size: .9rem;
    background: var(--card); border: 1.5px solid var(--line); color: var(--ink-2);
}
.tabs a.active { background: var(--tag); color: var(--tag-ink); border-color: var(--tag); }
.tab-count { font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }

.searchbar { position: relative; display: flex; }
.searchbar svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.searchbar input[type=search] { padding-left: 44px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters > * { flex: 1 1 140px; }

/* ================= STRUK (keranjang & nota) ================= */
.receipt-paper {
    position: relative; background: var(--card); border: 1px solid var(--line); border-bottom: 0;
    border-radius: var(--r) var(--r) 0 0; padding: 18px 16px 22px; box-shadow: var(--shadow);
}
.receipt-paper::after {
    content: ""; position: absolute; left: -1px; right: -1px; bottom: -10px; height: 10px;
    background:
        linear-gradient(-45deg, transparent 6px, var(--card) 6px) 0 0 / 14px 10px repeat-x,
        linear-gradient(45deg, transparent 6px, var(--card) 6px) 0 0 / 14px 10px repeat-x;
    filter: drop-shadow(0 1px 0 var(--line));
}
.receipt-title { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 12px; border-bottom: 1.5px dashed var(--line-strong); }
.receipt-title h2 { font-family: var(--display); font-size: 1.15rem; font-weight: 800; }
.receipt { margin-bottom: 14px; }
.receipt-head { display: grid; text-align: center; gap: 2px; padding-bottom: 12px; border-bottom: 1.5px dashed var(--line-strong); }
.receipt-head strong { font-family: var(--display); font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }
.receipt .kv { margin-top: 12px; }
.receipt .btn { margin-top: 16px; }

.cart { list-style: none; margin: 0; padding: 0; display: grid; }
.cart-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); animation: slidein .2s ease-out; }
.cart-line:last-child { border-bottom: 0; }
.cart-desc { display: grid; }
.cart-desc strong { font-family: var(--display); font-size: 1.12rem; font-weight: 800; letter-spacing: -.01em; }
.cart-ctl { display: flex; gap: 6px; }
.cart-ctl button { width: 42px; height: 42px; border-radius: 11px; border: 1.5px solid var(--line-strong); background: var(--card); font-size: 1.15rem; font-weight: 700; cursor: pointer; }
.cart-ctl button:active { background: var(--card-2); }
.cart-ctl .del { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, var(--line)); }
.cart-readonly .cart-line { animation: none; }
.cart-empty { margin: 0; padding: 26px 8px; text-align: center; color: var(--ink-3); font-size: .92rem; }

/* ================= KASIR ================= */
.page-kasir .page { padding-bottom: 104px; }
.kasir { display: grid; gap: 14px; }
.kasir-entry { display: grid; gap: 14px; }
.entry-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.entry-head h2 { font-family: var(--display); font-size: 1.15rem; font-weight: 800; }
.stock-pill { font-size: .82rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: var(--card-2); color: var(--ink-2); white-space: nowrap; }
.stock-pill strong { color: var(--ink); font-family: var(--display); }
.entry-grid { display: grid; grid-template-columns: 128px 1fr; gap: 10px; }
.entry-grid .field > span { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.stepper { display: flex; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; height: 60px; background: var(--card); }
.stepper button { width: 38px; border: 0; background: var(--card-2); font-size: 1.4rem; font-weight: 700; cursor: pointer; flex: none; }
.stepper button:active { background: var(--line); }
.stepper input { border: 0 !important; border-radius: 0 !important; text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.5rem; min-height: 0 !important; padding: 0 !important; box-shadow: none !important; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-wrap { position: relative; display: flex; }
.price-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 800; pointer-events: none; }
.price-wrap input { padding-left: 44px !important; padding-right: 68px !important; font-family: var(--display); font-size: 1.5rem; font-weight: 800 !important; min-height: 60px !important; letter-spacing: -.01em; }
.btn-000 { position: absolute; right: 7px; top: 7px; bottom: 7px; padding: 0 11px; border: 0; border-radius: 8px; background: var(--tag); color: var(--tag-ink); font-family: var(--display); font-weight: 800; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    min-height: 42px; padding: 0 15px 0 13px; border-radius: 8px 999px 999px 8px; border: 1.5px solid var(--line-strong);
    background: var(--card); font-family: var(--display); font-weight: 800; cursor: pointer; transition: background .12s, border-color .12s;
}
.chip:hover { border-color: var(--accent); }
.chip:active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); }

.paybar {
    position: fixed; left: 0; right: 0; z-index: 15;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -16px rgba(31, 36, 40, .35);
}
.paybar-sum { flex: 1; display: grid; line-height: 1.2; }
.paybar-sum span { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.paybar-sum strong { font-family: var(--display); font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.paybar .btn { min-width: 136px; }
.paybar.is-over .paybar-sum strong { color: var(--err); }

/* Lembar bawah */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 10, .5); animation: fade .15s ease-out; }
.sheet-panel {
    position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
    background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
    display: grid; gap: 14px; animation: up .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet-panel::before { content: ""; justify-self: center; width: 42px; height: 5px; border-radius: 999px; background: var(--line-strong); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-family: var(--display); font-size: 1.3rem; font-weight: 800; }
.sheet-head .icon-btn { color: var(--ink-2); }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border-radius: var(--r-sm); background: var(--tag); color: var(--tag-ink); }
.pay-total strong { font-family: var(--display); font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--card-2); padding: 4px; border-radius: 13px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: grid; place-items: center; min-height: 46px; border-radius: 10px; font-weight: 800; color: var(--ink-2); cursor: pointer; transition: background .12s; }
.segmented input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.change { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: var(--ok-soft); color: var(--ok); border-radius: var(--r-sm); font-weight: 700; }
.change strong { font-family: var(--display); font-size: 1.5rem; }
.change strong.neg { color: var(--err); }
.result-icon { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; font-weight: 800; margin: 2px auto 0; }
.result-icon.ok { background: var(--ok-soft); color: var(--ok); animation: pop .3s cubic-bezier(.2, 1.4, .4, 1); }
.result-icon.warn { background: var(--warn-soft); color: var(--warn); }
#result-ok, #result-unknown { display: grid; gap: 12px; text-align: center; }
#result-ok h2, #result-unknown h2 { font-family: var(--display); font-size: 1.45rem; font-weight: 800; }
#result-ok .kv, #result-ok .cart { text-align: left; }
#result-unknown p { margin: 0; }

.danger-zone summary { cursor: pointer; font-weight: 800; color: var(--err); list-style: none; }
.danger-zone summary::-webkit-details-marker { display: none; }
.danger-zone summary::before { content: "▸ "; }
.danger-zone[open] summary::before { content: "▾ "; }
.danger-zone .form { margin-top: 14px; }
.user-card summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.user-card summary::-webkit-details-marker { display: none; }
.user-card .form { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }

/* ================= LOGIN ================= */
.login-body { padding: 0; }
.login { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.login-hero {
    position: relative; overflow: hidden; padding: 40px 20px 64px;
    background:
        repeating-linear-gradient(-35deg, transparent 0 22px, rgba(255, 255, 255, .035) 22px 44px),
        var(--tag);
    color: var(--tag-ink);
}
.login-tag {
    position: relative; max-width: 360px; margin: 0 auto; padding: 26px 22px 24px;
    background: var(--accent); color: #fff; border-radius: 6px;
    clip-path: polygon(0 0, calc(100% - 34px) 0, 100% 34px, 100% 100%, 0 100%);
    transform: rotate(-3deg); box-shadow: var(--shadow-lg); display: grid; gap: 6px;
    animation: swing 1.1s cubic-bezier(.3, 1.4, .5, 1) both;
}
.login-tag-hole { position: absolute; top: 16px; right: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--tag); }
.login-tag-kicker { font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; opacity: .85; }
.login-tag strong { font-family: var(--display); font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.login-tag > span:last-child { font-weight: 600; opacity: .92; }
.login-panel {
    position: relative; margin: -32px 12px 24px; padding: 22px 18px; align-self: start;
    background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
    display: grid; gap: 18px; max-width: 440px; width: calc(100% - 24px); justify-self: center;
    animation: rise .5s .1s cubic-bezier(.2, .8, .2, 1) both;
}
.login-head { display: flex; gap: 12px; align-items: center; }
.login-head img { border-radius: 10px; }
.login-head h1 { font-family: var(--display); font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.login-head p { margin: 0; color: var(--ink-2); font-size: .9rem; }

/* ================= ANIMASI ================= */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes slidein { from { opacity: 0; transform: translateX(-8px); } }
@keyframes swing { from { transform: rotate(-14deg) translateY(-20px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= TABLET ≥ 768 ================= */
@media (min-width: 768px) {
    .page { padding: 22px 24px 36px; gap: 16px; }
    .stats { grid-template-columns: 1.5fr 1fr 1fr 1.3fr; }
    .stats-2 { grid-template-columns: 1.5fr 1fr; }
    .stats-1 { grid-template-columns: 1fr; }
    .stat-tag, .stat-accent { grid-column: auto; }
    .stat-accent .stat-value { font-size: 1.75rem; }
    .stats-2 .stat-tag { grid-column: auto; }
    .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; }
    .list { grid-template-columns: 1fr 1fr; }
    .quick-actions { grid-template-columns: repeat(2, minmax(0, 220px)); }
    .quick-actions .btn:only-child { grid-column: auto; }
    .card.form, form.card { width: 100%; max-width: 600px; }
    .tabs { margin: 0; padding: 2px 0; }

    /* Kasir: input kiri, struk kanan berisi tombol bayar */
    .kasir { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; gap: 18px; }
    .kasir-cart { position: sticky; top: 80px; display: grid; max-height: calc(100vh - 110px - var(--nav-h)); grid-template-rows: auto 1fr auto auto; }
    .kasir-cart .cart { overflow-y: auto; }
    .page-kasir .page { padding-bottom: 36px; }
    .paybar { position: static; padding: 14px 0 0; margin-top: 8px; background: none; border-top: 1.5px dashed var(--line-strong); box-shadow: none; flex-wrap: wrap; }
    .paybar .btn { flex: 1 1 100%; }
    .entry-grid { grid-template-columns: 150px 1fr; }
    .sheet { align-items: center; }
    .sheet-panel { border-radius: 22px; padding-top: 18px; }
    .sheet-panel::before { display: none; }

    .login { grid-template-rows: none; grid-template-columns: 1.1fr 1fr; }
    .login-hero { display: grid; place-items: center; padding: 40px; }
    .login-tag { max-width: 400px; width: 100%; padding: 34px 30px 30px; }
    .login-tag strong { font-size: 3rem; }
    .login-panel { margin: 0; align-self: center; width: calc(100% - 64px); padding: 30px 28px; }
}

/* ================= DESKTOP ≥ 1024: sidebar ================= */
@media (min-width: 1024px) {
    body { padding-bottom: 0; }
    .bottomnav { display: none; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
        display: flex; flex-direction: column; gap: 22px; padding: 22px 16px;
        background: var(--side-bg); color: var(--side-ink); border-right: 1px solid var(--line);
    }
    .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 6px; }
    .brand img { border-radius: 10px; }
    .brand span { font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; line-height: 1.05; }
    .brand small { display: block; font-family: var(--font); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .6; }
    .sidenav { display: grid; gap: 4px; }
    .sidenav a {
        display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
        text-decoration: none; font-weight: 700; color: color-mix(in srgb, var(--side-ink) 72%, transparent);
        transition: background .15s, color .15s;
    }
    .sidenav a:hover { background: color-mix(in srgb, var(--side-ink) 8%, transparent); color: var(--side-ink); }
    .sidenav a.active { background: var(--accent); color: #fff; }
    .sidebar-foot { margin-top: auto; display: grid; gap: 4px; }
    .sidebar-foot > a { padding: 9px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: .9rem; color: color-mix(in srgb, var(--side-ink) 70%, transparent); }
    .sidebar-foot > a:hover { background: color-mix(in srgb, var(--side-ink) 8%, transparent); color: var(--side-ink); }
    .sidebar-user { display: flex; align-items: center; gap: 10px; padding: 14px 6px 10px; margin-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--side-ink) 22%, transparent); font-weight: 700; }
    .sidebar-user small { display: block; font-weight: 600; font-size: .78rem; opacity: .6; }
    .sidebar-user .avatar { background: var(--accent); color: #fff; }
    .sidebar .btn-ghost { color: var(--side-ink); border-color: color-mix(in srgb, var(--side-ink) 25%, transparent); }

    .shell { margin-left: var(--side-w); }
    .topbar-inner { height: 68px; padding: 0 32px; }
    .topbar-mark, .usermenu { display: none; }
    .topbar-title { font-size: 1.6rem; }
    .page { padding: 26px 32px 48px; }
    .list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
    .kasir-cart { max-height: calc(100vh - 110px); }
}

@media (min-width: 1280px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .stat-tag .stat-value { font-size: 3.4rem; }
}

@media (min-width: 1024px) {
    .sidebar .theme-switch { padding: 10px 6px 4px; }
    .sidebar .theme-switch > span { color: color-mix(in srgb, var(--side-ink) 50%, transparent); }
    .sidebar .theme-switch > div { background: color-mix(in srgb, var(--side-ink) 9%, transparent); }
    .sidebar .theme-switch button { color: color-mix(in srgb, var(--side-ink) 72%, transparent); }
    .sidebar .theme-switch button[aria-pressed=true] { background: var(--accent); color: #fff; box-shadow: none; }
}
