:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #282530;
    background: #fbfaf6;
    font-size: 15px;
    --ink: #282530;
    --muted: #55617a;
    --line: #d8d9e8;
    --primary: #1c2775;
    --primary-dark: #192462;
    --accent: #ffd44b;
    --surface: #fff;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 280px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; flex: none; }
.skip-link { position: absolute; z-index: 100; top: -60px; left: 12px; padding: 10px 14px; background: #fff; border-radius: 8px; }
.skip-link:focus { top: 12px; }

/* Header */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    color: #fff;
    background: radial-gradient(circle at 12% 4%, #343d9b 0, #222c7a 34%, #192462 100%);
    border-bottom: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 8px 24px rgba(25,36,98,.16);
}
.topinner {
    max-width: 1600px;
    min-height: 76px;
    margin: auto;
    padding: 11px clamp(16px, 3vw, 34px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.header-start, .header-actions, .brand { display: flex; align-items: center; }
.header-start { min-width: 0; gap: 12px; }
.header-actions { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.brand { min-width: 0; gap: 11px; color: #fff; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 12px;
    padding: 4px;
    background: #fff;
    box-shadow: 0 3px 9px rgba(0,0,0,.16);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-copy { min-width: 0; }
.brand-short { display: none; }
.brand-copy strong { display: block; font-size: 18px; line-height: 1.2; letter-spacing: .03em; }
.brand-copy small { display: block; max-width: 390px; margin-top: 3px; overflow: hidden; color: #e0e7fa; font-size: 11px; letter-spacing: .01em; text-overflow: ellipsis; white-space: nowrap; }
.header-link, .logout-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,.19);
    border-radius: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,.06);
    color: #f7f7fd;
    font-weight: 650;
    white-space: nowrap;
}
.header-link:hover, .logout-button:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.header-link.primary { border-color: var(--accent); background: var(--accent); color: #192462; }
.header-link.primary:hover { background: #ffe179; }
.header-actions form { margin: 0; }
.logout-button svg { width: 18px; height: 18px; }
.user-chip { display: inline-flex; align-items: center; gap: 9px; min-width: 0; padding-right: 8px; }
.user-avatar { display: grid; place-items: center; width: 37px; height: 37px; flex: none; border-radius: 11px; background: #343d9b; color: #fff; font-weight: 800; }
.user-meta { min-width: 0; }
.user-meta strong { display: block; max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-meta small { display: block; margin-top: 1px; color: #d9e1fb; font-size: 11px; }
.menu-toggle, .sidebar-close { display: none; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.07); color: #fff; }
.menu-toggle:hover { background: rgba(255,255,255,.16); }

/* Page layout */
.page-shell { min-height: calc(100vh - 155px); }
.admin-shell { display: grid; grid-template-columns: 252px minmax(0,1fr); max-width: 1600px; min-height: calc(100vh - 155px); margin: 0 auto; }
.admin-sidebar {
    position: sticky;
    top: 76px;
    align-self: start;
    height: calc(100vh - 76px);
    overflow-y: auto;
    padding: 28px 16px 20px;
    background: #fff;
    border-right: 1px solid #d8d9e8;
}
.sidebar-top { padding: 0 12px 18px; border-bottom: 1px solid #e4e6f2; margin-bottom: 20px; }
.sidebar-overline { display: block; color: #6b7190; font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.sidebar-title { display: block; margin-top: 5px; color: #192462; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.sidebar-label { margin: 0 12px 10px; color: #737a99; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-link { display: flex; align-items: center; gap: 11px; min-height: 51px; padding: 7px 10px; border-radius: 11px; color: #303963; font-size: 14px; font-weight: 700; }
.sidebar-link:hover { background: #f2f3fb; color: #1c2775; text-decoration: none; }
.sidebar-link.active { background: #e9ecff; color: #1c2775; }
.sidebar-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 9px; background: #f2f3fb; color: #59648d; }
.sidebar-icon svg { width: 18px; height: 18px; }
.sidebar-link.active .sidebar-icon { background: #1c2775; color: #fff; }
.sidebar-link .chevron { width: 16px; height: 16px; margin-left: auto; color: #9da3c1; }
.sidebar-link.active .chevron { color: #1c2775; }
.sidebar-foot { margin: 26px 12px 0; padding-top: 17px; border-top: 1px solid #e4e6f2; color: #737a99; font-size: 11px; line-height: 1.5; }
.sidebar-backdrop { display: none; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 34px 24px 72px; }
.wrap.narrow { max-width: 520px; }
.admin-main { min-width: 0; width: 100%; max-width: none; padding: 34px clamp(20px, 3vw, 42px) 72px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 25px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 9px; color: #323f9e; font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.pagehead h1, h1 { margin: 0 0 8px; font-size: clamp(25px, 3vw, 35px); line-height: 1.15; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.lead { margin: 0; font-size: 16px; line-height: 1.6; }
.card { min-width: 0; margin-bottom: 18px; padding: 25px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(25,36,98,.06); }
.card h2 { margin: 0 0 14px; font-size: 18px; }
.card h3 { margin: 0 0 11px; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.field { min-width: 0; margin-bottom: 17px; }
.field:last-child { margin-bottom: 0; }
label { display: block; margin-bottom: 7px; font-weight: 650; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], input[type=file], select, textarea {
    width: 100%; min-height: 44px; padding: 11px 12px; border: 1px solid #d8d9e8; border-radius: 9px; background: #fff; color: var(--ink);
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(64,80,171,.18); border-color: var(--primary); }
.help { display: block; margin-top: 6px; color: #68728f; font-size: 12px; line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 16px; border: 1px solid var(--primary); border-radius: 9px; background: var(--primary); color: #fff; font-weight: 700; text-decoration: none; }
.button:hover { border-color: var(--primary-dark); background: var(--primary-dark); color: #fff; text-decoration: none; }
.button.secondary { border-color: #aab3df; background: #fff; color: var(--primary); }
.button.secondary:hover { background: #f2f3fb; }
.button.small { min-height: 35px; padding: 7px 10px; font-size: 13px; }
.button.danger { border-color: #a9443f; background: #a9443f; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 21px; }
.alert { margin-bottom: 18px; padding: 13px 16px; border-radius: 10px; line-height: 1.5; }
.alert.success { border: 1px solid #cbd2f4; background: #e9ecff; color: #263484; }
.alert.error { border: 1px solid #f3c9c2; background: #fff0ed; color: #9a3228; }
.alert ul { margin: 5px 0 0; padding-left: 20px; }
.badge { display: inline-block; padding: 6px 10px; border-radius: 99px; background: #eef0fb; color: #3d4778; font-size: 12px; font-weight: 700; line-height: 1.2; }
.badge.pending { background: #fff3d7; color: #6a5414; }
.badge.revision { background: #fff0ed; color: #a4443b; }
.badge.done { background: #e9ecff; color: #1c2775; }
.badge.issued { background: #fff3d7; color: #6a5414; }
.tablewrap { width: 100%; overflow-x: auto; }
.table-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.table-actions form { margin: 0; }
.table-action { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; flex: none; border: 1px solid #cbd1ed; border-radius: 9px; background: #f5f6fc; color: var(--primary); cursor: pointer; text-decoration: none; }
.table-action svg { width: 20px; height: 20px; }
.table-action:hover, .table-action:focus-visible { border-color: var(--primary); background: #e9ecff; color: var(--primary-dark); text-decoration: none; }
.table-action:focus-visible { outline: 3px solid rgba(64,80,171,.22); outline-offset: 2px; }
.table-action.edit { background: #fff; }
.table-action.danger { border-color: #efc7c4; background: #fff0ed; color: #a9443f; }
.table-action.danger:hover, .table-action.danger:focus-visible { border-color: #a9443f; background: #a9443f; color: #fff; }
.table-action-note { display: block; max-width: 175px; margin-top: 7px; font-size: 11px; line-height: 1.35; }
.recap-files { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 9px; }
.recap-files a { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
.recap-files svg { width: 15px; height: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 14px 11px; border-bottom: 1px solid #e4e6f2; text-align: left; vertical-align: top; }
th { color: #68728f; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; }
.step { padding: 8px 13px; border-radius: 8px; background: #e9ecff; color: #4f5b84; font-size: 12px; font-weight: 700; }
.step.active { background: var(--primary); color: #fff; }
.detail { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 10px 15px; margin: 0; }
.detail dt { color: #626c8c; }
.detail dd { min-width: 0; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.document-row { display: grid; grid-template-columns: minmax(170px,1fr) auto; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid #e4e6f2; }
.document-row:first-of-type { border-top: 0; }
.document-row small { display: block; margin-top: 5px; color: #707a96; }
.document-row-rejected { background: #fff8f6; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.document-feedback { margin-top: 8px; padding: 9px 11px; border-left: 3px solid #a9443f; border-radius: 6px; background: #fff0ed; color: #8d2f28; font-size: 13px; line-height: 1.45; }
.uploaded-letter { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 12px 14px; border: 1px solid #cbd2f4; border-radius: 9px; background: #f5f6ff; }
.uploaded-letter small { display: block; margin-top: 4px; color: var(--muted); }
.uploaded-letter .actions { margin: 0; }
.note { padding: 14px 16px; border-left: 4px solid var(--accent); border-radius: 8px; background: #fff9e8; color: #655018; line-height: 1.5; }
.footer { padding: 24px; border-top: 1px solid var(--line); color: #6f7895; font-size: 12px; text-align: center; }
.footer strong { color: var(--primary); letter-spacing: .04em; }
.footer-tagline { display: block; max-width: 780px; margin: 6px auto 0; line-height: 1.5; }
.stats { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.auth-head { margin-bottom: 23px; text-align: center; }
.required { color: #b64d46; }
.subtle { color: var(--muted); font-size: 13px; }
.mini-check { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.mini-check input { width: auto; }
.review-box { margin-top: 12px; padding: 16px; border: 1px solid #dfe2ef; border-radius: 10px; background: #fafaff; }
.inline-preview { margin: 12px 0 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fafaff; }
.inline-preview summary { display: flex; align-items: center; gap: 8px; padding: 12px 15px; color: var(--primary); font-weight: 700; cursor: pointer; list-style: none; }
.inline-preview summary::-webkit-details-marker { display: none; }
.inline-preview summary::before { content: "▸"; font-size: 16px; }
.inline-preview[open] summary::before { content: "▾"; }
.inline-preview[open] summary { border-bottom: 1px solid var(--line); background: #f2f3fb; }
.inline-preview-body { padding: 14px; }
.preview-frame { display: block; width: 100%; min-height: 410px; height: min(72vh,720px); border: 1px solid var(--line); border-radius: 10px; background: #f8f8fd; }
.filterbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 15px; }
.filterbar .field { margin: 0; }
.filterbar .field.status { min-width: 260px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 10px; padding-top: 15px; border-top: 1px solid #e4e6f2; }
.pager-summary { color: var(--muted); font-size: 12px; }
.pager nav { display: flex; gap: 5px; flex-wrap: wrap; }
.pager a, .pager nav span { display: inline-flex; align-items: center; justify-content: center; min-width: 35px; min-height: 35px; padding: 6px 10px; border: 1px solid #d8d9e8; border-radius: 8px; background: #fff; color: #303963; font-size: 13px; font-weight: 700; }
.pager a:hover { background: #f2f3fb; text-decoration: none; }
.pager nav .current { border-color: #1c2775; background: #1c2775; color: #fff; }
.pager nav .disabled { background: #f6f6fb; color: #9da3bb; }
.stage-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.stage-tabs a { padding: 10px 14px; border: 1px solid #d8d9e8; border-radius: 9px; background: #fff; color: #303963; font-size: 13px; font-weight: 700; }
.stage-tabs a:hover { background: #f2f3fb; text-decoration: none; }
.stage-tabs a.active { border-color: #1c2775; background: #1c2775; color: #fff; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.list-heading h2 { margin: 0 0 5px; }
.list-heading .eyebrow { margin-bottom: 5px; }
.list-heading .subtle { margin: 0; }
.application-list { margin: 0; padding: 0; list-style: none; }
.application-item { display: grid; grid-template-columns: 82px minmax(180px,1fr) minmax(170px,auto) auto; align-items: center; gap: 15px; padding: 14px 0; border-top: 1px solid #e4e6f2; }
.application-number { color: #303963; font-weight: 800; }
.application-info { min-width: 0; }
.application-info strong { display: block; overflow-wrap: anywhere; }
.application-info small { display: block; margin-top: 4px; color: #707a96; line-height: 1.45; }
.application-item .badge { justify-self: start; }
.application-empty { padding: 19px 0; border-top: 1px solid #e4e6f2; color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.summary-grid .card { margin-bottom: 0; }
#tahap-1, #tahap-2, #tanda-tangan { scroll-margin-top: 94px; }

@media (max-width: 1120px) {
    .application-item { grid-template-columns: 76px minmax(0,1fr) auto; }
    .application-item .badge { grid-column: 2; grid-row: 2; }
    .application-item .button { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 900px) {
    .admin-shell { display: block; }
    .admin-sidebar { position: static; height: auto; padding: 16px; border-right: 0; border-bottom: 1px solid #d8d9e8; }
    .admin-sidebar .sidebar-top, .admin-sidebar .sidebar-foot { display: none; }
    .sidebar-nav { display: flex; overflow-x: auto; gap: 8px; }
    .sidebar-link { flex: none; white-space: nowrap; }
    .sidebar-link .chevron { display: none; }
    .admin-main { padding: 25px 18px 60px; }
    .js .menu-toggle { display: inline-flex; }
    .js .admin-sidebar { position: fixed; z-index: 52; top: 0; bottom: 0; left: 0; width: min(310px, 86vw); height: 100dvh; padding: 20px 14px; border-right: 1px solid #d8d9e8; border-bottom: 0; box-shadow: 16px 0 40px rgba(25,36,98,.18); transform: translateX(-105%); transition: transform .2s ease; }
    .js .admin-sidebar .sidebar-top { display: flex; align-items: flex-start; justify-content: space-between; }
    .js .admin-sidebar .sidebar-foot { display: block; }
    .js .sidebar-nav { display: grid; overflow: visible; }
    .js .sidebar-link { white-space: normal; }
    .js .sidebar-link .chevron { display: block; }
    .js .sidebar-close { display: inline-flex; width: 35px; height: 35px; border-color: #d8d9e8; background: #f2f3fb; color: #303963; }
    .js .sidebar-backdrop { position: fixed; z-index: 51; inset: 0; display: block; background: rgba(15,20,66,.55); opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease; }
    .js .admin-menu-open .admin-sidebar { transform: translateX(0); }
    .js .admin-menu-open .sidebar-backdrop { opacity: 1; visibility: visible; }
}
@media (max-width: 750px) {
    .grid, .grid.three, .summary-grid { grid-template-columns: 1fr; }
    .detail { grid-template-columns: 1fr; gap: 3px; }
    .detail dt { margin-top: 8px; }
    .document-row { grid-template-columns: 1fr; }
    .card { padding: 19px; }
    .wrap { padding: 25px 16px 55px; }
    .admin-main { padding: 25px 16px 55px; }
    .preview-frame { min-height: 320px; height: 58vh; }
    .header-actions .user-meta { display: none; }
}
@media (max-width: 600px) {
    .topinner { min-height: 68px; padding: 10px 14px; gap: 10px; }
    .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
    .brand-full { display: none; }
    .brand-short { display: inline; }
    .brand-copy strong { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
    .brand-copy small { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
    .header-actions { gap: 6px; }
    .user-chip { padding-right: 0; }
    .user-avatar { width: 34px; height: 34px; border-radius: 9px; }
    .header-link, .logout-button { min-height: 37px; padding: 7px 9px; font-size: 12px; }
    .application-item { grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
    .application-number { grid-column: 1 / -1; }
    .application-info { grid-column: 1; }
    .application-item .badge { grid-column: 1; grid-row: auto; }
    .application-item .button { grid-column: 2; grid-row: 2 / span 2; }
    .list-heading { align-items: flex-start; }
    .list-heading .badge { flex: none; }
    .filterbar .field, .filterbar .field.status, .filterbar .button { width: 100%; min-width: 0; }
    .pager { align-items: flex-start; }
}
@media (max-width: 480px) {
    .topinner { flex-wrap: wrap; }
    .topinner:not(.admin-topinner) .header-actions { width: 100%; justify-content: flex-start; }
    .admin-topinner { flex-wrap: nowrap; }
    .admin-topinner .brand-copy strong { max-width: 120px; }
    .admin-topinner .brand-copy small { display: none; }
    .admin-topinner .logout-text { display: none; }
    .admin-topinner .user-chip { display: none; }
    .admin-topinner .logout-button { width: 38px; padding: 7px; }
}
@media (max-width: 360px) {
    .admin-topinner .brand-copy strong { max-width: 96px; }
    .menu-toggle { width: 38px; height: 38px; }
    .brand-mark { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .admin-sidebar, .sidebar-backdrop { transition: none !important; }
}
