/* MyAdvisorData web screen: the theme (madai-screen-brand, the brand seat, 10-09-26; the brief
   programs/briefs/madai-screen-ultrabuild-10-09-26.md). Loaded AFTER app.css; it keeps app.css's :root set
   (--navy --navy2 --ink --mute --gold --blue --green --red --card --line) and adds the tokens below. The shell
   (madai-screen-shell) owns the markup; this file owns how it looks: the quantum background behind the nav and
   the sign-in gate only (never behind table text), glass cards, the Fraunces/Hanken type scale, an 8px grid,
   gold for the one primary action per page, focus rings, 4.5:1 text contrast, no horizontal scroll at 390px,
   and stillness under prefers-reduced-motion. Nothing here names the company or the codename. */

:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --space: 8px;
  --radius-sm: 8px; --radius-md: 14px; --radius-lg: 20px;
  --surface-0: rgba(11, 26, 46, .55);     /* glass, the page background shows through */
  --surface-1: rgba(17, 37, 64, .72);     /* a card */
  --surface-2: rgba(24, 48, 82, .86);     /* a raised card, a drawer */
  --ink-2: rgba(234, 241, 251, .78);      /* secondary text, 4.5:1 on every surface above */
  --ink-3: rgba(234, 241, 251, .62);      /* captions and labels at 15px+, never body copy */
  --line-2: rgba(255, 255, 255, .16);
  --glow: 0 0 28px rgba(228, 200, 119, .22);
  --glow-strong: 0 0 44px rgba(228, 200, 119, .34);
  --focus: 0 0 0 2px var(--navy), 0 0 0 4px var(--gold);
  --nav-w: 248px; --nav-rail: 64px;
  --text-max: 65ch;
  --t-1: 13px; --t-2: 15px; --t-3: 17px; --t-4: 22px; --t-5: 30px; --t-6: clamp(34px, 4.6vw, 52px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--navy); color: var(--ink); font-family: var(--font-body); font-size: var(--t-2); line-height: 1.5; overflow-x: hidden; }
img, svg, video { max-width: 100%; }

/* ---- the quantum field: behind the nav and the gate, never behind a table ---------------------------- */
.q-bg { position: fixed; inset: 0; z-index: -1; background: #06101b url("brand/q2_core-still.jpg") center / cover no-repeat; }  /* brand/ sits under the app docroot (next. and app.) */
.q-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(6, 16, 27, .78) 0, rgba(6, 16, 27, .9) var(--nav-w), rgba(11, 26, 46, .96) calc(var(--nav-w) + 160px), var(--navy) 100%); }
.q-bg .q-loop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
@media (prefers-reduced-motion: no-preference) { .q-bg .q-loop { opacity: .55; transition: opacity 1.8s var(--ease); } }
@media (prefers-reduced-motion: reduce), (max-width: 900px) { .q-bg .q-loop { display: none; } }  /* phones get the still only: no 1.7 MB loop on cellular */
body.gate-open .q-bg::after { background: radial-gradient(ellipse at 50% 55%, rgba(6, 16, 27, .18) 0, rgba(6, 16, 27, .62) 70%, rgba(6, 16, 27, .9) 100%); }

/* ---- type --------------------------------------------------------------------------------------------- */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 300; letter-spacing: .01em; color: #fff; margin: 0; text-wrap: balance; }
h1 { font-size: var(--t-6); line-height: 1.05; }
h2 { font-size: var(--t-5); line-height: 1.15; }
h3 { font-size: var(--t-4); line-height: 1.25; font-weight: 400; }
p { margin: 0 0 calc(var(--space) * 1.5); max-width: var(--text-max); }
.kicker, .label { font-size: var(--t-1); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #fff; }

/* ---- focus, for every control ------------------------------------------------------------------------ */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

/* ---- the left side nav: full, rail, sheet ------------------------------------------------------------ */
.sidenav { position: fixed; inset: 0 auto 0 0; width: var(--nav-w); padding: calc(var(--space) * 3) calc(var(--space) * 2);
  display: flex; flex-direction: column; gap: var(--space);
  background: var(--surface-0); border-right: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 20;
  transition: width .25s var(--ease), transform .25s var(--ease); }
.sidenav .brandrow { display: flex; align-items: center; gap: calc(var(--space) * 1.5); color: var(--blue); padding: 0 calc(var(--space) * .5); }
.sidenav .brandrow svg { width: 36px; height: 36px; flex: none; }
.sidenav .wordmark { font-family: var(--font-display); font-size: var(--t-4); font-weight: 300; color: #fff; white-space: nowrap; }
.sidenav .wordmark b { color: var(--gold); font-weight: 400; }
.sidenav .book { font-size: var(--t-1); color: var(--ink-3); margin: 0 0 calc(var(--space) * 2) 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidenav nav { display: flex; flex-direction: column; gap: 2px; }
.sidenav nav a { display: flex; align-items: center; gap: calc(var(--space) * 1.5); padding: calc(var(--space) * 1.25) calc(var(--space) * 1.5);
  border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; border-left: 3px solid transparent; font-size: var(--t-2); }
.sidenav nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidenav nav a[aria-current="page"] { background: rgba(228, 200, 119, .14); border-left-color: var(--gold); color: #fff; }
.sidenav nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidenav .me { margin-top: auto; padding-top: calc(var(--space) * 2); border-top: 1px solid var(--line); font-size: var(--t-1); color: var(--ink-2); display: flex; flex-direction: column; gap: var(--space); }
.sidenav .me .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the rail: icons only */
.sidenav.rail { width: var(--nav-rail); padding-inline: calc(var(--space) * 1); }
.sidenav.rail .wordmark, .sidenav.rail .book, .sidenav.rail nav a span, .sidenav.rail .me .email { display: none; }
.sidenav.rail nav a { justify-content: center; padding-inline: 0; }
.sidenav .toggle { position: absolute; top: calc(var(--space) * 3); right: calc(var(--space) * -2); width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
/* the page beside it */
.page { margin-left: var(--nav-w); padding: calc(var(--space) * 4) calc(var(--space) * 5) calc(var(--space) * 10); min-height: 100vh; transition: margin-left .25s var(--ease); }
body.nav-rail .page { margin-left: var(--nav-rail); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: calc(var(--space) * 2); flex-wrap: wrap; margin-bottom: calc(var(--space) * 3); }
.page-head .asof { font-size: var(--t-1); color: var(--ink-3); }
/* phones: the nav is a sheet */
@media (max-width: 900px) {
  .sidenav { transform: translateX(-100%); width: min(84vw, var(--nav-w)); }
  body.nav-open .sidenav { transform: none; box-shadow: 0 0 0 100vmax rgba(6, 16, 27, .6); }
  .sidenav .toggle { display: none; }
  .page, body.nav-rail .page { margin-left: 0; padding: calc(var(--space) * 2) calc(var(--space) * 2) calc(var(--space) * 8); }
  .topbar { display: flex; align-items: center; gap: calc(var(--space) * 1.5); padding: calc(var(--space) * 1.5) calc(var(--space) * 2); position: sticky; top: 0; z-index: 15;
    background: var(--surface-0); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
}
@media (min-width: 901px) { .topbar { display: none; } }
.topbar .menu { width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: transparent; color: var(--ink); display: grid; place-items: center; }

/* ---- glass cards -------------------------------------------------------------------------------------- */
.glass { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: calc(var(--space) * 3);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: box-shadow .25s var(--ease), border-color .25s var(--ease); }
.glass:hover, .glass:focus-within { border-color: var(--line-2); box-shadow: var(--glow); }
.glass.raised { background: var(--surface-2); }
.glass .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: calc(var(--space) * 2); margin-bottom: calc(var(--space) * 2); }
.cards { display: grid; gap: calc(var(--space) * 2); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: var(--space); }
.stat .n { font-family: var(--font-display); font-size: var(--t-6); font-weight: 300; line-height: 1; color: #fff; }
.stat .l { font-size: var(--t-1); color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
.stat .spark { height: 36px; width: 100%; color: var(--blue); }
a.cardlink { display: block; color: inherit; text-decoration: none; }
a.cardlink:focus-visible { box-shadow: var(--focus); }

/* ---- buttons: one gold primary per page -------------------------------------------------------------- */
button, .btn { font: 500 var(--t-2) var(--font-body); border-radius: calc(var(--radius-sm) + 2px); padding: calc(var(--space) * 1.25) calc(var(--space) * 2.5);
  border: 1px solid var(--line-2); background: transparent; color: var(--ink); cursor: pointer; min-height: 44px; }
button:hover, .btn:hover { background: rgba(255, 255, 255, .06); color: #fff; }
button.primary, .btn.primary { background: var(--gold); color: #1a1405; border-color: transparent; font-weight: 600; box-shadow: var(--glow); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.06); box-shadow: var(--glow-strong); }
button.ghost, .btn.ghost { border-color: transparent; color: var(--ink-2); }
button[disabled], .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ---- forms and filters ---------------------------------------------------------------------------------- */
input, select, textarea { font: var(--t-2) var(--font-body); color: var(--ink); background: rgba(255, 255, 255, .06); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: calc(var(--space) * 1.25) calc(var(--space) * 1.5); min-height: 44px; }
input::placeholder { color: var(--ink-3); }
/* a checkbox or radio is not a text field: the rule above gave it the 44 px box and the white fill David saw on the
   Contracting filter (10-09-26, "why is this checkbox so HUGE"); the native control, gold accent, inline with its label */
input[type="checkbox"], input[type="radio"] { appearance: auto; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0 8px 0 0;
  background: transparent; border: 0; border-radius: 4px; accent-color: var(--gold); vertical-align: middle; flex: 0 0 auto; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: inline-flex; align-items: center; gap: 0; white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: var(--space); align-items: center; margin-bottom: calc(var(--space) * 2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: var(--t-1); color: var(--ink-2); background: transparent; min-height: 32px; }
.chip[aria-pressed="true"], .chip.on { background: rgba(228, 200, 119, .14); border-color: rgba(228, 200, 119, .5); color: #fff; }

/* ---- tables: sticky head, sortable, 50 rows a page, amounts right ------------------------------------- */
.table-wrap { overflow: auto; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-1); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-2); }
table.data th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--ink-2); font-weight: 500; font-size: var(--t-1); letter-spacing: .08em; text-transform: uppercase;
  text-align: left; padding: calc(var(--space) * 1.5) calc(var(--space) * 2); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.data th[aria-sort] { cursor: pointer; }
table.data th[aria-sort="ascending"]::after { content: " \2191"; color: var(--gold); }
table.data th[aria-sort="descending"]::after { content: " \2193"; color: var(--gold); }
table.data td { padding: calc(var(--space) * 1.5) calc(var(--space) * 2); border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: rgba(255, 255, 255, .04); }
table.data tbody tr[tabindex]:focus-visible { outline: none; box-shadow: inset var(--focus); }
table.data .amt, table.data .pct, table.data .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .date { white-space: nowrap; }
/* ---- phones (under 720 px): a table row becomes a card (David 10-09-26 on the Connect page at phone width: a sideways
   table "won't work"). The shell writes each cell's column head into data-label (shell.js labelTables) and the card prints
   it before the value; the thead stays for assistive tech only; the wrap stops scrolling sideways. ---- */
@media (max-width: 719px) {
  .table-wrap { overflow: visible; border: 0; background: transparent; border-radius: 0; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; min-width: 0; box-sizing: border-box; }   /* app.css still pins table.data to 520 px for the desktop scroll */
  table.data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.data tr { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-1); padding: var(--space) calc(var(--space) * 1.5); margin: 0 0 calc(var(--space) * 1.25); }
  table.data td { display: flex; justify-content: space-between; align-items: baseline; gap: calc(var(--space) * 1.5); padding: calc(var(--space) * .5) 0; border-bottom: 1px solid var(--line); text-align: right; white-space: normal; }
  table.data td:last-child { border-bottom: 0; }
  table.data td:empty { display: none; }
  table.data td::before { content: attr(data-label); flex: 0 0 40%; text-align: left; color: var(--ink-3); font-size: var(--t-1); letter-spacing: .06em; text-transform: uppercase; }
  table.data td:not([data-label])::before { content: none; }
  table.data td:first-child { font-weight: 600; }
  table.data .n, table.data .amt, table.data .pct, table.data .date { white-space: normal; }
  table.data td > button, table.data td > a.btn { margin: 2px 0 2px 6px; }
  table.data tbody tr:hover { background: var(--surface-1); }
}
.pct.up { color: var(--green); } .pct.down { color: var(--red); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space); padding: calc(var(--space) * 1.5) 0; font-size: var(--t-1); color: var(--ink-2); }

/* ---- status pills ----------------------------------------------------------------------------------------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: var(--t-1); font-weight: 500; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { color: var(--green); border-color: rgba(126, 224, 164, .45); }
.pill.warn { color: var(--gold); border-color: rgba(228, 200, 119, .45); }
.pill.bad { color: var(--red); border-color: rgba(255, 138, 138, .45); }
.pill.info { color: var(--blue); border-color: rgba(120, 190, 255, .45); }

/* ---- the details drawer ------------------------------------------------------------------------------------ */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(100vw, 560px); z-index: 30; background: var(--surface-2); border-left: 1px solid var(--line-2);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: -20px 0 60px rgba(0, 0, 0, .45); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s var(--ease); }
.drawer[open], .drawer.open { transform: none; }
.drawer .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space); padding: calc(var(--space) * 3) calc(var(--space) * 3) calc(var(--space) * 2); border-bottom: 1px solid var(--line); }
.drawer .drawer-body { padding: calc(var(--space) * 3); overflow: auto; flex: 1; }
.drawer .close { width: 40px; height: 40px; border-radius: 50%; padding: 0; display: grid; place-items: center; }
.drawer-scrim { position: fixed; inset: 0; z-index: 29; background: rgba(6, 16, 27, .55); }
@media (prefers-reduced-motion: reduce) { .drawer, .sidenav, .page, .glass { transition: none; } }

/* ---- the sign-in gate: the mark, one sentence, one button, the quantum field ---------------------------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: calc(var(--space) * 3); }
.gate-card { width: min(100%, 520px); text-align: center; background: var(--surface-0); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  padding: calc(var(--space) * 5) calc(var(--space) * 5) calc(var(--space) * 4); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--glow); color: var(--blue); }
.gate-card .mark { width: 72px; height: 72px; margin: 0 auto calc(var(--space) * 2); display: block; }
.gate-card .wordmark { font-family: var(--font-display); font-size: var(--t-4); color: #fff; font-weight: 300; letter-spacing: .02em; }
.gate-card .wordmark b { color: var(--gold); font-weight: 400; }
.gate-card h1 { font-size: var(--t-5); margin: calc(var(--space) * 2) 0 calc(var(--space) * 3); }
.gate-card .primary { min-width: 180px; }
.gate-card .small { color: var(--ink-3); font-size: var(--t-1); margin: calc(var(--space) * 2) 0 0; min-height: 1.5em; }
@media (max-width: 480px) { .gate-card { padding: calc(var(--space) * 4) calc(var(--space) * 3); } }

/* ---- the never-shows footer, every page --------------------------------------------------------------- */
.never { margin-top: calc(var(--space) * 6); padding-top: calc(var(--space) * 2); border-top: 1px solid var(--line); font-size: var(--t-1); color: var(--ink-3); max-width: var(--text-max); }

/* ---- helpers on the 8px grid ------------------------------------------------------------------------------- */
.mt1 { margin-top: var(--space); } .mt2 { margin-top: calc(var(--space) * 2); } .mt3 { margin-top: calc(var(--space) * 3); } .mt4 { margin-top: calc(var(--space) * 4); }
.row { display: flex; gap: calc(var(--space) * 2); align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; gap: calc(var(--space) * 2); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the mark's animation when it is inline (David 10-09-26: "connecting the dots to the center") ---------
   brand/mark.svg animates itself once when loaded as a file. Inline in the gate or the nav, the shell gives the
   <svg> class="mark-anim" and adds .play once (on gate show, on nav mount): the 1.2 s draw on mount, then an ambient loop (David, 10-09-26:
   "Logo isn't animated either"): the strokes erase and redraw every 7 s, the nodes pulse, the core and halo breathe.
   Without .play, and under prefers-reduced-motion, the resting mark shows. Source of every copy: mark-loop.py. Classes inside the SVG: m-stroke s1..s4, m-inner,
   m-node n1..n4, m-halo, m-core. */
.mark-anim.play .m-stroke { stroke-dasharray: 36; animation: m-draw-loop 7s var(--ease) infinite }
.mark-anim.play .m-stroke.s2 { animation-delay: .12s }
.mark-anim.play .m-stroke.s3 { animation-delay: .24s }
.mark-anim.play .m-stroke.s4 { animation-delay: .36s }
.mark-anim.play .m-inner { stroke-dasharray: 30; animation: m-draw-inner-loop 7s var(--ease) infinite }
.mark-anim.play .m-node { transform-origin: center; transform-box: fill-box; animation: m-pop .4s var(--ease) both, m-pulse 7s ease-in-out 1.2s infinite }
.mark-anim.play .m-node.n2 { animation-delay: .12s, 1.32s }
.mark-anim.play .m-node.n3 { animation-delay: .24s, 1.44s }
.mark-anim.play .m-node.n4 { animation-delay: .36s, 1.56s }
.mark-anim.play .m-core { transform-origin: center; transform-box: fill-box; animation: m-bloom .5s var(--ease) .8s both, m-breathe 3.5s ease-in-out 1.3s infinite }
.mark-anim.play .m-halo { transform-origin: center; transform-box: fill-box; animation: m-halo .9s ease-out .8s both, m-halo-breathe 3.5s ease-in-out 1.7s infinite }
@keyframes m-draw-loop { 0% { stroke-dashoffset: 36 } 9% { stroke-dashoffset: 0 } 90% { stroke-dashoffset: 0 } 100% { stroke-dashoffset: 36 } }
@keyframes m-draw-inner-loop { 0%, 7% { stroke-dashoffset: 30 } 15% { stroke-dashoffset: 0 } 90% { stroke-dashoffset: 0 } 100% { stroke-dashoffset: 30 } }
@keyframes m-pop { from { opacity: 0; transform: scale(.4) } to { opacity: 1; transform: scale(1) } }
@keyframes m-pulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.18) } }
@keyframes m-bloom { from { opacity: 0; transform: scale(.3) } to { opacity: 1; transform: scale(1) } }
@keyframes m-breathe { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.08) } }
@keyframes m-halo { 0% { opacity: 0; transform: scale(.6) } 60% { opacity: .5 } 100% { opacity: .16; transform: scale(1) } }
@keyframes m-halo-breathe { 0%, 100% { opacity: .14; transform: scale(1) } 50% { opacity: .26; transform: scale(1.12) } }
@media (prefers-reduced-motion: reduce) { .mark-anim.play .m-stroke,.mark-anim.play .m-inner,.mark-anim.play .m-node,.mark-anim.play .m-core,.mark-anim.play .m-halo { animation: none } }
