/* =====================================================
   KUKIKOE — gaya bersama semua halaman
   Tanpa framework: satu file kecil, tidak bergantung CDN.
   ===================================================== */

:root{
    --bg:          #f5f4f1;
    --surface:     #ffffff;
    --surface-2:   #f0eee9;
    --border:      #e3e0d9;
    --border-strong:#cfcac0;
    --text:        #1c1a17;
    --text-2:      #57534c;
    --muted:       #8a857b;

    --accent:      #9c3d17;
    --accent-hover:#84320f;
    --accent-soft: #f6e9e2;
    --accent-ink:  #ffffff;

    --ok:          #2d6a45;
    --ok-soft:     #e5f0e8;
    --warn:        #8a5a00;
    --warn-soft:   #fbf0d9;
    --danger:      #b42318;
    --danger-soft: #fbe9e7;

    --radius:      10px;
    --radius-sm:   7px;
    --shadow:      0 1px 2px rgba(28,26,23,.06), 0 1px 1px rgba(28,26,23,.04);
    --shadow-lg:   0 12px 32px rgba(28,26,23,.18);

    --topbar-h:    56px;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after{ box-sizing:border-box; }

html{
    -webkit-text-size-adjust:100%;
    /* Tidak ada zoom dobel-ketuk: ketuk cepat produk berulang tidak boleh memperbesar halaman. */
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
}

body{
    margin:0;
    background:var(--bg);
    color:var(--text);
    font:15px/1.45 var(--font);
    -webkit-font-smoothing:antialiased;
}

h1,h2,h3,h4{ margin:0; font-weight:650; letter-spacing:-.01em; }
p{ margin:0; }
img{ display:block; max-width:100%; }
button,input,select{ font:inherit; color:inherit; }
button{ cursor:pointer; }
[hidden]{ display:none !important; }

.num{ font-variant-numeric:tabular-nums; }
.muted{ color:var(--muted); }
.small{ font-size:13px; }
.mobile-only{ display:none !important; }
@media (max-width:760px){ .mobile-only{ display:inline-flex !important; } }
.sr-only{
    position:absolute; width:1px; height:1px; overflow:hidden;
    clip:rect(0 0 0 0); white-space:nowrap;
}


/* --- Ikon --- */

.i{
    width:18px; height:18px; flex:none;
    fill:none; stroke:currentColor; stroke-width:2;
    stroke-linecap:round; stroke-linejoin:round;
    vertical-align:middle;
}
.i-sm{ width:15px; height:15px; }
.i-lg{ width:22px; height:22px; }
.i-fill{ fill:currentColor; }


/* --- Tombol --- */

.btn{
    display:inline-flex; align-items:center; justify-content:center; gap:7px;
    min-height:40px; padding:0 14px;
    border:1px solid var(--border-strong); border-radius:var(--radius-sm);
    background:var(--surface); color:var(--text);
    font-weight:600; font-size:14px; white-space:nowrap;
    transition:background .12s, border-color .12s;
}
.btn:disabled{ opacity:.55; cursor:not-allowed; }
.btn:focus-visible,
.input:focus-visible,
.chip:focus-visible,
.tab:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.btn-primary{ background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.btn-danger{ color:var(--danger); }
.btn-solid-danger{ background:var(--danger); border-color:var(--danger); color:#fff; }
.btn-ghost{ border-color:transparent; background:transparent; }
.btn-lg{ min-height:52px; font-size:16px; padding:0 18px; }
.btn-block{ width:100%; }
.btn-icon{ width:40px; padding:0; }
.btn-icon.btn-sm{ width:32px; min-height:32px; }
.btn-sm{ min-height:32px; padding:0 10px; font-size:13px; }


/* --- Form --- */

.field{ display:flex; flex-direction:column; gap:5px; }
.label{ font-size:13px; font-weight:600; color:var(--text-2); }
.hint{ font-size:12.5px; color:var(--muted); }

.input{
    width:100%; min-height:40px; padding:8px 11px;
    border:1px solid var(--border-strong); border-radius:var(--radius-sm);
    background:var(--surface);
}
.input:focus{ border-color:var(--accent); outline:none; box-shadow:0 0 0 3px var(--accent-soft); }
.input-lg{ min-height:52px; font-size:20px; font-weight:600; }

.input-group{ position:relative; display:flex; align-items:center; }
.input-group > .i{ position:absolute; left:11px; color:var(--muted); pointer-events:none; }
.input-group > .input{ padding-left:36px; }
.input-group > .prefix{
    position:absolute; left:12px; color:var(--muted); font-weight:600; pointer-events:none;
}
.input-group > .prefix + .input{ padding-left:38px; }

/* Saklar */
.switch{
    display:flex; align-items:flex-start; gap:12px; padding:10px 12px;
    border:1px solid var(--border); border-radius:var(--radius-sm); cursor:pointer;
}
.switch input{ position:absolute; opacity:0; pointer-events:none; }
.switch-track{
    position:relative; width:36px; height:20px; margin-top:1px; flex:none;
    border-radius:20px; background:var(--border-strong); transition:background .15s;
}
.switch-track::after{
    content:""; position:absolute; top:2px; left:2px; width:16px; height:16px;
    border-radius:50%; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.25);
    transition:transform .15s;
}
.switch input:checked + .switch-track{ background:var(--accent); }
.switch input:checked + .switch-track::after{ transform:translateX(16px); }
.switch input:focus-visible + .switch-track{ outline:2px solid var(--accent); outline-offset:2px; }
.switch-text{ display:flex; flex-direction:column; font-size:14px; font-weight:600; }
.switch-text small{ font-weight:400; color:var(--muted); font-size:12.5px; }


/* --- Chip & segmented --- */

.chips{
    display:flex; gap:6px; overflow-x:auto; scrollbar-width:none;
    padding-bottom:2px;
}
.chips::-webkit-scrollbar{ display:none; }

.chip{
    flex:none; display:inline-flex; align-items:center; gap:6px;
    min-height:36px; padding:0 14px;
    border:1px solid var(--border); border-radius:999px;
    background:var(--surface); color:var(--text-2);
    font-size:14px; font-weight:600;
}
.chip[aria-pressed="true"]{ background:var(--text); border-color:var(--text); color:#fff; }

.segmented{
    display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:4px;
    padding:4px; border-radius:var(--radius); background:var(--surface-2);
}
.segmented button{
    display:flex; align-items:center; justify-content:center; gap:7px;
    min-height:38px; border:0; border-radius:var(--radius-sm);
    background:transparent; color:var(--text-2); font-weight:600; font-size:14px;
}
.segmented button[aria-pressed="true"]{ background:var(--surface); color:var(--text); box-shadow:var(--shadow); }


/* --- Badge --- */

.badge{
    display:inline-flex; align-items:center; gap:4px;
    padding:2px 8px; border-radius:999px;
    font-size:12px; font-weight:600; line-height:1.5;
    background:var(--surface-2); color:var(--text-2);
}
.badge-accent{ background:var(--accent-soft); color:var(--accent); }
.badge-ok{ background:var(--ok-soft); color:var(--ok); }
.badge-warn{ background:var(--warn-soft); color:var(--warn); }
.badge-danger{ background:var(--danger-soft); color:var(--danger); }


/* --- Panel --- */

.panel{
    background:var(--surface); border:1px solid var(--border);
    border-radius:var(--radius); box-shadow:var(--shadow);
}
.panel-head{
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:14px 16px; border-bottom:1px solid var(--border);
}
.panel-body{ padding:16px; }

.empty{
    display:flex; flex-direction:column; align-items:center; gap:8px;
    padding:40px 16px; text-align:center; color:var(--muted); font-size:14px;
}
.empty .i{ width:28px; height:28px; stroke-width:1.5; }


/* =====================================================
   TOPBAR & NAVIGASI
   ===================================================== */

.topbar{
    position:sticky; top:0; z-index:30;
    display:flex; align-items:center; gap:16px;
    height:var(--topbar-h); padding:0 16px;
    background:var(--surface); border-bottom:1px solid var(--border);
}
.brand{ font-weight:700; font-size:17px; letter-spacing:-.02em; white-space:nowrap; }

.tabs{ display:flex; gap:2px; height:100%; }
.tab{
    display:flex; align-items:center; gap:8px; height:100%;
    padding:0 12px; border:0; border-bottom:2px solid transparent;
    background:none; color:var(--text-2); font-weight:600; font-size:14px;
    text-decoration:none;
}
.tab[aria-current="page"]{ color:var(--accent); border-bottom-color:var(--accent); }

.topbar-end{ margin-left:auto; display:flex; align-items:center; gap:10px; }

.status{
    display:inline-flex; align-items:center; gap:6px;
    padding:4px 10px; border-radius:999px;
    font-size:12.5px; font-weight:600; white-space:nowrap;
}
.status-ok{ background:var(--ok-soft); color:var(--ok); }
.status-off{ background:var(--danger-soft); color:var(--danger); }
.status-pending{ background:var(--warn-soft); color:var(--warn); border:0; }

.who{ display:flex; flex-direction:column; align-items:flex-end; line-height:1.2; }
.who b{ font-size:13.5px; font-weight:600; }
.who span{ font-size:12px; color:var(--muted); }

/*
 * HP: tab pindah ke bar bawah layar, supaya jempol
 * gampang menjangkau dan topbar tidak penuh.
 */
@media (max-width:760px){
    .topbar{ gap:10px; padding:0 12px; }
    .who{ display:none; }
    .tabs{
        position:fixed; left:0; right:0; bottom:0; z-index:40; height:60px;
        background:var(--surface); border-top:1px solid var(--border);
        padding-bottom:env(safe-area-inset-bottom);
    }
    .tab{
        flex:1; flex-direction:column; justify-content:center; gap:2px;
        padding:0; font-size:11.5px; border-bottom:0; border-top:2px solid transparent;
    }
    .tab[aria-current="page"]{ border-top-color:var(--accent); }
    body.has-tabs{ padding-bottom:60px; }
}


/* =====================================================
   HALAMAN
   ===================================================== */

.view{ display:none; }
.view.active{ display:block; }

.page{ max-width:1100px; margin:0 auto; padding:20px 16px 40px; }
.page-head{
    display:flex; align-items:flex-end; justify-content:space-between; gap:12px;
    flex-wrap:wrap; margin-bottom:16px;
}
.page-head h1{ font-size:22px; }
.page-head p{ color:var(--muted); font-size:14px; margin-top:2px; }

.toolbar{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.toolbar .input-group{ flex:1; min-width:180px; }


/* =====================================================
   KASIR
   ===================================================== */

.pos{
    display:grid; grid-template-columns:minmax(0,1fr) clamp(320px, 36vw, 380px);
    min-height:calc(100vh - var(--topbar-h));
    min-height:calc(100dvh - var(--topbar-h));
}

.catalog{ padding:16px; min-width:0; }
.catalog-head{ display:flex; flex-direction:column; gap:12px; margin-bottom:14px; }

.product-grid{
    display:grid; gap:12px;
    grid-template-columns:repeat(auto-fill, minmax(140px, 1fr));
}

.product{
    position:relative; display:flex; flex-direction:column;
    padding:0; text-align:left; overflow:hidden;
    border:1px solid var(--border); border-radius:var(--radius);
    background:var(--surface); box-shadow:var(--shadow);
    transition:border-color .12s, transform .08s;
    -webkit-tap-highlight-color:transparent; user-select:none;
}
.product:active{ transform:scale(.98); }
.product.in-cart{ border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }

/*
 * Lebar eksplisit: di Safari isi <button> flex tidak otomatis melebar,
 * jadi tanpa foto kotaknya menciut seukuran ikon. Dengan width 100% +
 * aspect-ratio, kartu dengan & tanpa foto selalu sama bentuknya.
 */
.product > *{ align-self:stretch; }
.product-img{
    width:100%; flex:none; aspect-ratio:4 / 3; overflow:hidden;
    background:var(--surface-2);
    display:flex; align-items:center; justify-content:center; color:var(--border-strong);
}
.product-img img{ width:100%; height:100%; object-fit:cover; }
.product-img > .i{ width:40px; height:40px; stroke-width:1.3; }

.product-info{ padding:10px 11px 12px; display:flex; flex-direction:column; gap:3px; }
.product-name{ font-weight:600; font-size:14px; line-height:1.3; }
.product-price{ font-size:14px; color:var(--text-2); display:flex; align-items:center; gap:5px; }

.product-star{
    position:absolute; top:8px; left:8px;
    display:flex; align-items:center; justify-content:center;
    width:24px; height:24px; border-radius:50%;
    background:rgba(255,255,255,.92); color:#b7791f;
}
.product-qty{
    position:absolute; top:8px; right:8px;
    min-width:28px; height:28px; padding:0 8px; border-radius:999px;
    display:flex; align-items:center; justify-content:center;
    background:var(--accent); color:#fff; font-weight:700; font-size:14px;
}
.product-minus{
    position:absolute; top:42px; right:8px;
    width:28px; height:28px; padding:0; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    border:1px solid var(--border); background:var(--surface); color:var(--text);
}

/* --- Panel pesanan --- */

.order{
    position:sticky; top:var(--topbar-h);
    height:calc(100vh - var(--topbar-h));
    height:calc(100dvh - var(--topbar-h));
    display:flex; flex-direction:column;
    background:var(--surface); border-left:1px solid var(--border);
}
.order-head{
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 16px; border-bottom:1px solid var(--border);
}
.order-head h2{ font-size:16px; }

.order-lines{ flex:1 1 0; min-height:96px; overflow-y:auto; padding:4px 16px; }

.line{
    display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 10px;
    padding:12px 0; border-bottom:1px solid var(--border);
}
.line:last-child{ border-bottom:0; }
.line-name{ font-weight:600; font-size:14px; line-height:1.3; }
.line-sub{ font-weight:600; font-size:14px; text-align:right; }
.line-meta{ font-size:12.5px; color:var(--muted); display:flex; align-items:center; gap:6px; }

.stepper{ display:flex; align-items:center; gap:2px; justify-self:end; }
.stepper button{
    width:30px; height:30px; padding:0; border-radius:var(--radius-sm);
    display:flex; align-items:center; justify-content:center;
    border:1px solid var(--border); background:var(--surface);
}
.stepper input{
    width:40px; height:30px; text-align:center; font-weight:600;
    border:1px solid transparent; border-radius:var(--radius-sm); background:none;
    -moz-appearance:textfield;
}
.stepper input:focus{ border-color:var(--accent); outline:none; }
.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button{ -webkit-appearance:none; margin:0; }

.order-total{
    flex:none; padding:10px 16px; border-top:1px solid var(--border);
    background:var(--surface);
}
.order-total strong{ font-size:26px; }
/* Bagian bayar bisa di-scroll sendiri; tombol Bayar menempel di bawah. */
.order-foot{
    flex:0 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain;
    border-top:1px solid var(--border); padding:12px 16px 0;
    display:flex; flex-direction:column; gap:10px; background:var(--surface);
}
.order-foot > .btn-primary{
    position:sticky; bottom:0; z-index:1; margin-top:auto;
    box-shadow:0 -8px 8px -4px var(--surface);
}
/* Menempel di atas isi lain: jangan transparan saat nonaktif. */
.order-foot > .btn-primary:disabled{
    opacity:1;
    background:color-mix(in srgb, var(--accent) 50%, var(--surface));
    border-color:transparent;
}
.order-foot::after{ content:""; flex:none; height:6px; }
@media (max-height:1000px){
    .order-foot{ max-height:52%; }
}
.total-row{ display:flex; align-items:baseline; justify-content:space-between; }
.total-row span{ color:var(--text-2); font-weight:600; }
.total-row strong{ font-size:28px; font-weight:700; letter-spacing:-.02em; }

.quick-cash{ display:grid; grid-template-columns:repeat(4,1fr); gap:6px; }
.quick-cash button{
    min-height:34px; border:1px solid var(--border); border-radius:var(--radius-sm);
    background:var(--surface); font-size:13px; font-weight:600;
}

.change-row{
    display:flex; justify-content:space-between; align-items:center;
    padding:10px 12px; border-radius:var(--radius-sm);
    background:var(--surface-2); font-weight:600;
}
.change-row strong{ font-size:18px; }
.change-row.short{ background:var(--danger-soft); color:var(--danger); }
.change-row.enough{ background:var(--ok-soft); color:var(--ok); }

.notice{
    display:flex; gap:10px; align-items:flex-start;
    padding:10px 12px; border-radius:var(--radius-sm);
    font-size:13.5px; line-height:1.4;
}
.notice .i{ margin-top:1px; }
.notice-warn{ background:var(--warn-soft); color:var(--warn); }
.notice-info{ background:var(--surface-2); color:var(--text-2); }

/* Bar ringkas di HP */
.cart-bar{ display:none; }

@media (max-width:760px){
    .pos{ grid-template-columns:1fr; }
    .catalog{ padding:12px 12px 96px; }
    .product-grid{ grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:10px; }

    .order{
        position:fixed; inset:0; z-index:50; height:auto; top:0;
        border-left:0; transform:translateY(100%); transition:transform .22s ease;
    }
    .order.open{ transform:none; }

    .cart-bar{
        position:fixed; left:12px; right:12px; bottom:12px; z-index:35;
        display:flex; align-items:center; justify-content:space-between; gap:12px;
        min-height:56px; padding:0 8px 0 16px; border:0; border-radius:var(--radius);
        background:var(--text); color:#fff; box-shadow:var(--shadow-lg);
    }
    .cart-bar strong{ font-size:18px; }
    .cart-bar .btn{ background:var(--accent); border-color:var(--accent); color:#fff; }
    body.has-tabs .cart-bar{ bottom:72px; }
}

@media (max-width:380px){
    .product-grid{ grid-template-columns:repeat(2, minmax(0,1fr)); gap:8px; }
}


/* =====================================================
   DAFTAR (menu & akun)
   ===================================================== */

.rows{ list-style:none; margin:0; padding:0; }
.row{
    display:flex; align-items:center; gap:12px;
    padding:10px 16px; border-bottom:1px solid var(--border);
}
.row:last-child{ border-bottom:0; }
.row-main{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.row-title{ font-weight:600; font-size:14.5px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.row-sub{ font-size:13px; color:var(--muted); }
.row-end{ display:flex; align-items:center; gap:6px; flex:none; }
.row-price{ width:110px; text-align:right; font-weight:600; font-size:14px; }

button.row{ width:100%; border:0; border-bottom:1px solid var(--border); background:none; text-align:left; }

.thumb{
    width:48px; height:48px; flex:none; overflow:hidden;
    border-radius:var(--radius-sm); background:var(--surface-2);
    display:flex; align-items:center; justify-content:center; color:var(--border-strong);
}
.thumb img{ width:100%; height:100%; object-fit:cover; }

.avatar{
    width:38px; height:38px; flex:none; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    background:var(--surface-2); color:var(--text-2); font-weight:700; text-transform:uppercase;
}

.star-toggle{ color:var(--border-strong); }
.star-toggle[aria-pressed="true"]{ color:#b7791f; }
.star-toggle[aria-pressed="true"] .i{ fill:currentColor; }

.hide-toggle{ color:var(--border-strong); }
.hide-toggle[aria-pressed="true"]{ color:var(--text-2); }
.row.is-hidden .thumb, .row.is-hidden .row-main > :not(.row-title), .row.is-hidden .row-price{ opacity:.5; }

.group-label{
    padding:8px 16px; background:var(--surface-2);
    font-size:12px; font-weight:700; color:var(--text-2);
    text-transform:uppercase; letter-spacing:.04em;
    border-bottom:1px solid var(--border);
}

@media (max-width:600px){
    .row{ padding:10px 12px; }
    .row-price{ width:auto; }
    .hide-sm{ display:none !important; }
}


/* =====================================================
   DIALOG & TOAST
   ===================================================== */

dialog{
    width:min(440px, calc(100vw - 24px)); max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px);
    overflow-y:auto; overscroll-behavior:contain;
    padding:0; border:0; border-radius:12px;
    background:var(--surface); color:var(--text); box-shadow:var(--shadow-lg);
}
dialog::backdrop{ background:rgba(28,26,23,.45); }
.dialog-head{
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:16px 18px 0;
}
.dialog-head h2{ font-size:17px; }
.dialog-body{ padding:16px 18px; display:flex; flex-direction:column; gap:14px; }
.dialog-foot{
    display:flex; gap:8px; justify-content:flex-end; align-items:center;
    padding:12px 18px 16px; border-top:1px solid var(--border);
}
.dialog-foot .spacer{ flex:1; }
.dialog-msg{ color:var(--text-2); font-size:14.5px; white-space:pre-line; }

.photo-pick{
    display:flex; align-items:center; gap:14px;
}
.photo-pick .thumb{ width:88px; height:88px; }

.toasts{
    position:fixed; left:50%; bottom:20px; z-index:100; transform:translateX(-50%);
    display:flex; flex-direction:column; gap:8px; align-items:center;
    pointer-events:none; width:max-content; max-width:calc(100vw - 24px);
}
.toast{
    display:flex; align-items:center; gap:10px;
    padding:10px 14px; border-radius:var(--radius-sm);
    background:var(--text); color:#fff; font-size:14px; font-weight:500;
    box-shadow:var(--shadow-lg); animation:toast-in .18s ease-out;
}
.toast-ok .i{ color:#8fd3a6; }
.toast-error{ background:var(--danger); }
@keyframes toast-in{ from{ opacity:0; transform:translateY(8px); } }

@media (max-width:760px){
    body.has-tabs .toasts{ bottom:84px; }
}
@media (max-width:760px){
    .toasts{ bottom:84px; }
}


/* =====================================================
   LAPORAN
   ===================================================== */

.report-filters{
    display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-bottom:16px;
}
.report-filters .range{ display:flex; align-items:center; gap:6px; }
.report-filters .range .input{ width:auto; min-height:36px; padding:6px 10px; }

.kpis{ display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.kpi{ padding:14px 16px; }
.kpi-head{ display:flex; align-items:center; justify-content:space-between; gap:6px; }
.kpi-head > span{ font-size:13px; color:var(--muted); font-weight:600; }

.info-btn{
    position:relative; display:inline-flex; align-items:center; justify-content:center;
    flex:none; width:28px; height:28px; margin:-4px -6px -4px 0; padding:0;
    border:0; border-radius:50%; background:none; color:var(--muted);
}
.info-btn[aria-expanded="true"]{ color:var(--text); background:var(--surface-2); }
.info-btn:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }

.info-tip{
    position:absolute; top:calc(100% + 6px); left:0; z-index:20;
    width:220px; padding:8px 10px; border-radius:var(--radius-sm);
    background:var(--text); color:#fff; box-shadow:var(--shadow-lg);
    font-size:12.5px; font-weight:500; line-height:1.4; text-align:left;
    display:none; cursor:default;
}
.kpi:nth-child(even) .info-tip{ left:auto; right:0; }
.info-btn:focus-visible .info-tip,
.info-btn[aria-expanded="true"] .info-tip{ display:block; }
.kpi strong{ display:block; font-size:24px; font-weight:700; letter-spacing:-.02em; margin-top:4px; }
.kpi small{ display:block; font-size:12.5px; color:var(--text-2); margin-top:2px; }

.report-grid{ display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,1fr); gap:16px; margin-bottom:16px; }

@media (max-width:900px){
    .kpis{ grid-template-columns:repeat(2, minmax(0,1fr)); }
    .report-grid{ grid-template-columns:1fr; }
}

.viz{
    --grid-line:#e4e3dc;
    --series-cash:#2a78d6;
    --series-qris:#eb6834;
    --series-transfer:#4a3aa7;
    --series-debit:#eda100;
    --series-grab:#008300;
    --series-utang:#1baf7a;
    --series-trend:#2a78d6;
    --series-trend-wash:rgba(42,120,214,.1);
}
.bar-row{ display:grid; grid-template-columns:120px minmax(0,1fr) auto; gap:10px; align-items:center; margin-bottom:8px; }
.bar-label{ font-size:13px; color:var(--text-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-track{ height:20px; position:relative; }
.bar-fill{ position:absolute; inset:0 auto 0 0; border-radius:0 4px 4px 0; background:var(--series-trend); min-width:2px; }
.bar-fill.other{ background:var(--muted); }
.bar-value{ font-size:13px; font-weight:600; }

.split{ display:flex; height:24px; gap:2px; }
.split div:first-child{ border-radius:4px 0 0 4px; }
.split div:last-child{ border-radius:0 4px 4px 0; }
.legend{ display:flex; flex-direction:column; gap:8px; margin-top:14px; font-size:13.5px; }
.legend-item{ display:flex; align-items:center; gap:8px; }
.legend-item b{ margin-left:auto; }
.swatch{ width:10px; height:10px; border-radius:2px; flex:none; }

.tooltip{
    position:fixed; z-index:60; pointer-events:none; display:none;
    padding:7px 10px; border-radius:var(--radius-sm);
    background:var(--text); color:#fff; font-size:12.5px; white-space:nowrap;
    box-shadow:var(--shadow-lg);
}

.tx-table{ width:100%; border-collapse:collapse; font-size:14px; }
.tx-table th{
    text-align:left; font-size:12.5px; font-weight:600; color:var(--muted);
    padding:10px 16px; border-bottom:1px solid var(--border);
}
.tx-table td{ padding:11px 16px; border-bottom:1px solid var(--border); }
.tx-table .r{ text-align:right; }
.th-sort{
    display:inline-flex; align-items:center; gap:2px; padding:0; border:0; background:none;
    color:inherit; font:inherit; font-weight:600; cursor:pointer;
}
.th-sort:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; border-radius:3px; }
.tx-table th.r .th-sort{ flex-direction:row-reverse; }
.sort-ico{ opacity:0; transition:transform .15s; }
th[aria-sort="ascending"] .sort-ico{ opacity:1; transform:rotate(180deg); }
th[aria-sort="descending"] .sort-ico{ opacity:1; }
th[aria-sort="ascending"], th[aria-sort="descending"]{ color:var(--text); }
.tx-products{ max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.pager{
    display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
    padding:12px 16px; border-top:1px solid var(--border);
}
.pager-controls{ display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.pager-controls .btn{ min-width:32px; }
.pager-prev{ transform:rotate(90deg); }
.pager-next{ transform:rotate(-90deg); }

.tx-row{ cursor:pointer; }
.tx-row .i{ color:var(--muted); transition:transform .15s; }
.tx-row[aria-expanded="true"] .i{ transform:rotate(180deg); }
.tx-items td{ background:var(--surface-2); padding:4px 16px 12px 44px; }
.tx-items ul{ list-style:none; margin:0; padding:0; font-size:13.5px; }
.tx-items li{ display:flex; justify-content:space-between; gap:12px; padding:5px 0; border-bottom:1px dashed var(--border); }
.tx-items li:last-child{ border-bottom:0; }

@media (max-width:600px){
    .tx-table th, .tx-table td{ padding:10px 5px; }
    .tx-table th:first-child, .tx-table .tx-row td:first-child{ padding-left:12px; }
    .tx-table th:nth-last-child(2), .tx-table .tx-row td:nth-last-child(2){ padding-right:12px; }
    .tx-table .tx-items td{ padding:4px 12px 10px 16px; }
    .tx-table{ font-size:13px; }
    .tx-products{ max-width:84px; }
    .tx-chev, .pay-text{ display:none; }
    .tx-table .badge{ padding:3px 6px; }
    .pager{ justify-content:center; }
}

/* --- indikator memuat --- */

.spinner{
    display:inline-block; width:18px; height:18px; flex:none;
    border:2.5px solid var(--border-strong); border-top-color:var(--accent);
    border-radius:50%; animation:spin .7s linear infinite;
}
.loading-row{
    display:flex; align-items:center; justify-content:center; gap:10px;
    padding:6px 0 16px; color:var(--text-2); font-size:14px; font-weight:600;
}
.btn.is-loading .i{ animation:spin .8s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.skeleton{ height:120px; border-radius:var(--radius); background:linear-gradient(90deg, var(--surface-2), #f7f6f3, var(--surface-2)); background-size:200% 100%; animation:shimmer 1.2s linear infinite; }
@keyframes shimmer{ to{ background-position:-200% 0; } }


/* =====================================================
   LOGIN
   ===================================================== */

.login{
    min-height:100vh; display:flex; align-items:center; justify-content:center; padding:16px;
}
.login-card{ width:100%; max-width:360px; padding:28px 24px; display:flex; flex-direction:column; gap:16px; }
.login-card h1{ font-size:22px; }
.login-card .info{
    padding:9px 12px; border-radius:var(--radius-sm);
    background:var(--surface-2); color:var(--text-2); font-size:14px;
}
.login-card .error{
    padding:9px 12px; border-radius:var(--radius-sm);
    background:var(--danger-soft); color:var(--danger); font-size:14px;
}


/* --- varian --- */

.variant-rows{ padding:4px 18px 8px; max-height:60vh; overflow-y:auto; }
.variant-row{
    display:flex; align-items:center; gap:12px; padding:12px 0;
    border-bottom:1px solid var(--border);
}
.variant-row:last-child{ border-bottom:0; }
.variant-row.picked .variant-name{ color:var(--accent); }
.variant-info{ flex:1; min-width:0; display:flex; flex-direction:column; }
.variant-name{ font-weight:600; font-size:15px; }
.variant-price{ font-size:13.5px; color:var(--text-2); }
.variant-qty{ min-width:40px; text-align:center; font-weight:700; }

.variant-edit{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:8px; }
.variant-edit > .input{ flex:1 1 150px; min-width:0; }
.variant-edit > .input-group{ flex:0 0 140px; }

/* =====================================================
   SENTUH (tablet / HP)
   -----------------------------------------------------
   Hover tidak ada di layar sentuh: gaya hover hanya untuk
   mouse, dan tiap tombol punya efek :active saat ditekan.
   ===================================================== */

@media (hover:hover){
    .btn:hover{ background:var(--surface-2); }
    .btn-primary:hover{ background:var(--accent-hover); border-color:var(--accent-hover); }
    .btn-danger:hover{ background:var(--danger-soft); border-color:var(--danger); }
    .btn-solid-danger:hover{ background:#9a1d14; }
    .btn-ghost:hover{ background:var(--surface-2); }
    .chip:hover{ border-color:var(--border-strong); color:var(--text); }
    .tab:hover{ color:var(--text); }
    .product:hover{ border-color:var(--border-strong); }
    .stepper button:hover{ background:var(--surface-2); }
    .quick-cash button:hover{ background:var(--surface-2); }
    button.row:hover{ background:var(--surface-2); }
    .th-sort:hover{ color:var(--text); }
    .tx-row:hover td{ background:var(--surface-2); }
    .info-btn:hover{ color:var(--text); background:var(--surface-2); }
    .info-btn:hover .info-tip{ display:block; }
}

.btn:active{ background:var(--surface-2); }
.btn-primary:active{ background:var(--accent-hover); border-color:var(--accent-hover); }
.btn-danger:active{ background:var(--danger-soft); border-color:var(--danger); }
.btn-solid-danger:active{ background:#9a1d14; }
.chip:active{ background:var(--surface-2); }
.chip[aria-pressed="true"]:active{ background:var(--text); }
.stepper button:active,
.quick-cash button:active,
.product-minus:active{ background:var(--border); }
.tx-row:active td,
.row[data-id]:active,
.th-sort:active{ background:var(--surface-2); }
.row[data-id]{ cursor:pointer; }

.product{ -webkit-touch-callout:none; }
img{ -webkit-user-drag:none; user-select:none; }
#trendChart svg{ touch-action:pan-y; }

@media (pointer:coarse){

    /* Target ketuk minimal 44px. */
    .btn{ min-height:44px; }
    .btn-sm{ min-height:44px; padding:0 14px; }
    .btn-icon, .btn-icon.btn-sm{ width:44px; min-height:44px; }
    .btn-lg{ min-height:56px; }
    .chip{ min-height:44px; }
    .segmented button{ min-height:48px; }

    /* Input 16px: iOS Safari memperbesar halaman saat fokus kalau lebih kecil. */
    .input, select.input{ min-height:48px; font-size:16px; }
    .input-lg{ min-height:56px; font-size:22px; }
    .report-filters .range .input{ min-height:44px; }
    .stepper input{ font-size:16px; }

    .stepper button{ width:44px; height:44px; }
    .stepper input{ width:52px; height:44px; }
    .quick-cash button{ min-height:44px; font-size:14px; }
    .product-qty{ min-width:32px; height:32px; }
    .product-minus{ width:44px; height:44px; top:46px; }
    .product-star{ width:28px; height:28px; }

    .switch{ padding:14px 12px; }
    .switch-track{ width:46px; height:26px; }
    .switch-track::after{ width:20px; height:20px; }
    .switch input:checked + .switch-track::after{ transform:translateX(20px); }

    .row{ padding-top:12px; padding-bottom:12px; }
    .tx-table td{ padding-top:14px; padding-bottom:14px; }
    .th-sort{ min-height:44px; }
    .pager-controls .btn{ min-width:44px; }
    .tab{ min-height:44px; }

    /* Ikon info: area ketuk besar tapi ikonnya tetap kecil. */
    .info-btn{ width:44px; height:44px; margin:-14px -14px -14px 0; }
}


/* --- tampilkan password --- */

.pw-wrap{ position:relative; }
.input[data-pw]{ padding-right:48px; }
.pw-toggle{
    position:absolute; top:0; right:0; bottom:0; width:44px; padding:0;
    display:flex; align-items:center; justify-content:center;
    border:0; border-radius:0 var(--radius-sm) var(--radius-sm) 0; background:none; color:var(--muted);
}
.pw-toggle:hover{ color:var(--text); }
.pw-toggle:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }

/* Pengguna yang mematikan animasi di sistem: tanpa transisi (spinner tetap berputar sebagai penanda). */
@media (prefers-reduced-motion:reduce){
    *, *::before, *::after{ transition-duration:.01ms !important; }
    .toast{ animation:none; }
    .order{ transition:none; }
    html{ scroll-behavior:auto; }
}


/* =====================================================
   UTANG
   ===================================================== */

.tab-badge{
    min-width:18px; height:18px; padding:0 5px; margin-left:2px;
    border-radius:999px; background:var(--accent); color:#fff;
    font-size:11px; font-weight:700; line-height:18px; text-align:center;
}
@media (max-width:760px){
    .tab{ position:relative; }
    .tab-badge{ position:absolute; top:6px; left:calc(50% + 6px); margin:0; }
}

.kpis.kpis-3{ grid-template-columns:repeat(3, minmax(0,1fr)); }
@media (max-width:600px){
    .kpis.kpis-3{ grid-template-columns:1fr 1fr; }
    .kpis.kpis-3 .kpi:first-child{ grid-column:1 / -1; }
}

.debt-row.is-pending{ background:var(--warn-soft); cursor:default; }
.debt-amount{ display:flex; flex-direction:column; align-items:flex-end; flex:none; }
.debt-amount strong{ font-size:16px; }

dialog.dialog-wide{ width:min(560px, calc(100vw - 24px)); }
.dialog-head > div{ min-width:0; }
.debt-info{ display:flex; flex-wrap:wrap; gap:6px; }
a.badge{ text-decoration:none; }

.debt-list{ list-style:none; margin:0; padding:0; font-size:14px; }
.debt-list li{
    display:flex; justify-content:space-between; align-items:center; gap:12px;
    padding:7px 0; border-bottom:1px dashed var(--border);
}
.debt-list li:last-child{ border-bottom:0; }
.debt-pay-row{ display:flex; align-items:center; gap:4px; flex:none; }

.debt-totals{
    display:flex; flex-direction:column; gap:4px;
    padding:12px; border-radius:var(--radius-sm); background:var(--surface-2); font-size:14px;
}
.debt-totals > div{ display:flex; justify-content:space-between; }
.debt-sisa{ padding-top:6px; margin-top:2px; border-top:1px solid var(--border); font-weight:600; }
.debt-sisa strong{ font-size:22px; }

.debt-pay{ display:flex; flex-direction:column; gap:12px; padding:0 18px 16px; }

.kpis.kpis-6{ grid-template-columns:repeat(3, minmax(0,1fr)); }
@media (max-width:900px){ .kpis.kpis-6{ grid-template-columns:1fr 1fr; } }

/*
 * Tablet potret dengan semua tab owner: nama pengguna disembunyikan
 * (ada di dialog Profil) dan tab dirapatkan supaya topbar tidak melebar.
 */
@media (max-width:1100px) and (min-width:761px){
    .who{ display:none; }
    .topbar{ gap:10px; }
    .tab{ padding:0 10px; gap:6px; }
    .status span.hide-sm{ display:none; }
}
/* Lebih sempit lagi: tab yang tidak aktif cukup ikon, tab aktif tetap berlabel. */
@media (max-width:900px) and (min-width:761px){
    .tab:not([aria-current="page"]){ font-size:0; gap:0; padding:0 14px; }
    .tab:not([aria-current="page"]) .tab-badge{ font-size:11px; }
}
@media (pointer:coarse){ .debt-info a.badge{ min-height:44px; padding:0 14px; } }

/* Empat metode bayar di panel pesanan yang sempit: ikon di atas teks, tombol boleh menyusut. */
.segmented{ grid-auto-columns:minmax(0, 1fr); }
.segmented button{ min-width:0; }
#paymentToggle button{ flex-direction:column; gap:3px; min-height:54px; padding:4px 2px; font-size:13px; }


/* --- detail utang: satu angka utama, sisanya tenang --- */

dialog:focus{ outline:none; }

.debt-dialog .dialog-head{ align-items:flex-start; }
.debt-dialog .dialog-head h2{ font-size:19px; }
.debt-dialog .dialog-body{ gap:12px; padding-top:10px; }

.debt-contact{ font-size:14px; color:var(--text-2); line-height:1.5; }
.debt-contact a{ color:var(--text); font-weight:600; text-decoration:none; border-bottom:1px solid var(--border-strong); }
.debt-late{ color:var(--danger); font-weight:600; }

.debt-hero{ display:flex; flex-direction:column; gap:2px; padding:4px 0 2px; }
.debt-hero > span{ display:flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--text-2); }
.debt-hero strong{ font-size:34px; font-weight:700; letter-spacing:-.03em; line-height:1.15; }
.debt-hero small{ font-size:13px; }
.debt-hero.is-done > span{ color:var(--ok); }
.debt-hero.is-void > span{ color:var(--muted); }
.debt-hero.is-void strong{ color:var(--muted); text-decoration:line-through; text-decoration-thickness:2px; }

.debt-more{ border-top:1px solid var(--border); }
.debt-more:last-child{ border-bottom:1px solid var(--border); }
.debt-more summary{
    display:flex; align-items:center; gap:8px; min-height:44px; cursor:pointer;
    list-style:none; font-size:14px; font-weight:600;
}
.debt-more summary::-webkit-details-marker{ display:none; }
.debt-more summary > span:first-child{ flex:1; }
.debt-more summary .i{ color:var(--muted); transition:transform .15s; }
.debt-more[open] summary .i{ transform:rotate(180deg); }
.debt-more .debt-list{ padding-bottom:8px; }

.debt-pay{ padding:4px 18px 18px; gap:10px; }
.debt-void{
    align-self:center; margin-top:2px; min-height:40px; padding:0 12px;
    border:0; background:none; color:var(--danger); font-size:13.5px; font-weight:600;
}
.debt-void:hover{ text-decoration:underline; }
@media (pointer:coarse){ .debt-void{ min-height:44px; } }
.debt-dialog .dialog-head .toolbar{ flex-wrap:nowrap; flex:none; }
.debt-hero.is-void strong{ font-size:28px; }

/* --- logo --- */
.brand{ display:flex; align-items:center; flex:none; }
.brand img{ display:block; height:30px; width:auto; }
.login-head{ text-align:center; }
.login-logo{ display:block; height:auto; width:150px; max-width:100%; margin:4px auto 10px; }
@media (max-width:380px){ .brand img{ height:26px; } }

/* --- kelola kategori --- */
.cat-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.cat-row{ display:flex; align-items:flex-start; gap:8px; padding:10px 0; border-bottom:1px solid var(--border); }
.cat-row:last-child{ border-bottom:0; }
.cat-main{ flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.cat-grip{
    flex:none; width:36px; height:48px; margin-left:-8px; padding:0;
    display:flex; align-items:center; justify-content:center;
    border:0; border-radius:var(--radius-sm); background:none; color:var(--muted);
    cursor:grab; touch-action:none;
}
.cat-grip:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }
.cat-row.dragging{
    position:relative; z-index:2; background:var(--surface);
    box-shadow:var(--shadow-lg); border-radius:var(--radius-sm); border-bottom-color:transparent;
}
.cat-row.dragging .cat-grip{ cursor:grabbing; color:var(--text); }
.cat-list.is-sorting{ user-select:none; }
.cat-row .btn-danger:disabled{ opacity:.3; }
@media (pointer:coarse){ .cat-grip{ width:44px; } }

/* --- urutkan produk --- */
.sort-row{ align-items:center; padding:6px 0; }
.sort-row .thumb{ width:40px; height:40px; }
.sort-row.is-hidden .thumb, .sort-row.is-hidden .row-title{ opacity:.5; }
.sort-pos{ width:20px; flex:none; text-align:right; font-size:13px; color:var(--muted); }

.label-row{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.link-btn{ border:0; background:none; padding:4px 0; color:var(--accent); font-size:13px; font-weight:600; }
.link-btn:hover{ text-decoration:underline; }
@media (pointer:coarse){ .link-btn{ min-height:44px; padding:0 4px; } }
select.input{ appearance:auto; }


/* =====================================================
   SETORAN
   ===================================================== */

.page-narrow{ max-width:560px; }

.shift-sum{ display:flex; flex-direction:column; }
.shift-main{ display:flex; flex-direction:column; gap:2px; padding-bottom:12px; }
.shift-main > span, .shift-row > span{ display:flex; align-items:center; gap:7px; font-size:14px; font-weight:600; color:var(--text-2); }
.shift-main strong{ font-size:32px; font-weight:700; letter-spacing:-.03em; line-height:1.15; }
.shift-main small{ font-size:13px; }
.shift-row{ display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-top:1px solid var(--border); }
.shift-row strong{ font-size:18px; }

.shift-table td{ white-space:nowrap; }
/* Label dua baris (mis. "Transfer BCA"): ikon & baris pertama tetap sejajar dengan tombol lain. */
#paymentToggle button{ justify-content:flex-start; padding-top:9px; line-height:1.2; }

/* --- pratinjau nota (meniru kertas thermal 58mm) --- */
.slip{
    width:min(300px, 100%); margin:0 auto; padding:18px 16px 22px;
    background:#fff; color:#111; border:1px solid var(--border); border-radius:4px;
    box-shadow:var(--shadow); font:13px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.slip-line{ white-space:pre-wrap; word-break:break-word; }
.slip-line.c{ text-align:center; }
.slip-line.b, .slip-row.b{ font-weight:700; }
.slip-line.l{ font-size:18px; letter-spacing:.04em; }
.slip-row{ display:flex; justify-content:space-between; gap:12px; }
.slip-row span:last-child{ white-space:nowrap; }
.slip-div{ border-top:1px dashed #999; margin:6px 0; }
.slip-feed{ height:10px; }

/* Header panel pesanan: "Lihat nota" & "Kosongkan" tetap satu baris di panel sempit. */
.order-head .toolbar{ flex-wrap:nowrap; gap:0; }
.order-head .btn-sm{ padding:0 8px; }
@media (pointer:coarse){ .order-head .btn-sm{ padding:0 8px; } }

.shift-foot{
    display:flex; flex-direction:column; gap:4px; margin-top:4px;
    padding:10px 12px; border-radius:var(--radius-sm); background:var(--surface-2);
    font-size:13.5px; color:var(--text-2);
}
.shift-foot > div{ display:flex; justify-content:space-between; gap:12px; }
.shift-foot b{ color:var(--text); }


/* =====================================================
   GRAB & PENGATURAN
   ===================================================== */

.no-grab{ color:var(--warn); font-weight:600; }
.product-price .no-grab{ font-size:12.5px; }

/* Enam metode bayar: dua baris berisi tiga, ikon & teks sebaris. */
#paymentToggle{ grid-auto-flow:row; grid-template-columns:repeat(3, minmax(0, 1fr)); }
#paymentToggle button{ flex-direction:row; justify-content:center; gap:6px; min-height:44px; padding:0 4px; font-size:13px; line-height:1.15; text-align:left; }

.variant-edit > .input-group{ flex:0 0 120px; }
.variant-edit .prefix{ font-size:12.5px; }
.variant-edit .input-group:nth-of-type(2) > .input{ padding-left:44px; }

.settings-form{ display:flex; flex-direction:column; gap:14px; }
.settings-title{ display:flex; align-items:center; gap:8px; }
.settings-title h2{ font-size:16px; }
.input-suffix{ max-width:200px; }
.input-suffix > .input{ padding-right:36px; }
.input-suffix > .suffix{ position:absolute; right:14px; color:var(--muted); font-weight:600; pointer-events:none; }

/*
 * Metode bayar: enam ubin ringkas (3 × 2) — ikon & label sebaris, rata kiri
 * supaya ikon membentuk kolom yang rapi. Menggantikan aturan-aturan sebelumnya.
 */
#paymentToggle{ grid-template-columns:repeat(3, minmax(0, 1fr)); gap:4px; padding:4px; }
#paymentToggle button{
    flex-direction:row; justify-content:flex-start; align-items:center; gap:8px;
    min-height:40px; padding:0 12px;
    font-size:13.5px; line-height:1.1; text-align:left; white-space:nowrap; overflow:hidden;
}
#paymentToggle button .i{ width:18px; height:18px; flex:none; }
@media (pointer:coarse){ #paymentToggle button{ min-height:44px; } }
@media (max-width:380px){ #paymentToggle button{ padding:0 8px; gap:6px; } }


/* --- Pengaturan: daftar berkelompok, satu bar simpan --- */
.set-groups{ max-width:760px; display:flex; flex-direction:column; gap:22px; padding-bottom:80px; }
.set-group{ display:flex; flex-direction:column; gap:8px; }
.set-group-title{
    display:flex; align-items:center; gap:6px; padding:0 4px;
    font-size:12.5px; font-weight:700; color:var(--text-2); text-transform:uppercase; letter-spacing:.04em;
}
.set-row{ display:flex; align-items:center; gap:20px; padding:14px 16px; border-bottom:1px solid var(--border); }
.set-row:last-child{ border-bottom:0; }
.set-text{ flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
.set-label{ font-size:14.5px; font-weight:600; }
.set-help{ font-size:13px; color:var(--muted); line-height:1.45; }
.set-control{ flex:none; }
#settingsGroups{ display:contents; }
.set-control .btn{ white-space:nowrap; }
.set-control .input-suffix{ width:112px; }
.set-control .input{ text-align:right; }
.input.is-invalid{ border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-soft); }

.set-bar{
    position:sticky; bottom:16px; z-index:5;
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:10px 10px 10px 16px; border-radius:var(--radius);
    background:var(--text); color:#fff; box-shadow:var(--shadow-lg); font-size:14px; font-weight:500;
}
.set-bar .btn-ghost{ color:#fff; }
@media (hover:hover){ .set-bar .btn-ghost:hover{ background:rgba(255,255,255,.12); } }
body.has-tabs .set-bar{ bottom:76px; }
@media (min-width:761px){ body.has-tabs .set-bar{ bottom:16px; } }
.set-bar .toolbar{ flex-wrap:nowrap; }
.set-bar .short{ display:none; }
@media (max-width:600px){
    .set-row{ gap:12px; padding:14px; }
    .set-control .input-suffix{ width:92px; }
    .set-bar{ padding-left:14px; font-size:13.5px; }
    .set-bar .long{ display:none; }
    .set-bar .short{ display:inline; }
}


/* --- Bagi 2 metode (layar kasir) --- */

/* Tombol "Bagi 2" di samping Bayar — tidak memakan baris sendiri. */
/* "Split pembayaran": bagian dari pilihan metode, tepat di bawah ubin metode. */
.split-open{
    display:flex; align-items:center; justify-content:center; gap:7px;
    min-height:36px; margin-top:-4px;
    border:1px solid var(--border-strong); border-radius:var(--radius-sm);
    background:var(--surface); color:var(--text);
    font-size:13.5px; font-weight:600; cursor:pointer;
}
.split-open .i{ color:var(--accent); }
.split-open:disabled{ opacity:.55; cursor:not-allowed; }
@media (hover:hover){ .split-open:not(:disabled):hover{ background:var(--surface-2); } }
@media (pointer:coarse){ .split-open{ min-height:44px; } }

/* Kartu bagi: dua baris "metode + jumlah", menggantikan ubin metode selama aktif. */
.split-card{
    display:flex; flex-direction:column; gap:6px;
    padding:6px; border-radius:var(--radius); background:var(--surface-2);
}
.split-line{ display:grid; grid-template-columns:minmax(0, 2fr) minmax(0, 3fr); gap:6px; }
.split-line .input{ background:var(--surface); }
.split-method{ font-weight:600; }
.split-foot{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:0 0 0 4px; }
.split-cancel{ margin-left:auto; min-height:34px; padding:0 12px; background:var(--surface); }
.split-status{ font-size:13px; color:var(--muted); }
.split-status.good{ color:var(--ok); font-weight:600; }
.split-status.bad{ color:var(--danger); font-weight:600; }
@media (pointer:coarse){ .split-cancel{ min-height:44px; } }

.notice-sm{ padding:8px 10px; font-size:13px; align-items:center; }
.notice-sm .i{ margin-top:0; }

.badge-split .i + .i{ margin-left:-2px; }

/*
 * Panel pembayaran bisa lebih tinggi dari layar (mis. Bagi 2 metode + tunai):
 * isinya tidak boleh dipadatkan sampai bertumpuk; panel yang di-scroll,
 * dan daftar pesanan tetap kebagian tempat minimal.
 */
.order-foot{ min-height:0; overflow-y:auto; }
.order-foot > *{ flex:none; }
.order-lines{ min-height:96px; }

/*
 * Tablet / layar pendek: panel bayar dipadatkan supaya Total, uang
 * diterima, kembalian, dan Bayar muat tanpa scroll, dan daftar
 * pesanan tetap kelihatan.
 */
@media (max-width:1050px){
    #paymentToggle button{ padding:0 8px; gap:6px; }
}
@media (max-height:1000px){
    .order-head{ padding-top:10px; padding-bottom:10px; }
    .order-total{ padding-top:8px; padding-bottom:8px; }
    .order-foot{ gap:8px; padding-top:10px; }
    #paymentToggle button{ min-height:40px; }
    .split-open{ min-height:38px; }

    /* Uang diterima & kembalian sebaris. */
    #cashSection{
        display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); gap:4px 6px;
    }
    #cashSection > .label{ grid-column:1; grid-row:1; }
    #cashSection > .input-group{ grid-column:1; grid-row:2; }
    #cashSection .input-lg{ min-height:48px; font-size:20px; }
    #cashSection .quick-cash{ grid-column:1 / -1; grid-row:3; margin-top:2px; }
    #cashSection .quick-cash button{ min-height:38px; }
    #changeRow{
        grid-column:2; grid-row:1 / 3;
        flex-direction:column; align-items:flex-end; justify-content:center; gap:0;
        padding:4px 10px; font-size:12px;
    }
    #changeRow strong{ font-size:17px; }
    .order-foot > .btn-lg{ min-height:50px; }
}

/*
 * Baris pesanan ringkas: satu baris per item (nama & harga | stepper |
 * subtotal), supaya lebih banyak item terlihat di atas panel bayar.
 */
.line{
    grid-template-columns:minmax(0, 1fr) auto minmax(64px, auto);
    align-items:center; gap:0 10px; padding:8px 0;
}
.line-name{ grid-column:1; grid-row:1; align-self:end; }
.line-meta{ grid-column:1; grid-row:2; align-self:start; flex-wrap:wrap; }
.line .stepper{ grid-column:2; grid-row:1 / 3; }
.line-sub{ grid-column:3; grid-row:1 / 3; }
@media (pointer:coarse){
    .line .stepper button{ width:40px; height:40px; }
    .line .stepper input{ width:36px; height:40px; }
}


/* Riwayat nota: nota yang dibatalkan dibuat pudar. */
.debt-row.is-void{ opacity:.6; }
#saleBody .line{ grid-template-columns:minmax(0, 1fr) auto; }
#saleBody .line .stepper{ grid-row:1; }
#saleBody .segmented{ flex-wrap:wrap; }
#riwayatRange{ flex-wrap:nowrap; align-items:center; }
#riwayatRange .input{ width:auto; min-width:0; }
@media (max-width:640px){
    #riwayatRange{ flex:1 1 100%; }
    #riwayatRange .input{ flex:1; }
}
.range-field{ display:flex; flex-direction:column; gap:2px; }
.range-sep{ align-self:flex-end; padding-bottom:12px; }


/* Riwayat nota: pratinjau item & keadaan kosong */
.rw-items{ color:var(--text-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
#riwayatRows .row{ transition:background .12s; }
#riwayatRows .row:hover{ background:var(--surface-2); }
#riwayatRows .empty{ padding:56px 16px; }
#riwayatRows .empty .i{ width:40px; height:40px; padding:10px; box-sizing:content-box; border-radius:50%; background:var(--surface-2); }

/* Pembungkus Total + pembayaran: transparan kecuali di tablet landscape. */
.checkout{ display:contents; }
.payment-select{ display:none; }

/*
 * Tablet landscape: layout kasir dengan bilah bawah selebar layar.
 *   atas kiri  : produk (scroll sendiri)
 *   atas kanan : daftar pesanan, setinggi sisa layar
 *   bawah      : metode bayar | uang diterima | Total + Bayar
 * Tetap satu layar, tanpa langkah tambahan.
 */
@media (min-width:1000px) and (max-height:1000px) and (orientation:landscape){

    .pos{
        height:calc(100vh - var(--topbar-h)); height:calc(100dvh - var(--topbar-h));
        min-height:0; overflow:hidden;
        grid-template-columns:minmax(0, 1fr) clamp(340px, 34vw, 420px);
        grid-template-rows:auto minmax(0, 1fr) auto;
    }

    .catalog{ grid-column:1; grid-row:1 / 3; overflow-y:auto; min-height:0; }

    /* .order & .foot hanya pembungkus: anaknya jadi item grid .pos / .checkout. */
    .order, .order-foot{ display:contents; }

    .order-head, .order-lines{
        grid-column:2; background:var(--surface); border-left:1px solid var(--border);
    }
    .order-head{ grid-row:1; padding-top:10px; padding-bottom:10px; }
    .order-lines{ grid-row:2; min-height:0; flex:none; }

    /* Baris item: satu baris (nama | stepper | subtotal) */
    .line{ grid-template-columns:minmax(0, 1fr) auto 96px; padding:8px 0; }

    .checkout{
        grid-column:1 / -1; grid-row:3;
        display:grid; align-items:stretch; gap:6px 14px;
        grid-template-columns:minmax(150px, .55fr) minmax(0, 1.7fr) clamp(250px, 26vw, 320px);
        grid-template-rows:auto minmax(58px, auto) minmax(54px, auto);
        padding:10px 16px 12px; background:var(--surface);
        border-top:2px solid var(--border-strong);
        box-shadow:0 -6px 16px rgba(0,0,0,.06);
    }

    /* kolom 1: metode bayar = satu dropdown (lebih hemat tempat), split di bawahnya */
    #paymentToggle{
        grid-column:1; grid-row:1 / 3;
        display:flex; flex-direction:column; gap:4px;
        padding:0; background:none; border-radius:0;
    }
    #paymentToggle::before{
        content:"Metode bayar"; font-size:13px; font-weight:600; color:var(--text-2);
    }
    #paymentToggle > button{ display:none; }
    #paymentToggle .payment-select{
        display:block; flex:1; min-height:56px; font-size:20px; font-weight:700;
    }
    /* Bagi 2 metode: kartu bagi menggantikan dropdown & dapat kolom lebih lebar. */
    .checkout:has(#splitSection:not([hidden])){
        grid-template-columns:minmax(0, 1.3fr) minmax(0, 1fr) clamp(250px, 26vw, 320px);
    }
    #splitSection{ grid-column:1; grid-row:1 / 4; }
    #splitSection .split-line .input{ min-height:50px; }
    /* Saat dibagi, tunai & pemberitahuan metode lain tampil bersamaan: pemberitahuan pindah ke baris bawah. */
    .checkout:has(#splitSection:not([hidden])) .notice{
        grid-column:1 / 3; grid-row:4; padding:10px 14px; font-size:14px; justify-content:flex-start;
    }
    .checkout:has(#splitSection:not([hidden])) .notice > .i{ width:20px; height:20px; }
    #splitOpen{ grid-column:1; grid-row:3; margin:0; min-height:0; height:100%; }

    /* kolom 2: uang diterima / kembalian / uang cepat — target ketuk besar */
    #cashSection, .checkout .notice{ grid-column:2; grid-row:1 / 4; }
    #cashSection{
        display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows:auto minmax(58px, auto) minmax(54px, auto); gap:6px 8px;
    }
    #cashSection > .label{ grid-column:1 / -1; grid-row:1; font-size:13px; }
    #cashSection > .input-group{ grid-column:1; grid-row:2; }
    #cashSection .input-group .input{ height:100%; min-height:56px; font-size:clamp(20px, 2.2vw, 26px); }
    #cashSection .input-group .prefix{ font-size:16px; }
    /*
     * Kembalian: label di atas (sebaris dengan "Uang diterima"), kotak nilai
     * di bawahnya selebar & setinggi kotak uang diterima. changeRow sendiri
     * transparan; warna status (kurang / cukup) dipindah ke kotak nilainya.
     */
    #changeRow{ display:contents; }
    #changeLabel{
        grid-column:2; grid-row:1; font-size:13px; font-weight:600; color:var(--text-2);
    }
    #changeValue{
        grid-column:2; grid-row:2; min-width:0;
        display:flex; align-items:center; justify-content:flex-end;
        padding:0 12px; border-radius:var(--radius-sm); background:var(--surface-2);
        font-size:clamp(18px, 2vw, 24px); white-space:nowrap; overflow:hidden;
    }
    #changeRow.short #changeValue{ background:var(--danger-soft); color:var(--danger); }
    #changeRow.enough #changeValue{ background:var(--ok-soft); color:var(--ok); }
    #changeRow.short #changeLabel{ color:var(--danger); }
    #changeRow.enough #changeLabel{ color:var(--ok); }
    #cashSection .quick-cash{ grid-column:1 / -1; grid-row:3; }
    #cashSection .quick-cash button{ min-height:0; height:100%; font-size:15px; }
    #reprintNotice{ grid-column:1 / -1; grid-row:4; }

    /* Pemberitahuan metode (QRIS, Transfer, Debit, Grab, Utang): isi di tengah, teks besar. */
    .checkout .notice{
        align-items:center; justify-content:center; text-align:center;
        gap:14px; padding:0 28px; font-size:17px; line-height:1.4; font-weight:500;
    }
    .checkout .notice > .i{ width:30px; height:30px; flex:none; margin:0; }
    .checkout .notice > span{ max-width:46ch; }
    .checkout .notice.notice-warn{ font-weight:500; }
    #reprintNotice{ text-align:left; justify-content:flex-start; font-size:14px; padding:10px 14px; }

    /*
     * Metode non-tunai (QRIS, Transfer, Debit, Grab, Utang): tidak ada uang
     * yang diketik, jadi bilah dipadatkan jadi satu baris:
     * [metode] [split] [pemberitahuan] [Total] [Bayar]
     */
    .checkout:has(#cashSection[hidden]):not(:has(#splitSection:not([hidden]))){
        grid-template-columns:minmax(150px, .5fr) minmax(130px, .42fr) minmax(0, 1.3fr) auto clamp(190px, 20vw, 240px);
        grid-template-rows:auto 58px;
    }
    .checkout:has(#cashSection[hidden]):not(:has(#splitSection:not([hidden]))) #splitOpen{ grid-column:2; grid-row:2; }
    .checkout:has(#cashSection[hidden]):not(:has(#splitSection:not([hidden]))) .notice:not(#reprintNotice){
        grid-column:3; grid-row:2; padding:0 16px; font-size:15px; gap:10px;
    }
    .checkout:has(#cashSection[hidden]):not(:has(#splitSection:not([hidden]))) .notice:not(#reprintNotice) > .i{ width:24px; height:24px; }
    .checkout:has(#cashSection[hidden]):not(:has(#splitSection:not([hidden]))) .order-total{
        grid-column:4; grid-row:1 / 3; flex-direction:column; align-items:flex-end; justify-content:center; gap:0;
    }
    .checkout:has(#cashSection[hidden]):not(:has(#splitSection:not([hidden]))) #payButton{ grid-column:5; grid-row:1 / 3; }
    .checkout:has(#cashSection[hidden]):not(:has(#splitSection:not([hidden]))) #skipPrint{ grid-column:5; }

    /* Dropdown metode: tampilan sama dengan input lain, panah sendiri. */
    #paymentToggle .payment-select{
        appearance:none; -webkit-appearance:none; padding:0 44px 0 16px;
        background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
    }

    /* kolom 3: Total (label kiri, angka kanan) di atas tombol Bayar besar */
    .order-total{
        grid-column:3; grid-row:1 / 3; padding:0; border:0; background:none;
        display:flex; flex-direction:row; align-items:center; justify-content:space-between; gap:10px;
    }
    .order-total span{ font-size:15px; }
    .order-total strong{ font-size:clamp(26px, 2.8vw, 32px); line-height:1.1; }
    .checkout #payButton{
        grid-column:3; grid-row:3; position:static; align-self:stretch;
        min-height:0; height:100%; font-size:19px; box-shadow:none;
    }
    /* Total sudah tampil di atas: jangan diulang di tombol. */
    .checkout .pay-amt{ display:none; }
    #skipPrint{ grid-column:3; grid-row:4; }
}
