/* ==========================================================
   Cambodia SME Business Cycle Support System — Prototype
   Light, professional, government-friendly theme
   ========================================================== */

:root {
  --primary: #123c73;        /* government-style dark blue */
  --primary-600: #1c4f8f;
  --primary-50: #e9f0fa;
  --teal: #0f8a8a;
  --teal-50: #e3f4f4;
  --success: #1d9a4b;
  --success-50: #e6f6ec;
  --warning: #e0851a;
  --warning-50: #fdf1e2;
  --danger: #d33a3a;
  --danger-50: #fce9e9;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e7ee;
  --text: #1e2a3a;
  --muted: #6b7a90;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(18, 60, 115, 0.06), 0 1px 6px rgba(18, 60, 115, 0.05);
  --sidebar-w: 236px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0 0 8px; }
a { color: var(--primary-600); }
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.right { text-align: right; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.8; flex-shrink: 0; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(180deg, #eef3fa 0%, var(--bg) 100%); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px 36px; max-width: 1080px; width: 100%; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.logo { width: 52px; height: 52px; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 16px; letter-spacing: 0.5px; flex-shrink: 0; }
.logo.sm { width: 38px; height: 38px; font-size: 12px; border-radius: 9px; }
.login-title { font-size: 20px; font-weight: 700; color: var(--primary); }
.login-sub { color: var(--muted); font-size: 13px; }
.login-lead { font-size: 15px; color: var(--teal); font-weight: 600; margin: 8px 0 16px; }
.cycle-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 24px; }
.cycle-mini span { background: var(--primary-50); color: var(--primary); padding: 5px 10px; border-radius: 20px; font-weight: 500; }
.cycle-mini i { color: var(--muted); font-style: normal; }
.login-roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.role-btn { background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 22px 16px; cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: all .15s; color: var(--text); }
.role-btn svg { width: 30px; height: 30px; color: var(--primary); }
.role-btn b { font-size: 14px; letter-spacing: 0.4px; }
.role-btn small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.role-btn:hover { border-color: var(--primary); background: var(--primary-50); }
.login-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; font-size: 12px; color: var(--muted); flex-wrap: wrap; gap: 8px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--primary); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.sidebar-brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand .logo { background: #fff; color: var(--primary); }
.brand-name { font-weight: 600; font-size: 13.5px; }
.brand-role { font-size: 11.5px; opacity: .75; }
.nav { padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: rgba(255,255,255,.85); background: transparent; border: none; cursor: pointer; font-size: 13.5px; text-align: left; width: 100%; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-item .pill { margin-left: auto; background: var(--warning); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.12); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; height: 58px; display: flex; align-items: center; justify-content: space-between; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-weight: 600; font-size: 15px; }
.role-chip { background: var(--teal-50); color: var(--teal); font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-50); color: var(--primary); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-sub { font-size: 11.5px; color: var(--muted); }
.icon-btn { background: transparent; border: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; position: relative; display: inline-flex; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.badge { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.notif-panel { position: absolute; top: 58px; right: 24px; width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 8px; max-height: 420px; overflow-y: auto; }
.notif-item { padding: 10px; border-radius: 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--primary-50); }
.notif-item .t { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.content { padding: 24px; max-width: 1400px; width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; color: var(--primary); }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title .lnk { font-size: 12.5px; font-weight: 500; color: var(--primary-600); cursor: pointer; background: none; border: none; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }
.g6 { grid-template-columns: repeat(6, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.mt16.grid, .grid + .grid, .grid + .card, .card + .grid { margin-top: 16px; }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--text); }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.teal .v { color: var(--teal); }
.kpi.blue .v { color: var(--primary); }
.kpi.green .v { color: var(--success); }
.kpi.orange .v { color: var(--warning); }
.kpi.red .v { color: var(--danger); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; font-size: 13px; font-weight: 500; cursor: pointer; background: var(--primary); color: #fff; white-space: nowrap; }
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--primary-600); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-teal { background: var(--teal); }
.btn-teal:hover { background: #0c7373; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #167d3c; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #c47214; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b52d2d; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-50); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: inherit; }
.sidebar .btn-ghost { color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.25); }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #eef1f5; color: var(--muted); }
.chip-success, .chip-Paid, .chip-Accepted, .chip-Active, .chip-Verified, .chip-Complete, .chip-Resolved, .chip-Good, .chip-Positive, .chip-Compliant, .chip-Closed { background: var(--success-50); color: var(--success); }
.chip-warning, .chip-Pending, .chip-Draft, .chip-Overdue, .chip-Open, .chip-Attention, .chip-High, .chip-Medium { background: var(--warning-50); color: var(--warning); }
.chip-danger, .chip-Failed, .chip-Cancelled, .chip-Correction, .chip-Incomplete, .chip-Critical, .chip-Urgent { background: var(--danger-50); color: var(--danger); }
.chip-info, .chip-Submitted, .chip-Issued, .chip-Under, .chip-Ready, .chip-Progress, .chip-Available, .chip-Waiting, .chip-Low { background: var(--primary-50); color: var(--primary); }
.chip-teal { background: var(--teal-50); color: var(--teal); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td:first-child { white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-50); border-color: var(--primary-600); }
.field input[readonly] { background: var(--bg); color: var(--muted); }
.field textarea { min-height: 74px; resize: vertical; }
.form-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Definition list ---------- */
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.dl div { display: flex; flex-direction: column; }
.dl dt { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.dl dd { margin: 0; font-size: 13.5px; }
.dl.one { grid-template-columns: 1fr; }

/* ---------- Stepper (6-stage cycle) ---------- */
.stepper { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px; cursor: pointer; position: relative; box-shadow: var(--shadow); }
.step:hover { border-color: var(--primary-600); }
.step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; margin-bottom: 8px; }
.step.complete .n { background: var(--success); color: #fff; }
.step.active .n { background: var(--primary); color: #fff; }
.step .name { font-weight: 600; font-size: 13px; }
.step .st { font-size: 11.5px; margin-top: 3px; }
.step.complete .st { color: var(--success); }
.step.active .st { color: var(--primary); }
.step.pending .st { color: var(--warning); }
.step.available .st { color: var(--teal); }
.step::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); color: #c3cbd6; font-size: 14px; background: var(--bg); padding: 0 1px; }
.step:last-child::after { display: none; }

/* ---------- Workflow (horizontal steps) ---------- */
.wf { display: flex; align-items: stretch; gap: 0; }
.wf-step { flex: 1; padding: 10px 12px; border: 1px solid var(--border); background: var(--surface); position: relative; font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.wf-step:first-child { border-radius: 8px 0 0 8px; }
.wf-step:last-child { border-radius: 0 8px 8px 0; }
.wf-step .dot { width: 22px; height: 22px; border-radius: 50%; background: #eef1f5; color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.wf-step.done { background: var(--success-50); }
.wf-step.done .dot { background: var(--success); color: #fff; }
.wf-step.current { background: var(--primary-50); font-weight: 600; }
.wf-step.current .dot { background: var(--primary); color: #fff; }

/* ---------- Checklist / lists ---------- */
.check li { list-style: none; display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.check { padding: 0; margin: 0; }
.check li:last-child { border-bottom: none; }
.check svg { color: var(--success); width: 17px; height: 17px; }
.check li.no svg { color: var(--muted); }
.list { padding: 0; margin: 0; list-style: none; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 13.5px; }
.list li:last-child { border-bottom: none; }
.list .sub { color: var(--muted); font-size: 12px; }

/* ---------- Alerts ---------- */
.alert { border-radius: 10px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; border: 1px solid; margin-bottom: 16px; }
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--primary-50); border-color: #c9d9ee; color: var(--primary); }
.alert-success { background: var(--success-50); border-color: #bfe5cc; color: #146b35; }
.alert-warning { background: var(--warning-50); border-color: #f4d7ab; color: #9a5a0f; }
.alert-danger { background: var(--danger-50); border-color: #f2c4c4; color: #9c2727; }
.note { font-size: 12px; color: var(--muted); font-style: italic; }

/* ---------- Module menu (Accounting) ---------- */
.modules { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.module { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.module:hover { border-color: var(--teal); }
.module svg { color: var(--teal); width: 22px; height: 22px; }
.module b { font-size: 13px; }
.module small { color: var(--muted); font-size: 11.5px; }

/* ---------- Opportunity / health ---------- */
.health-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.health-row:last-child { border-bottom: none; }
.health-row b { font-weight: 500; }
.opp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.opp svg { color: var(--primary); width: 24px; height: 24px; }
.opp b { font-size: 14px; }
.opp p { color: var(--muted); font-size: 12.5px; flex: 1; }

/* ---------- Charts (simple bars, no library) ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding: 8px 4px 0; border-bottom: 1px solid var(--border); }
.bar-group { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 100%; }
.bar { width: 22px; border-radius: 4px 4px 0 0; background: var(--primary); position: relative; }
.bar.b2 { background: var(--teal); }
.bar.b3 { background: var(--warning); }
.bar-labels { display: flex; gap: 14px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.hbar { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin: 6px 0; }
.hbar .lab { width: 130px; color: var(--muted); }
.hbar .trk { flex: 1; background: #eef1f5; height: 10px; border-radius: 5px; overflow: hidden; }
.hbar .fil { height: 100%; background: var(--teal); border-radius: 5px; }
.hbar .val { width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.progress { background: #eef1f5; height: 8px; border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--success); }

/* ---------- Data architecture diagram ---------- */
.flow { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.flow-box { border: 1.5px solid var(--primary); border-radius: 10px; padding: 10px 18px; background: var(--primary-50); color: var(--primary); font-weight: 600; text-align: center; min-width: 260px; font-size: 13px; }
.flow-box.teal { border-color: var(--teal); background: var(--teal-50); color: var(--teal); }
.flow-box.gdt { background: var(--primary); color: #fff; }
.flow-box small { display: block; font-weight: 400; font-size: 11.5px; margin-top: 2px; opacity: .85; }
.flow-src { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.flow-src span { border: 1px solid var(--border); background: #fff; padding: 6px 12px; border-radius: 20px; font-size: 12.5px; }
.flow-arrow { color: var(--muted); font-size: 18px; line-height: 1; }
.flow-out { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.flow-out span { background: var(--teal-50); color: var(--teal); padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }

/* ---------- Conversation ---------- */
.convo { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; }
.msg .who { font-size: 11px; font-weight: 700; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .3px; }
.msg .t { font-size: 11px; opacity: .7; margin-top: 4px; }
.msg.sme { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); }
.msg.support { align-self: flex-end; background: var(--primary-50); color: var(--primary); }
.msg.internal { align-self: stretch; max-width: 100%; background: var(--warning-50); border: 1px dashed #e8c48f; font-size: 12.5px; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); margin-left: 8px; }
.timeline li { position: relative; padding: 0 0 14px 18px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; }
.timeline .d { color: var(--muted); font-size: 11.5px; }

/* ---------- Invoice preview / receipt ---------- */
.doc { background: #fff; border: 1px solid var(--border); padding: 26px 30px; font-size: 13px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 14px; }
.doc-head h2 { color: var(--primary); font-size: 20px; }
.doc table th { background: var(--bg); }
.qr { width: 90px; height: 90px; border: 2px dashed var(--muted); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 10px; color: var(--muted); border-radius: 6px; background: repeating-linear-gradient(45deg, #fff 0 6px, #f1f3f6 6px 12px); }
.stamp { display: inline-block; border: 2px solid var(--success); color: var(--success); font-weight: 800; padding: 4px 12px; border-radius: 6px; letter-spacing: 2px; transform: rotate(-4deg); }
.receipt-total { font-size: 22px; font-weight: 700; color: var(--primary); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 9px 14px; border: none; background: transparent; cursor: pointer; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Payment method picker ---------- */
.methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.method { border: 1.5px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.method:hover, .method.sel { border-color: var(--primary); background: var(--primary-50); }
.method svg { color: var(--primary); }
.method b { display: block; font-size: 13.5px; }
.method small { color: var(--muted); font-size: 11.5px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(18, 42, 74, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-box.wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 20px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.ok { background: var(--success); }

/* ---------- Print ---------- */
@media print {
  body * { visibility: hidden; }
  #modal, #modal * { visibility: visible; }
  #modal { position: absolute; inset: 0; background: #fff; padding: 0; }
  .modal-head, .no-print { display: none !important; }
  .modal-box { box-shadow: none; max-width: 100%; max-height: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g6 { grid-template-columns: repeat(3, 1fr); }
  .g5 { grid-template-columns: repeat(3, 1fr); }
  .modules { grid-template-columns: repeat(3, 1fr); }
  .stepper { grid-template-columns: repeat(3, 1fr); }
  .step::after { display: none; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .g4, .g3 { grid-template-columns: repeat(2, 1fr); }
  .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
  .login-roles { grid-template-columns: 1fr; }
  .wf { flex-wrap: wrap; }
  .wf-step { min-width: 45%; }
  .user-chip > div { display: none; }
}

/* ==========================================================
   Business Registration portal · Review period · Ledger links
   ========================================================== */
.chip-Approved, .chip-Passed, .chip-Match, .chip-Clear, .chip-Shared, .chip-Consented, .chip-Attached { background: var(--success-50); color: var(--success); }
.chip-Rejected, .chip-Missing, .chip-Unpaid { background: var(--danger-50); color: var(--danger); }
.chip-Unpaid { background: var(--warning-50); color: var(--warning); }
.chip-Information, .chip-Checking, .chip-Due { background: var(--warning-50); color: var(--warning); }
.chip-New { background: var(--primary-50); color: var(--primary); }
.chip-Not { background: #eef1f5; color: var(--muted); }
.req { color: var(--danger); font-size: 11px; font-weight: 600; }

/* review period bar */
.range-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.range-bar svg { color: var(--primary); }
.range-bar input[type=date] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font: inherit; font-size: 13px; color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: none; background: #fff; padding: 6px 11px; font-size: 12.5px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--bg); color: var(--text); }
.seg button.on { background: var(--primary); color: #fff; font-weight: 600; }
.bars.dense { gap: 3px; }
.bars.dense .bar { width: 7px; }
.bars.dense .bar-group { gap: 1px; }
.bar-labels.dense { gap: 3px; }
.bar-labels.dense span { font-size: 9.5px; }

/* wizard */
.reg-wf .wf-step { cursor: pointer; font-family: inherit; color: var(--text); text-align: left; }
.reg-wf .wf-step:hover { background: var(--bg); }
.kyc-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; }
.photo-up { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.photo-up img, .photo-up .ph { width: 96px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.photo-up.big img, .photo-up.big .ph { width: 150px; height: 175px; }
.photo-up .ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 11px; border-style: dashed; text-align: center; }
.photo-up .ph svg { width: 30px; height: 30px; }
.photo-up label { cursor: pointer; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doc-row:last-child { border-bottom: none; }
.doc-row b { font-weight: 600; font-size: 13px; }
.doc-ic { width: 34px; height: 34px; border-radius: 8px; background: var(--bg); color: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-ic.ok { background: var(--success-50); color: var(--success); }
.doc-row label { cursor: pointer; }
.kyc-check { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; }
.kyc-check > div:first-child { display: flex; align-items: center; gap: 10px; }
.kyc-check svg { color: var(--primary); }
.sh-card { display: flex; gap: 16px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: #fcfdfe; }
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sh-mini { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: 9px; padding: 10px; }
.sh-mini img, .mini-photo { width: 52px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; }
.mini-photo.sm { width: 28px; height: 32px; }
.mini-photo.ph { display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--bg); }
.consent { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; }
.consent.on { border-color: var(--teal); background: var(--teal-50); }
.consent svg { color: var(--teal); }
.consent input[type=checkbox] { margin-top: 3px; }
.rev { border: 1px solid var(--border); border-radius: 9px; padding: 12px; font-size: 13px; }
.rev-h { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 8px; }
.rev-h .lnk, .lnk { background: none; border: none; color: var(--primary-600); cursor: pointer; font-size: 12px; font-weight: 500; text-transform: none; }
.sigpad { width: 100%; max-width: 520px; height: 170px; border: 1.5px dashed var(--primary-600); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sig-done { border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: #fff; max-width: 520px; }
.sig-done img { max-width: 100%; height: 110px; object-fit: contain; display: block; }
.sig-script { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 34px; color: var(--primary); padding: 22px 10px; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd6df; border-radius: 22px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::before { transform: translateX(18px); }
.cert { border: 3px double var(--primary); }
@media (max-width: 1200px) { .login-roles { grid-template-columns: repeat(2, 1fr); } .kyc-grid { grid-template-columns: 1fr; } }
.doc-row .grow { flex: 1 1 200px; min-width: 0; }
.kyc-grid { grid-template-columns: 320px 1fr; }
.applicant-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 12px; font-size: 13px; }
.auth-card { max-width: 440px; margin: 40px auto; padding: 28px; }
.chip-Pending { background: var(--warning-50); color: var(--warning); }
