/* Finance Portal - banking panel theme */
:root {
    --navy: #0a1f44;
    --navy-2: #12306b;
    --primary: #0b57d0;
    --primary-dark: #0846a8;
    --gold: #f2b233;
    --bg: #f1f4f9;
    --card: #ffffff;
    --border: #e1e7ef;
    --text: #18212f;
    --muted: #5d6879;
    --success: #0d7a4c;
    --success-bg: #e2f5ec;
    --warning: #935600;
    --warning-bg: #fff3d6;
    --danger: #b42318;
    --danger-bg: #fde8e6;
    --info: #0b57d0;
    --info-bg: #e5eefe;
    --violet: #5b3cc4;
    --violet-bg: #efe9ff;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
    --sidebar-w: 264px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0 0 12px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(11, 87, 208, .45); outline-offset: 2px; }

.icon {
    width: 18px; height: 18px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.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;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: #fff; padding: 8px 14px; border-radius: 6px; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }

/* ---------- App shell ---------- */
.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: var(--sidebar-w); overflow-y: auto;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
    color: #c8d3ea; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 10px; color: #fff; font-weight: 700; font-size: 17px; }
.brand-mark {
    width: 38px; height: 38px; flex: none; border-radius: 10px;
    display: grid; place-items: center; background: var(--gold); color: var(--navy);
}
.brand-mark .icon { width: 22px; height: 22px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.role-pill { margin: 0 20px 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.nav { padding: 0 12px 28px; }
.nav-section { padding: 18px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #7f90b4; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px; border-radius: 8px; color: #d4ddef; font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(11, 87, 208, .35); }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px;
    padding: 12px 28px; background: #fff; border-bottom: 1px solid var(--border);
}
.page-title { flex: 1; font-size: 18px; }
.menu-toggle { display: none; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user form { margin: 0; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
    background: var(--info-bg); color: var(--primary);
}
.who { line-height: 1.25; }
.who strong { display: block; }
.who small { color: var(--muted); font-size: 12px; }
.content { flex: 1; padding: 24px 28px; }
.footer {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 28px; font-size: 12px; color: var(--muted); background: #fff; border-top: 1px solid var(--border);
}

/* ---------- Cards & layout ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 15px; }
.card-body { padding: 20px; }
.card-body + .card-body { border-top: 1px solid var(--border); }
.form-alert { padding: 20px 20px 0; }
.form-alert .alert { margin-bottom: 0; }
.big-number { margin: 0; font-size: 34px; font-weight: 700; color: var(--navy-2); }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-actions h2 { font-size: 16px; }
.welcome {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 22px 24px; margin-bottom: 20px; border-radius: var(--radius); color: #fff;
    background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 60%, var(--primary) 140%);
}
.welcome h2 { font-size: 20px; }
.welcome p { margin: 4px 0 0; color: #c8d3ea; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    display: block; padding: 16px 18px; color: var(--text);
    background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat:hover { text-decoration: none; box-shadow: 0 6px 16px rgba(16, 24, 40, .1); }
.stat span { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat strong { display: block; margin-top: 4px; font-size: 26px; }
.stat-pending { border-left-color: var(--gold); }
.stat-process { border-left-color: var(--info); }
.stat-approved { border-left-color: var(--success); }
.stat-rejected { border-left-color: var(--danger); }
.stat-network { border-left-color: var(--violet); }
.stats.compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin: 0; }
.stats.compact .stat { padding: 12px 14px; box-shadow: none; }
.stats.compact .stat strong { font-size: 22px; }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 20px; }
.quick a {
    display: flex; align-items: center; gap: 16px; padding: 20px; color: #fff;
    border-radius: var(--radius); box-shadow: var(--shadow);
    background: linear-gradient(135deg, var(--primary) 0%, var(--navy-2) 100%);
}
.quick a:hover { text-decoration: none; filter: brightness(1.06); }
.quick a.alt { background: linear-gradient(135deg, #0d7a4c 0%, #0a5536 100%); }
.quick .q-icon { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .16); }
.quick .q-icon .icon { width: 24px; height: 24px; }
.quick strong { display: block; font-size: 16px; }
.quick small { opacity: .85; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: #f6f8fc; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.table tbody tr:hover { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td small { display: block; color: var(--muted); font-size: 12px; }
.table td.empty { padding: 36px 14px; text-align: center; color: var(--muted); white-space: normal; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-pending, .badge-hold { background: var(--warning-bg); color: var(--warning); }
.badge-process { background: var(--info-bg); color: var(--info); }
.badge-approved, .badge-active, .badge-success { background: var(--success-bg); color: var(--success); }
.badge-rejected, .badge-blocked, .badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-suspended { background: var(--violet-bg); color: var(--violet); }
.badge-role { background: #eef2f7; color: #344054; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border: 1px solid transparent; border-radius: 8px;
    font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer;
    background: #eef2f7; color: var(--text); text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.95); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; border-color: #cdd6e2; color: var(--text); }
.btn-success, .btn-status-active { background: var(--success); color: #fff; }
.btn-danger, .btn-status-blocked { background: var(--danger); color: #fff; }
.btn-status-suspended { background: var(--violet); color: #fff; }
.btn-status-hold { background: #b45309; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }

/* ---------- Forms ---------- */
.form-section { margin: 0; padding: 20px; border: 0; border-bottom: 1px solid var(--border); min-width: 0; }
.form-section legend { float: left; width: 100%; padding: 0; margin-bottom: 16px; font-size: 14px; font-weight: 700; color: var(--navy-2); }
.form-section legend + * { clear: both; }
.form-section .section-note { clear: both; margin: -8px 0 14px; color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.span-all { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.req { color: var(--danger); }
.input {
    display: block; width: 100%; padding: 10px 12px;
    font: inherit; color: var(--text); background: #fff;
    border: 1px solid #cdd6e2; border-radius: 8px;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 87, 208, .15); outline: none; }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { min-height: 84px; resize: vertical; }
input[type="file"].input { padding: 7px; }
.input[data-upper] { text-transform: uppercase; }
fieldset.bare { margin: 0; padding: 0; border: 0; min-width: 0; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.field-error { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--danger); }
.form-actions {
    display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px; background: #f9fafc; border-radius: 0 0 var(--radius) var(--radius);
}
.stack > * + * { margin-top: 14px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; margin-bottom: 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 500; }
.alert-success { background: var(--success-bg); border-color: #b5e4cd; color: #0a5a39; }
.alert-error { background: var(--danger-bg); border-color: #f7c1bb; color: #8f1d14; }
.alert-info { background: var(--info-bg); border-color: #c2d6fb; color: #0b438f; }
.alert-warning { background: var(--warning-bg); border-color: #f5d79a; color: #7a4600; }

/* ---------- Tabs, filters, pagination ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 16px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 12px 12px; margin-bottom: -1px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { margin-left: 4px; padding: 1px 8px; font-size: 11px; border-radius: 999px; background: #eef2f7; color: var(--muted); }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .input { width: auto; min-width: 180px; }
.filters .grow { flex: 1; min-width: 220px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--info-bg); color: var(--primary); font-weight: 600; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--border); }
.pagination a, .pagination span { min-width: 36px; padding: 6px 10px; text-align: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); }
.pagination a:hover { text-decoration: none; border-color: var(--primary); }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Details, documents, profile ---------- */
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px 24px; margin: 0; }
.details dt { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.details dd { margin: 3px 0 0; font-weight: 600; word-break: break-word; }
.details .wide { grid-column: 1 / -1; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 12px; color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.doc:hover { text-decoration: none; border-color: var(--primary); background: #f8fbff; }
.doc .icon { color: var(--primary); }
.doc span { min-width: 0; }
.doc strong { display: block; }
.doc small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.profile-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.profile-head h2 { font-size: 20px; }
.profile-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.profile-photo { width: 96px; height: 96px; flex: none; object-fit: cover; border-radius: 50%; background: #eef2f7; border: 3px solid #fff; box-shadow: var(--shadow); }
.profile-photo.avatar { font-size: 30px; }
.thumb { width: 100%; max-width: 220px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.empty-state { padding: 48px 20px; text-align: center; }
.empty-state h1, .empty-state h2 { margin-bottom: 8px; font-size: 20px; }
.empty-state p { color: var(--muted); }

/* ---------- Status stepper & timeline ---------- */
.stepper { display: flex; margin: 0; padding: 0; list-style: none; }
.stepper li { position: relative; flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.stepper li::before {
    content: attr(data-step); position: relative; z-index: 1;
    display: grid; place-items: center; width: 34px; height: 34px; margin: 0 auto 8px;
    border-radius: 50%; background: #e6ebf2; color: var(--muted); font-weight: 700;
}
.stepper li::after { content: ""; position: absolute; top: 16px; left: -50%; width: 100%; height: 3px; background: #e6ebf2; }
.stepper li:first-child::after { display: none; }
.stepper li.done, .stepper li.current, .stepper li.failed { color: var(--text); }
.stepper li.done::before { content: "\2713"; background: var(--success); color: #fff; }
.stepper li.current::before { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--info-bg); }
.stepper li.failed::before { content: "\2715"; background: var(--danger); color: #fff; }
.stepper li.done::after, .stepper li.current::after, .stepper li.failed::after { background: var(--success); }
.stepper li.failed::after { background: var(--danger); }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; margin-left: 6px; padding: 0 0 18px 24px; border-left: 2px solid var(--border); }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
    content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary);
}
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline p { margin: 4px 0 0; white-space: pre-line; }

/* ---------- Selfie ---------- */
.selfie { max-width: 380px; }
.selfie-stage {
    position: relative; display: grid; place-items: center; overflow: hidden;
    aspect-ratio: 4 / 3; border-radius: 10px; background: var(--navy); color: #9fb0d0;
}
.selfie-stage video, .selfie-stage img { width: 100%; height: 100%; object-fit: cover; }
.selfie-stage video { transform: scaleX(-1); }
.selfie-placeholder { display: grid; justify-items: center; gap: 8px; }
.selfie-placeholder .icon { width: 40px; height: 40px; }
.selfie-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Login & installer ---------- */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-brand {
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    padding: 48px 56px; color: #fff;
    background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 55%, var(--primary) 140%);
}
.auth-brand .brand { padding: 0; }
.auth-brand h1 { margin-bottom: 14px; font-size: 34px; }
.auth-brand p { max-width: 440px; font-size: 15px; color: #c8d3ea; }
.auth-features { display: grid; gap: 12px; margin: 28px 0 0; padding: 0; list-style: none; }
.auth-features li { display: flex; align-items: center; gap: 10px; color: #dfe7f6; }
.auth-features .icon { color: var(--gold); }
.auth-brand small { color: #9fb0d0; }
.auth-panel { display: grid; place-items: center; padding: 40px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; padding: 32px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(16, 24, 40, .08); }
.auth-card h2 { font-size: 22px; }
.auth-card .sub { margin: 6px 0 22px; color: var(--muted); }
.auth-card .field { margin-bottom: 16px; }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.plain { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.narrow { width: 100%; max-width: 520px; }
.install { max-width: 880px; margin: 0 auto; padding: 32px 16px; }
.install-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.install-head h1 { font-size: 22px; }
.checks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; }
.ok { font-weight: 700; color: var(--success); }
.fail { font-weight: 700; color: var(--danger); }
.warn { font-weight: 700; color: var(--warning); }
pre.log { margin: 8px 0 0; padding: 12px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; background: #0f172a; color: #dbe4f3; border-radius: 8px; }
details summary { cursor: pointer; color: var(--primary); font-weight: 600; }
code { padding: 1px 6px; font-size: 12px; background: #eef2f7; border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 31, 68, .5); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .auth { grid-template-columns: 1fr; }
    .auth-brand { padding: 28px 24px; }
    .auth-brand h1 { font-size: 26px; }
    .auth-features { display: none; }
}
@media (max-width: 640px) {
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .content { padding: 16px; }
    .topbar { padding: 10px 16px; gap: 10px; }
    .who, .topbar-user .btn span { display: none; }
    .form-section { padding: 16px; }
    .stepper li { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
