/* Dashboard Monitoring Kualitas Air — tata letak admin */
:root {
    --accent: #3563E9;
    --accent-hover: #2A50C7;
    --accent-soft: #EAF0FE;
    --bg: #F5F6FA;
    --surface: #FFFFFF;
    --line: #E8EAF0;
    --line-soft: #EEF0F5;
    --input-line: #DDE1EA;
    --text: #202224;
    --text-2: #3B4250;
    --muted: #5E6573;
    --ok: #16A36F;
    --ok-text: #0A6B4A;
    --ok-strong: #0A7350;
    --ok-bg: #DDF6EC;
    --bad: #E5484D;
    --bad-text: #A51E25;
    --bad-strong: #C0262D;
    --bad-bg: #FDE4E5;
    --warn: #E39A0A;
    --warn-text: #7A3E00;
    --warn-bg: #FFF1D6;
    --shadow-card: 0 6px 24px rgba(31, 41, 72, 0.05);
    --shadow-bad: 0 0 0 2px var(--bad), 0 6px 24px rgba(229, 72, 77, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    background: var(--bg);
    font-family: 'Nunito Sans', system-ui, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
    outline: 3px solid rgba(53, 99, 233, 0.45);
    outline-offset: 2px;
}

/* ---------- Animasi ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes viewOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-6px); } }
.spin { animation: spin .9s linear infinite; transform-origin: 50% 50%; }
.pop, .toast { animation: popIn .2s cubic-bezier(.2, .8, .2, 1) both; }
.overlay { animation: fadeIn .16s ease-out both; }
.dialog { animation: dlgIn .2s cubic-bezier(.2, .8, .2, 1) both; }
.tooltip { animation: fadeIn .12s ease-out both; }
.view-in { animation: viewIn .26s cubic-bezier(.2, .8, .2, 1) both; }
.view-out { animation: viewOut .12s ease-in both; pointer-events: none; }
.btn { transition: transform .1s ease-out, background-color .15s ease-out, box-shadow .15s ease-out; }
.btn:active:not(:disabled) { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
    .pop, .toast, .dialog, .view-in { animation-name: fadeIn; }
    .view-out { animation-name: fadeOut; }
    .spin { animation-duration: 2.4s; }
    .btn:active:not(:disabled) { transform: none; }
}

/* ---------- Tombol umum ---------- */
.btn-primary {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px;
    background: var(--accent); color: #FFFFFF;
    font-size: 15px; font-weight: 700; cursor: pointer;
    box-shadow: 0 6px 14px rgba(53, 99, 233, 0.25);
}
.btn-primary:disabled { cursor: not-allowed; opacity: .45; }
.btn-primary[aria-busy="true"] { cursor: progress; opacity: 1; }
.btn-primary.sm { min-height: 44px; padding: 0 16px; font-size: 14px; box-shadow: none; }
.btn-primary.xs { min-height: 36px; margin-top: 10px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 800; box-shadow: none; }
.btn-outline {
    min-height: 44px; padding: 0 18px;
    border: 1px solid var(--input-line); border-radius: 10px;
    background: #FFFFFF; color: var(--text);
    font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-outline:disabled { opacity: .45; cursor: not-allowed; }
.btn-outline.sm { min-height: 40px; padding: 0 16px; }
.btn-soft {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 18px; border-radius: 10px;
    background: var(--accent-soft); color: var(--accent);
    font-size: 14px; font-weight: 800; text-decoration: none;
}
.btn-soft:hover { color: var(--accent-hover); background: #DFE8FD; }
.link-btn {
    min-height: 32px; padding: 0 4px; border: 0; background: transparent;
    font-size: 13px; font-weight: 700; color: var(--accent); cursor: pointer;
}
.icon-btn {
    width: 44px; height: 44px; border: 0; border-radius: 10px;
    background: transparent; color: var(--text); cursor: pointer;
    display: flex; align-items: center; justify-content: center; position: relative;
}
.icon-btn:hover { background: #F1F4FD; }
.icon-btn.bell { color: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 12px 24px; position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; width: 200px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--accent); color: #FFFFFF;
    display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.search { flex: 1 1 260px; max-width: 420px; position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.search input {
    width: 100%; height: 44px; padding: 0 16px 0 42px;
    border: 1px solid var(--input-line); border-radius: 999px;
    background: var(--bg); font-size: 15px; color: var(--text);
}
.spacer { flex: 1 1 0; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.chip {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 34px; padding: 0 12px; border-radius: 999px;
    font-size: 14px; font-weight: 700;
}
.chip-off { background: #EEF0F5; color: var(--text-2); }
.chip-online { background: var(--ok-bg); color: var(--ok-strong); }
.chip-offline { background: var(--bad-bg); color: var(--bad-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.dot-ring { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #8A91A0; }
.diamond { width: 8px; height: 8px; background: var(--bad); transform: rotate(45deg); flex: 0 0 auto; }
.notif { position: relative; }
.notif-count {
    position: absolute; top: 4px; right: 3px;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--bad); color: #FFFFFF; font-size: 11px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px #FFFFFF;
}
.popover {
    position: absolute; right: 0; top: 52px;
    width: 360px; max-width: calc(100vw - 32px);
    background: #FFFFFF; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 16px 40px rgba(31, 41, 72, 0.14); overflow: hidden;
}
.popover-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.popover-title { font-size: 16px; font-weight: 800; }
.notif-item {
    width: 100%; display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 18px; border: 0; border-bottom: 1px solid #F1F2F6;
    background: #FFFFFF; text-align: left; cursor: pointer;
}
.notif-item.unread { background: #F7F9FE; }
.notif-item:hover { background: #F1F4FD; }
.notif-icon {
    width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; color: #FFFFFF;
}
.notif-icon.ok { background: var(--ok); }
.notif-icon.warn { background: var(--warn); }
.notif-icon.bad { background: var(--bad); }
.notif-title { display: block; font-size: 14px; font-weight: 700; color: var(--text); }
.notif-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.popover-foot {
    display: block; padding: 12px 18px; text-align: center;
    font-size: 14px; font-weight: 700; color: var(--muted); text-decoration: none;
}
.popover-foot:hover { color: var(--text); background: #F7F9FE; }
.user { display: flex; align-items: center; gap: 10px; padding-left: 6px; border-left: 1px solid var(--line); }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    font-size: 14px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
}
.user-name { display: block; font-size: 14px; font-weight: 700; line-height: 1.2; }
.user-role { display: block; font-size: 12px; color: var(--muted); line-height: 1.2; }

/* ---------- Layout & sidebar ---------- */
.layout { display: flex; flex-wrap: wrap; align-items: stretch; }
.sidebar {
    flex: 1 0 240px; max-width: 100%;
    background: #FFFFFF; border-right: 1px solid var(--line);
    padding: 20px 16px; display: flex; flex-direction: column; gap: 4px;
}
.nav-wrap { position: relative; }
.nav-indicator {
    position: absolute; left: -16px; top: 0; bottom: 0; width: 4px;
    border-radius: 0 4px 4px 0; background: var(--accent);
}
.nav {
    display: flex; align-items: center; gap: 14px;
    min-height: 48px; padding: 0 16px; border-radius: 8px;
    text-decoration: none; font-size: 15px; font-weight: 700; color: var(--text);
    transition: background-color .15s ease-out, color .15s ease-out;
}
.nav:hover { background: #F1F4FD; color: var(--text); }
.nav.active, .nav.active:hover { background: var(--accent); color: #FFFFFF; }
.nav-label { flex: 1 1 auto; }
.nav-badge {
    min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
    font-size: 12px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bad-bg); color: var(--bad-text);
}
.nav.active .nav-badge { background: #FFFFFF; color: var(--accent); }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0 12px; }
.side-heading {
    padding: 0 16px; font-size: 12px; font-weight: 800;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.device-box {
    margin-top: 10px; padding: 14px 16px; border-radius: 12px; background: var(--bg);
    display: flex; flex-direction: column; gap: 8px; font-size: 14px;
}
.kv { display: flex; justify-content: space-between; gap: 8px; }
.kv > span { color: var(--muted); }
.t-ok { color: var(--ok-strong); }
.t-bad { color: var(--bad-strong); }
.t-dim { color: var(--muted); }
.t-plain { color: var(--text-2); }

.content {
    flex: 999 1 560px; min-width: 0;
    padding: 28px clamp(16px, 2.5vw, 32px) 48px;
    display: flex; flex-direction: column; gap: 24px;
}

/* ---------- Header halaman ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; color: var(--muted); }
.breadcrumb a { color: var(--muted); font-weight: 700; text-decoration: none; padding: 4px 0; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current] { color: var(--text); font-weight: 700; }
.page-title { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.01em; outline: none; }
.page-sub { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.sync-info { font-size: 14px; color: var(--muted); }
.sync-info strong { color: var(--text); }
.power-box {
    display: inline-flex; align-items: center; gap: 4px;
    min-height: 44px; padding: 0 12px 0 14px; border-radius: 10px;
    background: #FFFFFF; box-shadow: 0 2px 10px rgba(31, 41, 72, 0.06);
}
.power-title { font-size: 14px; font-weight: 700; color: var(--text-2); }
.switch {
    position: relative; width: 58px; height: 44px; padding: 0;
    border: 0; background: transparent; flex: 0 0 auto; cursor: pointer;
}
.switch:disabled { cursor: not-allowed; opacity: .5; }
.switch[aria-busy="true"] { cursor: progress; opacity: 1; }
.switch .track {
    position: absolute; left: 3px; top: 8px; width: 52px; height: 28px;
    border-radius: 999px; background: #9AA1AE; transition: background-color .22s ease-out;
}
.switch .knob {
    position: absolute; left: 6px; top: 11px; width: 22px; height: 22px;
    border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(31, 41, 72, 0.3);
    display: flex; align-items: center; justify-content: center;
    transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.switch.on .track { background: var(--ok); }
.switch.on .knob { transform: translateX(24px); }
.power-label { min-width: 98px; font-size: 14px; font-weight: 700; }

/* ---------- Banner ---------- */
.banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
    border-radius: 12px; padding: 14px 18px;
}
.banner-warn { background: #FFF6E5; border: 1px solid #F3D18A; color: #6B3B00; }
.banner-plain { background: #FFFFFF; border: 1px solid var(--input-line); }
.banner-icon {
    width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
}
.banner-warn .banner-icon { background: #FFE7B8; color: #8A4B00; }
.banner-plain .banner-icon { background: #EEF0F5; color: var(--text-2); }
.banner-body { flex: 1 1 340px; min-width: 0; }
.banner-title { font-size: 15px; font-weight: 700; }
.banner-text { font-size: 13px; margin-top: 2px; }
.banner-plain .banner-text { color: var(--muted); }
.btn-warn {
    min-height: 44px; padding: 0 16px;
    border: 1px solid #D9A441; border-radius: 10px;
    background: #FFFFFF; color: #6B3B00;
    font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-warn:disabled { opacity: .5; cursor: progress; }

/* ---------- Kartu ---------- */
.view { display: flex; flex-direction: column; gap: 24px; }
.card { background: #FFFFFF; border-radius: 16px; box-shadow: var(--shadow-card); }
.card.is-bad { box-shadow: var(--shadow-bad); }

.status { padding: 24px 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; }
.status-main { display: flex; align-items: center; gap: 20px; flex: 1 1 380px; min-width: 0; }
.status-icon {
    width: 72px; height: 72px; border-radius: 22px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: var(--ok-bg); color: var(--ok-strong);
}
.status.is-bad .status-icon { background: var(--bad-bg); color: var(--bad-strong); }
.status-eyebrow { font-size: 14px; font-weight: 700; color: var(--muted); }
.status-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.status-label { font-size: 48px; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; color: var(--ok-strong); }
.status.is-bad .status-label { color: var(--bad-strong); }
.status-summary { font-size: 18px; font-weight: 600; }
.status-meta { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* KPI sensor */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.kpi { padding: 18px 18px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.kpi-name { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-2); }
.kpi-value { display: flex; align-items: baseline; gap: 6px; margin-top: 10px; }
.kpi-num { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi.is-bad .kpi-num { color: var(--bad-strong); }
.kpi-unit { font-size: 16px; font-weight: 700; color: var(--muted); }
.tile {
    width: 56px; height: 56px; border-radius: 18px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
}
.tile-ph { background: #ECEBFF; color: #6C63FF; }
.tile-tds { background: #FFF3D6; color: #E6A700; }
.tile-kekeruhan { background: #DDF6EC; color: #1FA774; }
.tile-suhu { background: #FFE7DC; color: #F2784B; }
.tile-bad { background: var(--bad-bg); color: var(--bad); }
.kpi-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 6px; font-size: 13px; font-weight: 700;
}
.tag-ok { background: var(--ok-bg); color: var(--ok-text); }
.tag-bad { background: var(--bad-bg); color: var(--bad-text); }
.tag.lg { gap: 6px; padding: 5px 12px; font-weight: 800; }
.tag.xl { gap: 6px; padding: 6px 12px; font-size: 14px; font-weight: 800; }
.kpi-range { font-size: 13px; color: var(--muted); }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.kpi-delta strong { font-weight: 800; }
.spark { position: relative; width: 88px; height: 30px; flex: 0 0 auto; }
.spark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.spark-dot { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; }

/* Grafik */
.chart-card { padding: 24px 28px 18px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.section-title { margin: 0; font-size: 22px; font-weight: 800; }
.section-title.sm { font-size: 20px; }
.section-sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.select-wrap { position: relative; }
.select-wrap select {
    appearance: none; -webkit-appearance: none;
    min-height: 40px; padding: 0 38px 0 14px;
    border: 1px solid var(--input-line); border-radius: 8px;
    background: #FCFDFE; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer;
}
.select-wrap svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.segmented { display: flex; padding: 3px; gap: 2px; background: #F1F3F8; border-radius: 9px; }
.seg {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 36px; padding: 0 12px; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted);
    font-size: 13px; font-weight: 700; cursor: pointer;
    transition: background-color .18s ease-out, color .18s ease-out, box-shadow .18s ease-out;
}
.seg[aria-pressed="true"] { background: #FFFFFF; color: var(--text); box-shadow: 0 1px 3px rgba(31, 41, 72, 0.14); }
.seg.lg { min-height: 38px; padding: 0 14px; font-size: 14px; }
.seg-count {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    font-size: 12px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    background: #E3E6EE; color: var(--text-2);
}
.seg[aria-pressed="true"] .seg-count { background: var(--accent); color: #FFFFFF; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0 6px; font-size: 13px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.lg-band { width: 20px; height: 12px; border-radius: 3px; background: rgba(22, 163, 111, 0.14); border: 1px dashed var(--ok); }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.lg-dot.warn { background: var(--warn); }
.lg-diamond { width: 9px; height: 9px; background: var(--bad); transform: rotate(45deg); }
.charts { display: grid; gap: 8px 28px; grid-template-columns: repeat(1, minmax(0, 1fr)); }
.charts.all { grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.chart { padding-top: 18px; }
.chart-head {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
    gap: 4px 12px; margin: 0 0 22px 52px;
}
.chart-title { margin: 0; font-size: 15px; font-weight: 700; }
.chart-range { font-size: 13px; color: var(--muted); }
.chart-row { display: flex; gap: 8px; }
.y-axis { position: relative; width: 44px; flex: 0 0 44px; }
.y-tick { position: absolute; right: 6px; transform: translateY(-50%); font-size: 12px; color: var(--muted); }
.plot { position: relative; flex: 1 1 auto; min-width: 0; }
.gridline { position: absolute; left: 0; right: 0; height: 1px; background: var(--line-soft); }
.band {
    position: absolute; left: 0; right: 0;
    background: rgba(22, 163, 111, 0.08);
    border-top: 1px dashed rgba(22, 163, 111, 0.6);
    border-bottom: 1px dashed rgba(22, 163, 111, 0.6);
}
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pt-label {
    position: absolute; transform: translate(-50%, -32px);
    font-size: 12px; font-weight: 800; white-space: nowrap; pointer-events: none; color: var(--text-2);
}
.pt-label.warn { color: var(--warn-text); }
.pt-label.bad { color: var(--bad-strong); }
.pt {
    position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
    border: 0; border-radius: 50%; background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.pt-dot {
    display: block; width: 12px; height: 12px; border-radius: 50%;
    border: 2.5px solid #FFFFFF; background: var(--accent); box-shadow: 0 0 0 1.5px var(--accent);
}
.pt-dot.warn { background: var(--warn); box-shadow: 0 0 0 1.5px var(--warn); }
.pt-diamond {
    display: block; width: 11px; height: 11px; background: var(--bad);
    border: 2px solid #FFFFFF; box-shadow: 0 0 0 1.5px var(--bad); transform: rotate(45deg);
}
.tooltip {
    position: absolute; z-index: 5; min-width: 190px;
    background: var(--accent); color: #FFFFFF; border-radius: 8px; padding: 10px 12px;
    box-shadow: 0 10px 24px rgba(53, 99, 233, 0.3); pointer-events: none;
}
.tooltip-head { font-size: 12px; font-weight: 700; opacity: .92; }
.tooltip-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 6px; }
.tooltip-row span:first-child { font-size: 13px; }
.tooltip-row span:last-child { font-size: 18px; font-weight: 800; }
.tooltip-status {
    display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 5px;
    background: #FFFFFF; font-size: 12px; font-weight: 800;
}
.lv-ok { color: var(--ok-text); }
.lv-warn { color: var(--warn-text); }
.lv-bad { color: var(--bad-text); }
.x-gutter { width: 44px; flex: 0 0 44px; }
.x-axis { position: relative; flex: 1 1 auto; min-width: 0; height: 32px; }
.x-label {
    position: absolute; top: 10px; transform: translateX(-50%);
    font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
}

/* Ajakan evaluasi */
.cta { padding: 18px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.cta-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.cta-title { font-size: 17px; font-weight: 800; }
.cta-stat { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.cta-stat.ok { color: var(--ok-text); }
.cta-stat.bad { color: var(--bad-text); }

/* ---------- Evaluasi ---------- */
.eval { padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; }
.stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden;
}
.stat { padding: 14px 18px; }
.stat + .stat { border-left: 1px solid var(--line-soft); }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-label.ok { color: var(--ok-text); font-weight: 700; }
.stat-label.bad { color: var(--bad-text); font-weight: 700; }
.stat-num { font-size: 26px; font-weight: 800; margin-top: 2px; }
.stat-bar { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.bar { flex: 1 1 auto; height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.search-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--text-2); }
.search-note .link-btn { font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; }
.table { width: 100%; min-width: 1000px; border-collapse: collapse; font-size: 14px; }
.table thead tr { background: var(--bg); text-align: left; }
.table th { padding: 14px 16px; font-size: 13px; font-weight: 800; }
.table th:first-child { padding-left: 18px; }
.table .num { text-align: right; }
.table tbody tr { border-top: 1px solid var(--line-soft); cursor: pointer; transition: background-color .12s ease-out; }
.table tbody tr:hover { background: #F7F9FE; }
.table td { padding: 10px 16px; }
.table td:first-child { padding-left: 18px; }
.row-btn {
    border: 0; background: transparent; padding: 0; min-height: 40px;
    font-size: 14px; font-weight: 800; color: var(--text); cursor: pointer;
}
.cell-date { white-space: nowrap; color: var(--text-2); }
.cell-date span { color: var(--muted); }
.cell { display: inline-block; padding: 3px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; color: var(--text); }
.cell.warn { color: var(--warn-text); background: var(--warn-bg); font-weight: 800; }
.cell.bad { color: var(--bad-text); background: var(--bad-bg); font-weight: 800; }
.cell-eval { color: var(--text-2); line-height: 1.45; min-width: 260px; }
.empty { padding: 32px 20px; text-align: center; border-top: 1px solid var(--line-soft); }
.empty-title { font-size: 16px; font-weight: 800; }
.empty-text { font-size: 14px; color: var(--muted); margin-top: 4px; }
.empty .btn-outline { margin-top: 14px; }
.footnote { margin: 0; font-size: 13px; color: var(--muted); }
.key { font-weight: 800; padding: 2px 6px; border-radius: 5px; }
.key.bad { color: var(--bad-text); background: var(--bad-bg); }
.key.warn { color: var(--warn-text); background: var(--warn-bg); }
.no-data { padding: 40px 28px; text-align: center; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 84px; right: 24px; z-index: 60; width: 370px; max-width: calc(100% - 48px); }
.toast {
    display: flex; align-items: flex-start; gap: 12px;
    background: #FFFFFF; border: 1px solid var(--line); border-radius: 14px;
    padding: 14px 12px 14px 14px; box-shadow: 0 16px 40px rgba(31, 41, 72, 0.16);
}
.toast.err { background: var(--bad-strong); border-color: var(--bad-strong); color: #FFFFFF; box-shadow: 0 16px 40px rgba(31, 41, 72, 0.18); }
.toast-icon {
    width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; color: #FFFFFF;
}
.toast-icon.ok { background: var(--ok); }
.toast-icon.info { background: var(--text-2); }
.toast-icon.err { background: rgba(255, 255, 255, 0.2); }
.toast-body { flex: 1 1 auto; min-width: 0; }
.toast-title { font-size: 15px; font-weight: 800; }
.toast-msg { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.toast.err .toast-msg { color: #FFE3E4; }
.toast-close {
    width: 32px; height: 32px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); cursor: pointer; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
}
.toast.err .toast-close { color: #FFFFFF; }
.btn-retry {
    margin-top: 10px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 8px;
    background: #FFFFFF; color: var(--bad-strong); font-size: 13px; font-weight: 800; cursor: pointer;
}

/* ---------- Dialog detail ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 70; background: rgba(32, 34, 36, 0.45);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dialog {
    background: #FFFFFF; border-radius: 18px; width: 620px; max-width: 100%;
    max-height: calc(100vh - 48px); overflow: auto; outline: none;
    box-shadow: 0 24px 56px rgba(31, 41, 72, 0.24);
}
.dialog-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
    padding: 22px 26px 16px; border-bottom: 1px solid var(--line-soft);
}
.dialog-eyebrow { font-size: 13px; font-weight: 700; color: var(--muted); }
.dialog-title { margin: 4px 0 0; font-size: 24px; font-weight: 800; }
.dialog-head-right { display: flex; align-items: center; gap: 12px; }
.btn-close {
    width: 44px; height: 44px; border: 1px solid var(--input-line); border-radius: 10px;
    background: #FFFFFF; color: var(--text); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.detail-grid { padding: 18px 26px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-item { border-radius: 12px; padding: 14px 16px; background: #FFFFFF; border: 1px solid var(--line-soft); }
.detail-item.bad { background: #FFF5F5; border: 1.5px solid #F4A9AC; }
.detail-item-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.detail-name { font-size: 14px; font-weight: 700; color: var(--text-2); }
.detail-status { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 5px; }
.detail-status.ok { background: var(--ok-bg); color: var(--ok-text); }
.detail-status.warn { background: var(--warn-bg); color: var(--warn-text); }
.detail-status.bad { background: var(--bad-bg); color: var(--bad-text); }
.detail-val { font-size: 26px; font-weight: 800; margin-top: 6px; }
.detail-item.bad .detail-val { color: var(--bad-strong); }
.detail-range { font-size: 13px; color: var(--muted); }
.detail-eval { margin: 0 26px; padding: 14px 16px; background: var(--bg); border-radius: 12px; }
.detail-eval-label { font-size: 13px; font-weight: 800; color: var(--muted); }
.detail-eval-text { font-size: 15px; margin-top: 4px; line-height: 1.5; }
.dialog-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 18px 26px 22px; }
.dialog-foot .pager { display: flex; gap: 8px; }
.dialog-foot .btn-outline { padding: 0 14px; }

@media (max-width: 560px) {
    .topbar { padding: 12px 16px; }
    .brand { width: auto; }
    .user-text { display: none; }
    .detail-grid { grid-template-columns: 1fr; }
    .status-label { font-size: 40px; }
}
