/* ==========================================================================
   UNITED ECHOES — Design system (2026 redesign)
   One brand colour: #763AED. Every purple here is that colour, or a darker /
   lighter step of it. Large areas stay neutral; purple is for actions, links,
   the active menu item and focus outlines.
   Fonts: Fraunces (page and section headings) + Figtree (everything else).
   Written mobile-first: base styles are for a 360px phone, then 600 / 900 / 1200px.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  /* Brand */
  --brand: #763AED;
  --brand-strong: #6128D4;            /* hover / pressed */
  --on-brand: #FFFFFF;

  /* Light theme (default for every visitor) */
  --bg: #F7F5F9;
  --surface: #FFFFFF;
  --surface-2: #EFECF3;
  --surface-3: #E6E2EC;
  --field: #FFFFFF;
  --line: #E1DDE7;
  --line-strong: #C8C2D1;
  --text: #1D1A21;
  --text-muted: #57515F;
  --text-dim: #6C6575;
  --brand-text: #6128D4;
  --link: #763AED;                    /* text links: the brand colour (5.3:1 on the page background) */
  --link-hover: #5420BD;
  --brand-tint: rgba(118, 58, 237, .09);
  --brand-line: rgba(118, 58, 237, .32);
  --success: #1B7A50;
  --warning: #8A6200;
  --error: #BE3537;
  --success-tint: rgba(27, 122, 80, .1);
  --warning-tint: rgba(138, 98, 0, .1);
  --error-tint: rgba(190, 53, 55, .09);
  --success-line: rgba(27, 122, 80, .35);
  --warning-line: rgba(138, 98, 0, .35);
  --error-line: rgba(190, 53, 55, .38);
  --hover: rgba(29, 26, 33, .05);
  --overlay: rgba(29, 26, 33, .45);
  --scroll-shade: rgba(29, 26, 33, .16);
  --shadow-float: 0 12px 36px rgba(29, 26, 33, .16);
  --date-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2357515F' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  --time-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2357515F' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolyline points='12 7 12 12 15 14'/%3E%3C/svg%3E");
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2357515F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  color-scheme: light;

  /* Type */
  --font-display: 'Fraunces', Charter, 'Bitstream Charter', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Spacing steps: 4 8 12 16 24 32 48 72 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;

  /* Corners: 6 fields, 8 buttons, 10 cards. Pills only for badges and chips. */
  --r-sm: 6px;
  --r-btn: 8px;
  --r: 10px;
  --r-lg: 12px;
  --r-pill: 999px;

  --container: 1160px;
  --header-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Names used by older pages and inline styles: kept so nothing breaks */
  --purple: var(--brand);
  --purple-dark: var(--brand-strong);
  --purple-light: var(--brand-text);
  --purple-tint: var(--brand-tint);
  --purple-border: var(--brand-line);
  --purple-glow: rgba(118, 58, 237, .3);
  --border: var(--line);
  --border-strong: var(--line-strong);
  --shadow: var(--shadow-float);
  --glow: 0 0 0 1px var(--brand-line);
  --hr: var(--brand);
  --hr-tint: var(--brand-tint);
  --hr-border: var(--brand-line);
  --hr-glow: rgba(118, 58, 237, .3);
}

/* Dark theme: only when chosen with the theme button (saved in this browser; see assets/js/theme-init.js) */
:root[data-theme="dark"] {
  /* True black: the page is #000000; cards and menus sit just above it in neutral greys so they stay visible. */
  --bg: #000000;
  --surface: #0E0E0F;
  --surface-2: #18181A;
  --surface-3: #222225;
  --field: #000000;                   /* inside of form fields */
  --line: #2A2A2D;
  --line-strong: #43434A;
  --text: #F5F5F5;
  --text-muted: #B4B4BA;
  --text-dim: #8E8E95;
  --brand-text: #B797F7;              /* purple for text and icons on dark */
  --link: #B797F7;
  --link-hover: #D3BEFB;
  --brand-tint: rgba(118, 58, 237, .16);
  --brand-line: rgba(118, 58, 237, .45);
  --success: #56C596;
  --warning: #E0B24A;
  --error: #F0787A;
  --success-tint: rgba(86, 197, 150, .13);
  --warning-tint: rgba(224, 178, 74, .14);
  --error-tint: rgba(240, 120, 122, .13);
  --success-line: rgba(86, 197, 150, .4);
  --warning-line: rgba(224, 178, 74, .42);
  --error-line: rgba(240, 120, 122, .45);
  --hover: rgba(255, 255, 255, .06);
  --overlay: rgba(0, 0, 0, .72);
  --scroll-shade: rgba(0, 0, 0, .45);
  --shadow-float: 0 16px 44px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
  --date-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23B4B4BA' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  --time-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23B4B4BA' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolyline points='12 7 12 12 15 14'/%3E%3C/svg%3E");
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B4B4BA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
/* Safety net: if anything is ever a few pixels too wide, phones must not shrink the whole page to fit it.
   (clip, unlike hidden, keeps sticky headers and bars working.) */
html { overflow-x: hidden; }
body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 1.0625rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
main { flex: 1 0 auto; min-width: 0; }
main:focus { outline: none; }
img, video { max-width: 100%; height: auto; display: block; }
audio { max-width: 100%; }
.icon { display: inline-block; flex: none; vertical-align: middle; stroke-width: 1.75; }
h1, h2, h3, h4 { margin: 0 0 .6em; text-wrap: balance; }
h1, h2 { font-family: var(--font-display); font-weight: 500; line-height: 1.12; letter-spacing: -.012em; }
h3, h4 { font-family: var(--font-body); font-weight: 600; line-height: 1.3; }
h1 { font-size: clamp(2.1rem, 6vw, 3.5rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.25rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
strong, b { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
::selection { background: var(--brand); color: var(--on-brand); }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 300; background: var(--brand); color: var(--on-brand); padding: .7rem 1.1rem; border-radius: var(--r-btn); transition: top .2s; }
.skip-link:focus { top: 1rem; color: var(--on-brand); }
.num { font-variant-numeric: tabular-nums; }

/* 3. Layout utilities ------------------------------------------------------ */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }
.narrow { max-width: 760px; }
.section { padding-block: clamp(3rem, 8vw, 5.25rem); }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-alt .card { background: var(--bg); }
.section-head { max-width: 680px; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.section-head h2 { margin-bottom: .35em; }
.lead { font-size: clamp(1.0625rem, 1.6vw, 1.1875rem); color: var(--text-muted); max-width: 60ch; }
.section-head .lead:last-child { margin-bottom: 0; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.text-center { text-align: center; }
.text-center .lead { margin-inline: auto; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.flex { display: flex; gap: 1rem; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.text-center .btn-row { justify-content: center; }
.stack > * + * { margin-top: 1rem; }
.inline-form { display: inline; margin: 0; }
.kicker { color: var(--brand-text); font-weight: 600; margin-bottom: .5rem; }
.echo-text { text-shadow: none; }
@media (min-width: 600px) {
  .grid { gap: 1.25rem; }
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
}

/* 4. Logo ------------------------------------------------------------------ */
.brand { display: inline-flex; flex: none; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.logo { display: inline-flex; align-items: center; gap: .6rem; }
.logo-mark rect { fill: var(--brand); }
.logo-text { font: 600 .95rem/1 var(--font-body); letter-spacing: .14em; color: var(--text); white-space: nowrap; }
.logo-img { height: 34px; width: auto; max-width: 100%; }
.footer-brand .logo-img { height: 42px; }
.auth-card .brand .logo-img { height: 44px; }
@media (min-width: 900px) { .logo-img { height: 38px; } }

/* 5. Buttons ---------------------------------------------------------------
   One shape for every button, taken from the "Login / Register" button:
   8px corners, 600-weight 15px text, about 40px high, never underlined.
   Variants only change colours:
     .btn-primary              solid #763AED, white text: the main action of a page or form
     .btn-secondary / .btn     light purple tint, purple text: View all, Edit, Back, Cancel, Download…
     .btn-ghost                same look as .btn-secondary (kept so older markup keeps working)
     .btn-outline              white (surface) with a purple border, purple text
     .btn-danger               red tint (e.g. Delete in a list); add .btn-danger-solid for the final confirm
   Sizes: .btn-sm (34px, table rows) · default (40px) · .btn-lg (48px, hero / call to action).
   Phones and touch screens: every button is at least 44px high.
   Icon-only buttons: .btn-icon (square) with an aria-label or a .sr-only label. */
:root {
  --btn-h: 40px; --btn-h-sm: 34px; --btn-h-lg: 48px;
  --btn-primary: #763AED; --btn-primary-hover: #6128D4; --btn-primary-press: #5420BD;
  --btn-2-bg: rgba(118, 58, 237, .10); --btn-2-bg-hover: rgba(118, 58, 237, .17); --btn-2-bg-press: rgba(118, 58, 237, .24);
  --btn-2-line: rgba(118, 58, 237, .30); --btn-2-line-hover: rgba(118, 58, 237, .55);
  --btn-2-text: #6128D4;               /* darker step of #763AED: keeps AA contrast on the tint */
  --btn-outline-bg: var(--surface); --btn-outline-line: #763AED; --btn-outline-text: #763AED;
  --btn-danger-bg: rgba(190, 53, 55, .08); --btn-danger-bg-hover: rgba(190, 53, 55, .14); --btn-danger-line: rgba(190, 53, 55, .40);
  --btn-danger-text: #B02F31; --btn-danger-solid: #BE3537; --btn-danger-solid-hover: #A52A2C;
  --btn-focus: #763AED; --btn-focus-halo: rgba(118, 58, 237, .25);
}
:root[data-theme="dark"] {
  --btn-2-bg: rgba(118, 58, 237, .20); --btn-2-bg-hover: rgba(118, 58, 237, .30); --btn-2-bg-press: rgba(118, 58, 237, .38);
  --btn-2-line: rgba(151, 108, 242, .45); --btn-2-line-hover: rgba(183, 151, 247, .75);
  --btn-2-text: #C9B5FA;
  --btn-outline-line: #9B72F2; --btn-outline-text: #C9B5FA;
  --btn-danger-bg: rgba(240, 120, 122, .12); --btn-danger-bg-hover: rgba(240, 120, 122, .2); --btn-danger-line: rgba(240, 120, 122, .5);
  --btn-danger-text: #F59A9C;
  --btn-focus: #B797F7; --btn-focus-halo: rgba(183, 151, 247, .3);
}
.btn {
  --_bg: var(--btn-2-bg); --_bg-h: var(--btn-2-bg-hover); --_bg-a: var(--btn-2-bg-press);
  --_bd: var(--btn-2-line); --_bd-h: var(--btn-2-line-hover);
  --_fg: var(--btn-2-text); --_fg-h: var(--btn-2-text); --_spin: var(--btn-2-text);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--btn-h); padding: .5rem 1.125rem; margin: 0;
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_bd); border-radius: var(--r-btn);
  font: 600 .9375rem/1.25 var(--font-body); letter-spacing: normal; text-align: center; white-space: nowrap;
  text-decoration: none !important; vertical-align: middle; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
}
/* A visited link keeps its button colour. Kept at the same weight as one class, so a page's own button colours
   (for example the outline button on the purple banner) still win after the link has been visited. */
.btn:where(:visited) { color: var(--_fg); }
.btn:where(:not([disabled], [aria-disabled="true"])):hover { background: var(--_bg-h); border-color: var(--_bd-h); color: var(--_fg-h); }
.btn:where(:not([disabled], [aria-disabled="true"])):active { background: var(--_bg-a); transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--btn-focus); outline-offset: 2px; border-radius: var(--r-btn); box-shadow: 0 0 0 5px var(--btn-focus-halo); }
.btn .icon { flex: none; }
.btn-primary {
  --_bg: var(--btn-primary); --_bg-h: var(--btn-primary-hover); --_bg-a: var(--btn-primary-press);
  --_bd: var(--btn-primary); --_bd-h: var(--btn-primary-hover); --_fg: #FFFFFF; --_fg-h: #FFFFFF; --_spin: #FFFFFF;
}
.btn-secondary, .btn-ghost { /* same values as plain .btn: listed so the intent is clear in markup */
  --_bg: var(--btn-2-bg); --_bd: var(--btn-2-line); --_fg: var(--btn-2-text);
}
.btn-outline {
  --_bg: var(--btn-outline-bg); --_bg-h: var(--btn-2-bg); --_bg-a: var(--btn-2-bg-hover);
  --_bd: var(--btn-outline-line); --_bd-h: var(--btn-outline-line); --_fg: var(--btn-outline-text); --_fg-h: var(--btn-2-text); --_spin: var(--btn-outline-text);
}
.btn-danger, .btn.text-bad {
  --_bg: var(--btn-danger-bg); --_bg-h: var(--btn-danger-bg-hover); --_bg-a: var(--btn-danger-bg-hover);
  --_bd: var(--btn-danger-line); --_bd-h: var(--btn-danger-text); --_fg: var(--btn-danger-text); --_fg-h: var(--btn-danger-text); --_spin: var(--btn-danger-text);
}
.btn-danger.btn-danger-solid, .btn-danger-solid {
  --_bg: var(--btn-danger-solid); --_bg-h: var(--btn-danger-solid-hover); --_bg-a: var(--btn-danger-solid-hover);
  --_bd: var(--btn-danger-solid); --_bd-h: var(--btn-danger-solid-hover); --_fg: #FFFFFF; --_fg-h: #FFFFFF; --_spin: #FFFFFF;
}
.btn-sm { min-height: var(--btn-h-sm); padding: .375rem .875rem; font-size: .875rem; gap: .4rem; }
.btn-lg { min-height: var(--btn-h-lg); padding: .75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-icon.btn-sm, .dropdown > .btn.hr-dots, .dropdown > .btn.sx-dots, .btn.hr-dots, .btn.sx-dots { flex: none; width: var(--btn-h-sm); padding: 0; }  /* "More actions" (three dots) in table rows */
.dropdown > .btn.hr-dots, .dropdown > .btn.sx-dots { justify-content: center; }  /* keeps the three dots in the middle of the button */
/* Tablet cards view of HR-style lists: same rule for the title line */
@media (min-width: 768px) and (max-width: 1279px) {
  .table-cards.hrl-table td.cell-key { flex: 1 1 0; min-width: 50%; }
  .table-cards.hrl-table tr:not(:has(> td.cell-status)) > td.cell-key { flex-basis: 100%; }
}
/* A row menu near the bottom of the screen opens upwards (assets/js/app.js adds .is-up) */
.dropdown.is-up > .dropdown-menu { top: auto; bottom: 100%; margin-top: 0; margin-bottom: .3rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
a.btn[aria-disabled="true"] { pointer-events: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid var(--_spin); border-right-color: transparent; border-radius: 50%; opacity: .9; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Buttons side by side: even gaps, and they wrap neatly on small screens */
.btn-row, .page-head > .btn-row, .hr-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.icon-btn { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: var(--r-btn); cursor: pointer; text-decoration: none; }
.icon-btn:hover { border-color: var(--text-dim); }
/* Theme button: holds two icons, sun then moon. Shows the moon while light (tap for dark), the sun while dark. */
.theme-toggle .icon:first-child { display: none; }
:root[data-theme="dark"] .theme-toggle .icon:first-child { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .icon:last-child { display: none; }
@media (min-width: 900px) {
  .icon-btn { width: 40px; height: 40px; }
}
/* Phones and touch screens: big enough to tap */
@media (max-width: 599px), (pointer: coarse) {
  .btn, .btn-sm { min-height: 44px; }
  .btn-icon, .btn-icon.btn-sm, .dropdown > .btn.hr-dots, .dropdown > .btn.sx-dots { width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

/* Text links (inside sentences, help text, footers, breadcrumbs) stay links: brand purple, underlined. */
/* 6. Public header and menu ------------------------------------------------ */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.nav { display: flex; align-items: center; gap: .5rem; min-height: var(--header-h); }
.nav-tools { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.nav-toggle { display: inline-grid; }
/* Phone: the menu is a full-height panel that slides over the page */
.nav-menu { display: none; position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(100%, 420px); flex-direction: column; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-float); overflow-y: auto; overscroll-behavior: contain; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.nav-menu.is-open { display: flex; }
.nav-menu-head { display: flex; align-items: center; justify-content: space-between; flex: none; min-height: var(--header-h); padding-inline: clamp(1.25rem, 4vw, 2.5rem) .75rem; border-bottom: 1px solid var(--line); }
.nav-backdrop { position: fixed; inset: 0; z-index: 60; background: var(--overlay); }
body.nav-open { overflow: hidden; }
.nav-links { list-style: none; margin: 0; padding: .5rem clamp(1.25rem, 4vw, 2.5rem); display: flex; flex-direction: column; flex: 1 0 auto; }
.nav-links a { display: flex; align-items: center; min-height: 60px; color: var(--text); text-decoration: none; font: 500 1.6rem/1.2 var(--font-display); border-bottom: 1px solid var(--line); }
.nav-links a[aria-current="page"] { color: var(--brand-text); }
.nav-actions { display: flex; flex-direction: column; align-items: stretch; gap: .6rem; padding: 1rem clamp(1.25rem, 4vw, 2.5rem) 1.5rem; }
.nav-actions .btn { min-height: 52px; width: 100%; font-size: 1rem; }
.nav-actions .inline-form { display: block; }
.dropdown { position: relative; }
.dropdown > .btn { width: 100%; justify-content: space-between; }
.dropdown-menu { display: none; list-style: none; margin: .4rem 0 0; padding: .35rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); }
.dropdown.is-open > .dropdown-menu { display: block; }
.dropdown-menu a { display: flex; align-items: center; min-height: 44px; padding: .4rem .8rem; border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-weight: 500; }
.dropdown-menu a:hover { background: var(--hover); }
.dropdown-menu a.quiet, .footer-links a.quiet { color: var(--text-dim); font-size: .875rem; font-weight: 400; }
.dropdown-sep { height: 1px; background: var(--line); margin: .3rem .5rem; }
@media (min-width: 900px) {
  :root { --header-h: 64px; }
  .nav { gap: 1rem; }
  .nav-toggle, .nav-menu-head, .nav-backdrop { display: none !important; }
  .nav-menu { display: flex; position: static; width: auto; flex: 1; flex-direction: row; align-items: center; background: none; border: 0; box-shadow: none; overflow: visible; padding: 0; }
  .nav-links { flex-direction: row; flex: none; gap: 2px; margin-left: 1.5rem; padding: 0; }
  .nav-links a { min-height: 40px; padding: 0 .85rem; border: 0; border-radius: var(--r-sm); color: var(--text-muted); font: 500 .9375rem/1 var(--font-body); }
  .nav-links a:hover { color: var(--text); }
  .nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
  .nav-actions { flex-direction: row; align-items: center; margin-left: auto; padding: 0; gap: .5rem; }
  .nav-actions .btn { min-height: 40px; width: auto; font-size: .9375rem; }
  .nav-actions .inline-form { display: inline; }
  .nav-tools { margin-left: 0; order: 3; }
  .dropdown > .btn { width: auto; }
  .dropdown-menu { position: absolute; right: 0; top: 100%; min-width: 220px; margin-top: .5rem; box-shadow: var(--shadow-float); }
}

/* 7. Hero ------------------------------------------------------------------ */
.hero { padding-block: clamp(2.5rem, 8vw, 5.5rem) clamp(2.25rem, 7vw, 5rem); }
.hero-grid { display: grid; gap: 2rem; align-items: center; }
.hero h1 { max-width: 11ch; font-size: clamp(2.5rem, 7.2vw, 4.125rem); line-height: 1.05; margin-bottom: 0; }
.hero .lead { max-width: 52ch; margin: 1rem 0 0; }
.hero-actions { display: grid; gap: .6rem; margin-top: 1.6rem; }
.hero-tags { list-style: none; margin: 1.75rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); font-size: .9375rem; color: var(--text-muted); }
.hero-tags li { padding: .7rem .5rem .7rem 0; border-bottom: 1px solid var(--line); }
.hero-visual { display: none; }
.hero-art { margin-top: 1.9rem; min-width: 0; }
/* The echo line: strokes with a rounded end, taken from the logo, repeating and fading */
.echo-line { display: block; width: 100%; max-width: 560px; height: auto; color: var(--text); }
.echo-line .echo-first { stroke: var(--brand); fill: var(--brand); }
.echo-line .echo-rest { stroke: currentColor; fill: none; }
.waveform { display: flex; align-items: center; gap: 5px; height: 64px; }
.waveform span { flex: 0 0 3px; height: 100%; background: var(--brand); border-radius: 2px; }
.waveform span:nth-child(4n+1) { height: 55%; }
.waveform span:nth-child(4n+2) { height: 85%; }
.waveform span:nth-child(4n+3) { height: 40%; }
.waveform span:nth-child(5n) { opacity: .45; }
.text-center .waveform { justify-content: center; margin-bottom: 1.5rem; }
.waveform-flat span { transform: scaleY(.5); }
@media (min-width: 600px) {
  .hero-actions { display: flex; flex-wrap: wrap; }
  .hero-tags { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; border-top: 0; }
  .hero-tags li { padding: 0; border-bottom: 0; }
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 3.5rem; }
  .hero-art { margin-top: 0; }
  .echo-line { margin-left: auto; }
}

/* 8. Cards ----------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(1rem, 3vw, 1.5rem); min-width: 0; }
a.card { display: block; color: inherit; text-decoration: none; }
.card-hover { transition: border-color .15s; }
.card-hover:hover { border-color: var(--brand-line); color: inherit; }
.card-glow { border-color: var(--brand-line); }
.card h2 { font: 600 1.2rem/1.3 var(--font-body); letter-spacing: 0; }
.card h3 { margin-bottom: .35rem; }
.card p:last-child { margin-bottom: 0; }
.card-title { font: 600 1.125rem/1.3 var(--font-body); letter-spacing: 0; margin: 0 0 .75rem; }
.card-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; margin-bottom: .9rem; border-radius: var(--r-btn); background: var(--brand-tint); color: var(--brand-text); }
.stat { font: 600 clamp(1.75rem, 4.5vw, 2.4rem)/1.1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--text); }
.stat-label { color: var(--text-muted); font-size: .9375rem; margin: .3rem 0 0; }
.stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; }
@media (min-width: 700px) { .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.avatar { width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--brand-tint); color: var(--brand-text); font: 600 1.05rem var(--font-body); }
.team-name { margin-top: .9rem; }
.quote { font-size: 1.0625rem; color: var(--text); margin: 0 0 1rem; }
.quote-by { color: var(--text-dim); font-size: .9rem; }
figure.card { margin: 0; }

/* 9. Forms ----------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }  /* minmax(0,…): a long field can't push the page sideways */
.field { display: grid; gap: .4rem; align-content: start; min-width: 0; }
.field label, .field .label, legend { font-weight: 500; font-size: .9375rem; }
.req::after { content: ' *'; color: var(--brand-text); }
.hint { color: var(--text-dim); font-size: .875rem; margin: 0; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: .7rem .85rem;
  background: var(--field); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font: 400 1rem/1.4 var(--font-body);          /* 16px: stops iPhones zooming in */
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 120px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-dim); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-dim); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-text); box-shadow: 0 0 0 3px var(--brand-tint); }
.select { appearance: none; -webkit-appearance: none; padding-right: 2.5rem; background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right .8rem center; }
.select option { background: var(--surface); color: var(--text); }
.input[type="file"] { padding: .5rem; cursor: pointer; }
.input[type="file"]::file-selector-button { margin-right: .8rem; min-height: 34px; padding: .4rem .9rem; border: 0; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text); font: 600 .875rem var(--font-body); cursor: pointer; }
/* Date and time fields. iPhones draw these wider than the box and centre the text, which pushed the field
   past the card and made Safari zoom the whole page out. They now fill the box exactly, like every other field. */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { display: block; width: 100%; min-width: 0; max-width: 100%; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value, input[type="month"]::-webkit-date-and-time-value { text-align: left; margin: 0; min-height: 1.4em; }
@supports (-webkit-touch-callout: none) {   /* iPhone and iPad only */
  .input[type="date"], .input[type="time"], .input[type="datetime-local"], .input[type="month"] {
    -webkit-appearance: none; appearance: none;
    padding-right: 2.75rem; background-image: var(--date-icon); background-repeat: no-repeat; background-position: right .85rem center; background-size: 18px;
  }
  .input[type="time"] { background-image: var(--time-icon); }
  .input[type="date"]::-webkit-calendar-picker-indicator, .input[type="time"]::-webkit-calendar-picker-indicator,
  .input[type="datetime-local"]::-webkit-calendar-picker-indicator, .input[type="month"]::-webkit-calendar-picker-indicator { opacity: 0; }   /* never two icons */
}
[aria-invalid="true"] { border-color: var(--error) !important; }
.field-error { margin: 0; color: var(--error); font-size: .875rem; }
.check { display: flex; gap: .7rem; align-items: flex-start; min-height: 28px; }
.check input { flex: none; width: 22px; height: 22px; margin: .15rem 0 0; accent-color: var(--brand); }
.check label { font-weight: 400; color: var(--text-muted); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1rem 1.2rem; margin: 0; min-width: 0; }
legend { padding-inline: .4rem; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 3.2rem; }
.input-wrap .toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: var(--r-sm); color: var(--text-muted); cursor: pointer; }
.input-wrap .toggle:hover { color: var(--text); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--error); transition: width .3s var(--ease), background .3s; }
.meter[data-level="2"] > span { background: var(--warning); }
.meter[data-level="3"] > span, .meter[data-level="4"] > span { background: var(--success); }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .5rem; }
.form-actions > .btn, .form-actions > button { flex: 1 1 100%; }
@media (min-width: 600px) {
  .form-actions > .btn, .form-actions > button { flex: 0 0 auto; }
}
@media (min-width: 700px) {
  .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: 1 / -1; }
  fieldset { padding: 1.1rem 1.25rem 1.3rem; }
}
@media (min-width: 900px) {
  .input, .select { min-height: 44px; padding-block: .55rem; }
}

/* Sign-in pages */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.25rem, 5vw, 2.25rem); }
.auth-card .brand { margin-bottom: 1.5rem; }
.auth-card h1 { font-size: clamp(1.6rem, 5vw, 2rem); }
.auth-card .btn-primary, .auth-card .form-actions .btn { width: 100%; }
.theme-member .auth-card { border-color: var(--brand-line); }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; margin: 0 0 1.5rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-btn); }
.auth-switch a { display: grid; place-items: center; min-height: 42px; padding: 0 .4rem; border-radius: var(--r-sm); color: var(--text-muted); text-align: center; text-decoration: none; font-weight: 600; font-size: .875rem; line-height: 1.2; }
.auth-switch a:hover { color: var(--text); }
.auth-switch a[aria-current="page"] { background: var(--brand); color: var(--on-brand); }

/* 10. Tables --------------------------------------------------------------- */
/* Wide tables scroll sideways inside their own box; a soft shade shows there is more to the side. */
.table-wrap {
  position: relative;   /* keeps screen-reader-only labels inside the scrolling box */
  overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r);
  background:
    linear-gradient(to right, var(--surface) 35%, transparent) left center / 44px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 35%, transparent) right center / 44px 100% no-repeat local,
    linear-gradient(to right, var(--scroll-shade), transparent) left center / 14px 100% no-repeat scroll,
    linear-gradient(to left, var(--scroll-shade), transparent) right center / 14px 100% no-repeat scroll,
    var(--surface);
}
.table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: .9375rem; }   /* small screens: columns keep their natural width and the box scrolls */
.table td { max-width: 20rem; }
.table td:first-child strong, .table td:first-child a { white-space: nowrap; }
.table th, .table td { padding: .8rem .9rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8125rem; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--hover); }
.table .actions { display: flex; gap: .4rem; justify-content: flex-end; }
.table td.actions { display: table-cell; white-space: nowrap; text-align: right; }
.table td.actions > * { vertical-align: middle; }
.table td.actions form + form, .table td.actions a + form { margin-left: .3rem; }
.table input[type="checkbox"], .check-grid input[type="checkbox"] { width: 22px; height: 22px; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1.25rem; }
.toolbar .field { flex: 1 1 100%; }
.toolbar > .btn, .toolbar > button { flex: 1 1 auto; }
.pagination ul { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: 1.5rem 0 0; padding: 0; }
.page-link { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding-inline: .8rem; border: 1px solid var(--line-strong); border-radius: var(--r-btn); color: var(--text); text-decoration: none; font-size: .9375rem; font-variant-numeric: tabular-nums; }
a.page-link:hover { border-color: var(--brand-text); background: var(--brand-tint); color: var(--text); }
.page-link.is-current { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.page-gap { display: inline-grid; place-items: center; height: 44px; color: var(--text-dim); }
@media (min-width: 600px) {
  .toolbar .field { flex: 1 1 180px; min-width: 160px; max-width: 300px; }
  .toolbar > .btn, .toolbar > button { flex: 0 0 auto; }
}
@media (min-width: 900px) {
  .page-link { min-width: 40px; height: 40px; }
  .page-gap { height: 40px; }
}

/* 11. Badges, chips and alerts --------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .16rem .65rem; border-radius: var(--r-pill); font-size: .78rem; font-weight: 600; line-height: 1.45; white-space: nowrap; color: var(--text-muted); background: var(--surface-2); border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.badge-submitted, .badge-accepted, .badge-in_production, .badge-upcoming, .badge-ongoing { color: var(--brand-text); background: var(--brand-tint); }
.badge-completed, .badge-released, .badge-approved, .badge-active, .badge-paid, .badge-delivered { color: var(--success); background: var(--success-tint); }
.badge-under_review, .badge-revision, .badge-pending, .badge-on_hold, .badge-created, .badge-awaiting_advance, .badge-completed_awaiting_final, .badge-partial, .badge-partially_refunded { color: var(--warning); background: var(--warning-tint); }
.badge-rejected, .badge-cancelled, .badge-inactive, .badge-failed, .badge-past_due { color: var(--error); background: var(--error-tint); }
.badge-refunded, .badge-reversed, .badge-archived { color: var(--text-muted); background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.chip { display: inline-flex; align-items: center; padding: .15rem .65rem; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); color: var(--text-muted); font-size: .8125rem; }
.chip-more { background: transparent; }
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); font-size: 1rem; }
.alert > .icon { margin-top: .2rem; }
.alert p { margin: 0; min-width: 0; }
.alert-success { border-color: var(--success-line); background: var(--success-tint); } .alert-success > .icon { color: var(--success); }
.alert-warning { border-color: var(--warning-line); background: var(--warning-tint); } .alert-warning > .icon { color: var(--warning); }
.alert-error { border-color: var(--error-line); background: var(--error-tint); } .alert-error > .icon { color: var(--error); }
.alert-info { border-color: var(--brand-line); background: var(--brand-tint); } .alert-info > .icon { color: var(--brand-text); }

/* 12. Dialogs and pop-up messages ------------------------------------------ */
/* Phones: dialogs slide up from the bottom as a sheet. From 600px they sit in the middle. */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; align-items: end; background: var(--overlay); }
body.modal-open { overflow: hidden; }
.modal { width: 100%; max-height: calc(100vh - 2.5rem); max-height: calc(100dvh - 2.5rem); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 1.25rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom)); box-shadow: var(--shadow-float); animation: sheet-up .2s var(--ease); }
.modal::before { content: ''; display: block; width: 40px; height: 4px; margin: -.5rem auto .9rem; border-radius: 4px; background: var(--line-strong); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .75rem; }
.modal-head h2, .modal h2 { font: 600 1.25rem/1.3 var(--font-body); letter-spacing: 0; margin: 0; }
.modal-close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -.5rem -.5rem 0 0; background: none; border: 0; border-radius: var(--r-btn); color: var(--text-muted); cursor: pointer; }
.modal-close:hover { color: var(--text); background: var(--hover); }
.modal-foot { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.modal-foot > .btn, .modal-foot > button, .modal-foot > form { flex: 1 1 auto; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } }
.toast-region { position: fixed; z-index: 200; left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom)); display: grid; gap: .5rem; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: .75rem; align-items: flex-start; padding: .8rem .9rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-left: 3px solid var(--brand); border-radius: var(--r-btn); box-shadow: var(--shadow-float); animation: toast-in .2s var(--ease); }
.toast.is-leaving { opacity: 0; transition: opacity .25s; }
.toast-success { border-left-color: var(--success); } .toast-error { border-left-color: var(--error); } .toast-warning { border-left-color: var(--warning); }
.toast-msg { flex: 1; font-size: .9375rem; }
.toast-close { flex: none; width: 32px; height: 32px; margin: -.3rem -.4rem -.3rem 0; background: none; border: 0; color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.toast-close:hover { color: var(--text); }
@media (pointer: coarse) { .toast-close { width: 44px; height: 44px; margin: -.6rem -.6rem -.6rem 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (min-width: 600px) {
  .modal-backdrop { place-items: center; padding: 1rem; }
  .modal { max-width: 520px; border-bottom: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; animation-name: pop; }
  .modal::before { display: none; }
  .modal-foot { justify-content: flex-end; }
  .modal-foot > .btn, .modal-foot > button, .modal-foot > form { flex: 0 0 auto; }
  .toast-region { left: auto; right: 1rem; bottom: 1rem; width: min(92vw, 380px); }
  @keyframes pop { from { opacity: 0; transform: translateY(10px); } }
}

/* 13. States --------------------------------------------------------------- */
.empty-state, .error-state { text-align: center; padding: clamp(1.75rem, 6vw, 3rem) 1.25rem; border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--surface); }
.empty-state .card-icon, .error-state .card-icon { margin-inline: auto; }
.empty-state h2, .empty-state h3, .error-state h2, .error-state h3 { font: 600 1.2rem/1.3 var(--font-body); letter-spacing: 0; }
.empty-state p:last-child, .error-state p:last-child { margin-bottom: 0; }
.error-state { border-color: var(--error-line); } .error-state .card-icon { color: var(--error); background: var(--error-tint); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--surface-3); border-top-color: var(--brand-text); border-radius: 50%; animation: spin .8s linear infinite; }
.skeleton { display: block; height: 1rem; border-radius: 6px; background: var(--surface-2); }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* 14. Request timeline (<ol class="timeline"><li class="is-done|is-current">) */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 1.25rem 2rem; color: var(--text-dim); font-size: .9375rem; }
.timeline li::before { content: ''; position: absolute; left: 0; top: .3rem; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline li::after { content: ''; position: absolute; left: 6px; top: 1.2rem; bottom: -.1rem; width: 2px; background: var(--line-strong); }
.timeline li:last-child::after { display: none; }
.timeline li.is-done { color: var(--text-muted); } .timeline li.is-done::before { background: var(--brand); border-color: var(--brand); } .timeline li.is-done::after { background: var(--brand); }
.timeline li.is-current { color: var(--text); font-weight: 600; } .timeline li.is-current::before { background: var(--bg); border-color: var(--brand-text); box-shadow: 0 0 0 3px var(--brand-tint); }
@media (min-width: 1240px) {
  .timeline { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .timeline li { padding: 2rem .5rem 0 0; }
  .timeline li::before { top: 0; }
  .timeline li::after { left: 14px; right: 0; top: 6px; bottom: auto; width: auto; height: 2px; }
}

/* 15. Portal shell (client / member / admin) ------------------------------- */
/* Phones (under 768px): a slim bar at the top, the page, and a fixed menu bar at the bottom.
   Tablets and laptops: the sidebar. Between 768 and 1099px it shows icons only (the button at
   the top switches it); from 1100px it shows names. A choice made with that button is remembered. */
.portal-body { background: var(--bg); font-size: 1rem; --bottom-h: 62px; }
.portal { min-height: 100vh; min-height: 100dvh; }
.portal-main { min-width: 0; padding: 1.25rem 1rem calc(var(--bottom-h) + 1.75rem + env(safe-area-inset-bottom)); }
.portal-main h2, .portal-main h3 { font-family: var(--font-body); font-weight: 600; letter-spacing: 0; line-height: 1.3; }
.portal-main h2 { font-size: 1.1875rem; }
.portal-main h3 { font-size: 1.0625rem; }
.portal-main h2.section-title { font: 500 clamp(1.4rem, 3vw, 1.65rem)/1.2 var(--font-display); letter-spacing: -.01em; }
.page-head { display: flex; flex-wrap: wrap; gap: .9rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head > div:first-child { min-width: 0; flex: 1 1 240px; }
.page-head h1 { font-size: clamp(1.65rem, 3.4vw, 2rem); margin: 0 0 .25rem; }
.small { font-size: .875rem; }

/* Top bar (phones) */
.appbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .5rem; min-height: 56px; padding: env(safe-area-inset-top) .75rem 0 1rem; background: var(--bg); border-bottom: 1px solid var(--line); }
.appbar-brand { display: inline-flex; flex: none; margin-right: auto; }
.appbar-brand .logo-img { height: 30px; }
.appbar-back { margin-left: -.5rem; border-color: transparent; }
.appbar-title { flex: 1; min-width: 0; margin: 0; font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bottom menu bar (phones) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--surface); border-top: 1px solid var(--line); }
.bottom-nav a, .bottom-more { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: var(--bottom-h); padding: 6px 2px 5px; background: none; border: 0; color: var(--text-dim); font: 500 .6875rem/1.15 var(--font-body); text-align: center; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bottom-nav a:hover, .bottom-more:hover { color: var(--text); }
.bottom-nav [aria-current="page"] { color: var(--brand-text); }
.bottom-nav [aria-current="page"]::before { content: ''; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--brand); }
.bottom-nav .nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav .nav-badge { position: absolute; top: 5px; left: calc(50% + 5px); margin: 0; min-width: 18px; padding: 0 .3rem; font-size: .625rem; line-height: 18px; }
.portal-body .toast-region, .portal-body .cookie-notice { bottom: calc(var(--bottom-h) + .75rem + env(safe-area-inset-bottom)); }

/* Bottom sheets: the More menu and the phone filter panel */
.sheet { position: fixed; inset: 0; z-index: 90; display: none; flex-direction: column; justify-content: flex-end; background: var(--overlay); }
.sheet.is-open { display: flex; }
body.sheet-open { overflow: hidden; }
.sheet-panel { max-height: calc(100vh - 2.5rem); max-height: calc(100dvh - 2.5rem); overflow-y: auto; overscroll-behavior: contain; padding: .6rem 1rem calc(1rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-float); animation: sheet-up .2s var(--ease); }
.sheet-panel::before { content: ''; display: block; width: 40px; height: 4px; margin: 0 auto .75rem; border-radius: 4px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.sheet-head .user-chip { flex: 1; min-width: 0; padding: 0; border: 0; }
.sheet-head .icon-btn { border-color: transparent; }
.sheet-title { margin: 0; font-weight: 600; font-size: 1.125rem; }
.sheet-nav { list-style: none; margin: .5rem 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px .25rem; }
.sheet-nav a { position: relative; display: flex; align-items: center; gap: .6rem; min-height: 50px; padding: .4rem .6rem; border-radius: var(--r-btn); color: var(--text); text-decoration: none; font-weight: 500; font-size: .9375rem; line-height: 1.25; }
.sheet-nav a:hover { background: var(--hover); color: var(--text); }
.sheet-nav a .icon { color: var(--text-dim); }
.sheet-nav a[aria-current="page"] { background: var(--surface-2); }
.sheet-nav a[aria-current="page"] .icon { color: var(--brand-text); }
.sheet-nav .nav-badge { margin-left: auto; }
.sheet-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.sheet-foot form { margin: 0; }

/* Sidebar (tablets and laptops) */
.sidebar { display: none; min-width: 0; background: var(--surface); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-inline: .4rem 0; }
.rail-toggle { width: 36px; height: 36px; border-color: transparent; color: var(--text-muted); }
.user-chip { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: var(--r-btn); }
.user-chip-text { min-width: 0; }
.user-name { margin: 0; font-weight: 600; font-size: .9375rem; line-height: 1.3; overflow-wrap: anywhere; }
.user-role { margin: 0; font-size: .8125rem; color: var(--text-dim); }
.avatar-sm { width: 36px; height: 36px; font-size: .8125rem; }
.avatar-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.side-nav { position: relative; list-style: none; margin: 0; padding: 0 0 .5rem; display: flex; flex-direction: column; gap: 1px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: .65rem; min-height: 40px; padding: 0 .65rem; border-radius: var(--r-sm); color: var(--text-muted); text-decoration: none; white-space: nowrap; font-weight: 500; font-size: .9375rem; }
.side-nav a .icon { flex: none; }
.side-nav a:hover { color: var(--text); background: var(--hover); }
.side-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.side-nav a[aria-current="page"] .icon { color: var(--brand-text); }
.side-nav .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 .4rem; border-radius: var(--r-pill); background: var(--brand); color: var(--on-brand); font-size: .72rem; font-weight: 600; line-height: 20px; text-align: center; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: .4rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.sidebar-foot .quiet-link { font-size: .8125rem; white-space: nowrap; }
.sidebar-foot .btn { gap: .35rem; padding-inline: .55rem; white-space: nowrap; }
.sidebar-foot .icon-btn { width: 36px; height: 36px; }
.quiet-link { color: var(--text-dim); font-size: .875rem; text-decoration: none; }
.quiet-link:hover { color: var(--text); text-decoration: underline; }

@media (min-width: 768px) {
  .portal-body { --bottom-h: 0px; }
  .appbar, .bottom-nav, .sheet[data-sheet] { display: none !important; }
  .portal { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: .75rem; padding: 1rem .75rem .75rem; border-right: 1px solid var(--line); }
  .sidebar-nav { flex: 1 1 auto; min-height: 0; margin-inline: -.75rem; padding-inline: .75rem; overflow-y: auto; scrollbar-width: thin; }
  .portal-main { padding: 2rem clamp(1.25rem, 2.4vw, 2.5rem) 2.5rem; }
  .portal-body .toast-region, .portal-body .cookie-notice { bottom: 1rem; }
}
/* Icons-only sidebar */
@media (min-width: 768px) and (max-width: 1099px) {
  :root:not([data-rail="off"]) .portal { grid-template-columns: 76px minmax(0, 1fr); }
  :root:not([data-rail="off"]) .sidebar { padding-inline: .5rem; align-items: center; }
  :root:not([data-rail="off"]) .sidebar-top { justify-content: center; padding: 0; }
  :root:not([data-rail="off"]) .sidebar-top .brand { display: none; }
  :root:not([data-rail="off"]) .user-chip { justify-content: center; padding: .25rem; border-color: transparent; margin-top: .5rem; }
  :root:not([data-rail="off"]) .user-chip-text, :root:not([data-rail="off"]) .sidebar .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root:not([data-rail="off"]) .sidebar-nav { margin-inline: -.5rem; padding-inline: .5rem; width: calc(100% + 1rem); }
  :root:not([data-rail="off"]) .side-nav { align-items: center; }
  :root:not([data-rail="off"]) .side-nav a { justify-content: center; width: 48px; min-height: 44px; padding: 0; }
  :root:not([data-rail="off"]) .side-nav .nav-badge { position: absolute; top: 3px; right: 0; min-width: 16px; padding: 0 .25rem; font-size: .625rem; line-height: 16px; }
  :root:not([data-rail="off"]) .sidebar-foot { flex-direction: column; align-items: center; }
  :root:not([data-rail="off"]) .sidebar-foot .quiet-link { display: none; }
  :root:not([data-rail="off"]) .sidebar-foot .btn { width: 44px; padding: 0; }
}
@media (min-width: 1100px) {
  :root[data-rail="on"] .portal { grid-template-columns: 76px minmax(0, 1fr); }
  :root[data-rail="on"] .sidebar { padding-inline: .5rem; align-items: center; }
  :root[data-rail="on"] .sidebar-top { justify-content: center; padding: 0; }
  :root[data-rail="on"] .sidebar-top .brand { display: none; }
  :root[data-rail="on"] .user-chip { justify-content: center; padding: .25rem; border-color: transparent; margin-top: .5rem; }
  :root[data-rail="on"] .user-chip-text, :root[data-rail="on"] .sidebar .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :root[data-rail="on"] .sidebar-nav { margin-inline: -.5rem; padding-inline: .5rem; width: calc(100% + 1rem); }
  :root[data-rail="on"] .side-nav { align-items: center; }
  :root[data-rail="on"] .side-nav a { justify-content: center; width: 48px; min-height: 44px; padding: 0; }
  :root[data-rail="on"] .side-nav .nav-badge { position: absolute; top: 3px; right: 0; min-width: 16px; padding: 0 .25rem; font-size: .625rem; line-height: 16px; }
  :root[data-rail="on"] .sidebar-foot { flex-direction: column; align-items: center; }
  :root[data-rail="on"] .sidebar-foot .quiet-link { display: none; }
  :root[data-rail="on"] .sidebar-foot .btn { width: 44px; padding: 0; }
}
@media (min-width: 900px) {
  .table { font-size: .90625rem; }
  .table th, .table td { padding: .7rem .75rem; }
}

/* 15b. Portal pages: filters, tables as cards, stat tiles (Phase C) --------- */
/* Filter bars: on phones assets/js/portal.js folds the form into a sheet behind a "Filter" button
   and lists the filters in use as chips. Without the script the form simply shows as usual. */
.filter-bar { display: none; }
.toolbar-sheet-head { display: none; }
@media (max-width: 767px) {
  .filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
  .filter-bar > .btn { flex: none; }
  .filter-chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; min-width: 0; }
  .filter-chip { display: inline-flex; align-items: center; gap: .4rem; max-width: 100%; min-height: 36px; padding: .25rem .5rem .25rem .8rem; background: var(--brand-tint); border: 1px solid var(--brand-line); border-radius: var(--r-pill); color: var(--text); font: 500 .8125rem/1.2 var(--font-body); cursor: pointer; }
  .filter-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .filter-chip .icon { color: var(--text-muted); }
  .toolbar-sheet-head { display: flex; margin-bottom: .25rem; }
  .toolbar-sheet-wrap .toolbar { flex-direction: column; align-items: stretch; margin: 0; gap: 1rem; }
  .toolbar-sheet-wrap .toolbar .field { flex: none; min-width: 0; }
  .toolbar-sheet-wrap .toolbar > .btn { flex: none; width: 100%; min-height: 48px; }
  .toolbar-sheet-wrap .toolbar > .btn[type="submit"] { --_bg: var(--btn-primary); --_bg-h: var(--btn-primary-hover); --_bg-a: var(--btn-primary-press); --_bd: var(--btn-primary); --_bd-h: var(--btn-primary-hover); --_fg: #FFFFFF; --_fg-h: #FFFFFF; }
}
@media (min-width: 768px) {
  .toolbar-sheet-wrap, .toolbar-sheet-wrap > .sheet-panel { display: contents; }
  .toolbar-sheet-wrap > .sheet-panel::before { display: none; }
}

/* Tables that turn into cards on phones: <div class="table-wrap is-cards"><table class="table table-cards">
   Each <td> carries data-label="Column name". Optional cell classes:
   cell-key (reference, top left), cell-status (badge, top right), cell-title, cell-half (two per row), actions (buttons at the bottom). */
@media (max-width: 759px) {
  .table-wrap.is-cards { overflow: visible; border: 0; border-radius: 0; background: none; }
  .table-cards { display: block; width: 100%; min-width: 0; }
  .table-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-cards tbody { display: grid; gap: .6rem; }
  .table-cards tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .65rem 1rem; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
  .table-cards tbody tr:hover { background: var(--surface); }
  .table-cards td { display: block; flex: 1 1 100%; min-width: 0; max-width: none; padding: 0; border: 0; overflow-wrap: anywhere; }
  .table-cards td[data-label]::before { content: attr(data-label); display: block; margin-bottom: .1rem; color: var(--text-dim); font-size: .75rem; font-weight: 500; }
  .table-cards td.cell-key, .table-cards td.cell-status, .table-cards td.cell-title, .table-cards td.actions { padding: 0; }
  .table-cards td.cell-key::before, .table-cards td.cell-status::before, .table-cards td.cell-title::before, .table-cards td.actions::before { display: none; }
  .table-cards td.cell-key { flex: 1 1 auto; order: -2; font-weight: 600; }
  /* In a card the name may wrap onto a second line: one long name never runs under the status pill */
  .table-cards td:first-child a, .table-cards td:first-child strong { white-space: normal; }
  /* The title line holds only the title (and its status pill): other fields always start on the next line */
  .table-cards td.cell-key { flex: 1 1 0; min-width: 50%; }
  .table-cards tr:not(:has(> td.cell-status)) > td.cell-key { flex-basis: 100%; }
  .table-cards td.cell-status { flex: 0 1 auto; order: -1; margin-left: auto; text-align: right; }
  .table-cards td.cell-title { font-weight: 500; }
  .table-cards td.cell-half { flex: 1 1 40%; }
  .table-cards td.actions { order: 99; display: flex; flex-wrap: wrap; gap: .5rem; text-align: left; white-space: normal; }
  .table-cards td.actions > form { display: contents; }   /* the form's buttons line up with the links */
  .table-cards td.actions .btn { flex: 1 1 auto; margin: 0; }
  .table-cards td.actions .btn-sm { min-height: 44px; }
  .table-cards td:empty { display: none; }
  .table-cards td.actions:has(> .dim:only-child) { display: none; }   /* no lone "—" at the bottom of a card */
  /* Two half-width fields side by side: when one label wraps to two lines, both values still line up */
  .table-cards tr:has(> td.cell-half) { align-items: stretch; }
  .table-cards td.cell-half:has(> .badge:only-child), .table-cards td.cell-half:has(> .check:only-child) { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; }
}
@media (min-width: 760px) and (max-width: 1279px) {
  .table-cards.hrl-table td:first-child a, .table-cards.hrl-table td:first-child strong { white-space: normal; }
  .table-cards.hrl-table tr:has(> td.cell-half) { align-items: stretch; }
  .table-cards.hrl-table td.cell-half:has(> .badge:only-child), .table-cards.hrl-table td.cell-half:has(> .check:only-child) { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; }
}

/* Number tiles: two per row on phones */
@media (max-width: 599px) {
  .grid:has(> .card > .stat), .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .grid > .card:has(> .stat) { padding: .9rem 1rem; }
  .grid > .card > .stat { font-size: 1.5rem; }
}
.stat-ok { color: var(--success); }
.stat-warn { color: var(--warning); }

/* 16. Footer, cookie notice, misc ----------------------------------------- */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); padding-top: clamp(2rem, 6vw, 3.5rem); font-size: .9375rem; }
.footer-grid { display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.footer-grid > .footer-brand { grid-column: 1 / -1; max-width: 420px; }
.footer-brand p { margin: .9rem 0 0; }
.footer-title { font: 600 .9375rem var(--font-body); letter-spacing: 0; color: var(--text); margin-bottom: .6rem; }
.footer-links, .footer-legal, .social-links { list-style: none; margin: 0; padding: 0; }
.footer-links a, .footer-legal a, .social-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--text-muted); text-decoration: none; }
.footer-links a:hover, .footer-legal a:hover, .social-links a:hover { color: var(--text); text-decoration: underline; }
.footer-links li.muted { padding-block: .35rem; }
.social-links { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin-top: .75rem; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-top: 2rem; padding-block: 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--text-dim); font-size: .875rem; }
.footer-bottom p { margin: 0; }
.footer-legal { display: flex; gap: 1.25rem; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1.4fr; } .footer-grid > .footer-brand { grid-column: auto; } }
.cookie-notice { position: fixed; z-index: 150; left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom)); max-width: 560px; display: flex; flex-wrap: wrap; gap: .75rem 1.2rem; align-items: center; justify-content: space-between; padding: .9rem 1rem; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow-float); font-size: .9rem; }
.cookie-notice p { margin: 0; flex: 1 1 240px; }
.error-page { display: grid; place-items: center; min-height: 60vh; }
.reveal.is-pending { opacity: 1; transform: none; }   /* sections no longer fade in on scroll */
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: .1rem .4rem; border-radius: 5px; font-size: .9em; }

@media print {
  body { background: #fff; color: #000; display: block; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset: 0 auto auto 0; width: 100%; padding: 1.5rem; color: #000; background: #fff; }
  .no-print { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* 17. Public pages --------------------------------------------------------- */
.page-hero { padding-block: clamp(2.25rem, 7vw, 4.5rem) clamp(1.75rem, 5vw, 2.75rem); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.25rem); max-width: 20ch; }
.page-hero .lead:last-child { margin-bottom: 0; }
.svc-list { display: grid; }
.svc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .9rem; align-items: center; padding: .95rem 0; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.svc:hover { color: inherit; }
.svc .card-icon { margin: 0; }
.svc h3 { margin: 0; }
.svc p { margin: .15rem 0 0; font-size: .9375rem; color: var(--text-muted); }
.svc > .icon { color: var(--text-dim); }
.offer { display: flex; flex-direction: column; gap: .9rem; padding: clamp(1.15rem, 4vw, 1.75rem); }
.offer .card-icon { margin: 0; }
.offer h3 { font-size: 1.25rem; margin: 0; }
.offer p { margin: 0; }
.offer .btn { width: 100%; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.checklist li { display: flex; gap: .6rem; align-items: flex-start; color: var(--text-muted); }
.checklist .icon { color: var(--brand-text); margin-top: .3rem; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; gap: 1.25rem; grid-template-columns: 1fr; }
.steps li { counter-increment: step; position: relative; padding: 0 0 0 3rem; min-height: 2.1rem; }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 0; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--brand-line); color: var(--brand-text); font: 600 .9375rem var(--font-body); }
.steps h3 { margin: .25rem 0 .2rem; }
.steps p { margin: 0; font-size: .9375rem; }
.release { padding: .9rem .9rem 1.1rem; }
.release h3 { font-size: 1.0625rem; margin: 0 0 .15rem; }
.cover { aspect-ratio: 1; margin-bottom: .9rem; border-radius: var(--r-btn); overflow: hidden; background: var(--surface-2); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-dim); background: var(--surface-2); }
.team-photo { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.filter-tabs { position: relative; display: flex; gap: .4rem; margin: 0 -1rem 1.5rem; padding: 0 1rem; overflow-x: auto; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tabs a { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border: 1px solid var(--line-strong); border-radius: var(--r-pill); color: var(--text); text-decoration: none; font-weight: 500; font-size: .9375rem; }
.filter-tabs a:hover { border-color: var(--brand-text); }
.filter-tabs a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.faq { display: grid; gap: .6rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 1rem; }
.faq details[open] { border-color: var(--brand-line); }
.faq summary { display: flex; justify-content: space-between; gap: 1rem; align-items: center; min-height: 56px; padding: .6rem 0; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex: none; color: var(--brand-text); font-size: 1.5rem; font-weight: 400; line-height: 1; }
.faq details[open] summary::after { content: '\2212'; }
.faq .answer { padding: 0 0 1.1rem; color: var(--text-muted); max-width: 70ch; }
.cta-band { padding: clamp(1.5rem, 6vw, 3rem) clamp(1.15rem, 4vw, 2.5rem); }
.cta-band h2 { max-width: 20ch; font: 500 clamp(1.7rem, 3.6vw, 2.25rem)/1.12 var(--font-display); letter-spacing: -.012em; }
.cta-band .btn-row { margin-top: 1.25rem; }
.cta-band .btn-row .btn { flex: 1 1 100%; }
.text-center .cta-band h2, .cta-band.text-center h2 { margin-inline: auto; }
.contact-grid { display: grid; gap: 1.75rem; align-items: start; }
.contact-grid .form-grid .form-grid { margin: 0; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.edit-me { color: var(--text); background: var(--brand-tint); border-bottom: 1px dashed var(--brand-text); border-radius: 3px; padding: 0 .25rem; }
@media (min-width: 600px) {
  .filter-tabs { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; overflow: visible; }
  .cta-band .btn-row .btn { flex: 0 0 auto; }
  .offer .btn { width: auto; align-self: flex-start; }
}
@media (min-width: 900px) {
  .svc-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
  .svc { grid-template-columns: minmax(0, 1fr); align-items: start; gap: .8rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); transition: border-color .15s; }
  .svc:hover { border-color: var(--brand-line); }
  .svc > .icon { display: none; }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.75rem; }
  .steps li { padding: 3rem 0 0; }
  .contact-grid { grid-template-columns: 1.4fr 1fr; }
}

/* 17b. Inner public pages (Phase B) ----------------------------------------- */
/* Reading pages: about story, privacy, terms */
.prose { max-width: 70ch; }
.prose h2 { margin-top: 0; }
.prose p { color: var(--text-muted); }
.legal { max-width: 70ch; }
.legal > p.dim:first-child { display: inline-block; margin-bottom: 1.5rem; padding: .3rem .75rem; border: 1px solid var(--line); border-radius: var(--r-pill); font-size: .875rem; }
.legal h2 { font: 600 1.25rem/1.3 var(--font-body); letter-spacing: 0; margin: 2.5rem 0 .75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header-h) + 16px); }
.legal h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 1rem; }
.legal h3 { font: 600 1.0625rem/1.35 var(--font-body); margin: 1.75rem 0 .5rem; color: var(--text); }
.legal p, .legal li { color: var(--text-muted); }
.legal ul, .legal ol { padding-left: 1.25rem; display: grid; gap: .45rem; margin: 0 0 1.1rem; }
.legal li::marker { color: var(--brand-text); }
.legal strong { color: var(--text); }
.legal a { word-break: break-word; }

/* Services page */
.service-card { display: flex; flex-direction: column; scroll-margin-top: calc(var(--header-h) + 16px); }
.service-card:target { border-color: var(--brand-line); }
.service-card h2 { font: 600 1.25rem/1.3 var(--font-body); letter-spacing: 0; margin: 0 0 .5rem; }
.service-card > .muted { margin-bottom: 1.1rem; }
.service-action { margin: auto 0 0; padding-top: 1.35rem; }
.service-action .btn { width: 100%; }

/* Team page */
.team-card { display: flex; flex-direction: column; }
.team-card .avatar, .team-card .team-photo { width: 72px; height: 72px; }
.team-card .avatar { font-size: 1.25rem; }
.team-card h2.team-name { font: 600 1.15rem/1.3 var(--font-body); letter-spacing: 0; margin: 1rem 0 .15rem; }
.team-role { margin: 0 0 .75rem; color: var(--brand-text); font-size: .9375rem; font-weight: 500; }

/* Contact page */
.contact-grid aside .card h2 { font: 600 1.0625rem/1.3 var(--font-body); letter-spacing: 0; margin: 0 0 .35rem; }
.contact-grid aside .card-icon { margin-bottom: .75rem; }
.contact-grid aside .card p { margin-bottom: .35rem; }
.contact-grid aside .card p:last-child { margin-bottom: 0; }
.contact-grid aside .social-links { margin-top: .25rem; }
.contact-grid aside a[href^="mailto:"], .contact-grid aside a[href^="tel:"] { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; word-break: break-all; }
.contact-form .form-actions .btn { width: 100%; }

/* Portfolio cards */
.release .badge { margin-top: .6rem; }
.release .muted { font-size: .9375rem; }

/* Error pages (404, 500) */
.error-page { min-height: 0; padding-block: clamp(3rem, 10vw, 6rem); }
.error-page .container { display: flex; flex-direction: column; align-items: center; }
.error-art { width: min(100%, 320px); margin: 0 auto 1.5rem; }
.error-art .echo-line { width: 100%; margin: 0; }
.error-page h1 { font-size: clamp(2rem, 6vw, 3rem); max-width: 16ch; }
.error-page .lead { margin-inline: auto; }
.error-actions { width: 100%; margin-top: .75rem; }
.error-actions .btn { flex: 1 1 100%; }

@media (min-width: 600px) {
  .service-action .btn { width: auto; }
  .contact-form .form-actions .btn { width: auto; }
  .error-actions { width: auto; justify-content: center; }
  .error-actions .btn { flex: 0 0 auto; }
}

/* 18. Client portal and request flows -------------------------------------- */
.choice-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.choice { display: flex; flex-direction: column; gap: .6rem; padding: clamp(1.15rem, 4vw, 1.75rem); }
.choice .card-icon { margin: 0 0 .25rem; }
.portal-main .choice h2, .choice h2 { font: 600 1.25rem/1.3 var(--font-body); letter-spacing: 0; margin: 0; }
.choice p { margin: 0; }
.choice-cta { margin-top: auto; padding-top: .6rem; color: var(--brand-text); font-weight: 600; }
.check-grid { display: grid; gap: .7rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-top: .25rem; }
.stack > fieldset { padding: clamp(1rem, 3vw, 1.5rem); }
.stack > fieldset > legend { font: 600 1.0625rem var(--font-body); padding-inline: .5rem; }
fieldset fieldset { border: 0; padding: 0; }
fieldset fieldset > legend { padding: 0; margin-bottom: .4rem; }
.stack > fieldset .form-grid + datalist { display: none; }
.ref-box { text-align: center; padding: clamp(1.25rem, 4vw, 2rem); }
.ref-number { margin: .4rem 0 .8rem; font: 600 clamp(1.4rem, 5vw, 2.1rem)/1.15 var(--font-body); font-variant-numeric: tabular-nums; color: var(--text); word-break: break-all; }
.dl-grid { display: grid; gap: .2rem 1.5rem; margin: 0; }
.dl-grid dt { color: var(--text-dim); font-size: .875rem; margin-top: .8rem; }
.dl-grid dt:first-child { margin-top: 0; }
.dl-grid dd { margin: 0; min-width: 0; word-break: break-word; }
.dl-grid .badge { white-space: normal; }
@media (min-width: 700px) {
  .dl-grid { grid-template-columns: minmax(90px, min(200px, 32%)) minmax(0, 1fr); gap: .8rem 1.5rem; }
  .dl-grid dt { margin-top: 0; padding-top: .1rem; }
}
.note { padding: .9rem 0; border-top: 1px solid var(--line); }
.note:first-of-type { border-top: 0; padding-top: 0; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.file-list li { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.file-list li > div { flex: 1 1 240px; min-width: 0; word-break: break-word; }
.file-list audio { display: block; width: 100%; max-width: 420px; margin-top: .6rem; }
/* Chat: message bubbles, newest at the bottom (assets/js/portal.js scrolls there) */
.thread { position: relative; display: flex; flex-direction: column; gap: .5rem; max-height: min(62vh, 560px); overflow-y: auto; overscroll-behavior: contain; padding: .25rem .25rem .25rem 0; }
.msg { align-self: flex-start; max-width: 85%; padding: .6rem .85rem; border-radius: 14px 14px 14px 4px; background: var(--surface-2); color: var(--text); overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--brand); color: var(--on-brand); }
.msg-by { margin: 0 0 .2rem; font-size: .75rem; color: var(--text-dim); }
.msg.mine .msg-by { color: rgba(255, 255, 255, .86); }
.msg p { margin: 0; }
.msg p + p { margin-top: .2rem; }
.chat-composer { position: sticky; bottom: calc(var(--bottom-h, 0px) + env(safe-area-inset-bottom)); z-index: 5; margin: 1rem -1rem -1rem; padding: .75rem 1rem 1rem; background: var(--surface); border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.chat-composer .field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-composer .textarea { min-height: 52px; max-height: 40vh; }
.chat-composer .form-actions { margin-top: 0; }
.chat-composer .form-actions .btn { min-height: 48px; }
@media (min-width: 768px) {
  .chat-composer { position: static; margin: 1rem 0 0; padding: 1rem 0 0; background: none; border-radius: 0; }
  .chat-composer .field label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
}
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.note-item { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.note-item.is-unread { border-color: var(--brand-line); box-shadow: inset 3px 0 0 var(--brand); }
.note-title { margin: 0; font-weight: 600; }

/* 19. Member portal and projects ------------------------------------------- */
.project-card { display: flex; flex-direction: column; gap: .5rem; }
.project-card h3 { margin: .25rem 0 0; font-size: 1.0625rem; }
.project-card p { margin: 0; }
.project-card .mt-auto { margin-top: auto; padding-top: .75rem; }
.project-meta { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; font-size: .875rem; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.cred { display: inline-block; padding: .3rem .7rem; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); font: 600 1rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; word-break: break-all; }

/* 20. Admin panel ---------------------------------------------------------- */
.two-col { display: grid; gap: 1.25rem; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .two-col { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.activity-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.activity-list li { padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border-bottom: 0; padding-bottom: 0; }
[data-uid-status][data-state="ok"] { color: var(--success); }
[data-uid-status][data-state="bad"] { color: var(--error); }
.logbox { position: relative; max-height: 360px; overflow: auto; margin: 0; padding: 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font: .8rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; color: var(--text-muted); }

/* 21. Payments, locked deliverables and United Space ----------------------- */
.deliverables { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }
.deliv-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--r); }
.deliverables.is-locked { border-color: var(--warning-line); }
.deliverables.is-locked .deliv-icon { color: var(--warning); background: var(--warning-tint); }
.deliverables.is-unlocked { border-color: var(--success-line); }
.deliverables.is-unlocked .deliv-icon { color: var(--success); background: var(--success-tint); }
@media (min-width: 520px) { .deliverables { flex-direction: row; } }
.terms-box { border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--field); padding: .25rem 1rem; }
.terms-box summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; }
.terms-box[open] { padding-bottom: .9rem; }


/* Small layout helpers used by portal pages (replace earlier inline styles) */
.gap-sm { gap: .5rem; }
.align-start { align-items: flex-start; }
.fw-normal { font-weight: 400; }
.lg { font-size: 1.1rem; }
.mt-1 { margin-top: 1rem; }
.sub-item-name.is-center { align-items: center; }
.timeline-date { display: block; font-weight: 400; font-size: .8rem; }
.narrow-form, .narrow-card { max-width: 520px; }
.auth-card.auth-card-wide { max-width: none; }
.terms-box.terms-inline { display: inline-block; }
.steps-list { padding-left: 1.2rem; display: grid; gap: .4rem; }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; }
.profile-head-text { flex: 1 1 240px; min-width: 0; }
.avatar-lg { width: 96px; height: 96px; font-size: 1.8rem; }
.avatar-remove { display: block; margin-top: .75rem; }
.other-service { gap: 1rem; }
.other-service > .btn { flex: 1 1 100%; }
@media (min-width: 600px) { .other-service > .btn { flex: 0 0 auto; } }

/* Admin page helpers (Phase D) */
.nowrap { white-space: nowrap; }
.min-w-0 { min-width: 0; }
.align-center { align-items: center; }
.fw-strong { font-weight: 600; }
.mt-half { margin-top: .5rem; }
.grow-260 { flex: 1 1 260px; min-width: 0; }
.narrow-wide { max-width: 820px; }
.stat-bad { color: var(--error); }
.cred.cred-sm { font-size: .8rem; font-weight: 500; letter-spacing: 0; }
.table.table-fit { min-width: 0; width: 100%; }
.invite-link { margin: .4rem 0; word-break: break-all; }
.log-clear > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; }
.msg-delete { margin-top: .4rem; --_bg: var(--btn-danger-bg); --_bg-h: var(--btn-danger-bg-hover); --_bg-a: var(--btn-danger-bg-hover); --_bd: var(--btn-danger-line); --_bd-h: var(--btn-danger-text); --_fg: var(--btn-danger-text); --_fg-h: var(--btn-danger-text); }
.msg.mine .msg-delete { --_bg: rgba(255, 255, 255, .14); --_bg-h: rgba(255, 255, 255, .24); --_bg-a: rgba(255, 255, 255, .3); --_bd: rgba(255, 255, 255, .5); --_bd-h: #FFFFFF; --_fg: #FFFFFF; --_fg-h: #FFFFFF; }
/* On / off switch (chat on the admin request page) */
.switch { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; padding: 0; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; }
.switch-label { font-size: .875rem; color: var(--text-muted); }
.switch-track { position: relative; display: inline-block; width: 44px; height: 24px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line-strong); transition: background .15s, border-color .15s; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-muted); transition: left .15s, background .15s; }
.switch.is-on .switch-track { background: var(--brand); border-color: var(--brand); }
.switch.is-on .switch-thumb { left: 22px; background: #fff; }
/* Wide permission grid: first column stays in view while the ticks scroll */
.table-wrap > .table th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--surface); }
@media (max-width: 759px) {
  .table-cards td.nowrap { white-space: normal; }
  .table-cards .cred { word-break: break-all; }
}

/* HR helpers (Phase E) */
summary { cursor: pointer; }
.text-bad:not(.btn) { color: var(--error); }
.text-warn { color: var(--warning); }
.m-0 { margin: 0; }
.my-tight { margin-block: .4rem; }
.mb-1 { margin-bottom: 1rem; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.stack-sm { display: grid; gap: .5rem; }
.minw-110 { min-width: 110px; }
.input.input-inline { width: auto; min-width: min(16rem, 100%); flex: 1 1 16rem; }
.textarea.textarea-sm { min-height: 80px; }
.textarea.textarea-lg { min-height: 160px; }
.subcard { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.subcard > h3:first-child { margin-top: 0; }
.progress.progress-lg { height: 10px; }
.progress.my-progress { margin: .75rem 0 1rem; }

/* HR styles now live in assets/css/hr.css (loaded only on HR pages). */

/* "Please confirm" dialog (assets/js/app.js, data-confirm) */
.ue-confirm-msg { margin: 0; color: var(--text-muted); font-size: 1rem; }

/* Touch screens (phones and tablets): every control at least 44px, whatever the layout */
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
  .icon-btn, .rail-toggle, .sidebar-foot .icon-btn { width: 44px; height: 44px; }
  .page-link { min-width: 44px; height: 44px; }
  .page-gap { height: 44px; }
  .input, .select { min-height: 48px; }
}

/* 22b. Theme switch and loading screen ------------------------------------ */
/* Theme row in the phone menu (the round button stays in the header bar) */
.theme-toggle-row { justify-content: flex-start; gap: .6rem; border: 1px solid var(--line); }
@media (min-width: 900px) { .nav-actions .theme-toggle-row { display: none; } }
.corner-theme { display: flex; justify-content: flex-end; padding: calc(env(safe-area-inset-top) + .75rem) .75rem 0; }
.corner-theme .icon-btn { background: var(--surface); }
/* A short, smooth colour change when the theme is switched (assets/js/theme-init.js adds .theme-anim for 0.4 s) */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .32s ease, border-color .32s ease, color .32s ease, fill .32s ease, stroke .32s ease, box-shadow .32s ease !important;
}

/* Loading screen: markup from loader_html() in app/layout.php; timing in assets/js/theme-init.js.
   Without JavaScript it fades out on its own after 2 s; with JavaScript it can never stay longer than 3 s. */
.ue-loader {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: radial-gradient(60% 45% at 50% 42%, var(--brand-tint), transparent 70%), var(--bg);
  color: var(--text); pointer-events: auto;
  animation: ue-loader-out .45s ease 2s forwards;
}
.js .ue-loader { animation-delay: 3.2s; }
.ue-loader.is-hiding { opacity: 0; transform: translateY(-14px); pointer-events: none; transition: opacity .45s ease, transform .45s var(--ease); }
@keyframes ue-loader-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.ue-loader-inner { display: grid; justify-items: center; gap: 1.1rem; padding: 1.5rem; text-align: center; }
.ue-loader-mark { width: 96px; height: auto; animation: ue-loader-pop .7s var(--ease) both; }
.ue-loader-eq { display: flex; align-items: flex-end; gap: 5px; height: 30px; }
.ue-loader-eq span { width: 5px; height: 100%; border-radius: 3px; background: linear-gradient(to top, var(--brand), #B797F7); transform-origin: bottom; animation: ue-eq 1s ease-in-out infinite; }
.ue-loader-eq span:nth-child(2) { animation-delay: -.15s; } .ue-loader-eq span:nth-child(3) { animation-delay: -.45s; }
.ue-loader-eq span:nth-child(4) { animation-delay: -.3s; } .ue-loader-eq span:nth-child(5) { animation-delay: -.6s; }
.ue-loader-eq span:nth-child(6) { animation-delay: -.75s; } .ue-loader-eq span:nth-child(7) { animation-delay: -.9s; }
.ue-loader-tag { margin: 0; font: 500 1.125rem/1.3 var(--font-display); letter-spacing: .01em; color: var(--text-muted); opacity: 0; animation: ue-fade-in .4s ease .05s forwards; }
.ue-loader-bar { position: absolute; left: 0; top: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--brand), #B797F7); transform-origin: left; transform: scaleX(0); animation: ue-bar 2.4s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes ue-eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@keyframes ue-bar { to { transform: scaleX(.92); } }
@keyframes ue-fade-in { to { opacity: 1; } }
@keyframes ue-loader-pop { from { opacity: .35; transform: scale(.94); } to { opacity: 1; transform: none; } }
/* Later pages in the same visit: only the slim bar at the top, so moving around the portals stays fast */
.ue-quick .ue-loader { inset: 0 0 auto 0; height: 3px; background: none; pointer-events: none; }
.ue-quick .ue-loader-inner { display: none; }
.ue-quick .ue-loader-bar { animation-duration: 1s; }
@media (prefers-reduced-motion: reduce) {
  .ue-loader-eq span, .ue-loader-mark, .ue-loader-bar { animation: none; }
  .ue-loader-eq span { transform: scaleY(.6); }
  .ue-loader-tag { animation: none; opacity: 1; }
  .ue-loader-bar { transform: scaleX(.6); }
  .ue-loader.is-hiding { transform: none; transition-duration: .15s; }
}
@media print { .ue-loader { display: none !important; } }

/* 23. Spacing helpers (last, so they win over the component rules above) --- */
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 1.5rem; } .mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1.5rem; }
.mt-auto { margin-top: auto; }
