:root {
  --navy: #0b1f3f;
  --navy-2: #13315c;
  --teal: #0f9d94;
  --teal-2: #14b8a6;
  --green: #1fc08a;
  --bg: #f4f7fa;
  --card: #ffffff;
  --ink: #0b1f3f;
  --muted: #5b6b82;
  --line: #e1e7ef;
  --danger: #c2410c;
  --danger-bg: #fff4ed;
  --warn-bg: #fffbeb;
  --warn: #92400e;
  --ok-bg: #ecfdf5;
  --ok: #047857;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 31, 63, .06), 0 4px 16px rgba(11, 31, 63, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.45; }
h1, h2, h3 { font-family: 'Poppins', 'Inter', sans-serif; margin: 0 0 12px; color: var(--navy); }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--teal); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ── Auth screens ── */
.auth { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(160deg, #eef6f6 0%, #f4f7fa 45%, #e9eef6 100%); }
.auth-card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); width: 100%; max-width: 440px; padding: 28px; }
.auth-card.wide { max-width: 760px; }
.auth-logo { display: block; width: 150px; height: 150px; margin: -12px auto 4px; object-fit: contain; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 18px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: linear-gradient(90deg, var(--teal), var(--green)); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.choice { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; background: #fff; text-align: left; font: inherit; color: inherit; }
.choice:hover { border-color: var(--teal-2); background: #f7fdfc; }
.choice.on { border-color: var(--teal); background: #effaf8; box-shadow: 0 0 0 3px rgba(20, 184, 166, .15); }
.choice b { display: block; font-size: 15px; margin-bottom: 4px; color: var(--navy); }
.choice span { color: var(--muted); font-size: 12.5px; }
.big-choice { padding: 20px; }
.big-choice b { font-size: 18px; }

/* ── Forms ── */
label { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 184, 166, .18); }
input[type=checkbox] { width: auto; margin-right: 6px; }
.check { display: flex; align-items: flex-start; gap: 4px; font-weight: 400; color: var(--ink); font-size: 13px; }
.field { margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; background: var(--navy); color: #fff; text-decoration: none; }
button:hover { background: var(--navy-2); }
button.primary { background: linear-gradient(90deg, var(--teal), #12a37f); }
button.primary:hover { filter: brightness(1.05); }
button.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
button.ghost:hover { background: #f1f5f9; }
button.danger { background: var(--danger); }
button.link { background: none; color: var(--teal); padding: 0; font-weight: 500; }
button.sm { padding: 5px 10px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.full { width: 100%; }
.msg { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 13px; }
.msg.err { background: var(--danger-bg); color: var(--danger); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }

/* ── App shell ── */
.app { display: flex; min-height: 100%; }
.side { width: 236px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; }
.side-brand img { width: 44px; height: 44px; object-fit: contain; }
.side-brand b { font-family: 'Poppins', sans-serif; font-size: 17px; color: var(--navy); line-height: 1; }
.side-brand small { display: block; letter-spacing: .25em; color: var(--teal); font-size: 9px; font-weight: 600; margin-top: 3px; }
.co { margin: 0 12px 10px; padding: 10px 12px; border-radius: 8px; background: var(--bg); font-size: 12.5px; }
.co b { display: block; color: var(--navy); }
.nav { padding: 4px 8px 16px; flex: 1; }
.nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; padding: 12px 10px 4px; font-weight: 600; }
.nav a { display: block; padding: 7px 10px; border-radius: 7px; color: var(--navy); text-decoration: none; font-weight: 500; }
.nav a:hover { background: #f1f5f9; }
.nav a.on { background: #e6f6f4; color: #0b766f; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; }
.main-col { flex: 1; min-width: 0; }
.main { padding: 22px 26px 60px; }
.topbar { display: none; }
@media (max-width: 860px) {
  .app { display: block; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .topbar img { width: 32px; height: 32px; }
  .main { padding: 16px 16px 60px; }
}

/* ── Cards, tables ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.card.tight > h2, .card.tight > .card-head { padding: 16px 18px 0; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border-top: 3px solid var(--teal-2); }
.kpi .v { font-family: 'Poppins', sans-serif; font-size: 21px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8fafc; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8fafc; }
tr.total td { font-weight: 700; border-top: 2px solid var(--navy); }
tr.sub td { font-weight: 600; background: #f8fafc; }
td input, td select { padding: 6px 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #e2e8f0; color: var(--navy); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--danger-bg); color: var(--danger); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; color: var(--muted); border-radius: 0; border-bottom: 2px solid transparent; padding: 8px 12px; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--teal); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* ── Modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(11, 31, 63, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 760px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.sm { max-width: 460px; }
.modal-head { display: flex; align-items: center; margin-bottom: 12px; }
.modal-head h2 { margin: 0; flex: 1; }
.x { background: none; color: var(--muted); font-size: 22px; padding: 0 6px; }
.x:hover { background: none; color: var(--navy); }

/* ── Printable tax invoice ── */
.doc { background: #fff; padding: 28px; border: 1px solid var(--line); border-radius: 8px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.doc-title { font-family: 'Poppins', sans-serif; font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: .04em; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); }
@media print {
  .side, .topbar, .no-print, .modal-head, .toast { display: none !important; }
  .modal-bg { position: static; background: none; padding: 0; }
  .modal { box-shadow: none; padding: 0; max-width: none; }
  body { background: #fff; }
  .doc { border: 0; }
}
/* plain-looking buttons keep their own look on hover */
button.link:hover { background: none; text-decoration: underline; }
.tabs button:hover { background: none; color: var(--navy); }
.choice.on:hover { background: #effaf8; }
.check + .hint { margin-bottom: 10px; }
.terms h2 { margin-top: 22px; }
.terms p, .terms li { color: var(--ink); }
.terms ul { padding-left: 20px; }
.visit-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff7ed; color: #9a3412; border-bottom: 1px solid #fed7aa; padding: 8px 26px; font-weight: 500; }
