@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');
@import url('tokens.css');

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

html, body {
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img, video, canvas {
  max-width: 100%;
  height: auto;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* :not(.btn) on every rule below: a button-styled anchor (<a class="btn
   btn-primary">) must keep .btn-primary/.btn-ghost's own text colour, not
   the plain-link colour - without the exclusion, these `a` rules
   out-specificity .btn-primary's single class selector and paint teal link
   text onto a near-identical teal button background, unreadable in light
   mode (e.g. "Open evidence portfolio" on account.html). */
a:not(.btn) { color: var(--pascal-blue-bright); }
:root[data-theme="light"] a:not(.btn) { color: var(--pascal-blue); }
/* Un-set data-theme (no stored preference yet - the common case on first
   run) must fall back on the OS's actual preference, not assume light -
   without this guard, :not([data-theme="dark"]) matches ANY unset theme
   and wins on specificity over .btn-primary's on-accent color, which is
   exactly the bug that made "Start your route" unreadable: the light-mode
   link colour (#0096B7) landing on a dark-mode cyan button (#00B4D8) it
   nearly matches. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) a:not(.btn) { color: var(--pascal-blue); }
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.mono { font-family: var(--font-mono); letter-spacing: 0.01em; }

:focus-visible {
  outline: 2px solid var(--pascal-green);
  outline-offset: 2px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ── Buttons ── */
/* One size everywhere in the app: full width of the card, fixed height,
   smaller type so labels fit without growing the control. The login
   theme toggle is the only exception (compact circle in the top nav). */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  width: 100%;
  height: 2.85rem;
  min-height: 2.85rem;
  max-height: 2.85rem;
  padding: 0 0.85rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pascal-green); color: var(--on-accent); }
.btn-primary:hover { background: var(--pascal-green-dim); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-muted); }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.topnav .btn {
  width: auto;
  min-width: 2.85rem;
  padding: 0 0.75rem;
}
.tile-row { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.card .stack { align-items: stretch; width: 100%; }
.card .stack > .btn,
.card .stack > a.btn { width: 100%; align-self: stretch; }

/* ── Cards / surfaces ── */
/* Top accent is a real border-top so it follows the card radius at the
   corners. --accent-color is cycled per tile by rtrPaintTileStripes. */
.card {
  position: relative;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow);
}
/* Scroll entrance (rtrRevealTilesOnScroll in ui.js). Only a tile the JS
   actually opts in gets .rtr-reveal-pending, so a tile is never invisible
   by default - if the observer never runs, everything just stays visible.
   prefers-reduced-motion already zeroes every transition-duration globally
   (top of this file), which also neutralises this one. */
.rtr-reveal-pending { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease, transform 0.5s ease; }
.rtr-reveal-pending.rtr-revealed { opacity: 1; transform: none; }
/* Accent rides the top edge and the top corner arcs only. A coloured
   border-top bleeds down the left join on a rounded box, which read as
   a cheap side strip. Clip a full rounded stroke to the top 12px. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 3px solid var(--accent-color, var(--pascal-green));
  clip-path: inset(0 0 calc(100% - 8px) 0);
  pointer-events: none;
  /* Tapers the stripe's colour out toward each end instead of it just
     stopping dead at the corner - reads as a deliberate fade rather than a
     strip that got cut off (user feedback, 2026-09-05). */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
}
details.card > summary {
  list-style: none;
  cursor: default;
}
details.card > summary::-webkit-details-marker { display: none; }

/* ── Tab tiles (shared) ──────────────────────────────────────────
   A row of button "tiles" that each swap in one content panel below,
   used to keep a data-dense page's landing view to a handful of tiles
   with nothing else on-screen until a tile is picked (log-progress.html,
   interview-prep.html - 2026-09-07 request). Wiring is a few lines of
   inline JS per page (toggle .active / [hidden] by matching data-tab to
   data-panel); this file only owns the look. */
.rtr-tabs { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); flex-wrap: wrap; justify-content: center; }
.rtr-tab {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--text-muted); cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: var(--step--1);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.rtr-tab svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rtr-tab:hover { color: var(--text); }
.rtr-tab.active { background: color-mix(in srgb, var(--pascal-green) 14%, transparent); border-color: var(--pascal-green); color: var(--pascal-green-text); }
.rtr-tab-panel[hidden] { display: none !important; }

/* Same tiles, but square and in a grid, for a page whose panels are
   short reference content rather than a form (interview-prep.html). */
.rtr-tab-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
@media (min-width: 981px) { .rtr-tab-tiles { grid-template-columns: repeat(3, 1fr); } }
.rtr-tab-tile {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-2); text-align: center; padding: var(--space-3);
  border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--text-muted); cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: var(--step--1);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.rtr-tab-tile svg { width: 30px; height: 30px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rtr-tab-tile:hover { color: var(--text); transform: translateY(-2px); }
.rtr-tab-tile.active { background: color-mix(in srgb, var(--pascal-green) 14%, transparent); border-color: var(--pascal-green); color: var(--pascal-green-text); }

/* Dashboard-style information tiles. Every card in a row shares the same
   vertical rhythm: fixed visual slot, title, body, CTA flush to the bottom
   so text no longer starts at different heights across the row. */
.rtr-action-cards { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-top: var(--space-3); }
.rtr-action-cards > * { min-width: 0; }
.rtr-action-card {
  text-align: center;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.rtr-tile-visual {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-bottom: var(--space-2);
}
.rtr-tile-visual svg { display: block; }
.rtr-tile-visual-lg { height: 110px; }
.rtr-action-card > h2 {
  font-size: var(--step-0);
  margin-bottom: var(--space-2);
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rtr-tile-body {
  flex: 1;
  width: 100%;
  font-size: var(--step--1);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  min-height: 3.6em;
}
.rtr-action-card .btn:last-child,
.rtr-tile-actions { margin-top: auto; }
.rtr-tile-actions { display: flex; flex-direction: row; gap: 0.5rem; width: 100%; }
.rtr-tile-actions .btn { flex: 1; width: auto; min-width: 0; }
.rtr-pace-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: auto;
  width: 100%;
}
.rtr-pace-control label { font-size: var(--step--1); color: var(--text-muted); }
.rtr-pace-control select { width: 100%; }
.rtr-progress-tile .rtr-tile-visual {
  height: 110px;
  overflow: visible;
  flex: none;
}
.rtr-progress-tile .rtr-tile-visual svg {
  width: 96px;
  height: 96px;
  max-height: none;
}
button.rtr-action-card, a.rtr-action-card {
  width: 100%;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
button.rtr-action-card.active {
  border-color: var(--pascal-green);
  box-shadow: inset 0 0 0 1px var(--pascal-green);
}

/* Candidate "view mentor" desk: identity plate + correspondence, not a
   mentor sign-in. Lives above the review-status tiles. */
.rtr-mentor-desk {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.rtr-mentor-desk .card {
  text-align: left;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rtr-mentor-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pascal-green-text);
  margin-bottom: var(--space-2);
}
.rtr-mentor-name { font-size: var(--step-2); margin: 0 0 0.25rem; }
.rtr-mentor-meta { margin-bottom: var(--space-3); }
.rtr-mentor-thread {
  flex: 1;
  min-height: 12rem;
  max-height: 22rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: var(--space-2);
  margin-bottom: var(--space-3);
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.rtr-mentor-empty { margin: auto; text-align: center; max-width: 28ch; }
.rtr-mentor-bubble {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.rtr-mentor-bubble p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.rtr-mentor-bubble time {
  display: block;
  margin-top: 0.35rem;
  font-size: var(--step--1);
  color: var(--text-muted);
}
.rtr-mentor-bubble.mine {
  align-self: flex-end;
  background: color-mix(in srgb, var(--pascal-green) 12%, var(--bg-raised));
  border-color: color-mix(in srgb, var(--pascal-green) 40%, var(--border));
}
.rtr-mentor-compose { margin-top: auto; }
.rtr-mentor-compose textarea { min-height: 5.5rem; resize: vertical; }

/* Shared frame for the AI-generated hero/badge photos under
   assets/img/site-photos/ - every placement was shipping the image raw
   (hard square corners, no border) while every other surface in the app
   (.card, above) is rounded with a border and soft glow, which is what
   made the photos read as pasted-on rather than part of the page. Two
   placements were also silently broken - `border-radius: var(--rad)`
   referenced a token that was never defined anywhere in this file, so it
   resolved to 0 (square) exactly like the placements with no radius at
   all. One class, applied everywhere a site-photo appears, replaces both. */
.site-photo {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--pascal-green-text);
}

/* ── Forms ── */
label { display: block; font-size: var(--step--1); color: var(--text-muted); margin-bottom: var(--space-1); }
input, select, textarea {
  width: 100%;
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  font-family: var(--font-body);
  font-size: var(--step-0);
}
/* Checkboxes/radios must stay their native small size - width:100% above
   stretches an invisible hit-box across the whole row while the visible
   tick stays tiny on the left, leaving a huge dead gap before its label
   text (e.g. the outcome checklist on the Engineering Report page). */
input[type="checkbox"], input[type="radio"] { width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--pascal-blue-bright); }
.field { margin-bottom: var(--space-3); }
/* Side-by-side field pairs (.grid-2/3/4) stretch every item to the row's
   tallest cell - a longer label wrapping to 2 lines otherwise pushes just
   that one input down, misaligning it against its neighbour's input. Bottom-
   aligning each field's own content keeps every input in the row level. */
.grid-2 > .field, .grid-3 > .field, .grid-4 > .field { display: flex; flex-direction: column; justify-content: flex-end; }
.form-error { color: var(--danger); font-size: var(--step--1); margin-top: var(--space-1); min-height: 1.2em; }

/* ── Top nav ── */
.topnav {
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.topnav-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-4); max-width: 1180px; margin: 0 auto; }
.topnav-inner-login { justify-content: center; flex-wrap: nowrap; }
.topnav-inner-login .nav-links { width: auto; flex-wrap: nowrap; }
/* A nav bar with nothing but the brand link (mentor sign-in/feedback pages)
   left-aligned under the default space-between - user feedback, 2026-09-05. */
.topnav-inner-solo { justify-content: center; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); text-decoration: none; color: var(--text); }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.nav-links { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); row-gap: 0.5rem; }
.nav-links a:not(.btn) { color: var(--text-muted); text-decoration: none; font-size: var(--step--1); font-weight: 500; }
.nav-links a:not(.btn):hover, .nav-links a:not(.btn).active { color: var(--text); }
.onboarding-hero { padding: 0.6rem; margin-bottom: var(--space-3); overflow: hidden; }
.onboarding-hero-photo,
.hero-banner {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  padding: 0.6rem;
  box-sizing: border-box;
  background: var(--bg-raised);
}
.hero-banner { margin: 0 auto var(--space-2); }

@media (max-width: 640px) {
  .topnav-inner { padding: var(--space-2) var(--space-3); }
  .nav-links { gap: var(--space-2); row-gap: 0.5rem; width: 100%; }
  .topnav-inner-login .nav-links { width: auto; }
}

/* ── Responsive grid utilities ── */
/* Default gap so tile grids are equally spaced app-wide without every
   caller having to remember an inline override - a page-specific inline
   `gap:` (e.g. a tighter form-field pair) still wins over this default. */
.grid-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
/* Grid items default to min-width:auto, sized to their content's
   intrinsic minimum - on a tablet-width 3/4-column layout, a card's own
   text refuses to shrink below that and forces its track wider than its
   1fr share, overlapping the next column. min-width:0 lets it wrap
   instead. Invisible on narrow single-column mobile, where there's
   already room, which is why this only shows up on wider screens. */
.grid-hero > *, .grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; }

@media (max-width: 760px) {
  .grid-hero, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 761px) and (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Waypoint status chips (route map) ── */
.chip { font-family: var(--font-mono); font-size: var(--step--1); padding: 0.15rem 0.55rem; border-radius: var(--radius-sm); }
.chip-done { background: color-mix(in srgb, var(--contour-green) 22%, transparent); color: var(--contour-green-text); }
.chip-active { background: color-mix(in srgb, var(--pascal-green) 20%, transparent); color: var(--pascal-green-text); }
.chip-upcoming { background: var(--bg-raised-2); color: var(--text-muted); }
.chip-warn { background: color-mix(in srgb, var(--karoo-ochre) 18%, transparent); color: var(--karoo-ochre); }

/* ── K53-style numbered step system ──────────────────────────────────
   Borrows the visual language of South Africa's K53 driving-manual: a
   bold numbered/lettered circle badge per step in a sequence, connected
   by a line, colour-coded by where you are in it. Used for any ordered
   procedure - landing-page "how it works", the onboarding wizard, the
   Degree-of-Responsibility ladder, the outcome checklist, and route
   waypoints - so the same "step 1 of N" visual reads consistently
   everywhere in the app. */
.k53-badge {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 999px;
  font-family: var(--font-mono); font-weight: 700; font-size: var(--step-0);
  border: 2px solid currentColor; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.k53-badge.tone-done { color: var(--contour-green-text); background: color-mix(in srgb, var(--contour-green) 18%, transparent); }
.k53-badge.tone-active { color: var(--pascal-green-text); background: color-mix(in srgb, var(--pascal-green) 18%, transparent); }
.k53-badge.tone-milestone { color: var(--karoo-ochre-text); background: color-mix(in srgb, var(--karoo-ochre) 18%, transparent); }
.k53-badge.tone-upcoming { color: var(--text-muted); background: var(--bg-raised-2); border-color: var(--border); }
.k53-badge.sm { width: 1.6rem; height: 1.6rem; font-size: var(--step--1); border-width: 1.5px; }

/* Vertical stepper - a rail of badges connected by a line, body text to the right */
.k53-step { display: flex; gap: var(--space-3); }
.k53-step-rail { display: flex; flex-direction: column; align-items: center; flex: none; }
.k53-step-rail .k53-line { flex: 1; width: 2px; background: var(--border); min-height: var(--space-2); }
.k53-step:last-child .k53-step-rail .k53-line { display: none; }
.k53-step-body { padding-bottom: var(--space-4); flex: 1; min-width: 0; }

/* Horizontal stepper - badges in a row connected by a line (wizard-style flows) */
.k53-steps-h { display: flex; align-items: center; }
.k53-steps-h .k53-line-h { flex: 1; height: 2px; background: var(--border); min-width: 1rem; margin: 0 0.4rem; }

/* ── Error banner (window.rtrShowError) ── */
.rtr-error-banner {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  background: var(--danger); color: #fff;
  padding: 0.7rem var(--space-4);
  font-size: var(--step--1); font-weight: 500;
}
.rtr-error-banner button {
  background: transparent; border: none; color: #fff; font-size: 1.3rem; line-height: 1;
  cursor: pointer; padding: 0 0.3rem;
}

/* ── Loading overlay (window.rtrShowLoading/rtrHideLoading, ui.js) ──
   Every data-page page ships an empty content container until several
   sequential awaits resolve (rtrRequireAuth + 2-4 more Supabase calls) -
   this full-viewport overlay covers that gap instead of a blank flash.
   z-index 45: above the 30 topbar/bottomnav chrome, below the 50 error
   banner so a load failure's error text is never hidden behind it
   (rtrShowError calls rtrHideLoading itself - see ui.js). */
.rtr-loading-overlay {
  position: fixed; inset: 0; z-index: 45;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.rtr-loading-spinner {
  width: 32px; height: 32px; border-radius: 999px;
  border: 3px solid var(--border);
  border-top-color: var(--pascal-green);
  animation: rtr-spin 0.7s linear infinite;
}
@keyframes rtr-spin { to { transform: rotate(360deg); } }

/* ── Icon tiles / badges (landing-page smart-art accents) ── */
.icon-tile {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-raised-2); margin-bottom: var(--space-2);
}
.icon-badge {
  width: 56px; height: 56px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; margin-bottom: var(--space-2);
}

/* ── Blueprint & Drafting Instruments (signature theme) ──────────────
   .blueprint-panel: faint drafting-grid texture for hero/summary cards -
   used sparingly (one or two per page, never every card) so it reads as a
   deliberate accent, not wallpaper. Pair with a .blueprint-mark crosshair
   (an inline SVG dropped in the corner) and .instrument-icon svgs for the
   hand-drawn compass/set-square/level iconography. Screen-only: reports
   strip all of this under @media print - a real ECSA submission stays a
   plain document, not a themed one. */
.blueprint-panel {
  position: relative;
  overflow: hidden;
  background-image:
    linear-gradient(color-mix(in srgb, var(--pascal-green) 10%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--pascal-green) 10%, transparent) 1px, transparent 1px);
  background-size: 24px 24px;
}
.blueprint-mark { position: absolute; top: var(--space-2); right: var(--space-2); width: 20px; height: 20px; opacity: 0.4; color: var(--pascal-green); pointer-events: none; }
.instrument-icon { width: 32px; height: 32px; flex: none; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* Compact variant for an icon sitting inline next to a card's own h2/h3
   heading (account.html's section headers, etc.) - the default size above
   is for a page's single big H1 icon, too large next to in-card heading text. */
.instrument-icon.sm { width: 20px; height: 20px; }

/* Dimension-line stat - a value flanked by tick marks, like a measurement
   callout on a technical drawing. Use for headline numbers you want to
   read as "measured", not just displayed. */
.dimension-stat { display: flex; align-items: center; gap: 0.5rem; }
.dimension-stat .dim-tick { width: 1px; height: 10px; background: var(--karoo-ochre); flex: none; }
.dimension-stat .dim-rule { flex: 1; height: 1px; background: color-mix(in srgb, var(--karoo-ochre) 55%, transparent); min-width: 0.75rem; }
.dimension-stat .dim-label { font-family: var(--font-body); font-size: var(--step--1); color: var(--text-muted); white-space: nowrap; }

@media print {
  .blueprint-panel { background-image: none; }
  .blueprint-mark { display: none; }
}

.no-print { }
@media print {
  .no-print { display: none !important; }
}

/* ── App chrome: X-style top bar + bottom tab bar ──────────────────
   Replaces the old per-page horizontal .topnav link list. Injected once
   by rtrRenderAppChrome() (assets/js/ui.js) into every authenticated app
   page - body gets .rtr-has-chrome for the top/bottom safe-area padding.
   Both bars carry .no-print so neither appears in Print/Save-as-PDF output.
   Icon <svg> elements also carry explicit width/height XML attributes (set
   in ui.js, not just here) as a defense-in-depth belt-and-braces measure -
   see service-worker.js's CACHE version comment for the stale-cache bug
   this guards against: if CSS ever fails to load, an unstyled <svg> with no
   width/height attribute renders at the browser's oversized intrinsic
   default instead of collapsing to 0, which is exactly what shipped once.
   No backdrop-filter here (2026-08-12): both bars are fixed and always
   on-screen, so blur() was resampling everything scrolling underneath on
   every frame - measurably part of the Android WebView scroll jank found
   during the perf pass (see PLAY-STORE-LAUNCH.md-adjacent perf notes).
   Dropped in favour of the same solid-ish color-mix background alone,
   which reads almost identically at 88-94% opacity without the per-frame
   resample cost. */
/* padding-bottom must match .rtr-bottomnav's own height + safe-area inset
   below, or it under-reserves space on any gesture-nav phone (the inset is
   nonzero there) and the last card on every page sits partly behind the
   bottom nav - found via on-device battle-testing 2026-09-05. */
body.rtr-has-chrome { padding-top: 58px; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

.rtr-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: 58px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--space-3);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid var(--border);
}
.rtr-topbar-start { justify-self: start; }
.rtr-topbar-center { justify-self: center; display: flex; align-items: center; gap: 0.4rem; }
.rtr-topbar-end { justify-self: end; }
/* Circle behind the logo, matching .rtr-avatar's own badge treatment
   (same background + border ring) rather than a flat white fill - a
   plain navy-on-transparent mark reads as decoration, not a button, in
   dark mode without some kind of badge around it. */
.rtr-topbar-center a {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px; flex: none;
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
}
.rtr-topbar-logo { width: 26px; height: 26px; flex: none; display: block; }

.rtr-avatar {
  width: 38px; height: 38px; border-radius: 999px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-raised-2); color: var(--text);
  font-family: var(--font-display); font-weight: 700; font-size: 0.85rem;
  border: 1px solid var(--border); overflow: hidden; text-decoration: none;
}
.rtr-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Legal/info link, top right - same badge treatment as the avatar and
   topbar logo so all three chrome buttons read as one family. */
.rtr-topbar-info {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px; flex: none;
  background: var(--bg-raised-2); border: 1px solid var(--border);
  color: var(--text-muted); text-decoration: none;
}
.rtr-topbar-info:hover { color: var(--text); }

/* Bottom bar: icon-only (no visible labels), matching the X app reference -
   each tab still carries aria-label/title for screen readers and long-press
   tooltips even without on-screen text. */
.rtr-topbar, .rtr-bottomnav {
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}
.rtr-bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: 64px;
  display: flex; align-items: stretch; justify-content: space-around;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.rtr-tab {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); text-decoration: none; background: none; border: none; cursor: pointer;
}
.rtr-tab svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; }
.rtr-tab.active { color: var(--pascal-green); }

/* ── Desktop sidebar (Clockify-style) ──────────────────────────────
   Built by the same rtrRenderAppChrome() call from the same TABS array -
   see assets/js/ui.js. Both this and the topbar/bottomnav are always in
   the DOM; this media query is the only thing deciding which shows,
   matching the app's existing 981px+ "desktop" tier (tablet stops at 980
   in the query above). Mobile/tablet keep today's chrome untouched. */
.rtr-sidebar { display: none; }
@media (min-width: 981px) {
  .rtr-topbar, .rtr-bottomnav { display: none; }
  /* :has(.rtr-sidebar) matters: .rtr-has-chrome is added synchronously
     before auth resolves (see ui.js) so the topbar/bottomnav space is
     reserved from first paint, but the sidebar itself is only appended
     once rtrRenderAppChrome() actually confirms a signed-in user. Without
     this guard, any visit where the sidebar never mounts (auth still
     pending past the loading overlay, or a page that isn't actually
     redirect-gated) reserved a 240px gutter for a sidebar that was never
     there and stretched the container full-width into the remainder -
     content read as unstyled and off-centre (found via user report,
     2026-09-08). */
  body.rtr-has-chrome:has(.rtr-sidebar) {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 240px;
    transition: padding-left 0.2s ease;
    min-height: 100vh;
    min-height: 100dvh;
  }
  body.rtr-sidebar-collapsed.rtr-has-chrome:has(.rtr-sidebar) { padding-left: 72px; }
  body.rtr-has-chrome:has(.rtr-sidebar) .container {
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .rtr-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    z-index: 30;
    background: var(--bg-raised);
    border-right: 1px solid var(--border);
    padding: var(--space-4) var(--space-3);
    gap: var(--space-3);
    transition: width 0.2s ease;
    overflow: visible;
  }
  .rtr-sidebar.collapsed { width: 72px; padding-left: var(--space-2); padding-right: var(--space-2); }

  .rtr-sidebar-head { display: flex; align-items: center; justify-content: center; }
  .rtr-sidebar-brand {
    display: flex; align-items: center; gap: var(--space-2);
    font-family: var(--font-display); font-weight: 700; font-size: var(--step-0);
    color: var(--text); text-decoration: none;
  }
  .rtr-sidebar-brand svg { border-radius: 999px; flex: none; }
  .rtr-sidebar.collapsed .rtr-sidebar-brand span { display: none; }

  /* Chevron sits on the extreme right edge, vertically centred on the
     whole sidebar, overlapping the content by half so it stays reachable
     when the rail is collapsed. */
  .rtr-sidebar-collapse {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translate(50%, -50%);
    display: flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 999px; flex: none;
    background: var(--bg-raised); border: 1px solid var(--border); cursor: pointer;
    color: var(--text-muted); z-index: 32;
    transition: transform 0.2s ease, background 0.15s ease, color 0.15s ease;
  }
  .rtr-sidebar-collapse:hover { background: var(--bg-raised-2); color: var(--text); }
  .rtr-sidebar.collapsed .rtr-sidebar-collapse { transform: translate(50%, -50%) rotate(180deg); }

  .rtr-sidebar-nav { display: flex; flex-direction: column; gap: 0.1rem; }
  .rtr-sidebar-link {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 0.5rem var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none;
    font-size: var(--step--1); font-weight: 500;
    white-space: nowrap; overflow: hidden;
  }
  button.rtr-sidebar-link {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
  }
  .rtr-sidebar.collapsed .rtr-sidebar-link { justify-content: center; }
  .rtr-sidebar.collapsed .rtr-sidebar-link > span:not(.rtr-avatar) { display: none; }
  .rtr-sidebar-link svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
  .rtr-sidebar-link:hover { background: var(--bg-raised-2); color: var(--text); }
  .rtr-sidebar-link.active { background: color-mix(in srgb, var(--pascal-green) 14%, transparent); color: var(--pascal-green-text); }
  .rtr-sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 0.1rem; border-top: 1px solid var(--border); padding-top: var(--space-3); }

  /* Footer items reuse .rtr-sidebar-link so icon + text line up with the
     nav above: same padding, gap, icon size, and type. */
  .rtr-theme-icon-dark { display: none; }
  :root[data-theme="dark"] .rtr-theme-icon-light,
  :root:not([data-theme="light"]) .rtr-theme-icon-light { display: none; }
  :root[data-theme="dark"] .rtr-theme-icon-dark,
  :root:not([data-theme="light"]) .rtr-theme-icon-dark { display: block; }
  :root[data-theme="light"] .rtr-theme-icon-light { display: block; }
  :root[data-theme="light"] .rtr-theme-icon-dark { display: none; }
  .rtr-sidebar-link .rtr-avatar { width: 20px; height: 20px; font-size: 0.6rem; flex: none; }
  .rtr-sidebar-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Density: work-tool feel instead of the centered mobile card stack.
     Leave max-width and centering alone here: login/onboarding/home still
     need a centred column. App pages with the sidebar opt out via
     body.rtr-has-chrome .container above. */
  .container { padding: var(--space-4) var(--space-5, 2.5rem); }
  .rtr-action-cards { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--space-3); }
  .rtr-mentor-desk { grid-template-columns: minmax(16rem, 0.9fr) minmax(20rem, 1.1fr); align-items: stretch; }
  .card { padding: var(--space-3); }
  .k53-step-body { padding-bottom: var(--space-3); }

  /* Packed canvas for hub pages. Report/portfolio/account/log/interview
     section pages scroll so their tiles are not clipped. */
  body.rtr-has-chrome:has(.rtr-sidebar):not([data-page^="report-"]):not([data-page="portfolio"]):not([data-page="organogram"]):not([data-page="quiz"]):not([data-page^="cpd-"]):not([data-page="account"]):not([data-page="log-progress"]):not([data-page="interview-prep"]):not([data-page="profession-exam"]):not([data-page="profession-report"]):not([data-page="mentor-review"]):not([data-page="privacy-policy"]):not([data-page="terms"]):not([data-page="cookie-policy"]):not([data-page="refund-policy"]) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  body.rtr-has-chrome:has(.rtr-sidebar):not([data-page^="report-"]):not([data-page="portfolio"]):not([data-page="organogram"]):not([data-page="quiz"]):not([data-page^="cpd-"]):not([data-page="account"]):not([data-page="log-progress"]):not([data-page="interview-prep"]):not([data-page="profession-exam"]):not([data-page="profession-report"]):not([data-page="mentor-review"]):not([data-page="privacy-policy"]):not([data-page="terms"]):not([data-page="cookie-policy"]):not([data-page="refund-policy"]) #main.container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    min-height: 0;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }

  body.rtr-has-chrome:has(.rtr-sidebar):not([data-page="account"]) .rtr-action-card:not(.rtr-progress-tile) .rtr-tile-visual { height: 52px; margin-bottom: var(--space-1); }
  body.rtr-has-chrome:has(.rtr-sidebar):not([data-page="account"]) .rtr-action-card:not(.rtr-progress-tile) .rtr-tile-visual-lg { height: 64px; }
  body.rtr-has-chrome:has(.rtr-sidebar):not([data-page="account"]) .rtr-action-card:not(.rtr-progress-tile) .rtr-tile-visual svg { max-height: 48px; width: auto; }
  body.rtr-has-chrome:has(.rtr-sidebar):not([data-page="account"]) .rtr-action-card:not(.rtr-progress-tile) > h2 { min-height: 0; margin-bottom: 0.35rem; }
  body.rtr-has-chrome:has(.rtr-sidebar):not([data-page="account"]) .rtr-action-card:not(.rtr-progress-tile) .rtr-tile-body { min-height: 0; }

  /* Dashboard + reports hub: 3+2 that both fill the full width. */
  body[data-page="dashboard"] .rtr-action-cards,
  body[data-page="reports"] .rtr-action-cards,
  body[data-page="legal"] .rtr-action-cards {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--space-3);
    margin-top: 0;
    flex: 1;
    min-height: 0;
    align-content: stretch;
  }
  body[data-page="dashboard"] .rtr-action-card:nth-child(-n+3),
  body[data-page="reports"] .rtr-action-card:nth-child(-n+3),
  body[data-page="legal"] .rtr-action-card:nth-child(-n+3) { grid-column: span 2; }
  body[data-page="dashboard"] .rtr-action-card:nth-child(n+4),
  body[data-page="reports"] .rtr-action-card:nth-child(n+4),
  body[data-page="legal"] .rtr-action-card:nth-child(n+4) { grid-column: span 3; }

  /* Progress donut sits in its own 136px slot so it is not clipped by the
     packed 52px visual or overlapped by "Your progress" text. */
  body.rtr-has-chrome[data-page="dashboard"]:has(.rtr-sidebar) .rtr-progress-tile {
    overflow: hidden;
    min-height: 0;
  }
  body.rtr-has-chrome[data-page="dashboard"]:has(.rtr-sidebar) .rtr-progress-tile .rtr-tile-visual {
    /* Donut takes only the height left after the text and button, so short
       laptop viewports shrink the ring instead of overlapping the CTA. */
    flex: 1 1 0;
    min-height: 56px;
    max-height: 148px;
    margin-bottom: var(--space-2);
    overflow: visible;
    align-items: center;
    justify-content: center;
  }
  body.rtr-has-chrome[data-page="dashboard"]:has(.rtr-sidebar) .rtr-progress-tile .rtr-tile-visual svg {
    max-height: none;
    width: auto;
    height: 100%;
    max-height: 136px;
    aspect-ratio: 1;
    display: block;
  }
  body.rtr-has-chrome[data-page="dashboard"]:has(.rtr-sidebar) .rtr-progress-tile > h2 {
    min-height: 0;
    margin-bottom: var(--space-1);
    position: relative;
    z-index: 1;
  }
  body.rtr-has-chrome[data-page="dashboard"]:has(.rtr-sidebar) .rtr-progress-tile .rtr-tile-body {
    min-height: 0;
    position: relative;
    z-index: 1;
  }

  body[data-page="dashboard"] .rtr-pace-control {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    margin-top: auto;
    width: 100%;
  }
  body[data-page="dashboard"] .rtr-pace-control label {
    font-size: var(--step--1);
    color: var(--text-muted);
  }
  body[data-page="dashboard"] .rtr-pace-control select {
    width: 100%;
    height: 2.85rem;
  }

  /* Document pages use the full canvas; cards sit in a 2-col grid. */
  body.rtr-has-chrome:has(.rtr-sidebar)[data-page^="report-"] .container,
  body.rtr-has-chrome:has(.rtr-sidebar)[data-page="profession-report"] .container,
  body.rtr-has-chrome:has(.rtr-sidebar)[data-page="portfolio"] .container,
  body.rtr-has-chrome:has(.rtr-sidebar)[data-page="organogram"] .container,
  body.rtr-has-chrome:has(.rtr-sidebar)[data-page^="cpd-"] .container,
  body.rtr-has-chrome:has(.rtr-sidebar)[data-page="quiz"] .container {
    max-width: none !important;
    width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body[data-page^="report-"] .rtr-doc-grid,
  body[data-page="portfolio"] .rtr-doc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    align-items: stretch;
  }
  body[data-page="portfolio"] .rtr-doc-grid { gap: var(--space-5); }
  body[data-page="portfolio"] #p-outcomes { margin-top: var(--space-4); }
  body[data-page^="report-"] .rtr-doc-grid > *,
  body[data-page="portfolio"] .rtr-doc-grid > * {
    min-width: 0;
    min-height: 0;
  }
  body[data-page^="report-"] .rtr-doc-grid > .card,
  body[data-page="portfolio"] .rtr-doc-grid > .card {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  body[data-page^="report-"] .rtr-doc-span-2,
  body[data-page="portfolio"] .rtr-doc-span-2,
  body[data-page="portfolio"] #p-outcomes > p {
    grid-column: 1 / -1;
  }

  /* Interview prep: 3x2 hub tiles; section pages scroll. */
  body[data-page="interview-prep"] #main.container {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  body[data-page="interview-prep"] #ip-section-tiles:not([hidden]) {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    align-content: stretch;
    min-height: 0;
  }
  body[data-page="interview-prep"] #ip-section-tiles .rtr-action-card {
    min-height: 0;
    height: 100%;
  }
  body.rtr-has-chrome[data-page="interview-prep"]:has(.rtr-sidebar) #ip-section-tiles .rtr-tile-visual {
    height: 88px;
    margin-bottom: var(--space-2);
  }
  body.rtr-has-chrome[data-page="interview-prep"]:has(.rtr-sidebar) #ip-section-tiles .rtr-tile-visual svg {
    max-height: none;
    width: 56px;
    height: 56px;
  }
  body.rtr-has-chrome[data-page="interview-prep"]:has(.rtr-sidebar) #ip-section-tiles .rtr-action-card > h2 {
    min-height: 2.4em;
    margin-bottom: var(--space-2);
  }
  body.rtr-has-chrome[data-page="interview-prep"]:has(.rtr-sidebar) #ip-section-tiles .rtr-tile-body {
    min-height: 3.6em;
  }
  body[data-page="interview-prep"] .rtr-tab-panel {
    flex: none;
  }
  body[data-page="interview-prep"] .rtr-tab-panel > h2 {
    text-align: center;
  }
  body[data-page="interview-prep"] .rtr-tab-panel .rtr-action-cards {
    flex: none;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: var(--space-3);
    align-content: start;
  }
  body[data-page="interview-prep"] .rtr-tab-panel .rtr-action-card {
    height: auto;
    text-align: center;
  }
  body[data-page="interview-prep"] .rtr-tab-panel .rtr-tile-body {
    min-height: 0;
  }

  /* Account: original tile sizes, page can scroll so buttons don't overlap. */
  body[data-page="account"] #main.container {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  body[data-page="account"] .rtr-action-cards {
    flex: none;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--space-3);
    align-content: start;
  }
  body[data-page="account"] .rtr-tile-visual {
    height: 88px;
    margin-bottom: var(--space-2);
  }
  body[data-page="account"] .rtr-tile-visual-lg { height: 110px; }
  body[data-page="account"] .rtr-tile-visual svg {
    max-height: none;
    width: 56px;
    height: 56px;
  }
  body[data-page="account"] .rtr-action-card > h2 {
    min-height: 2.4em;
    margin-bottom: var(--space-2);
  }
  body[data-page="account"] .rtr-tile-body { min-height: 3.6em; }

  body[data-page="mentor-review"] .rtr-mentor-desk {
    flex: none;
    min-height: 0;
    margin-bottom: var(--space-3);
    align-items: stretch;
  }
  body[data-page="mentor-review"] .rtr-mentor-desk .card {
    min-height: 0;
    overflow: hidden;
  }
  body[data-page="mentor-review"] .rtr-action-cards {
    flex: none;
    min-height: 0;
  }
  body[data-page="mentor-review"] .rtr-mentor-thread {
    flex: 1 1 auto;
    min-height: 12rem;
    max-height: 22rem;
    overflow: auto;
  }
  body[data-page="mentor-review"] .rtr-mentor-compose {
    flex: none;
  }
  body[data-page="mentor-review"] .rtr-mentor-compose textarea {
    min-height: 5.5rem;
  }

  /* Log progress: keep the form compact, but never clip the submit/print buttons. */
  body[data-page="log-progress"] .container { padding-top: var(--space-3); padding-bottom: var(--space-3); }
  body[data-page="log-progress"] .field { margin-bottom: var(--space-2); }
  body[data-page="log-progress"] input,
  body[data-page="log-progress"] select,
  body[data-page="log-progress"] textarea { padding: 0.5rem 0.7rem; }
  body[data-page="log-progress"] textarea { min-height: 4.2rem; }
  body[data-page="log-progress"] .rtr-action-row { margin: var(--space-2) auto; }
  body[data-page="log-progress"] .rtr-tabs { flex: none; }
  body[data-page="log-progress"] .rtr-tab-panel {
    flex: none;
    overflow: visible;
  }
  body[data-page="log-progress"] .rtr-tab-panel[hidden] {
    display: none !important;
  }
  body[data-page="log-progress"] .rtr-tab-panel.card {
    overflow: visible;
    padding-bottom: 1.5rem;
  }
  body[data-page="log-progress"] .rtr-tab-panel[data-panel="entry"] > .row:has(#btn-repeat-last[hidden]) {
    display: none;
  }
  body[data-page="log-progress"] #entries-list { overflow: visible; max-height: none; }

  /* Calendar: shrink the month grid so the whole page fits one screen. */
  body[data-page="calendar"] .container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 100vh;
    overflow: hidden;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
  }
  body[data-page="calendar"] .cal-fit {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  body[data-page="calendar"] .cal-grid {
    flex: 1;
    min-height: 0;
    grid-auto-rows: minmax(0, 1fr);
  }
  body[data-page="calendar"] .cal-day { aspect-ratio: auto; min-height: 0; }

  /* Legal: 3+2 that both fill the full width (span trick), no blank column. */
  body[data-page="legal"] .container { padding-top: var(--space-3); padding-bottom: var(--space-3); }
  body[data-page="legal"] h1 { font-size: var(--step-2); margin-bottom: var(--space-2); }
  body[data-page="legal"] .card { padding: var(--space-3); }
  body[data-page="legal"] .rtr-tile-visual { height: 48px; margin-bottom: var(--space-1); }
  body[data-page="legal"] .rtr-tile-visual svg { width: 36px; height: 36px; max-height: none; }
  body[data-page="legal"] .rtr-action-card > h2 { min-height: 0; margin-bottom: var(--space-1); }
  body[data-page="legal"] .rtr-tile-body { min-height: 0; margin-bottom: var(--space-2); }
  body[data-page="legal"] .rtr-tile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  body[data-page="legal"] .rtr-tile-actions .btn { width: 100%; flex: none; }
}

/* Page action row (Print / Share) - replaces the buttons that used to live
   in each report page's nav bar. .no-print hides it from the PDF output. */
.rtr-action-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: 28rem;
  margin: var(--space-4) auto;
}
.rtr-action-row[hidden] { display: none !important; }
#ip-section-tiles[hidden],
#ip-back-row[hidden] { display: none !important; }

.rtr-doc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  align-items: stretch;
}
.rtr-doc-span-2 { grid-column: 1 / -1; }

/* ── Centered-by-default headings (uniform look across the app) ────────
   Every card's own heading and lead-in description centers by default.
   Structured content - lists, tables, form fields, logged entries - is
   nested deeper than a direct child, so the `>` combinator leaves it
   alone: centering a bullet list or a form field is a readability bug,
   not a style choice, regardless of how the surrounding card looks. */
.card > h1, .card > h2, .card > h3 { text-align: center; }
.card > h1.row, .card > h2.row, .card > h3.row { justify-content: center; }
main > h1, main > h2, main > h3 { text-align: center; }
.card .btn { width: 100%; margin-left: auto; margin-right: auto; }
.card .rtr-tile-actions .btn { width: 100%; max-width: 100%; min-width: 0; flex: 1; }
/* Page-header icon+title rows (icon <svg> + h1.display inside a centered
   .row): a centered flex item still left-aligns its OWN wrapped lines, so
   a two-line title looks off-center without this - the row's own
   justify-content:center only centers the icon+title as a group. */
.row > h1.display, .row > h2.display, .row > h3.display { text-align: center; }
.card > p.muted { text-align: center; }

/* ── Utility ── */
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.row { display: flex; align-items: center; gap: var(--space-2); }
.muted { color: var(--text-muted); }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: var(--space-2); top: var(--space-2); background: var(--pascal-green); color: var(--on-accent); padding: 0.6rem 1rem; border-radius: var(--radius-sm); z-index: 100; }

/* ── ECSA print document ──────────────────────────────────────────────
   Printing the live editable form (input boxes, textareas, dropdowns)
   produces a screenshot of a web form, not a document - see
   assets/js/ecsa-print.js. Each report builds a typeset, bordered-table
   version of itself into a hidden sibling of <main>, appended directly
   to <body> (never nested inside <main> - see rtrSetPrintSheet), and
   print mode hides everything else and shows only that. Letterhead/
   table/signature-row conventions verified against ECSA's own R-03-TER-PE
   and R-03-TES-PE templates (2013 revision) - field content itself
   follows the current 2022 R-03-PRO-SC Rev 3 structure where the two
   differ (see report-engineering.js's research note). */
.ecsa-print-sheet { display: none !important; }
@media print {
  /* Belt-and-braces: body's dark-theme background is only skipped by print
     "economy" color mode, which desktop browsers default to but Android's
     native WebView print pipeline does not reliably apply the same way -
     without an explicit white background here, a print job that fires
     before the sheet's content has painted (see PrintBridge.java's
     postVisualStateCallback fix) rendered as a solid dark page instead of a
     blank *white* one (user report, 2026-09-05). */
  html, body {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body > *:not(.ecsa-print-sheet) { display: none !important; }
  .ecsa-print-sheet,
  .ecsa-print-sheet[hidden] {
    display: block !important;
    background: #fff;
    margin: 0 auto;
    max-width: 190mm;
    padding: 12mm 10mm;
  }
}
/* Branded document treatment (Pippit promo video reference, 2026-08-12):
   navy letterhead band + teal accent rules, matching the video's document
   mockup - GEC navy for anything text sits on (contrast), teal reserved for
   thin accent lines and light tints where it never carries body text.
   Still black-on-white for every actual field value: this is a real
   document a candidate submits to ECSA, not a marketing showpiece, so the
   branding stays at the edges (header band, rules, table-header tint)
   and never touches legibility of the content itself. print-color-adjust
   is required here - browsers drop background colours from print output
   by default unless told otherwise. */
.ecsa-doc {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 9.5pt;
  color: #111; max-width: 190mm; margin: 0 auto; line-height: 1.35;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact;
}
.ecsa-doc table { width: 100%; border-collapse: collapse; margin-bottom: 10pt; page-break-inside: auto; }
.ecsa-doc th, .ecsa-doc td { border: 1px solid #0B1E3D; padding: 4pt 7pt; text-align: left; vertical-align: top; }
.ecsa-doc th { background: #E8F1F8; }
.ecsa-doc .ecsa-letterhead { text-align: center; font-weight: bold; padding: 9pt 8pt; font-size: 11pt; background: #0B1E3D; color: #fff; border-bottom: 3pt solid #00B4D8; letter-spacing: 0.01em; }
.ecsa-doc .ecsa-formno { text-align: right; font-size: 8.5pt; margin: 0 0 2pt; color: #0096B7; font-weight: bold; }
.ecsa-doc .ecsa-footer { font-size: 8pt; margin-top: 6pt; display: flex; justify-content: space-between; color: #444; }
.ecsa-doc h2 { font-size: 11pt; margin: 14pt 0 4pt; color: #0B1E3D; border-bottom: 2pt solid #00B4D8; padding-bottom: 2pt; }
.ecsa-doc p { margin: 0 0 6pt; }
.ecsa-doc .ecsa-sig-row td { height: 26pt; }
.ecsa-doc .ecsa-section { margin-bottom: 10pt; page-break-inside: avoid; }
.ecsa-doc .ecsa-label { font-weight: bold; font-size: 8.5pt; text-transform: uppercase; letter-spacing: 0.02em; display: block; margin-bottom: 2pt; color: #0096B7; }

/* ── Organogram chart (boxes + connecting line) - shared between the
   organogram builder page and the TER report/print sheet, since the TER's
   real ECSA form requires this as its own section, not just a text field. */
.org-chart { display: flex; flex-direction: column; align-items: center; padding: var(--space-3, 1rem) 0; }
.org-box { border: 1px solid var(--border, #ccc); border-radius: var(--radius-sm, 4px); padding: var(--space-2, 0.5rem) var(--space-3, 1rem); text-align: center; min-width: 200px; background: var(--bg-raised, #fff); }
.org-box.you { border-color: var(--pascal-blue-bright, #00B4D8); border-width: 2px; font-weight: 600; }
.org-link { width: 2px; height: 1.4rem; background: var(--pascal-blue-bright, #00B4D8); }

/* Voice typing mic on long textareas */
.rtr-voice-wrap { position: relative; }
.rtr-voice-wrap textarea { width: 100%; padding-right: 2.6rem; }
.rtr-voice-btn {
  position: absolute; top: 0.45rem; right: 0.45rem;
  width: 2rem; height: 2rem; padding: 0; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-raised);
  color: var(--text); display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.rtr-voice-btn:hover { border-color: var(--pascal-green); color: var(--pascal-green); }
.rtr-voice-btn.is-listening { background: var(--pascal-green); color: var(--ink-900); border-color: var(--pascal-green); }

.rtr-profession-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
.rtr-profession-grid label.card { margin: 0; }
.rtr-tour-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(11, 30, 61, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.rtr-tour-card { max-width: 28rem; width: 100%; text-align: center; }
.rtr-help-hits { margin-top: var(--space-2); }

#dash-modules { display: contents; }
.rtr-preview-banner {
  text-align: center;
  padding: var(--space-3);
  margin: 0 0 var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  font-size: var(--step--1);
}
.rtr-preview-banner a { font-weight: 600; }
