:root {
    --brand-950: #0a3550;
    --brand-900: #0d4568;
    --brand-800: #135d8c;
    --brand-700: #1a74ad;
    --brand-600: #2b8fc9;
    --brand-500: #4aa9e0;
    --brand-400: #7cc3ea;
    --brand-200: #c3e4f8;
    --brand-100: #e4f3fd;
    --brand-50: #f4fafe;
    --gold-600: #d97706;
    --gold-500: #f59e0b;
    --gold-100: #fef3c7;
    --ink-950: #0c1a24;
    --ink-800: #1e2e3d;
    --ink-600: #475a6b;
    --ink-500: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-muted: #f1f5f9;
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --warning: #f59e0b;
    --warning-soft: #fffbeb;
    --info: #2b8fc9;
    --info-soft: #f4fafe;
    --success: #10b981;
    --success-soft: #ecfdf5;
    --violet: #8b5cf6;
    --shadow-xs: 0 1px 2px rgba(10, 53, 80, .05);
    --shadow-sm: 0 8px 24px rgba(10, 53, 80, .07);
    --shadow-md: 0 18px 48px rgba(10, 53, 80, .11);
    --radius-sm: .7rem;
    --radius-md: 1rem;
    --radius-lg: 1.35rem;
    --radius-xl: 1.75rem;
    --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); color: var(--ink-950); background: var(--surface-soft); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 9999; padding: .7rem 1rem; border-radius: .75rem; background: var(--ink-950); color: #fff; transform: translateY(-180%); transition: .2s; }
.skip-link:focus { transform: translateY(0); }
.eyebrow { display: block; margin-bottom: .3rem; color: var(--brand-700); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: .42rem .72rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.light-pill { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.optional { color: var(--ink-500); font-size: .75rem; font-weight: 500; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 .6rem; border-radius: 999px; background: var(--brand-50); color: var(--brand-700); font-size: .82rem; font-weight: 800; }

.button { min-height: 2.75rem; padding: .7rem 1rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid transparent; border-radius: .78rem; font-weight: 750; font-size: .88rem; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(43,143,201,.28); outline-offset: 2px; }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--brand-700), var(--brand-900)); box-shadow: 0 8px 18px rgba(10,51,80,.2); }
.button-primary:hover { box-shadow: 0 12px 24px rgba(10,51,80,.28); }
.button-outline { color: var(--brand-800); background: #fff; border-color: var(--line-strong); }
.button-ghost { color: var(--ink-600); background: transparent; border-color: transparent; }
.button-light { color: var(--brand-900); background: #fff; }
.button-glass { color: #fff; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.button-success { color: #fff; background: var(--success); }
.button-warning { color: #7a4909; background: #f6d58f; }
.button-danger { color: #fff; background: var(--danger); }
.button-danger-ghost { color: var(--danger); background: var(--danger-soft); }
.button-block { width: 100%; }
.button-lg { min-height: 3.2rem; font-size: .96rem; }
.button-sm { min-height: 2.25rem; padding: .48rem .72rem; font-size: .78rem; border-radius: .65rem; }

.ui-input { width: 100%; min-height: 2.85rem; padding: .72rem .82rem; border: 1px solid var(--line-strong); border-radius: .78rem; color: var(--ink-950); background: #fff; outline: none; transition: border-color .18s, box-shadow .18s; }
.ui-input:hover { border-color: #94a3b8; }
.ui-input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(43,143,201,.18); }
.ui-input::placeholder { color: var(--ink-500); opacity:1; }
select.ui-input { appearance: auto; }
textarea.ui-input { resize: vertical; min-height: 6rem; }
.ui-checkbox { width: 1.08rem; height: 1.08rem; accent-color: var(--brand-700); flex: 0 0 auto; }
.ui-file-input { width: 100%; color: var(--ink-600); font-size: .86rem; }
.ui-file-input::file-selector-button { margin-right: .7rem; padding: .62rem .8rem; border: 0; border-radius: .65rem; background: var(--brand-100); color: var(--brand-800); font-weight: 750; cursor: pointer; }
.form-field { display: flex; flex-direction: column; gap: .42rem; min-width: 0; }
.form-field[hidden] { display: none; }
.form-field > label { display: flex; align-items: baseline; gap: .4rem; color: var(--ink-800); font-size: .82rem; font-weight: 750; }
.field-help { color: var(--ink-500); font-size: .74rem; line-height: 1.45; }
.field-error { color: var(--danger); font-size: .75rem; font-weight: 650; }
.form-alert { padding: .85rem 1rem; margin-bottom: 1rem; border: 1px solid #f2c5c5; border-radius: .8rem; background: var(--danger-soft); color: #8e2424; font-size: .84rem; }
.check-row { display: flex; align-items: flex-start; gap: .65rem; color: var(--ink-600); font-size: .83rem; cursor: pointer; }
.check-row input { margin-top: .15rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0,1fr)); }
.full-column { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: .7rem; padding-top: 1.25rem; margin-top: 1.25rem; border-top: 1px solid var(--line); }

/* Cascading/chained combobox fields (e.g. entry_form.html's category picker) */
.form-section { margin-bottom: 1.6rem; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section > h3 { margin: 0 0 1.1rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); color: var(--ink-950); font-size: .95rem; font-weight: 800; }
.pesilat-slot { margin-bottom: 1.2rem; }
.pesilat-slot:last-child { margin-bottom: 0; }
.pesilat-slot[hidden] { display: none; }
.pesilat-slot > h4 { margin: 0 0 .7rem; color: var(--brand-700); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: .5rem; }
.slot-badge { font-size: .62rem; font-weight: 700; text-transform: none; letter-spacing: .03em; padding: .12em .55em; border-radius: .35rem; }
.slot-badge.required { color: #fff; background: var(--danger); }
.slot-badge.optional { color: var(--ink-600); background: var(--ink-100); }
.chain-hint { display: inline-flex; align-items: center; gap: .25rem; color: var(--ink-500); font-size: .68rem; font-weight: 600; }
.chain-hint::before { content: "→"; color: var(--brand-600); }
.field-wait-hint { color: var(--ink-500); font-size: .74rem; font-style: italic; }
.fee-estimate-box { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; margin-top: 1rem; border: 1px solid var(--brand-100); border-radius: var(--radius-md); background: linear-gradient(120deg, var(--brand-50), #fff); }
.fee-estimate-box span { color: var(--ink-600); font-size: .78rem; font-weight: 650; }
.fee-estimate-box strong { color: var(--brand-800); font-size: 1.35rem; font-weight: 900; letter-spacing: -.02em; transition: color .3s ease; }
.fee-estimate-box strong.is-updated { color: var(--brand-600); }

.status-badge { display: inline-flex; align-items: center; width: fit-content; max-width: 100%; padding: .34rem .62rem; border-radius: 999px; font-size: .68rem; font-weight: 800; white-space: nowrap; }
.status-success, .status-open, .status-active, .status-verified, .status-valid, .status-validated { color: #12673f; background: var(--success-soft); }
.status-warning, .status-upcoming, .status-pending, .status-needs_revision { color: #8a560d; background: var(--warning-soft); }
.status-info, .status-submitted, .status-ready { color: #175b92; background: var(--info-soft); }
.status-danger, .status-rejected, .status-suspended { color: #9c2929; background: var(--danger-soft); }
.status-neutral, .status-draft, .status-cancelled, .status-closed, .status-disabled { color: var(--ink-600); background: var(--surface-muted); }

/* Form submit loading overlay */
.form-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); animation: overlayIn .2s ease-out; }
.form-overlay[hidden] { display: none; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.form-overlay-card { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 2.75rem 3.5rem; border-radius: 1.25rem; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.2); text-align: center; animation: cardPop .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes cardPop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.form-overlay-card strong { color: var(--ink-900); font-size: 1.05rem; }
.form-overlay-card p { margin: 0; color: var(--ink-500); font-size: .82rem; }
.form-spinner { display: flex; align-items: center; justify-content: center; color: var(--brand-600); margin-bottom: .35rem; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.button .btn-icon { transition: opacity .2s; }
.button .btn-spinner { display: none; width: 1.1rem; height: 1.1rem; animation: spin .7s linear infinite; }
.button .btn-text { transition: opacity .2s; }
.button.is-loading .btn-icon { display: none; }
.button.is-loading .btn-text { opacity: .6; }
.button.is-loading .btn-spinner { display: inline-block; }

/* Toast notification */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 10000; display: flex; flex-direction: column; gap: .5rem; max-width: 28rem; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: .65rem; padding: .85rem 1rem; border-radius: .75rem; background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.15); pointer-events: auto; animation: toast-in .3s ease; font-size: .82rem; line-height: 1.45; }
.toast-icon { flex-shrink: 0; width: 1.2rem; height: 1.2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; margin-top: .05rem; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; color: var(--ink-900); }
.toast-message { color: var(--ink-600); margin-top: .15rem; }
.toast-close { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--ink-400); font-size: 1rem; line-height: 1; padding: 0 .15rem; }
.toast-close:hover { color: var(--ink-700); }
.toast.error .toast-icon { background: #fde8e8; color: #b91c1c; }
.toast.success .toast-icon { background: #dcfce7; color: #15803d; }
.toast.warning .toast-icon { background: #fef3c7; color: #a16207; }
@keyframes toast-in { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* Logo uploader */
.logo-uploader { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.logo-preview { position: relative; width: 6rem; height: 6rem; border-radius: 1rem; border: 1px solid var(--line); overflow: hidden; background: #fff; flex-shrink: 0; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-remove { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; background: rgba(0,0,0,.55); color: #fff; font-size: .65rem; font-weight: 700; cursor: pointer; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.logo-preview:hover .logo-remove { opacity: 1; }
.logo-remove input { display: none; }
.logo-remove:has(input:checked) { opacity: 1; background: rgba(180,40,40,.75); }
.logo-remove:has(input:checked)::after { content: 'Dihapus'; font-size: .65rem; font-weight: 700; }
.logo-input-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; padding-top: 1rem; }
.logo-input-wrap input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.logo-filename { color: var(--ink-500); font-size: .72rem; }
/* Button icon alignment */
.button svg, .btn svg { width: 1em; height: 1em; vertical-align: -2px; margin-right: .35em; flex-shrink: 0; }
.button.button-sm svg, .btn.btn-sm svg { width: .9em; height: .9em; }
.button-lg svg, .btn-lg svg { width: 1.1em; height: 1.1em; }
/* Password input & strength (shared from auth.css) */
.password-input { position: relative; }
.password-input .ui-input { padding-right: 4rem; }
.password-input .pwd-icon { position: absolute; top: 50%; left: .85rem; width: 1.05rem; height: 1.05rem; color: var(--ink-500); transform: translateY(-50%); }
.password-input .pwd-icon svg { width: 100%; height: 100%; }
.password-input .pwd-icon + .ui-input { padding-left: 2.55rem; }
.password-toggle { position: absolute; top: 50%; right: .6rem; padding: .3rem .5rem; border: 0; border-radius: .45rem; color: var(--brand-700); background: transparent; font-size: .68rem; font-weight: 800; cursor: pointer; transform: translateY(-50%); transition: background .15s, color .15s; }
.password-toggle:hover { background: var(--brand-50); color: var(--brand-800); }
.pwd-strength { margin-top: .55rem; }
.pwd-bar { height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pwd-bar-fill { height: 100%; width: 0; border-radius: 99px; transition: width .35s, background .35s, box-shadow .35s; }
.pwd-bar-fill.weak { width: 25%; background: #d74b4b; box-shadow: 0 0 6px rgba(215,75,75,.3); }
.pwd-bar-fill.medium { width: 50%; background: #e8993d; box-shadow: 0 0 6px rgba(232,153,61,.3); }
.pwd-bar-fill.strong { width: 75%; background: #54b683; box-shadow: 0 0 6px rgba(84,182,131,.3); }
.pwd-bar-fill.very-strong { width: 100%; background: #2b8c5c; box-shadow: 0 0 6px rgba(43,140,92,.3); }
.pwd-rules { display: flex; flex-wrap: wrap; gap: .25rem .85rem; margin-top: .5rem; }
.pwd-rules span { display: flex; align-items: center; gap: .35rem; color: var(--ink-500); font-size: .65rem; font-weight: 600; transition: color .25s; }
.pwd-rules span::before { content: ''; width: .4rem; height: .4rem; border-radius: 50%; background: var(--line-strong); transition: background .25s, box-shadow .25s; }
.pwd-rules span.met { color: #2b8c5c; }
.pwd-rules span.met::before { background: #2b8c5c; box-shadow: 0 0 4px rgba(43,140,92,.35); }

@media (max-width: 720px) {
    .form-grid.two-columns { grid-template-columns: 1fr; }
    .full-column { grid-column: auto; }
    .form-actions { position: sticky; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 5; margin-inline: -.2rem; padding: .75rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(255,255,255,.96); box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); }
    .form-actions .button { flex: 1; }
}
