:root {
    --brand: #dc2626;
    --brand-dark: #991b1b;
    --brand-soft: #fee2e2;
    --navy: #0f172a;
    --navy-2: #16213b;
    --ink: #1e293b;
    --muted: #64748b;
    --bg: #f3f5fa;
    --card: #ffffff;
    --border: #e4e9f2;
    --success: #0f9d58;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 16px;
    --sidebar-w: 264px;
    --shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body.app-body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
    min-height: 100vh;
}

a { text-decoration: none; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #111c34 0%, #0b1220 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    z-index: 1040;
    transition: transform .25s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    padding: 4px 8px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 18px;
}

.brand:hover { color: #fff; }

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(135deg, #ef4444, #991b1b);
    display: grid;
    place-items: center;
    font-size: 21px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(220, 38, 38, .35);
    flex: 0 0 auto;
}

.brand strong { display: block; font-size: 17px; letter-spacing: .2px; }
.brand small { color: #94a3b8; font-size: 11.5px; }

.sidebar-label {
    font-size: 10.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #64748b;
    padding: 0 12px;
    margin: 10px 0 8px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    border-radius: 10px;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: background .15s ease, color .15s ease;
}

.sidebar-nav a i { font-size: 17px; width: 20px; text-align: center; color: #94a3b8; }

.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a:hover i { color: #fff; }

.sidebar-nav a.aktif {
    background: linear-gradient(90deg, rgba(220, 38, 38, .22), rgba(220, 38, 38, .04));
    color: #fff;
    border-left-color: #ef4444;
}

.sidebar-nav a.aktif i { color: #fca5a5; }

.sidebar-foot {
    margin-top: auto;
    padding: 16px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #64748b;
    font-size: 11.5px;
}

.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.app-topbar h1 { font-size: 19px; font-weight: 700; margin: 0; }
.app-topbar .crumb { font-size: 12px; color: var(--muted); margin-top: 1px; }

.btn-sidebar {
    display: none;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    font-size: 18px;
    color: var(--ink);
}

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px 10px 6px 6px;
    color: var(--ink);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 13px;
}

.topbar-user .nama { font-weight: 600; font-size: 13px; line-height: 1.15; }
.topbar-user .peran { font-size: 11px; color: var(--muted); text-transform: capitalize; }

.app-content { padding: 26px 28px 48px; max-width: 1320px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-head p { color: var(--muted); margin: 0; max-width: 680px; }

.kartu {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.kartu-body { padding: 22px; }
.kartu-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kartu-head h3 { font-size: 15.5px; font-weight: 700; margin: 0; }
.kartu-head small { color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
}
.stat .ikon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: #eef2f7; color: #334155; flex: 0 0 auto; }
.stat .ikon.merah { background: #fee2e2; color: #b91c1c; }
.stat .ikon.hijau { background: #dcfce7; color: #15803d; }
.stat .ikon.biru { background: #dbeafe; color: #1d4ed8; }
.stat .ikon.amber { background: #fef3c7; color: #b45309; }
.stat .nilai { font-size: 21px; font-weight: 700; line-height: 1.1; }
.stat .label { font-size: 12px; color: var(--muted); }

.score-ring {
    --val: 0;
    --ring: var(--brand);
    width: 156px;
    height: 156px;
    border-radius: 50%;
    background: conic-gradient(var(--ring) calc(var(--val) * 1%), #eef1f7 0);
    display: grid;
    place-items: center;
    position: relative;
}
.score-ring::before { content: ""; position: absolute; inset: 11px; background: #fff; border-radius: 50%; }
.score-ring > div { position: relative; text-align: center; }
.score-ring .angka { font-size: 36px; font-weight: 800; line-height: 1; }
.score-ring .satuan { font-size: 12px; color: var(--muted); }
.score-ring.sm { width: 112px; height: 112px; }
.score-ring.sm::before { inset: 8px; }
.score-ring.sm .angka { font-size: 26px; }

.badge-skor { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-skor.baik { background: #dcfce7; color: #166534; }
.badge-skor.cukup { background: #dbeafe; color: #1e40af; }
.badge-skor.perbaikan { background: #fef3c7; color: #92400e; }
.badge-skor.kurang { background: #fee2e2; color: #991b1b; }

.tren { font-size: 12px; font-weight: 600; }
.tren.naik { color: var(--success); }
.tren.turun { color: var(--danger); }
.tren.datar { color: var(--muted); }

.btn { border-radius: 10px; font-weight: 600; font-size: 13.5px; }
.btn-brand { background: linear-gradient(135deg, #dc2626, #b91c1c); border: none; color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: linear-gradient(135deg, #b91c1c, #7f1d1d); color: #fff; }
.btn-outline-brand { border: 1px solid #fca5a5; color: var(--brand-dark); background: #fff; }
.btn-outline-brand:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-sm { font-size: 12.5px; padding: 5px 10px; border-radius: 8px; }

.form-control, .form-select { border-radius: 10px; border-color: #d7dfea; font-size: 14px; padding: 9px 12px; }
.form-control:focus, .form-select:focus { border-color: #f87171; box-shadow: 0 0 0 3px rgba(248, 113, 113, .15); }
.form-label { font-size: 12.5px; font-weight: 600; color: #475569; margin-bottom: 5px; }

.table { font-size: 13.5px; vertical-align: middle; }
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; border-bottom-color: var(--border); }
.table > :not(caption) > * > * { padding: 11px 12px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 38px; color: #cbd5e1; display: block; margin-bottom: 10px; }

.alert { border-radius: 12px; font-size: 13.5px; border: none; }
.alert-success { background: #e8f8ee; color: #166534; }
.alert-danger { background: #fdeaea; color: #991b1b; }
.alert-warning { background: #fff6e5; color: #92400e; }
.alert-info { background: #e9f1ff; color: #1e40af; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: #f1f5f9; border-radius: 999px; padding: 5px 12px; font-size: 12px; color: #475569; font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.dot.hijau { background: #22c55e; }
.dot.merah { background: #ef4444; }
.dot.amber { background: #f59e0b; }

.progress { height: 8px; border-radius: 999px; background: #eef1f7; }
.progress-bar { background: linear-gradient(90deg, #ef4444, #b91c1c); border-radius: 999px; }

.video-wrap { position: relative; background: #0b1220; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-wrap video.mirror { transform: scaleX(-1); }
.video-wrap canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.video-hint { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #cbd5e1; padding: 24px; }
.video-hint i { font-size: 46px; display: block; margin-bottom: 12px; color: #64748b; }
.video-hint strong { display: block; font-size: 16px; margin-bottom: 4px; color: #e2e8f0; }
.video-badge { position: absolute; top: 12px; left: 12px; background: rgba(15, 23, 42, .72); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; backdrop-filter: blur(6px); }
.video-badge.live { background: rgba(220, 38, 38, .88); }
.video-score { position: absolute; top: 12px; right: 12px; background: rgba(15, 23, 42, .72); color: #fff; padding: 8px 14px; border-radius: 12px; font-size: 12px; text-align: right; }
.video-score b { display: block; font-size: 22px; line-height: 1; }

.countdown {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .55);
    color: #fff;
    font-size: 96px;
    font-weight: 900;
    letter-spacing: -2px;
    text-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    backdrop-filter: blur(2px);
}

.segmen { display: inline-flex; background: #eef2f7; border-radius: 12px; padding: 4px; gap: 4px; }
.segmen button { border: none; background: transparent; padding: 8px 18px; border-radius: 9px; font-size: 13px; font-weight: 600; color: #64748b; }
.segmen button.aktif { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(15, 23, 42, .08); }

.timeline-bar { display: flex; align-items: flex-end; gap: 1px; height: 96px; padding: 8px; background: #f8fafc; border-radius: 12px; border: 1px solid var(--border); }
.timeline-bar span { flex: 1; min-width: 2px; border-radius: 2px 2px 0 0; background: var(--brand); opacity: .85; }

.rekomendasi-list { display: flex; flex-direction: column; gap: 10px; }
.rekomendasi { display: flex; gap: 12px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.rekomendasi .num { width: 28px; height: 28px; border-radius: 9px; background: #fee2e2; color: #b91c1c; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.rekomendasi strong { font-size: 13.5px; }
.rekomendasi p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.hasil-ringkas { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.hasil-inti { flex: 1 1 280px; min-width: 220px; }
.hasil-stat { display: flex; flex-wrap: wrap; gap: 6px 26px; margin-top: 10px; }
.hasil-stat div { display: flex; flex-direction: column; }
.hasil-stat span { font-size: 11.5px; color: var(--muted); }
.hasil-stat b { font-size: 14px; font-weight: 700; }
.hasil-chart { position: relative; height: 104px; }

.temuan-ringkas { border: 1px solid var(--border); border-radius: 12px; padding: 2px 14px; background: #fff; }
.temuan { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed #e8edf5; }
.temuan:last-child { border-bottom: none; }
.temuan .persen { flex: 0 0 auto; min-width: 46px; text-align: center; padding: 2px 7px; border-radius: 999px; background: #fee2e2; color: #b91c1c; font-size: 12px; font-weight: 700; }
.temuan > div { min-width: 0; }
.temuan .judul { display: block; font-size: 13px; font-weight: 600; }
.temuan .saran { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rekomendasi-ringkas { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.rekomendasi-ringkas li { padding-left: 2px; }
.rekomendasi-ringkas li::marker { color: var(--brand); font-weight: 700; }

@media (max-width: 575.98px) {
    .hasil-ringkas { gap: 14px; }
    .hasil-inti { flex-basis: 100%; }
    .hasil-stat { gap: 4px 20px; }
    .temuan .saran { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

.metric-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed #e8edf5; font-size: 13px; }
.metric-item:last-child { border-bottom: none; }
.metric-item .label { color: var(--muted); }
.metric-item .value { font-weight: 600; }

.profil-hero { display: flex; align-items: center; gap: 16px; }
.profil-hero .avatar { width: 58px; height: 58px; font-size: 20px; border-radius: 16px; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--bg); }
.login-visual {
    position: relative;
    background: radial-gradient(circle at 20% 20%, #7f1d1d 0%, #0f172a 55%, #060b16 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.login-visual::before, .login-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .09);
}
.login-visual::before { width: 620px; height: 620px; right: -260px; bottom: -260px; }
.login-visual::after { width: 380px; height: 380px; right: -120px; bottom: -120px; }
.login-visual h2 { font-size: 34px; font-weight: 800; line-height: 1.2; margin: auto 0 14px; max-width: 460px; }
.login-visual p { color: #94a3b8; max-width: 440px; line-height: 1.7; }
.login-visual .fitur { display: flex; flex-direction: column; gap: 14px; margin-top: 30px; }
.login-visual .fitur div { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #cbd5e1; }
.login-visual .fitur i { color: #f87171; font-size: 18px; }
.login-form-wrap { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 420px; }
.login-card h1 { font-size: 25px; font-weight: 800; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; font-size: 13.5px; }
.login-card .brand { color: var(--ink); border: none; padding: 0; margin-bottom: 30px; }
.login-card .brand small { color: var(--muted); }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1030; }

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 991px) {
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.buka { transform: translateX(0); }
    .sidebar-backdrop.tampil { display: block; }
    .app-main { margin-left: 0; }
    .btn-sidebar { display: grid; place-items: center; }
    .app-content { padding: 20px 16px 40px; }
    .app-topbar { padding: 12px 16px; }
    .topbar-user .teks { display: none; }
}

@media (max-width: 576px) {
    .stat-grid { grid-template-columns: 1fr; }
    .score-ring { width: 132px; height: 132px; }
    .app-topbar h1 { font-size: 16px; }
    .page-head h2 { font-size: 19px; }
    .kartu-body { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
