/* ==========================================================================
   Toko Sembako POS — satu lembar gaya untuk semua halaman.
   Tema: 6 pilihan warna x 2 mode (terang/gelap), dipilih dari Pengaturan.
   Semua warna lewat variabel; jangan menulis warna tetap di view.
   ========================================================================== */

/* ---------- 1. Token ---------- */
:root {
    --primary: #6d28d9;
    --primary-dark: #5b21b6;
    --primary-light: #ede9fe;
    --on-primary: #ffffff;
    --accent: #f59e0b;
    --glow: 109, 40, 217;

    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #fbfbfd;
    --border: #e6e8ee;
    --border-strong: #d3d7e0;

    --text: #0f1729;
    --text-soft: #475069;
    --text-muted: #7b8398;

    --success: #059669;
    --success-bg: #d9f7ea;
    --success-text: #04543b;
    --danger: #dc2626;
    --danger-bg: #fde8e8;
    --danger-text: #8f1d1d;
    --warning: #c2740a;
    --warning-bg: #fdf1d6;
    --warning-text: #7c4a04;
    --info: #2563eb;
    --info-bg: #e2ecff;
    --info-text: #1b3fa0;

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 41, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 41, .06), 0 1px 2px rgba(15, 23, 41, .04);
    --shadow: 0 6px 18px rgba(15, 23, 41, .07);
    --shadow-lg: 0 18px 44px rgba(15, 23, 41, .14);
    --ring: 0 0 0 3px rgba(var(--glow), .18);
    --sidebar-w: 262px;
    --rail-w: 76px;
    --header-h: 60px;
}

/* Tema warna: hanya mengganti token, tidak menyentuh aturan lain. */
html[data-theme="violet"] { --primary:#6d28d9; --primary-dark:#5b21b6; --primary-light:#ede9fe; --glow:109,40,217; --sidebar-1:#1b1830; --sidebar-2:#31215c; }
html[data-theme="emerald"] { --primary:#059669; --primary-dark:#047857; --primary-light:#d9f7ea; --glow:5,150,105; --sidebar-1:#04231b; --sidebar-2:#065f46; }
html[data-theme="ocean"] { --primary:#0284c7; --primary-dark:#0369a1; --primary-light:#e0f2fe; --glow:2,132,199; --sidebar-1:#0a1d2e; --sidebar-2:#0c4a6e; }
html[data-theme="sunset"] { --primary:#ea580c; --primary-dark:#c2410c; --primary-light:#ffedd5; --glow:234,88,12; --sidebar-1:#2a1407; --sidebar-2:#7c2d12; }
html[data-theme="rose"] { --primary:#e11d48; --primary-dark:#be123c; --primary-light:#ffe4e6; --glow:225,29,72; --sidebar-1:#2a0a15; --sidebar-2:#881337; }
html[data-theme="mono"] { --primary:#111827; --primary-dark:#000000; --primary-light:#e8eaee; --glow:17,24,39; --sidebar-1:#0b0f17; --sidebar-2:#2b3444; }
html[data-theme="violet"] { --sidebar-1:#1b1830; }

html[data-mode="dark"] {
    --bg: #0a0a11;
    --surface: #14141d;
    --surface-2: #191926;
    --border: #262635;
    --border-strong: #33334a;
    --text: #ececf3;
    --text-soft: #c3c3d4;
    --text-muted: #8e8ea6;
    --success-bg: #063c2d; --success-text: #5eead4;
    --danger-bg: #431616; --danger-text: #fca5a5;
    --warning-bg: #3d2a06; --warning-text: #fcd34d;
    --info-bg: #16264d; --info-text: #93c5fd;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.5);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.55);
    --shadow: 0 8px 22px rgba(0,0,0,.5);
    --shadow-lg: 0 20px 48px rgba(0,0,0,.62);
}

/* ---------- 2. Dasar ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text);
    margin: 0; font-size: 14px; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4 { color: var(--text); letter-spacing: -.02em; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- 3. Kerangka ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar-1) 0%, var(--sidebar-2) 100%);
    color: #e7e7ef;
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 50;
    transition: width .2s ease, transform .22s ease;
}

.main {
    flex: 1; margin-left: var(--sidebar-w); min-width: 0;
    padding: 22px clamp(14px, 2.2vw, 30px) 40px;
    transition: margin-left .2s ease;
}
.main-inner { max-width: 1440px; margin: 0 auto; }

/* --- tombol kerangka (hamburger, mode) --- */
.mobile-bar { display: none; }

/* ---------- 4. Sidebar ---------- */
.sidebar-brand {
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
    padding: 16px 14px; border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar-brand .logo {
    width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
    background: var(--primary); color: #fff; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px;
}
.sidebar-brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand .brand-txt { min-width: 0; }
.sidebar-brand .name { font-weight: 700; font-size: 14.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand .sub { font-size: 11px; color: rgba(255,255,255,.5); }
.sidebar-x { display: none; margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; padding: 4px; }
.sidebar-rail {
    display: none; margin-left: auto; background: rgba(255,255,255,.07);
    border: 0; color: rgba(255,255,255,.72); cursor: pointer;
    padding: 7px; border-radius: 9px; line-height: 0;
}
@media (min-width: 1025px) {
    .sidebar-rail { display: inline-flex; }
    html[data-rail="1"] .sidebar-rail { margin: 0 auto; }
    html[data-rail="1"] .sidebar-brand { flex-direction: column; gap: 8px; padding: 14px 8px; }
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px 16px; overscroll-behavior: contain; }
.nav-group {
    font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
    color: rgba(255,255,255,.38); font-weight: 700;
    padding: 16px 12px 7px;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: 12px; margin-bottom: 3px;
    color: rgba(255,255,255,.8); font-weight: 500;
    transition: background .14s, color .14s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active {
    background: var(--primary); color: #fff;
    box-shadow: 0 6px 16px rgba(var(--glow), .45);
}
.sidebar-nav a .ico { width: 20px; height: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-nav a .ico svg { display: block; }
.sidebar-nav a .txt { min-width: 0; display: flex; flex-direction: column; }
.sidebar-nav a .t-label { font-size: 13.5px; line-height: 1.3; }
.sidebar-nav a .t-desc {
    font-size: 10.5px; line-height: 1.3; font-weight: 400;
    color: rgba(255,255,255,.5); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nav a.active .t-desc { color: rgba(255,255,255,.85); }

.sidebar-foot { flex-shrink: 0; padding: 12px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-foot .user { display: flex; align-items: center; gap: 10px; }
.sidebar-foot .avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent); color: #241a02; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-foot .u-txt { min-width: 0; flex: 1; }
.sidebar-foot .u-name { display: block; font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-foot .u-role { font-size: 11px; color: rgba(255,255,255,.5); }
.sidebar-foot .u-out { color: rgba(255,255,255,.55); display: inline-flex; padding: 6px; border-radius: 8px; }
.sidebar-foot .u-out:hover { color: #fff; background: rgba(255,255,255,.1); }

/* --- sidebar jadi rel ikon (layar sedang / desktop diciutkan) --- */
@media (min-width: 1025px) {
    html[data-rail="1"] .sidebar { width: var(--rail-w); }
    html[data-rail="1"] .main { margin-left: var(--rail-w); }
    html[data-rail="1"] .sidebar-brand { justify-content: center; padding: 16px 8px; }
    html[data-rail="1"] .sidebar-brand .brand-txt,
    html[data-rail="1"] .sidebar-nav .t-desc,
    html[data-rail="1"] .sidebar-nav .t-label,
    html[data-rail="1"] .nav-group,
    html[data-rail="1"] .sidebar-foot .u-txt { display: none; }
    html[data-rail="1"] .sidebar-nav a { justify-content: center; padding: 11px 0; }
    html[data-rail="1"] .sidebar-foot .user { justify-content: center; }
    html[data-rail="1"] .sidebar-foot .u-out { display: none; }
}
@media (max-width: 1024px) {
    .sidebar-brand .brand-txt, .sidebar-nav .t-desc { display: none; }
    .sidebar { width: var(--rail-w); }
    .main { margin-left: var(--rail-w); }
    .sidebar-brand { justify-content: center; padding: 16px 8px; }
    .sidebar-nav a { justify-content: center; padding: 11px 0; }
    .sidebar-nav .t-label { display: none; }
    .nav-group { text-align: center; font-size: 0; padding: 12px 0 6px; }
    .nav-group::after { content: ''; display: block; width: 22px; height: 1px; margin: 0 auto; background: rgba(255,255,255,.18); }
    .sidebar-foot .u-txt, .sidebar-foot .u-out { display: none; }
    .sidebar-foot .user { justify-content: center; }
}

/* ---------- 5. Header halaman ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.topbar h1 { font-size: 21px; font-weight: 700; margin: 0; }
.topbar .lead { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 6. Kartu & statistik ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-xs);
    padding: 20px;
}
.grid { display: grid; gap: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; }

.stat-card {
    position: relative; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 18px;
    box-shadow: var(--shadow-xs);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat-card .label { font-size: 12px; color: var(--text-muted); font-weight: 600; letter-spacing: .01em; }
.stat-card .value { font-size: 23px; font-weight: 800; margin-top: 7px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.stat-card .delta { font-size: 12px; margin-top: 7px; color: var(--text-muted); }
/* ikon lama (halaman laporan/kas/gudang) menempel di pojok kartu;
   .kpi-ico di dashboard baru TIDAK boleh kena aturan ini. */
.stat-card .icon:not(.kpi-ico) {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.icon.purple { background: var(--primary-light); color: var(--primary-dark); }
.icon.green  { background: var(--success-bg); color: var(--success-text); }
.icon.orange { background: var(--warning-bg); color: var(--warning-text); }
.icon.red    { background: var(--danger-bg); color: var(--danger-text); }
.icon.blue   { background: var(--info-bg); color: var(--info-text); }

/* kartu KPI gaya dashboard baru */
.kpi { display: flex; align-items: flex-start; gap: 14px; }
.kpi .kpi-body { min-width: 0; flex: 1; }
.kpi .kpi-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.kpi .kpi-value { font-size: 24px; font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.15; }
.kpi .kpi-note { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.kpi .kpi-ico { width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.kpi-spark { display: flex; align-items: flex-end; gap: 3px; height: 26px; margin-top: 10px; }
.kpi-spark i { flex: 1; background: var(--primary-light); border-radius: 2px; min-height: 3px; }
.kpi-spark i.on { background: var(--primary); }

/* ---------- 7. Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px; border-radius: 11px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1.2;
    cursor: pointer; transition: background .14s, border-color .14s, transform .1s, box-shadow .14s;
    white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn:active { transform: translateY(1px); }
.btn svg { flex-shrink: 0; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--on-primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 13px; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-outline-secondary { background: transparent; color: var(--text-soft); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 8. Form ---------- */
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-soft); }
.form-control, .form-select {
    width: 100%; padding: 10px 13px; font: inherit; font-size: 14px;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 11px;
    transition: border-color .14s, box-shadow .14s;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.form-control-sm { padding: 6px 10px; font-size: 13px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text { font-size: 12px; color: var(--text-muted); }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-check-input { width: 17px; height: 17px; accent-color: var(--primary); margin: 0; flex-shrink: 0; }
.form-check-label { font-size: 13.5px; cursor: pointer; }

/* ---------- 9. Tabel ---------- */
.table-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-xs);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; padding: 12px 15px; white-space: nowrap;
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 700;
    background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 15px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 10. Lencana & peringatan ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger  { background: var(--danger-bg); color: var(--danger-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-info    { background: var(--info-bg); color: var(--info-text); }
.badge-purple  { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray    { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }

.alert { padding: 12px 15px; border-radius: 12px; margin-bottom: 15px; font-size: 13.5px; border: 1px solid transparent; }
.alert-danger  { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success); }

/* ---------- 11. Keranjang & pemindai (kasir pakai /assets/css/kasir.css) ---------- */
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; font-size: 13.5px; }
.sum-row.total { font-size: 21px; font-weight: 800; color: var(--primary); padding: 11px 0; font-variant-numeric: tabular-nums; }
.sum-row .big { font-weight: 800; font-variant-numeric: tabular-nums; }

.search-results {
    position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
    box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; z-index: 100;
}
.search-results button { display: block; width: 100%; text-align: left; padding: 12px 15px; background: none; border: none; border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text); font: inherit; }
.search-results button:last-child { border-bottom: none; }
.search-results button:hover { background: var(--primary-light); }
.sr-notfound { padding: 12px 15px; font-size: 13.5px; color: var(--text-muted); }
.sr-notfound strong { color: var(--text); }
.search-results .sr-notfound button { border-bottom: none; padding: 9px 0; color: var(--primary); font-weight: 600; }
.search-results .sr-notfound button:last-child { color: var(--text-muted); font-weight: 500; }

/* ---------- 12. Widget dashboard ---------- */
.hero-card {
    position: relative; overflow: hidden; border-radius: var(--radius-lg);
    color: #fff; padding: 24px; margin-bottom: 18px;
    background: radial-gradient(760px 320px at 92% -20%, rgba(255,255,255,.2), transparent 62%),
                linear-gradient(118deg, var(--sidebar-1) 0%, var(--sidebar-2) 58%, var(--primary) 100%);
    box-shadow: 0 14px 32px rgba(var(--glow), .26);
}
.hero-card h2 { margin: 0 0 6px; font-size: 22px; color: #fff; }
.hero-card p { margin: 0; color: rgba(255,255,255,.85); font-size: 13.5px; }
.hero-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.hero-meta div { font-size: 12.5px; color: rgba(255,255,255,.82); }
.hero-meta strong { display: block; font-size: 17px; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.hero-actions .btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #fff; backdrop-filter: blur(6px); }
.hero-actions .btn:hover { background: rgba(255,255,255,.26); color: #fff; }
.hero-actions .btn.solid { background: #fff; color: var(--primary-dark); border-color: #fff; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 11px; }
.quick-btn {
    display: flex; align-items: center; gap: 11px;
    text-decoration: none; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 13px 14px; font-weight: 600; font-size: 13.5px;
    transition: border-color .14s, transform .14s, box-shadow .14s;
}
.quick-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.quick-btn .qi { width: 36px; height: 36px; border-radius: 11px; background: var(--primary-light); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.trend { display: flex; align-items: flex-end; gap: 8px; height: 168px; padding-top: 14px; }
.trend .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.trend .bar { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); min-height: 4px; transition: filter .14s; }
.trend .bar:hover { filter: brightness(1.12); }
.trend .bar.today { background: linear-gradient(180deg, var(--accent), #c2740a); }
.trend .lbl { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.trend .val { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }

.list-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; }
.list-row .lr-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.list-row .lr-val { font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 7px; border-radius: 6px; background: var(--primary-light); overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 6px; }

.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 18px; min-width: 0; }
.chart-box h3 { margin: 0 0 14px; font-size: 15px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.chart-head h3 { margin: 0; }

/* ---------- 13. Halaman publik (landing) ----------
   Gaya halaman depan ada di SATU berkas: /assets/css/landing.css.
   Halaman depan dimuat tanpa sidebar/kasir, jadi tidak perlu ikut mengunduh
   seluruh app.css; sisa di sini hanya tombol di atas latar gelap yang juga
   dipakai halaman lain. */
.btn-white { background: #fff; color: var(--primary-dark); border: 1px solid #fff; }
.btn-white:hover { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow); }
.btn-outline-w { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.5); }
.btn-outline-w:hover { color: #fff; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.8); }

/* ---------- 14. Halaman masuk ---------- */
.auth-wrap {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: radial-gradient(900px 420px at 20% -10%, rgba(var(--glow), .55), transparent 60%),
                linear-gradient(150deg, var(--sidebar-1) 0%, var(--sidebar-2) 60%, var(--primary) 100%);
}
.auth-card {
    width: 100%; max-width: 404px; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 22px;
    box-shadow: var(--shadow-lg); padding: 34px 30px; text-align: center;
}
.auth-logo {
    width: 62px; height: 62px; border-radius: 17px; margin: 0 auto 15px;
    background: var(--primary); color: var(--on-primary); font-size: 26px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.auth-logo img { width: 100%; height: 100%; object-fit: cover; }
.auth-card h2 { margin: 0 0 4px; font-size: 21px; }
.auth-card .sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-card form { text-align: left; }

/* ---------- 15. Struk ----------
   Gaya .receipt TIDAK ada di sini: satu sumber = struk-content.css
   (di-link layout lewat $extraCss, halaman struk, dan overlay). Dua sumber
   = struk tercetak "kadang tebal kadang tipis" di printer termal. */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .sidebar, .mobile-bar, .backdrop { display: none !important; }
    .main { margin: 0 !important; padding: 0 !important; }
}

/* ---------- 16. Pemindai kamera ---------- */
.pscan { position: fixed; inset: 0; z-index: 400; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.75); padding: 16px; }
.pscan.open { display: flex; }
.pscan-box { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.pscan-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pscan-head strong { font-size: 15px; }
.pscan-x { background: none; border: 0; color: var(--text-muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 6px; }
.pscan-box video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; border-radius: 12px; display: block; }
.pscan-hint { font-size: 12.5px; color: var(--text-muted); margin: 10px 0; min-height: 32px; }
.pscan-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.pscan-manual input { width: 100%; }

/* ---------- 17. Utilitas ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.position-absolute { position: absolute; }
.shadow { box-shadow: var(--shadow); }
.p-3 { padding: 20px; }

/* sisa kelas gaya Bootstrap di halaman lama */
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > [class*="col-"] { min-width: 0; }
.g-3 { gap: 14px; }
.col-md-3 { flex: 1 1 210px; }
.col-md-4 { flex: 1 1 300px; }
.col-md-6 { flex: 1 1 380px; }
.col-md-8 { flex: 1 1 480px; }
.col-md-12 { flex: 1 1 100%; }
.col-lg-8 { flex: 1 1 520px; }
.list-group { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.list-group-item { padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.list-group-item:last-child { border-bottom: none; }
.list-group-item-action:hover { background: var(--primary-light); }
.unit-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }

/* ---------- 18. Penyesuaian layar ---------- */
@media (max-width: 1024px) {
    /* grid dua kolom dari style inline (dashboard, detail hutang) jatuh jadi satu kolom */
    .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 900px) {
    .mobile-bar {
        display: flex; align-items: center; gap: 10px;
        position: sticky; top: 0; z-index: 60;
        min-height: var(--header-h);
        padding: 9px 14px;
        background: var(--surface);
        background: color-mix(in srgb, var(--surface) 88%, transparent);  /* HP lama tetap pakai baris di atas */
        backdrop-filter: saturate(160%) blur(12px);
        border-bottom: 1px solid var(--border);
    }
    .mobile-bar .mb-title { font-weight: 700; flex: 1; font-size: 14.5px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .mobile-bar .mb-title small { display: block; font-weight: 500; font-size: 10.5px; color: var(--text-muted); }
    .mobile-bar .mb-btn {
        background: none; border: 1px solid var(--border); border-radius: 11px;
        padding: 8px 9px; cursor: pointer; color: var(--text);
        display: inline-flex; align-items: center; gap: 6px;
        font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: none; flex-shrink: 0;
    }
    .mobile-bar .mb-btn:hover { border-color: var(--border-strong); }

    .sidebar { width: min(84vw, 300px); transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.55); }
    .sidebar-brand { justify-content: flex-start; padding: 16px 14px; }
    .sidebar-brand .brand-txt { display: block; }
    .sidebar-x { display: inline-flex; }
    .sidebar-nav a { justify-content: flex-start; padding: 11px 12px; }
    .sidebar-nav .t-label { display: block; font-size: 14px; }
    .sidebar-nav .t-desc { display: block; }
    .nav-group { text-align: left; font-size: 10px; padding: 15px 12px 6px; }
    .nav-group::after { display: none; }
    .sidebar-foot .u-txt, .sidebar-foot .u-out { display: block; }
    .sidebar-foot .u-out { display: inline-flex; }
    .sidebar-foot .user { justify-content: flex-start; }

    .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 45; }
    .main { margin-left: 0 !important; padding: 16px 14px 40px; }
    .topbar { margin-bottom: 16px; }
    .topbar h1 { font-size: 19px; }
    .topbar-actions { width: 100%; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 11px; }
    .stat-card { padding: 15px; border-radius: 16px; }
    .stat-card .value { font-size: 19px; }
    .stat-card .icon:not(.kpi-ico) { width: 34px; height: 34px; top: 13px; right: 13px; }
    .kpi .kpi-value { font-size: 20px; }
    .kpi .kpi-ico { width: 36px; height: 36px; border-radius: 11px; }
    .chart-box { padding: 15px; }
    .hero-card { padding: 19px; }
    .hero-card h2 { font-size: 19px; }
    .quick-grid { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
    .trend { height: 142px; gap: 6px; }
    .table th, .table td { padding: 10px 12px; }
    .card { padding: 16px; }
}

@media (max-width: 820px) {
    .btn { min-height: 42px; }
    .btn-sm { min-height: 36px; }
    .form-control, .form-select { min-height: 44px; font-size: 16px; }  /* 16px: cegah zoom otomatis iOS */
    .pos-search input { font-size: 16px; }
    .table th, .table td { font-size: 12.5px; }
    .pscan-actions .btn { flex: 1; }
}

@media (max-width: 560px) {
    .main { padding: 12px 11px 34px; }
    .card { padding: 14px; border-radius: 14px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 13px; }
    .stat-card .value { font-size: 17px; }
    .stat-card .icon:not(.kpi-ico) { display: none; }
    .kpi { flex-direction: column-reverse; gap: 10px; }
    .kpi .kpi-ico { width: 34px; height: 34px; }
    .topbar h1 { font-size: 18px; }
    .topbar > .btn, .topbar-actions > .btn { flex: 1 1 auto; justify-content: center; }
    .hero-card { padding: 16px; }
    .hero-card .hero-actions { flex-direction: column; gap: 8px; }
    .hero-card .hero-actions .btn { width: 100%; }
    .hero-meta { gap: 13px; }
    .hero-meta strong { font-size: 15px; }
    .trend .val { display: none; }
    .quick-grid { grid-template-columns: 1fr 1fr; }
    .btn-lg { width: 100%; }
    .lp-cta { flex-direction: column; }
    .lp-cta .btn { width: 100%; }
    .auth-card { padding: 26px 20px; }
    .unit-row { flex-wrap: wrap; }
    .pscan { padding: 0; align-items: stretch; }
    .pscan-box { max-width: 100%; border-radius: 0; min-height: 100dvh; display: flex; flex-direction: column; }
    .pscan-box video { aspect-ratio: 3 / 4; flex: 1; min-height: 240px; }
    .pscan-manual { margin-top: auto; }
}

@media (hover: none) {
    .sidebar-nav a { padding-top: 12px; padding-bottom: 12px; }
    .quick-btn { padding: 15px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ---------- 19. Brand sidebar & logo mobile lebih besar dan rapi ---------- */
.sidebar-brand{gap:14px;padding:18px 16px}
.sidebar-brand .logo{width:52px;height:52px;border-radius:16px;font-size:22px;box-shadow:0 4px 14px rgba(0,0,0,.28)}
.sidebar-brand .logo-fallback{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--primary),#4c1d95);color:#fff;font-weight:800;font-size:22px;border-radius:16px}
.sidebar-brand .name{font-size:16px}
.sidebar-brand .sub{font-size:12px}
.mobile-bar{gap:10px}
.mobile-bar .mb-logo{width:36px;height:36px;border-radius:11px;overflow:hidden;flex:none;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--primary),#4c1d95);color:#fff;font-weight:800;font-size:16px}
.mobile-bar .mb-logo img{width:100%;height:100%;object-fit:cover}

/* ---------- 20. Responsif tambahan (audit 2026-10-05) ---------- */
@media (max-width: 560px) {
    /* kartu flex min-width:320px (laporan detail) muat di HP 360px */
    .row > .card[style*="min-width:320px"] { min-width: 0 !important; flex: 1 1 100% !important; }
    /* aksi baris tabel tetap nyaman disentuh */
    .table .btn-sm { min-height: 36px; }
    /* cegah teks panjang (nama barang, catatan) mendorong layout */
    .table td { overflow-wrap: anywhere; }
}

/* ---------- Kartu paket di sidebar (integrasi Kasirin) ---------- */
.sidebar-plan {
    margin: 10px 12px 0;
    padding: 11px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(79, 70, 229, .16), rgba(14, 165, 233, .12));
    border: 1px solid rgba(79, 70, 229, .22);
}
.sidebar-plan .sp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-plan .sp-plan { font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.sidebar-plan .sp-days { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(5, 150, 105, .16); color: #047857; white-space: nowrap; }
.sidebar-plan .sp-days.warn { background: rgba(220, 38, 38, .14); color: #b91c1c; }
.sidebar-plan a { display: block; margin-top: 6px; font-size: 11.5px; color: var(--primary); text-decoration: none; font-weight: 600; }
.sidebar-plan a:hover { text-decoration: underline; }
[data-rail="1"] .sidebar-plan { display: none; }

/* ---------- Pencarian menu & fitur terkunci ---------- */
.sidebar-search { padding: 6px 12px 8px; }
.sidebar-search input {
    width: 100%; padding: 8px 11px; border-radius: 9px; font: inherit; font-size: 12.5px;
    background: rgba(255, 255, 255, .07); color: #ececf4;
    border: 1px solid rgba(255, 255, 255, .12); outline: none;
}
.sidebar-search input::placeholder { color: #9aa0b5; }
.sidebar-search input:focus { border-color: rgba(167, 139, 250, .7); background: rgba(255,255,255,.1); }
.sidebar-nav a.locked { opacity: .72; }
.sidebar-nav a.locked:hover { opacity: 1; }
.lock-badge {
    display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px;
    font-size: 9.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
    background: rgba(129, 140, 248, .22); color: #c7d2fe; vertical-align: middle;
}
[data-rail="1"] .sidebar-search, [data-rail="1"] .lock-badge { display: none; }

/* ---------- Panel bantuan (tombol ?) ---------- */
.help-fab {
    position: fixed; right: 18px; bottom: 18px; z-index: 60;
    width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface, #fff); color: var(--primary);
    font-size: 19px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow, 0 8px 24px -12px rgba(0,0,0,.35));
    display: grid; place-items: center;
}
.help-fab:hover { border-color: var(--primary); }
.help-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 70;
    opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.help-overlay.show { opacity: 1; pointer-events: auto; }
.help-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw); z-index: 71;
    background: var(--surface, #fff); border-left: 1px solid var(--border);
    transform: translateX(102%); transition: transform .22s ease;
    display: flex; flex-direction: column; box-shadow: -20px 0 40px -30px rgba(15,23,42,.4);
}
.help-drawer.open { transform: translateX(0); }
.help-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px;
}
.help-head button { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); }
.help-body { padding: 16px; overflow-y: auto; font-size: 13.5px; line-height: 1.6; color: var(--text-soft); }
.help-body h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.help-body h4 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.help-body ol, .help-body ul { margin: 0; padding-left: 18px; }
.help-body li { margin-bottom: 5px; }
.help-more {
    display: inline-flex; margin-top: 18px; padding: 9px 14px; border-radius: 9px;
    background: var(--primary); color: #fff; font-weight: 600; font-size: 13px; text-decoration: none;
}
@media print { .help-fab, .help-drawer, .help-overlay { display: none !important; } }
/* Di halaman kasir, tombol bantuan bisa menutupi tombol bayar pada layar kecil. */
@media (max-width: 900px) { .help-fab-kasir { display: none; } }
