/* ==========================================================================
   BINAFIZ MONITORING - gaya antarmuka
   Tema: gelap & terang. Aksen ungu-indigo, latar netral, gradasi hanya di
   tombol utama, logo, dan grafik.
   ========================================================================== */

/* ---------- Token: tema terang (default) ---------- */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f6f7f9;
    --surface-3: #eceef2;
    --line: #e6e8ec;
    --line-strong: #d6d9e0;
    --text: #111318;
    --text-2: #3f4450;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-2: #3b82f6;
    --accent-soft: #eaf1ff;
    --accent-line: #bfd2fb;
    --hot: #ea7a0c;
    --ok: #16a34a;
    --ok-soft: #e8f7ee;
    --warn: #b45309;
    --warn-soft: #fdf1e3;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --info: #2563eb;
    --info-soft: #eaf1ff;
    --chart-grid: #eceef2;
    --chart-track: #eceef2;
    --shadow: none;
    --grad: var(--accent);
    --r-lg: 14px;
    --r: 12px;
    --r-sm: 9px;
    --side-w: 232px;
    color-scheme: light;
}

/* ---------- Token: tema gelap ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1012;
        --surface: #17191d;
        --surface-2: #1d2025;
        --surface-3: #262a31;
        --line: #272b33;
        --line-strong: #353a43;
        --text: #eef0f3;
        --text-2: #c3c8d1;
        --muted: #8b919c;
        --accent: #60a5fa;
        --accent-2: #93c5fd;
        --accent-soft: rgba(96, 165, 250, 0.14);
        --accent-line: rgba(96, 165, 250, 0.4);
        --hot: #fb923c;
        --ok: #4ade80;
        --ok-soft: rgba(74, 222, 128, 0.12);
        --warn: #fbbf24;
        --warn-soft: rgba(251, 191, 36, 0.12);
        --danger: #f87171;
        --danger-soft: rgba(248, 113, 113, 0.12);
        --info: #60a5fa;
        --info-soft: rgba(96, 165, 250, 0.12);
        --chart-grid: #262a31;
        --chart-track: #262a31;
        --shadow: none;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0f1012;
    --surface: #17191d;
    --surface-2: #1d2025;
    --surface-3: #262a31;
    --line: #272b33;
    --line-strong: #353a43;
    --text: #eef0f3;
    --text-2: #c3c8d1;
    --muted: #8b919c;
    --accent: #60a5fa;
    --accent-2: #93c5fd;
    --accent-soft: rgba(96, 165, 250, 0.14);
    --accent-line: rgba(96, 165, 250, 0.4);
    --hot: #fb923c;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.12);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.12);
    --chart-grid: #262a31;
    --chart-track: #262a31;
    --shadow: none;
    color-scheme: dark;
}

/* ---------- Dasar ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background-image: radial-gradient(900px 420px at 85% -12%, var(--glow), transparent 70%);
    background-repeat: no-repeat;
    font-family: ui-sans-serif, "Segoe UI Variable", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
h1, h2, h3 { color: var(--text); letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 28px 0 12px; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 10px; }
.ico { flex: none; vertical-align: middle; }
.subtitle { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.text-muted { color: var(--muted); }
.small-note { color: var(--muted); font-size: 13px; margin-top: 6px; }
.mt-0 { margin-top: 0 !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.flex-between h2 { margin: 24px 0 10px; }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--line); }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ---------- Tata letak aplikasi: sidebar + topbar + konten ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none;
    display: flex; flex-direction: column; gap: 4px;
    padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line);
    overflow-y: auto;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 28px 56px; }
.footer { color: var(--muted); font-size: 12.5px; padding: 0 28px 24px; max-width: 1240px; margin: 0 auto; width: 100%; }
.scrim { position: fixed; inset: 0; background: rgba(5, 5, 12, 0.45); z-index: 40; }

/* Topbar: pencarian, aksi, dan profil */
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    height: 64px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.menu-toggle { display: none; }
.search {
    flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px;
    height: 40px; padding: 0 14px; background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 10px; color: var(--muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.search input {
    flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 14.5px; color: var(--text);
    padding: 0; height: 100%;
}
.search input:focus { outline: none; box-shadow: none; }
.search input::placeholder { color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me-mini { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 4px; }
.me-mini-text { display: flex; flex-direction: column; line-height: 1.2; }
.me-mini .me-name { font-size: 14px; font-weight: 600; }
.me-mini .me-role { font-size: 12px; color: var(--muted); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px;
}
.avatar-sm {
    width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; margin-right: 8px;
    background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; vertical-align: middle;
}

/* Brand & navigasi sidebar */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.brand-text small { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 12px; color: var(--muted); padding: 18px 12px 6px; font-weight: 500; }
.nav-label:first-child { padding-top: 2px; }
.nav-link {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm);
    color: var(--text-2); font-size: 14.5px; font-weight: 500; transition: background-color .15s, color .15s;
}
.nav-link .ico { color: var(--muted); }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link.active .ico { color: var(--accent); }
.nav-link.active::before { display: none; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
    background: var(--grad); color: #fff; font: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none; line-height: 1.2;
    transition: filter .15s, background-color .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; color: #fff; }
.btn:active { filter: brightness(0.95); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-outline {
    background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); box-shadow: none;
}
.btn-outline:hover { background: var(--surface-2); filter: none; color: var(--text); }
.btn-green { background: var(--ok); color: #fff; }
.btn-green:hover { filter: brightness(1.05); }
.btn-danger { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-outline .ico, .btn-sm .ico { vertical-align: -3px; }

/* ---------- Kartu & panel ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 22px 24px; margin-bottom: 16px; box-shadow: none;
}
.card h2:first-child, .card > h2.mt-0 { margin-top: 0; }

/* Statistik */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-box {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
    box-shadow: var(--shadow);
}
.stat-box .angka { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-box .label { font-size: 13.5px; color: var(--muted); }
a.stat-link { color: inherit; transition: border-color .15s, background-color .15s; }
a.stat-link:hover { border-color: var(--accent-line); text-decoration: none; }
.stat-go { margin-top: 8px; font-size: 13px; color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }

/* Grafik */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { margin: 0; }
.chart-card h2 { font-size: 16px; margin: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.chart-card > .small-note { margin: 0 0 12px; }
.chart-panel svg, .chart-card > svg { display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.hint-klik { font-size: 12px; font-weight: 500; color: var(--accent); margin-left: 8px; }
.chart-clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.chart-clickable:hover, .chart-clickable:focus-visible { border-color: var(--accent-line); outline: none; }
.seg {
    display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 3px; gap: 2px;
}
.seg-btn {
    border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500;
    padding: 5px 11px; border-radius: 7px; cursor: pointer; transition: background-color .15s, color .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 0 0 1px var(--line); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; padding: 0; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th {
    font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2);
    white-space: nowrap; position: sticky; top: 0;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:not(:first-child):hover td { background: var(--surface-2); }
td { font-variant-numeric: tabular-nums; }
.table-wrap > table th:first-child, .table-wrap > table td:first-child { padding-left: 20px; }
.table-wrap > table th:last-child, .table-wrap > table td:last-child { padding-right: 20px; }
.col-alur { min-width: 240px; }
.table-wrap td strong { white-space: nowrap; }

/* ---------- Lencana status ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px;
    border-radius: 999px; font-size: 12.5px; font-weight: 500; line-height: 1.3; white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-selesai, .badge-sla-ok, .badge-dikantor, .badge-aktif, .badge-pm-selesai, .badge-pm-selesai {
    background: var(--ok-soft); color: var(--ok);
}
.badge-batal, .badge-sla-lewat, .badge-pm-cancel, .badge-prio-high { background: var(--danger-soft); color: var(--danger); }
.badge-lewat, .badge-luarkantor, .badge-isolir, .badge-pm-konfirmasi, .badge-prio-medium, .badge-terjadwal, .badge-baru {
    background: var(--warn-soft); color: var(--warn);
}
.badge-diproses, .badge-pm-pemasangan, .badge-pm-cancel-soft, .badge-prio-low { background: var(--info-soft); color: var(--info); }
.badge-nonaktif, .badge-prio-low-muted { background: var(--surface-3); color: var(--muted); }
.badge-prio-low { background: var(--info-soft); color: var(--info); }

/* ---------- Formulir ---------- */
label { display: block; font-size: 13.5px; font-weight: 500; color: var(--text-2); margin: 12px 0 6px; }
label:first-child { margin-top: 0; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="month"],
input[type="time"], input[type="tel"], input[type="email"], select, textarea {
    width: 100%; font: inherit; font-size: 14.5px; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px;
    padding: 9px 12px; transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="file"] { font-size: 13.5px; color: var(--text-2); }
input[type="file"]::file-selector-button {
    font: inherit; font-size: 13px; background: var(--surface-3); color: var(--text);
    border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; margin-right: 10px; cursor: pointer;
}
textarea { min-height: 84px; resize: vertical; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 4px; }
.form-row > div { min-width: 0; }
.form-row label { margin-top: 0; }

/* Peringatan & info */
.alert {
    padding: 12px 16px; border-radius: var(--r); margin-bottom: 18px; font-size: 14px;
    border: 1px solid transparent; display: flex; align-items: flex-start; gap: 10px;
}
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.warning-box {
    background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
    padding: 12px 16px; border-radius: var(--r); font-size: 14px; margin: 10px 0;
}
.libur-box {
    background: var(--info-soft); color: var(--info); padding: 14px 18px; border-radius: var(--r);
    display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 14.5px;
}
.lokasi-info { font-size: 13.5px; color: var(--text-2); margin: 10px 0; display: flex; align-items: center; gap: 6px; }

/* ---------- Dokumentasi & foto ---------- */
.dok-box {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
    padding: 14px 16px; margin: 12px 0;
}
.dok-box > strong { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.dok-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.absen-preview { display: none; max-width: 100%; width: 260px; border-radius: var(--r); margin-top: 10px; border: 1px solid var(--line); }
.foto-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); margin: 2px 4px 2px 0; }
img { max-width: 100%; }
.riwayat { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.riwayat li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.riwayat li:last-child { border-bottom: 0; }
.riwayat-waktu { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; margin-right: 6px; }

/* ---------- Alur pemasangan (stepper kecil) ---------- */
.flow { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0 2px; }
.flow-step { flex: 1; min-width: 0; text-align: center; position: relative; }
.flow-step:not(:last-child)::after {
    content: ""; position: absolute; top: 12px; left: calc(50% + 16px); right: calc(-50% + 16px);
    height: 2px; background: var(--line-strong); border-radius: 2px;
}
.flow-step.done:not(:last-child)::after { background: var(--ok); }
.flow-dot {
    width: 24px; height: 24px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center;
    background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 600; position: relative; z-index: 1;
}
.flow-step.done .flow-dot { background: var(--ok); color: #fff; }
.flow-step.active .flow-dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.flow-step.cancel .flow-dot { background: var(--danger); color: #fff; }
.flow-label { font-size: 12px; color: var(--text-2); margin-top: 6px; line-height: 1.25; }
.flow-step.pending .flow-label { color: var(--muted); }
.flow-time { font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Diagram alur pemasangan (halaman admin) */
.fd { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; gap: 10px; align-items: stretch; }
.fd-node {
    display: block; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
    background: var(--surface-2); color: var(--text); min-width: 0; transition: border-color .15s;
}
a.fd-node:hover { border-color: var(--accent-line); text-decoration: none; }
.fd-node.gate { border-style: dashed; }
.fd-step { font-size: 12px; color: var(--muted); }
.fd-title { font-weight: 600; font-size: 14.5px; margin: 4px 0 8px; display: flex; align-items: center; gap: 8px; }
.fd-count { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -0.02em; }
.fd-count small { font-size: 15px; color: var(--muted); font-weight: 500; }
.fd-desc { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.fd-arrow { align-self: center; color: var(--muted); display: grid; place-items: center; }
.n-selesai .fd-title { color: var(--ok); }
.fd-cancel { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13.5px; }
.fd-cancel:hover { text-decoration: none; border-color: var(--danger); }
.fd-cancel-box { color: var(--danger); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Pencarian pelanggan ---------- */
.cari-wrap { position: relative; }
.hasil-cari {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 6px;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
    box-shadow: 0 12px 32px rgba(0,0,0,.18); max-height: 320px; overflow-y: auto;
}
.hasil-item {
    display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
    border-bottom: 1px solid var(--line); padding: 10px 14px; font: inherit; color: var(--text);
}
.hasil-item:last-child { border-bottom: 0; }
.hasil-item:hover, .hasil-item:focus-visible { background: var(--surface-2); outline: none; }
.hasil-item strong { font-weight: 600; }
.hasil-kosong { padding: 12px 14px; color: var(--muted); font-size: 14px; }

/* ---------- Popup detail dashboard ---------- */
.popup-latar {
    position: fixed; inset: 0; z-index: 100; background: rgba(5, 5, 12, 0.6);
    display: flex; align-items: flex-start; justify-content: center; padding: 32px 14px; overflow-y: auto;
}
.popup-kotak {
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px;
    width: 100%; max-width: 1000px; padding: 22px 24px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.popup-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.popup-head h2 { margin: 0; font-size: 19px; }
.popup-tutup {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
    color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer;
}
.popup-tutup:hover { background: var(--surface-3); color: var(--text); }
.popup-grafik { display: flex; justify-content: center; margin: 14px 0 16px; }
.popup-grafik svg { width: 100%; height: auto; max-width: 900px; }
.popup-grafik .chart-legend { font-size: 15px; justify-content: center; gap: 18px; }
.popup-chart-src { display: contents; }
.popup-tabel { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.popup-tabel th, .popup-tabel td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.popup-tabel th { position: static; }
.baris-klik { cursor: pointer; }
.baris-klik:hover td { background: var(--surface-2); }
.popup-daftar { margin-top: 14px; }
.popup-daftar h3 { margin: 12px 0 6px; font-size: 15px; }
.popup-tab { display: flex; gap: 8px; margin: 12px 0; }

/* ---------- Halaman masuk ---------- */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background:
        radial-gradient(60% 50% at 50% 0%, rgba(109,75,245,.18), transparent 70%),
        var(--bg);
}
.login-box {
    width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 20px; padding: 32px 30px 30px; box-shadow: var(--shadow);
}
.login-box .brand { padding: 0 0 20px; }
.login-box h1 { display: none; }
.login-box .subtitle { margin-bottom: 18px; }
.login-box .btn { width: 100%; padding: 11px 16px; font-size: 15px; margin-top: 16px; }

/* ---------- Footer ---------- */
.footer { margin-top: auto; }

/* ---------- Layar kecil ---------- */
@media (max-width: 1100px) {
    .chart-grid { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr 1fr; }
    .dash-grid .side-stack { grid-column: span 2; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    .dash-grid .side-stack .card { margin: 0; }
    .fd { grid-template-columns: 1fr 1fr; }
    .fd-arrow { display: none; }
}
@media (max-width: 900px) {
    .app { display: block; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; height: auto; z-index: 50;
        transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.2);
    }
    .sidebar.open { transform: none; }
    .menu-toggle { display: inline-grid; }
    .topbar { padding: 0 16px; gap: 10px; }
    .me-mini-text { display: none; }
    .container { padding: 20px 16px 48px; }
    h1 { font-size: 22px; }
    .stat-box .angka { font-size: 26px; }
}
@media (max-width: 640px) {
    .form-row, .dok-grid { grid-template-columns: 1fr; }
    .fd { grid-template-columns: 1fr; }
    .card { padding: 16px 16px; border-radius: 14px; }
    .popup-kotak { padding: 16px; }
    .popup-grafik .chart-legend { font-size: 13px; }
    .table-wrap > table th, .table-wrap > table td { padding: 10px 12px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-box { padding: 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}


/* ==========================================================================
   Dashboard: grid kartu, kepala kartu, angka besar, daftar, dan aktivitas
   ========================================================================== */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-grid { gap: 16px; margin-bottom: 16px; }
.stat-box { gap: 6px; padding: 18px 20px; }
.stat-box .label { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.stat-box .angka { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.stat-box .angka small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.delta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.muted { color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.dash-grid > .card { margin: 0; }
.span-2 { grid-column: span 2; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }
.side-stack .card { margin: 0; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.card-head .small-note { margin: 0; }
.card-head .seg { flex: none; }
.chart-card > .chart-head { margin-bottom: 10px; }
.big-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.big-num { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.chart-card .chart-legend { margin-top: 14px; }
.chart-legend { font-size: 13px; color: var(--muted); gap: 18px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }

/* Donat + daftar angka */
.donut-wrap { margin: 2px 0 14px; padding: 0 12px; }
.legend-rows { list-style: none; margin: 0; padding: 0; }
.legend-rows li {
    display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line);
    font-size: 14px;
}
.legend-rows li:first-child { border-top: 0; }
.legend-name { flex: 1; color: var(--text-2); }
.legend-val { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Bar horizontal */
.hbars { display: flex; flex-direction: column; gap: 16px; }
.hbar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 7px; color: var(--text-2); }
.hbar-val { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; background: var(--accent); }

/* Aktivitas */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.feed li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.feed-ico {
    width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.feed-body { min-width: 0; line-height: 1.45; }
.feed-time { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* Grafik: sumbu & label lebih tenang */
.chart-panel svg text { font-family: inherit; }

/* Tabel dashboard */
.table-wrap td .badge { vertical-align: middle; }

@media (max-width: 900px) {
    .dash-grid { grid-template-columns: 1fr; }
    .dash-grid .side-stack { grid-column: auto; display: flex; }
    .span-2 { grid-column: auto; }
    .big-num { font-size: 32px; }
}
.span-3 { grid-column: span 3; }
.span-3 .feed { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; }
@media (max-width: 900px) { .span-3 { grid-column: auto; } .span-3 .feed { grid-template-columns: 1fr; } }
