/* Company Secretarial & Regulatory Hub — corporate trust, dark navy & charcoal. Theme switchable. */
/* Contrast: every tone colour is used as TEXT on an 18% tint of itself (badges) — the values below
   are chosen so that pairing clears WCAG AA (4.5:1) in both themes. --gold-text is the gold used
   for small type (eyebrows, tags); --gold stays the button/emblem gold with dark ink on it. */
:root {
  --bg: #0b1220; --bg-2: #0f172a; --surface: #131c30; --surface-2: #1a2540; --border: #263452; --border-2: #334467;
  --text: #e8eef8; --muted: #9fb0cc; --accent: #4f8cff; --accent-2: #7fb0ff; --accent-ink: #061024;
  --ok: #34c26b; --warn: #e2a72e; --danger: #ff7a86; --info: #5aa2ff;
  --gold: #d6b25a; --gold-text: #d6b25a; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px; --radius-sm: 9px; --nav-h: 64px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3f5fa; --bg-2: #e9edf5; --surface: #ffffff; --surface-2: #f2f5fb; --border: #d9e0ec; --border-2: #c4cedf;
  --text: #0f1a2e; --muted: #56647d; --accent: #1f4fd1; --accent-2: #1a3fa8; --accent-ink: #ffffff;
  --ok: #146b36; --warn: #7a5210; --danger: #a8232e; --info: #1a4fb8; --gold: #a58330; --gold-text: #6e5514;
  --shadow: 0 10px 30px rgba(15, 26, 46, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif; overflow-x: hidden; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.price, .money, .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
svg.icon { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Header / nav ─────────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--nav-h); display: flex; align-items: center; gap: 1rem; padding: 0 clamp(1rem, 3vw, 2rem); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; min-height: 44px; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand-name { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name small { font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a { padding: .55rem .8rem; border-radius: 999px; color: var(--muted); font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--surface-2); }
.top-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { border-color: var(--border-2); }
.tabbar { display: none; }
@media (max-width: 900px) {
  .nav { display: none; }
  .tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-top: 1px solid var(--border); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .35rem .2rem; min-height: 52px; font-size: .7rem; color: var(--muted); border-radius: 10px; }
  .tabbar a.active { color: var(--accent-2); }
  .tabbar a svg { width: 22px; height: 22px; }
  main { padding-bottom: 92px; }
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
main { min-height: calc(100vh - var(--nav-h)); }
.container { width: min(1180px, 100% - 2rem); margin: 0 auto; }
.page { padding: clamp(1.25rem, 3vw, 2.5rem) 0 3rem; }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-head p { margin: 0; }
.section { margin: 2rem 0; }
.section-head { margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.25rem; display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.card.clickable { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.clickable:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-head { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.card-head h3 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.kpi { display: flex; flex-direction: column; gap: .2rem; }
.kpi .num { font-size: 2rem; font-weight: 700; }
.kpi .label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi-danger .num { color: var(--danger); } .kpi-warn .num { color: var(--warn); } .kpi-ok .num { color: var(--ok); } .kpi-info .num { color: var(--info); }

/* ── Buttons / badges / forms ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; transition: filter .15s, transform .1s; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1a1508; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 36px; padding: .35rem .8rem; font-size: .875rem; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; border: 1px solid transparent; }
.badge-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge-danger { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge-info { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.badge-muted { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; color: var(--muted); white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.input { width: 100%; min-height: 44px; padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea.input { min-height: 110px; resize: vertical; }
.check { display: flex; gap: .6rem; align-items: center; min-height: 44px; }
.check input { width: 20px; height: 20px; }
.hint { font-size: .8rem; color: var(--muted); }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.callout { padding: .9rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.callout-danger { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.callout-warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.callout-ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--radius); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 1.5rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border-2); border-left: 4px solid var(--ok); padding: .8rem 1.1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 100; max-width: min(92vw, 520px); transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-danger { border-left-color: var(--danger); } .toast-warn { border-left-color: var(--warn); }
@media (max-width: 900px) { .toast { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* ── Modal dialogs (confirm / prompt — never native dialogs) ──────────────── */
.dialog { border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.25rem 1.4rem; width: min(92vw, 520px); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(5, 9, 20, .62); backdrop-filter: blur(3px); }
.dialog-form { display: flex; flex-direction: column; gap: .6rem; }
.dialog-title { font-size: 1.2rem; margin: 0; }
.dialog-message { margin: 0; }
.dialog-actions { justify-content: flex-end; }
.dialog-error:empty { display: none; }
.dialog-error { color: var(--danger); }

/* ── Lists & tables ───────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; gap: .6rem; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.item .fw { width: 6px; align-self: stretch; border-radius: 4px; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .meta { color: var(--muted); font-size: .85rem; display: flex; gap: .6rem; flex-wrap: wrap; }
.item .side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
@media (max-width: 600px) { .item { grid-template-columns: auto 1fr; } .item .side { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; flex-wrap: wrap; align-items: center; } }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.stages { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; gap: .25rem; flex-wrap: wrap; }
.stage { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); padding: .25rem .5rem; border-radius: 999px; background: var(--surface-2); }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); }
.stage-done .stage-dot { background: var(--ok); } .stage-active { color: var(--text); border: 1px solid var(--accent); } .stage-active .stage-dot { background: var(--accent); }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button { min-height: 40px; padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font-weight: 600; }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .4rem; }
.slot { min-height: 44px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.slot[disabled] { opacity: .35; cursor: not-allowed; text-decoration: line-through; }
.slot.selected { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
pre.doc { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; max-height: 420px; overflow: auto; }
.score-ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ring) calc(var(--p) * 1%), var(--surface-2) 0); flex: none; }
.score-ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; line-height: 1.1; }
.score-ring strong { font-size: 2rem; font-variant-numeric: tabular-nums; }
.score-ring small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }

/* ── Landing ──────────────────────────────────────────────────────────────── */
.hero { position: relative; isolation: isolate; min-height: min(78vh, 720px); display: grid; align-items: center; padding: clamp(3rem, 8vw, 6rem) 0; background: url('/assets/hero-generated.webp') center / cover no-repeat; color: #fff; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(100deg, rgba(7, 13, 28, .96) 0%, rgba(7, 13, 28, .86) 45%, rgba(7, 13, 28, .45) 100%); }
.hero h1 { font-size: clamp(2.4rem, 5.4vw, 4rem); line-height: 1.05; letter-spacing: -.02em; max-width: 14ch; margin-bottom: 1rem; }
.hero .lead { font-size: clamp(1.05rem, 1.6vw, 1.3rem); max-width: 56ch; color: #d3dcec; margin-bottom: 1.75rem; }
.hero .row .btn { min-width: 160px; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--gold-text); margin-bottom: 1rem; }
.hero .eyebrow { color: #e9cf7a; }
.frameworks { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 2rem; }
.frameworks .chip { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #e5ebf5; }
.feature { gap: .5rem; }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-2); font-weight: 700; }
.feature .ico svg { width: 24px; height: 24px; }
.plan { display: flex; flex-direction: column; gap: .75rem; height: 100%; border-color: var(--gold); }
.plan .price-line { display: flex; flex-direction: column; gap: .1rem; padding: .6rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.plan .price { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; }
.plan ul { margin: 0; padding-left: 1.2rem; color: var(--muted); display: flex; flex-direction: column; gap: .35rem; }
.plan .btn { margin-top: auto; }
.steps { counter-reset: s; }
.steps .card { position: relative; padding-top: 1.5rem; }
.steps .card::before { counter-increment: s; content: counter(s, decimal-leading-zero); position: absolute; top: -.7rem; left: 1rem; background: var(--gold); color: #1a1508; font-weight: 800; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; }
footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 2rem 0 2.5rem; color: var(--muted); font-size: .9rem; }
footer .cols { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.trust { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Admin console ────────────────────────────────────────────────────────── */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-side { background: #0a1020; color: #d9e2f2; border-right: 1px solid #1c2842; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; }
[data-theme="light"] .admin-side { background: #111a2e; }
.admin-side .brand { color: #fff; padding: .25rem .25rem .75rem; border-bottom: 1px solid #1c2842; }
.admin-side nav { display: flex; flex-direction: column; gap: .2rem; }
.admin-side nav a { display: flex; align-items: center; gap: .6rem; padding: .65rem .8rem; border-radius: 10px; color: #aab8d3; font-weight: 500; min-height: 44px; }
.admin-side nav a:hover { background: #142038; color: #fff; text-decoration: none; }
.admin-side nav a.active { background: #1a2a4a; color: #fff; box-shadow: inset 3px 0 0 #d6b25a; }
.admin-side .who { margin-top: auto; font-size: .8rem; color: #8d9cba; border-top: 1px solid #1c2842; padding-top: .8rem; overflow-wrap: anywhere; }
.admin-main { min-width: 0; }
.admin-top { display: flex; align-items: center; gap: 1rem; padding: .75rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 40; }
.admin-top h1 { font-size: 1.15rem; margin: 0; }
.admin-top .ops { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.admin-tag { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); font-weight: 700; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { display: none; }
  .admin-main main { padding-bottom: 92px; }
}
.queue-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; }
@media (max-width: 700px) { .queue-item { grid-template-columns: 1fr; } }
.audit-row { display: grid; grid-template-columns: 170px 1fr; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.audit-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .audit-row { grid-template-columns: 1fr; gap: .2rem; } }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.legal { max-width: 70ch; }
