/* GriyaPro - gaya dasar bersama. Token warna & komponen umum. */
:root {
  --ink: #12143a; --ink-2: #43456a; --muted: #6a6c8c; --line: #e3e5f0; --line-2: #eef0f7;
  --bg: #f3f4f9; --surface: #ffffff; --surface-2: #f8f8fc;
  --brand: #3e4095; --brand-700: #31337a; --brand-900: #1f2158; --brand-50: #eeeffa; --brand-100: #dcdef5;
  --accent: #f26a1b; --accent-700: #cf530c; --accent-50: #fff0e6;
  --ok: #0f7f5a; --ok-50: #e3f6ee; --warn: #a96300; --warn-50: #fff3d9; --bad: #c0301d; --bad-50: #fdebe8; --info: #3e4095; --info-50: #eeeffa;
  --shadow-sm: 0 1px 2px rgba(18, 20, 58, .06), 0 1px 1px rgba(18, 20, 58, .04);
  --shadow-md: 0 6px 20px -6px rgba(18, 20, 58, .18);
  --shadow-lg: 0 24px 60px -20px rgba(18, 20, 58, .35);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --ink: #e8eef9; --ink-2: #bcc8dd; --muted: #8b9ab3; --line: #2a2c55; --line-2: #202248;
    --bg: #0c0d24; --surface: #14163a; --surface-2: #1a1c46;
    --brand: #9a9df0; --brand-700: #b4b7f5; --brand-900: #d3d5fa; --brand-50: #1d1f4d; --brand-100: #2a2d6e;
    --accent: #ff8a46; --accent-700: #ffa56f; --accent-50: #3a2415;
    --ok: #3ecf9b; --ok-50: #0f2b22; --warn: #f2b44a; --warn-50: #33260d; --bad: #ff8573; --bad-50: #371915; --info: #9a9df0; --info-50: #1d1f4d;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 6px 20px -6px rgba(0,0,0,.55); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; line-height: 1.2; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
.ic { flex: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.row-gap { display: flex; gap: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }

/* Tombol */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1.5px solid transparent; border-radius: var(--r-md); font-weight: 650; font-size: 15px; letter-spacing: .005em; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; white-space: nowrap; text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -8px var(--brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 6px 14px -8px var(--accent); }
.btn-accent:hover:not(:disabled) { background: var(--accent-700); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); }
.btn-soft { background: var(--brand-50); color: var(--brand); }
.btn-soft:hover:not(:disabled) { background: var(--brand-100); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-50); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-ghost.loading::after, .btn-soft.loading::after { border-color: color-mix(in srgb, var(--ink) 25%, transparent); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; color: inherit; transition: background .15s; position: relative; flex: none; }
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }

/* Formulir */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 11px 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none; }
.textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2366758d' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--bad); }
.field-err { font-size: 12.5px; color: var(--bad); font-weight: 550; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 42px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); margin: 1px 0 0; flex: none; }
.form-error { background: var(--bad-50); color: var(--bad); border-radius: var(--r-md); padding: 11px 14px; font-size: 14px; font-weight: 550; margin-bottom: 14px; }

/* Komponen */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge.b-ok { background: var(--ok-50); color: var(--ok); }
.badge.b-warn { background: var(--warn-50); color: var(--warn); }
.badge.b-bad { background: var(--bad-50); color: var(--bad); }
.badge.b-info { background: var(--info-50); color: var(--info); }
.badge.b-accent { background: var(--accent-50); color: var(--accent-700); }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 14px; flex: none; letter-spacing: .02em; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.skeleton { background: linear-gradient(100deg, var(--line-2) 30%, var(--surface-2) 50%, var(--line-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 10px; min-height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 44px 24px; color: var(--muted); }
.empty .empty-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty p { max-width: 300px; margin: 0 auto 16px; font-size: 14px; }

/* Toast */
#toasts { position: fixed; z-index: 400; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 84px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; gap: 10px; align-items: center; background: #12143a; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-md); font-size: 14px; font-weight: 550; max-width: 440px; animation: toast-in .25s ease-out; pointer-events: auto; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
.toast.t-ok .ic { color: #4be0aa; } .toast.t-bad .ic { color: #ff9585; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* Lapisan: sheet / dialog / modal */
.layer { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-end; justify-content: center; }
.layer-scrim { position: absolute; inset: 0; background: rgba(8, 16, 32, .55); opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.layer.open .layer-scrim { opacity: 1; }
.layer-panel { position: relative; width: 100%; max-width: 520px; max-height: 92dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); transform: translateY(24px); opacity: 0; transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .2s; outline: 0; }
.layer.open .layer-panel { transform: none; opacity: 1; }
.layer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 6px 20px; }
.layer-head h3 { font-size: 18px; }
.layer-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.layer-dialog, .layer-modal { align-items: center; padding: 16px; }
.layer-dialog .layer-panel, .layer-modal .layer-panel { border-radius: 20px; max-width: 420px; }
.layer-modal .layer-panel { max-width: 640px; }
.layer-modal.wide .layer-panel { max-width: 860px; }
.layer-dialog .layer-body, .layer-modal .layer-body { padding-bottom: 20px; }
@media (min-width: 640px) { .layer-sheet { align-items: center; padding: 16px; } .layer-sheet .layer-panel { border-radius: 20px; } }

/* ---- sentuh ---- */
html { -webkit-tap-highlight-color: transparent; }
a, button, label, select, summary, [role=button], [role=tab] { touch-action: manipulation; }
@media (max-width: 760px) { .input, .select, .textarea { font-size: 16px; } }
