@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations'), url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* =====================================================================
   1. TOKEN DESAIN
   ===================================================================== */
:root {
    --bg: #F2F3EF;
    --surface: #FFFFFF;
    --surface-2: #F8F9F6;
    --surface-3: #EFF1EC;
    --ink: #15171A;
    --ink-2: #444A52;
    --ink-3: #7B818A;
    --ink-4: #A8ADB4;
    --line: #E3E6E0;
    --line-2: #ECEEE8;

    --brand: #0F7A5E;
    --brand-strong: #0B6350;
    --brand-deep: #0B2F27;
    --brand-soft: #E2F2EC;
    --brand-mid: #BFE1D4;
    --brand-ring: rgba(15, 122, 94, 0.22);
    --brand-glow: #5ED6B0;

    --sidebar: #15171A;
    --sidebar-2: #1D2024;
    --sidebar-ink: #C6CAD0;
    --sidebar-mute: #7A8089;

    --amber: #A5620D;
    --amber-soft: #FBEFD9;
    --red: #B7352A;
    --red-soft: #FBE7E4;
    --blue: #2A5FA8;
    --blue-soft: #E5EEF9;

    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-1: 0 1px 2px rgba(21, 23, 26, 0.04), 0 2px 10px rgba(21, 23, 26, 0.04);
    --shadow-2: 0 10px 30px rgba(21, 23, 26, 0.08);
    --shadow-3: 0 24px 64px rgba(21, 23, 26, 0.18);

    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --sidebar-w: 268px;
}

/* =====================================================================
   2. DASAR
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body { min-height: 100vh; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
p { margin: 0; }
img { max-width: 100%; }

.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D5D8D1; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }

.ic { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

/* =====================================================================
   3. KERANGKA APLIKASI & SIDEBAR
   ===================================================================== */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app-shell > .sidebar { grid-column: 1; grid-row: 1; }
.app-shell > .main { grid-column: 2; grid-row: 1; }

.sidebar {
    background: var(--sidebar); color: var(--sidebar-ink); padding: 22px 14px 16px;
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; }
.sidebar-brand img, .brand-fallback { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: #2A2E33; }
.brand-fallback { background: linear-gradient(135deg, #1F9174, #0B5A47); }
.sidebar-brand strong {
    display: block; color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25;
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-brand span { font-size: 12px; color: var(--sidebar-mute); }

.nav-section-title { font-size: 11.5px; font-weight: 600; color: var(--sidebar-mute); margin: 18px 12px 6px; letter-spacing: 0.03em; }
.nav-link {
    display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px;
    color: var(--sidebar-ink); font-weight: 500; font-size: 14px; transition: background 0.15s ease, color 0.15s ease;
}
.nav-link .ic { opacity: 0.8; }
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link.active { background: rgba(94, 214, 176, 0.14); color: #8EF2D0; font-weight: 600; }
.nav-link.active .ic { opacity: 1; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.user-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--sidebar-2); }
.user-card .avatar { background: #2D3238; color: #E8EBEE; border-radius: 12px; }
.user-meta { min-width: 0; }
.user-meta strong { display: block; color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 12px; color: var(--sidebar-mute); }
.user-actions { display: flex; gap: 8px; margin-top: 10px; }
.user-actions button {
    flex: 1; height: 38px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.12); background: transparent;
    color: var(--sidebar-ink); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}
.user-actions button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; letter-spacing: 0.01em; }
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 16px; }

.tone-0 { background: #E2F2EC; color: #0F7A5E; }
.tone-1 { background: #FBEFD9; color: #A5620D; }
.tone-2 { background: #E5EEF9; color: #2A5FA8; }
.tone-3 { background: #FBE7EC; color: #B0365A; }
.tone-4 { background: #EDE8FA; color: #6845B5; }
.tone-5 { background: #E9ECEF; color: #4A515A; }

.main { padding: 32px 40px 80px; max-width: 1400px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.topbar h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.topbar p { color: var(--ink-3); font-size: 15px; margin-top: 4px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.mobile-topbar { display: none; align-items: center; gap: 12px; height: 56px; padding: 0 16px; background: var(--sidebar); color: #fff; position: sticky; top: 0; z-index: 30; }
.mobile-topbar strong { font-size: 15px; font-weight: 700; }
.hamburger-btn { background: transparent; border: 0; color: #fff; padding: 6px; display: flex; border-radius: 10px; }
.hamburger-btn:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar-close-btn { display: none; margin-left: auto; background: transparent; border: 0; color: #EDEDED; width: 36px; height: 36px; border-radius: 10px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 17, 19, 0.5); z-index: 39; }
.sidebar-overlay.visible { display: block; }

/* =====================================================================
   4. KARTU, BENTO, KPI
   ===================================================================== */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card-sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.bento > * { grid-column: span 12; min-width: 0; }
.col-3 { grid-column: span 3 !important; }
.col-4 { grid-column: span 4 !important; }
.col-5 { grid-column: span 5 !important; }
.col-6 { grid-column: span 6 !important; }
.col-7 { grid-column: span 7 !important; }
.col-8 { grid-column: span 8 !important; }
.col-12 { grid-column: span 12 !important; }

.stat-label { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-bottom: 8px; }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

.kpi { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; position: relative; overflow: hidden; }
.kpi-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi-icon.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-icon.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

.kpi-hero { background: linear-gradient(140deg, #0F4034 0%, #0A2822 100%); border: none; color: #fff; min-height: 236px; box-shadow: 0 14px 34px rgba(11, 47, 39, 0.28); }
.kpi-hero::after { content: ""; position: absolute; right: -50px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(closest-side, rgba(94, 214, 176, 0.32), transparent); }
.kpi-hero > * { position: relative; z-index: 1; }
.kpi-hero .stat-label { color: rgba(255, 255, 255, 0.72); }
.kpi-hero .stat-value { font-size: 40px; color: #fff; }
.kpi-hero .kpi-icon { background: rgba(255, 255, 255, 0.12); color: #8EF2D0; }
.kpi-hero .stat-sub { color: rgba(255, 255, 255, 0.66); }

.delta { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.delta.up { background: rgba(94, 214, 176, 0.18); color: #7DEBC6; }
.delta.down { background: rgba(255, 138, 122, 0.18); color: #FF9D8E; }
.delta.flat { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.8); }
.card:not(.kpi-hero) .delta.up { background: var(--brand-soft); color: var(--brand); }
.card:not(.kpi-hero) .delta.down { background: var(--red-soft); color: var(--red); }

.chart { width: 100%; height: 236px; }
.chart svg { width: 100%; height: 100%; overflow: visible; display: block; }
.chart .bar { fill: var(--brand-mid); transition: fill 0.15s ease; }
.chart .bar.today { fill: var(--brand); }
.chart .bar:hover { fill: var(--brand-strong); }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-label { font-size: 12px; fill: var(--ink-3); font-weight: 500; }
.chart .axis-label.today { fill: var(--ink); font-weight: 700; }
.chart .bar-value { font-size: 11.5px; fill: var(--ink-2); font-weight: 700; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-main { min-width: 0; flex: 1; }
.list-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.list-end { text-align: right; flex-shrink: 0; }
.list-end strong { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.list-end span { color: var(--ink-3); font-size: 12px; }

.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.meter.warn > i { background: #D9922B; }
.meter.danger > i { background: #D9534A; }
.rank { width: 26px; height: 26px; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }

/* =====================================================================
   5. TOMBOL, BADGE, FORM
   ===================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
    border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 1px 2px rgba(15, 122, 94, 0.35); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: #D6D9D2; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #F6D6D1; }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 0 12px; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.btn-xl { height: 56px; font-size: 16px; border-radius: 16px; }

.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-3); display: inline-grid; place-items: center; transition: background 0.15s ease, color 0.15s ease; flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.ok { background: var(--brand-soft); color: var(--brand); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.danger { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: var(--surface-3); color: var(--ink-2); }
.badge.info { background: var(--blue-soft); color: var(--blue); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; transition: all 0.15s ease; white-space: nowrap; }
.chip:hover { border-color: #CFD3CB; background: var(--surface-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], input[type="email"], input[type="tel"], textarea, select {
    height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
    outline: none; width: 100%; transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
textarea { height: auto; min-height: 88px; padding: 11px 14px; resize: vertical; line-height: 1.5; }
input:hover, textarea:hover, select:hover { border-color: #D3D7CF; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }
input[type="file"] { height: auto; padding: 10px; font-size: 13px; border-style: dashed; background: var(--surface-2); }
select {
    appearance: none; padding-right: 38px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
    background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.toolbar-select { width: auto; min-width: 190px; }

.search-input {
    display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; min-width: 300px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-3); transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.search-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); background: var(--surface); }
.search-input input { border: none; background: none; box-shadow: none; padding: 0; height: 100%; flex: 1; }
.search-input input:focus { box-shadow: none; }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.5; align-items: flex-start; }
.alert .ic { margin-top: 2px; }
.alert-error { background: var(--red-soft); color: #8E2A21; }
.alert-warn { background: var(--amber-soft); color: #7A4A0A; }
.alert-info { background: var(--blue-soft); color: #214A82; }

/* =====================================================================
   6. TABEL
   ===================================================================== */
.table-scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.table-scroll table { min-width: 620px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
thead th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 0 14px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody td { padding: 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.cell-flex { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.actions { display: flex; gap: 2px; justify-content: flex-end; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.empty-state { text-align: center; padding: 52px 20px; color: var(--ink-3); }
.empty-state strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty-state .empty-ic { width: 52px; height: 52px; border-radius: 16px; background: var(--surface-3); color: var(--ink-3); display: grid; place-items: center; margin: 0 auto 14px; }

.sk { height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3) 25%, #F8F9F6 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton-row td { padding: 18px 14px; }
.sk-list { display: flex; flex-direction: column; gap: 14px; }
.sk-line { height: 44px; border-radius: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.tab-bar { display: inline-flex; gap: 2px; padding: 4px; background: var(--surface-3); border-radius: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.tab-btn { height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-3); transition: all 0.15s ease; }
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* =====================================================================
   7. MODAL & TOAST
   ===================================================================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 17, 19, 0.46); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; animation: fade-in 0.18s ease; }
.modal { background: var(--surface); border-radius: 24px; padding: 26px; width: 100%; max-width: 500px; box-shadow: var(--shadow-3); max-height: 90vh; overflow-y: auto; animation: modal-in 0.24s var(--ease); }
.modal.wide { max-width: 760px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.modal-header h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

.toast-stack { position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: calc(100vw - 40px); }
.toast { padding: 13px 16px 13px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-2); min-width: 240px; max-width: 380px; border-left: 4px solid #6B7280; animation: toast-in 0.28s var(--ease); }
.toast.success { border-left-color: var(--brand-glow); }
.toast.error { background: #3A1512; border-left-color: #FF7A6B; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   8. HALAMAN MASUK
   ===================================================================== */
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); min-height: 100vh; background: var(--bg); }
.auth-art { background: var(--sidebar); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before { content: ""; position: absolute; left: -120px; bottom: -160px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(closest-side, rgba(15, 122, 94, 0.55), transparent); }
.auth-art::after {
    content: ""; position: absolute; right: 48px; top: 0; width: 150px; height: 100%;
    background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, 0.04) 22px 23px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 6px, rgba(255, 255, 255, 0.07) 6px 7px, transparent 7px 14px);
    opacity: 0.7;
}
.auth-art > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 14px; }
.auth-brand img, .auth-brand .brand-fallback { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; }
.auth-brand strong { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.auth-hero h2 { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; max-width: 470px; }
.auth-hero h2 em { font-style: normal; color: var(--brand-glow); }
.auth-hero p { margin-top: 18px; color: rgba(255, 255, 255, 0.66); font-size: 16px; max-width: 420px; line-height: 1.6; }
.auth-points { display: flex; flex-direction: column; gap: 14px; margin-top: 34px; }
.auth-point { display: flex; align-items: center; gap: 14px; font-size: 14.5px; color: rgba(255, 255, 255, 0.84); }
.auth-point .pt-ic { width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); color: var(--brand-glow); display: grid; place-items: center; flex-shrink: 0; }
.auth-foot { font-size: 12.5px; color: rgba(255, 255, 255, 0.4); }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.auth-card .lead { color: var(--ink-3); margin: 8px 0 28px; }
.input-icon { position: relative; }
.input-icon > [data-icon] { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-4); pointer-events: none; }
.input-icon input { padding-left: 44px; }
.auth-mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 28px; }

/* installer memakai kerangka kartu sederhana */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-2); padding: 36px 32px; border: 1px solid var(--line-2); }
.login-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px; }
.login-error { color: var(--red); font-size: 13.5px; line-height: 1.5; min-height: 18px; margin: 4px 0 12px; }

/* =====================================================================
   9. DASBOR
   ===================================================================== */
.quick-links { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.quick-links .btn { background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.16); }
.quick-links .btn:hover { background: rgba(255, 255, 255, 0.18); }
.quick-links .btn-light { background: #fff; color: var(--brand-deep); border-color: #fff; }
.quick-links .btn-light:hover { background: #F0F4F2; }

/* =====================================================================
   10. KASIR (POS)
   ===================================================================== */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 20px; align-items: start; }
.pos-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pos-toolbar { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.pos-toolbar .field { margin: 0; }
.scan-box { position: relative; }
.scan-box > [data-icon] { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--brand); pointer-events: none; }
.scan-box input { padding-left: 44px; height: 50px; border-color: var(--brand-mid); background: var(--brand-soft); font-weight: 500; }
.scan-box input:focus { background: var(--surface); }
.camera-wrap { border-radius: var(--radius-md); overflow: hidden; background: #000; }
.camera-wrap video { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.pos-filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pos-filter .search-input { flex: 1; min-width: 220px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chips::-webkit-scrollbar { height: 0; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.product-tile {
    text-align: left; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-md); padding: 14px;
    display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-1); transition: transform 0.12s var(--ease), box-shadow 0.15s ease, border-color 0.15s ease;
}
.product-tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--brand-mid); }
.product-tile:active:not(:disabled) { transform: scale(0.98); }
.product-tile:disabled { opacity: 0.55; cursor: not-allowed; }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tile-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.tile-name { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.tile-price { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile-sku { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-pill { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.stock-pill.low { background: var(--amber-soft); color: var(--amber); }
.stock-pill.out { background: var(--red-soft); color: var(--red); }

.cart-panel { position: sticky; top: 20px; display: flex; flex-direction: column; max-height: calc(100vh - 40px); padding: 0; overflow: hidden; }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px 14px; }
.cart-head h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.cart-count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 8px; margin-left: 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; vertical-align: 2px; }
.cart-lines { padding: 0 22px; overflow-y: auto; flex: 1; min-height: 120px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.cart-line:last-child { border-bottom: none; }
.cart-line-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.cart-line-price { color: var(--ink-3); font-size: 12.5px; }
.cart-line-total { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
.cart-line-ctrl { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-3); border-radius: 12px; padding: 3px; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--surface); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow-1); transition: transform 0.08s ease; }
.stepper button:active { transform: scale(0.92); }
.stepper .qty { min-width: 36px; text-align: center; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }

.cart-foot { padding: 16px 22px 22px; border-top: 1px solid var(--line-2); background: var(--surface-2); }
.cart-summary-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cart-summary-row.total { color: var(--ink); font-weight: 800; font-size: 26px; letter-spacing: -0.03em; padding: 10px 0 6px; align-items: baseline; }
.cart-summary-row.total span:first-child { font-size: 14px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.cart-summary-row.change { font-weight: 700; color: var(--brand); }

.pay-methods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.pay-method { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: 11.5px; font-weight: 600; transition: all 0.15s ease; }
.pay-method:hover { border-color: #CDD1C9; color: var(--ink); }
.pay-method.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick-cash .chip { height: 32px; padding: 0 12px; font-size: 12.5px; }
.mini-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-fields .field { margin: 0 0 10px; }
.mini-fields input { height: 40px; }
.cart-bar { display: none; }

/* =====================================================================
   11. PENGATURAN, JABATAN, LOGO
   ===================================================================== */
.permission-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 8px 0 18px; }
.permission-group { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; background: var(--surface-2); }
.permission-group h4 { font-size: 12.5px; margin-bottom: 10px; color: var(--ink-3); font-weight: 700; letter-spacing: 0.02em; }
.permission-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; cursor: pointer; }
.permission-item input { width: 18px; height: 18px; flex-shrink: 0; }
.logo-preview { width: 76px; height: 76px; border-radius: 18px; object-fit: cover; margin-bottom: 14px; border: 1px solid var(--line); }

/* =====================================================================
   12. UTILITAS
   ===================================================================== */
.u-m0 { margin: 0 !important; }
.u-mt-4 { margin-top: 4px !important; }
.u-mt-14 { margin-top: 14px !important; }
.u-mt-20 { margin-top: 20px !important; }
.u-mb-14 { margin-bottom: 14px !important; }
.u-mb-16 { margin-bottom: 16px !important; }
.u-mb-18 { margin-bottom: 18px !important; }
.u-mb-20 { margin-bottom: 20px !important; }
.u-mb-22 { margin-bottom: 22px !important; }
.u-w-auto { width: auto !important; }
.u-mw-120 { max-width: 120px !important; }
.u-mw-640 { max-width: 640px !important; }
.u-mw-900 { max-width: 900px !important; }
.u-minw-220 { min-width: 220px !important; }
.u-flex { display: flex !important; }
.u-center { align-items: center !important; }
.u-wrap { flex-wrap: wrap !important; }
.u-gap-6 { gap: 6px !important; }
.u-gap-8 { gap: 8px !important; }
.u-gap-10 { gap: 10px !important; }
.u-self-end { align-self: flex-end !important; }
.u-grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
.u-pad-60 { padding: 60px 20px !important; }
.u-fs-12 { font-size: 12px !important; }
.u-fs-125 { font-size: 12.5px !important; }
.u-fs-13 { font-size: 13px !important; }
.u-soft, .text-soft { color: var(--ink-3) !important; }
.u-warn { color: var(--amber) !important; }
.u-light { color: #EDEDEA !important; }
.u-note { color: var(--ink-3) !important; font-size: 13px !important; margin-bottom: 14px !important; }
.u-label { font-size: 12.5px !important; font-weight: 600 !important; color: var(--ink-2) !important; }
.u-check-row { flex-direction: row !important; align-items: center !important; gap: 10px !important; }

/* =====================================================================
   13. RESPONSIF
   ===================================================================== */
@media (max-width: 1280px) {
    .pos { grid-template-columns: minmax(0, 1fr) 370px; }
    .col-5, .col-3, .col-4 { grid-column: span 6 !important; }
    .col-7, .col-8 { grid-column: span 12 !important; }
}
@media (max-width: 1100px) {
    .pos { grid-template-columns: minmax(0, 1fr); }
    .cart-panel { position: static; max-height: none; }
    .cart-lines { max-height: 360px; }
    .cart-bar {
        display: flex; position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 35; align-items: center; justify-content: space-between;
        height: 58px; padding: 0 20px; border-radius: 18px; border: 0; background: var(--brand); color: #fff; font-weight: 700; box-shadow: var(--shadow-3);
    }
    .main.has-cart-bar { padding-bottom: 100px; }
}
@media (max-width: 900px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .app-shell > .main { grid-column: 1; grid-row: auto; }
    .mobile-topbar { display: flex; }
    .sidebar { position: fixed; left: 0; top: 0; height: 100vh; width: 286px; transform: translateX(-100%); transition: transform 0.24s var(--ease); z-index: 40; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-3); }
    .sidebar-close-btn { display: grid; place-items: center; }
    .main { padding: 22px 16px 60px; }
    .topbar { flex-direction: column; align-items: stretch; }
    .topbar h1 { font-size: 24px; }
    .topbar > .btn, .topbar-actions .btn { width: 100%; }
    .field-row, .permission-groups, .mini-fields { grid-template-columns: 1fr; }
    .bento > .card { grid-column: span 12 !important; }
    .modal { max-width: 100%; padding: 22px; border-radius: 22px; }
    .search-input { min-width: 0; width: 100%; }
    .toolbar-select { width: 100%; }
    .table-toolbar { align-items: stretch; }
    .table-toolbar > div { width: 100%; }
    .pos-toolbar { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-art { display: none; }
    .auth-panel { min-height: 100vh; }
    .auth-mobile-brand { display: flex; }
}
@media (max-width: 520px) {
    .stat-value { font-size: 24px; }
    .kpi-hero .stat-value { font-size: 32px; }
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .product-tile { padding: 12px; }
    .pay-methods { grid-template-columns: repeat(3, 1fr); }
    .toast-stack { left: 14px; right: 14px; top: 14px; }
    .toast { min-width: 0; max-width: none; }
    .u-grid-2 { grid-template-columns: 1fr !important; }
}

/* ---- tambahan dasbor & meter ---- */
.kpi-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kpi-stack .wide { grid-column: span 2; }
.kpi-compact { padding: 18px 20px; gap: 10px; }
.kpi-compact .stat-value { font-size: 28px; }
.kpi-compact .kpi-icon { width: 38px; height: 38px; border-radius: 12px; }
.quick-links .btn:not(.btn-light) { background: rgba(255, 255, 255, 0.1); }

.pct-0 { width: 0%; }
.pct-5 { width: 5%; }
.pct-10 { width: 10%; }
.pct-15 { width: 15%; }
.pct-20 { width: 20%; }
.pct-25 { width: 25%; }
.pct-30 { width: 30%; }
.pct-35 { width: 35%; }
.pct-40 { width: 40%; }
.pct-45 { width: 45%; }
.pct-50 { width: 50%; }
.pct-55 { width: 55%; }
.pct-60 { width: 60%; }
.pct-65 { width: 65%; }
.pct-70 { width: 70%; }
.pct-75 { width: 75%; }
.pct-80 { width: 80%; }
.pct-85 { width: 85%; }
.pct-90 { width: 90%; }
.pct-95 { width: 95%; }
.pct-100 { width: 100%; }
@media (max-width: 900px) { .kpi-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-stack.col-7 { grid-column: span 12 !important; } }
@media (max-width: 520px) { .kpi-stack { grid-template-columns: minmax(0, 1fr); } .kpi-stack .wide { grid-column: span 1; } }

/* ---- penyempurnaan: kasir ringkas, tautan, kartu hero ---- */
.topbar.compact { margin-bottom: 16px; }
.topbar.compact h1 { font-size: 24px; }
.extra-fields { margin-bottom: 6px; }
.extra-fields summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 4px 0 8px; }
.extra-fields summary::-webkit-details-marker { display: none; }
.extra-fields summary::after { content: "+"; font-size: 18px; line-height: 1; color: var(--ink-3); }
.extra-fields[open] summary::after { content: "\2013"; }
.cart-lines { min-height: 90px; }
.cart-head { padding: 18px 22px 10px; }
.cart-foot { padding: 14px 22px 18px; }
.pay-methods { margin: 10px 0; gap: 5px; }
.pay-method { padding: 8px 2px; }
.quick-cash .chip { height: 30px; padding: 0 10px; font-size: 12px; }
.more-link { padding-top: 14px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.more-link a { display: inline-flex; align-items: center; gap: 4px; }

/* ---- penyempurnaan akhir ---- */
.chart { height: 300px; }
.cart-panel { max-height: calc(100vh - 116px); }
.pos-toolbar select, .pos-toolbar .btn { height: 50px; }
@media (max-width: 1100px) { .cart-panel { max-height: none; } }
@media (max-width: 900px) { .topbar.compact p { display: none; } }

.chart-card { display: flex; flex-direction: column; }
.chart-card .chart { flex: 1; height: auto; min-height: 260px; }

/* ---- kerangka muat: sidebar, KPI, grafik, grid kasir (ukuran sama dengan hasil akhir) ---- */
.sk-dark { background: linear-gradient(90deg, #1F2226 25%, #2A2E33 50%, #1F2226 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px; }
.sk-brand { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; }
.sk-stack { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.sk-bar { height: 10px; }
.sk-section { height: 8px; margin: 22px 12px 10px; }
.sk-nav { height: 40px; margin: 2px 0; border-radius: 12px; }
.sk-user { height: 66px; border-radius: 14px; }
.sk-value { display: block; width: 150px; height: 34px; border-radius: 10px; }
.sk-value.sk-sm { width: 70px; height: 30px; }
.sk-delta { display: inline-block; width: 200px; height: 24px; border-radius: 99px; vertical-align: middle; }
.sk-text { display: block; width: 62%; height: 12px; margin-top: 4px; }
.sk-chart { width: 100%; height: 100%; min-height: 260px; border-radius: 14px; }
.kpi-hero .sk { background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 25%, rgba(255, 255, 255, 0.18) 50%, rgba(255, 255, 255, 0.08) 75%); background-size: 200% 100%; }
.tile-skeleton { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line-2); min-height: 150px; }
.tile-skeleton .sk-mark { width: 44px; height: 44px; border-radius: 14px; }
.tile-skeleton .sk-short { width: 55%; margin-top: auto; }

/* ruang chip kategori & tinggi kerangka kartu produk dipesan sejak awal agar tidak ada lompatan saat data tiba */
.chips { min-height: 38px; }
.tile-skeleton { min-height: 156px; }

/* ---- scan produk, petunjuk kode, barang masuk ---- */
.opt { font-weight: 500; color: var(--ink-4); }
.field-hint { min-height: 18px; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.field-hint.ok { color: var(--brand); }
.field-hint.bad { color: var(--red); font-weight: 600; }
.field-hint.checking { color: var(--ink-4); }
.field input.is-bad { border-color: var(--red); }
.field input.is-bad:focus { box-shadow: 0 0 0 4px rgba(183, 53, 42, 0.18); }
.input-action { position: relative; }
.input-action input { padding-right: 48px; }
.input-action .icon-btn { position: absolute; right: 4px; top: 4px; }
.scan-banner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; margin-bottom: 16px; }
.scan-banner .scan-box input, .scan-banner .btn { height: 50px; }
.receive-toolbar { display: grid; grid-template-columns: 240px minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.receive-toolbar .field { margin: 0; }
.receive-toolbar select, .receive-toolbar .btn { height: 50px; }
.receive-lines { border: 1px solid var(--line-2); border-radius: var(--radius-md); min-height: 150px; overflow: hidden; }
.receive-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); transition: background 0.4s ease; }
.receive-line:last-child { border-bottom: none; }
.receive-line.flash { background: var(--brand-soft); }
.receive-after { text-align: right; min-width: 92px; font-size: 13px; color: var(--ink-3); }
.receive-after strong { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.qty-input { width: 72px !important; height: 32px !important; padding: 0 6px !important; text-align: center; font-weight: 800; border: 0 !important; background: transparent !important; box-shadow: none !important; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.receive-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; margin-top: 18px; }
.receive-summary { display: flex; align-items: center; gap: 18px; }
.receive-summary > span { font-weight: 700; font-size: 15px; white-space: nowrap; }
@media (max-width: 900px) {
    .receive-toolbar, .scan-banner, .receive-foot { grid-template-columns: minmax(0, 1fr); }
    .receive-line { grid-template-columns: auto minmax(0, 1fr) auto; }
    .receive-line .stepper { grid-column: 2 / 3; }
    .receive-line .receive-after { grid-column: 2 / 3; text-align: left; }
    .receive-summary { justify-content: space-between; }
    .modal-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
