/* Venture Scale Media — People Portal
   Hand-written so the app can ship a strict CSP (no 'unsafe-inline', no CDN). */

:root {
  --ink-900: #10141f;
  --ink-700: #2b3446;
  --ink-500: #55607a;
  --ink-400: #7b869d;
  --ink-200: #d5dae4;
  --ink-100: #e8ecf3;
  --paper:   #ffffff;
  --ground:  #f5f7fb;

  --brand-700: #23346b;
  --brand-600: #2e4489;
  --brand-500: #3a55ac;
  --brand-100: #e5eaf8;

  --accent-600: #0d7f78;
  --accent-100: #dcf1ef;

  --warn-600: #a35c07;
  --warn-100: #fdf0dc;
  --danger-600: #b03030;
  --danger-100: #fbe4e4;
  --ok-600: #1f7a45;
  --ok-100: #dff3e7;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 20, 31, .06), 0 4px 14px rgba(16, 20, 31, .05);
  --shadow-lg: 0 8px 30px rgba(16, 20, 31, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-700);
  background: var(--ground);
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink-900); line-height: 1.25; margin: 0 0 .5rem; font-weight: 620; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .85rem; }

/* ---------- layout ---------- */

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--brand-700);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 1.25rem;
  display: flex; align-items: center; gap: 1.25rem; min-height: 58px;
}
.brandmark { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 640; }
.brandmark:hover { text-decoration: none; }
.brandmark .dot {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent-600), #34b3a4);
  display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: #04211f;
}
.brandmark small { display: block; font-size: .68rem; font-weight: 500; opacity: .72; letter-spacing: .04em; text-transform: uppercase; }

.nav { display: flex; gap: .15rem; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: rgba(255, 255, 255, .82); padding: .4rem .7rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 520;
}
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255, 255, 255, .16); color: #fff; }
.nav .badge { margin-left: .35rem; }

.main { flex: 1; max-width: 1180px; width: 100%; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.main.narrow { max-width: 720px; }
.main.mid { max-width: 940px; }

.page-head { margin-bottom: 1.25rem; }
.page-head .eyebrow {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-400); font-weight: 620; margin-bottom: .2rem;
}
.page-head p { color: var(--ink-500); margin: 0; }

.footer {
  border-top: 1px solid var(--ink-200); background: var(--paper);
  padding: 1.1rem 1.25rem; font-size: .8rem; color: var(--ink-400);
}
.footer-inner { max-width: 1180px; margin: 0 auto; display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- surfaces ---------- */

.card {
  background: var(--paper); border: 1px solid var(--ink-200);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem;
  margin-bottom: 1.1rem;
}
.card > :last-child { margin-bottom: 0; }
.card-head {
  display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap;
  margin: -.15rem 0 .9rem;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { margin-left: auto; }
.card-sub { color: var(--ink-500); font-size: .875rem; margin: -.5rem 0 .9rem; }

.grid { display: grid; gap: 1.1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat { background: var(--paper); border: 1px solid var(--ink-200); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-400); font-weight: 620; }
.stat .value { font-size: 1.6rem; font-weight: 650; color: var(--ink-900); line-height: 1.15; margin-top: .15rem; }
.stat .value small { font-size: .8rem; font-weight: 520; color: var(--ink-400); }
.stat .note { font-size: .78rem; color: var(--ink-500); margin-top: .15rem; }

/* ---------- forms ---------- */

.field { margin-bottom: .95rem; }
.field > label, .field-label {
  display: block; font-size: .82rem; font-weight: 600; color: var(--ink-700); margin-bottom: .3rem;
}
.field .hint { font-size: .78rem; color: var(--ink-400); margin-top: .28rem; }
.req { color: var(--danger-600); font-weight: 600; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=url], input[type=search],
select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; color: var(--ink-900);
  background: var(--paper); border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100);
}
input[disabled], select[disabled], textarea[disabled] { background: var(--ink-100); color: var(--ink-400); }
input[type=file] { font-size: .85rem; }

.choices { display: flex; flex-direction: column; gap: .4rem; }
.choices.inline { flex-direction: row; flex-wrap: wrap; gap: .75rem; }
.choice { display: flex; align-items: flex-start; gap: .5rem; font-size: .9rem; cursor: pointer; }
.choice input { width: auto; margin: .25rem 0 0; flex: none; }

.scale { display: flex; gap: .4rem; flex-wrap: wrap; }
.scale label {
  display: grid; place-items: center; min-width: 40px; padding: .4rem .2rem;
  border: 1px solid var(--ink-200); border-radius: var(--radius-sm);
  font-size: .85rem; cursor: pointer; background: var(--paper);
}
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale input:checked + span { color: #fff; }
.scale label:has(input:checked) { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

.row { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.actions.tight { margin-top: .5rem; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; font: inherit; font-weight: 580; font-size: .9rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--brand-600); color: #fff; cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--brand-700); text-decoration: none; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--paper); color: var(--ink-700); border-color: var(--ink-200); }
.btn.ghost:hover { background: var(--ink-100); }
.btn.subtle { background: var(--brand-100); color: var(--brand-700); }
.btn.subtle:hover { background: #d6dff5; }
.btn.danger { background: var(--danger-600); }
.btn.danger:hover { background: #8f2626; }
.btn.ok { background: var(--ok-600); }
.btn.ok:hover { background: #185f36; }
.btn.small { padding: .32rem .6rem; font-size: .82rem; }
.btn.block { width: 100%; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--ink-200); border-radius: var(--radius); background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--ink-100); vertical-align: middle; }
th {
  background: var(--ground); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-500); font-weight: 650; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-400); }

/* ---------- badges & notices ---------- */

.badge {
  display: inline-block; padding: .12rem .45rem; border-radius: 99px;
  font-size: .72rem; font-weight: 620; letter-spacing: .01em;
  background: var(--ink-100); color: var(--ink-500); white-space: nowrap;
}
.badge.ok      { background: var(--ok-100);     color: var(--ok-600); }
.badge.warn    { background: var(--warn-100);   color: var(--warn-600); }
.badge.danger  { background: var(--danger-100); color: var(--danger-600); }
.badge.info    { background: var(--brand-100);  color: var(--brand-700); }
.badge.accent  { background: var(--accent-100); color: var(--accent-600); }

.notice {
  border: 1px solid var(--ink-200); border-left: 3px solid var(--ink-400);
  background: var(--paper); border-radius: var(--radius-sm);
  padding: .75rem .9rem; margin-bottom: 1rem; font-size: .89rem;
}
.notice > :last-child { margin-bottom: 0; }
.notice.ok     { border-left-color: var(--ok-600);     background: var(--ok-100); }
.notice.warn   { border-left-color: var(--warn-600);   background: var(--warn-100); }
.notice.danger { border-left-color: var(--danger-600); background: var(--danger-100); }
.notice.info   { border-left-color: var(--brand-500);  background: var(--brand-100); }
.notice strong { color: var(--ink-900); }

/* ---------- progress ---------- */

.bar { height: 7px; background: var(--ink-100); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent-600); border-radius: 99px; }
.bar.brand > span { background: var(--brand-500); }

.steps { display: flex; gap: .3rem; margin-bottom: 1.25rem; }
.steps .step { flex: 1; height: 4px; border-radius: 99px; background: var(--ink-200); }
.steps .step.done { background: var(--accent-600); }
.steps .step.now { background: var(--brand-500); }

/* ---------- module list ---------- */

.module-list { display: flex; flex-direction: column; gap: .7rem; }
.module-row {
  display: flex; align-items: center; gap: 1rem; padding: .95rem 1.1rem;
  background: var(--paper); border: 1px solid var(--ink-200); border-radius: var(--radius);
}
.module-row.locked { opacity: .62; background: var(--ground); }
.module-row .idx {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--ink-100); color: var(--ink-500); font-weight: 650; font-size: .82rem;
}
.module-row.done .idx { background: var(--ok-100); color: var(--ok-600); }
.module-row.now  .idx { background: var(--brand-600); color: #fff; }
.module-row .body { flex: 1; min-width: 0; }
.module-row .body h3 { margin: 0 0 .1rem; font-size: .95rem; }
.module-row .body p { margin: 0; font-size: .82rem; color: var(--ink-400); }

/* ---------- training content ---------- */

.sop {
  position: relative; background: var(--paper); border: 1px solid var(--ink-200);
  border-radius: var(--radius); padding: 1.6rem;
  user-select: none; -webkit-user-select: none;
}
.sop h1, .sop h2, .sop h3 { margin-top: 1.4rem; }
.sop > :first-child { margin-top: 0; }
.sop ul, .sop ol { padding-left: 1.3rem; }
.sop li { margin-bottom: .35rem; }
.sop img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.sop table { margin: 1rem 0; }

/* Per-user watermark. A determined leaker beats this; the point is that a casual
   screenshot carries the leaker's own address. */
.watermark {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 3.5rem; opacity: .045; font-size: .95rem; font-weight: 700;
  transform: rotate(-24deg); letter-spacing: .06em; color: var(--ink-900);
}
.watermark span { white-space: nowrap; }

.readbar {
  position: sticky; bottom: 0; margin-top: 1rem;
  background: var(--paper); border: 1px solid var(--ink-200); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: .85rem 1.1rem;
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
}
.readbar .status { font-size: .85rem; color: var(--ink-500); flex: 1; min-width: 180px; }

/* ---------- quiz ---------- */

.question { border-bottom: 1px solid var(--ink-100); padding: 1.1rem 0; }
.question:first-of-type { padding-top: 0; }
.question:last-of-type { border-bottom: none; }
.question .q { font-weight: 600; color: var(--ink-900); margin-bottom: .7rem; }
.question .q .n { color: var(--ink-400); font-weight: 620; margin-right: .35rem; }
.option {
  display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem;
  border: 1px solid var(--ink-200); border-radius: var(--radius-sm);
  margin-bottom: .4rem; cursor: pointer;
}
.option:hover { border-color: var(--brand-500); background: #fafbff; }
.option input { width: auto; margin: .25rem 0 0; flex: none; }
.option:has(input:checked) { border-color: var(--brand-600); background: var(--brand-100); }

/* ---------- profile ---------- */

.selfie { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: flex-start; }
.selfie video, .selfie canvas, .selfie img.shot {
  width: 260px; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  background: var(--ink-100); border: 1px solid var(--ink-200); border-radius: var(--radius);
}
.avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--ink-100); border: 1px solid var(--ink-200);
}
.avatar.lg { width: 96px; height: 96px; border-radius: var(--radius); }

.kv { display: grid; grid-template-columns: minmax(140px, 34%) 1fr; gap: .45rem .9rem; font-size: .89rem; }
.kv dt { color: var(--ink-400); font-weight: 560; }
.kv dd { margin: 0; color: var(--ink-900); overflow-wrap: anywhere; }
.kv .muted { color: var(--ink-400); font-style: italic; }

.doc-slot {
  display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem;
  border: 1px solid var(--ink-200); border-radius: var(--radius-sm); margin-bottom: .6rem;
}
.doc-slot .name { flex: 1; min-width: 0; font-size: .88rem; }
.doc-slot .name small { display: block; color: var(--ink-400); }

.diff { font-size: .85rem; }
.diff .old { color: var(--danger-600); text-decoration: line-through; }
.diff .new { color: var(--ok-600); font-weight: 560; }

.mono { font-family: var(--mono); font-size: .85em; }
.muted { color: var(--ink-400); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack { display: flex; flex-direction: column; gap: .35rem; }
.inline-list { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
hr.rule { border: none; border-top: 1px solid var(--ink-100); margin: 1.1rem 0; }

/* ---------- auth ---------- */

.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-hero {
  background: linear-gradient(150deg, var(--brand-700), #16213f 65%, #0b2d2a);
  color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center;
}
.auth-hero h1 { color: #fff; font-size: 1.9rem; max-width: 15ch; }
.auth-hero p { color: rgba(255, 255, 255, .74); max-width: 42ch; }
.auth-hero .points { margin-top: 1.75rem; display: flex; flex-direction: column; gap: .7rem; }
.auth-hero .points div { font-size: .89rem; color: rgba(255, 255, 255, .8); padding-left: 1.1rem; position: relative; }
.auth-hero .points div::before {
  content: ''; position: absolute; left: 0; top: .55em;
  width: 6px; height: 6px; border-radius: 50%; background: #34b3a4;
}
.auth-panel { display: grid; place-items: center; padding: 2rem 1.5rem; background: var(--paper); }
.auth-box { width: 100%; max-width: 360px; }
.auth-box .brandmark { color: var(--ink-900); margin-bottom: 1.5rem; }
.auth-box .brandmark small { color: var(--ink-400); }

@media (max-width: 800px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 2rem 1.5rem; }
  .auth-hero h1 { font-size: 1.5rem; }
}

/* ---------- print (CSV/PDF-ish views) ---------- */

@media print {
  .topbar, .footer, .actions, .readbar { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- training module body ----------
   The imported content pack emits a fixed, small set of classes and no inline
   styles — which is what lets it render under the strict CSP. Everything the pack
   can produce is styled here; if a new class appears in the content, it belongs in
   this block rather than in a style attribute. */

.module-slide {
  padding: 1.5rem 0;
  border-top: 1px solid var(--ink-100);
}
.module-slide:first-child { padding-top: 0; border-top: 0; }
.module-slide h3 {
  margin: 0 0 .85rem;
  font-size: 1.12rem;
  color: var(--ink-900);
  letter-spacing: -.01em;
}
.module-slide p { margin: 0 0 .8rem; color: var(--ink-700); line-height: 1.65; }
.module-slide ul { margin: 0 0 .9rem; padding-left: 1.15rem; }
.module-slide li { margin-bottom: .4rem; color: var(--ink-700); line-height: 1.6; }
.module-slide strong { color: var(--ink-900); }
.module-slide code {
  font-family: var(--mono); font-size: .88em;
  background: var(--ink-100); padding: .1em .35em; border-radius: var(--radius-sm);
}

.module-slide .lead {
  font-size: 1.02rem;
  color: var(--ink-500);
  border-left: 3px solid var(--brand-500);
  padding-left: .9rem;
}

/* Do / don't rules. The colour is a cue, never the only cue — each block keeps its
   ✓ or ✗ label, so this reads the same in monochrome or to a screen reader. */
.rule-good, .rule-bad, .rule-note {
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  margin: 0 0 .9rem;
  border-left: 3px solid;
}
.rule-good { background: var(--ok-100);     border-left-color: var(--ok-600); }
.rule-bad  { background: var(--danger-100); border-left-color: var(--danger-600); }
.rule-note { background: var(--warn-100);   border-left-color: var(--warn-600); color: var(--ink-700); }
.rule-good ul, .rule-bad ul, .rule-note ul { margin-bottom: 0; }
.rule-good .lbl, .rule-bad .lbl {
  display: block; font-weight: 600; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: .45rem;
}
.rule-good .lbl { color: var(--ok-600); }
.rule-bad .lbl  { color: var(--danger-600); }

.term-grid { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem; }
.term {
  background: var(--brand-100); color: var(--brand-700);
  border-radius: 999px; padding: .28rem .7rem; font-size: .84rem; font-weight: 500;
}
.defn { color: var(--ink-500); }

.module-figure { margin: 1rem 0 1.1rem; }
.module-img {
  max-width: 100%; height: auto; display: block;
  border: 1px solid var(--ink-200); border-radius: var(--radius-sm);
}
.module-figure figcaption {
  margin-top: .45rem; font-size: .83rem; color: var(--ink-400);
}

/* Wide tables scroll inside their own box rather than stretching the page. */
.m-table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.m-table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .89rem; }
.m-table th, .m-table td {
  border: 1px solid var(--ink-200); padding: .55rem .7rem;
  text-align: left; vertical-align: top;
}
.m-table th { background: var(--ground); color: var(--ink-900); font-weight: 600; }
