/* ==========================================================
   ASA — Design System
   Palet: indigo tenang & teal sebagai aksen ketenangan/psikologis,
   dipasangkan dengan serif hangat (Fraunces) untuk judul supaya
   terasa manusiawi—bukan dashboard SaaS generik—dan Inter untuk
   antarmuka/form supaya tetap sangat mudah dibaca di layar kecil.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Warna */
    --bg: #F6F7FB;
    --surface: #FFFFFF;
    --surface-muted: #EEF0F8;
    --border: #E2E4EE;
    --border-strong: #C7CBE0;

    --indigo-900: #1E1B4B;
    --indigo-700: #2E2A78;
    --indigo-600: #3730A3;
    --indigo-500: #4F46C7;
    --indigo-100: #E4E2F9;

    --teal-600: #0F766E;
    --teal-100: #D9F1EE;

    --amber-600: #B45309;
    --amber-100: #FDECD1;

    --rose-600: #B91C1C;
    --rose-100: #FBE1E1;

    --text: #1E1B4B;
    --text-muted: #55597A;
    --text-faint: #8A8EB0;

    /* Tipografi */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;

    /* Layout */
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-card: 0 1px 2px rgba(30, 27, 75, 0.06);
    --max-width: 880px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
}

h1, h2, h3 {
    font-family: var(--font-display);
    color: var(--indigo-900);
    line-height: 1.25;
    margin: 0 0 0.4em;
    font-weight: 500;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; color: var(--text-muted); }

a { color: var(--indigo-600); }

:focus-visible {
    outline: 2px solid var(--indigo-500);
    outline-offset: 2px;
}

/* ---------- Layout dasar ---------- */
.wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 20px 80px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.stack > * + * { margin-top: 16px; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    line-height: 1.2;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--indigo-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--indigo-700); }

.btn-secondary { background: var(--surface); color: var(--indigo-600); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-muted); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-muted); }

.btn-danger { background: var(--rose-600); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ---------- Form ---------- */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

input[type="text"], input[type="date"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--indigo-500);
    outline: none;
    box-shadow: 0 0 0 3px var(--indigo-100);
}

.field { margin-bottom: 18px; }
.field-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 4px; }
.field-error { font-size: 0.78rem; color: var(--rose-600); margin-top: 4px; display: none; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 620px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Skala Likert (1-5) ---------- */
.likert {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.likert input { position: absolute; opacity: 0; pointer-events: none; }
.likert label {
    flex: 1;
    min-width: 44px;
    text-align: center;
    padding: 10px 6px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    margin: 0;
    transition: all 0.12s ease;
    user-select: none;
}
.likert input:checked + label {
    background: var(--indigo-600);
    border-color: var(--indigo-600);
    color: #fff;
}
.likert-caption {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-faint);
    margin-top: 4px;
}

/* ---------- Badge ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
}
.badge-teal { background: var(--teal-100); color: var(--teal-600); }
.badge-amber { background: var(--amber-100); color: var(--amber-600); }
.badge-rose { background: var(--rose-100); color: var(--rose-600); }
.badge-indigo { background: var(--indigo-100); color: var(--indigo-600); }

/* ---------- Tabel ---------- */
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 12px 10px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}
th { color: var(--text-faint); font-weight: 600; font-size: 0.76rem; text-transform: none; }
tbody tr:hover { background: var(--surface-muted); }

/* ---------- Progress bar (halaman tes) ---------- */
.progress-track {
    position: sticky;
    top: 0;
    height: 4px;
    background: var(--border);
    z-index: 10;
}
.progress-fill {
    height: 100%;
    background: var(--indigo-600);
    width: 0%;
    transition: width 0.25s ease;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--indigo-900);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 90vw;
    text-align: center;
    z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.error { background: var(--rose-600); }

/* ---------- Dashboard shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--indigo-900);
    color: #fff;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}
.sidebar .brand { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 28px; padding: 0 8px; }
.sidebar .brand span { display: block; font-family: var(--font-body); font-size: 0.7rem; color: #A5A9D6; font-weight: 600; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #C7C9EA;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 2px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar .bottom { margin-top: auto; }

.main { flex: 1; min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.content { padding: 28px 32px 80px; max-width: 1080px; }

@media (max-width: 780px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; }
    .sidebar .brand { display: none; }
    .sidebar .bottom { margin-top: 0; margin-left: auto; }
    .content { padding: 20px; }
    .topbar { padding: 14px 20px; }
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-faint);
}

.saldo-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--indigo-100);
    color: var(--indigo-700);
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
}
