/*
 * Design system MedisApp (Fase 4 roadmap tampilan).
 *
 * Sumber: mockup FINAL di docs/mockup/ (lihat docs/mockup/README.md).
 * Contoh semua komponen: design-system.php (khusus admin).
 *
 * Aturan pakai:
 * - Semua kelas berawalan `ds-`, dan tidak ada aturan untuk elemen polos (body, table, button, ...).
 *   Jadi file ini aman dimuat di halaman lama; tampilan lama tidak berubah sampai kelas `ds-` dipakai.
 * - Bungkus halaman/bagian baru dengan `.ds` supaya huruf dan warna dasar ikut.
 * - Warna selalu lewat token `--ds-*`, jangan menulis kode warna langsung di halaman.
 */

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../lib/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../lib/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-600-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../lib/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-700-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../lib/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-800-normal.woff2") format("woff2");
}

/* ------------------------------------------------------------------ */
/* Token                                                               */
/* ------------------------------------------------------------------ */

:root {
    --ds-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Dasar */
    --ds-bg: #f4f7f6;
    --ds-surface: #ffffff;
    --ds-surface-soft: #f8fafc;
    --ds-track: #f1f5f9;
    --ds-line: #e2e8f0;
    --ds-line-strong: #cbd5e1;
    --ds-ink: #0f172a;
    --ds-ink-2: #334155;
    --ds-muted: #475569;
    --ds-neutral: #94a3b8;

    /* Utama (teal): terkendali, aksi utama */
    --ds-primary: #0f766e;
    --ds-primary-strong: #115e59;
    --ds-primary-ink: #134e4a;
    --ds-primary-deep: #0f3d3a;
    --ds-primary-soft: #f0fdfa;
    --ds-primary-mint: #e6f4f1;
    --ds-primary-100: #ccfbf1;
    --ds-primary-200: #99f6e4;
    --ds-primary-300: #5eead4;

    /* Perhatian (oranye): tensi masih tinggi, perlu dijangkau */
    --ds-warn: #ea580c;
    --ds-warn-strong: #c2410c;
    --ds-warn-ink: #9a3412;
    --ds-warn-soft: #fff7ed;
    --ds-warn-100: #ffedd5;
    --ds-warn-200: #fed7aa;

    /* Bahaya (merah bata): tensi >= 180/110 */
    --ds-crisis: #7c2d12;

    /* Warna luaran program (disepakati 24 Okt 2026, sama dengan "Luaran program" versi lama).
       Dipakai di semua grafik/peta terkendali, belum terkendali, tidak kontrol. Varian -ink untuk teks. */
    --ds-outcome-ok: #27ae60;
    --ds-outcome-ok-ink: #1e8449;
    --ds-outcome-high: #f39c12;
    --ds-outcome-high-ink: #b9770e;
    --ds-outcome-miss: #e74c3c;
    --ds-outcome-miss-ink: #c0392b;
    /* Peta padukuhan: jumlah pasien terbanyak (navy) dan paling membaik (emas). */
    --ds-navy: #1e3a8a;
    --ds-gold: #c99a06;
    --ds-gold-ink: #8a6a04;

    /* Tunda (kuning): mangkir */
    --ds-amber: #f59e0b;
    --ds-amber-soft: #fef3c7;
    --ds-amber-ink: #78350f;

    /* Tempat kontrol lain & jenis kelamin */
    --ds-info: #2563eb;
    --ds-violet: #7c3aed;
    --ds-male: #93c5fd;
    --ds-male-ink: #1d4ed8;

    /* Bentuk */
    --ds-radius-sm: 10px;
    --ds-radius: 14px;
    --ds-radius-md: 16px;
    --ds-radius-lg: 20px;
    --ds-radius-xl: 24px;
    --ds-radius-pill: 999px;

    /* Jarak */
    --ds-space-1: 4px;
    --ds-space-2: 8px;
    --ds-space-3: 12px;
    --ds-space-4: 16px;
    --ds-space-5: 20px;
    --ds-space-6: 24px;
    --ds-space-7: 28px;

    /* Ukuran huruf */
    --ds-text-xs: 12px;
    --ds-text-sm: 13px;
    --ds-text-md: 14px;
    --ds-text-base: 15px;
    --ds-text-lg: 18px;
    --ds-text-xl: 22px;
    --ds-text-2xl: 26px;
    --ds-text-3xl: 44px;

    --ds-touch: 44px;
    --ds-focus: 0 0 0 3px rgba(15, 118, 110, 0.35);
}

/* ------------------------------------------------------------------ */
/* Dasar halaman                                                       */
/* ------------------------------------------------------------------ */

.ds {
    font-family: var(--ds-font);
    color: var(--ds-ink);
    font-size: var(--ds-text-md);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

.ds-body {
    margin: 0;
    background: var(--ds-bg);
}

/* :where() supaya warna link bawaan tidak mengalahkan komponen yang berupa <a> (ds-alert, ds-btn, ...). */
:where(.ds) a {
    color: var(--ds-primary);
}

:where(.ds) a:hover {
    color: var(--ds-primary-strong);
}

.ds :focus-visible {
    outline: none;
    box-shadow: var(--ds-focus);
    border-radius: 6px;
}

.ds-page {
    max-width: 1240px;
    margin: 0 auto;
    padding: var(--ds-space-7) var(--ds-space-6) 64px;
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-7);
}

.ds-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;
}

/* ------------------------------------------------------------------ */
/* Judul & teks                                                        */
/* ------------------------------------------------------------------ */

.ds-eyebrow {
    font-size: var(--ds-text-sm);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ds-primary);
}

.ds-h1 {
    margin: 0;
    font-size: var(--ds-text-3xl);
    line-height: 1.12;
    font-weight: 800;
}

.ds-h2 {
    margin: 0;
    font-size: var(--ds-text-2xl);
    line-height: 1.2;
    font-weight: 800;
}

.ds-h3 {
    margin: 0;
    font-size: var(--ds-text-lg);
    line-height: 1.3;
    font-weight: 800;
}

.ds-text-muted {
    color: var(--ds-muted);
}

.ds-note {
    margin: 0;
    font-size: var(--ds-text-sm);
    line-height: 1.55;
    color: var(--ds-muted);
}

/* Angka yang belum tersedia dari sistem. */
.ds-placeholder {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--ds-track);
    color: var(--ds-ink-2);
    font-weight: 700;
}

/* ------------------------------------------------------------------ */
/* Tata letak                                                          */
/* ------------------------------------------------------------------ */

.ds-section {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-4);
}

.ds-section__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--ds-space-3);
}

.ds-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(var(--ds-cols, 2), minmax(0, 1fr));
}

.ds-grid--2 { --ds-cols: 2; }
.ds-grid--3 { --ds-cols: 3; }
.ds-grid--4 { --ds-cols: 4; }

.ds-stack {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
}

.ds-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ds-space-2);
}

/* ------------------------------------------------------------------ */
/* Kartu                                                               */
/* ------------------------------------------------------------------ */

.ds-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius-lg);
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
    min-width: 0;
}

.ds-card--lg {
    border-radius: var(--ds-radius-xl);
    padding: var(--ds-space-7);
}

.ds-card--dark {
    background: var(--ds-primary-deep);
    border-color: var(--ds-primary-deep);
    color: #ffffff;
}

.ds-card--dark .ds-eyebrow,
.ds-card--dark .ds-card__label {
    color: var(--ds-primary-200);
}

.ds-card--dark .ds-note {
    color: var(--ds-primary-100);
}

.ds-card--soft {
    background: var(--ds-primary-soft);
    border-color: transparent;
}

.ds-card--warn {
    background: var(--ds-warn-soft);
    border-color: var(--ds-warn-200);
}

.ds-card__label {
    font-size: var(--ds-text-md);
    font-weight: 700;
    color: var(--ds-primary);
}

/* Kartu pembuka (hero) di beranda. */
.ds-hero {
    background: var(--ds-primary-deep);
    color: #ffffff;
    border-radius: var(--ds-radius-xl);
    padding: 40px 40px 36px;
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start; /* teks rata atas; ruang kosong boleh di bawah (masukan 25 Okt) */
    justify-content: space-between;
}

.ds-hero__main {
    flex: 999 1 520px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ds-hero .ds-eyebrow {
    color: var(--ds-primary-200);
}

.ds-hero__lead {
    margin: 0;
    font-size: 17px;
    line-height: 1.6;
    color: var(--ds-primary-100);
    max-width: 640px;
}

.ds-hero__stats {
    flex: 1 1 280px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ds-space-3);
}

.ds-hero__stat {
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-4);
}

.ds-hero__stat-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
}

.ds-hero__stat-label {
    font-size: var(--ds-text-sm);
    color: var(--ds-primary-100);
}

.ds-hero__meta {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-2);
    font-size: var(--ds-text-md);
    color: var(--ds-primary-100);
}

.ds-hero__meta::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ds-primary-300);
    flex: none;
}

/* ------------------------------------------------------------------ */
/* Angka                                                               */
/* ------------------------------------------------------------------ */

.ds-stat__value {
    font-size: 52px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.ds-stat__value--md {
    font-size: 40px;
}

.ds-stat__unit {
    font-size: 20px;
    font-weight: 700;
    color: var(--ds-muted);
}

.ds-stat__desc {
    margin: 0;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ds-ink-2);
}

/* Perbandingan dengan bulan lalu. */
.ds-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--ds-radius-pill);
    font-size: var(--ds-text-xs);
    font-weight: 700;
    background: var(--ds-track);
    color: var(--ds-muted);
    white-space: nowrap;
}

.ds-delta--good {
    background: var(--ds-primary-soft);
    color: var(--ds-primary-strong);
}

.ds-delta--bad {
    background: var(--ds-warn-soft);
    color: var(--ds-warn-ink);
}

.ds-delta--on-dark {
    background: rgba(255, 255, 255, 0.14);
    color: var(--ds-primary-100);
}

/* ------------------------------------------------------------------ */
/* Badge                                                               */
/* ------------------------------------------------------------------ */

.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--ds-radius-pill);
    font-size: var(--ds-text-xs);
    font-weight: 700;
    line-height: 1.3;
    background: var(--ds-track);
    color: var(--ds-ink-2);
    white-space: nowrap;
}

.ds-badge--ok { background: var(--ds-primary-100); color: var(--ds-primary-strong); }
.ds-badge--warn { background: var(--ds-warn-100); color: var(--ds-warn-ink); }
.ds-badge--amber { background: var(--ds-amber-soft); color: var(--ds-amber-ink); }
.ds-badge--crisis { background: var(--ds-crisis); color: #ffffff; }
.ds-badge--info { background: #dbeafe; color: var(--ds-male-ink); }
.ds-badge--sample { background: rgba(255, 255, 255, 0.12); color: var(--ds-primary-100); }

/* Titik warna untuk legenda. */
.ds-swatch {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex: none;
    background: var(--ds-swatch, var(--ds-neutral));
}

/* ------------------------------------------------------------------ */
/* Tombol & form                                                       */
/* ------------------------------------------------------------------ */

.ds-btn {
    font: inherit;
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 700;
    min-height: var(--ds-touch);
    padding: 10px 16px;
    border-radius: var(--ds-radius-pill);
    border: 1px solid var(--ds-line-strong);
    background: var(--ds-surface);
    color: var(--ds-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    text-decoration: none;
    cursor: pointer;
}

.ds-btn:hover {
    border-color: var(--ds-neutral);
}

.ds-btn--primary {
    background: var(--ds-primary);
    border-color: var(--ds-primary);
    color: #ffffff;
}

.ds-btn--primary:hover {
    background: var(--ds-primary-strong);
    border-color: var(--ds-primary-strong);
    color: #ffffff;
}

.ds-btn--warn {
    background: var(--ds-warn);
    border-color: var(--ds-warn);
    color: #ffffff;
}

.ds-btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ds-primary);
    padding-left: 0;
    padding-right: 0;
}

.ds-btn--block {
    width: 100%;
    border-radius: var(--ds-radius);
    font-size: var(--ds-text-base);
    padding: 14px;
}

.ds-btn--icon {
    width: var(--ds-touch);
    padding: 0;
    border-radius: var(--ds-radius-sm);
}

.ds-btn[disabled],
.ds-btn[aria-disabled="true"] {
    background: var(--ds-neutral);
    border-color: var(--ds-neutral);
    color: #ffffff;
    cursor: not-allowed;
}

/* Pilihan (tombol filter / pilihan hasil kunjungan). */
.ds-choice {
    font: inherit;
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 600;
    min-height: var(--ds-touch);
    padding: 12px 14px;
    border-radius: var(--ds-radius-sm);
    border: 2px solid var(--ds-line);
    background: var(--ds-surface);
    color: var(--ds-ink);
    text-align: left;
    cursor: pointer;
}

.ds-choice[aria-pressed="true"],
.ds-choice.is-selected {
    border-color: var(--ds-primary);
    background: var(--ds-primary-soft);
}

.ds-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--ds-text-sm);
    font-weight: 700;
    color: var(--ds-ink-2);
}

.ds-input,
.ds-select,
.ds-textarea {
    font: inherit;
    font-family: var(--ds-font);
    font-size: var(--ds-text-md);
    font-weight: 400;
    min-height: var(--ds-touch);
    padding: 10px 12px;
    border-radius: var(--ds-radius-sm);
    border: 1px solid var(--ds-line-strong);
    background: var(--ds-surface);
    color: var(--ds-ink);
    width: 100%;
}

.ds-textarea {
    resize: vertical;
}

/* ------------------------------------------------------------------ */
/* Batang & baris angka                                                */
/* ------------------------------------------------------------------ */

.ds-bar {
    display: block;
    height: 12px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-track);
    overflow: hidden;
}

.ds-bar__fill {
    display: block;
    height: 100%;
    width: var(--ds-value, 0%);
    border-radius: inherit;
    background: var(--ds-bar-color, var(--ds-primary));
}

/* Batang bertumpuk (mis. 1 obat / 2 obat / 3+ obat). */
.ds-bar--stacked {
    display: flex;
    height: 18px;
}

.ds-bar--stacked > span {
    display: block;
    flex: none;
    height: 100%;
    width: var(--ds-value, 0%);
    background: var(--ds-bar-color, var(--ds-primary));
}

/* Baris: label | batang | angka | (perbandingan). Pakai <a> kalau bisa diklik. */
.ds-barrow {
    display: grid;
    grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) 56px;
    align-items: center;
    gap: var(--ds-space-3);
    font-size: var(--ds-text-md);
    color: var(--ds-ink);
    text-decoration: none;
}

.ds-barrow--delta {
    grid-template-columns: minmax(120px, 170px) minmax(0, 1fr) 56px 64px;
}

.ds-barrow__value {
    text-align: right;
    font-weight: 800;
}

a.ds-barrow,
button.ds-barrow {
    font: inherit;
    background: none;
    border: 0;
    padding: 4px 0;
    text-align: left;
    cursor: pointer;
    color: var(--ds-ink);
}

a.ds-barrow .ds-barrow__label,
button.ds-barrow .ds-barrow__label {
    text-decoration: underline;
    text-decoration-color: var(--ds-line-strong);
    text-underline-offset: 3px;
}

a.ds-barrow:hover .ds-barrow__label,
button.ds-barrow:hover .ds-barrow__label {
    text-decoration-color: var(--ds-primary);
}

/* Donat (tensi saat ini): --ds-a = persen hijau, --ds-b = persen hijau + oranye. */
.ds-donut {
    --ds-size: 190px;
    width: var(--ds-size);
    height: var(--ds-size);
    border-radius: 50%;
    flex: none;
    background: conic-gradient(
        var(--ds-outcome-ok) 0 var(--ds-a, 0%),
        var(--ds-outcome-high) var(--ds-a, 0%) var(--ds-b, 0%),
        var(--ds-line-strong) var(--ds-b, 0%) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-donut__hole {
    width: 64%;
    height: 64%;
    border-radius: 50%;
    background: var(--ds-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ds-donut__value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
}

.ds-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: var(--ds-text-md);
}

.ds-legend__item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ds-legend__item > span:nth-child(2) {
    flex: 1;
}

/* ------------------------------------------------------------------ */
/* Pesan & penjelasan                                                  */
/* ------------------------------------------------------------------ */

/* "Apa artinya?" pakai <details class="ds-info"><summary>Apa artinya?</summary><p>...</p></details> */
.ds-info {
    font-size: var(--ds-text-md);
    color: var(--ds-ink-2);
}

.ds-info > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--ds-text-sm);
    font-weight: 700;
    color: var(--ds-primary);
    padding: 4px 10px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-primary-mint);
}

.ds-info > summary::-webkit-details-marker {
    display: none;
}

.ds-info > summary::before {
    content: "?";
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    font-size: 10px;
    line-height: 12px;
    text-align: center;
}

.ds-info > p {
    margin: 8px 0 0;
    padding: 12px 14px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-primary-soft);
    line-height: 1.55;
}

.ds-callout {
    margin: 0;
    padding: 14px;
    border-radius: var(--ds-radius);
    font-size: var(--ds-text-md);
    line-height: 1.55;
    background: var(--ds-primary-soft);
    color: var(--ds-primary-ink);
}

.ds-callout--warn {
    background: var(--ds-warn-soft);
    color: var(--ds-crisis);
}

/* Pita bahaya (tensi >= 180/110). */
.ds-alert {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 24px;
    border-radius: var(--ds-radius-lg);
    background: var(--ds-crisis);
    color: #ffffff;
    text-decoration: none;
}

a.ds-alert:hover {
    color: #ffffff;
}

.ds-alert__kicker {
    font-size: var(--ds-text-md);
    font-weight: 700;
    color: var(--ds-warn-200);
}

.ds-alert__value {
    font-size: 20px;
    font-weight: 800;
}

.ds-alert__action {
    font-size: var(--ds-text-md);
    font-weight: 700;
    padding: 10px 16px;
    border-radius: var(--ds-radius-pill);
    background: #ffffff;
    color: var(--ds-crisis);
}

/* "Perlu perhatian bulan ini": daftar bernomor. */
.ds-attention {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    counter-reset: ds-attention;
}

.ds-attention > li {
    counter-increment: ds-attention;
    display: flex;
    gap: var(--ds-space-3);
    padding: var(--ds-space-4);
    border-radius: var(--ds-radius-md);
    background: var(--ds-warn-soft);
    font-size: var(--ds-text-base);
    line-height: 1.5;
}

.ds-attention > li::before {
    content: counter(ds-attention);
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ds-warn);
    color: #ffffff;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-attention > li.is-good {
    background: var(--ds-primary-soft);
}

.ds-attention > li.is-good::before {
    background: var(--ds-primary);
}

/* ------------------------------------------------------------------ */
/* Tabel                                                               */
/* ------------------------------------------------------------------ */

.ds-table-wrap {
    overflow-x: auto;
}

.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ds-text-md);
}

.ds-table th {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--ds-line);
    color: var(--ds-muted);
    font-size: var(--ds-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.ds-table td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--ds-track);
    vertical-align: middle;
}

.ds-table .is-num {
    text-align: right;
}

.ds-table__sub {
    display: block;
    font-size: var(--ds-text-xs);
    color: var(--ds-muted);
}

/* ------------------------------------------------------------------ */
/* Panel samping (daftar pasien dari angka yang diklik)                */
/* ------------------------------------------------------------------ */

.ds-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    justify-content: flex-end;
    z-index: 1000;
}

.ds-backdrop[hidden] {
    display: none;
}

.ds-drawer {
    width: 560px;
    max-width: 100%;
    height: 100%;
    background: var(--ds-surface);
    overflow-y: auto;
    padding: var(--ds-space-6);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-4);
}

.ds-drawer__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ds-space-3);
}

/* ------------------------------------------------------------------ */
/* Tampilan HP                                                         */
/* ------------------------------------------------------------------ */

.ds-list-item {
    font: inherit;
    font-family: var(--ds-font);
    width: 100%;
    text-align: left;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius);
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--ds-space-2);
    color: var(--ds-ink);
    text-decoration: none;
    cursor: pointer;
}

.ds-list-item__title {
    font-size: var(--ds-text-base);
    font-weight: 700;
}

.ds-list-item__sub {
    display: block;
    font-size: var(--ds-text-xs);
    color: var(--ds-muted);
}

.ds-bottom-nav {
    position: sticky;
    bottom: 0;
    background: var(--ds-surface);
    border-top: 1px solid var(--ds-line);
    display: grid;
    grid-template-columns: repeat(var(--ds-nav-items, 4), minmax(0, 1fr));
    z-index: 50;
}

.ds-bottom-nav__item {
    font: inherit;
    font-family: var(--ds-font);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 0 14px;
    border: 0;
    background: none;
    color: var(--ds-muted);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.ds-bottom-nav__item[aria-current="page"] {
    color: var(--ds-primary);
    font-weight: 700;
}

.ds-bottom-nav__item svg {
    width: 22px;
    height: 22px;
}

/* ------------------------------------------------------------------ */
/* Layar kecil                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 1080px) {
    .ds-grid--4 { --ds-cols: 2; }
    .ds-attention { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .ds-grid--2,
    .ds-grid--3 { --ds-cols: 1; }
    .ds-hero { padding: var(--ds-space-6); }
    .ds-h1 { font-size: 30px; }
    .ds-stat__value { font-size: 42px; }
}

@media (max-width: 560px) {
    .ds-page { padding: var(--ds-space-4) var(--ds-space-4) 48px; gap: var(--ds-space-5); }
    .ds-grid--4 { --ds-cols: 1; }
    .ds-h1 { font-size: 24px; }
    .ds-h2 { font-size: 20px; }
    .ds-card { padding: var(--ds-space-4); }
    .ds-hero { padding: var(--ds-space-5); border-radius: var(--ds-radius-lg); }
    .ds-barrow,
    .ds-barrow--delta { grid-template-columns: minmax(0, 1fr) 52px; }
    .ds-barrow .ds-bar { grid-column: 1 / -1; grid-row: 2; }
    .ds-barrow--delta .ds-delta { display: none; }
    .ds-donut { --ds-size: 140px; }
    .ds-donut__value { font-size: 22px; }
    .ds-drawer { padding: var(--ds-space-4); }
}

@media (prefers-reduced-motion: reduce) {
    .ds *,
    .ds *::before,
    .ds *::after {
        transition: none !important;
        animation: none !important;
    }
}

.ds-card--dark .ds-stat__unit {
    color: rgba(255, 255, 255, 0.78);
}
