/* Layout: slim top bar with tabs, page heading, one white working card holding a DataTables-style register; detail opens as a right-side drawer. */
:root {
  --bg: #eef2f6; --surface: #ffffff; --surface-2: #f6f8fb; --fg: #27313d; --muted: #6a7684; --line: #dde3ea;
  --accent: #2c6aae; --accent-fg: #ffffff; --accent-soft: #e6eef8;
  --t-neutral: #6f7b89; --t-info: #2c6aae; --t-indigo: #5146b8; --t-ok: #1e9a4f; --t-warn: #c4620a; --t-teal: #0d7c74; --t-done: #276749; --t-danger: #b4323a;
  --shadow: 0 1px 2px rgba(30,45,65,.06), 0 4px 16px rgba(30,45,65,.06);
  --brand-bg: #1f4f86; --brand-fg: #ffffff; --brand-muted: rgba(255,255,255,.72);
  --f-body: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11171e; --surface: #18212b; --surface-2: #1d2732; --fg: #dde4ec; --muted: #93a0ae; --line: #2a3644;
  --accent: #6aa0e2; --accent-fg: #0d1520; --accent-soft: #1d2d42;
  --t-neutral: #5d6876; --t-info: #2f69ab; --t-indigo: #5a50c4; --t-ok: #1f8a49; --t-warn: #b3590a; --t-teal: #0f736c; --t-done: #2b6b4c; --t-danger: #b03a42;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --brand-bg: #17314f; --brand-fg: #e8f0fa; --brand-muted: rgba(232,240,250,.68); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #11171e; --surface: #18212b; --surface-2: #1d2732; --fg: #dde4ec; --muted: #93a0ae; --line: #2a3644;
  --accent: #6aa0e2; --accent-fg: #0d1520; --accent-soft: #1d2d42;
  --t-neutral: #5d6876; --t-info: #2f69ab; --t-indigo: #5a50c4; --t-ok: #1f8a49; --t-warn: #b3590a; --t-teal: #0f736c; --t-done: #2b6b4c; --t-danger: #b03a42;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --brand-bg: #17314f; --brand-fg: #e8f0fa; --brand-muted: rgba(232,240,250,.68); color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1400px; margin: 0 auto; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-size: .88em; }
.muted { color: var(--muted); }

/* Top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 20px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 6px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.tab { padding: 8px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.tab:hover { color: var(--fg); background: var(--surface-2); }
.tab[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.tab .n { font-family: var(--f-mono); font-size: 12px; margin-left: 4px; opacity: .8; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 5px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--t-danger); border-color: currentColor; background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Page head */
.pagehead { background: var(--surface); border-bottom: 1px solid var(--line); }
.pagehead .wrap { padding-block: 22px 18px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 30px; font-weight: 500; color: var(--muted); letter-spacing: -.01em; line-height: 1.15; text-wrap: balance; }
.sub { color: var(--muted); font-size: 15px; margin-top: 2px; }

main .wrap { padding-block: 24px 48px; display: grid; gap: 18px; }
.notice { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; font-size: 14px; }

/* Status strip */
.strip { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px 4px 6px; cursor: pointer; font-size: 13.5px; }
.chip .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--f-mono); font-size: 11.5px; }
.chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Card + table */
.card { background: var(--surface); border-top: 3px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.field, select.field { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 7px 10px; min-width: 0; }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search { width: min(260px, 60vw); }
.btngroup { display: inline-flex; }
.btngroup .btn { border-radius: 0; }
.btngroup .btn:first-child { border-radius: 4px 0 0 4px; }
.btngroup .btn:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.info { color: var(--muted); margin: 14px 0 8px; }
.tablebox { overflow-x: auto; margin-inline: -4px; }
table { width: 100%; border-collapse: collapse; min-width: 1080px; }
th { text-align: left; vertical-align: bottom; color: var(--muted); font-weight: 600; font-size: 14.5px; padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: "⇅"; margin-left: 6px; opacity: .3; font-size: 12px; }
th[aria-sort="ascending"]::after { content: "↑"; opacity: .9; }
th[aria-sort="descending"]::after { content: "↓"; opacity: .9; }
td { padding: 14px 12px; vertical-align: middle; border-bottom: 1px solid var(--line); }
tbody tr.row:nth-child(4n+1) { background: var(--surface-2); }
.lbl { color: var(--muted); font-size: 13.5px; display: block; line-height: 1.35; }
.val { display: block; margin-bottom: 4px; }
.cons-code { display: block; }
.cons-name { color: var(--muted); font-size: 14px; text-transform: uppercase; }
.expander { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); background: var(--accent); color: var(--accent-fg); box-shadow: 0 0 0 1px var(--line); cursor: pointer; font-weight: 700; line-height: 1; padding: 0; }
.actcell { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.dd { position: relative; }
.dd-menu { position: absolute; left: 0; top: calc(100% + 4px); z-index: 4; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; box-shadow: var(--shadow); min-width: 210px; padding: 4px; }
.dd-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 4px; cursor: pointer; }
.dd-menu button:hover { background: var(--accent-soft); }
.badge { display: inline-block; color: #fff; font-weight: 600; font-size: 13px; padding: 3px 9px; border-radius: 3px; white-space: nowrap; }
.tone-neutral { background: var(--t-neutral); } .tone-info { background: var(--t-info); } .tone-indigo { background: var(--t-indigo); }
.tone-ok { background: var(--t-ok); } .tone-warn { background: var(--t-warn); } .tone-teal { background: var(--t-teal); } .tone-done { background: var(--t-done); }
.docs-meter { display: inline-flex; gap: 3px; vertical-align: middle; }
.docs-meter i { width: 8px; height: 14px; border-radius: 2px; background: var(--line); }
.docs-meter i.on { background: var(--t-ok); }
.notlodged { color: var(--t-warn); font-size: 13.5px; font-weight: 600; }
.child td { background: var(--surface); padding: 0 12px 16px 56px; }
.childgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 28px; padding-top: 12px; font-size: 14px; }
.empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.pager { display: flex; justify-content: flex-end; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager button { border: 1px solid var(--line); background: var(--surface); padding: 5px 11px; cursor: pointer; border-radius: 3px; }
.pager button[aria-current="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tnum { font-variant-numeric: tabular-nums; }

/* Form */
.form { display: grid; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
legend { font-weight: 700; font-size: 16px; padding: 0; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
legend .step { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.f { display: grid; gap: 5px; min-width: 0; }
.f > span { font-size: 13.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.f .req { color: var(--t-danger); }
.f .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.f.wide { grid-column: 1 / -1; }
textarea.field { resize: vertical; min-height: 64px; }
.upl { border: 1.5px dashed var(--line); border-radius: 6px; padding: 12px; background: var(--surface-2); display: grid; gap: 6px; }
.upl input[type=file] { font-size: 13.5px; max-width: 100%; }
.formfoot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(10,18,28,.45); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); z-index: 21; background: var(--surface); box-shadow: -8px 0 30px rgba(0,0,0,.2); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px); }
.dhead { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dhead h2 { margin: 0; font-size: 21px; font-weight: 600; }
.dbody { overflow-y: auto; padding: 18px 22px 40px; display: grid; gap: 24px; align-content: start; }
.dsec { display: grid; gap: 10px; }
.dsec h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }

.stepper { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; counter-reset: s; }
.stp { position: relative; text-align: center; font-size: 11.5px; color: var(--muted); padding-top: 30px; line-height: 1.25; }
.stp::before { content: ""; position: absolute; top: 10px; left: 0; right: 0; height: 3px; background: var(--line); }
.stp:first-child::before { left: 50%; } .stp:last-child::before { right: 50%; }
.stp .b { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 19px; height: 19px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); z-index: 1; }
.stp.done::before { background: var(--t-ok); } .stp.done .b { background: var(--t-ok); border-color: var(--t-ok); }
.stp.cur .b { border-color: var(--accent); background: var(--accent-soft); } .stp.cur { color: var(--fg); font-weight: 600; }
.stp.cur.warn .b { border-color: var(--t-warn); }
@media (max-width: 520px) { .stp { font-size: 0; } .stp.cur { font-size: 11px; } }

.doclist { display: grid; gap: 8px; }
.docrow { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; font-size: 14px; flex-wrap: wrap; }
.docrow .t { font-weight: 600; min-width: 130px; }
.docrow .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.docrow.missing { border-style: dashed; color: var(--muted); }
.docrow a { color: var(--accent); }
.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.inline .f { flex: 1 1 160px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: 12.5px; }
/* Users */
.who { display: flex; align-items: center; gap: 8px; font-size: 13.5px; text-decoration: none; color: inherit; line-height: 1.2; padding: 4px 8px; border-radius: 6px; }
.who:hover { background: var(--surface-2); }
.who .r { display: block; color: var(--muted); font-size: 12px; }
.av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }
.ch { margin: 0; font-size: 17px; font-weight: 600; }
.cardstack { display: grid; gap: 14px; }
table.users { min-width: 900px; }
table.users tbody tr:nth-child(odd) { background: var(--surface-2); }
.ucell { display: flex; align-items: center; gap: 10px; }
.em { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.results { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font-size: 14px; }
.pick .av { width: 24px; height: 24px; }
.pick[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.role-card { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: 14px; display: grid; gap: 6px; align-content: start; }
.reqrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.dotst { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--t-ok); margin-right: 6px; }
.dotst.off { background: var(--t-neutral); }
/* Sign-in screen */
.login { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); overflow: auto; }
.lg-brand { background: var(--brand-bg); color: var(--brand-fg); padding: calc(40px + env(safe-area-inset-top, 0px)) 48px 40px max(48px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 40px; }
.lg-mark { background: var(--brand-fg); color: var(--brand-bg); }
.lg-pitch { margin-top: auto; margin-bottom: auto; }
.lg-pitch h2 { margin: 0; font-size: 32px; font-weight: 600; line-height: 1.18; max-width: 17ch; text-wrap: balance; letter-spacing: -.01em; }
.lg-flow { list-style: none; counter-reset: f; padding: 0; margin: 30px 0 0; display: grid; gap: 14px; }
.lg-flow li { counter-increment: f; display: flex; gap: 12px; align-items: center; color: var(--brand-muted); }
.lg-flow li::before { content: counter(f); width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--brand-muted); display: grid; place-items: center; font-family: var(--f-mono); font-size: 12px; flex: none; }
.lg-foot { color: var(--brand-muted); font-size: 13px; }
.lg-main { display: grid; place-items: center; padding: 40px max(24px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) 24px; }
.lg-card { width: min(420px, 100%); display: grid; gap: 18px; }
.lg-h { margin: 0; font-size: 28px; font-weight: 600; color: var(--fg); }
.lg-id { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 14px; min-width: 0; }
.lg-id img { width: 48px; height: 48px; border-radius: 50%; flex: none; background: var(--line); }
.lg-id b { display: block; font-size: 16.5px; overflow-wrap: anywhere; }
.lg-go { width: 100%; justify-content: center; padding: 11px 16px; font-size: 16px; }
.lg-small { font-size: 13px; color: var(--muted); }
.lg-warn { border-left: 3px solid var(--t-warn); padding: 8px 12px; background: var(--surface); font-size: 14.5px; }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lg-brand { padding: calc(22px + env(safe-area-inset-top, 0px)) 20px 22px max(20px, env(safe-area-inset-left, 0px)); gap: 14px; }
  .lg-pitch h2 { font-size: 21px; max-width: none; }
  .lg-flow, .lg-foot { display: none; }
  .lg-main { place-items: start center; padding-top: 28px; }
}
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 6px; z-index: 40; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: no-preference) { .drawer { animation: slide .18s ease-out; } @keyframes slide { from { transform: translateX(30px); opacity: .6; } } }
@media (max-width: 640px) { h1 { font-size: 24px; } .card { padding: 16px; } .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dd { margin-bottom: 8px; } }
