/* ==========================================================================
   ZCU IMPACT TRACKER — Zen Coast brand system
   Palette and type from the Zen Coast brand deck (Emma Linh, Jan 2021):
     Pure White  #FFFFFF
     Ink Black   #000023   (a blue-black, not a flat black)
     Ocean Spray #88DBDF   wash #DCF7F7
     Mariner     #0047BB
   Headlines: Garamond, "a humanist serif ... authority with warmth"
   Body:      Montserrat, "a friendly and distinctive geometric sans-serif"
   The deck's design principles are load-bearing here, not decoration:
   white space, not busy. So the surfaces stay white, the rules stay hairline,
   and Mariner is spent sparingly on the things that matter.
   ========================================================================== */
:root{
  --bg:#F4FBFB; --surface:#FFFFFF; --surface-2:#F7FCFC; --surface-3:#DCF7F7;
  --line:#CDE8EA; --line-soft:#E6F5F6;
  --ink:#000023; --ink-2:#39415C; --ink-3:#6E7590;
  --brand:#000023; --on-brand:#FFFFFF; --accent:#0047BB;
  --btn-bg:#0047BB; --btn-ink:#FFFFFF;
  /* the "gold" slots are the brand's accent slots; Ocean Spray fills them */
  --gold:#00707A; --gold-line:#88DBDF; --gold-wash:#DCF7F7;
  --good:#0E7C6B; --good-wash:#D8F2EC;
  --warn:#8A5A00; --warn-wash:#FBEED2;
  --risk:#A3271F; --risk-wash:#FADFDC;
  --focus:#0047BB;
  --shadow:0 1px 2px rgba(0,0,35,.05), 0 10px 28px -20px rgba(0,0,35,.40);
  --serif:"EB Garamond",Garamond,"Adobe Garamond Pro",Georgia,"Times New Roman",serif;
  --sans:Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
  --mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#000018; --surface:#0A0A28; --surface-2:#0E0E30; --surface-3:#13143C;
  --line:#22244F; --line-soft:#17183E;
  /* --ink-3 carries .hint and every explanatory sub-line. At #7C8AA0 it
     measured 5.34:1 on the dark ground - fine for large text, thin for the
     11px it is actually used at. Lifted to clear 7:1. */
  --ink:#EAF7F8; --ink-2:#A9C4CC; --ink-3:#93A3B8;
  --brand:#000023; --on-brand:#EAF7F8; --accent:#88DBDF;
  --btn-bg:#88DBDF; --btn-ink:#000023;
  --gold:#88DBDF; --gold-line:#2C5C63; --gold-wash:#0C2A2E;
  --good:#5FCBB4; --good-wash:#0B2F2A; --warn:#E0AE5C; --warn-wash:#33280F;
  --risk:#E58676; --risk-wash:#3A1E19; --focus:#88DBDF;
  --shadow:0 1px 2px rgba(0,0,0,.45), 0 10px 28px -20px rgba(0,0,0,.9);
}}
:root[data-theme="dark"]{
  --bg:#000018; --surface:#0A0A28; --surface-2:#0E0E30; --surface-3:#13143C;
  --line:#22244F; --line-soft:#17183E;
  /* --ink-3 carries .hint and every explanatory sub-line. At #7C8AA0 it
     measured 5.34:1 on the dark ground - fine for large text, thin for the
     11px it is actually used at. Lifted to clear 7:1. */
  --ink:#EAF7F8; --ink-2:#A9C4CC; --ink-3:#93A3B8;
  --brand:#000023; --on-brand:#EAF7F8; --accent:#88DBDF;
  --btn-bg:#88DBDF; --btn-ink:#000023;
  --gold:#88DBDF; --gold-line:#2C5C63; --gold-wash:#0C2A2E;
  --good:#5FCBB4; --good-wash:#0B2F2A; --warn:#E0AE5C; --warn-wash:#33280F;
  --risk:#E58676; --risk-wash:#3A1E19; --focus:#88DBDF;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--sans);
  font-size:14.5px;line-height:1.6;-webkit-font-smoothing:antialiased}
/* Garamond sets small and light; headings need the extra size to hold weight */
h1,h2,h3{font-family:var(--serif);letter-spacing:.005em}
h1,h2,h3{margin:0;text-wrap:balance;font-weight:400}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:3px}
.num{font-variant-numeric:tabular-nums}
[hidden]{display:none !important}

/* ---------- auth ---------- */
.auth{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.auth .panel{width:min(420px,100%);background:var(--surface);border:1px solid var(--line);
  border-top:3px solid var(--gold-line);border-radius:8px;padding:30px;box-shadow:var(--shadow)}
.auth h1{font-family:var(--serif);font-size:24px;text-align:center;margin-bottom:6px}
.auth .lede{font-size:13.5px;color:var(--ink-2);text-align:center;margin:0 0 22px}
.auth label{display:block;font-family:var(--mono);font-size:9.5px;text-transform:uppercase;
  letter-spacing:.11em;color:var(--ink-3);margin-bottom:5px}
.auth input{width:100%;background:var(--surface-2);border:1px solid var(--line);
  border-radius:4px;padding:10px 12px;font-size:15px;margin-bottom:13px}
/* --brand is Ink Black, which in dark mode is also the panel colour - the
   button vanished. --btn-bg/--btn-ink are the pair that stay legible in both
   themes: Mariner on white in light, Ocean Spray on Ink Black in dark. */
.auth .go{width:100%;background:var(--btn-bg);color:var(--btn-ink);border:1px solid var(--btn-bg);
  border-radius:4px;padding:12px;font-size:15px;cursor:pointer;margin-top:6px}
.auth .go:hover{filter:brightness(1.15)}
.auth .go[disabled]{opacity:.6;cursor:progress}
.auth .alt{text-align:center;margin-top:16px;font-size:13px;color:var(--ink-2)}
.auth .alt button{background:none;border:0;color:var(--focus);text-decoration:underline;cursor:pointer;padding:0;font-size:13px}
.msg{padding:10px 12px;border-radius:4px;font-size:13px;margin-bottom:14px}
.msg.err{background:var(--risk-wash);color:var(--risk)}
.msg.ok{background:var(--good-wash);color:var(--good)}

/* ---------- shell ---------- */
.topbar{background:var(--brand);color:var(--on-brand);border-bottom:2px solid var(--gold-line)}
.topbar .bar{max-width:1240px;margin:0 auto;padding:10px 20px;display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.topbar .mark{font-family:var(--serif);font-size:17px;letter-spacing:.02em;margin-right:auto}
.topbar .mark small{display:block;font-family:var(--mono);font-size:9.5px;text-transform:uppercase;letter-spacing:.16em;opacity:.7}
.topbar .who{font-size:12px;opacity:.8}
.btn{background:transparent;color:inherit;border:1px solid currentColor;border-radius:3px;
  padding:6px 11px;font-size:12.5px;cursor:pointer;opacity:.85}
.btn:hover{opacity:1;background:rgba(255,255,255,.1)}
.btn.solid{background:var(--btn-bg);border-color:var(--btn-bg);color:var(--btn-ink);opacity:1;font-weight:700}

nav.modules{background:var(--surface-2);border-bottom:1px solid var(--line);overflow-x:auto}
nav.modules ul{max-width:1240px;margin:0 auto;padding:6px 20px;display:flex;gap:2px;list-style:none}
nav.modules a{display:block;white-space:nowrap;font-size:12px;text-decoration:none;color:var(--ink-2);
  padding:6px 10px;border-radius:3px;font-family:var(--mono)}
nav.modules a:hover{background:var(--surface-3);color:var(--ink)}
nav.modules a.on{background:var(--brand);color:var(--on-brand)}
nav.modules a.soon{opacity:.45}

main{max-width:1240px;margin:0 auto;padding:22px 20px 60px}
.mhead{display:flex;align-items:baseline;gap:14px;margin-bottom:16px;flex-wrap:wrap}
.mhead .n{font-family:var(--mono);font-size:11px;color:var(--gold);border:1px solid var(--gold-line);
  border-radius:2px;padding:2px 7px}
.mhead h2{font-family:var(--serif);font-size:23px}
.mhead .save{margin-left:auto;font-size:12px;color:var(--ink-3)}

.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px;align-items:start}
.card{background:var(--surface);border:1px solid var(--line);border-radius:6px;box-shadow:var(--shadow);overflow:hidden}
.card > header{padding:12px 16px;border-bottom:1px solid var(--line-soft);background:var(--surface-2);
  font-family:var(--serif);font-size:16px;display:flex;align-items:baseline;gap:10px}
.card > header .hint{margin-left:auto;font-size:11.5px;color:var(--ink-3);font-family:var(--sans)}
.card .body{padding:8px 16px 14px}

.row{display:grid;grid-template-columns:minmax(0,1fr) 150px;gap:10px;align-items:center;
  padding:6px 0;border-bottom:1px solid var(--line-soft)}
.row:last-child{border-bottom:0}
.row label{font-size:13.5px}
.row .val{text-align:right;font-variant-numeric:tabular-nums;font-size:14px}
.row.out{background:linear-gradient(90deg,var(--surface-2),transparent 70%)}
.row.total{border-top:1px solid var(--line);border-bottom:0;padding-top:10px;font-weight:700}
.row.total .val{font-family:var(--serif);font-size:17px}
.row .neg{color:var(--risk)}
input.cell,select.cell,textarea.cell{width:100%;background:var(--surface);border:1px solid var(--line);
  border-radius:4px;padding:7px 9px;font-size:14px;text-align:right;font-variant-numeric:tabular-nums}
input.cell.txt,select.cell,textarea.cell{text-align:left}
textarea.cell{min-height:90px;resize:vertical;line-height:1.5}
input.cell:hover,select.cell:hover{border-color:var(--ink-3)}

table.grid-t{width:100%;border-collapse:collapse;font-size:13px}
.tblwrap{overflow-x:auto}
table.grid-t th{text-align:left;font-family:var(--mono);font-size:9px;text-transform:uppercase;
  letter-spacing:.09em;color:var(--ink-3);font-weight:400;padding:0 6px 6px;border-bottom:1px solid var(--line);white-space:nowrap}
table.grid-t td{padding:3px 6px;border-bottom:1px solid var(--line-soft)}
table.grid-t input{width:100%;min-width:80px;background:var(--surface);border:1px solid var(--line);
  border-radius:3px;padding:5px 7px;font-size:13px;text-align:right;font-variant-numeric:tabular-nums}
table.grid-t input.txt{text-align:left;min-width:120px}
table.grid-t tfoot td{font-weight:700;padding-top:8px;font-variant-numeric:tabular-nums}
.rm{background:none;border:1px solid var(--line);color:var(--ink-3);border-radius:3px;cursor:pointer;padding:3px 7px;font-size:11px}
.rm:hover{border-color:var(--risk);color:var(--risk)}
.addbtn{background:none;border:1px solid var(--line);color:var(--ink-2);border-radius:3px;
  cursor:pointer;padding:6px 11px;font-size:12.5px;margin-top:8px}
.addbtn:hover{border-color:var(--accent);color:var(--ink)}

.pill{display:inline-block;font-family:var(--mono);font-size:9px;text-transform:uppercase;
  letter-spacing:.09em;padding:2px 7px;border-radius:99px}
.pill.good{background:var(--good-wash);color:var(--good)}
.pill.warn{background:var(--warn-wash);color:var(--warn)}
.pill.risk{background:var(--risk-wash);color:var(--risk)}

.bigstat{padding:14px 16px}
.bigstat .k{font-family:var(--mono);font-size:9.5px;text-transform:uppercase;letter-spacing:.11em;color:var(--ink-3)}
.bigstat .v{font-family:var(--serif);font-size:30px;font-variant-numeric:tabular-nums;margin-top:2px}
.bigstat .sub{font-size:12px;color:var(--ink-2);margin-top:2px}

canvas.pie{width:100%;max-width:260px;height:260px;display:block;margin:0 auto}
.legend{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:5px}
.legend li{display:grid;grid-template-columns:auto 1fr auto auto;gap:8px;align-items:center;font-size:12.5px}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{display:block;width:10px;height:10px;border-radius:2px;flex:none}
.legend b{font-variant-numeric:tabular-nums;font-weight:600}
.legend .p{color:var(--ink-3);font-variant-numeric:tabular-nums;min-width:44px;text-align:right}

.note{background:var(--gold-wash);border:1px solid var(--gold-line);border-left-width:3px;
  border-radius:4px;padding:11px 14px;font-size:12.5px;color:var(--ink-2);margin:12px 0}
.note b{color:var(--ink)}
.note.good{background:var(--good-wash);border-color:var(--good)}
.note.risk{background:var(--risk-wash);border-color:var(--risk)}
.soonbox{background:var(--surface);border:1px dashed var(--line);border-radius:6px;padding:34px;text-align:center;color:var(--ink-3)}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(8px);background:var(--brand);
  color:var(--on-brand);padding:9px 16px;border-radius:4px;font-size:13px;opacity:0;pointer-events:none;
  transition:opacity .2s,transform .2s;z-index:200}
.toast.on{opacity:1;transform:translateX(-50%) translateY(0)}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* ---------- vision board collage ---------- */
.board{margin-bottom:18px}
.board .drop{
  border:2px dashed var(--line); border-radius:8px; padding:26px; text-align:center;
  color:var(--ink-3); font-size:13.5px; cursor:pointer; transition:border-color .15s, background .15s;
}
.board .drop:hover, .board .drop.over{border-color:var(--gold-line); background:var(--gold-wash); color:var(--ink-2)}
.board .drop b{display:block; font-size:15px; color:var(--ink); margin-bottom:4px; font-family:var(--serif)}
/* a real collage: uneven tiles, first one large */
.collage{
  /* auto-fit, not auto-fill: with only a few pictures the tiles stretch to
     fill the row instead of stranding on the left. */
  display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
  grid-auto-rows:120px; gap:8px; margin-bottom:12px;
}
.collage figure{
  margin:0; position:relative; overflow:hidden; border-radius:8px;
  background:var(--surface-3); border:1px solid var(--line);
}
.collage figure:nth-child(6n+1){grid-column:span 2; grid-row:span 2}
.collage figure:nth-child(6n+4){grid-row:span 2}
.collage img{width:100%; height:100%; object-fit:cover; display:block}
.collage .rmimg{
  position:absolute; top:6px; right:6px; width:24px; height:24px; border-radius:50%;
  border:0; background:rgba(9,20,29,.62); color:#fff; cursor:pointer; font-size:14px; line-height:1;
  opacity:0; transition:opacity .15s;
}
.collage figure:hover .rmimg, .collage .rmimg:focus{opacity:1}
.board .count{font-size:11.5px; color:var(--ink-3); margin-top:8px}
.board .bar{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:10px}
@media (max-width:640px){ .collage{grid-auto-rows:92px} }

/* ---------- flip analyzer: where the money goes ---------- */
.stackbar{display:flex;width:100%;height:16px;border-radius:3px;overflow:hidden;
  border:1px solid var(--line);background:var(--surface-2)}
.stackbar i{display:block;height:100%;min-width:0}

/* ==========================================================================
   THE MARK
   The Zen Coast house mark, used as the deck asks: "white space, not busy".
   It is a MASK rather than an image, so the ink follows the theme instead of
   fighting it, and it is pointer-events:none so it never swallows a click.
   ========================================================================== */
.mark-wm{
  background-color:currentColor;
  -webkit-mask-image:url(../img/zcu-mark.png); mask-image:url(../img/zcu-mark.png);
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;
  -webkit-mask-size:contain;    mask-size:contain;
  -webkit-mask-position:center; mask-position:center;
  pointer-events:none; flex:none;
}

/* --- the page's two standing marks ---------------------------------------
   Fixed, faint, and behind everything. They give the page the brand's hand
   without asking the reader to look at them. */
body::before,
body::after{
  content:""; position:fixed; z-index:0; pointer-events:none;
  background-color:var(--accent); opacity:.045;
  -webkit-mask-image:url(../img/zcu-mark.png); mask-image:url(../img/zcu-mark.png);
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;
  -webkit-mask-size:contain;    mask-size:contain;
}
body::before{ top:6vh;    right:-4vw; width:26vw; height:26vw }
body::after { bottom:-4vh; left:-4vw;  width:22vw; height:22vw }
.topbar, .auth, #appView{position:relative; z-index:1}
@media (max-width:820px){ body::before, body::after{display:none} }

/* --- the mark in the top bar --------------------------------------------- */
.topbar .mark{display:flex; align-items:center; gap:10px}
.topbar .mark .mark-wm{width:26px; height:24px; color:var(--on-brand); opacity:.92}
.topbar .mark .wordmark{display:block}

/* --- a small mark beside every module heading -----------------------------
   Sits inline after the title. An earlier version placed it under the heading,
   where it collided with the numbered badge and read as a stray glyph. */
.mhead .mark-wm.rule{
  width:16px; height:15px; color:var(--gold-line); opacity:.9;
  align-self:center; margin-left:-4px;
}

/* --- the mark on the sign-in panel ---------------------------------------- */
.auth .panel{position:relative; overflow:hidden}
.auth .panel .mark-wm.hero{
  display:block; width:52px; height:48px; margin:0 auto 14px; color:var(--accent);
}

/* --- a faint mark on the headline stat card ------------------------------- */
.bigstat{position:relative; overflow:hidden}
.bigstat .mark-wm{
  position:absolute; right:10px; bottom:6px; width:42px; height:39px;
  color:var(--accent); opacity:.05;
}

/* Card headers deliberately carry NO mark. One per card meant fifteen of them
   on a page, each bisected by the header rule - the opposite of the deck's
   "white space, not busy". The mark earns its place in the top bar, beside the
   module title, on the headline stats and behind the page. */

/* ==========================================================================
   "WHERE DID THIS NUMBER COME FROM?"
   Every cell in the year-by-year plan carries its own arithmetic. Shown on
   hover and on keyboard focus, so it is not mouse-only, and each cell also
   carries a title attribute as the last-resort fallback.
   ========================================================================== */
td.why, th.why{position:relative; cursor:help}
td.why::after{
  content:""; position:absolute; left:50%; bottom:2px; width:14px; height:1px;
  transform:translateX(-50%); background:var(--ink-3); opacity:.35;
}
.tip{
  position:absolute; left:50%; bottom:calc(100% + 8px); transform:translateX(-50%);
  width:max-content; max-width:270px; z-index:60;
  background:var(--ink); color:var(--surface); font-family:var(--sans);
  font-size:11.5px; font-weight:400; line-height:1.5; letter-spacing:0;
  text-transform:none; text-align:left; padding:8px 11px; border-radius:5px;
  box-shadow:0 6px 22px -8px rgba(0,0,35,.55);
  opacity:0; visibility:hidden; transition:opacity .12s; pointer-events:none;
}
.tip::after{
  content:""; position:absolute; top:100%; left:50%; margin-left:-5px;
  border:5px solid transparent; border-top-color:var(--ink);
}
td.why:hover .tip, td.why:focus .tip, td.why:focus-visible .tip,
th.why:hover .tip, th.why:focus .tip{opacity:1; visibility:visible}
/* the first and last columns would push a centred tip off the table */
tbody tr td.why:first-of-type .tip, thead th.why:first-of-type .tip{left:0; transform:none}
tbody tr td.why:last-child .tip, thead th.why:last-child .tip{left:auto; right:0; transform:none}
.tip::after{}
@media (max-width:820px){ .tip{max-width:210px} }
@media (prefers-reduced-motion:reduce){ .tip{transition:none} }

/* ---------- coach view: the ten-module progress dots ---------- */
.steps{display:flex; gap:3px; align-items:center}
.steps i{
  display:block; width:9px; height:9px; border-radius:2px; flex:none;
  background:var(--line); cursor:help;
}
.steps i.on{background:var(--accent)}

/* ---------- Vivid Vision walkthrough ---------- */
.videowrap{
  position:relative; width:100%; aspect-ratio:16/9; border-radius:6px; overflow:hidden;
  background:var(--surface-3); border:1px solid var(--line);
}
.videowrap iframe{position:absolute; inset:0; width:100%; height:100%; border:0}
.playbtn{
  position:absolute; inset:0; width:100%; height:100%; display:flex; gap:12px;
  align-items:center; justify-content:center; flex-direction:column;
  background:transparent; border:0; cursor:pointer; color:var(--ink);
  font-family:var(--sans); font-size:13.5px;
}
.playbtn:hover .tri{transform:scale(1.06)}
.playbtn .tri{
  width:56px; height:56px; border-radius:50%; background:var(--btn-bg);
  transition:transform .15s; position:relative;
}
.playbtn .tri::after{
  content:""; position:absolute; top:50%; left:52%; transform:translate(-50%,-50%);
  border-left:16px solid var(--btn-ink);
  border-top:10px solid transparent; border-bottom:10px solid transparent;
}
