/* DivyUp e-Reporting
   Teal untuk struktur, oranye hanya untuk hal yang menuntut tindakan.
   Kanvas gading, kartu putih bertepi tipis, radius 12 untuk panel besar.
   Angka besar memakai Newsreader; teks antarmuka Plus Jakarta Sans. */

:root {
    --teal: #0E7C7B;
    --teal-dark: #0A5F5E;
    --teal-soft: #E4F1F0;
    --teal-line: #BCDCDA;
    --orange: #E4732B;
    --orange-soft: #FBEBDF;
    --orange-ink: #A33F0C;
    --ink: #16233A;
    --ink-muted: #56637A;
    --ink-faint: #8A93A5;
    --canvas: #F6F6F3;
    --surface: #FFFFFF;
    --line: #E6E7E1;
    --line-soft: #EFF0EA;
    --line-strong: #CFD2CA;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --sans: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    --serif: "Newsreader", Georgia, serif;
    --rail-w: 236px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }

a { color: var(--teal-dark); }

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Tombol ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 9px 15px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }

.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink-muted); background: #FCFCFA; }

.btn-danger { background: var(--orange); color: #fff; }
.btn-danger:hover { background: #C95F1C; }

.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 13px; }

/* ---------- Form ---------- */

.form { display: grid; gap: 16px; }

.field { display: grid; gap: 6px; min-width: 0; }

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
}

.field textarea { min-height: 96px; resize: vertical; }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--ink-faint); }

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: var(--orange); }

.field input[type="file"] { padding: 8px 10px; font-size: 13px; }

.field-error {
    margin: 0;
    font-size: 13px;
    color: var(--orange-ink);
}

.field-hint {
    margin: 0;
    font-size: 13px;
    color: var(--ink-muted);
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--ink-muted);
}

.check input { width: 18px; height: 18px; accent-color: var(--teal); }

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 2px;
}

/* ---------- Login ---------- */

.auth-body {
    min-height: 100vh;
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 32px 20px;
    background:
        radial-gradient(1100px 380px at 50% -8%, rgba(14, 124, 123, .08), transparent 70%),
        var(--canvas);
}

.auth-shell { width: 100%; max-width: 428px; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 30px 26px;
    box-shadow: 0 1px 2px rgba(22, 35, 58, .04);
}

.wordmark {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .17em;
    color: var(--teal);
}

.auth-title {
    margin: 12px 0 4px;
    font-family: var(--serif);
    font-size: 27px;
    font-weight: 500;
    line-height: 1.22;
    letter-spacing: -0.01em;
}

.auth-sub {
    margin: 0 0 22px;
    font-size: 14px;
    color: var(--ink-muted);
}

.auth-foot {
    margin: 18px 0 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--ink-faint);
}

/* ---------- Kerangka aplikasi ---------- */

.app-body { background: var(--canvas); }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    padding: 8px 12px;
    background: var(--teal);
    color: #fff;
    z-index: 10;
}

.skip-link:focus { left: 8px; }

.app-shell {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    min-height: 100vh;
}

.rail {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 14px 18px;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.rail-top { display: grid; gap: 1px; padding: 0 8px; }

.wordmark-sub {
    font-size: 11.5px;
    letter-spacing: .04em;
    color: var(--ink-faint);
}

.rail-nav { display: grid; gap: 1px; }

/* Tombol menu hanya untuk layar kecil. */
.nav-toggle,
.nav-burger { display: none; }

.rail-label {
    margin: 14px 8px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.rail-nav .rail-label:first-child { margin-top: 0; }

.rail-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background-color .14s, color .14s;
}

.rail-link:hover { background: #F5F6F1; }

.rail-link[aria-current="page"] {
    background: var(--teal-soft);
    color: var(--teal-dark);
    font-weight: 600;
}

.rail-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
    color: var(--teal-dark);
    background: var(--surface);
    border: 1px solid var(--teal-line);
    border-radius: 20px;
}

.rail-link[aria-current="page"] .rail-badge {
    background: var(--surface);
    border-color: var(--teal);
}

.rail-note {
    margin: 4px 10px 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink-faint);
}

.rail-foot-note {
    margin: auto 0 0;
    padding: 12px 10px 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--ink-faint);
    border-top: 1px solid var(--line-soft);
}

.app-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    min-height: 58px;
}

.topbar-role {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar-user {
    display: grid;
    gap: 0;
    min-width: 0;
    text-align: right;
}

.topbar-name {
    font-size: 13.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-mail {
    font-size: 11.5px;
    color: var(--ink-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bell {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--ink-muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    transition: color .15s, border-color .15s;
}

.bell:hover { color: var(--ink); border-color: var(--line-strong); }

.bell-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    color: #fff;
    background: var(--orange);
    border-radius: 20px;
}

.app-main {
    min-width: 0;
    padding: 24px 24px 44px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-title {
    font-size: 23px;
    line-height: 1.25;
}

.page-sub {
    margin: 5px 0 0;
    font-size: 13.5px;
    color: var(--ink-muted);
}

/* ---------- Panel & tabel ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.panel-title {
    margin-bottom: 14px;
    font-size: 14.5px;
    font-weight: 600;
}

.panel-flush { padding: 0; overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th,
.table td {
    padding: 11px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line-soft);
}

.table th {
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    background: transparent;
    white-space: nowrap;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FBFCF8; }
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }

.nowrap { white-space: nowrap; }

.empty {
    margin: 0;
    padding: 20px 4px;
    font-size: 13.5px;
    color: var(--ink-muted);
}

.muted { color: var(--ink-muted); }

.flash {
    margin-bottom: 16px;
    padding: 10px 14px;
    font-size: 13.5px;
    color: var(--teal-dark);
    background: var(--teal-soft);
    border: 1px solid var(--teal-line);
    border-radius: var(--radius);
}

.flash-error {
    color: var(--orange-ink);
    background: var(--orange-soft);
    border-color: #F0C8AC;
}

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

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat {
    padding: 16px 18px 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.stat-label {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
}

.stat-value {
    margin: 10px 0 0;
    font-family: var(--serif);
    font-size: 32px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.01em;
}

.stat-note {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ink-faint);
}

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

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    transition: border-color .15s, transform .15s;
}

.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }

.card-kicker {
    margin: 0;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.card-title {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.35;
}

.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--teal-dark); text-decoration: underline; }

.meta-list {
    display: grid;
    gap: 7px;
    margin: 0;
    font-size: 13px;
}

.meta-list div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.meta-list dt { color: var(--ink-muted); }
.meta-list dd { margin: 0; text-align: right; font-weight: 600; }

.tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 20px;
    background: var(--teal-soft);
    color: var(--teal-dark);
}

.tag-warn { background: var(--orange-soft); color: var(--orange-ink); }

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

/* ---------- Timeline tahapan ---------- */

.timeline {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 12px;
    padding-bottom: 16px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: var(--surface);
}

.timeline-item:not(:last-child) .timeline-marker::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 18px;
    bottom: 0;
    width: 2px;
    background: var(--line-soft);
}

.timeline-item.is-done .timeline-marker { border-color: var(--teal); background: var(--teal); }
.timeline-item.is-active .timeline-marker { border-color: var(--orange); background: var(--orange-soft); }
.timeline-item.is-skipped .timeline-marker { border-color: var(--line-strong); background: var(--line); }

.timeline-stage { margin: 0; font-size: 14px; font-weight: 600; }
.timeline-item.is-todo .timeline-stage { color: var(--ink-muted); font-weight: 500; }

.timeline-state { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.timeline-item.is-active .timeline-state { color: var(--orange-ink); font-weight: 600; }

.timeline-note { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-muted); }

/* ---------- Baris tahap (tim) ---------- */

.stage-list { display: grid; gap: 4px; }

.stage-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.1fr) minmax(160px, 1fr) minmax(190px, 1.8fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}

.stage-row:last-child { border-bottom: 0; padding-bottom: 0; }

.stage-label { margin: 0; font-size: 13.5px; font-weight: 600; }
.stage-state { margin: 2px 0 0; font-size: 12px; color: var(--ink-muted); }

/* ---------- Daftar aset ---------- */

.asset-list { margin: 0; padding: 0; list-style: none; display: grid; }

.asset-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line-soft);
}

.asset-row:first-child { padding-top: 0; }
.asset-row:last-child { border-bottom: 0; padding-bottom: 0; }

.asset-main { min-width: 0; }

.asset-name {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.asset-meta { margin: 2px 0 0; font-size: 12px; color: var(--ink-faint); }

.asset-note {
    margin: 6px 0 0;
    padding: 6px 10px;
    font-size: 12.5px;
    color: var(--orange-ink);
    background: var(--orange-soft);
    border-radius: var(--radius-sm);
}

.asset-side {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input[type="file"] { max-width: 190px; font-size: 12px; }

/* ---------- Galeri aset (portal) ---------- */

.asset-grid {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.asset-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}

.asset-preview {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: #F2F3EE;
    border-bottom: 1px solid var(--line);
}

.asset-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.file-ext {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--ink-faint);
}

.asset-card-body { display: grid; gap: 8px; padding: 15px; }
.asset-card-body .tag { justify-self: start; }
.asset-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.revision-form {
    gap: 8px;
    margin-top: 6px;
    padding-top: 11px;
    border-top: 1px dashed var(--line-strong);
}

.revision-form label { font-size: 13px; }
.revision-form textarea { min-height: 76px; }
.revision-form button { justify-self: start; }

/* ---------- Notifikasi ---------- */

.notif-list { margin: 0; padding: 0; list-style: none; display: grid; }

.notif-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
}

.notif-item:first-child { padding-top: 0; }
.notif-item:last-child { border-bottom: 0; padding-bottom: 0; }

.notif-item.is-unread .notif-title::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    vertical-align: middle;
    border-radius: 50%;
    background: var(--orange);
}

.notif-title { margin: 0; font-size: 13.5px; font-weight: 600; }
.notif-text { margin: 3px 0 0; font-size: 13px; color: var(--ink-muted); }
.notif-meta { margin: 5px 0 0; font-size: 11.5px; color: var(--ink-faint); }
.notif-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Filter bar ---------- */

.filter-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-row .field { max-width: 200px; }

/* ---------- Grafik ---------- */

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

.chart-row .panel { margin-bottom: 0; }

.chart-head { margin-bottom: 6px; }

.chart-head .panel-title { margin-bottom: 3px; }

.chart-note {
    margin: 0 0 14px;
    font-size: 12.5px;
    color: var(--ink-muted);
}

.chart-foot {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--ink-faint);
}

.bars {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 10px;
    align-items: end;
    height: 200px;
    padding-top: 18px;
}

.bar-col {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-items: center;
    gap: 6px;
    height: 100%;
    min-width: 0;
}

.bar-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}

.bar-track {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.bar-fill {
    width: min(100%, 44px);
    min-height: 6px;
    background: var(--teal);
    border-radius: 5px 5px 2px 2px;
    transition: height .2s;
}

.bar-col:hover .bar-fill { background: var(--teal-dark); }

.bar-label {
    font-size: 11.5px;
    color: var(--ink-muted);
    white-space: nowrap;
}

.pie-wrap {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.pie {
    position: relative;
    display: grid;
    place-items: center;
    width: 156px;
    height: 156px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.pie-hole {
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    background: var(--surface);
    border-radius: 50%;
}

.pie-total {
    font-family: var(--serif);
    font-size: 26px;
    line-height: 1;
}

.pie-total-label {
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.pie-legend {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 9px;
    font-size: 13px;
    min-width: 0;
}

.pie-legend li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 2px;
}

.legend-label { color: var(--ink-muted); overflow-wrap: anywhere; }
.legend-value { font-weight: 700; }
.legend-count { min-width: 20px; text-align: right; font-size: 12px; color: var(--ink-faint); }

/* ---------- Progres per proyek ---------- */

.progress-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }

.progress-item { display: grid; gap: 6px; }

.progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.progress-name {
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.progress-name a { color: var(--ink); text-decoration: none; }
.progress-name a:hover { color: var(--teal-dark); text-decoration: underline; }

.progress-client {
    display: block;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--ink-faint);
}

.progress-value {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

.progress-track {
    height: 8px;
    background: var(--line-soft);
    border-radius: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--teal);
    border-radius: 20px;
}

.progress-meta { margin: 0; font-size: 11.5px; color: var(--ink-faint); }

/* ---------- Sebaran per tahap ---------- */

.spread-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }

.spread-item { display: grid; gap: 5px; }

.spread-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
}

.spread-label { font-weight: 600; }
.spread-count { font-size: 12px; color: var(--ink-muted); }

.spread-track {
    height: 8px;
    background: var(--line-soft);
    border-radius: 20px;
    overflow: hidden;
}

.spread-fill {
    height: 100%;
    background: var(--orange);
    border-radius: 20px;
}

@media (max-width: 900px) {
    .chart-row { grid-template-columns: minmax(0, 1fr); }
    .bars { height: 170px; }
}

/* ---------- Responsif ---------- */

@media (max-width: 1000px) {
    .stage-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
    .stage-row .field:nth-of-type(2) { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
    }

    .rail {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 10px;
        padding: 10px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .rail-top { flex: 1 1 auto; padding: 0; }
    .wordmark-sub { display: none; }

    /* Tombol hamburger: kotak 44px, garis tiga digambar dengan CSS. */
    .nav-burger {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        margin-left: auto;
        border: 1px solid var(--line-strong);
        border-radius: var(--radius);
        background: var(--surface);
        cursor: pointer;
    }

    .nav-burger-lines,
    .nav-burger-lines::before,
    .nav-burger-lines::after {
        display: block;
        width: 18px;
        height: 2px;
        background: var(--ink);
        border-radius: 2px;
    }

    .nav-burger-lines { position: relative; }

    .nav-burger-lines::before,
    .nav-burger-lines::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .nav-burger-lines::before { top: -6px; }
    .nav-burger-lines::after { top: 6px; }

    /* Fokus keyboard terlihat pada tombol, bukan pada input tersembunyi. */
    .nav-toggle:focus-visible + .nav-burger {
        outline: 2px solid var(--teal);
        outline-offset: 2px;
    }

    /* Nav tersembunyi sampai tombol ditekan. */
    .rail-nav { display: none; }
    .nav-toggle:checked ~ .rail-nav {
        display: flex;
        flex-wrap: wrap;
        flex: 1 0 100%;
        order: 3;
        gap: 2px;
        margin: 0 -4px;
        padding-top: 4px;
        border-top: 1px solid var(--line-soft);
    }

    .nav-toggle:checked + .nav-burger {
        background: var(--teal-soft);
        border-color: var(--teal-line);
    }
    .rail-label, .rail-foot-note, .rail-note { display: none; }
    .rail-link {
        padding: 8px 10px;
        white-space: nowrap;
        border-radius: var(--radius);
    }
    .rail-badge { min-width: 18px; }

    .topbar { padding: 8px 14px; min-height: 52px; }
    .topbar-role { display: none; }
    .topbar-mail { display: none; }
    .topbar-right { margin-left: auto; }

    .app-main { padding: 18px 14px 36px; }
    .page-title { font-size: 20px; }
    .panel { padding: 16px; }
    .stat-value { font-size: 27px; }
}

@media (max-width: 640px) {
    .field-row { grid-template-columns: minmax(0, 1fr); }
    .stage-row { grid-template-columns: minmax(0, 1fr); padding: 14px 0; }
    .asset-row { flex-direction: column; }
    .asset-side { justify-content: flex-start; }
    .notif-item { flex-direction: column; }
    .notif-actions { justify-content: flex-start; }
    .auth-card { padding: 22px 18px; }
    .auth-title { font-size: 23px; }

    /* Tabel jadi kartu bertumpuk; label kolom dibawa tiap sel. */
    .table,
    .table thead,
    .table tbody,
    .table tr,
    .table td { display: block; width: 100%; }

    .table thead { display: none; }

    .table tr {
        padding: 12px 14px;
        border-bottom: 1px solid var(--line);
    }

    .table tr:last-child { border-bottom: 0; }

    .table td {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 10px;
        padding: 3px 0;
        border: 0;
        font-size: 13.5px;
        overflow-wrap: anywhere;
    }

    .table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--ink-faint);
        padding-top: 2px;
    }

    .table td.cell-title {
        grid-template-columns: minmax(0, 1fr);
        font-size: 15px;
        font-weight: 600;
        padding-bottom: 6px;
    }

    .table td.cell-title::before { display: none; }

    .table td.cell-action {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 10px;
    }

    .table td.cell-action::before { display: none; }
    .table td.cell-action .btn { width: 100%; }

    /* Label status tidak ikut melebar mengisi kolom. */
    .table td .tag { justify-self: start; }

    .bars { height: 150px; gap: 6px; }
    .pie { width: 132px; height: 132px; }
    .pie-hole { width: 82px; height: 82px; }

    .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 13px 14px; }
    .stat-value { font-size: 24px; }
    .stat-note { font-size: 11.5px; }

    .page-head { gap: 10px; }
    .page-head .btn { width: 100%; }
    .filter-row .field { max-width: none; }
    .form-actions { width: 100%; }
    .form-actions .btn { flex: 1 1 auto; }
}
