/* ==========================================================================
   Theme — shared design system
   Warm cream/terracotta palette, serif display, soft motion.
   Dipakai sebagai base untuk semua halaman aplikasi.
   ========================================================================== */

/* ===== Design tokens (neutral zinc + blue accent) ===== */
:root {
    --bg: #ffffff;            /* pure white — main background */
    --bg-subtle: #ffffff;     /* pure white — deeper recess */
    --surface: #ffffff;       /* card surface (sama, dibatasi border) */
    --surface-hover: #f5f5f5; /* hover lift */
    --border: #e4e4e7;        /* zinc-200 */
    --border-strong: #d4d4d8; /* zinc-300 */
    --text: #18181b;          /* zinc-900 */
    --text-muted: #52525b;    /* zinc-600 */
    --text-subtle: #a1a1aa;   /* zinc-400 */
    --accent: #2563eb;        /* blue-600 */
    --accent-hover: #1d4ed8;  /* blue-700 */
    --accent-soft: #dbeafe;   /* blue-100 */
    --accent-ring: rgba(37, 99, 235, 0.18);
    --danger: #dc2626;        /* red-600 */
    --danger-soft: #fee2e2;   /* red-100 */
    --warning: #d97706;       /* amber-600 */
    --warning-soft: #fef3c7;  /* amber-100 */
    --success: #16a34a;       /* green-600 */
    --success-soft: #dcfce7;  /* green-100 */
    --info: #0284c7;          /* sky-600 */
    --info-soft: #e0f2fe;     /* sky-100 */

    /* Data-type brand colors (PBB / BPHTB) — konsisten di chart, badge, dll */
    --pbb: #2563eb;           /* blue-600 */
    --pbb-soft: #dbeafe;      /* blue-100 */
    --bphtb: #059669;         /* emerald-600 */
    --bphtb-soft: #d1fae5;    /* emerald-100 */
    --purple: #7c3aed;        /* violet-600 */
    --purple-soft: #ede9fe;   /* violet-100 */
    --teal: #0d9488;          /* teal-600 */
    --teal-soft: #ccfbf1;     /* teal-100 */
    --shadow-sm: 0 1px 2px rgba(31, 30, 29, 0.04);
    --shadow-md: 0 4px 12px rgba(31, 30, 29, 0.06), 0 1px 2px rgba(31, 30, 29, 0.04);
    --shadow-lg: 0 12px 32px rgba(31, 30, 29, 0.08), 0 2px 4px rgba(31, 30, 29, 0.04);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --t-fast: 0.14s;
    --t-base: 0.2s;
    --t-slow: 0.35s;
    --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

[data-theme="dark"] {
    --bg: #000000;            /* pure black — main background */
    --bg-subtle: #000000;     /* pure black — deeper recess */
    --surface: #0a0a0a;       /* near-black, slightly lifted cards */
    --surface-hover: #161616; /* hover lift */
    --border: #1f1f1f;        /* subtle separation */
    --border-strong: #2a2a2a; /* stronger separation */
    --text: #ffffff;          /* pure white */
    --text-muted: #d4d4d8;    /* zinc-300 — lebih terang utk dark */
    --text-subtle: #a1a1aa;   /* zinc-400 — lebih terang utk dark */
    --accent: #3b82f6;        /* blue-500 (brighter for dark) */
    --accent-hover: #60a5fa;  /* blue-400 */
    --accent-soft: #1e2a4d;   /* muted dark blue */
    --accent-ring: rgba(59, 130, 246, 0.25);
    --danger: #f87171;        /* red-400 */
    --danger-soft: #2a1414;
    --warning: #fbbf24;       /* amber-400 */
    --warning-soft: #2a1f0a;
    --success: #4ade80;       /* green-400 */
    --success-soft: #0f2818;
    --info: #38bdf8;          /* sky-400 */
    --info-soft: #0f1e2e;

    /* Data-type brand colors (PBB / BPHTB) — varian dark */
    --pbb: #3b82f6;           /* blue-500 */
    --pbb-soft: #1e2a4d;
    --bphtb: #10b981;         /* emerald-500 */
    --bphtb-soft: #0f2818;
    --purple: #a78bfa;        /* violet-400 */
    --purple-soft: #2e1a47;
    --teal: #2dd4bf;          /* teal-400 */
    --teal-soft: #0f2820;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--t-slow) ease, color var(--t-base) ease;
}

/* Typography utility */
/* Display class (formerly serif — kept class name for backward compat) */
.serif {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.mono {
    font-family: ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* Decorative radial glow — opt-in via .has-glow on <body> */
body.has-glow::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
    background-image:
        radial-gradient(circle at 20% 10%, rgba(37, 99, 235, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(37, 99, 235, 0.05) 0%, transparent 50%);
}
[data-theme="dark"] body.has-glow::before {
    background-image:
        radial-gradient(circle at 20% 10%, rgba(59, 130, 246, 0.09) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
}

/* Links */
a { color: var(--accent); text-decoration: none; transition: color var(--t-base) ease; }
a:hover { color: var(--accent-hover); }

/* ===== Brand mark (logo square) ===== */
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 600; font-size: 15px;
    color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand-dot {
    width: 26px; height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    flex-shrink: 0;
}
.brand-dot::after {
    content: '';
    position: absolute; inset: 5px;
    border-radius: 4px;
    background: var(--bg);
    opacity: 0.9;
}
.brand-dot.lg { width: 44px; height: 44px; border-radius: 12px; }
.brand-dot.lg::after { inset: 8px; border-radius: 6px; }

/* ===== Nav (sticky top bar) ===== */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-link {
    padding: 8px 12px;
    font-size: 13.5px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--t-base) ease;
}
.nav-link:hover { color: var(--text); background: var(--surface-hover); }
.nav-link.active { color: var(--text); background: var(--surface-hover); }

/* ===== Theme toggle ===== */
.theme-toggle {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--t-base) ease;
    padding: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--border-strong); transform: translateY(-1px); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }

/* ===== Card ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all var(--t-slow) ease;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card.flat:hover { box-shadow: var(--shadow-sm); border-color: var(--border); }
.card h3 {
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}
.card .hint {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Form primitives ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field.row { flex-direction: row; justify-content: space-between; align-items: center; }

.label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}
.label .req { color: var(--accent); margin-left: 2px; }

.input, .textarea, .select {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: 0;
    transition: all var(--t-fast) ease;
}
[data-theme="dark"] .input,
[data-theme="dark"] .textarea,
[data-theme="dark"] .select { background: var(--bg-subtle); }
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-ring);
}
.input.error, .textarea.error, .select.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent);
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
.input-upper { text-transform: uppercase; }

.helper { font-size: 12px; color: var(--text-subtle); }
.helper.error { color: var(--danger); }

/* Input with leading icon */
.input-ic { position: relative; }
.input-ic .ic {
    position: absolute; left: 13px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle); pointer-events: none;
    width: 16px; height: 16px;
}
.input-ic .input { padding-left: 40px; }

/* Input with trailing action (e.g., eye toggle for password) */
.input-act { position: relative; }
.input-act .input { padding-right: 44px; }
.input-act .act {
    position: absolute; right: 8px; top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent;
    border: 0;
    color: var(--text-subtle);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--t-base) ease;
}
.input-act .act:hover { color: var(--accent); background: var(--surface-hover); }
.input-act .act svg { width: 16px; height: 16px; }

/* Input group with prefix/suffix */
.input-group {
    display: flex; align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    transition: all var(--t-fast) ease;
}
[data-theme="dark"] .input-group { background: var(--bg-subtle); }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.input-group .prefix,
.input-group .suffix {
    padding: 0 12px; display: flex; align-items: center;
    color: var(--text-muted); font-size: 14px;
    background: var(--bg-subtle);
}
.input-group .prefix { border-right: 1px solid var(--border); }
.input-group .suffix { border-left: 1px solid var(--border); }
.input-group .input { border: 0; border-radius: 0; box-shadow: none !important; background: transparent; }

/* Select (native, styled chevron) */
.select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'><path stroke='%239a948a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='m6 8 4 4 4-4'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: inherit; font-size: 14px; font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--t-base) ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Loading state (spinner) */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}
.btn-ghost.is-loading::after,
.btn-outline.is-loading::after {
    border-color: color-mix(in srgb, var(--text) 25%, transparent);
    border-top-color: var(--text);
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, black); color: #fff; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: color-mix(in srgb, var(--warning) 85%, black); color: #fff; transform: translateY(-1px); }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn svg { width: 15px; height: 15px; }

/* ===== Chips ===== */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--t-fast) ease;
    font-family: inherit;
}
.chip:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.chip.solid { background: var(--surface); border-color: var(--border); }
.chip svg { width: 15px; height: 15px; }

/* ===== Toggle switch ===== */
.switch {
    --w: 40px; --h: 22px;
    position: relative; display: inline-block;
    width: var(--w); height: var(--h);
    flex-shrink: 0;
}
.switch input { display: none; }
.switch .track {
    position: absolute; inset: 0;
    background: var(--border-strong);
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--t-base) ease;
}
.switch .track::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: calc(var(--h) - 4px); height: calc(var(--h) - 4px);
    background: #fff; border-radius: 50%;
    transition: all var(--t-base) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: calc(var(--w) - var(--h) + 2px); }

/* ===== Checkbox cards ===== */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-card {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--t-fast) ease;
    background: var(--surface);
}
.check-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.check-card input { display: none; }
.check-card .box {
    width: 18px; height: 18px; border-radius: 5px;
    border: 1.5px solid var(--border-strong);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 1px;
    transition: all var(--t-fast) ease;
}
.check-card .box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(0.6); transition: all var(--t-base) ease; }
.check-card input:checked ~ .box {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-ring);
}
.check-card input:checked ~ .box svg { opacity: 1; transform: scale(1); }
.check-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
[data-theme="dark"] .check-card:has(input:checked) { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.check-card .meta { display: flex; flex-direction: column; }
.check-card .meta .title { font-size: 14px; font-weight: 500; color: var(--text); }
.check-card .meta .desc { font-size: 12.5px; color: var(--text-muted); }

/* ===== Segmented radio ===== */
.segment {
    display: inline-flex; padding: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 2px;
}
.segment input { display: none; }
.segment label {
    padding: 7px 14px;
    font-size: 13px; font-weight: 500;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--t-base) ease;
}
.segment label:hover { color: var(--text); }
.segment input:checked + label {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ===== Range slider ===== */
.slider-top { display: flex; justify-content: space-between; align-items: center; }
.slider-val {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    color: var(--accent);
}
.slider-range { display: flex; justify-content: space-between; margin-top: 4px; }
input[type="range"].slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%; height: 6px;
    border-radius: 999px;
    background: var(--border);
    outline: 0;
}
input[type="range"].slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 0 4px var(--accent-ring);
    transition: transform var(--t-fast) ease;
}
input[type="range"].slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"].slider::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); cursor: pointer; border: 0;
}

/* ===== File drop ===== */
.drop {
    display: block;
    border: 1.5px dashed var(--border-strong);
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--t-base) ease;
}
.drop:hover, .drop.drag {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
}
.drop svg { width: 28px; height: 28px; color: var(--text-muted); margin-bottom: 8px; }
.drop .main { font-size: 14px; color: var(--text); font-weight: 500; }
.drop .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.drop input { display: none; }

/* ===== Tag input ===== */
.tag-field {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: all var(--t-fast) ease;
    min-height: 44px;
}
[data-theme="dark"] .tag-field { background: var(--bg-subtle); }
.tag-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 8px 4px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    animation: popIn 0.2s ease;
}
.tag .x { cursor: pointer; opacity: 0.65; display: inline-flex; }
.tag .x:hover { opacity: 1; }
.tag-input {
    flex: 1; min-width: 100px;
    border: 0; outline: 0; background: transparent;
    font-family: inherit; font-size: 14px; color: var(--text);
    padding: 4px;
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

/* ===== Alert / callout ===== */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    border: 1px solid transparent;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 25%, transparent); }

/* ===== Badge ===== */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    font-size: 11.5px; font-weight: 500;
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.badge-accent  { background: var(--accent-soft);  color: var(--accent);  border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.badge-pbb     { background: var(--pbb-soft);     color: var(--pbb);     border-color: transparent; }
.badge-bphtb   { background: var(--bphtb-soft);   color: var(--bphtb);   border-color: transparent; }
.badge-info    { background: var(--info-soft);    color: var(--info);    border-color: transparent; }
.badge-purple  { background: var(--purple-soft);  color: var(--purple);  border-color: transparent; }
.badge-teal    { background: var(--teal-soft);    color: var(--teal);    border-color: transparent; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text);
    color: var(--bg);
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: all var(--t-slow) cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; align-items: center; gap: 10px;
    z-index: 100;
    max-width: calc(100vw - 32px);
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

/* ===== Scroll reveal utility ===== */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s ease, transform 0.7s var(--ease);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== Utility: eyebrow pill ===== */
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 12px 5px 10px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.eyebrow-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
    50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* ===== Utilities ===== */
.hidden { display: none !important; }
.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;
}

/* ===== Scrollbar (subtle) ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ===== Summary cards (dipakai di beberapa halaman tabel) ===== */
.sb-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.sb-summary-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform var(--t-fast) var(--ease),
                box-shadow var(--t-base) var(--ease),
                border-color var(--t-base) var(--ease);
}

.sb-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.sb-summary-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.sb-summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sb-summary-icon svg { width: 20px; height: 20px; }

.sb-summary-icon.all         { background: var(--accent-soft);   color: var(--accent); }
.sb-summary-icon.pelayanan   { background: var(--warning-soft);  color: var(--warning); }
.sb-summary-icon.survey      { background: var(--info-soft);     color: var(--info); }
.sb-summary-icon.penilaian   { background: var(--purple-soft);   color: var(--purple); }
.sb-summary-icon.penginputan { background: var(--teal-soft);     color: var(--teal); }
.sb-summary-icon.selesai     { background: var(--success-soft);  color: var(--success); }

.sb-summary-label {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sb-summary-count {
    font-size: 19px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}

@media (max-width: 720px) {
    .sb-summary-icon { width: 32px; height: 32px; }
    .sb-summary-icon svg { width: 16px; height: 16px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
    .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   UI Components — page layout, table, modal, form, pagination.
   (Previously tanda-terima.css — merged here so no extra <link> is needed.)
   ========================================================================== */

/* ---------- Filter bar — sejajar 1 baris horizontal ---------- */
.sb-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.sb-filters > .tt-search         { flex: 0 0 240px; min-width: 0; }
.sb-filters > .tt-search .input  { width: 100%; padding: 7px 10px 7px 34px; font-size: 12.5px; }
.sb-filters > .select            { flex: 0 0 160px; width: 160px; padding: 7px 10px; font-size: 12.5px; }
.sb-filters > input[type="date"] { flex: 0 0 140px; width: 140px; padding: 7px 10px; font-size: 12.5px; }
.sb-filters > .btn               { flex: 0 0 auto; }
@media (max-width: 720px) {
    .sb-filters > .tt-search,
    .sb-filters > .select,
    .sb-filters > input[type="date"] { flex: 1 1 140px; }
}

/* ===== Page header ===== */
.tt-header {
    padding: 24px 32px 16px;
}
.tt-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px;
    color: var(--text-subtle);
    margin-bottom: 6px;
}
.tt-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.tt-breadcrumb a:hover { color: var(--accent); }
.tt-breadcrumb .sep { color: var(--text-subtle); }
.tt-breadcrumb .current { color: var(--text); font-weight: 500; }

.tt-title {
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text);
    margin: 0;
}

/* ===== Tab pills (PBB / BPHTB) ===== */
.tt-tabs {
    display: inline-flex;
    padding: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 2px;
    margin: 0 32px 18px;
}
.tt-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--t-base) ease;
}
.tt-tab:hover { color: var(--text); }
.tt-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.tt-tab.pbb.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.tt-tab.bphtb.active {
    background: #059669;
    color: #fff;
    border-color: #059669;
}
.tt-tab svg { width: 14px; height: 14px; }

/* Varian pill (toggle PBB/BPHTB) — selaras dgn tab pill halaman penagihan */
.tt-tabs--pill {
    background: #f3f4f6;
    border: none;
    border-radius: 9999px;
    padding: 5px;
    gap: 4px;
}
[data-theme="dark"] .tt-tabs--pill {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}
.tt-tabs--pill .tt-tab {
    border-radius: 9999px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 0.875rem;
}
.tt-tabs--pill .tt-tab:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .tt-tabs--pill .tt-tab:hover { background: var(--surface-hover); }
.tt-tabs--pill .tt-tab.active { background: transparent; box-shadow: none; }
.tt-tabs--pill .tt-tab.pbb.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}
.tt-tabs--pill .tt-tab.bphtb.active {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 2px 8px rgba(5,150,105,0.35);
}
.tt-tabs--pill .tt-tab svg { width: 15px; height: 15px; }

/* ===== Page body ===== */
.tt-body { padding: 0 32px 60px; }
@media (max-width: 768px) {
    .tt-header { padding: 18px 18px 14px; }
    .tt-tabs { margin: 0 18px 14px; }
    .tt-body { padding: 0 18px 40px; }
}

/* ===== Form section card ===== */
.form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.form-section-head {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    background: color-mix(in srgb, var(--bg-subtle) 50%, transparent);
}
.form-section-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.form-section-head h3 .num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11.5px;
    font-weight: 700;
    flex-shrink: 0;
}
.form-section-head .badge { font-size: 11px; }
.form-section-body {
    padding: 18px 20px;
    display: grid;
    gap: 14px;
}

/* ===== Field with input button (cek NIK/NOP) ===== */
.field-with-btn {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.field-with-btn > .input,
.field-with-btn > .input-ic { flex: 1; }
.field-with-btn .btn { flex-shrink: 0; }

/* ===== Inline RT/RW combo ===== */
.rtrw-combo {
    display: flex;
    align-items: center;
    gap: 6px;
}
.rtrw-combo .input {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.rtrw-combo .sep {
    color: var(--text-subtle);
    font-weight: 600;
}
.input.error,
.rtrw-combo .input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent);
}

/* ===== Inline unit (m²) ===== */
.input-unit {
    display: flex;
    align-items: center;
    gap: 8px;
}
.input-unit .input { flex: 1; min-width: 0; }
.input-unit .unit { color: var(--text-muted); font-size: 13px; }

/* Form row: flexible horizontal grouping */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    align-items: start;
}
.form-row > .field { margin-bottom: 0; }
.form-row.grow-last > :last-child { grid-column: span 2; }
@media (min-width: 640px) {
    .form-row.subjek-fields { grid-template-columns: 2fr 1fr 1.5fr 1.5fr; }
    .form-row.objek-fields  { grid-template-columns: 1fr 1.2fr 1.2fr 1.6fr; }
}

/* Form actions footer */
.form-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding-top: 12px;
    flex-wrap: wrap;
}

/* ===== Riwayat / history card ===== */
.tt-riwayat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-top: 8px;
}
.tt-riwayat-head {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.tt-riwayat-head h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
}
.tt-riwayat-actions {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.tt-search {
    position: relative;
    min-width: 240px;
}
.tt-search .ic {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px;
    color: var(--text-subtle);
    pointer-events: none;
}
.tt-search .input { padding-left: 34px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; }

/* ===== Table ===== */
.tt-table-wrap { overflow-x: auto; }
.tt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid var(--border);
}
.tt-table th {
    padding: 12px 16px;
    text-align: center;
    color: var(--text);
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    white-space: nowrap;
}
.tt-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--t-fast) ease;
}
.tt-table th.sortable:hover { color: var(--text); }
.tt-table th.sortable .sort-ic {
    display: inline;
    width: 12px; height: 12px;
    margin-left: 4px;
    opacity: 0.5;
    vertical-align: middle;
    transition: all var(--t-fast) ease;
}
.tt-table th.sortable.sort-asc .sort-ic,
.tt-table th.sortable.sort-desc .sort-ic { opacity: 1; color: var(--accent); }
.tt-table th.sortable.sort-desc .sort-ic { transform: rotate(180deg); }
.tt-table td {
    padding: 12px 16px;
    border: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
.tt-table tr:hover td { background: color-mix(in srgb, var(--bg-subtle) 40%, transparent); }

.tt-noreg {
    font-family: ui-monospace, 'SF Mono', monospace;
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
    font-size: 12.5px;
}
.tt-name-cell {
    display: flex; align-items: center; gap: 10px;
}
.tt-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #e4e4e7;
    color: #27272a;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11.5px;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
}
[data-theme="dark"] .tt-avatar { background: rgba(255,255,255,0.14); color: #f4f4f5; }
.tt-name { font-weight: 500; color: var(--text); font-size: 13px; }
.tt-nik { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text-subtle); margin-top: 2px; }

.tt-actions {
    display: inline-flex; align-items: center; gap: 4px;
    justify-content: center;
}
.tt-action-btn {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: all var(--t-fast) ease;
    text-decoration: none;
}
.tt-action-btn:hover { background: var(--bg-subtle); color: var(--accent); }
.tt-action-btn.danger:hover { color: var(--danger); }
/* Hilangkan kotak outline yang menempel setelah klik mouse; ring fokus hanya
   tampil saat navigasi keyboard (aksesibilitas). */
.tt-action-btn:focus { outline: none; }
.tt-action-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tt-action-btn svg { width: 16px; height: 16px; }

.tt-table-empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--text-subtle);
    font-style: italic;
    font-size: 13px;
}

/* ===== Pagination ===== */
.tt-pagination {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 4px;
    flex-wrap: wrap; gap: 12px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 10px;
}
.tt-pagination strong { color: var(--text); font-weight: 600; }
.tt-page-nav { display: flex; align-items: center; gap: 4px; }
.tt-page-link,
.page-link {
    padding: 6px 11px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all var(--t-fast) ease;
    cursor: pointer;
    font-family: inherit;
}
.tt-page-link:hover,
.page-link:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--bg-subtle);
}
.tt-page-link.active,
.page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.tt-page-link.disabled,
.page-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== Modal ===== */
.tt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tt-modal.open {
    display: flex;
    animation: ttModalIn 0.2s ease;
}
@keyframes ttModalIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.tt-modal-dialog {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 920px;
    margin-top: 5vh;
    box-shadow: var(--shadow-lg);
    animation: ttDialogIn 0.25s var(--ease);
    overflow: hidden;
}
.tt-modal-dialog.sm { max-width: 420px; }
.tt-modal-dialog.md { max-width: 620px; }
.tt-modal-dialog.lg { max-width: 1100px; }
@keyframes ttDialogIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.tt-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}
.tt-modal-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.tt-modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all var(--t-fast) ease;
}
.tt-modal-close:hover { background: var(--bg-subtle); color: var(--text); }
.tt-modal-close svg { width: 16px; height: 16px; }
.tt-modal-body {
    padding: 18px 22px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.tt-modal-body.flush { padding: 0; }
.tt-modal-foot {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
    background: color-mix(in srgb, var(--bg-subtle) 40%, transparent);
}
@media (max-width: 600px) {
    .tt-modal { padding: 0; }
    .tt-modal-dialog { margin-top: 0; border-radius: 0; min-height: 100vh; max-width: none; }
}

/* Notification modal styles */
.tt-notif-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
}
.tt-notif-icon svg { width: 26px; height: 26px; }
.tt-notif-icon.success { background: var(--success-soft); color: var(--success); }
.tt-notif-icon.danger  { background: var(--danger-soft);  color: var(--danger); }
.tt-notif-icon.warning { background: var(--warning-soft); color: var(--warning); }
.tt-notif-icon.info    { background: var(--info-soft);    color: var(--info); }
.tt-notif-message {
    text-align: center;
    font-size: 14px;
    color: var(--text);
    margin: 0;
}

/* ===== Loading overlay ===== */
.tt-loading {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    display: none;
    align-items: center; justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 200;
    backdrop-filter: blur(2px);
}
.tt-loading.active { display: flex; }
.tt-loading .spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.tt-loading .label { font-size: 13px; color: var(--text-muted); }

/* ===== Kolektif: objek-row card + compact table ===== */
.kol-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    background: var(--surface);
}
.kol-row-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
    font-size: 12.5px;
}
.kol-row-label {
    color: var(--accent);
    font-weight: 600;
}
.kol-shared {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: color-mix(in srgb, var(--bg-subtle) 50%, transparent);
}
.kol-shared-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.kol-shared-title .hint {
    font-size: 11.5px;
    color: var(--text-subtle);
    font-weight: 400;
}
.kol-controls {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 13px;
}
.kol-controls .label-ic { color: var(--text-muted); }
.kol-controls .input { width: 64px; text-align: center; }

/* Compact bulk table (Pendaftaran Baru) */
.tt-compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.tt-compact-table th {
    background: var(--bg-subtle);
    padding: 9px 10px;
    font-size: 11px;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.tt-compact-table th.center { text-align: center; }
.tt-compact-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}
.tt-compact-table td.center { text-align: center; }
.tt-compact-table td input {
    width: 100%;
    padding: 7px 10px;
    font-size: 12.5px;
}
.tt-compact-num { color: var(--accent); font-weight: 600; }

.req-conditional { display: none; }
.form-section.required-all .req-conditional {
    display: inline;
    color: var(--accent);
    margin-left: 2px;
    font-weight: 600;
}

.tt-hidden { display: none !important; }

/* ===== Locked / readonly fields ===== */
.input[readonly],
.textarea[readonly] {
    background: #eef1f5;
    border-color: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}
.input[readonly]:hover,
.textarea[readonly]:hover {
    border-color: var(--border-strong);
}
.input[readonly]:focus,
.textarea[readonly]:focus {
    border-color: var(--border-strong);
    box-shadow: none;
}
[data-theme="dark"] .input[readonly],
[data-theme="dark"] .textarea[readonly] {
    background: color-mix(in srgb, var(--bg-subtle) 80%, var(--surface));
    border-color: var(--border);
}
