/* ============================================================================
   GTMN Portal — design system (mockup, round 2)

   Direction after Rafael's notes:
   - The orb is no longer a solid gold ball. It is an APERTURE, modelled on
     "The Entity": a dark pupil, dense radiating filaments, concentric rings,
     a gold rim glow. It reads as something looking back at you.
   - HUD language borrowed from the Jarvis reference: corner brackets, hairline
     tick rails, ring gauges, waveforms, monospace readouts, sweeping beams.
   - Palette stays cream + gold (Rafael: "as cores estao boas"), with a Night
     theme available on every screen via the Day/Night switch.
   - UI language is ENGLISH everywhere by design. No emoji anywhere: every icon
     is an inline SVG injected by app.js.
   ========================================================================== */

:root {
  /* Paper */
  --cream-0: #fdfbf6;
  --cream-1: #f8f4ea;
  --cream-2: #f2ece0;
  --cream-3: #e9e1d1;
  --line: #e3dac6;
  --line-soft: #efe8da;
  --field-bg: #ffffff;

  /* Ink */
  --ink-0: #1c1913;
  --ink-1: #3c352a;
  --ink-2: #6d6353;
  --ink-3: #9a9081;

  /* Gold */
  --gold-0: #b8912a;
  --gold-1: #cda63a;
  --gold-2: #e6c76a;
  --gold-3: #f5e3ab;
  --glow: rgba(205, 166, 58, 0.28);

  /* Status */
  --ok: #4a7c59;
  --warn: #b07d29;
  --stop: #a8503f;
  --info: #4a6b8a;

  /* Round 3: sharper geometry. Soft rounded rectangles read "web app"; a
     3px radius with cut corners and bracket frames reads "instrument". */
  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;
  --cut: 11px; /* corner notch depth for .cut panels */
  --shadow-1: 0 1px 2px rgba(60, 53, 42, 0.05), 0 1px 3px rgba(60, 53, 42, 0.04);
  --shadow-2: 0 4px 16px rgba(60, 53, 42, 0.08), 0 1px 3px rgba(60, 53, 42, 0.05);
  --shadow-3: 0 18px 50px rgba(60, 53, 42, 0.16);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* Night theme — same layout, same gold, inverted paper. */
html[data-theme="night"] {
  --cream-0: #12100b;
  --cream-1: #0a0906;
  --cream-2: #1b1710;
  --cream-3: #262015;
  --line: #322a1a;
  --line-soft: #241e14;
  --field-bg: #0e0c08;

  --ink-0: #f4eddc;
  --ink-1: #dbd2bd;
  --ink-2: #9d9179;
  --ink-3: #6f6555;

  --gold-0: #cda63a;
  --gold-1: #e6c76a;
  --gold-2: #f5e3ab;
  --gold-3: #fff7e0;
  --glow: rgba(230, 199, 106, 0.34);

  --ok: #6ba87c;
  --warn: #d3a04a;
  --stop: #d1705c;
  --info: #6f9ac2;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 4px 18px rgba(0, 0, 0, 0.55);
  --shadow-3: 0 18px 50px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--cream-1);
  color: var(--ink-0);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* --- Icons ---------------------------------------------------------------- */
/* Never emoji. app.js injects an SVG sprite; pages reference it with <use>.   */

.icn {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}
.icn.xs { width: 12px; height: 12px; vertical-align: -2px; }
.icn.sm { width: 13px; height: 13px; }
.icn.lg { width: 18px; height: 18px; vertical-align: -4px; }
.icn.xl { width: 22px; height: 22px; }

/* File-type badge — replaces the document emoji entirely */
.ftype {
  font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 5px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--cream-2); color: var(--ink-2); text-transform: uppercase;
  flex: none; min-width: 34px; text-align: center;
}
.ftype.pdf  { color: #a8503f; border-color: rgba(168,80,63,.35);  background: rgba(168,80,63,.08); }
.ftype.xls  { color: #4a7c59; border-color: rgba(74,124,89,.35);  background: rgba(74,124,89,.08); }
.ftype.doc  { color: #4a6b8a; border-color: rgba(74,107,138,.35); background: rgba(74,107,138,.08); }
.ftype.ppt  { color: #b07d29; border-color: rgba(176,125,41,.35); background: rgba(176,125,41,.08); }
.ftype.img  { color: #7a5f10; border-color: rgba(205,166,58,.35); background: rgba(205,166,58,.10); }

/* One document in a Companies or Deals drawer (#75), and the control that takes it off again (#77).

   The class predates the rule. The mockup and then the product both emitted `.docrow` with a
   `.spacer` inside it, and with no `display:flex` here the spacer collapsed to nothing and the date
   sat against the end of the filename instead of at the right edge. Adding the rule is what makes
   the markup that already shipped mean what it reads as. */
.docrow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 2px; flex: 1 1 auto; min-width: 0;
}
.docrow .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.docrow:hover { background: var(--cream-1); }

/* A search result in the "add somebody to this company" picker (#78). It is a <button> wearing a
   class named for a row, and deliberately so: it has to read as one of the roster rows above it —
   same avatar, same name, same job title, same column — while being a control rather than a link,
   because clicking it changes data instead of going somewhere.

   `font` and `color` are the load-bearing pair. A <button> does not inherit either from its parent;
   without these two lines the hits come out in the browser's system font at 13.3px next to roster
   rows in the portal's, which is exactly the kind of difference that reads as a broken page rather
   than as a different control. `all: unset` would do it in one word and is avoided: it also throws
   away the focus ring and the disabled styling, both of which are wanted here. */
button.docrow {
  width: 100%; background: none; border: 0;
  text-align: left; cursor: pointer;
  font: inherit; color: inherit;
}
/* Not `:hover` alone. Somebody already on the roster is still drawn — hiding them would read as
   "not in the address book", the one wrong answer a search box can give — but they are disabled,
   and a highlight under a pointer that cannot click is an invitation to keep pressing. */
button.docrow:hover:not(:disabled) { background: var(--cream-1); }
button.docrow:disabled { opacity: .55; cursor: default; }

/* The row PLUS its remove control. They are siblings and not nested, because the row is an <a> when
   the document can be opened, and a <button> inside an <a> is invalid HTML that browsers resolve by
   guessing — usually into a click that both removes the document and navigates away from the proof. */
.docline { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line-soft); }
.docline:last-child { border-bottom: 0; }

/* Held at low contrast until the pointer is on the row: this is a destructive-LOOKING control on a
   list he mostly reads, and a permanent column of crosses would make the section read as a delete
   queue rather than a shelf. `opacity` rather than `display` so nothing reflows when it appears, and
   full opacity on :focus-visible so it stays reachable from a keyboard, where there is no hover. On
   touch there is no hover at all, so it is dimmed-but-present instead of invisible. */
.docline .docx { opacity: 0; transition: opacity .12s ease; flex: none; }
.docline:hover .docx, .docline .docx:focus-visible { opacity: 1; }
@media (hover: none) { .docline .docx { opacity: .55; } }

/* Armed, waiting for the second press. Full opacity regardless of where the pointer is — a control
   that is one click from acting must not be able to fade out while it is still live — and the word
   in it carries the meaning, so `.btn.icon`'s 25px is dropped rather than clipping "Remove?". */
.docline .docx.armed { opacity: 1; width: auto; padding: 0 8px; color: var(--stop); border-color: var(--stop); }

/* --- Brand ---------------------------------------------------------------- */

.wordmark {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-0);
}
.wordmark span { color: var(--gold-0); }

/* --- The Entity — a sphere of filaments, not an eye ------------------------

   Round 4. The shape itself is drawn by app.js into a <canvas>; all this rule
   does is hold the well it sits in — a dark body so the gold has something to
   burn against, and the glow it throws. The body stays dark in BOTH themes: it
   is a light source, not a surface.

   No crisp outline. A 1px ring around a radial field is half of what made the
   old orb read as an iris, and the canvas now frays its own silhouette, so any
   hard circle here would just draw the eye back. Only diffuse bloom. */

/* Gold filaments need a dark field behind them, so the well stays dark in both
   themes — but it has to fade out before the rim. An opaque circle with gold
   inside it is a bezel, and this is supposed to be suspended, not mounted. No
   ring shadows either: concentric rings around a round thing are the one cue
   guaranteed to rebuild an iris. Diffuse bloom only.

   Day and Night need different falloffs. Over cream, a long low-alpha tail
   mixes to grey and the orb reads as a smudge, so Day stays near-opaque and
   does the whole fade in the last sixth. Over near-black there is nothing to
   mix with, so Night can start dissolving at 40% and disappear completely. */
.orb {
  position: relative;
  width: var(--orb, 56px);
  height: var(--orb, 56px);
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle,
    rgba(16, 12, 6, .98) 0%,
    rgba(12, 9, 4, .97) 66%,
    rgba(9, 7, 3, .82) 84%,
    rgba(6, 5, 2, .34) 94%,
    rgba(4, 3, 1, 0) 100%);
  box-shadow: 0 0 30px rgba(205, 166, 58, .30), 0 0 76px rgba(205, 166, 58, .12);
}

html[data-theme="night"] .orb {
  background: radial-gradient(circle,
    rgba(9, 6, 2, .96) 0%,
    rgba(8, 5, 2, .90) 40%,
    rgba(6, 4, 1, .58) 70%,
    rgba(4, 3, 0, .20) 87%,
    rgba(3, 2, 0, 0) 100%);
  box-shadow: 0 0 34px var(--glow);
}

.orb-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.orb.is-listening { animation: entity-alive 2.6s ease-in-out infinite; }
@keyframes entity-alive {
  0%, 100% { box-shadow: 0 0 34px var(--glow); }
  50%      { box-shadow: 0 0 62px rgba(205, 166, 58, .55); }
}

.orb.lg { --orb: 168px; }
.orb.sm { --orb: 24px; box-shadow: 0 0 14px var(--glow); }

@media (prefers-reduced-motion: reduce) { .orb.is-listening { animation: none; } }

/* --- HUD furniture -------------------------------------------------------- */

/* Corner brackets — the Jarvis frame cue. Round 3: all FOUR corners, drawn as
   two full-width rules masked down to 14px stubs at each end. */
.hud { position: relative; }
.hud::before, .hud::after {
  content: ""; position: absolute; left: -1px; right: -1px; height: 14px;
  pointer-events: none; border: 1px solid var(--gold-1); opacity: .55;
  -webkit-mask: linear-gradient(90deg, #000 0 14px, transparent 14px calc(100% - 14px), #000 calc(100% - 14px) 100%);
          mask: linear-gradient(90deg, #000 0 14px, transparent 14px calc(100% - 14px), #000 calc(100% - 14px) 100%);
}
.hud::before { top: -1px; border-bottom: 0; }
.hud::after  { bottom: -1px; border-top: 0; }

/* Hairline tick rail */
.tick {
  height: 9px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 6px);
  opacity: .85;
}
.tick.tall { height: 14px; background-image: repeating-linear-gradient(90deg, var(--gold-1) 0 1px, transparent 1px 5px); opacity: .3; }

/* Monospace readout — coordinates, counters, machine text */
.readout {
  font-family: var(--mono); font-size: 10px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--ink-3);
}
.readout b { color: var(--gold-0); font-weight: 700; }

/* Ring gauge */
.gauge {
  --pct: 62; --sz: 58px;
  position: relative; width: var(--sz); height: var(--sz); flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--gold-1) calc(var(--pct) * 1%), var(--line-soft) 0);
  display: grid; place-items: center;
  /* WITHOUT THIS THE TWO LINES GET PUSHED TO THE EDGES OF THE CIRCLE, which is the narrowest part
     of it. `place-items: center` centres each item in its OWN track, and two auto tracks in a
     fixed-height grid stretch to fill it — measured 29.5px + 28.5px. So the figure floated in the
     middle of the top half and the caption in the middle of the bottom half, riding against the
     arc, with a gap between them.

     It survived review because the PAIR's midpoint still lands exactly on the ring's centre, so it
     measures as centred and only looks wrong. What it costs is horizontal room: a chord 21.7px off
     centre is 20.3px wide, against 38.2px once the rows are content-sized and the block is centred
     as one. `$115` needs 37.3px. It was crossing the gold ring, and `.gauge` sets no `overflow`, so
     it spilled rather than clipped. */
  align-content: center;
}
.gauge::before {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: var(--cream-0);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
.gauge::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--gold-1) 0deg .8deg, transparent .8deg 9deg);
  -webkit-mask: radial-gradient(circle, transparent 78%, #000 80%, #000 100%);
          mask: radial-gradient(circle, transparent 78%, #000 80%, #000 100%);
  opacity: .45;
}
.gauge .g-v {
  position: relative; font-variant-numeric: tabular-nums;
  font-size: 15px; font-weight: 600; letter-spacing: -.02em; line-height: 1;
}
/* 15px is the STARTING size, not the final one. `fitGaugeText` in app.js shrinks any line that
   does not clear the chord at its own height — see the note there for why counting characters
   cannot do this job. Nothing else should set a size on .g-v: the fitter reads this one. */
.gauge .g-k { position: relative; font-family: var(--mono); font-size: 8px; letter-spacing: .12em; color: var(--ink-3); text-transform: uppercase; margin-top: 2px; }

/* Waveform */
.wavebar { display: inline-flex; gap: 2px; align-items: center; height: 18px; }
.wavebar i { width: 2px; border-radius: 1px; background: var(--gold-1); animation: wv 1.05s ease-in-out infinite; }
.wavebar i:nth-child(1){height:5px;animation-delay:0s}
.wavebar i:nth-child(2){height:11px;animation-delay:.08s}
.wavebar i:nth-child(3){height:17px;animation-delay:.16s}
.wavebar i:nth-child(4){height:9px;animation-delay:.24s}
.wavebar i:nth-child(5){height:14px;animation-delay:.32s}
.wavebar i:nth-child(6){height:6px;animation-delay:.4s}
.wavebar i:nth-child(7){height:12px;animation-delay:.48s}
.wavebar i:nth-child(8){height:8px;animation-delay:.56s}
.wavebar.flat i { animation: none; opacity: .5; }
@keyframes wv { 0%,100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }

/* Sweeping beam — used once per screen, never more */
.beam { position: relative; overflow: hidden; }
.beam > .beam-l {
  position: absolute; left: 0; right: 0; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--gold-1), transparent);
  animation: sweep 6s ease-in-out infinite;
}
@keyframes sweep {
  0%   { transform: translateY(0);     opacity: 0; }
  8%   { opacity: .85; }
  92%  { opacity: .85; }
  100% { transform: translateY(var(--beam-h, 180px)); opacity: 0; }
}

/* Live dot */
.live { display: inline-flex; align-items: center; gap: 5px; }
.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(74,124,89,.16); animation: blip 2.2s ease-in-out infinite;
}
.live.warn::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(176,125,41,.16); }
.live.stop::before { background: var(--stop); box-shadow: 0 0 0 3px rgba(168,80,63,.16); animation: none; }
@keyframes blip { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* --- App shell ------------------------------------------------------------ */

.shell {
  display: grid;
  /* minmax(0,1fr), not 1fr: a wide topbar or a wide table must scroll or
     truncate inside the column, never push the whole shell past the window. */
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-rows: 56px 1fr;
  grid-template-areas: "brand top" "nav main";
  height: 100vh;
}

.brand {
  grid-area: brand;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--cream-0);
}

/* The phone tab bar. app.js appends one to <body> on every shell page, and it
   is display:none across the entire desktop range — where the rail is a
   permanent 232px column and a second copy of four of its rows, pinned over the
   content, would be redundant chrome charging rent on the shortest dimension
   the layout has. The PHONE block at the foot of this file is the one place
   that turns it on. Kept here, next to the shell it overlays, because that is
   where anyone will look for it. */
.tabbar { display: none; }

.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--cream-0);
  min-width: 0; overflow: hidden;
}
/* Priority when the bar runs out of room: the instruments on the right (sync
   chip, language switch, theme switch, avatar) are readings and must never
   wrap or squeeze. The title and its subtitle give up space instead — one
   line each, truncated with an ellipsis. */
.topbar h1,
.topbar > .readout {
  min-width: 0; flex: 0 1 auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.topbar .crumb { color: var(--ink-3); font-weight: 400; }
.topbar > [data-tools] { flex: none; }
.spacer { flex: 1 1 0; min-width: 8px; }

.nav {
  grid-area: nav;
  border-right: 1px solid var(--line);
  background: var(--cream-0);
  padding: 14px 10px;
  overflow-y: auto;
}
.nav-group { margin-bottom: 18px; }
.nav-label {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--ink-1); font-size: 13.5px; margin-bottom: 1px;
}
.nav a:hover { background: var(--cream-2); }
.nav a.active {
  background: linear-gradient(90deg, rgba(205,166,58,.16), rgba(205,166,58,.05));
  color: var(--ink-0); font-weight: 550;
  box-shadow: inset 2px 0 0 var(--gold-1);
}
.nav a .icn { opacity: .7; }
.nav a.active .icn { opacity: 1; color: var(--gold-0); }
.nav .count { margin-left: auto; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.main { grid-area: main; overflow-y: auto; padding: 22px 26px 60px; }
.main.flush { padding: 0; }

/* --- Bits ----------------------------------------------------------------- */

.card {
  background: var(--cream-0);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.card-h h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.card-b { padding: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--cream-0);
  color: var(--ink-1);
  font: inherit; font-size: 13px;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--cream-2); border-color: var(--cream-3); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold-1));
  border-color: var(--gold-0); color: #2c2308; font-weight: 600;
  box-shadow: 0 1px 2px rgba(120,90,10,.2);
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--cream-2); color: var(--ink-0); }
.btn.sm { height: 25px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 25px; }
.btn.danger:hover { color: var(--stop); border-color: rgba(168,80,63,.3); background: rgba(168,80,63,.06); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 550; letter-spacing: .02em;
  background: var(--cream-2); color: var(--ink-2);
  border: 1px solid var(--line-soft); white-space: nowrap;
}
.chip.gold  { background: rgba(205,166,58,.14); color: #7a5f10; border-color: rgba(205,166,58,.3); }
.chip.ok    { background: rgba(74,124,89,.12);  color: var(--ok);   border-color: rgba(74,124,89,.25); }
.chip.warn  { background: rgba(176,125,41,.12); color: var(--warn); border-color: rgba(176,125,41,.25); }
.chip.stop  { background: rgba(168,80,63,.1);   color: var(--stop); border-color: rgba(168,80,63,.22); }
.chip.info  { background: rgba(74,107,138,.1);  color: var(--info); border-color: rgba(74,107,138,.22); }
html[data-theme="night"] .chip.gold { color: var(--gold-2); }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field-bg);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font: inherit; font-size: 13.5px;
  color: var(--ink-0);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--gold-1);
  box-shadow: 0 0 0 3px rgba(205,166,58,.15);
}
/* Dates and times: the whole field opens the browser's own picker -----------------------
   "On any reference to dates that I could change I want to click and open a small calendar."

   Every editable date in this portal is already a native date input, so the calendar was always
   there — behind a glyph about fourteen pixels wide at the far right of the field. Miss it and the
   only way in is typing into three separate segments, which is why the field read as type-only. The
   click handler in app.js makes the whole field the trigger. Half of this is CSS and half is script,
   and the split is deliberate: see that handler for why the geometry trick that would have done it
   in CSS alone was abandoned.

   It is the browser's own calendar either way. Nothing here draws a calendar, tracks an open/closed
   state, or has to be kept in step with the input's value — the part a hand-built picker always gets
   wrong eventually. Typing still works too: the input keeps focus while the popup is up, so digits
   go where they always did, which matters for a date a year out where a calendar is the slower way
   to arrive.

   `color-scheme` is not decoration. The popup is drawn by the browser and is outside CSS's reach
   except through this one property; without it a white calendar comes out of the night theme. It
   is bound to the theme attribute rather than the OS setting because the theme here is a switch in
   the page, and following the OS would contradict the switch he just used. Scoped to these inputs
   on purpose: on `:root` it would also repaint scrollbars and selects, which is not what he asked
   for.

   `pointer-events: none` on the glyph is what leaves ONE way in. The glyph stays visible, because it
   is the only thing on the field that says "there is a calendar behind this" — but it stops being a
   click target of its own, so the script in app.js is the single handler and the picker cannot be
   opened and closed again by one click landing on both paths. Cheaper than hiding the native glyph
   and hand-drawing a replacement, and it stays themed for free.

   The pseudo-element is WebKit/Blink only, which is Chrome and Safari; Firefox has no glyph to
   neutralise and opens the picker on click by itself. */
input[type="date"], input[type="time"], input[type="datetime-local"] {
  cursor: pointer;
  color-scheme: light;
}
html[data-theme="night"] input[type="date"],
html[data-theme="night"] input[type="time"],
html[data-theme="night"] input[type="datetime-local"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { pointer-events: none; }

.textarea { resize: vertical; line-height: 1.55; }
.field { margin-bottom: 12px; }
.field label {
  display: block; font-family: var(--mono);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 5px;
}

/* Segmented control — translation switch, Day/Night, filters */
.seg {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--cream-2);
  padding: 2px; gap: 2px;
}
/* Anchors as well as buttons: a segment that switches a VIEW is navigation, and writing it as a
   link is what makes each view a URL that can be bookmarked, opened in a tab and gone back from.
   Same pixels either way, so the two cannot drift into looking like different controls. */
.seg button, .seg a {
  border: 0; background: transparent; font: inherit; font-size: 11.5px;
  padding: 3px 9px; border-radius: 4px; color: var(--ink-2);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.seg button.on, .seg a.on {
  background: var(--cream-0); color: var(--ink-0); font-weight: 600;
  box-shadow: var(--shadow-1);
}
.seg .flag { opacity: .8; margin-right: 3px; }

.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 14px; }

hr.sep { border: 0; border-top: 1px solid var(--line-soft); margin: 14px 0; }

/* Tables */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--cream-1); position: sticky; top: 0;
}
/* The first column of a record table: the avatar and the name. A class and not
   `style="width:30%"` on the <th>, because an inline width outranks every
   selector in this file, and the phone block near the bottom has to be able to
   hand this column the rest of the screen once the others are dropped. */
.tbl th.colmain { width: 30%; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:hover td { background: rgba(205,166,58,.045); cursor: pointer; }
.tbl tr.sel td { background: rgba(205,166,58,.1); }
.num { font-variant-numeric: tabular-nums; }

/* Avatar */
.av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--cream-3); color: var(--ink-2);
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 650; letter-spacing: .02em;
  flex: none; border: 1px solid var(--line);
}

/* Editable surface — the visual promise that everything can be changed */
.editable {
  border-radius: var(--r-sm);
  padding: 2px 4px; margin: -2px -4px;
  cursor: text; border: 1px dashed transparent;
}
.editable:hover { border-color: rgba(205,166,58,.5); background: rgba(205,166,58,.05); }

.pen { opacity: 0; transition: opacity .12s; color: var(--gold-0); font-size: 11px; }
tr:hover .pen, .hoverwrap:hover .pen { opacity: 1; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(10,9,6,.42); backdrop-filter: blur(2px); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 520px; max-width: 92vw;
  background: var(--cream-0); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3); z-index: 41;
  display: flex; flex-direction: column;
  animation: slidein .16s ease-out;
}
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-h { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-b { padding: 18px; overflow-y: auto; flex: 1; }
.hidden { display: none !important; }

/* Note / comment */
.note {
  border-left: 2px solid var(--gold-2);
  background: rgba(205,166,58,.06);
  padding: 9px 12px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13px;
}

/* Footer bar for save state */
.savebar {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0), var(--cream-0) 40%);
  border-top: 1px solid var(--line-soft);
}

/* --- Shared page furniture ------------------------------------------------ */

.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { width: 240px; }

.item { display: flex; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.item:last-child { border-bottom: 0; }
.item .t { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; width: 46px; flex: none; padding-top: 1px; }
.item .body { flex: 1; min-width: 0; }
.item .ttl { font-size: 13.5px; }
.item .sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* Ticking several items to rule on them together. The box is a real `input[type=checkbox]` tinted
   with `accent-color` rather than a styled-over span: the native control already carries the focus
   ring, the space-bar, the indeterminate state and the screen-reader name, and every one of those
   would have to be rebuilt by hand to end up looking the same. It is sized up from the 13px default
   because this is the one control on the page that decides more than one thing at a time.
   `flex: none` keeps it out of the row's text column; the padding lines it up with the timestamp
   beside it rather than with the top of the box. */
.pick { flex: none; display: flex; align-items: flex-start; }
.item .pick { padding-top: 1px; }
.pick input { accent-color: var(--gold-0); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.pick input:disabled { cursor: default; opacity: .5; }

/* The bar sits above the list it acts on, inside the same card, so the tick boxes below it always
   have their verbs in view. It is drawn only when there are at least two things to tick. */
.bulkbar { display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(205,166,58,.035); }
.bulkbar .pick { align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.bulkbar .readout { margin: 0; flex: 1; min-width: 90px; }
.bulkbar .bulkacts { display: flex; gap: 7px; flex-wrap: wrap; }

/* A row that goes somewhere. The class does the layout on either element — `a { color: inherit;
   text-decoration: none }` above is what makes that true — so these rules add only the affordance,
   and they are scoped to `a` so a row that is genuinely not a link never advertises itself as one.
   Same tint as `.prow:hover`, because it is the same gesture on a different list. */
a.item:hover, a.row:hover { background: rgba(205,166,58,.05); }
/* Keyboard parity: these rows are now tab stops, and a focus ring that only appears for keyboard
   users is the difference between a page one can drive without a mouse and one that merely can be. */
a.item:focus-visible, a.row:focus-visible { outline: 2px solid var(--gold-1); outline-offset: -2px; }
/* Cards that are links (the Today stats strip, the header rings) lift very slightly instead. A
   background tint would fight the `.hud` corner brackets those cards draw. */
a.stat, a.gwrap { transition: border-color .12s ease, transform .12s ease; }
a.stat:hover, a.gwrap:hover { border-color: rgba(205,166,58,.4); }
a.stat:hover { transform: translateY(-1px); }
a.stat:focus-visible, a.gwrap:focus-visible { outline: 2px solid var(--gold-1); outline-offset: 2px; }

.kv { display: grid; grid-template-columns: 116px 1fr; gap: 9px 12px; align-items: baseline; }
.kv .k { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

.sect { margin-top: 20px; }
.sect > .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.sect > .hd h4 { margin: 0; font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }

/* Provenance — "where did Max get this" */
.src { font-size: 11px; color: var(--ink-3); margin-top: 5px; }
.src b { color: var(--gold-0); font-weight: 600; }

/* Source badge — which connected system a record came from */
.from {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--line-soft); border-radius: 3px;
  padding: 1px 5px; background: var(--cream-1);
}
.from .icn { width: 10px; height: 10px; opacity: .8; }
.from.gold { color: var(--gold-0); border-color: rgba(205,166,58,.32); background: rgba(205,166,58,.08); }

/* Content shown in the original language because no translation exists */
.is-fallback { opacity: .82; }

/* ============================================================================
   ROUND 3 — "more futuristic, still professional"

   Three moves, no new colours:
   1. GEOMETRY. Sharper radii, notched corners, four-corner brackets, a faint
      engineering grid behind every screen. Panels read as instruments.
   2. A PERMANENT CHANNEL TO MAX. The Entity lives at the bottom of the left
      rail on every screen and opens a full-height console.
   3. TWO-WAY SYNC MADE VISIBLE. A sync chip in the top bar of every page and
      a "mirror" line under every editable surface — the portal and WhatsApp
      are one system, and the UI says so at all times.
   ========================================================================== */

/* --- The engineering grid behind everything ------------------------------- */

/* Round 4: the grid drifts. One cell over 44 seconds — about a pixel a second,
   slow enough that you never catch it moving and only register that the surface
   is not dead. The radial highlight is pinned by holding its position at 0 0 in
   both keyframes, so only the two hairline layers travel. */
.main::before {
  content: ""; position: fixed; inset: 56px 0 0 232px; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(205,166,58,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205,166,58,.055) 1px, transparent 1px),
    radial-gradient(700px 420px at 82% -8%, rgba(205,166,58,.07), transparent 70%);
  background-size: 46px 46px, 46px 46px, 100% 100%;
  -webkit-mask: radial-gradient(150% 110% at 50% 0%, #000 30%, transparent 78%);
          mask: radial-gradient(150% 110% at 50% 0%, #000 30%, transparent 78%);
  animation: gridrift 44s linear infinite;
}
@keyframes gridrift {
  from { background-position: 0 0, 0 0, 0 0; }
  to   { background-position: 46px 46px, 46px 46px, 0 0; }
}
.main > * { position: relative; z-index: 1; }

/* A telemetry pulse crossing the seam under the topbar. This is the one piece
   of the chrome that says the link to Max is open right now — it runs whether
   or not anything is on screen. `.topbar` is already overflow:hidden, so the
   travelling segment is clipped at both ends and needs no exact end position. */
.topbar { position: relative; }
.topbar::after {
  content: ""; position: absolute; bottom: 0; left: 0; z-index: 2;
  width: 190px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg,
    transparent, var(--gold-1) 42%, rgba(240, 220, 160, .95) 50%, var(--gold-1) 58%, transparent);
  animation: topsignal 8.5s linear infinite;
}
@keyframes topsignal {
  0%   { transform: translateX(-190px); opacity: 0; }
  6%   { opacity: .9; }
  88%  { opacity: .9; }
  100% { transform: translateX(100vw); opacity: 0; }
}

/* Machined edge-light. A single hairline along the top of every panel, brighter
   in the middle, so a card reads as a milled plate catching a light rather than
   a rectangle with a border. Cheap, static, and it holds in both themes. */
.card { position: relative; }
.card::after {
  content: ""; position: absolute; left: 1px; right: 1px; top: 0; height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent, rgba(233, 203, 112, .30) 24%, rgba(233, 203, 112, .48) 50%, rgba(233, 203, 112, .30) 76%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .main::before { animation: none; }
  .topbar::after { animation: none; opacity: 0; }
}

/* --- Notched panel -------------------------------------------------------- */
/* A cut top-right corner. Reads as machined rather than drawn. The HUD bracket
   is pulled in so it stops before the notch instead of being sliced by it. */

.cut { clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%); }
.cut.hud::before { right: calc(var(--cut) - 2px); }

/* --- Panel header, instrument style --------------------------------------- */

.card-h .ix {
  font-family: var(--mono); font-size: 9px; letter-spacing: .16em;
  color: var(--gold-0); border: 1px solid rgba(205,166,58,.35);
  border-radius: 2px; padding: 1px 4px; background: rgba(205,166,58,.08);
  flex: none;
}
.card-h .rule {
  flex: 1; height: 5px; min-width: 18px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 5px);
  opacity: .9;
}

/* Big instrument number */
.bignum {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05;
}
.bignum.sm { font-size: 18px; }
.bignum .u { font-size: 12px; color: var(--ink-3); font-weight: 500; margin-left: 3px; }

/* --- Left rail, restyled -------------------------------------------------- */

.nav { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.nav-scroll { flex: 1; overflow-y: auto; padding: 14px 10px 10px; }
.nav-label { display: flex; align-items: center; gap: 7px; }
.nav-label::after {
  content: ""; flex: 1; height: 5px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 5px);
}
.nav a { position: relative; border-radius: 2px; }
.nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 15px; background: var(--gold-1);
  box-shadow: 0 0 8px var(--glow);
}
.nav a.active { box-shadow: none; }
.nav .count {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  border: 1px solid var(--line-soft); border-radius: 2px; padding: 0 4px;
  background: var(--cream-1);
}

/* A rail row whose screen is not built yet. It has to be legible as part of the list and
   unmistakable as not-a-link at the same time: same geometry, no hover, no pointer, dimmer
   ink, and the word "soon" where a count would sit. Nothing here is clickable, so nothing
   here can disappoint a click. */
.nav .navsoon {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 2px;
  font-size: 13.5px; margin-bottom: 1px;
  color: var(--ink-3); cursor: default;
}
.nav .navsoon .icn { opacity: .34; }
.nav .navsoon .count { margin-left: auto; opacity: .75; }
.nav .navsoon .soonmark {
  margin-left: auto; font-style: normal;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); opacity: .62;
}
/* When a real count is present it takes the right edge, so "soon" tucks in beside it. */
.nav .navsoon .count:not(.hidden) ~ .soonmark { margin-left: 6px; }

/* --- The Max dock: a permanent channel, bottom of the rail ---------------- */

.maxdock {
  flex: none; border-top: 1px solid var(--line);
  padding: 11px 12px 13px; cursor: pointer;
  background:
    radial-gradient(120px 60px at 22% 40%, rgba(205,166,58,.13), transparent 70%),
    var(--cream-0);
  position: relative; overflow: hidden;
}
.maxdock:hover { background:
  radial-gradient(140px 70px at 22% 40%, rgba(205,166,58,.22), transparent 72%), var(--cream-0); }
.maxdock .md-top { display: flex; align-items: center; gap: 9px; }
.maxdock .orb { --orb: 30px; }
.maxdock .md-n {
  font-family: var(--serif); font-size: 13px; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-0);
}
.maxdock .md-s { font-family: var(--mono); font-size: 8.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); margin-top: 1px; }
.maxdock .md-line {
  margin-top: 9px; display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 2px;
  background: var(--field-bg); padding: 5px 8px;
  font-size: 11.5px; color: var(--ink-3);
}
.maxdock .md-line .icn { width: 12px; height: 12px; color: var(--gold-0); }
.maxdock .kbd {
  font-family: var(--mono); font-size: 9px; margin-left: auto;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px;
  padding: 0 4px; color: var(--ink-3); background: var(--cream-1);
}

/* --- The Max console: full-height panel on the left ----------------------- */

.maxpanel {
  position: fixed; left: 0; top: 0; bottom: 0; width: 390px; max-width: 94vw;
  z-index: 60; display: flex; flex-direction: column;
  border-right: 1px solid var(--gold-0);
  background:
    radial-gradient(420px 260px at 50% -4%, rgba(205,166,58,.16), transparent 66%),
    var(--cream-0);
  box-shadow: var(--shadow-3), 0 0 60px rgba(205,166,58,.09);
  animation: maxin .18s ease-out;
}
@keyframes maxin { from { transform: translateX(-26px); opacity: .4; } to { transform: none; opacity: 1; } }

.maxpanel .mp-h { padding: 18px 18px 14px; text-align: center; position: relative; }
.maxpanel .mp-h .orb { --orb: 62px; margin: 0 auto 11px; }
.maxpanel .mp-h .n {
  font-family: var(--serif); font-size: 15px; letter-spacing: .17em;
  text-transform: uppercase; margin-bottom: 3px;
}
.maxpanel .mp-x { position: absolute; top: 12px; right: 12px; }
.maxpanel .mp-rails { display: flex; align-items: center; gap: 7px; padding: 0 18px 12px; }
.maxpanel .mp-rails .tick { flex: 1; }
.maxpanel .mp-body { flex: 1; overflow-y: auto; padding: 4px 18px 14px; border-top: 1px solid var(--line-soft); }
.maxpanel .mp-foot { border-top: 1px solid var(--line); padding: 12px 14px 14px; background: var(--cream-1); }

.mp-turn { margin-bottom: 14px; font-size: 13px; line-height: 1.6; }
.mp-turn .who {
  font-family: var(--mono); font-size: 9px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.mp-turn.me .who { color: var(--gold-0); }
.mp-turn .txt {
  border-left: 2px solid var(--line); padding-left: 11px; color: var(--ink-1);
}
.mp-turn.me .txt { border-left-color: var(--gold-1); }
.mp-turn .txt ul { margin: 6px 0 0; padding-left: 16px; }
.mp-turn .txt li { margin-bottom: 3px; }

.mp-box {
  display: flex; align-items: flex-end; gap: 8px;
  border: 1px solid var(--line); background: var(--field-bg);
  border-radius: var(--r-sm); padding: 7px 8px 7px 11px;
}
.mp-box textarea {
  flex: 1; border: 0; outline: none; resize: none; font: inherit; font-size: 13.5px;
  background: transparent; color: var(--ink-0); line-height: 1.5; max-height: 96px; padding: 3px 0;
}
/* Typing is the primary way in, so Send is a real button sitting next to the
   mic — not a hidden Enter key. The mic stays the round gold one; Send is the
   squarer, quieter sibling so the two never read as the same control. */
.mp-send {
  width: 30px; height: 30px; flex: none; cursor: pointer;
  border: 1px solid var(--gold-0); border-radius: var(--r-sm);
  background: rgba(205, 166, 58, 0.1); color: var(--gold-0);
  display: grid; place-items: center; padding: 0;
  transition: background .12s, color .12s, box-shadow .12s;
}
.mp-send:hover { background: var(--gold-1); color: #3d3006; box-shadow: 0 0 12px var(--glow); }
.mp-send .icn { width: 14px; height: 14px; }

.mp-mic {
  width: 30px; height: 30px; border-radius: 50%; flex: none; cursor: pointer;
  border: 1px solid var(--gold-0); color: #3d3006;
  background: radial-gradient(circle at 35% 30%, var(--gold-3), var(--gold-1));
  display: grid; place-items: center; box-shadow: 0 0 12px var(--glow);
}
.mp-hint {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin-top: 8px; font-size: 10.5px; color: var(--ink-3);
}
.mp-hint .key {
  font-family: var(--mono); font-size: 9.5px; padding: 0 4px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; background: var(--cream-2);
}
.mp-ctx { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.mp-ctx .chip { cursor: pointer; }
.mp-ctx .chip:hover { border-color: var(--gold-1); background: rgba(205,166,58,.12); }

/* --- Two-way sync, made visible ------------------------------------------- */

.syncchip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ok); border: 1px solid rgba(74,124,89,.3); background: rgba(74,124,89,.08);
  border-radius: 2px; padding: 3px 7px;
  flex: none; white-space: nowrap;
}
.syncchip .icn { width: 11px; height: 11px; flex: none; animation: spin-slow 4.5s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.syncchip b { color: var(--ink-2); font-weight: 500; letter-spacing: .06em; }

/* "changed here → landed in Max" line */
.mirror {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); border-top: 1px dashed var(--line); padding-top: 9px; margin-top: 12px;
}
.mirror .icn { width: 11px; height: 11px; color: var(--gold-0); }
.mirror b { color: var(--gold-0); font-weight: 600; }

/* Live write ticker — proof the two directions are one pipe */
.ticker { display: flex; flex-direction: column; gap: 0; }
.ticker .tk {
  display: flex; align-items: center; gap: 9px; padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft); font-size: 12px;
}
.ticker .tk:last-child { border-bottom: 0; }
.ticker .tk .ago { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); width: 48px; flex: none; letter-spacing: .06em; }
.ticker .tk .dir { color: var(--gold-0); flex: none; }

/* --- People page ---------------------------------------------------------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) 452px; gap: 14px; align-items: start; }
/* minmax(0, 1fr) and not a bare 1fr, in BOTH declarations. A bare `1fr` has an
   automatic minimum of min-content, so the track never shrinks below the widest
   unbreakable thing inside it — a table, a long filename — and the column then
   sticks out of its own container instead of the content adapting. Measured on
   a 390px phone before this change: notes resolved a single 396.8px column
   inside a 366px box, people 414.25px. The page did not visibly overflow only
   because .main scrolls, so it showed up as a sideways drag rather than as
   anything obviously broken. A 0 floor lets the column be as narrow as it has
   to be and pushes the shrinking down into the content, where it belongs. */
@media (max-width: 1240px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* Roster row */
.prow {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.prow:last-child { border-bottom: 0; }
.prow:hover { background: rgba(205,166,58,.05); }
.prow.on { background: rgba(205,166,58,.1); box-shadow: inset 3px 0 0 var(--gold-1); }
.prow .av { width: 30px; height: 30px; font-size: 11px; }
.prow .pb { flex: 1; min-width: 0; }
.prow .pn { font-size: 13.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.prow .pm { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pr { text-align: right; flex: none; }
.prow .pt { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); letter-spacing: .06em; }

/* Role badge — how a person relates to a company */
.role {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 7px;
  border-radius: 2px; font-family: var(--mono); font-size: 9px; font-weight: 600;
  letter-spacing: .11em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
}
.role.inv { color: #4a6b8a; border-color: rgba(74,107,138,.4);  background: rgba(74,107,138,.1); }
.role.pro { color: var(--warn); border-color: rgba(176,125,41,.4); background: rgba(176,125,41,.1); }
.role.amp { color: #7a5f10; border-color: rgba(205,166,58,.45); background: rgba(205,166,58,.16); }
.role.fnd { color: var(--ok);   border-color: rgba(74,124,89,.4);  background: rgba(74,124,89,.1); }
.role.lp  { color: var(--stop); border-color: rgba(168,80,63,.35); background: rgba(168,80,63,.08); }
html[data-theme="night"] .role.amp { color: var(--gold-2); }

/* Warmth meter — how live the relationship is */
.warm { display: inline-flex; gap: 2px; align-items: center; }
.warm i { width: 3px; height: 11px; border-radius: 1px; background: var(--line); }
.warm i.f { background: var(--gold-1); }
.warm.cold i.f { background: var(--ink-3); }

/* A company link on a person */
.link-row {
  display: flex; align-items: center; gap: 9px; padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.link-row:last-child { border-bottom: 0; }
.link-row .lc { flex: 1; min-width: 0; }
.link-row .ln { font-size: 13px; font-weight: 550; }
.link-row .lw { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }

/* Match card — Max proposing who in the network fits a new company */
.match {
  display: flex; gap: 12px; padding: 13px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.match:last-child { border-bottom: 0; }
.match:hover { background: rgba(205,166,58,.04); }
.match .score { flex: none; text-align: center; width: 52px; }
.match .mb { flex: 1; min-width: 0; }
.match .mn { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.match .why {
  font-family: var(--mono); font-size: 10.5px; line-height: 1.65; color: var(--ink-2);
  margin-top: 6px; border-left: 2px solid rgba(205,166,58,.4); padding-left: 9px;
}
.match .why em { color: var(--gold-0); font-style: normal; font-weight: 600; }

/* The learned model — what Max thinks Rafael's filter is */
.model-row {
  display: grid; grid-template-columns: 132px 1fr 42px; gap: 11px; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12.5px;
}
.model-row:last-child { border-bottom: 0; }
.meter { height: 5px; border-radius: 2px; background: var(--cream-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-0), var(--gold-2)); }
.model-row .mv { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-align: right; letter-spacing: .06em; }

/* Unfiled person awaiting a decision */
.unfiled {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.unfiled:last-child { border-bottom: 0; }
.unfiled .ub { flex: 1; min-width: 0; }

/* Source dots — which channels know this person */
.srcdots { display: inline-flex; gap: 3px; align-items: center; }
.srcdots i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--line);
  display: block;
}
.srcdots i.on { background: var(--gold-1); box-shadow: 0 0 4px var(--glow); }

/* Section rule used above stacked blocks in the detail panel */
.brk {
  display: flex; align-items: center; gap: 8px; margin: 16px 0 10px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3);
}
.brk::after {
  content: ""; flex: 1; height: 5px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 5px);
}

/* Tab strip, instrument style */
.tabs { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--cream-2); padding: 2px; }
.tabs button {
  border: 0; background: transparent; font: inherit; font-size: 12px;
  padding: 4px 12px; border-radius: 2px; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tabs button.on { background: var(--cream-0); color: var(--ink-0); font-weight: 600; box-shadow: var(--shadow-1); }
.tabs button .count {
  font-family: var(--mono); font-size: 9px; color: var(--ink-3);
  border: 1px solid var(--line-soft); border-radius: 2px; padding: 0 3px; background: var(--cream-1);
}

/* ── Scroll regions ───────────────────────────────────────────────────────
   Several panels scroll inside themselves (a long roster next to a long
   detail sheet). On macOS the scrollbar is hidden until you touch it, so a
   panel that is actually scrollable reads as *clipped* — the content just
   stops mid-sentence. An instrument shows its travel, so the track is always
   drawn: a hairline rail with a gold thumb, on-theme rather than chrome.

   NOTE: the standard `scrollbar-width` / `scrollbar-color` properties must NOT
   be set unconditionally. In Chrome, either one switches the element back to
   the native (overlay, on macOS) scrollbar and *disables* the
   ::-webkit-scrollbar pseudo-elements — zero layout width, invisible at rest,
   which is the exact bug we are fixing. The legacy pseudo-elements alone are
   what force a classic, always-drawn track, so Firefox gets the standard
   properties behind an @supports guard instead. */
.scrollzone::-webkit-scrollbar,
.drawer-b::-webkit-scrollbar,
.maxpanel .mp-body::-webkit-scrollbar { width: 9px; }
.scrollzone::-webkit-scrollbar-track,
.drawer-b::-webkit-scrollbar-track,
.maxpanel .mp-body::-webkit-scrollbar-track {
  background: transparent;
  border-left: 1px solid var(--line-soft);
}
.scrollzone::-webkit-scrollbar-thumb,
.drawer-b::-webkit-scrollbar-thumb,
.maxpanel .mp-body::-webkit-scrollbar-thumb {
  background: rgba(205,166,58,.38); border-radius: 0;
  border-left: 2px solid transparent; border-right: 2px solid transparent;
  background-clip: padding-box;
}
.scrollzone::-webkit-scrollbar-thumb:hover,
.drawer-b::-webkit-scrollbar-thumb:hover,
.maxpanel .mp-body::-webkit-scrollbar-thumb:hover { background: rgba(205,166,58,.62); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) {
  .scrollzone, .drawer-b, .maxpanel .mp-body { scrollbar-width: thin; scrollbar-color: rgba(205,166,58,.42) transparent; }
}
/* The rail is only 232px wide and the item counts sit hard right, so its track
   is slimmer and quieter than the one on a full panel. */
.nav-scroll::-webkit-scrollbar { width: 5px; }
.nav-scroll::-webkit-scrollbar-track { border-left: 0; }
.nav-scroll::-webkit-scrollbar-thumb { background: rgba(205,166,58,.26); border-left-width: 1px; border-right-width: 1px; }

/* And a mono footer that names what is below the fold, so the cut is a fact
   the panel states rather than something the eye has to guess at. */
.morebelow {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); background: var(--cream-1);
}
.morebelow::before {
  content: ""; flex: 1; height: 5px; order: 2;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 5px);
}
.morebelow .icn { color: var(--gold-0); }

/* ==========================================================================
   PHONE
   Until this block there was exactly one layout breakpoint in the whole file
   (.split at 1240px), so every screen rendered its desktop layout on a phone.

   It is worth being precise about what that actually broke, because the
   obvious answer is wrong. Measured at 390x844 across all eighteen screens:
   horizontal overflow 0px, scroll width 390px, on every one. Nothing spills.
   `minmax(0, 1fr)` on the shell has been doing its job the entire time.

   What breaks is the space left over. The rail column is a fixed 232px, which
   on a 390px screen is 59% of the width, leaving about 158px for the page —
   every table, card and split still being asked to fit inside a strip
   narrower than the rail beside it. The portal was not overflowing on a
   phone. It was being squeezed into a quarter of one.

   So this block's job is to take the rail out of the content's way and hand
   the page the whole screen, not to chase an overflow that was never there.

   720px and not 480px: below 720 the rail is already more than a third of the
   width. A rail too narrow to read is worse than one you have to open.
   ========================================================================== */

@media (max-width: 720px) {

  /* One column and two rows of chrome; the rail leaves the grid entirely and
     becomes the fixed drawer below.

     100dvh, with 100vh kept above it as the fallback for anything that does
     not know the unit. On iOS Safari 100vh is the height the window has when
     the URL bar is HIDDEN, so a 100vh shell is permanently taller than what
     you can see and the bottom ~90px of every screen — which is where the
     primary buttons sit — starts life underneath the browser chrome. dvh is
     the height that is actually on screen. */
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 50px auto minmax(0, 1fr);
    grid-template-areas: "brand" "top" "main";
    height: 100vh;
    height: 100dvh;
  }

  /* The brand row is the phone's title bar now, and drops the border that used
     to divide it from the rail beside it. It no longer carries a menu button:
     that moved to the tab bar at the bottom of this block. */
  .brand { padding: 0 12px; border-right: 0; gap: 8px; }

  /* The desktop bar gives the instruments on the right absolute priority and
     lets the title give up space — correct at 1440px, where there is space to
     give. At 390px the instruments measure 543px on their own, so that rule
     takes the title to ZERO width and still overflows: the avatar landed at
     x=589, off the side of the screen and impossible to tap. Nothing was
     visibly broken, because .topbar clips.

     So the priority inverts here. The title always shows — it is the only
     thing telling you which screen you are on now that the rail is closed —
     and the instruments shrink and scroll instead of running off the edge. */
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar h1 { font-size: 14px; min-width: 96px; }

  /* Two of the instruments are dropped rather than scrolled, because on a
     phone they are saying something twice: the clock duplicates the one in the
     status bar six pixels above it, and "Content" is a label for the language
     switch sitting immediately to its right. */
  .topbar > .readout { display: none; }
  .topbar [data-tools] > .readout,
  .topbar [data-tools] .syncchip { display: none; }

  /* `flex: none` is what pinned these open; it has to go before they can fit.
     The strip scrolls so the ones that remain stay reachable, and the bar is
     short enough that a visible scrollbar would be most of its height. */
  .topbar > [data-tools] {
    flex: 0 1 auto; min-width: 0;
    overflow-x: auto; scrollbar-width: none;
  }
  .topbar > [data-tools]::-webkit-scrollbar { display: none; }

  /* The scroll above is the safety net, and it was carrying more load than it
     should. On the pages that mark up a translation the strip holds a second
     segmented control — Original / English / Português, 204px — and the bar
     then measures 496px inside 390. What falls off the end is the theme switch
     and the avatar, and the theme switch is the one control on this strip a
     phone reaches for more often than a desktop does.

     Its two labels are the cheapest 70px on the bar: the sun and the moon say
     Day and Night without help, and which one is active is shown by the raised
     panel behind it, not by the word. `font-size: 0` is safe here precisely
     because `.icn.xs` is 12px in absolute units — an em-sized icon would
     vanish with the text.

     The language buttons keep their words. "Original" and "English" have no
     icon between them, and a switch whose options cannot be told apart is
     worse than one you have to scroll to. */
  .topbar [data-theme-seg] button { font-size: 0; padding: 4px 8px; }

  /* Off-canvas rail. `position: fixed` rather than a grid area that is merely
     hidden, because a drawer that is still a grid child re-reserves its column
     the instant it is shown — which is the 232px problem again, on top of the
     content this time. translateX keeps it paintable and animatable while
     closed, and `visibility` rides the same transition so a closed rail is not
     a row of invisible tab stops sitting over the page. */
  .nav {
    position: fixed; z-index: 45;
    top: 0; left: 0; bottom: 0;
    width: min(84vw, 300px);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-3);
    transform: translateX(-100%);
    visibility: hidden;
    /* `visibility 0s linear .18s` and NOT `visibility .18s`. Putting a duration
       on visibility asks the browser to interpolate a property that has no
       in-between, and the rail then depends on the transition actually running
       to arrive at `visible` — which is a bad thing to depend on, because a
       transition that never advances (a throttled or occluded tab does this,
       observed here) strands an open rail invisible with the scrim up and no
       way back. A 0s change with a DELAY has no such state: opening flips it
       to visible at once and slides in; closing slides out first and hides it
       at the end, so the rail is never yanked off screen mid-slide. */
    transition: transform .18s ease-out, visibility 0s linear .18s;
    /* Top for the notch, bottom for the home indicator. The rail runs the full
       height of the screen, so without these the first nav row sits under the
       status bar and the Max dock — the last thing in the rail, and a tap
       target — sits under the swipe bar. */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  html[data-rail="open"] .nav {
    transform: none;
    visibility: visible;
    transition: transform .18s ease-out, visibility 0s;
  }
  /* The slide is decoration; being able to reach the navigation is not. */
  @media (prefers-reduced-motion: reduce) {
    .nav, html[data-rail="open"] .nav { transition: none; }
  }
  /* On a phone the rail is the entire navigation rather than a glanceable
     index beside the page, and every row has to survive a thumb. 11px of
     padding is what puts the row at 44px, which is the tap target Apple asks
     for; 10px measured 42 and there is no reason to be two pixels short. */
  .nav a { padding: 11px 12px; font-size: 14.5px; }
  .nav-scroll { padding: 12px 10px 10px; }

  /* The tab bar is fixed, so it is out of flow and covers whatever the page
     ends with. 58px of bar plus 16px of air, and the env() on top of that for
     the home indicator — without which the last row of any long page ends
     underneath the strip you swipe up on. */
  .main { padding: 14px 12px calc(74px + env(safe-area-inset-bottom)); }

  /* The drifting grid is pinned to `56px 0 0 232px`, which describes the
     desktop chrome. With no rail and two stacked bars those numbers name
     nothing on this screen, and the left offset leaves a bare 232px strip.
     Both bars paint their own opaque background over the top, so full bleed
     is the correct value here rather than a second set of magic numbers. */
  .main::before { inset: 0; }

  /* 92vw of a 390px screen leaves 31px of scrim to tap, which is half a
     fingertip. Full width, and it closes from its own header instead. */
  .drawer { width: 100%; max-width: 100%; border-left: 0; }

  /* Tables scroll inside their card instead of dictating its width. Scoped
     with :has to the cards that actually hold one — `overflow-x` on every card
     would compute overflow-y to auto as well and clip anything positioned
     outside a card's box. min-width so the columns keep their shape and the
     row scrolls, rather than every cell collapsing to its longest word. */
  .card:has(> table.tbl) { overflow-x: auto; }
  table.tbl { min-width: 540px; }

  /* ...except where the table is too wide for that to be a kindness. Deals is
     seven columns; 540px on a 390px screen puts five of them behind a sideways
     scroll with no visible edge, so the screen reads as "company, stage, and
     then nothing" and the cheque size is a fact you have to discover. A table
     marked `data-phone-lean` gives up the min-width and drops to the columns
     worth scanning with a thumb. Nothing is lost by it: every row opens the
     drawer on tap and the drawer holds the whole record.

     Hidden by attribute rather than :nth-child, so that adding a column later
     cannot silently hide the wrong one — the same reason the cells are saved
     by `data-cell` name instead of position. */
  .card:has(> table.tbl[data-phone-lean]) { overflow-x: visible; }

  /* Not scoped to the table: `data-phone-hide` means "this is not shown on a
     phone" wherever it is put, and the Deals screen uses it on its feed strip
     as well as on five of its columns. Anything marked with it has to be
     something the screen still works without — a read-out, never a control.

     `.main` is in the selector for weight, not for structure. A bare attribute
     selector ties with `.feeds { display: flex }` in crm.html's own <style>,
     and that block is parsed after this file, so the tie goes to it and the
     strip stays on screen. Same reason `.main .stagebar` is written that way
     below. The cost is that this only reaches things inside `.main`, which is
     where every screen's content lives. */
  .main [data-phone-hide] { display: none; }

  /* `min-width: 0` alone is not enough, and this is the part that is easy to
     get wrong: an auto-layout table sizes a column to its content's MIN-content
     width, and the ellipsis rule below sets `white-space: nowrap`, which makes
     the min-content of "Clarity Health do Brasil Participações" the whole name.
     The table then measures wider than the phone and hangs off the edge again —
     the same bug, arrived at from the other direction.

     `table-layout: fixed` is what breaks that: the columns take the widths
     declared here and the content is made to fit them, rather than the other
     way round. 68/32 because the stage chip needs about 100px at its longest
     ("Term sheet") and the name should have every pixel that is left. */
  table.tbl[data-phone-lean] { min-width: 0; table-layout: fixed; }
  table.tbl[data-phone-lean] th.colmain { width: 68%; }
  table.tbl[data-phone-lean] td { overflow: hidden; }

  /* With the scroll gone the company cell has to live inside 375px, and a name
     like "Clarity Health do Brasil Participações" wraps to four lines and
     builds a 110px row — three deals to a screen. One line each, clipped. The
     `min-width: 0` is what makes the ellipsis possible at all: a flex child
     defaults to min-content and refuses to shrink below its longest word. */
  .co { min-width: 0; }
  .co > div:last-child { min-width: 0; }
  .co .nm, .co .sc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* The stage counts are eight chips that wrap onto two rows and push the first
     deal further under the fold. They are a read-out, not a filter — nothing in
     the bar is tappable — so they scroll sideways on one row instead. `.main
     .stagebar` and not `.stagebar`, because app.css loads before each page's
     own <style> and a bare class here would lose the cascade to the
     `flex-wrap: wrap` declared there.

     `flex: none` on the children and not only on the chips: a flex item shrinks
     by default, and in a nowrap row with no room to spare that squeezes each
     chip down to its narrowest word. */
  .main .stagebar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .main .stagebar::-webkit-scrollbar { display: none; }
  .main .stagebar > * { flex: none; }

  /* --- Tab bar -------------------------------------------------------------
     Four destinations and a More, fixed to the bottom edge.

     z-index 39 is deliberate and sits one below the scrim at 40. Everything
     that opens over the page — the rail, a drawer, the Max console — comes
     with that scrim, and a bright bar left sitting on top of a dimmed page
     reads as still-tappable when it is not. Under the scrim it dims with
     everything else, and the scrim closes what is open, which is the gesture
     people try first.

     grid with equal columns rather than flex, so the five targets are the same
     width whatever the labels say. A thumb aims at a position, not at a word,
     and positions that move when a badge appears are positions you re-learn. */
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed; z-index: 39;
    left: 0; right: 0; bottom: 0;
    background: var(--cream-0);
    border-top: 1px solid var(--line);
    /* Zero today: viewport-fit=cover is deliberately not set, so iOS keeps the
       web view inside the safe area and this resolves to 0. Here so the bar is
       already correct if that decision is ever revisited — a tab bar sitting
       under the home indicator is the exact failure cover introduces. */
    padding-bottom: env(safe-area-inset-bottom);
  }

  .tabbar > a,
  .tabbar > .tabmore {
    /* 58px, not the 44px Apple asks for as a minimum: this is the one control
       that is on screen on every page, and it is being aimed at by a thumb in
       motion rather than a settled finger. */
    min-height: 58px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    /* The button has to be told all of this; the anchor inherits most of it. */
    background: none; border: 0; padding: 6px 2px; margin: 0;
    font: inherit; color: var(--ink-3);
    text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .tabbar .tb-i { position: relative; display: flex; line-height: 0; }
  .tabbar .tb-l {
    font-size: 10px; letter-spacing: .01em;
    /* A label that outgrows its fifth of the screen truncates rather than
       wrapping the bar to two lines. The four chosen fit; a longer one swapped
       in later degrades instead of breaking the layout. */
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

  /* The current screen. Gold on the icon and full-strength ink on the label —
     the rail marks the active row the same way, so the two agree about where
     you are. */
  .tabbar > a.on { color: var(--ink-0); }
  .tabbar > a.on .icn { color: var(--gold-0); opacity: 1; }

  .tabbar > a:active,
  .tabbar > .tabmore:active { background: var(--cream-1); }

  /* The badge rides the icon rather than sitting after the label, which is
     where the rail puts it. A count in the label row would push the label off
     centre and move the target.

     The rail's badge is a bordered pill in muted ink, and that is right on a
     flat row you read on the way past. Here it has to carry across the room on
     a bar the size of a thumbnail, sitting ON an outlined icon — so it is
     filled instead of outlined, and gold, which is the one colour this portal
     uses to mean "look".

     The text colour is a literal and not a token, which is worth explaining
     rather than looking like an oversight: every ink token inverts between Day
     and Night, and --gold-0 does not — it is light in both (#b8912a / #cda63a).
     Dark text is the correct answer on both, and there is no token that stays
     dark. The ring is the bar's own background, so the pill lifts off the icon
     strokes underneath instead of tangling with them. */
  .tabbar .count {
    position: absolute; top: -5px; left: 10px;
    min-width: 9px; padding: 0 4px;
    font-family: var(--mono); font-size: 9px; line-height: 15px;
    text-align: center; letter-spacing: .02em;
    color: #1c1913; background: var(--gold-0);
    border: 0; border-radius: 999px;
    box-shadow: 0 0 0 2px var(--cream-0);
  }

  /* --- Things sized for a wide row, on a narrow one ------------------------
     Everything below is one bug with five faces. The portal's chrome is built
     out of single rows — a title beside a subtitle, a card heading beside a
     hint, a strip of stat cards, a row of tabs, a funnel divided by hairlines.
     Every one of them is correct at 1440px and every one of them was still
     being asked to be a single row at 390px, where it either clipped, or
     wrapped into something that no longer described what it was drawing.

     The rule they break is the same one the rail broke: a layout that has run
     out of width has to give something up on purpose. What follows is that
     decision, taken once per pattern. ---------------------------------------- */

  /* The crumb is the page's subtitle — "— what you spend, what you're owed,
     what Max costs" after "Finance". It is worth reading on a desktop and it
     is the single reason the phone title bar does not fit: measured across the
     16 screens, TWELVE had a clipped h1, and Finance asked for 396px of title
     inside 245. The result read "Finance — what you spend, what yo…", which is
     worse than no subtitle at all, and it pushed the Day/Night switch half off
     the right edge on the way.

     The page name alone is what the bar is for here (see the note above about
     the title always showing), and dropping the crumb hands ~130px back to the
     instruments, which is what stops them scrolling on most screens. */
  .topbar .crumb { display: none; }

  /* Stat cards, two up.
     `.stats` is declared per page and never in this file, in four different
     flavours: `repeat(4, 1fr)` on Today and the Activity log, `repeat(3, 1fr)`
     on Approvals and Reminders, and `auto-fit, minmax(190px, 1fr)` on
     Investors. On a 366px column all of them are wrong in one of two
     directions — four columns is 82px each and the figures overflow their
     card, while auto-fit cannot fit a second 190px track and drops to ONE, so
     Investors spent 440px of an 844px screen drawing four numbers.

     Two is the number that works: 2 x 177px, which holds a 25px figure and its
     caption without wrapping either.

     `.main .stats` and not `.stats`, because this file is loaded before every
     page's own <style> and a bare class here loses the cascade to the rule
     declared there — the same reason `.main .stagebar` is written that way. */
  .main .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .main .stats .stat { padding: 11px 12px; }
  .main .stats .stat .v { font-size: 21px; }

  /* Card headings wrap instead of crushing the title.
     `.card-h` is a flex row of icon, title, count, spacer, then whatever the
     card wants at the far end — a hint, a button, a select, sometimes all
     three. A flex item's automatic minimum is its min-content width, so when
     that row overflows the <h2> is the thing that gives: "Exposure by company"
     was being folded into three lines inside a 90px column while a 150px hint
     wrapped to three of its own beside it, and Finance's "Every expense, and
     how Max reads it" made four lines next to a month select, a Filter and an
     Export that ran off the screen entirely.

     Letting the row wrap fixes both at once and costs a line: the title gets
     the first line to itself and the controls drop underneath, still visible
     and still tappable, instead of being squeezed to a word each.

     `flex: 1 0 auto` on the h2 — grow into the leftover, and NEVER shrink,
     which is the half that stops the folding. */
  .card-h { flex-wrap: wrap; row-gap: 7px; }
  .card-h > h2 { flex: 1 0 auto; }

  /* A `.tiny` in a card heading is always the trailing note that explains the
     card — "largest position first", "A guest can negotiate a time", "Always
     from max@gtmnholdings.com". Checked across every screen: the slot after
     the spacer holds a chip, a button, a readout or one of these, and the
     `.tiny` case is the only one that is a sentence. A sentence given the last
     140px of a row is a column of two-word lines, so it takes a line of its
     own and reads as prose. */
  .card-h > .tiny { flex: 1 0 100%; }

  /* The tab strips scroll rather than clip.
     `.tabs` is `display: inline-flex`, so it is exactly as wide as its buttons
     and simply hangs over the edge — Library's third tab read "What M" and
     People's "Matches" lost its count, with nothing on screen to suggest there
     was more. Block-level plus a scroller is the same answer already used for
     the topbar instruments and the Deals stage bar.

     `flex: none` on the children matters: in a nowrap row with no room to
     spare, flex items shrink by default, which would squeeze each tab to its
     longest word instead of letting the strip scroll. */
  .main .tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .main .tabs::-webkit-scrollbar { display: none; }
  .main .tabs > * { flex: none; }

  /* Machine text that has become a paragraph.
     `.readout` is for counters and coordinates — 10px mono, uppercased, with
     .15em of letter-spacing, all of which is right for "jul 2026 · usd" on one
     line. Several screens use it for a full sentence ("ask him on whatsapp for
     now — this portal reads his memory, it does not talk back yet"), and at
     .15em that sentence is three lines of spaced capitals, which is a wall
     rather than a caption. The tracking is what costs the most and buys the
     least once the string wraps at all, so it comes down inside .main — and
     only inside .main, because the topbar's readouts are still single tokens
     and still want it. */
  .main .readout { letter-spacing: .06em; }

  /* The hairline rail that fills whatever a row has left over.
     Every page that draws a feed strip closes it with `<div class="tick">` set
     to `flex: 1`, which at desk width is a few centimetres of hairline finishing
     the row. On a phone the strip wraps, the tick lands on a line of its own,
     and `flex: 1` then means the full width of the screen: an ornament sized to
     leftover space, drawn where there is none, reading as a band of tally marks
     under the sources. It is decoration, so it goes rather than shrinks.

     `.main` for weight — the pages define `.feeds .tick { flex: 1 }` in their
     own <style>, which is parsed after this file, so a bare `.feeds .tick` here
     would tie and lose. Same reason as `.main [data-phone-hide]` above. */
  .main .feeds .tick { display: none; }
}
