:root {
    --bg: #edf1f9;
    --panel: #ffffff;
    --ink: #0d1b36;
    --text: #1f2a44;
    --muted: #7b8ca8;
    --muted-2: #94a3b8;
    --line: #e6ebf4;
    --sidebar: #0d1b36;
    --sidebar-2: #10264a;
    --primary: #2563eb;
    --primary-2: #3b82f6;
    --primary-dark: #1d4ed8;
    --blue-soft: #eff4ff;
    --green: #059669;
    --green-soft: #d1fae5;
    --red: #ef4444;
    --red-soft: #fee2e2;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --pink: #f472b6;
    --violet: #7c3aed;
    --violet-soft: #ede9fe;
    --shadow: 0 16px 36px rgba(15, 23, 42, .08);
    --shadow-soft: 0 8px 22px rgba(15, 23, 42, .06);
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

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

.sidebar {
    background: linear-gradient(175deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #fff;
    padding: 26px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,.05);
}

.sidebar::-webkit-scrollbar,
.content::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.sidebar::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb { background: rgba(148,163,184,.45); border-radius: 99px; }

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 20px;
}
.brand-icon {
    width: 39px;
    height: 39px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 12px 26px rgba(37, 99, 235, .32);
}
.brand h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: -.03em;
    line-height: 1.1;
}
.brand p {
    margin: 4px 0 0;
    color: #7b9cc8;
    font-size: 11px;
    font-weight: 600;
}
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: 0 0 22px;
}
.filter-title {
    color: #7b9cc8;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 11px;
    font-weight: 900;
    margin-bottom: 14px;
}
.filter-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
}
label {
    display: block;
    color: #7b9cc8;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin: 14px 0 7px;
}
select,
button {
    width: 100%;
    border-radius: 11px;
    font: inherit;
}
select {
    border: 1px solid rgba(255,255,255,.08);
    background: #1a2d50;
    color: #d4e4f7;
    min-height: 38px;
    padding: 10px 13px;
    font-size: 12px;
    font-weight: 700;
    outline: none;
    transition: border .18s, box-shadow .18s, background .18s;
}
select:hover { border-color: rgba(96,165,250,.35); }
select:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.16); border-color: rgba(96,165,250,.65); }
button {
    border: 0;
    cursor: pointer;
    min-height: 42px;
    font-size: 13px;
    font-weight: 900;
    transition: transform .16s, opacity .16s, box-shadow .16s;
}
button:active { transform: scale(.985); }
.primary-btn,
button:not(.secondary) {
    margin-top: 16px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    box-shadow: 0 12px 25px rgba(37, 99, 235, .25);
}
button.secondary {
    margin-top: 9px;
    background: rgba(255,255,255,.03);
    color: #9bb6da;
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: none;
}
button:hover { opacity: .92; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.filter-note {
    margin-top: 16px;
    padding: 13px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.09);
    color: #d4e4f7;
    font-size: 11px;
    line-height: 1.55;
}
.filter-note b { color: #fff; }

.content {
    padding: 26px 26px 38px;
    overflow-y: auto;
    min-width: 0;
}
.compact-dashboard {
    max-width: 1480px;
}

.hero {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,.55);
}
.premium-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    background: linear-gradient(135deg, #0d1b36 0%, #173563 58%, #1e4d8c 100%);
    color: #fff;
    padding: 0;
    min-height: 178px;
}
.hero-left { padding: 30px 30px 28px; }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 7px 13px;
    border-radius: 999px;
    background: rgba(96,165,250,.18);
    border: 1px solid rgba(96,165,250,.28);
    color: #93c5fd;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 900;
}
.hero h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(24px, 3.2vw, 36px);
    line-height: 1.08;
    letter-spacing: -.045em;
    font-weight: 950;
    max-width: 780px;
}
.hero h2 span { color: #60a5fa; }
.hero-text { color: #d8e8ff; max-width: 760px; }
.formula-pill {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 20px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    font-size: 12px;
}
.formula-pill strong {
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 10px;
}
.formula-pill span { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #e7f0ff; font-weight: 800; }
.formula-pill em { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #6ee7b7; font-style: normal; font-weight: 900; }
.formula-pill em.warning { color: #fcd34d; }
.hero-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 22px;
    text-align: center;
    background: rgba(0,0,0,.20);
    border-left: 1px solid rgba(255,255,255,.08);
}
.hero-badge::before {
    content: "Kategori Tren";
    color: #93c5fd;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .15em;
    font-weight: 900;
    margin-bottom: 10px;
}
.hero-badge span {
    font-size: 25px;
    line-height: 1;
    font-weight: 950;
}
.hero-badge small {
    display: inline-flex;
    margin-top: 12px;
    padding: 7px 11px;
    color: #fcd34d;
    background: rgba(245,158,11,.18);
    border: 1px solid rgba(245,158,11,.28);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.formula-box {
    margin: 18px 0;
    border-radius: 15px;
    padding: 15px 17px;
    background: #fffbeb;
    border: 1px solid #facc15;
    color: #713f12;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    box-shadow: 0 6px 16px rgba(245, 158, 11, .06);
}
.formula-box strong { color: #0d1b36; }
.formula-box span { color: #0d1b36; font-weight: 850; }
.formula-box small { flex-basis: 100%; color: #92400e; font-size: 12px; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.kpi-card,
.panel,
.quality-card {
    background: var(--panel);
    border: 1px solid rgba(13, 27, 54, .06);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}
.kpi-card {
    position: relative;
    overflow: hidden;
    padding: 21px;
    min-height: 126px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.kpi-card .kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-weight: 950;
    margin-bottom: 9px;
}
.kpi-card .kpi-icon.blue { background: var(--blue-soft); color: var(--primary); }
.kpi-card .kpi-icon.red { background: var(--red-soft); color: var(--red); }
.kpi-card .kpi-icon.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-card span,
.quality-card span {
    color: #98a6ba;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .10em;
}
.kpi-card strong {
    display: block;
    color: var(--ink);
    font-size: 25px;
    font-weight: 950;
    letter-spacing: -.03em;
    margin-top: 6px;
}
.kpi-card small {
    color: #7e8ba1;
    font-size: 12px;
    margin-top: 7px;
}
.kpi-card.primary {
    background: linear-gradient(135deg, #1e3a6e 0%, #2563eb 100%);
    color: #fff;
    border: 0;
    box-shadow: 0 16px 30px rgba(37,99,235,.24);
}
.kpi-card.primary::after {
    content: "⌁";
    position: absolute;
    right: 22px;
    top: 16px;
    color: rgba(255,255,255,.10);
    font-size: 66px;
    font-weight: 950;
}
.kpi-card.primary span,
.kpi-card.primary small { color: #bfdbfe; }
.kpi-card.primary strong { color: #fff; }
.metric-delta.is-up { color: var(--green); }
.metric-delta.is-down { color: var(--red); }
.metric-delta.is-flat { color: #64748b; }

.panel-grid.two {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    margin-bottom: 18px;
}
.panel {
    padding: 20px;
    overflow: hidden;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 15px;
}
.panel-head h3,
.section-title-row h3 {
    margin: 0;
    color: var(--ink);
    font-size: 17px;
    font-weight: 950;
    letter-spacing: -.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-head p,
.section-title-row p {
    margin: 5px 0 0;
    color: #8a98af;
    font-size: 12px;
}
.title-icon {
    color: var(--primary);
    font-size: 16px;
}
.chart-panel { min-height: 365px; }
.chart-area {
    position: relative;
    width: 100%;
}
.trend-area { height: 300px; }
.component-area { height: 292px; }

.insight-panel { display: flex; flex-direction: column; gap: 12px; }
.classification {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.classification div {
    padding: 14px;
    border-radius: 14px;
    background: #f3f7ff;
    border: 1px solid #e3ebfb;
}
.classification .risk-box {
    background: #fff3bf;
    border-color: #fde68a;
}
.classification span {
    display: block;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 10px;
    font-weight: 900;
    margin-bottom: 3px;
}
.classification .risk-box span { color: var(--amber); }
.classification strong {
    color: var(--ink);
    font-size: 15px;
    font-weight: 950;
}
.insight {
    margin: 0;
    padding: 13px 14px;
    border-radius: 14px;
    background: #f8fafd;
    color: #52637c;
    font-size: 12px;
    line-height: 1.55;
}
.diagnosis-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.diagnosis-list li {
    position: relative;
    padding: 12px 13px 12px 28px;
    border-radius: 13px;
    background: #f8fafd;
    color: #52637c;
    font-size: 12px;
    line-height: 1.45;
}
.diagnosis-list li::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 17px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--primary);
}
.diagnosis-list li:nth-child(2)::before { background: var(--pink); }
.diagnosis-list li:nth-child(3)::before { background: var(--red); }
.diagnosis-list li:nth-child(4)::before { background: var(--amber); }

.read-flow {
    display: flex;
    flex-direction: column;
    gap: 11px;
}
.read-flow div {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: #eff4ff;
}
.read-flow div:nth-child(2) { background: var(--violet-soft); }
.read-flow div:nth-child(3) { background: var(--green-soft); }
.read-flow div:nth-child(4) { background: var(--amber-soft); }
.read-flow b {
    min-width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 950;
}
.read-flow div:nth-child(2) b { background: var(--violet); }
.read-flow div:nth-child(3) b { background: var(--green); }
.read-flow div:nth-child(4) b { background: var(--amber); }
.read-flow span {
    color: #33507a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}
.read-flow div:nth-child(2) span { color: #6d28d9; }
.read-flow div:nth-child(3) span { color: #047857; }
.read-flow div:nth-child(4) span { color: #b45309; }
.legend-box {
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #eef2f7;
}
.legend-title {
    display: block;
    color: #98a6ba;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 10px;
}
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.legend-grid span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #5b6b82;
    font-size: 12px;
    font-weight: 700;
}
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.amber { background: #f59e0b; }
.dot.violet { background: #6366f1; }

.quality-section { margin: 4px 0 18px; }
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 2px 12px;
}
.year-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    color: var(--primary);
    background: var(--blue-soft);
    font-size: 11px;
    font-weight: 950;
}
.quality-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.quality-card {
    padding: 17px;
    min-height: 122px;
}
.quality-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.quality-icon {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    font-weight: 950;
}
.quality-icon.good { background: var(--green-soft); color: var(--green); }
.quality-icon.warn { background: var(--amber-soft); color: var(--amber); }
.quality-icon.bad { background: var(--red-soft); color: var(--red); }
.quality-status {
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green) !important;
    font-size: 10px !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}
.quality-status.warn { background: var(--amber-soft); color: var(--amber) !important; }
.quality-status.bad { background: var(--red-soft); color: var(--red) !important; }
.quality-card strong {
    display: block;
    margin-top: 9px;
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 22px;
    font-weight: 950;
}
.quality-card small {
    display: block;
    margin-top: 8px;
    color: #8a98af;
    font-size: 12px;
}

.table-panel { padding: 0; margin-bottom: 18px; }
.table-head { padding: 18px 20px; border-bottom: 1px solid #eef2f7; margin-bottom: 0; }
.table-wrap {
    overflow-x: auto;
    border-radius: 0 0 18px 18px;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 980px;
}
thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafd;
    color: #93a0b4;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-size: 10px;
    font-weight: 950;
    text-align: left;
    padding: 14px 15px;
    border-bottom: 1px solid #e8edf5;
    white-space: nowrap;
}
tbody td {
    padding: 15px;
    border-bottom: 1px solid #edf1f7;
    color: #35425a;
    vertical-align: middle;
    line-height: 1.45;
}
tbody tr:nth-child(even) { background: #fafbfe; }
tbody tr:hover { background: rgba(37, 99, 235, .045); }
tbody td:first-child {
    color: var(--primary);
    font-weight: 950;
}
tbody td:nth-child(2),
tbody td:nth-child(5),
tbody td:nth-child(6),
tbody td:nth-child(7),
tbody td:nth-child(8) {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 800;
}
.diagnosis-text,
.compact-text { max-width: 310px; color: #52637c; }
.accuracy-stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
    white-space: nowrap;
}
.accuracy-stack span { color: #52637c; }
.accuracy-stack b { color: var(--ink); }
.delta,
.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 25px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 950;
    white-space: nowrap;
}
.delta.up { background: var(--green-soft); color: var(--green); }
.delta.up::before { content: "↗"; }
.delta.down { background: var(--red-soft); color: var(--red); }
.delta.down::before { content: "↘"; }
.delta.flat { background: #fef3c7; color: #b45309; }
.status.ok { background: var(--green-soft); color: var(--green); }
.status.ok::before { content: "✓"; }
.status.danger { background: var(--red-soft); color: var(--red); }
.status.danger::before { content: "⚠"; }
.status.warn { background: var(--amber-soft); color: var(--amber); }
.status.warn::before { content: "⏳"; }

.dashboard-footer {
    text-align: center;
    color: #98a6ba;
    font-size: 12px;
    padding: 2px 0 4px;
}
.loading {
    position: fixed;
    right: 26px;
    top: 26px;
    z-index: 999;
    padding: 14px 18px;
    border-radius: 18px;
    background: rgba(13, 27, 54, .94);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 18px 45px rgba(13, 27, 54, .22);
}
.hidden { display: none !important; }

@media (max-width: 1180px) {
    .app-shell { grid-template-columns: 230px minmax(0, 1fr); }
    .premium-hero { grid-template-columns: 1fr; }
    .hero-badge { border-left: 0; border-top: 1px solid rgba(255,255,255,.08); }
    .kpi-grid,
    .quality-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .panel-grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: relative; height: auto; }
    .content { padding: 18px; }
    .kpi-grid,
    .quality-grid { grid-template-columns: 1fr; }
    .hero-left { padding: 24px; }
    .hero h2 { font-size: 27px; }
}
