/*
 * ETC HQ V3 — Midnight & Pearl: materials.
 *
 * Loaded after hq.css. The palette and every material recipe live in the
 * tokens layer of hq.css; this file applies them in one cascade layer
 * (materials), above the component definitions and below motion, so a
 * component keeps its layout and takes its material from here.
 *
 *  1. Canvas and ambient light (per module, by the active navigation item)
 *  2. Satin navy: cards, sidebar, panels (anodized metal, smoked glass)
 *  3. Pearl: the light-surface context and where it is used
 *  4. Accents: navigation, tabs, pills, meters, charts
 *  5. Controls: buttons, inputs, menus, tooltips
 *  6. TESLA: Neon Orange command center
 *  7. Sign-in and welcome
 *
 * Nothing here changes what is shown, only how it looks.
 */

@property --lit {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

@layer materials {
  /* ================================================================ */
  /* 1. Canvas and ambient light                                       */
  /* ================================================================ */
  html { --ambient-a: var(--blue-rgb); --ambient-b: var(--blue-rgb); --ambient-c: var(--green-rgb); }
  /* Each module keeps the same canvas with its own faint key light. */
  html:has(.hq-nav__link--tesla[aria-current="page"]),
  html:has(.hq-tc-stage, .hq-agent) { --ambient-a: var(--orange-rgb); --ambient-b: var(--blue-rgb); --ambient-c: var(--orange-rgb); }
  html:has(.hq-nav__link[aria-current="page"][href^="/hq/finance"]) { --ambient-c: var(--green-rgb); --ambient-b: var(--green-rgb); }
  html:has(.hq-nav__link[aria-current="page"][href^="/hq/employees"]) { --ambient-b: var(--green-rgb); }

  body::before {
    background:
      radial-gradient(60% 48% at 18% -8%, rgb(var(--ambient-a) / 0.20), transparent 70%),
      radial-gradient(40% 36% at 100% 12%, rgb(var(--ambient-b) / 0.10), transparent 72%),
      radial-gradient(50% 40% at 82% 112%, rgb(var(--ambient-c) / 0.07), transparent 70%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 30%),
      radial-gradient(130% 95% at 50% 40%, transparent 52%, rgba(2, 5, 10, 0.62) 100%),
      var(--navy-900);
  }
  body::after { opacity: 1; background-image: var(--grain); }
  /* Energy Flow: one WebGL light stream behind every page (ui/js/energy-flow.js).
     The body's opaque navy covers anything at a negative z-index, so the
     canvas is the first positioned layer at z-index 0 and the app shell is
     positioned after it (no z-index, so no new stacking context): all
     content paints above the light, which never takes pointer events. */
  .hq-app { position: relative; }
  .hq-energy-track {
    position: fixed; inset: 0 0 auto 0; z-index: 0;
    height: 100vh; height: 100lvh;
    overflow: hidden; pointer-events: none;
  }
  /* Touch devices: the track spans the page and the script sizes and moves
     the canvas inside it, so the browser scrolls the light with the content. */
  .hq-energy-track.is-page { position: absolute; }
  /* The stream starts after the page's first frame and fades in with its
     first drawn frame (energy-flow.js adds .hq-energy-live). */
  .hq-energy { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 360ms var(--ease-out); }
  .hq-energy-live .hq-energy { opacity: 1; }
  @media (prefers-reduced-motion: reduce) { .hq-energy { transition: none; } }
  .hq-energy[hidden] { display: none; }
  /* While the light runs, the smoked glass is nearly solid: the stream only
     glimmers through cards, and their content stays first. (Pearl surfaces
     set their own values and are unchanged.) */
  html.hq-energy-on {
    --glass-1: rgb(var(--navy-hi-rgb) / 0.92);
    --glass-2: rgb(25 42 64 / 0.94);
    --glass-3: rgb(var(--navy-rgb) / 0.96);
  }
  @media print { .hq-energy-track { display: none; } }

  /* ================================================================ */
  /* 2. Satin navy                                                      */
  /* ================================================================ */
  /* Anodized satin: brushed hairlines, a key light from the top left,
     fine grain and a lit bevel along the top edge. */
  .hq-card, .hq-pulse, .panel, .kpi, .opp-card, .tesla {
    --lit-rgb: var(--blue-rgb);
    background: var(--grain), var(--brush), var(--satin), var(--glass-1);
    box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), --lit var(--dur-slow) var(--ease-out);
  }
  .panel, .kpi, .opp-card { border-color: rgb(var(--fg-rgb) / 0.06); border-top-color: rgba(255, 255, 255, 0.16); }

  /* The bevel: brightest where the light falls, and a second light that
     travels along the edge under the pointer. */
  .hq-card::after, .hq-pulse::after {
    background:
      radial-gradient(220px circle at var(--mx, -400px) var(--my, -400px), rgb(var(--lit-rgb) / calc(var(--lit) * 0.85)), transparent 70%),
      linear-gradient(var(--edge-angle), var(--edge-top), var(--edge-mid) 34%, var(--edge-bottom));
  }
  .hq-card::before, .hq-pulse::before {
    background: radial-gradient(560px circle at var(--mx, 50%) var(--my, -30%), rgb(var(--lit-rgb) / 0.09), transparent 62%);
  }
  .hq-card.is-lit, .hq-pulse.is-lit { --lit: 1; }

  .hq-card--hero {
    background:
      var(--grain),
      radial-gradient(70% 95% at 0% 0%, rgb(var(--blue-rgb) / 0.26), transparent 62%),
      radial-gradient(55% 70% at 100% 100%, rgb(var(--green-rgb) / 0.05), transparent 70%),
      var(--brush), var(--satin), var(--glass-2);
    box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    --edge-top: rgb(var(--blue-hi-rgb) / 0.42);
  }

  /* Smoked-glass sidebar with a satin face. */
  @media (min-width: 1024px) {
    .hq-sidebar {
      background: var(--grain), var(--satin), rgb(var(--navy-rgb) / 0.66);
      box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.08), inset -1px 0 0 rgba(255, 255, 255, 0.03);
    }
    .hq-sidebar::after { background: linear-gradient(170deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04) 30%, rgba(255, 255, 255, 0.06)); }
  }
  .hq-scrolled .hq-topbar { background: rgb(var(--navy-rgb) / 0.74); }
  .hq-tabbar::before { background: var(--grain), var(--satin), rgb(var(--navy-rgb) / 0.8); }

  /* Recessed wells inside cards (sub-figures, stats, empty frames). */
  :is(.hq-agent__status div, .hq-account__signed, .hq-site__stats) { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--line-soft); }

  /* Interactive cards rise to the pointer. */
  @media (hover: hover) and (pointer: fine) {
    a.hq-card:hover, .hq-sitecard:hover, .opp-card:hover {
      transform: var(--lift);
      box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.10);
    }
    .hq-card:hover { box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 -1px 0 rgba(0, 0, 0, 0.25); }
  }

  /* ================================================================ */
  /* 3. Pearl                                                           */
  /* ================================================================ */
  /* The pearl context: one set of tokens for everything that sits on a
     light surface. Any component placed inside reads correctly, because
     it takes its colours from these tokens, not from its own. */
  .hq-pearl,
  .hq-pulse:not(.hq-fin-kpis), .kpis .kpi, a.hq-tc-action, .hq-sitecard__stats, .hq-sys-overview .hq-facts > div,
  .hq-form-card, .hq-auth__card, .auth--single .auth-card,
  .hq-menu, .hq-tooltip,
  .hq-attention--flagged,
  .hq-ledger__item--result,
  .hq-task-description__body,
  .hq-chat__msg--user .hq-chat__bubble {
    --fg-rgb: var(--navy-rgb);
    --text: var(--pearl-ink);
    --text-muted: var(--pearl-ink-muted);
    --text-subtle: var(--pearl-ink-subtle);
    --line-soft: rgb(var(--navy-rgb) / 0.08);
    --line: rgb(var(--navy-rgb) / 0.12);
    --line-strong: rgb(var(--navy-rgb) / 0.20);
    --highlight: var(--pearl-edge-hi);
    --glass-0: rgb(var(--navy-rgb) / 0.035);
    --glass-1: rgb(var(--pearl-rgb) / 0.6);
    --hover-tint: rgb(var(--navy-rgb) / 0.05);
    --blue-300: var(--pearl-ink-blue);
    --blue-400: var(--pearl-ink-blue);
    --blue-500: #2b6ff0;
    --ok-text: var(--pearl-ink-green);
    --error-text: var(--pearl-ink-error);
    --warn: var(--pearl-ink-warn);
    --tesla-text: var(--pearl-ink-orange);
    --series-1: #2b6ff0;
    --series-2: #0b1420;
    --series-3: #00a974;
    --series-4: #7aa6f0;
    --series-5: #8b95a3;
    --series-6: #c7ccd3;
    --chart-dot-fill: var(--pearl-hi);
    --surface-solid: var(--pearl-solid);
    --edge-top: var(--pearl-edge-hi);
    --edge-mid: rgba(255, 255, 255, 0.24);
    --edge-bottom: rgb(var(--navy-rgb) / 0.10);
    --lit-rgb: 244 246 249;
    --focus-ring: 0 0 0 2px var(--pearl), 0 0 0 4px var(--blue-500);
    --surface: var(--pearl-well);
    --surface-muted: rgb(var(--navy-rgb) / 0.04);
    --border: var(--line);
    --border-strong: var(--line-strong);
    --link: var(--pearl-ink-blue);
    --primary: var(--navy-900);
    --on-primary: var(--pearl);
    color: var(--text);
    color-scheme: light;
  }
  /* Polished pearl ceramic: a soft key light, a pearlescent sweep, grain,
     a bright rim and a grounded, layered shadow. */
  .hq-pearl, .hq-pulse:not(.hq-fin-kpis), .kpis .kpi, a.hq-tc-action, .hq-form-card, .hq-attention--flagged {
    background: var(--pearl-grain-faint), var(--pearl-surface);
    box-shadow: var(--pearl-shadow);
  }
  .kpis .kpi, .auth--single .auth-card { border-color: var(--pearl-edge-hi); }
  :is(.hq-pearl, .hq-pulse:not(.hq-fin-kpis), .hq-form-card, .hq-attention--flagged)::before {
    background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -30%), var(--pearl-sheen), transparent 60%);
  }
  :is(.hq-pearl, .hq-pulse:not(.hq-fin-kpis), .hq-form-card, .hq-attention--flagged)::after {
    background:
      radial-gradient(200px circle at var(--mx, -400px) var(--my, -400px), rgb(var(--blue-rgb) / calc(var(--lit) * 0.7)), transparent 70%),
      linear-gradient(var(--edge-angle), var(--pearl-edge-hi), rgba(255, 255, 255, 0.2) 40%, rgb(var(--navy-rgb) / 0.12));
  }
  @media (hover: hover) and (pointer: fine) {
    :is(.hq-pearl, .hq-pulse:not(.hq-fin-kpis), .hq-form-card, .hq-attention--flagged):hover {
      box-shadow: var(--pearl-rim), 0 1px 1px rgba(0, 0, 0, 0.35), 0 10px 22px -8px rgba(0, 0, 0, 0.55), 0 44px 80px -36px rgba(0, 0, 0, 0.95);
    }
  }
  /* Six figures in one strip: the size follows the space, never overlaps. */
  .hq-fin-kpis--six .hq-pulse__value { font-size: clamp(18px, 1.05vw + 8px, 26px); }
  .hq-fin-kpis--six .hq-pulse__item { padding-inline: 18px; }
  .hq-pulse:not(.hq-fin-kpis) .hq-pulse__item:hover { background: rgb(var(--navy-rgb) / 0.035); }
  .hq-pearl .hq-chart__line--expenses { stroke: var(--series-2); opacity: 0.7; }
  .hq-pearl .hq-chart__dot--expenses { stroke: var(--series-2); }
  .hq-pearl .hq-chart__line--revenue { filter: drop-shadow(0 4px 8px rgb(var(--blue-rgb) / 0.3)); }
  .hq-pearl .hq-swatch--expenses { background: var(--series-2); }
  .hq-pearl .hq-donut__track, .hq-pearl .hq-cost-track { stroke: rgb(var(--navy-rgb) / 0.08); }
  .hq-pearl .hq-meter__track { background: rgb(var(--navy-rgb) / 0.08); box-shadow: inset 0 1px 1px rgb(var(--navy-rgb) / 0.12); }
  .hq-pearl .hq-pill--active { color: var(--pearl-ink-green); background: rgb(var(--green-rgb) / 0.16); }
  .hq-pearl .hq-pill--delayed { color: var(--pearl-ink-error); background: rgb(var(--red-rgb) / 0.12); }
  .hq-pearl .hq-pill--closing { color: var(--pearl-ink-blue); background: rgb(var(--blue-rgb) / 0.12); }
  .hq-pearl .hq-count-badge { color: #fff; background: var(--orange); }
  .hq-pearl a:not([class]) { color: var(--pearl-ink-blue); }
  .hq-pearl .hq-table tbody tr:hover > * { background: rgb(var(--navy-rgb) / 0.03); }
  /* The selected figure in a filter strip (Projects, Employees, Tasks) is
     pressed into the pearl: a soft grey shade with an inner shadow, no
     colour of its own. */
  .hq-pulse .hq-sites-summary__item[aria-current="true"],
  .hq-pulse .hq-sites-summary__item[aria-current="true"]:hover {
    background: rgb(var(--navy-rgb) / 0.06);
    box-shadow: inset 0 2px 6px rgb(var(--navy-rgb) / 0.14), inset 0 1px 1px rgb(var(--navy-rgb) / 0.10), inset 0 0 0 1px rgb(var(--navy-rgb) / 0.05);
  }

  /* Each project card carries its recorded figures on a small pearl tablet. */
  .hq-sitecard__stats {
    background: var(--pearl-grain-faint), var(--pearl-surface);
    box-shadow: var(--pearl-rim), 0 1px 1px rgba(0, 0, 0, 0.35), 0 10px 20px -12px rgba(0, 0, 0, 0.8);
  }
  .hq-sitecard__stats dt { color: var(--pearl-ink-subtle); }

  /* Six figures inside a card sit in a recessed, machined well. */
  .hq-fin-kpis { background: rgb(var(--navy-rgb) / 0.35); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 0 0 1px var(--line-soft); }

  /* The month's result: a raised pearl tablet in the hero. */
  .hq-ledger__item--result { background: var(--pearl-grain-faint), var(--pearl-surface); box-shadow: var(--pearl-shadow); }

  /* ================================================================ */
  /* 4. Accents                                                         */
  /* ================================================================ */
  /* Navigation: a lit blue channel with a light bar that glows. */
  .hq-nav__link:hover { background: rgb(var(--fg-rgb) / 0.05); }
  .hq-nav__link[aria-current="page"] {
    background: linear-gradient(90deg, rgb(var(--blue-rgb) / 0.26), rgb(var(--blue-rgb) / 0.06) 85%);
    box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px -12px rgb(var(--blue-rgb) / 0.6);
  }
  .hq-nav__link[aria-current="page"] .icon { color: var(--blue-300); filter: drop-shadow(0 0 6px rgb(var(--blue-rgb) / 0.6)); }
  .hq-nav__link[aria-current="page"]::before {
    left: 3px;
    background: linear-gradient(180deg, #cfe0ff, var(--blue-500));
    box-shadow: 0 0 10px rgb(var(--blue-rgb) / 0.9), 0 0 2px rgb(var(--blue-hi-rgb) / 1);
  }
  .hq-nav__link--tesla:hover { background: rgb(var(--orange-rgb) / 0.07); }
  .hq-nav__link--tesla[aria-current="page"] {
    background: linear-gradient(90deg, rgb(var(--orange-rgb) / 0.24), rgb(var(--orange-rgb) / 0.05) 85%);
    box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 24px -12px rgb(var(--orange-rgb) / 0.7);
  }
  .hq-nav__link--tesla[aria-current="page"]::before { background: linear-gradient(180deg, #ffd2b0, var(--orange)); box-shadow: 0 0 12px rgb(var(--orange-rgb) / 1); }
  .hq-tabbar__item[aria-current="page"]::before { background: var(--blue-500); box-shadow: 0 0 10px rgb(var(--blue-rgb) / 0.9); }
  .hq-tabbar__item[aria-current="page"]::after { background: linear-gradient(180deg, rgb(var(--blue-rgb) / 0.30), rgb(var(--blue-rgb) / 0.12)); }

  .hq-tabbar__item--tesla[aria-current="page"]::before { background: var(--orange); box-shadow: 0 0 10px rgb(var(--orange-rgb) / 0.9); }
  .hq-tabbar__item--tesla[aria-current="page"]::after { background: linear-gradient(180deg, rgb(var(--orange-rgb) / 0.26), rgb(var(--orange-rgb) / 0.08)); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.3); }

  /* Tabs: the active tab is a small pearl chip on the navy track; the
     track is a machined groove. */
  .hq-segmented, .hq-tc-tabs__list {
    background: rgb(var(--navy-rgb) / 0.55);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 0 0 1px var(--line-soft), 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  .hq-segmented__item:hover { background: rgb(var(--fg-rgb) / 0.05); }
  .hq-segmented__item:is([aria-current="true"], [aria-selected="true"], [aria-current="page"], [aria-pressed="true"]),
  .hq-fin-tabs .hq-segmented__item[aria-current="page"] {
    color: var(--pearl-ink);
    background: var(--pearl-surface);
    box-shadow: var(--pearl-rim), 0 1px 1px rgba(0, 0, 0, 0.4), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
  }
  .hq-segmented__item[aria-current] .icon { color: var(--pearl-ink-blue); }
  /* Inside a pearl surface the groove turns light. */
  .hq-pearl .hq-segmented { background: rgb(var(--navy-rgb) / 0.06); box-shadow: inset 0 1px 2px rgb(var(--navy-rgb) / 0.12); }

  /* Pills: green for what is done or running well, blue for information,
     orange for priority and attention, red only for what is late. */
  .hq-pill--active { color: var(--green); background: rgb(var(--green-rgb) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--green-rgb) / 0.2); }
  .hq-pill--prio-high { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.14); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.32); }
  .hq-pill--active::before { box-shadow: 0 0 6px currentColor; }
  .hq-pearl .hq-pill--prio-high { color: var(--pearl-ink-orange); background: rgb(var(--orange-rgb) / 0.12); }
  .prio--high { color: #fff; background: linear-gradient(180deg, #ff7f2a, var(--orange)); border-color: transparent; box-shadow: 0 4px 12px -4px rgb(var(--orange-rgb) / 0.7); }
  .prio--medium { color: var(--blue-300); border-color: rgb(var(--blue-rgb) / 0.5); }
  .hq-count-badge { color: #fff; background: var(--orange); box-shadow: 0 0 0 3px rgb(var(--orange-rgb) / 0.16), 0 4px 10px -2px rgb(var(--orange-rgb) / 0.6); }

  /* Meters: lit bars with a bright leading edge. */
  .hq-meter__track { background: rgb(var(--fg-rgb) / 0.06); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35); }
  .hq-meter__bar:not([class*="hq-fin-age"]) {
    background: linear-gradient(90deg, var(--blue-700), var(--blue-500) 70%, #a8c8ff);
    box-shadow: 0 0 14px rgb(var(--blue-rgb) / 0.4);
  }
  .hq-pearl .hq-meter__bar:not([class*="hq-fin-age"]) { background: linear-gradient(90deg, #1a56c4, #438bff); box-shadow: 0 2px 6px rgb(var(--blue-rgb) / 0.3); }

  /* Charts: the revenue line is lit, its points glow. */
  .hq-chart__line--revenue { stroke: var(--blue-500); filter: drop-shadow(0 4px 12px rgb(var(--blue-rgb) / 0.55)); }
  .hq-chart__dot--revenue { stroke: var(--blue-500); }
  .hq-chart__dot.is-current { filter: drop-shadow(0 0 6px rgb(var(--blue-rgb) / 0.8)); }
  .hq-donut__arc--1 { stroke: var(--blue-500); }
  .hq-change.is-good { color: var(--green); }

  /* ================================================================ */
  /* 5. Controls                                                        */
  /* ================================================================ */
  /* Primary buttons: pearl ceramic keys that press in. */
  .hq-button--primary, .btn--primary, .hq-quick__action--primary, .hq-auth__submit {
    color: var(--pearl-ink);
    background: var(--pearl-surface);
    border-color: transparent;
    box-shadow: var(--pearl-rim), 0 1px 1px rgba(0, 0, 0, 0.45), 0 8px 18px -8px rgba(0, 0, 0, 0.75);
  }
  .hq-button--primary .icon, .hq-quick__action--primary .icon { color: var(--pearl-ink-blue); }
  :is(.hq-button--primary, .btn--primary, .hq-quick__action--primary, .hq-auth__submit):active {
    transform: translateY(1px) scale(var(--press-scale));
    box-shadow: inset 0 1px 2px rgb(var(--navy-rgb) / 0.25), inset 0 0 0 1px var(--pearl-edge), 0 1px 1px rgba(0, 0, 0, 0.4);
    transition-duration: 80ms;
  }
  /* Secondary buttons: satin navy keys. */
  .hq-quick__action, .btn:not(.btn--primary) {
    background: var(--satin), rgb(var(--fg-rgb) / 0.04);
    box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  }
  .hq-pearl :is(.hq-quick__action, .btn:not(.btn--primary)) { background: var(--pearl-well); box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgb(var(--navy-rgb) / 0.12); }
  .hq-sys-overview .hq-facts > div { background: var(--pearl-grain-faint), var(--pearl-surface); box-shadow: var(--pearl-rim), 0 1px 1px rgba(0, 0, 0, 0.35), 0 14px 28px -16px rgba(0, 0, 0, 0.85); border: 0; }
  :is(.hq-pearl, .hq-form-card) :is(.btn--primary, .hq-button--primary, .hq-quick__action--primary) { color: var(--pearl); background: linear-gradient(180deg, #1b2b42, var(--navy-900)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 14px -6px rgb(var(--navy-rgb) / 0.7); }
  :is(.hq-quick__action, .btn):active { transform: translateY(1px) scale(var(--press-scale)); transition-duration: 80ms; }

  /* Inputs: machined wells; focus lights the rim in blue. */
  :is(input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="number"], input[type="date"], select, textarea) {
    background: rgb(var(--navy-rgb) / 0.6);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  }
  :is(input, select, textarea):focus-visible {
    border-color: var(--blue-500);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 3px rgb(var(--blue-rgb) / 0.22);
  }
  .hq-pearl :is(input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="number"], input[type="date"], select, textarea),
  :is(.hq-form-card, .hq-auth__card, .auth-card) :is(input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="number"], input[type="date"], select, textarea) {
    color: var(--pearl-ink);
    background: var(--pearl-well);
    border-color: rgb(var(--navy-rgb) / 0.16);
    box-shadow: inset 0 1px 2px rgb(var(--navy-rgb) / 0.12);
  }
  :is(.hq-form-card, .hq-auth__card, .auth-card) :is(input, select, textarea):focus-visible { border-color: var(--blue-500); box-shadow: inset 0 1px 2px rgb(var(--navy-rgb) / 0.1), 0 0 0 3px rgb(var(--blue-rgb) / 0.25); }
  :is(.hq-form-card, .hq-auth__card, .auth-card) :is(label, legend) { color: var(--pearl-ink-muted); }

  /* Menus and tooltips: pearl panels over the navy. */
  .hq-menu {
    background: var(--pearl-grain-faint), var(--pearl-surface);
    box-shadow: var(--pearl-rim), 0 2px 4px rgba(0, 0, 0, 0.3), 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  }
  .hq-menu__item { color: var(--pearl-ink-muted); }
  .hq-menu__item:hover { color: var(--pearl-ink); background: rgb(var(--navy-rgb) / 0.06); }
  .hq-menu__item[aria-current] { color: var(--pearl-ink); background: rgb(var(--blue-rgb) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.2); }
  .hq-select__button { background: var(--satin), var(--glass-1); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px -4px rgba(0, 0, 0, 0.5); }
  .hq-select[open] .hq-select__button { box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.6), 0 0 0 3px rgb(var(--blue-rgb) / 0.16); }
  .hq-tooltip { box-shadow: var(--pearl-rim), 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 48px -16px rgba(0, 0, 0, 0.8); }
  .hq-account__panel { background: var(--grain), var(--satin), rgb(var(--navy-rgb) / 0.95); }

  /* Tables on navy: a quiet row light under the pointer. */
  .hq-table tbody tr > * { transition: background-color var(--dur-fast) var(--ease-out); }
  @media (hover: hover) and (pointer: fine) {
    .hq-table tbody tr:hover > * { background: rgb(var(--fg-rgb) / 0.025); }
  }

  /* ================================================================ */
  /* 6. TESLA: Neon Orange command center                               */
  /* ================================================================ */
  .hq-card--tesla, .tesla, .hq-research, .hq-tc-alert, .hq-tc-alerts, .hq-ask {
    --lit-rgb: var(--orange-rgb);
    --edge-top: rgb(var(--orange-rgb) / 0.55);
  }
  .hq-title--tesla .icon, .hq-agent__name span, .hq-report__from strong, .hq-auth__agent strong { color: var(--tesla-text); }
  .hq-tesla__dot, .hq-nav__tesla-dot { background: var(--orange); box-shadow: 0 0 0 3px rgb(var(--orange-rgb) / 0.18), 0 0 10px rgb(var(--orange-rgb) / 0.8); }

  /* The TESLA stage: orange key light behind him, a fine instrument grid
     fading out from the figure, a lit orange rim. */
  .hq-tc-stage, .hq-agent__stage {
    --lit-rgb: var(--orange-rgb);
    --edge-top: rgb(var(--orange-rgb) / 0.6);
    background:
      radial-gradient(60% 80% at 22% 85%, rgb(var(--orange-rgb) / 0.26), transparent 62%),
      radial-gradient(70% 70% at 100% 0%, rgb(var(--blue-rgb) / 0.16), transparent 60%),
      linear-gradient(rgb(var(--orange-rgb) / 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
      linear-gradient(90deg, rgb(var(--orange-rgb) / 0.05) 1px, transparent 1px) 0 0 / 28px 28px,
      var(--grain), var(--satin), var(--glass-2);
    box-shadow: var(--shadow-2), inset 0 1px 0 rgb(var(--orange-hi-rgb) / 0.25), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.12), 0 0 80px -40px rgb(var(--orange-rgb) / 0.6);
  }
  .hq-tc-stage__glow { background: radial-gradient(closest-side, rgb(var(--orange-rgb) / 0.45), rgb(var(--orange-rgb) / 0.12) 55%, transparent); }

  /* The linked quick action is a pearl key with an orange arrow. */
  a.hq-tc-action { box-shadow: var(--pearl-shadow); }
  a.hq-tc-action:hover { box-shadow: var(--pearl-rim), 0 0 0 1px rgb(var(--orange-rgb) / 0.45), 0 14px 30px -10px rgb(var(--orange-rgb) / 0.45), 0 30px 60px -30px rgba(0, 0, 0, 0.9); }
  a.hq-tc-action .hq-tc-action__go { color: #fff; background: linear-gradient(180deg, #ff8233, var(--orange)); box-shadow: 0 6px 14px -4px rgb(var(--orange-rgb) / 0.7); }

  /* TESLA tabs: the active one carries his orange light. */
  .hq-tc-tabs__item[aria-current="page"] {
    color: var(--pearl-ink);
    background: var(--pearl-surface);
    box-shadow: var(--pearl-rim), 0 0 0 1px rgb(var(--orange-rgb) / 0.5), 0 6px 18px -6px rgb(var(--orange-rgb) / 0.6);
  }
  .hq-tc-tabs__item[aria-current="page"] .icon { color: var(--pearl-ink-orange); }

  /* Portrait: an orange ring that breathes while he is active. */
  .hq-portrait { box-shadow: 0 0 0 1.5px rgb(var(--orange-rgb) / 0.6), 0 0 14px -2px rgb(var(--orange-rgb) / 0.5); }
  .hq-portrait--nav, .hq-portrait--tab { box-shadow: 0 0 0 1px rgb(var(--orange-rgb) / 0.45); }
  .hq-nav__link--tesla:hover .hq-portrait, .hq-nav__link--tesla[aria-current="page"] .hq-portrait { box-shadow: 0 0 0 1.5px var(--orange), 0 0 12px rgb(var(--orange-rgb) / 0.7); }

  /* Status pills and dots. */
  .hq-agent__state--active, .hq-tc-state--active { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.14); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.3); }
  .hq-agent__pulse, .hq-presence__dot.is-running { position: relative; }

  /* Conversation: TESLA speaks from smoked glass with an orange filament,
     the owner's words sit on pearl. */
  .hq-chat__msg--tesla .hq-chat__bubble {
    background: var(--grain), linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)), rgb(var(--navy-rgb) / 0.55);
    box-shadow: inset 0 0 0 1px var(--line), inset 2px 0 0 rgb(var(--orange-rgb) / 0.75), 0 10px 24px -14px rgba(0, 0, 0, 0.7);
  }
  .hq-chat__msg--user .hq-chat__bubble {
    background: var(--pearl-surface);
    box-shadow: var(--pearl-rim), 0 1px 1px rgba(0, 0, 0, 0.35), 0 10px 22px -12px rgba(0, 0, 0, 0.7);
  }
  .hq-ask__form textarea {
    background: rgb(var(--navy-rgb) / 0.6);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
  }
  .hq-ask__form textarea:focus-visible { border-color: var(--orange); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 3px rgb(var(--orange-rgb) / 0.2); }
  .hq-ask__form .hq-quick__action--primary:not(:disabled) {
    color: #fff;
    background: linear-gradient(180deg, #ff8233, var(--orange) 55%, #e65a00);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 1px rgba(0, 0, 0, 0.4), 0 10px 22px -8px rgb(var(--orange-rgb) / 0.8);
  }
  .hq-ask__form .hq-quick__action--primary:not(:disabled) .icon { color: #fff; }
  .hq-ask__form .hq-quick__action--primary:disabled { color: var(--text-muted); background: rgb(var(--fg-rgb) / 0.07); box-shadow: inset 0 0 0 1px var(--line); opacity: 1; }
  .hq-ask__form .hq-quick__action--primary:disabled .icon { color: var(--text-subtle); }
  .hq-ask__tag--estimate, .hq-ask__kind--estimate { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.14); }

  /* ================================================================ */
  /* 7. Sign-in and welcome                                             */
  /* ================================================================ */
  .hq-auth__card, .auth--single .auth-card {
    background: var(--pearl-grain-faint), var(--pearl-surface);
    box-shadow: var(--pearl-shadow), 0 0 120px -40px rgb(var(--blue-rgb) / 0.5);
  }
  .hq-auth__card :is(.hq-auth__title) { color: var(--pearl-ink); }
  .hq-auth__card :is(.hq-auth__submit) {
    color: var(--pearl);
    background: linear-gradient(180deg, #1c2d45, var(--navy-900));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 1px rgba(0, 0, 0, 0.4), 0 12px 24px -10px rgb(var(--navy-rgb) / 0.8);
  }
  .hq-auth__card :is(.hq-auth__submit):hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 0 3px rgb(var(--blue-rgb) / 0.25), 0 14px 28px -10px rgb(var(--navy-rgb) / 0.9); }
  .hq-auth-page body::before, body.hq-auth-page::before {
    background:
      radial-gradient(50% 50% at 50% 30%, rgb(var(--blue-rgb) / 0.20), transparent 70%),
      radial-gradient(40% 40% at 80% 100%, rgb(var(--orange-rgb) / 0.08), transparent 70%),
      radial-gradient(130% 95% at 50% 40%, transparent 52%, rgba(2, 5, 10, 0.7) 100%),
      var(--navy-900);
  }
}

/* ------------------------------------------------------------------ */
/* Motion for the materials (only when motion is allowed)              */
/* ------------------------------------------------------------------ */
@layer motion {
  @keyframes mp-ring { 0% { transform: scale(1); opacity: 0.75; } 100% { transform: scale(2.6); opacity: 0; } }
  @keyframes mp-breathe { 0%, 100% { box-shadow: 0 0 0 1.5px rgb(var(--orange-rgb) / 0.55), 0 0 10px -2px rgb(var(--orange-rgb) / 0.35); } 50% { box-shadow: 0 0 0 1.5px rgb(var(--orange-rgb) / 0.9), 0 0 22px 0 rgb(var(--orange-rgb) / 0.55); } }
  @keyframes mp-glow { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
  @keyframes mp-sweep { from { transform: translateX(-120%); } to { transform: translateX(120%); } }

  @media (prefers-reduced-motion: no-preference) {
    /* A living status: the dot sends a soft ring outward. */
    .hq-tesla__dot, .hq-nav__tesla-dot, .hq-agent__pulse { position: relative; }
    :is(.hq-tesla__dot, .hq-nav__tesla-dot, .hq-agent__state--active .hq-agent__pulse)::after {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: var(--orange);
      animation: mp-ring 2.4s var(--ease-out) infinite;
      pointer-events: none;
    }
    .hq-presence__button .hq-portrait, .hq-tc-stage .hq-portrait { animation: mp-breathe 4.8s var(--ease-in-out) infinite; }
    .hq-tc-stage__glow, .hq-agent__light { animation: mp-glow 6s var(--ease-in-out) infinite; }

    /* The pearl keys catch a passing light on hover. */
    @media (hover: hover) and (pointer: fine) {
      .hq-button--primary, .btn--primary, .hq-quick__action--primary { position: relative; overflow: hidden; }
      :is(.hq-button--primary, .btn--primary, .hq-quick__action--primary)::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.38) 50%, transparent 65%);
        transform: translateX(-120%);
        pointer-events: none;
      }
      :is(.hq-button--primary, .btn--primary, .hq-quick__action--primary):hover::after { animation: mp-sweep 700ms var(--ease-out); }
    }

    /* Active tab chips glide between pages (View Transitions). */
    .hq-fin-tabs .hq-segmented__item[aria-current="page"] { view-transition-name: hq-tab-chip; }
    .hq-tc-tabs__item[aria-current="page"] { view-transition-name: hq-tc-chip; }
    ::view-transition-group(hq-tab-chip), ::view-transition-group(hq-tc-chip) { animation-duration: 360ms; animation-timing-function: var(--ease-out); }
  }
}

/* Tab tracks: the pointer's gliding light (hq.js adds .mp-glide). */
@layer materials {
  .has-glide { position: relative; isolation: isolate; }
  .has-glide > :not(.mp-glide) { position: relative; z-index: 1; }
  .mp-glide {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    border-radius: 10px;
    background: rgb(var(--fg-rgb) / 0.07);
    box-shadow: inset 0 0 0 1px rgb(var(--fg-rgb) / 0.08);
    opacity: 0;
    pointer-events: none;
    transition: transform 320ms var(--ease-out), width 320ms var(--ease-out), opacity var(--dur-fast) var(--ease-out);
  }
  .mp-glide.is-on { opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Header: page metadata, profile, Home controls                       */
/* ------------------------------------------------------------------ */
@layer materials {
  .hq-topbar__actions { gap: 14px; min-width: 0; }

  /* Desktop: the header sits at the top of the page, in the content column
     beside the sidebar, and scrolls away with the page. Only the profile
     stays: it is fixed where it sits in the header (the header's top edge
     lines up with the sidebar's, its right edge with the content's) and
     floats over the page once it scrolls. Its right offset follows the
     navigation column (--nav-w), so expanded and collapsed navigation both
     keep it on the content edge. hq.js reports the profile's width as
     --profile-w, and the header keeps that space free for it. */
  @media (min-width: 1024px) {
    :root { --nav-w: var(--sidebar); --bar-top: 14px; --bar-h: 60px; }
    .hq-rail { --nav-w: var(--rail); }
    .hq-topbar {
      position: relative;
      top: auto;
      width: calc(100% - 2 * var(--gutter));
      max-width: calc(1520px - 2 * var(--gutter));
      height: var(--bar-h);
      margin: var(--bar-top) auto 0;
      padding: 0 calc(var(--profile-w, 200px) + 14px) 0 0;
    }
    .hq-scrolled .hq-topbar { background: none; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
    .hq-topbar > .hq-account {
      position: fixed;
      z-index: 30;
      top: calc(var(--bar-top) + (var(--bar-h) - 48px) / 2);
      right: calc(max(0px, (100% - var(--nav-w) - 1520px) / 2) + var(--gutter));
      transition: right var(--dur) var(--ease-in-out);
    }
    /* Floating over the page, the profile turns to the sidebar's smoked
       glass so it stays legible over navy and pearl alike. */
    .hq-scrolled .hq-topbar .hq-account__button.hq-profile {
      background: var(--grain), var(--satin), rgb(var(--navy-rgb) / 0.88);
      -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
      backdrop-filter: blur(var(--blur)) saturate(150%);
      box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.1), var(--shadow-1);
    }
    .hq-content { padding-top: 14px; }
  }

  /* The shown month and its last update: quiet, secondary, right-aligned. */
  .hq-pagemeta { display: grid; gap: 1px; min-width: 0; text-align: right; line-height: 1.35; }
  .hq-pagemeta__line { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-pagemeta__month { color: var(--text); }
  .hq-pagemeta__sub { font-size: 11.5px; font-weight: 500; color: var(--text-subtle); }
  .hq-pagemeta__warn { color: var(--warn); font-weight: 650; }
  .hq-pagemeta--inline { display: none; text-align: left; margin-top: -4px; }
  .hq-pagemeta--inline .hq-pagemeta__line { white-space: normal; }

  /* Sources and definitions: a small info key beside the metadata. */
  .hq-info--topbar .hq-info__button { width: 32px; height: 32px; }
  .hq-info--topbar .hq-info__panel { left: auto; right: -8px; z-index: 40; }

  /* Profile: avatar, name, role and a chevron, on a satin pill. */
  .hq-account__button.hq-profile {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: auto;
    height: 48px;
    padding: 4px 14px 4px 4px;
    border-radius: 999px;
    background: var(--satin), rgb(var(--fg-rgb) / 0.04);
    box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px -8px rgba(0, 0, 0, 0.6);
    transition: box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }
  .hq-profile:hover { box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 20px -8px rgba(0, 0, 0, 0.7); }
  .hq-account[open] .hq-profile { box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.55), 0 0 0 3px rgb(var(--blue-rgb) / 0.14); }
  .hq-profile .hq-profile__avatar {
    width: 40px;
    height: 40px;
    font-size: 17px;
    font-weight: 650;
    color: var(--pearl-ink);
    background: var(--pearl-surface);
    box-shadow: var(--pearl-rim), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
  }
  .hq-account__button:hover .hq-profile__avatar, .hq-account[open] .hq-profile__avatar { color: var(--pearl-ink); box-shadow: var(--pearl-rim), 0 2px 6px -2px rgba(0, 0, 0, 0.5); transform: none; }
  .hq-profile__text { display: grid; min-width: 0; max-width: 180px; text-align: left; line-height: 1.2; }
  .hq-profile__name { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-profile__role { font-size: 11.5px; font-weight: 600; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-profile__chevron { width: 16px; height: 16px; color: var(--text-subtle); transition: transform var(--dur) var(--ease-out); }
  .hq-account[open] .hq-profile__chevron { transform: rotate(180deg); }

  /* Home: a compact header — the heading, then one row of controls. */
  .hq-header--home { display: grid; justify-content: start; gap: 14px; margin-bottom: 22px; }
  .hq-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
  .hq-controls .hq-select__button { height: 42px; min-width: 0; }
  .hq-controls .hq-update { gap: 10px; }
  /* Update: a pearl key with an orange accent. */
  .hq-controls .hq-update__button {
    height: 42px;
    padding: 0 16px 0 13px;
    border-radius: 12px;
    gap: 8px;
    font-size: 14px;
    color: var(--pearl-ink);
    background: var(--pearl-surface);
    box-shadow: var(--pearl-rim), inset 0 -2px 0 rgb(var(--orange-rgb) / 0.55), 0 1px 1px rgba(0, 0, 0, 0.4), 0 8px 18px -8px rgba(0, 0, 0, 0.75);
  }
  .hq-controls .hq-update__button .icon { width: 17px; height: 17px; color: var(--orange); }
  .hq-controls .hq-update__button:hover { background: var(--pearl-surface); box-shadow: var(--pearl-rim), inset 0 -2px 0 var(--orange), 0 0 0 3px rgb(var(--orange-rgb) / 0.16), 0 10px 22px -8px rgba(0, 0, 0, 0.8); }
  .hq-controls .hq-update__button:active { transform: translateY(1px) scale(var(--press-scale)); }
  .hq-controls .hq-update__button:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

  /* Narrow screens: the profile shows its avatar only and the metadata
     moves under the heading, so nothing in the bar competes for space. */
  @media (max-width: 767px) {
    .hq-topbar .hq-pagemeta { display: none; }
    .hq-pagemeta--inline { display: grid; }
    .hq-account__button.hq-profile { gap: 0; height: 44px; padding: 2px; }
    .hq-profile__text, .hq-profile__chevron { display: none; }
    .hq-controls .hq-select { flex: 1 1 40%; min-width: 0; }
    .hq-controls .hq-select__button { width: 100%; padding-inline: 12px 10px; }
    .hq-controls .hq-select__button > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .hq-controls .hq-update { flex: 1 1 100%; flex-wrap: wrap; }
    .hq-header--home { justify-content: stretch; }
  }
  @media (min-width: 768px) and (max-width: 1023px) {
    .hq-profile__text { max-width: 120px; }
  }
}

/* Receivables by age on pearl: the light 1-30 red keeps a defining rim and
   the deepest bucket drops its glow, so every step stays distinct. */
@layer materials {
  .hq-pearl :is(.hq-fin-age--1_30, .hq-donut-swatch--2, .hq-aging-swatch--2) { box-shadow: inset 0 0 0 1px #e11d48; }
  .hq-pearl :is(.hq-fin-age--over_90, .hq-donut-swatch--4) { box-shadow: none; }
  .hq-pearl .hq-donut__arc--2 { stroke: #fb7185; }
  .hq-pearl .hq-pay--overdue.hq-pay--age-1_30 { color: #be123c; background: rgb(253 164 175 / 0.35); box-shadow: inset 0 0 0 1px rgb(225 29 72 / 0.35); }
  .hq-pearl .hq-pay--overdue.hq-pay--age-31_60 { color: #be123c; }
  .hq-pearl .hq-pay--overdue.hq-pay--age-61_90 { color: #991b1b; }
}

/* ------------------------------------------------------------------ */
/* Page headers and Projects                                           */
/* ------------------------------------------------------------------ */
@layer materials {
  /* Every page heading stands alone: the heading, then one row of the
     page's own controls. Its description lives in the top bar beside the
     profile (ui/components/page_meta.html). */
  .hq-header--stack { display: grid; justify-content: start; gap: 14px; margin-bottom: 22px; }
  .hq-header--stack .hq-back { margin-bottom: -6px; }
  .hq-controls form { display: contents; }
  .hq-controls .hq-button { height: 42px; border-radius: 12px; }

  /* A page's primary action: Home's Update key, a pearl key with an
     orange accent. */
  .hq-key {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px 0 13px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    text-decoration: none;
    color: var(--pearl-ink);
    background: var(--pearl-surface);
    box-shadow: var(--pearl-rim), inset 0 -2px 0 rgb(var(--orange-rgb) / 0.55), 0 1px 1px rgba(0, 0, 0, 0.4), 0 8px 18px -8px rgba(0, 0, 0, 0.75);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }
  .hq-key .icon { width: 17px; height: 17px; color: var(--orange); }
  .hq-key:hover { color: var(--pearl-ink); box-shadow: var(--pearl-rim), inset 0 -2px 0 var(--orange), 0 0 0 3px rgb(var(--orange-rgb) / 0.16), 0 10px 22px -8px rgba(0, 0, 0, 0.8); }
  .hq-key:active { transform: translateY(1px) scale(var(--press-scale)); }
  .hq-key:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

  /* Desktop: the page description sits in the header beside the profile
     and scrolls away with the page; only the profile floats. */
  @media (min-width: 1024px) {
    .hq-topbar__actions {
      position: absolute;
      top: calc((var(--bar-h) - 48px) / 2);
      right: calc(var(--profile-w, 200px) + 12px);
      max-width: 46vw;
      min-height: 48px;
      padding: 0 14px;
    }
  }

  /* Project cards: one size, the whole card opens the project. */
  .hq-sitecards { align-items: stretch; grid-auto-rows: 1fr; }
  .hq-sitecard { position: relative; display: flex; flex-direction: column; gap: 14px; cursor: pointer; }
  .hq-sitecard__name { display: flex; align-items: center; min-width: 0; white-space: nowrap; overflow-wrap: normal; }
  .hq-sitecard__name .hq-sitecard__code { flex: none; vertical-align: 0; }
  .hq-sitecard__link { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .hq-sitecard__link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
  .hq-sitecard__link:focus-visible { outline: none; }
  .hq-sitecard:has(.hq-sitecard__link:focus-visible) { outline: 2px solid var(--blue-400); outline-offset: 3px; }
  .hq-sitecard:hover .hq-sitecard__name a { color: var(--blue-300); }
  .hq-sitecard__meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-sitecard__phase { min-width: 0; }
  .hq-sitecard__phase > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-sitecard__badges { position: relative; z-index: 2; display: flex; flex: none; align-items: center; gap: 6px; }
  .hq-sitecard__alert { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--warn); background: rgb(var(--warn-rgb) / 0.14); box-shadow: inset 0 0 0 1px rgb(var(--warn-rgb) / 0.3); }
  .hq-sitecard__alert .icon { width: 14px; height: 14px; }
  .hq-sitecard__count { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-subtle); }
  /* Room for three invoices on every card, listed or not. */
  .hq-sitecard__invoices { min-height: 176px; align-content: start; }
  .hq-sitecard__money .hq-invoice { padding-block: 8px; }
  /* Two lines for the note on every card, written or not. */
  .hq-sitecard__note { min-height: 3em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hq-sitecard__note:empty { border-left-color: transparent; }
  .hq-sitecard__foot { margin-top: auto; }
  .hq-sitecard__go { width: 18px; height: 18px; color: var(--text-subtle); transition: transform var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
  .hq-sitecard:hover .hq-sitecard__go { transform: translateX(3px); color: var(--text); }

  /* Project page */
  .hq-site-facts__wide { grid-column: 1 / -1; }
  .hq-site-month { margin: 26px 0 12px; padding-left: 2px; line-height: 1.3; }
  .hq-site-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; }
  .hq-site-stats dd { overflow: hidden; text-overflow: ellipsis; }
  @media (max-width: 599px) { .hq-site-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

  /* Four tiles, each opening its section beneath them. */
  .hq-site-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--gap); }
  .hq-site-tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 12px;
    align-items: center;
    min-height: 128px;
    padding: 18px 18px 16px;
    border: 0;
    border-radius: 22px;
    font: inherit;
    text-align: left;
    color: var(--text);
    background: var(--grain), var(--satin), rgb(var(--navy-rgb) / 0.55);
    box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07), var(--shadow-1);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }
  .hq-site-tile__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--blue-400); background: rgb(var(--blue-rgb) / 0.12); }
  .hq-site-tile__icon .icon { width: 18px; height: 18px; }
  .hq-site-tile__label { font-size: 13.5px; font-weight: 650; color: var(--text-muted); }
  .hq-site-tile__value { grid-column: 1 / -1; margin-top: 14px; font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .hq-site-tile__value--text { font-size: 20px; }
  .hq-site-tile__note { grid-column: 1 / -1; margin-top: 4px; font-size: 12.5px; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-site-tile--tesla .hq-site-tile__icon { color: var(--orange); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-site-tile:active { transform: translateY(1px) scale(var(--press-scale)); }
  .hq-site-tile:focus-visible { outline: 2px solid var(--blue-400); outline-offset: 3px; }
  .hq-site-tile[aria-expanded="true"] { box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.6), 0 0 0 3px rgb(var(--blue-rgb) / 0.14), var(--shadow-1); }
  .hq-site-tile--tesla[aria-expanded="true"] { box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.6), 0 0 0 3px rgb(var(--orange-rgb) / 0.14), var(--shadow-1); }
  @media (hover: hover) and (pointer: fine) {
    .hq-site-tile:hover { transform: var(--lift); box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 0 rgba(255, 255, 255, 0.1), var(--shadow-2); }
  }
  .hq-site-panel:not([hidden]) { display: grid; gap: var(--gap); scroll-margin-top: 90px; }
  .hq-site-panel > .hq-card { margin: 0; }
}

/* ------------------------------------------------------------------ */
/* Tasks (Aktivnosti)                                                  */
/* ------------------------------------------------------------------ */
@layer materials {
  /* Four tabs, each with its own dot: open blue, urgent red, due soon
     orange (attention), completed green. */
  .hq-task-tabs .hq-pulse__label::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    vertical-align: 1px;
    background: var(--blue-500);
  }
  .hq-task-tabs__item--urgent .hq-pulse__label::before { background: rgb(var(--red-rgb)); }
  .hq-task-tabs__item--soon .hq-pulse__label::before { background: var(--orange); }
  .hq-task-tabs__item--done .hq-pulse__label::before { background: var(--pearl-ink-green); }

  /* Filters: one satin bar, labelled fields of one height. */
  .hq-task-filter {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr) auto;
    align-items: end;
    gap: 12px 14px;
    margin-bottom: var(--gap);
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--grain), var(--satin), rgb(var(--navy-rgb) / 0.5);
    box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-1);
  }
  .hq-task-filter__field { display: grid; gap: 6px; min-width: 0; }
  .hq-task-filter__label { font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-task-filter__field select,
  .hq-task-filter .hq-search input[type="search"] { width: 100%; height: 42px; min-height: 42px; border-radius: 12px; font-size: 14px; }
  .hq-task-filter__field select { padding: 0 12px; }
  .hq-task-filter .hq-search { max-width: none; flex: none; }
  .hq-task-filter__actions { display: flex; align-items: center; gap: 12px; height: 42px; }
  .hq-task-filter__actions .hq-button { height: 42px; border-radius: 12px; }
  .hq-task-filter__reset { font-size: 13px; font-weight: 600; color: var(--text-subtle); text-decoration: none; white-space: nowrap; }
  .hq-task-filter__reset:hover { color: var(--text); }
  @media (max-width: 1099px) {
    .hq-task-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hq-task-filter__field--search { grid-column: 1 / -2; }
  }
  @media (max-width: 699px) {
    .hq-task-filter { grid-template-columns: 1fr 1fr; padding: 14px; }
    .hq-task-filter__field--search, .hq-task-filter__field--status { grid-column: 1 / -1; }
    .hq-task-filter__actions { grid-column: 1 / -1; }
  }

  /* The task form: four labelled groups on the pearl card. */
  .hq-task-form { max-width: 920px; }
  .hq-task-form .hq-form { gap: 4px; }
  .hq-task-form__group { min-width: 0; margin: 0; padding: 18px 0 20px; border: 0; border-top: 1px solid var(--line-soft); }
  .hq-task-form__group:first-of-type { padding-top: 0; border-top: 0; }
  .hq-task-form__legend { display: flex; align-items: center; gap: 8px; float: left; width: 100%; margin-bottom: 14px; padding: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-task-form__legend + * { clear: both; }
  .hq-task-form__legend .icon { width: 16px; height: 16px; color: var(--pearl-ink-blue); }
  .hq-task-form .hq-form__actions { padding-top: 18px; border-top: 1px solid var(--line-soft); }
  .hq-task-form .hq-form__actions .hq-button { height: 44px; padding-inline: 18px; border-radius: 12px; }
  .hq-task-form textarea { min-height: 96px; }

  /* Date fields: the application's own calendar (datepicker.js). */
  .hq-date { position: relative; }
  .hq-form .hq-date .hq-date__input { padding-right: 48px; font-variant-numeric: tabular-nums; }
  .hq-date__button {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    color: var(--pearl-ink-blue);
    background: rgb(var(--blue-rgb) / 0.10);
    transform: translateY(-50%);
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out);
  }
  .hq-date__button .icon { width: 18px; height: 18px; }
  .hq-date__button:hover, .hq-date__button[aria-expanded="true"] { background: rgb(var(--blue-rgb) / 0.18); }
  .hq-date__button:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }
  .hq-datepop {
    position: fixed;
    z-index: 90;
    top: 0;
    left: 0;
    width: 312px;
    max-width: calc(100vw - 32px);
    padding: 14px;
    border-radius: 18px;
    color: var(--pearl-ink);
    background: var(--pearl-grain-faint), var(--pearl-surface), var(--pearl-solid);
    box-shadow: var(--pearl-rim), 0 2px 4px rgba(0, 0, 0, 0.25), 0 30px 60px -20px rgba(0, 0, 0, 0.75);
    animation: hq-datepop-in var(--dur-fast) var(--ease-out);
  }
  .hq-datepop[hidden] { display: none; }
  @keyframes hq-datepop-in { from { opacity: 0; transform: translateY(-4px); } }
  @media (prefers-reduced-motion: reduce) { .hq-datepop { animation: none; } }
  .hq-datepop__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
  .hq-datepop__title { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
  .hq-datepop__nav {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    color: var(--pearl-ink-muted);
    background: rgb(var(--navy-rgb) / 0.05);
    cursor: pointer;
  }
  .hq-datepop__nav[data-step="-1"] .icon { transform: rotate(180deg); }
  .hq-datepop__nav .icon { width: 16px; height: 16px; }
  .hq-datepop__nav:hover { color: var(--pearl-ink); background: rgb(var(--navy-rgb) / 0.10); }
  .hq-datepop__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
  .hq-datepop__weekday { padding: 4px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; color: var(--pearl-ink-subtle); }
  .hq-datepop__day {
    height: 36px;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--pearl-ink);
    background: transparent;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out);
  }
  .hq-datepop__day:hover { background: rgb(var(--navy-rgb) / 0.07); }
  .hq-datepop__day.is-outside { font-weight: 500; color: rgb(var(--navy-rgb) / 0.32); }
  .hq-datepop__day.is-today { color: var(--pearl-ink-orange); box-shadow: inset 0 0 0 1.5px var(--orange); }
  .hq-datepop__day.is-selected,
  .hq-datepop__day.is-selected:hover { color: var(--pearl); background: linear-gradient(180deg, #1b2b42, var(--navy-900)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 10px -4px rgb(var(--navy-rgb) / 0.7); }
  .hq-datepop__day:focus-visible, .hq-datepop__action:focus-visible, .hq-datepop__nav:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }
  .hq-datepop__foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgb(var(--navy-rgb) / 0.08); }
  .hq-datepop__action { height: 32px; padding: 0 12px; border: 0; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 650; color: var(--pearl-ink-muted); background: transparent; cursor: pointer; }
  .hq-datepop__action:hover { color: var(--pearl-ink); background: rgb(var(--navy-rgb) / 0.06); }
  .hq-datepop__action--today { color: var(--pearl-ink-blue); }
  .hq-form-card:has(.hq-datepop:not([hidden])) { z-index: 5; overflow: visible; }

  /* A task's description: a pearl panel, slightly larger text, so it reads
     before the facts around it. */
  .hq-task-description .hq-subhead { margin-bottom: 10px; }
  .hq-task-description .hq-task-description__body { margin: 0; padding: 16px 18px; border-radius: 14px; font-size: 16px; line-height: 1.6; font-weight: 500; color: var(--text); background: var(--pearl-grain-faint), var(--pearl-surface); box-shadow: var(--pearl-shadow); overflow-wrap: anywhere; }

  /* A task's notes, in the task card, the latest first. */
  .hq-task-notes { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
  .hq-task-notes .hq-subhead { display: flex; align-items: center; gap: 8px; }
  .hq-task-notes__count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--text-muted); background: rgb(var(--fg-rgb) / 0.08); }
  .hq-task-notes__list { display: grid; gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
  .hq-task-notes__item { padding: 12px 14px; border-left: 3px solid var(--blue-500); border-radius: 14px; background: rgb(var(--fg-rgb) / 0.04); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-task-notes__text { margin: 0; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
  .hq-task-notes__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0 0; font-size: 12px; color: var(--text-subtle); }
  .hq-task-notes__meta .hq-pill { font-size: 11px; }
  .hq-task-notes__empty { margin: 8px 0 0; font-size: 13.5px; color: var(--text-subtle); }
  .hq-task-update textarea { min-height: 112px; }
}

/* ------------------------------------------------------------------ */
/* Employees (Zaposleni)                                               */
/* ------------------------------------------------------------------ */
@layer materials {
  .hq-emp-payroll { margin-top: var(--gap); }

  /* Directory: days and hours share one small orange frame, its left
     half in the Days cell and its right half in the Hours cell. */
  .hq-emp-table th.hq-emp-work__head--days { padding-right: 12px; }
  .hq-emp-table th.hq-emp-work__head--hours { padding-left: 12px; text-align: left; }
  .hq-emp-table td.hq-emp-work--days { padding-right: 0; }
  .hq-emp-table td.hq-emp-work--hours, .hq-emp-table tbody td.hq-emp-work--hours.is-num { padding-left: 0; text-align: left; }
  .hq-emp-work__box {
    --frame: rgb(var(--orange-rgb) / 0.5);
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    font-size: 13.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, rgb(var(--orange-rgb) / 0.16), rgb(var(--orange-rgb) / 0.06));
  }
  .hq-emp-work--days .hq-emp-work__box { justify-content: flex-end; min-width: 50px; border-radius: 10px 0 0 10px; box-shadow: inset 1px 0 0 var(--frame), inset 0 1px 0 var(--frame), inset 0 -1px 0 var(--frame), inset 0 2px 0 rgba(255, 255, 255, 0.05); }
  .hq-emp-work--hours .hq-emp-work__box { min-width: 72px; border-radius: 0 10px 10px 0; font-weight: 600; color: var(--text-muted); box-shadow: inset -1px 0 0 var(--frame), inset 0 1px 0 var(--frame), inset 0 -1px 0 var(--frame), inset 0 2px 0 rgba(255, 255, 255, 0.05); }
  /* A short divider between the two figures, not a full-height seam. */
  .hq-emp-work--hours .hq-emp-work__box::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 1px; background: rgb(var(--orange-rgb) / 0.4); }
  tr:hover .hq-emp-work__box { --frame: rgb(var(--orange-rgb) / 0.75); }
  .hq-emp-work__box small { margin-left: 2px; color: var(--text-subtle); }
  @media (max-width: 639px) {
    .hq-emp-table td.hq-emp-work--days, .hq-emp-table td.hq-emp-work--hours { padding: 0; }
    .hq-emp-work .hq-emp-work__box { justify-content: flex-start; min-width: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--frame); }
    .hq-emp-work--hours .hq-emp-work__box::before { display: none; }
  }

  /* Employee page: the person first. */
  .hq-emp-hero__main { display: flex; align-items: center; gap: 18px; min-width: 0; }
  .hq-emp-hero__avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--blue-300);
    background: rgb(var(--blue-rgb) / 0.12);
    box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .hq-emp-hero__avatar .icon { width: 26px; height: 26px; }
  .hq-emp-hero__body { display: grid; gap: 10px; min-width: 0; }
  .hq-emp-hero__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .hq-emp-hero__tags .hq-sitecard__code { margin: 0; padding: 4px 9px; vertical-align: 0; }
  .hq-emp-hero__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text-muted);
    text-decoration: none;
    background: rgb(var(--fg-rgb) / 0.05);
    box-shadow: inset 0 0 0 1px var(--line-soft);
  }
  .hq-emp-hero__tag .icon { width: 14px; height: 14px; color: var(--text-subtle); }
  a.hq-emp-hero__tag:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
  @media (max-width: 639px) {
    .hq-emp-hero__main { align-items: flex-start; gap: 14px; }
    .hq-emp-hero__avatar { width: 48px; height: 48px; border-radius: 15px; font-size: 17px; }
  }

  /* Basic information and work assignment: label and value on one quiet
     row, no boxes. */
  .hq-facts.hq-emp-facts, .hq-facts.hq-emp-assign { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; margin-bottom: 16px; }
  .hq-facts.hq-emp-assign { grid-template-columns: minmax(0, 1fr); }
  .hq-emp-facts > div, .hq-emp-assign > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 2px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .hq-emp-facts dt, .hq-emp-assign dt { flex: 1 1 auto; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--text-subtle); }
  .hq-emp-facts dd, .hq-emp-assign dd { flex: 0 1 auto; max-width: 65%; margin: 0; text-align: right; font-weight: 650; overflow-wrap: break-word; }
  .hq-emp-facts dd small, .hq-emp-assign dd small { font-size: 11.5px; font-weight: 500; }
  .hq-emp-facts > .hq-emp-facts__wide, .hq-emp-assign > .hq-emp-facts__wide { display: grid; gap: 6px; }
  .hq-emp-facts__wide dd { max-width: none; text-align: left; font-weight: 600; line-height: 1.6; }
  .hq-emp-assign .hq-chip { padding: 0 12px; }
  @media (max-width: 639px) { .hq-facts.hq-emp-facts { grid-template-columns: minmax(0, 1fr); } }

  /* Attendance: the six figures as one calm row. */
  .hq-emp-stats { gap: 0; padding: 0; overflow: hidden; }
  .hq-emp-stats > div { padding: 14px 16px; border-left: 1px solid var(--line-soft); }
  .hq-emp-stats > div:first-child { border-left: 0; }
  .hq-emp-stats dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  @media (max-width: 639px) {
    .hq-emp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hq-emp-stats > div { border-left: 0; border-top: 1px solid var(--line-soft); }
    .hq-emp-stats > div:nth-child(-n+2) { border-top: 0; }
    .hq-emp-stats > div:nth-child(even) { border-left: 1px solid var(--line-soft); }
  }

  /* Month by month: the cost's four parts as a compact two-by-two. */
  .hq-months-table .hq-emp-cost__parts { grid-template-columns: auto auto; justify-content: end; gap: 1px 12px; margin-top: 3px; }

  /* Team history and changes: what on the left, when on the right. */
  .hq-emp-history .hq-history__item { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; padding: 11px 0; }
  .hq-emp-history .hq-history__item:first-child { padding-top: 0; }
  .hq-emp-history .hq-history__what { flex: 1 1 220px; min-width: 0; }
  .hq-emp-history .hq-history__when { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }

  /* ------------------------------------------------------------------ */
  /* Finance (Finansije)                                                 */
  /* ------------------------------------------------------------------ */
  /* One colour system for every Finance chart: money flows by meaning,
     categories by position (1-8), receivables by age. Orange stays out
     (TESLA and attention only); red is for a loss and late money. */
  :root {
    --tone-revenue: var(--blue-500);
    --tone-invoiced: var(--blue-500);
    --tone-collected: var(--green);
    --tone-open: #8fb8ff;
    --tone-cost: var(--pearl);
    --tone-profit: var(--green);
    --tone-loss: var(--error-text);
    --tone-7: rgb(var(--blue-rgb) / 0.45);
    --tone-8: rgb(var(--pearl-rgb) / 0.42);
  }
  .hq-pearl { --tone-cost: #5d6b7e; --tone-open: #7aa6f0; --tone-7: rgb(var(--navy-rgb) / 0.35); --tone-8: rgb(var(--navy-rgb) / 0.16); }
  .hq-tone--revenue, .hq-tone--invoiced { --tone: var(--tone-revenue); }
  .hq-tone--collected { --tone: var(--tone-collected); }
  .hq-tone--open { --tone: var(--tone-open); }
  .hq-tone--cost { --tone: var(--tone-cost); }
  .hq-tone--profit { --tone: var(--tone-profit); }
  .hq-tone--loss { --tone: var(--tone-loss); }
  .hq-tone--muted { --tone: var(--text-subtle); }
  .hq-tone--1 { --tone: var(--series-1); }
  .hq-tone--2 { --tone: var(--series-2); }
  .hq-tone--3 { --tone: var(--series-3); }
  .hq-tone--4 { --tone: var(--series-4); }
  .hq-tone--5 { --tone: var(--series-5); }
  .hq-tone--6 { --tone: var(--series-6); }
  .hq-tone--7 { --tone: var(--tone-7); }
  .hq-tone--8 { --tone: var(--tone-8); }
  .hq-tone--age1 { --tone: var(--age-1); }
  .hq-tone--age2 { --tone: var(--age-2); }
  .hq-tone--age3 { --tone: var(--age-3); }
  .hq-tone--age4 { --tone: var(--age-4); }
  rect[class*="hq-tone--"] { fill: var(--tone); }
  circle[class*="hq-tone--"] { stroke: var(--tone); }
  .hq-swatch[class*="hq-tone--"], span[class*="hq-tone--"]:not(.hq-swatch) { background: var(--tone); }
  .hq-pearl .hq-swatch.hq-tone--age1 { box-shadow: inset 0 0 0 1px #e11d48; }

  @media (min-width: 720px) { .hq-grid > .hq-span-6 { grid-column: span 6; } }

  /* Header: the month and the tab's own choices under the title. */
  .hq-fin-tabs { margin-bottom: 18px; }

  /* Charts */
  .hq-fin-bar { opacity: 0.9; transition: opacity var(--dur) var(--ease-out); }
  .hq-fin-col:hover .hq-fin-bar { opacity: 1; }
  .hq-fin-chart--stacked .hq-fin-bar { stroke: rgb(var(--navy-rgb) / 0.55); stroke-width: 0.6; }
  .hq-pearl .hq-fin-chart--stacked .hq-fin-bar { stroke: var(--pearl-solid); }
  .hq-fin-zero { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
  .hq-fin-chart .hq-chart__table { margin-top: 6px; }
  .hq-fin-chart .hq-chart__table .hq-table-wrap { margin-top: 8px; overflow-x: auto; }

  /* Donut with its legend */
  .hq-fin-mixbox { container-type: inline-size; }
  .hq-fin-mix { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 22px; }
  .hq-fin-donut { width: clamp(132px, 15vw, 172px); }
  .hq-fin-donut .hq-donut__center { inset: 15%; }
  .hq-fin-donut .hq-donut__label { font-size: 11px; line-height: 1.2; text-align: center; }
  .hq-fin-donut .hq-donut__value { font-size: clamp(14px, 1.1vw + 4px, 18px); }
  .hq-fin-mix__legend { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; min-width: 0; }
  .hq-fin-mix__row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 9px;
    font-size: 13px;
    color: inherit;
    text-decoration: none;
  }
  a.hq-fin-mix__row:hover { background: var(--hover-tint); }
  .hq-fin-mix__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-weight: 600; }
  .hq-fin-mix__label small { font-weight: 500; color: var(--text-subtle); }
  .hq-fin-mix__share { font-size: 12px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-fin-mix__row strong { font-family: var(--font-display); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
  @container (max-width: 420px) {
    .hq-fin-mix { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .hq-fin-mix__legend { width: 100%; }
  }

  /* Horizontal bars */
  .hq-fin-meters { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
  .hq-fin-meter { display: grid; gap: 6px; min-width: 0; break-inside: avoid; }
  .hq-fin-meter__line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; font-size: 13.5px; }
  .hq-fin-meter__label { min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hq-fin-meter__value { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .hq-fin-meter__track { display: block; height: 9px; border-radius: 9px; background: rgb(var(--fg-rgb) / 0.06); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); overflow: hidden; }
  .hq-pearl .hq-fin-meter__track { background: rgb(var(--navy-rgb) / 0.08); box-shadow: inset 0 1px 1px rgb(var(--navy-rgb) / 0.12); }
  .hq-fin-meter__bar { display: flex; width: var(--value); height: 100%; border-radius: inherit; background: var(--tone, var(--blue-500)); overflow: hidden; transform-origin: left; }
  .hq-fin-meter__bar--split { gap: 2px; background: none; }
  .hq-fin-meter__bar--split > span { display: block; height: 100%; min-width: 2px; }
  .hq-fin-meter__meta { margin: 0; font-size: 12px; color: var(--text-subtle); }
  @media (prefers-reduced-motion: no-preference) {
    .hq-motion .is-revealed .hq-fin-meter__bar { animation: hq-grow-x 1300ms var(--ease-out) both; animation-delay: calc(320ms + var(--i, 0) * 80ms); }
  }
  .hq-fin-columns .hq-fin-meters { display: block; columns: 2 300px; column-gap: 44px; }
  .hq-fin-columns .hq-fin-meter { margin-bottom: 16px; }

  /* Small tiles of single figures */
  .hq-fin-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
  .hq-fin-tiles > div { display: grid; gap: 6px; padding: 14px; border-radius: 14px; background: rgb(var(--fg-rgb) / 0.035); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-fin-tiles dt { font-size: 12px; font-weight: 600; color: var(--text-subtle); }
  .hq-fin-tiles dd { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .hq-fin-tiles dd small { font-size: 12px; font-weight: 500; color: var(--text-subtle); }
  .hq-fin-tiles--wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

  /* The current month: one rounded chip in the corner, four figures. */
  .hq-fin-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text);
    background: rgb(var(--fg-rgb) / 0.07);
    box-shadow: inset 0 0 0 1px var(--line);
    white-space: nowrap;
  }
  .hq-fin-chip .icon { width: 14px; height: 14px; color: var(--blue-300); }
  .hq-fin-now .hq-card__head .hq-info { margin-left: 4px; }
  .hq-fin-now__kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hq-fin-now__kpis .hq-pulse__value { font-size: clamp(22px, 1.4vw + 8px, 32px); }
  .hq-fin-now__kpis .hq-pulse__item { gap: 10px; padding-block: 20px; }
  @media (max-width: 899px) { .hq-fin-now__kpis { grid-template-columns: 1fr 1fr; } }

  /* Revenue by type: three parts side by side. */
  .hq-fin-kinds__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.25fr) minmax(0, 0.85fr); gap: 0; }
  .hq-fin-kinds__part { min-width: 0; padding: 0 24px; border-left: 1px solid var(--line-soft); }
  .hq-fin-kinds__part:first-child { padding-left: 0; border-left: 0; }
  .hq-fin-kinds__part:last-child { padding-right: 0; }
  .hq-fin-kinds__part > .hq-subhead:first-child { margin-top: 0; margin-bottom: 14px; }
  @media (max-width: 1199px) {
    .hq-fin-kinds__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 24px; }
    .hq-fin-kinds__part:last-child { grid-column: 1 / -1; padding: 22px 0 0; border-left: 0; border-top: 1px solid var(--line-soft); }
    .hq-fin-kinds__part:last-child .hq-fin-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
  @media (max-width: 767px) {
    .hq-fin-kinds__grid { grid-template-columns: minmax(0, 1fr); }
    .hq-fin-kinds__part { padding: 22px 0 0; border-left: 0; border-top: 1px solid var(--line-soft); }
    .hq-fin-kinds__part:first-child { padding-top: 0; border-top: 0; }
    .hq-fin-kinds__part:last-child .hq-fin-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  /* Days late as a quiet red count beside the amount. */
  .hq-fin-late { flex: none; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; color: var(--error-text); background: rgb(220 38 38 / 0.12); font-variant-numeric: tabular-nums; }
  .hq-debtor .hq-fin-late { margin-left: auto; margin-right: 14px; }

  /* Paused projects: a calm pearl outline with a pause mark, never the
     attention orange. */
  .hq-pill--site-paused { color: var(--text-muted); background: rgb(var(--pearl-rgb) / 0.08); box-shadow: inset 0 0 0 1px rgb(var(--pearl-rgb) / 0.28); }
  .hq-pill--site-paused::before { content: ""; width: 6px; height: 7px; border-radius: 0; background: none; box-shadow: none; border-inline: 2px solid currentColor; }
  .hq-pearl .hq-pill--site-paused { color: var(--pearl-ink-muted); background: rgb(var(--navy-rgb) / 0.05); box-shadow: inset 0 0 0 1px rgb(var(--navy-rgb) / 0.2); }

  /* Filter bars (Receivables, Costs): labelled fields in one wrapping row. */
  .hq-fin-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 18px; padding: 16px; border-radius: 16px; background: rgb(var(--navy-rgb) / 0.35); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--line-soft); }
  .hq-fin-field { display: grid; gap: 6px; flex: 1 1 150px; min-width: 0; }
  .hq-fin-field--wide { flex: 2 1 300px; }
  .hq-fin-field > span { font-size: 11.5px; font-weight: 650; letter-spacing: 0.02em; color: var(--text-subtle); }
  .hq-fin-field :is(select, input) { width: 100%; min-height: 40px; }
  .hq-fin-filter__actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
  .hq-fin-period { display: flex; align-items: center; gap: 8px; }
  .hq-fin-period input { flex: 1 1 0; min-width: 0; }

  .hq-pearl .hq-fin-filter { background: rgb(var(--navy-rgb) / 0.05); box-shadow: inset 0 0 0 1px var(--line); }
  .hq-fin-strip--flush { margin: 18px 0 0; }

  /* A row of KPIs inside a card (selection, scope). */
  .hq-fin-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 18px; }
  .hq-fin-strip > div { display: grid; gap: 6px; padding: 14px 16px; border-radius: 14px; background: rgb(var(--fg-rgb) / 0.035); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-fin-strip dt { font-size: 12px; font-weight: 600; color: var(--text-subtle); }
  .hq-fin-strip dd { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .hq-fin-strip dd small { display: block; margin-top: 2px; font-family: var(--font-sans, inherit); font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--text-subtle); }

  /* Projects tab: status groups. */
  .hq-fin-table tr.hq-fin-group th { padding-top: 20px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); background: none; }
  .hq-fin-table tbody tr.hq-fin-group:first-child th { padding-top: 6px; }

  /* Costs: payroll as its own section. */
  .hq-fin-payroll { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 28px; align-items: start; }
  @media (max-width: 1023px) { .hq-fin-payroll { grid-template-columns: minmax(0, 1fr); } }

  /* Year: the KPI row of the year and the annual comparison charts. */
  .hq-fin-year-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hq-fin-year-kpis .hq-pulse__value { font-size: clamp(19px, 1.1vw + 8px, 27px); }
  @media (max-width: 899px) { .hq-fin-year-kpis { grid-template-columns: 1fr 1fr; } }
  .hq-fin-annual { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; margin-bottom: 8px; }
  .hq-fin-annual .hq-subhead { margin: 0 0 8px; }
}

/* Page titles: one type on every page and sub-page. ETC HQ pages (.hq-title),
   the Project Radar and System pages (.page-title) and the TESLA headers
   (.hq-tc__title) share Sora 600 at the same size, tracking and line height. */
@layer materials {
  .hq-title, .page-title, .hq-tc__title {
    font-family: var(--font-display);
    font-size: clamp(26px, 2.4vw + 12px, 36px);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.1;
    text-transform: none;
  }
  .hq-tc__title span:last-child { font-weight: 600; letter-spacing: -0.035em; }
}

/* ------------------------------------------------------------------ */
/* TESLA page (V3): chat, conversations, research and reports          */
/* ------------------------------------------------------------------ */
@layer materials {
  /* The heading is .hq-title, as on every page; the tabs sit beside it. */
  .hq-tc__head { align-items: center; }
  .hq-tc__head .hq-title { margin: 0; }
  .hq-tc__heading { display: flex; align-items: center; gap: 14px; }

  /* Danger button, for removing conversations. */
  .hq-button--danger { border: 0; cursor: pointer; color: #fff; background: rgb(var(--red-rgb) / 0.82); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 14px -6px rgb(var(--red-rgb) / 0.7); }
  .hq-button--danger:hover { background: rgb(var(--red-rgb) / 0.95); }
  .hq-button--danger .icon { width: 15px; height: 15px; }

  /* ── Chat ─────────────────────────────────────────────────────────── */
  .hq-ask { display: grid; gap: 0; padding: 0; }
  .hq-ask:has(.hq-ask__manager:not([hidden])) { z-index: 7; }
  .hq-ask__head { position: relative; z-index: 4; display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
  .hq-ask__who { display: flex; align-items: center; gap: 14px; min-width: 0; }
  .hq-ask__face { position: relative; flex: none; display: inline-grid; }
  .hq-portrait--ask { width: 56px; height: 56px; }
  .hq-ask__dot { position: absolute; right: 1px; bottom: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--navy-850), 0 0 10px rgb(var(--green-rgb) / 0.7); }
  .hq-ask__dot.is-off { background: rgb(var(--fg-rgb) / 0.35); box-shadow: 0 0 0 3px var(--navy-850); }
  .hq-ask__name { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: 0.04em; }
  .hq-ask__tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .hq-ask__toolgroup { display: flex; align-items: center; gap: 8px; }
  .hq-ask__toolgroup[hidden] { display: none; }
  .hq-ask__tool {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 12px;
    border: 0; border-radius: 12px; font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer;
    color: var(--text); background: var(--glass-1); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 var(--highlight);
    transition: box-shadow var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
  }
  .hq-ask__tool .icon { width: 17px; height: 17px; color: var(--tesla-text); }
  .hq-ask__tool:hover, .hq-ask__tool[aria-expanded="true"] { background: var(--glass-2); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.45), inset 0 1px 0 var(--highlight); }
  .hq-ask__tool:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
  .hq-ask__tool.hq-key { height: 40px; color: var(--pearl-ink); background: var(--pearl-surface); box-shadow: var(--pearl-rim), inset 0 -2px 0 rgb(var(--orange-rgb) / 0.55), 0 1px 1px rgba(0, 0, 0, 0.4), 0 8px 18px -8px rgba(0, 0, 0, 0.75); }
  .hq-ask__tool.hq-key .icon { color: var(--orange); }
  .hq-ask__count { min-width: 20px; padding: 1px 6px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-align: center; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.14); }
  .hq-ask__count:empty { display: none; }
  .hq-ask__head .hq-info__button { width: 34px; height: 34px; box-shadow: inset 0 0 0 1px var(--line); }
  .hq-ask__head .hq-info__panel { right: 0; }

  /* Conversation manager: open, select, arrange and remove. */
  .hq-ask__manager {
    position: absolute; top: calc(100% - 6px); right: 18px; z-index: 30;
    display: grid; gap: 10px; width: min(460px, calc(100vw - 32px)); padding: 14px;
    border-radius: var(--radius); background: var(--glass-3); box-shadow: var(--shadow-3), inset 0 0 0 1px var(--line-strong);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(140%); backdrop-filter: blur(var(--blur)) saturate(140%);
  }
  .hq-ask__manager[hidden] { display: none; }
  .hq-ask__manager-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px; }
  .hq-ask__manager-title { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; }
  .hq-ask__check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
  .hq-ask__manager input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--orange); cursor: pointer; }
  .hq-ask__convs { display: grid; gap: 4px; max-height: min(52vh, 420px); margin: 0; padding: 2px; list-style: none; overflow-y: auto; overscroll-behavior: contain; }
  .hq-ask__conv {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
    padding: 6px 6px 6px 4px; border-radius: 12px; background: rgb(var(--fg-rgb) / 0.03); box-shadow: inset 0 0 0 1px var(--line-soft);
    transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  }
  .hq-ask__conv:hover { background: rgb(var(--fg-rgb) / 0.06); }
  .hq-ask__conv.is-current { box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.5); background: rgb(var(--orange-rgb) / 0.07); }
  .hq-ask__conv:has(input:checked) { background: rgb(var(--blue-rgb) / 0.12); }
  .hq-ask__conv.is-dragging { opacity: 0.45; }
  .hq-ask__conv-grip { display: inline-grid; place-items: center; width: 20px; height: 32px; color: var(--text-subtle); cursor: grab; }
  .hq-ask__conv-grip .icon { width: 18px; height: 18px; stroke-width: 3; }
  .hq-ask__conv-open { display: grid; gap: 1px; min-width: 0; padding: 4px 6px; border: 0; border-radius: 8px; font: inherit; text-align: left; color: var(--text); background: none; cursor: pointer; }
  .hq-ask__conv-open:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
  .hq-ask__conv-title { overflow: hidden; font-size: 13.5px; font-weight: 600; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
  .hq-ask__conv-date { font-size: 11.5px; color: var(--text-subtle); }
  .hq-ask__conv-move { display: inline-flex; gap: 2px; }
  .hq-ask__conv-arrow { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; color: var(--text-muted); background: none; cursor: pointer; }
  .hq-ask__conv-arrow .icon { width: 16px; height: 16px; }
  .hq-ask__conv-arrow:hover:not(:disabled) { color: var(--text); background: rgb(var(--fg-rgb) / 0.08); }
  .hq-ask__conv-arrow:disabled { opacity: 0.25; cursor: default; }
  .hq-ask__manager-empty, .hq-ask__manager-hint { margin: 0; padding: 0 4px; font-size: 12px; color: var(--text-subtle); }
  .hq-ask__manager-empty { padding: 10px 4px; font-size: 13px; }
  .hq-ask__manager-empty[hidden] { display: none; }
  .hq-ask__manager-foot { display: grid; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .hq-ask__bulk, .hq-ask__confirm-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .hq-ask__bulk[hidden], .hq-ask__confirm[hidden], .hq-ask__manager-error[hidden] { display: none; }
  .hq-ask__bulk-count { font-size: 13px; font-weight: 650; }
  .hq-ask__confirm { display: grid; gap: 10px; padding: 12px; border-radius: 12px; font-size: 13px; color: var(--text); background: rgb(var(--red-rgb) / 0.1); box-shadow: inset 0 0 0 1px rgb(var(--red-rgb) / 0.35); }
  .hq-ask__confirm p { margin: 0; }
  .hq-ask__confirm-actions { justify-content: flex-start; }
  .hq-ask__manager-error { margin: 0; font-size: 12.5px; color: var(--error-text); }

  /* Conversation and composer. */
  .hq-ask__stage { position: relative; display: grid; min-height: 300px; padding: 18px 22px 8px; }
  .hq-ask__stage .hq-ask__log { max-height: min(62vh, 560px); margin: 0; }
  .hq-ask__blank { display: grid; place-content: center; gap: 6px; padding: 30px 12px; text-align: center; }
  .hq-ask__blank[hidden] { display: none; }
  .hq-ask__blank-title { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
  .hq-ask__blank-text { margin: 0; font-size: 13.5px; color: var(--text-subtle); }
  .hq-ask__form { position: relative; display: flex; align-items: flex-end; gap: 10px; margin: 8px 18px 18px; padding: 8px 8px 8px 16px; border-radius: 18px; background: rgb(var(--navy-rgb) / 0.55); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 0 0 1px var(--line); transition: box-shadow var(--dur-fast) var(--ease-out); }
  .hq-ask__form:focus-within { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.55), 0 0 0 3px rgb(var(--orange-rgb) / 0.12); }
  .hq-ask__form textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 180px; padding: 9px 0; border: 0; border-radius: 0; font: inherit; font-size: 15.5px; line-height: 1.45; color: var(--text); background: none; box-shadow: none; resize: none; outline: none; }
  .hq-ask__form textarea::placeholder { color: var(--text-subtle); }
  /* The form carries the focus ring; app.css (unlayered) would add a second one around the field. */
  .hq-ask__form textarea:focus { border-color: transparent !important; box-shadow: none !important; }
  .hq-ask__send { flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 13px; color: #fff; cursor: pointer; background: linear-gradient(180deg, #ff8233, var(--orange)); box-shadow: 0 6px 14px -4px rgb(var(--orange-rgb) / 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25); transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast); }
  .hq-ask__send .icon { width: 18px; height: 18px; }
  .hq-ask__send:hover:not(:disabled) { transform: translateY(-1px); }
  .hq-ask__send:disabled { opacity: 0.35; cursor: default; box-shadow: none; }
  .hq-ask__send:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
  @media (max-width: 639px) {
    .hq-ask__head { flex-wrap: wrap; padding: 16px; }
    .hq-ask__tool > span:not(.hq-ask__count) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .hq-ask__tool { padding: 0 11px; }
    .hq-portrait--ask { width: 46px; height: 46px; }
    .hq-ask__stage { padding: 14px 16px 6px; min-height: 240px; }
    .hq-ask__form { margin: 6px 12px 12px; }
    .hq-ask__manager { right: 8px; }
  }
}

@layer materials {
  /* Section heads: the title with its "i" (and a state) on one line. */
  .hq-tc-section__head--row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
  .hq-tc-info .hq-info__button { box-shadow: inset 0 0 0 1px var(--line); }
  .hq-card__head .hq-tc-info + .hq-card__link { margin-left: auto; }
  .hq-tc-soon { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.08em; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.4); }
  .hq-tc-pill--error { color: var(--error-text); background: rgb(var(--red-rgb) / 0.14); box-shadow: none; }
  .hq-tc-score { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 7px; border-radius: 8px; font-family: var(--font-display); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); background: rgb(var(--fg-rgb) / 0.07); box-shadow: inset 0 0 0 1px var(--line); }

  /* ── Research: the ETC Project Radar card ─────────────────────────── */
  .hq-tc-run__main { display: grid; align-content: start; gap: 18px; min-width: 0; }
  .hq-tc-run__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .hq-tc-run .hq-tc-section__title { margin-top: -10px; }
  .hq-tc-last { display: flex; flex-wrap: wrap; gap: 10px; }
  .hq-tc-last__item { display: grid; gap: 4px; min-width: 150px; padding: 10px 14px; border-radius: 14px; background: rgb(var(--navy-rgb) / 0.45); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-tc-last__label { font-size: 11.5px; font-weight: 650; color: var(--text-subtle); }
  .hq-tc-last__value { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
  .hq-tc-last__value small { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
  .hq-tc-last__item .hq-tc-pill { justify-self: start; margin-top: 1px; }
  .hq-tc-progress { display: flex; align-items: center; gap: 12px; }
  .hq-tc-progress__bar { position: relative; flex: 1; height: 8px; border-radius: 8px; background: rgb(var(--fg-rgb) / 0.08); overflow: hidden; }
  .hq-tc-progress__bar > span { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, #ff8233, var(--orange)); box-shadow: 0 0 12px rgb(var(--orange-rgb) / 0.6); }
  .hq-tc-progress__bar.is-failed > span { background: rgb(var(--red-rgb) / 0.75); box-shadow: none; }
  .hq-tc-progress__text { flex: none; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-muted); }
  .hq-tc-progress--large .hq-tc-progress__bar { height: 10px; }
  .hq-tc-top3 { display: grid; gap: 8px; }
  .hq-tc-top3__label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-tc-top3__list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
  .hq-tc-top3__item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: inherit; text-decoration: none; background: rgb(var(--fg-rgb) / 0.035); box-shadow: inset 0 0 0 1px var(--line-soft); transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
  .hq-tc-top3__item:hover { background: rgb(var(--fg-rgb) / 0.07); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.4); }
  .hq-tc-top3__rank, .hq-tc-opp__rank { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 800; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.14); }
  .hq-tc-top3__main { display: grid; flex: 1; min-width: 0; }
  .hq-tc-top3__name { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .hq-tc-top3__meta { overflow: hidden; font-size: 12px; color: var(--text-subtle); text-overflow: ellipsis; white-space: nowrap; }
  .hq-tc-run__actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .hq-tc-run__actions form { display: contents; }
  .hq-tc-run__actions .hq-key { border: 0; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
  .hq-tc-run__actions .hq-key:disabled { opacity: 0.5; cursor: not-allowed; }
  .hq-tc-run__actions .hq-ask__tool { height: 42px; text-decoration: none; }
  .hq-tc-run__note { margin: -6px 0 0; font-size: 12.5px; color: var(--text-subtle); }
  .hq-tc-run__tesla { margin-bottom: -24px; }

  /* Indicators that open their lists. */
  .hq-tc-kpis .hq-pulse__item { position: relative; transition: background-color var(--dur-fast) var(--ease-out); }
  .hq-tc-kpis .hq-pulse__item:hover { background: rgb(var(--fg-rgb) / 0.04); }
  .hq-tc-kpis .hq-pulse__label { display: inline-flex; align-items: center; gap: 7px; }
  .hq-tc-kpis .hq-pulse__label .icon { width: 15px; height: 15px; color: var(--tesla-text); }
  .hq-tc-kpis__go { position: absolute; top: 14px; right: 12px; color: var(--text-subtle); opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
  .hq-tc-kpis__go .icon { width: 16px; height: 16px; }
  .hq-tc-kpis .hq-pulse__item:hover .hq-tc-kpis__go, .hq-tc-kpis .hq-pulse__item:focus-visible .hq-tc-kpis__go { opacity: 1; transform: translateX(2px); }

  /* The last research in numbers: one compact row. */
  .hq-tc-stats .hq-card__head { margin-bottom: 14px; }
  .hq-tc-stats__open, .hq-tc-best .hq-card__link { display: inline-flex; align-items: center; gap: 2px; }
  .hq-tc-stats__open .icon, .hq-tc-best .hq-card__link .icon { width: 15px; height: 15px; }
  .hq-tc-stats .hq-card__meta + .hq-card__link { margin-left: 12px; }
  .hq-tc-stats__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin: 0; border-radius: 14px; background: rgb(var(--navy-rgb) / 0.4); box-shadow: inset 0 0 0 1px var(--line-soft); overflow: hidden; }
  .hq-tc-stats__row > div { display: grid; gap: 2px; padding: 12px 16px; box-shadow: -1px 0 0 var(--line-soft); }
  .hq-tc-stats__row dt { font-size: 11.5px; font-weight: 650; color: var(--text-subtle); }
  .hq-tc-stats__row dd { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

  /* Best opportunities: six compact tiles. */
  .hq-tc-best .hq-card__head { margin-bottom: 14px; }
  .hq-tc-best__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
  .hq-tc-opp { display: grid; align-content: start; gap: 6px; height: 100%; padding: 14px; border-radius: 14px; color: inherit; text-decoration: none; background: rgb(var(--fg-rgb) / 0.035); box-shadow: inset 0 0 0 1px var(--line-soft); transition: background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
  .hq-tc-opp:hover { background: rgb(var(--fg-rgb) / 0.065); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.42); transform: translateY(-1px); }
  .hq-tc-opp__top { display: flex; align-items: center; gap: 8px; }
  .hq-tc-opp__top .hq-tc-score { margin-left: auto; }
  .hq-tc-opp__name { font-size: 14.5px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hq-tc-opp__meta { overflow: hidden; font-size: 12px; color: var(--text-subtle); text-overflow: ellipsis; white-space: nowrap; }
  .hq-tc-opp__why { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hq-tc-opp__contact { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; color: var(--ok-text); }
  .hq-tc-opp__contact .icon { width: 13px; height: 13px; }

  /* History and how TESLA works. */
  .hq-tc-research__foot { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
  @media (max-width: 1099px) { .hq-tc-research__foot { grid-template-columns: minmax(0, 1fr); } }
  .hq-tc-history .hq-card__head, .hq-tc-how .hq-card__head { margin-bottom: 12px; }
  .hq-tc-history__list, .hq-tc-how__list { display: grid; margin: 0; padding: 0; list-style: none; }
  .hq-tc-history__item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 11px 6px; border-top: 1px solid var(--line-soft); color: inherit; text-decoration: none; border-radius: 10px; transition: background-color var(--dur-fast) var(--ease-out); }
  .hq-tc-history__list li:first-child .hq-tc-history__item { border-top: 0; }
  .hq-tc-history__item:hover { background: rgb(var(--fg-rgb) / 0.04); }
  .hq-tc-history__date { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .hq-tc-history__date small { font-size: 12px; font-weight: 500; color: var(--text-subtle); }
  .hq-tc-history__meta { overflow: hidden; font-size: 12.5px; color: var(--text-subtle); text-overflow: ellipsis; white-space: nowrap; }
  .hq-tc-history__go { width: 16px; height: 16px; color: var(--text-subtle); }
  @media (max-width: 639px) {
    .hq-tc-history__item { grid-template-columns: minmax(0, 1fr) auto; }
    .hq-tc-history__meta { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
    .hq-tc-history__go { display: none; }
  }
  .hq-tc-how__list { gap: 12px; }
  .hq-tc-how__list li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
  .hq-tc-how__list .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--tesla-text); }

  /* ── Research cycle (Follow progress) ────────────────────────────── */
  .hq-tc-cycle { display: grid; gap: var(--gap); }
  .hq-tc-cycle > * { min-width: 0; }
  .hq-tc-cycle__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13.5px; color: var(--text-muted); }
  .hq-tc-cycle__meta .hq-key { margin-left: 4px; }
  .hq-tc-cycle__progress { display: grid; gap: 16px; }
  .hq-tc-cycle__progress .hq-card__head { margin-bottom: 0; }
  .hq-tc-cycle__detail { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); background: var(--glass-0); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-tc-cycle__detail .icon { flex: none; width: 17px; height: 17px; margin-top: 1px; }
  .hq-tc-cycle__detail.is-error { color: var(--text); box-shadow: inset 0 0 0 1px rgb(var(--red-rgb) / 0.35); }
  .hq-tc-cycle__detail.is-error .icon { color: var(--error-text); }
  .hq-tc-backline { margin: 0 0 14px; }

  /* ── Reports: the filter looks like the TESLA tabs, reports are tiles ─ */
  .hq-tc-subtabs .hq-tc-tabs__list { width: fit-content; max-width: 100%; }
  .hq-tc-subtabs .hq-tc-tabs__list[hidden] { display: none; }
  .hq-tc-subtabs .hq-tc-tabs__item { border: 0; font: inherit; font-size: 13.5px; font-weight: 650; background: none; cursor: pointer; }
  .hq-tc-subtabs .hq-tc-tabs__item[aria-pressed="true"] {
    color: var(--pearl-ink);
    background: var(--pearl-surface);
    box-shadow: var(--pearl-rim), 0 0 0 1px rgb(var(--orange-rgb) / 0.5), 0 6px 18px -6px rgb(var(--orange-rgb) / 0.6);
  }
  .hq-tc-subtabs .hq-tc-tabs__item[aria-pressed="true"] .icon { color: var(--pearl-ink-orange); }
  .hq-tc-subtabs__count { min-width: 20px; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 700; text-align: center; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.14); }
  .hq-tc-subtabs__count.is-planned { color: var(--text-subtle); background: rgb(var(--fg-rgb) / 0.06); }
  .hq-tc-subtabs .hq-tc-tabs__item[aria-pressed="true"] .hq-tc-subtabs__count { color: var(--pearl-ink-orange); background: rgb(var(--orange-rgb) / 0.16); }

  .hq-tc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
  .hq-tc-tiles > li { min-width: 0; }
  .hq-tc-tiles > li[data-filtered="out"] { display: none; }
  .hq-tc-tile {
    display: flex; flex-direction: column; gap: 10px; aspect-ratio: 1 / 1; min-height: 210px; padding: 18px;
    border-radius: var(--radius-card, 20px); color: inherit; text-decoration: none;
    background: var(--grain), var(--satin), var(--glass-1);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  }
  a.hq-tc-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.5), 0 14px 30px -14px rgb(var(--orange-rgb) / 0.45); }
  a.hq-tc-tile:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
  .hq-tc-tile__type { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-tc-tile__type .icon { flex: none; width: 26px; height: 26px; padding: 5px; border-radius: 8px; color: var(--tesla-text); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-tc-tile__title { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hq-tc-tile__text { font-size: 12.5px; line-height: 1.5; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .hq-tc-tile__figures { display: grid; gap: 4px; font-size: 13px; color: var(--text-muted); }
  .hq-tc-tile__figures strong { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--text); }
  .hq-tc-tile__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .hq-tc-tile__open { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 700; color: var(--tesla-text); }
  .hq-tc-tile__open .icon { width: 15px; height: 15px; }
  .hq-tc-tile__date { font-size: 12.5px; font-weight: 600; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-tc-tile--planned, .hq-tc-tile--empty { background: var(--glass-0); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-tc-tile--planned { border: 1px dashed rgb(var(--fg-rgb) / 0.14); box-shadow: none; }
  .hq-tc-tile--planned .hq-tc-tile__title, .hq-tc-tile--empty .hq-tc-tile__title { font-size: 15px; color: var(--text-muted); }
  .hq-tc-tile--planned .hq-tc-tile__type .icon, .hq-tc-tile--empty .hq-tc-tile__type .icon { color: var(--text-subtle); background: rgb(var(--fg-rgb) / 0.06); }
  @media (max-width: 639px) { .hq-tc-tile { aspect-ratio: auto; min-height: 0; } }
}

@layer materials {
  /* ── Activity: awaiting you, the last 7 days, the log by day ──────── */
  .hq-tc-activity__status { justify-self: start; margin-top: -6px; }
  .hq-tc-activity__status[hidden], .hq-tc-day[hidden] { display: none; }
  .hq-tc-subtabs .hq-tc-tabs__item:disabled { opacity: 0.4; cursor: default; }

  .hq-tc-await { --edge-top: rgb(var(--orange-rgb) / 0.55); }
  .hq-tc-await .hq-card__head { margin-bottom: 12px; }
  .hq-tc-await__count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff; background: var(--orange); box-shadow: 0 0 12px rgb(var(--orange-rgb) / 0.6); }
  .hq-tc-await__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .hq-tc-await__item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; color: inherit; text-decoration: none; background: rgb(var(--orange-rgb) / 0.07); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.3); transition: background-color var(--dur-fast) var(--ease-out); }
  .hq-tc-await__item:hover { background: rgb(var(--orange-rgb) / 0.13); }
  .hq-tc-await__go { flex: none; display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 700; color: var(--tesla-text); white-space: nowrap; }
  .hq-tc-await__go .icon { width: 15px; height: 15px; }

  .hq-tc-feed-card { padding-top: 10px; }
  .hq-tc-day + .hq-tc-day { margin-top: 10px; }
  .hq-tc-day__title { position: sticky; top: 0; z-index: 1; margin: 0; padding: 12px 0 8px; font-size: 12px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-tc-feed { display: grid; margin: 0; padding: 0; list-style: none; }
  .hq-tc-feed__row[data-filtered="out"] { display: none; }
  .hq-tc-feed__link { display: grid; grid-template-columns: 44px auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--line-soft); border-radius: 10px; color: inherit; text-decoration: none; transition: background-color var(--dur-fast) var(--ease-out); }
  .hq-tc-feed__row:first-child .hq-tc-feed__link { border-top: 0; }
  .hq-tc-feed__link:hover { background: rgb(var(--fg-rgb) / 0.04); }
  .hq-tc-feed__link:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
  .hq-tc-feed__time { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-subtle); }
  .hq-tc-feed__icon { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.12); }
  .hq-tc-feed__icon .icon { width: 16px; height: 16px; }
  .hq-tc-feed__icon--chat, .hq-tc-feed__icon--research { color: var(--tesla-text); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-tc-feed__icon--memory { color: var(--green-300); background: rgb(var(--green-rgb) / 0.1); }
  .hq-tc-feed__main { display: grid; gap: 2px; min-width: 0; flex: 1; }
  .hq-tc-feed__title { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .hq-tc-feed__detail { overflow: hidden; font-size: 12.5px; color: var(--text-subtle); text-overflow: ellipsis; white-space: nowrap; }
  .hq-tc-feed__row--error .hq-tc-feed__title { color: var(--error-text); }
  @media (max-width: 639px) {
    .hq-tc-feed__link { grid-template-columns: auto minmax(0, 1fr); row-gap: 6px; }
    .hq-tc-feed__time { grid-column: 1 / -1; }
    .hq-tc-feed__link .hq-tc-pill { grid-column: 2; justify-self: start; }
    .hq-tc-feed__detail { white-space: normal; }
  }
}

/* ------------------------------------------------------------------ */
/* Reports                                                             */
/* ------------------------------------------------------------------ */
@layer materials {
  /* Heading with its round "i" in the right corner, the New report key
     below it, then the orange mini navigation. */
  .hq-rep-head { position: relative; z-index: 6; display: grid; gap: 14px; margin-bottom: 20px; }
  .hq-rep-head__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .hq-rep-head__row .hq-title { margin: 0; }
  .hq-rep-head .hq-info__panel { right: 0; left: auto; }

  /* The orange key: a page's one creating action. */
  .hq-key--orange {
    color: #fff;
    background: linear-gradient(180deg, #ff8233, var(--orange));
    box-shadow: inset 0 1px 0 rgb(var(--orange-hi-rgb) / 0.6), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 1px 1px rgba(0, 0, 0, 0.4), 0 10px 22px -8px rgb(var(--orange-rgb) / 0.75);
  }
  .hq-key--orange .icon { color: #fff; }
  .hq-key--orange:hover { color: #fff; box-shadow: inset 0 1px 0 rgb(var(--orange-hi-rgb) / 0.7), 0 0 0 3px rgb(var(--orange-rgb) / 0.22), 0 12px 26px -8px rgb(var(--orange-rgb) / 0.85); }
  .hq-key--orange:focus-visible { outline-color: var(--orange-300); }
  button.hq-key { border: 0; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
  .hq-key--small { height: 38px; padding: 0 14px 0 11px; font-size: 13.5px; }


  .hq-rep-nav { margin-bottom: 26px; }
  .hq-rep-nav .hq-tc-tabs__list { width: fit-content; max-width: 100%; }
  .hq-rep-nav .hq-tc-tabs__item { text-decoration: none; }
  .hq-rep-nav .hq-tc-tabs__item[aria-current="page"] .hq-tc-subtabs__count { color: var(--pearl-ink-orange); background: rgb(var(--orange-rgb) / 0.16); }
  /* The Archive closes the navigation, set apart by a thin divider. */
  .hq-rep-nav li:has(.hq-rep-nav__archive) { position: relative; margin-left: 9px; }
  .hq-rep-nav li:has(.hq-rep-nav__archive)::before { content: ""; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 1px; background: var(--line); }

  /* Sections: a clean title, its count and the round "i" on the right. */
  .hq-rep-section { margin-bottom: 30px; }
  .hq-rep-section__head { position: relative; z-index: 4; display: flex; align-items: center; gap: 10px 12px; margin-bottom: 14px; }
  .hq-rep-section__title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
  .hq-rep-section__count { min-width: 26px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 750; text-align: center; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.28); font-variant-numeric: tabular-nums; }
  .hq-rep-section__head .hq-tc-info { margin-left: auto; }
  .hq-rep-section__head .hq-info__panel { right: 0; left: auto; }

  /* Overview numbers: the active total, each type, the archive. */
  .hq-rep-stats { display: grid; grid-template-columns: 1.5fr repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
  .hq-rep-stats > li { min-width: 0; }
  .hq-rep-stat {
    display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 118px; padding: 16px;
    border-radius: 18px; color: inherit; text-decoration: none;
    background: var(--grain), var(--satin), var(--glass-1);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  }
  a.hq-rep-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.5), 0 14px 30px -14px rgb(var(--orange-rgb) / 0.45); }
  a.hq-rep-stat:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
  .hq-rep-stat__label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-rep-stat__label .icon { flex: none; width: 24px; height: 24px; padding: 4px; border-radius: 7px; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-rep-stat__value { margin-top: auto; font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .hq-rep-stat__note { font-size: 12px; color: var(--text-subtle); }
  .hq-rep-stat--total { background: var(--pearl-surface); color: var(--pearl-ink); box-shadow: var(--pearl-rim), inset 0 -2px 0 rgb(var(--orange-rgb) / 0.6), 0 12px 30px -14px rgba(0, 0, 0, 0.8); }
  .hq-rep-stat--total .hq-rep-stat__label, .hq-rep-stat--total .hq-rep-stat__note { color: rgb(var(--navy-rgb) / 0.66); }
  .hq-rep-stat--total .hq-rep-stat__label .icon { color: var(--pearl-ink-orange); background: rgb(var(--orange-rgb) / 0.14); }
  .hq-rep-stat--total .hq-rep-stat__value { font-size: 40px; }
  .hq-rep-stat--archive .hq-rep-stat__label .icon { color: var(--text-muted); background: rgb(var(--fg-rgb) / 0.07); }
  @media (max-width: 1279px) { .hq-rep-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  @media (max-width: 639px) {
    .hq-rep-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .hq-rep-stats > li:first-child { grid-column: 1 / -1; }
    .hq-rep-stat { min-height: 96px; padding: 14px; }
    .hq-rep-stat__value { font-size: 26px; }
  }

  /* Search and filters: the Tasks filter bar, with type, dates and project. */
  /* The filter (and its calendar) sits above the table that follows it. */
  .hq-rep-filter { position: relative; z-index: 5; grid-template-columns: minmax(0, 1.8fr) repeat(4, minmax(0, 1fr)) auto; margin-bottom: 14px; }
  /* An opaque calendar: the table must not show through it. */
  :is(.hq-rep-filter, .hq-rep-form) .hq-datepop { z-index: 40; background-color: var(--pearl-solid); }
  .hq-rep-filter--nocat { grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(0, 1fr)) auto; }
  .hq-rep-filter .hq-task-filter__field--search { grid-column: auto; }
  .hq-rep-filter :is(.hq-date__input, input[type="date"]) { width: 100%; height: 42px; min-height: 42px; border-radius: 12px; font-size: 14px; }
  .hq-rep-filter .hq-date { display: block; }
  .hq-rep-filter select:disabled { opacity: 0.5; }
  @media (max-width: 1279px) {
    .hq-rep-filter, .hq-rep-filter--nocat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hq-rep-filter .hq-task-filter__field--search, .hq-rep-filter .hq-task-filter__actions { grid-column: 1 / -1; }
  }

  /* The latest reports. */
  .hq-rep-latest { padding: 8px 12px 0; }
  .hq-rep-table :is(th, td):first-child { padding-left: 20px; }
  .hq-rep-table :is(th, td):last-child { padding-right: 20px; }
  .hq-rep-table :is(th, td) { padding-left: 14px; padding-right: 14px; }
  .hq-rep-table { width: 100%; }
  .hq-rep-table thead th { padding-top: 12px; padding-bottom: 12px; font-size: 11px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-rep-table tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
  .hq-rep-table tbody tr:hover { background: rgb(var(--fg-rgb) / 0.035); }
  .hq-rep-table tbody :is(th, td) { padding-top: 14px; padding-bottom: 14px; vertical-align: middle; }
  .hq-rep-name .hq-table__name { font-weight: 700; }
  .hq-rep-name:hover .hq-table__name { color: var(--orange-300); }
  .hq-rep-type { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px 0 7px; border-radius: 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: rgb(var(--fg-rgb) / 0.05); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-rep-type .icon { width: 15px; height: 15px; color: var(--orange-300); }
  .hq-rep-table__date { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .hq-rep-table__date .hq-table__sub { display: block; }
  .hq-rep-state { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--text-muted); background: rgb(var(--fg-rgb) / 0.06); }
  .hq-rep-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .hq-rep-state--completed { color: var(--ok-text); background: rgb(var(--green-rgb) / 0.12); }
  .hq-rep-state--active { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); }
  .hq-rep-state--failed { color: var(--error-text); background: rgb(var(--red-rgb) / 0.13); }
  .hq-rep-state--archived { color: var(--text-subtle); }
  .hq-rep-open__link { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--text-subtle); box-shadow: inset 0 0 0 1px var(--line); transition: color var(--dur-fast), box-shadow var(--dur-fast); }
  .hq-rep-open__link .icon { width: 17px; height: 17px; }
  .hq-rep-open__link:hover { color: var(--orange-300); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.55); }
  .hq-rep-table__pick { width: 1%; }
  .hq-rep-check { display: inline-grid; place-items: center; width: 34px; height: 34px; cursor: pointer; }
  .hq-rep-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--orange); cursor: pointer; }
  .hq-rep-table.is-selecting tbody tr:has(input:checked) { background: rgb(var(--orange-rgb) / 0.08); box-shadow: inset 3px 0 0 var(--orange); }
  .hq-rep-select__hint { display: flex; align-items: center; gap: 8px; margin: 8px 12px 4px; font-size: 13px; font-weight: 650; color: var(--orange-300); }
  .hq-rep-select__hint .icon { width: 16px; height: 16px; }
  .hq-rep-latest__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 18px; border-top: 1px solid var(--line-soft); }
  .hq-rep-latest__foot .hq-rep-pages { margin: 0; }
  .hq-rep-latest__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
  .hq-rep-collect { display: flex; justify-content: flex-end; margin-top: 14px; }
  .hq-rep-collect__button { height: 42px; padding: 0 16px; border-radius: 12px; font-size: 14px; }
  .hq-rep-collect__button .icon { width: 17px; height: 17px; color: var(--orange-300); }
  @media (max-width: 767px) {
    .hq-rep-latest { padding: 0; }
    .hq-rep-open { display: none; }
  }

  /* Report tiles: one size, each opens the document. */
  .hq-rep-tiles { margin-bottom: 18px; }
  .hq-rep-tile .hq-tc-tile__type { color: var(--text-muted); font-variant-numeric: tabular-nums; }
  .hq-rep-tile .hq-tc-tile__type .icon { color: var(--orange-300); }
  .hq-rep-tile__by { font-size: 12px; font-weight: 650; color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* The report page: a clean heading with the PDF key, then the paper. */
  .hq-rep-detail-head { display: grid; gap: 10px; margin-bottom: 22px; }
  .hq-rep-detail-head__row { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; }
  .hq-rep-detail-head__title { margin: 0; min-width: 0; text-wrap: balance; }
  .hq-rep-detail-head .hq-key { flex: none; }
  .hq-rep-paper { max-width: 800px; margin: 0 auto 18px; }
  .hq-rep-versions-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 800px; margin: 0 auto; font-size: 13px; color: var(--text-subtle); }
  .hq-rep-versions-line a { color: var(--orange-300); font-weight: 700; }
  .hq-rep-versions-line [aria-current] { font-weight: 700; color: var(--text); }
  @media (max-width: 639px) {
    .hq-rep-detail-head__row { flex-direction: column; align-items: stretch; }
    .hq-rep-detail-head .hq-key { justify-content: center; }
  }
}

@layer materials {
  /* Writing a new report. */
  .hq-rep-form { max-width: 920px; }
  .hq-rep-form .hq-form { display: grid; gap: 18px; }
  .hq-rep-form__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .hq-rep-form textarea { min-height: 320px; line-height: 1.6; resize: vertical; }
  .hq-rep-form__actions { display: flex; justify-content: flex-end; gap: 10px; }
  .hq-rep-form .hq-datepop { z-index: 40; }
  @media (max-width: 767px) { .hq-rep-form__grid { grid-template-columns: 1fr; } }
}

/* ------------------------------------------------------------------ */
/* Database (Baza podataka)                                            */
/* ------------------------------------------------------------------ */
@layer materials {
  /* The heading as Reports: back link above, the round "i" right, the key below. */
  .hq-kb-head .hq-back { justify-self: start; }
  .hq-kb-head .hq-info__text.hq-subtitle { max-width: none; margin: 0; font-size: 13.5px; line-height: 1.55; color: inherit; }
  .hq-kb-head .hq-sitecard__code { margin-right: 10px; }

  /* The filter bar: search, domain, category, verification, then actions. */
  .hq-kb-filter { position: relative; z-index: 5; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; margin-bottom: 16px; }
  .hq-kb-filter--nodomain { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto; }
  .hq-kb-filter .hq-task-filter__field--search { grid-column: auto; }
  .hq-kb-more { grid-column: 1 / -1; margin-top: -2px; }
  .hq-kb-more__toggle { display: inline-flex; align-items: center; gap: 6px; width: fit-content; font-size: 13px; font-weight: 650; color: var(--text-subtle); cursor: pointer; list-style: none; }
  .hq-kb-more__toggle::-webkit-details-marker { display: none; }
  .hq-kb-more__toggle .icon { width: 15px; height: 15px; color: var(--orange-300); transition: transform var(--dur-fast) var(--ease-out); }
  .hq-kb-more[open] .hq-kb-more__toggle .icon { transform: rotate(180deg); }
  .hq-kb-more__toggle:hover { color: var(--text); }
  .hq-kb-more__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
  .hq-kb-more__grid select, .hq-kb-more__grid input[type="search"] { width: 100%; max-width: none; height: 42px; min-height: 42px; border-radius: 12px; font-size: 14px; padding: 0 12px; }
  .hq-kb-more__grid .hq-kb-check { grid-column: 1 / -1; }
  .hq-kb-check input { accent-color: var(--orange); }
  .hq-kb-filter select { max-width: none; }
  @media (max-width: 1099px) {
    .hq-kb-filter, .hq-kb-filter--nodomain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hq-kb-filter .hq-task-filter__field--search, .hq-kb-filter .hq-task-filter__actions { grid-column: 1 / -1; }
    .hq-kb-more__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 639px) { .hq-kb-more__grid { grid-template-columns: 1fr; } }

  /* The business domains as chips with their counts. */
  .hq-kb-domains { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
  .hq-kb-domain {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 13px;
    border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--text-muted); text-decoration: none;
    background: var(--glass-1); box-shadow: inset 0 0 0 1px var(--line);
    transition: color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast);
  }
  .hq-kb-domain:hover { color: var(--text); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.45); }
  .hq-kb-domain__n { min-width: 24px; padding: 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 750; text-align: center; color: var(--text-subtle); background: rgb(var(--fg-rgb) / 0.07); font-variant-numeric: tabular-nums; }
  .hq-kb-domain[aria-current="true"] { color: var(--text); background: rgb(var(--orange-rgb) / 0.1); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.55); }
  .hq-kb-domain[aria-current="true"] .hq-kb-domain__n { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.16); }
  .hq-kb-domain.is-empty:not([aria-current]) { opacity: 0.6; }

  .hq-kb-partial { font-size: 12.5px; color: var(--text-subtle); }
  .hq-kb-section-link { margin-left: auto; }

  /* Every piece of knowledge as its own card, one size per row. */
  .hq-kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
  .hq-kb-grid--two { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .hq-kb-card {
    position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 190px; padding: 16px 18px;
    border-radius: 18px;
    background: var(--grain), var(--satin), var(--glass-1);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  }
  .hq-kb-card:has(a.hq-kb-card__title):hover { transform: translateY(-2px); box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.5), 0 14px 30px -14px rgb(var(--orange-rgb) / 0.45); }
  .hq-kb-card:focus-within { box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.6); }
  .hq-kb-card.is-outdated { opacity: 0.66; }
  .hq-kb-card__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
  .hq-kb-card__warn:not(:has(li)) { display: none; }
  .hq-kb-card__kind { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 11.5px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-kb-card__kind > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hq-kb-card__kind .icon { flex: none; width: 24px; height: 24px; padding: 4px; border-radius: 7px; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-kb-card__top .hq-pill { flex: none; }
  .hq-kb-card__date { flex: none; font-size: 12.5px; font-weight: 650; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-kb-card__title { font-family: var(--font-display); font-size: 16.5px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); text-decoration: none; text-wrap: balance; overflow-wrap: anywhere; }
  /* The title's link covers the card; chips and warnings stay above it. */
  a.hq-kb-card__title::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }
  a.hq-kb-card__title:focus-visible { outline: none; }
  .hq-kb-card:hover a.hq-kb-card__title { color: var(--orange-300); }
  .hq-kb-card__text { display: -webkit-box; margin: 0; overflow: hidden; font-size: 13.5px; line-height: 1.55; color: var(--text-muted); -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
  .hq-kb-card__links { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
  .hq-kb-card__warn { position: relative; z-index: 1; }
  .hq-kb-card__warn li { font-size: 12.5px; }
  .hq-kb-card__foot { display: flex; align-items: center; gap: 10px; min-width: 0; margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-subtle); }
  .hq-kb-card__foot .hq-kb-ref { flex: none; color: var(--orange-300); }
  .hq-kb-card__source { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hq-kb-card__records { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
  .hq-kb-card__records .icon { width: 14px; height: 14px; color: var(--orange-300); }
  .hq-kb-card--doc { min-height: 150px; }
  .hq-kb-empty { padding: 8px; }

  /* Overview: five tiles of one size, every part on the same lines (label,
     value, note at the foot), then three columns of one height. */
  .hq-kb-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 22px; }
  .hq-kb-stats .hq-rep-stat { min-height: 150px; }
  .hq-kb-stats .hq-rep-stat__label { min-height: 24px; white-space: nowrap; }
  .hq-kb-stats .hq-rep-stat__value,
  .hq-kb-stats .hq-rep-stat--total .hq-rep-stat__value { margin-top: 6px; font-size: 38px; }
  .hq-kb-stats .hq-rep-stat__note { margin-top: auto; line-height: 1.45; }
  .hq-kb-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
  .hq-kb-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
  .hq-kb-col > .hq-card:last-of-type { flex: 1 1 auto; }
  .hq-kb-col > .hq-card { margin: 0; }
  .hq-kb-col--log > .hq-card:last-of-type { display: flex; flex-direction: column; }
  .hq-kb-col--log > .hq-card:last-of-type > :not(.hq-card__head) { flex: 1 1 auto; }
  .hq-kb-col--log .hq-state { align-items: center; align-content: center; }
  .hq-kb-profile-card__key { margin-top: auto; }
  @media (max-width: 1279px) {
    .hq-kb-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .hq-kb-stats > li { grid-column: span 2; }
    .hq-kb-stats > li:nth-child(-n+2) { grid-column: span 3; }
    .hq-kb-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hq-kb-col--log { grid-column: 1 / -1; }
  }
  @media (max-width: 767px) { .hq-kb-overview { grid-template-columns: minmax(0, 1fr); } }
  .hq-kb-stat--waiting { box-shadow: var(--shadow-1), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.55), 0 0 0 3px rgb(var(--orange-rgb) / 0.08); }
  .hq-kb-stat--waiting .hq-rep-stat__value { color: var(--orange-300); }
  @media (max-width: 639px) { .hq-kb-stats { grid-template-columns: 1fr 1fr; } .hq-kb-stats > li, .hq-kb-stats > li:nth-child(-n+2) { grid-column: auto; } .hq-kb-stats > li:first-child { grid-column: 1 / -1; } .hq-kb-stats .hq-rep-stat__label { white-space: normal; } }
  .hq-kb-columns { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
  @media (max-width: 1023px) { .hq-kb-columns { grid-template-columns: minmax(0, 1fr); } }
  .hq-kb-panel--waiting { box-shadow: var(--shadow-1), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.45); }
  .hq-kb-cats a { align-items: center; padding: 9px 10px; }
  .hq-kb-cats a:hover { box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.35); }
  .hq-kb-cats__n { min-width: 26px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 750; text-align: center; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); font-variant-numeric: tabular-nums; }
  .hq-kb-cats__n.is-zero { color: var(--text-subtle); background: rgb(var(--fg-rgb) / 0.06); }
  .hq-kb-profile-card { display: flex; flex-direction: column; gap: 12px; }
  .hq-kb-profile-card .hq-card__head { margin-bottom: 0; }
  .hq-kb-profile-card__count { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--pearl-ink-orange); font-variant-numeric: tabular-nums; }
  .hq-kb-profile-card .hq-card__note { margin: 0; }
  .hq-kb-profile-card__key { align-self: flex-start; }
  .hq-kb-meter { height: 8px; border-radius: 999px; overflow: hidden; background: rgb(var(--navy-rgb) / 0.12); }
  .hq-kb-meter > span { display: block; width: calc(var(--done) / var(--total) * 100%); min-width: 4px; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff8233, var(--orange)); }
  .hq-kb-rules { display: flex; gap: 10px; margin: 0; padding: 14px 16px; border-radius: 16px; font-size: 12.5px; line-height: 1.55; color: var(--text-subtle); background: rgb(var(--fg-rgb) / 0.03); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-kb-rules .icon { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--orange-300); }

  /* The change log: a label pill, the record, then when and who. */
  .hq-kb-log__label { display: inline-flex; align-items: center; height: 22px; margin-right: 6px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.12); vertical-align: 1px; }
  .hq-kb-log .hq-history__what a { color: var(--text); text-decoration: none; }
  .hq-kb-log .hq-history__what a:hover { color: var(--orange-300); }
  .hq-kb-history .hq-card__head { justify-content: flex-start; gap: 12px; }

  /* Documents: the register form on the pearl card beside the cards. */
  .hq-kb-register { position: sticky; top: 96px; }
  .hq-kb-register .hq-form__actions { justify-content: flex-end; }
  @media (max-width: 1023px) { .hq-kb-register { position: static; } }

  /* Company profile: sections two by two. */
  .hq-kb-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  @media (max-width: 899px) { .hq-kb-profile-grid { grid-template-columns: minmax(0, 1fr); } }
  .hq-kb-section__state { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--text-subtle); background: rgb(var(--fg-rgb) / 0.06); }
  .hq-kb-section.is-recorded .hq-kb-section__state { color: var(--ok-text); background: rgb(var(--green-rgb) / 0.12); }
  .hq-kb-profile__form textarea { min-height: 120px; }

  /* A record's page: source facts as rows, label left and value right. */
  .hq-facts.hq-emp-facts.hq-kb-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0 0 4px; }
  .hq-kb-actions .hq-inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .hq-kb-actions .hq-inline-form input[type="text"] { width: 100%; min-width: 0; }
}

@layer materials {
  /* ── Market analysis (Analiza tržišta): heading, nav, overview ────── */
  .hq-mi-head .hq-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
  .hq-mi-cost { display: inline-flex; align-items: center; gap: 8px; width: fit-content; margin: 0; padding: 7px 12px 7px 9px; border-radius: 999px; font-size: 13px; color: var(--text-muted); background: var(--glass-1); box-shadow: inset 0 0 0 1px var(--line); }
  .hq-mi-cost .icon { width: 16px; height: 16px; color: var(--orange-300); }
  .hq-mi-cost strong { color: var(--text); font-variant-numeric: tabular-nums; }
  .hq-mi-nav { margin-bottom: 22px; }

  .hq-mi-kpis { margin-bottom: var(--gap); }
  .hq-mi-kpis .hq-pulse__label .icon { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; color: var(--orange-300); }

  /* TESLA's card beside three tiles of the same height. */
  .hq-mi-research { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(240px, 1fr); gap: var(--gap); margin-bottom: 16px; }
  .hq-mi-tesla { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; overflow: hidden; padding: 22px 24px; container-type: inline-size; }
  .hq-mi-tesla__main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .hq-mi-tesla__head { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .hq-mi-tesla__head .hq-tc-stage__eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--orange-300); }
  .hq-mi-mark { width: 9px; height: 9px; border-radius: 50%; background: var(--tesla); box-shadow: 0 0 0 4px var(--tesla-soft), 0 0 18px rgb(var(--orange-rgb) / 0.45); }
  .hq-mi-tesla__head .hq-info__panel { right: 0; left: auto; }
  .hq-mi-tesla__title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
  .hq-mi-tesla__period { margin: -6px 0 0; font-size: 12.5px; font-weight: 650; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-mi-tesla__block { display: grid; gap: 5px; max-width: 64ch; }
  .hq-mi-tesla__label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 11.5px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-tesla__text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-muted); }
  .hq-mi-tesla__step { padding: 12px 14px; border-radius: 14px; background: rgb(var(--orange-rgb) / 0.07); box-shadow: inset 3px 0 0 var(--orange), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.2); }
  .hq-mi-tesla__step .hq-mi-tesla__text { color: var(--text); }
  .hq-mi-tesla__link { display: inline-flex; align-items: center; gap: 7px; width: fit-content; margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--orange-300); text-decoration: none; }
  .hq-mi-tesla__link .icon { width: 15px; height: 15px; }
  .hq-mi-tesla__link:hover { color: var(--text); }
  .hq-mi-tesla__open { margin-top: auto; width: fit-content; }
  .hq-mi-tesla__figure { align-self: end; width: clamp(150px, 26cqi, 230px); height: auto; margin: 0 -12px -22px 0; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45)); pointer-events: none; }
  .hq-mi-est { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); }
  .hq-mi-est.is-plain { color: var(--text-subtle); background: rgb(var(--fg-rgb) / 0.07); }

  .hq-mi-side { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .hq-mi-stat { min-height: 0; }
  .hq-rep-stat__value.hq-mi-stat__value { font-size: 26px; }

  .hq-mi-run { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: var(--gap); }
  .hq-mi-run__key { height: 46px; padding: 0 20px 0 16px; font-size: 14.5px; }
  .hq-mi-run__key:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
  .hq-mi-run__note { margin: 0; font-size: 13px; color: var(--text-subtle); }

  /* Two short lists side by side. */
  .hq-mi-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
  .hq-mi-short { padding: 18px 20px 12px; }
  .hq-mi-short .hq-card__head { position: relative; z-index: 3; margin-bottom: 8px; }
  .hq-mi-short .hq-card__head .hq-tc-info { margin-left: auto; }
  .hq-mi-short .hq-card__head .hq-info__panel { right: 0; left: auto; }
  .hq-mi-list { display: grid; margin: 0; padding: 0; list-style: none; }
  .hq-mi-list > li + li { border-top: 1px solid var(--line-soft); }
  .hq-mi-row { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 11px 4px; color: inherit; text-decoration: none; border-radius: 10px; transition: background-color var(--dur-fast) var(--ease-out); }
  a.hq-mi-row:hover { background: rgb(var(--fg-rgb) / 0.035); }
  a.hq-mi-row:hover .hq-mi-row__name { color: var(--orange-300); }
  .hq-mi-row__rank { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-mi-row__rank .icon { width: 15px; height: 15px; }
  .hq-mi-row__main { display: grid; gap: 2px; flex: 1; min-width: 0; }
  .hq-mi-row__name { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
  .hq-mi-row__name a { color: inherit; text-decoration: none; }
  .hq-mi-row__name a:hover { color: var(--orange-300); }
  .hq-mi-row__meta { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; color: var(--text-subtle); }
  .hq-mi-row__date { flex: none; font-size: 12.5px; font-weight: 650; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-mi-row .prio { flex: none; }
  .hq-mi-dot { background: transparent; }
  .hq-mi-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--blue-500); box-shadow: 0 0 0 4px rgb(var(--blue-rgb) / 0.16); }
  .hq-mi-dot--created::before { background: var(--orange); box-shadow: 0 0 0 4px rgb(var(--orange-rgb) / 0.16); }

  @media (max-width: 1099px) {
    .hq-mi-research { grid-template-columns: 1fr; }
    .hq-mi-side { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; }
  }
  @media (max-width: 899px) { .hq-mi-pair { grid-template-columns: 1fr; } }
  @media (max-width: 639px) {
    .hq-mi-side { grid-template-columns: 1fr; }
    .hq-mi-tesla { grid-template-columns: 1fr; padding: 18px; }
    .hq-mi-tesla__figure { display: none; }
  }

  /* ── Lists: the filter bar and the tidy tables ─────────────────────── */
  .hq-mi-filter { position: relative; z-index: 5; grid-template-columns: repeat(var(--mi-fields, 3), minmax(0, 1fr)); margin-bottom: 16px; }
  .hq-mi-filter .hq-task-filter__field--search { grid-column: 1 / -2; grid-row: 1; }
  .hq-mi-filter .hq-task-filter__actions { grid-column: -2 / -1; grid-row: 1; justify-content: flex-end; }
  .hq-mi-filter .hq-task-filter__actions .hq-button { flex: 1; max-width: 160px; }
  .hq-mi-filter select { max-width: none; }
  .hq-mi-filter .hq-task-filter__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (max-width: 1099px) {
    .hq-mi-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  @media (max-width: 699px) {
    .hq-mi-filter { grid-template-columns: 1fr 1fr; }
    .hq-mi-filter .hq-task-filter__field--search { grid-column: 1 / -1; }
    .hq-mi-filter .hq-task-filter__actions { grid-column: 1 / -1; grid-row: auto; }
  }

  .hq-mi-table-card { padding: 6px 10px 0; }
  .hq-mi-table-card .hq-table-wrap { margin: 0; overflow-x: auto; }
  .hq-mi-table-card .pagination { padding: 14px 12px 16px; border-top: 1px solid var(--line-soft); }
  .hq-mi-table { min-width: 900px; table-layout: fixed; }
  .hq-mi-table tbody :is(th, td) { padding-top: 15px; padding-bottom: 15px; vertical-align: top; font-weight: 400; text-align: left; }
  .hq-mi-table .num { text-align: right; font-variant-numeric: tabular-nums; }
  .hq-mi-table--opps th:nth-child(1) { width: 118px; }
  .hq-mi-table--opps th:nth-child(2) { width: 23%; }
  .hq-mi-table--opps th:nth-child(3) { width: 13%; }
  .hq-mi-table--opps th:nth-child(4) { width: 13%; }
  .hq-mi-table--opps th:nth-child(5) { width: 108px; }
  .hq-mi-table--opps th:nth-child(7) { width: 116px; }
  .hq-mi-table--projects th:nth-child(1) { width: 32%; }
  .hq-mi-table--projects th:nth-child(n + 6) { width: 92px; }
  .hq-mi-table thead th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-mi-table .hq-mi-sub { max-width: 100%; }
  .hq-mi-prio { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
  .hq-mi-prio .prio { min-width: 0; padding: 4px 9px; border-radius: 8px; font-size: 11px; line-height: 1.2; }
  .hq-mi-prio .hq-tc-score { min-width: 30px; height: 24px; font-size: 12.5px; }
  .hq-mi-name { display: block; font-family: var(--font-display); font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--text); text-decoration: none; text-wrap: balance; }
  .hq-mi-name:hover { color: var(--orange-300); }
  .hq-mi-sub { display: block; margin-top: 3px; overflow: hidden; font-size: 12.5px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; color: var(--text-subtle); }
  .hq-mi-company { font-size: 13.5px; font-weight: 650; color: var(--text); text-decoration: none; }
  .hq-mi-company:hover { color: var(--orange-300); }
  .hq-mi-place { font-size: 13.5px; font-weight: 600; color: var(--text); }
  .hq-mi-unknown { font-size: 13px; color: var(--text-subtle); }
  .hq-mi-phase { font-size: 13.5px; color: var(--text-muted); }
  .hq-mi-contact { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; white-space: nowrap; color: var(--text-subtle); }
  .hq-mi-contact::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--fg-rgb) / 0.25); }
  .hq-mi-contact.is-yes { color: var(--ok-text); }
  .hq-mi-contact.is-yes::before { background: var(--ok-text); box-shadow: 0 0 6px var(--ok-text); }
  .hq-mi-action { display: -webkit-box; overflow: hidden; font-size: 13px; line-height: 1.5; color: var(--text-muted); -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .hq-mi-tag { display: inline-flex; align-items: center; height: 19px; margin-right: 7px; padding: 0 7px; border-radius: 6px; font-size: 10.5px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; vertical-align: 1px; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); }
  .hq-mi-status { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--text-muted); background: rgb(var(--fg-rgb) / 0.06); }
  .hq-mi-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .hq-mi-status--info { color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.12); }
  .hq-mi-status--ok { color: var(--ok-text); background: rgb(var(--green-rgb) / 0.12); }
  .hq-mi-date { margin-top: 6px; padding-left: 2px; font-variant-numeric: tabular-nums; }
  .hq-mi-empty { padding: 26px 20px; }

  /* ── Companies: the business network as cards of one size ──────────── */
  .hq-mi-netstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; padding: 0; list-style: none; }
  .hq-mi-netstats > li { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--grain), var(--satin), var(--glass-1); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
  .hq-mi-netstats__value { font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
  .hq-mi-netstats__value--orange { color: var(--orange-300); }
  .hq-mi-netstats__label { font-size: 12.5px; font-weight: 650; color: var(--text-subtle); }
  @media (max-width: 899px) { .hq-mi-netstats { grid-template-columns: 1fr 1fr; } }

  .hq-mi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 0 0 16px; padding: 0; list-style: none; }
  .hq-mi-grid > li { min-width: 0; }
  .hq-mi-co {
    display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 268px; padding: 16px 16px 12px;
    border-radius: 18px; color: inherit; text-decoration: none;
    background: var(--grain), var(--satin), var(--glass-1);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  }
  .hq-mi-co:hover { transform: translateY(-2px); box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.5), 0 14px 30px -14px rgb(var(--orange-rgb) / 0.45); }
  .hq-mi-co:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
  .hq-mi-co__top { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; }
  .hq-mi-co__top .hq-mi-rel:first-of-type { margin-left: auto; }
  .hq-mi-co__logo, .hq-mi-hero__logo {
    flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
    font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: 0.02em; color: var(--pearl-ink);
    background: var(--pearl-surface); box-shadow: var(--pearl-rim), inset 0 -2px 0 rgb(var(--orange-rgb) / 0.55);
  }
  .hq-mi-co__name { display: -webkit-box; overflow: hidden; min-height: 2.6em; font-family: var(--font-display); font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .hq-mi-co:hover .hq-mi-co__name { color: var(--orange-300); }
  .hq-mi-co__types { overflow: hidden; font-size: 12px; font-weight: 700; letter-spacing: 0.03em; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-co__place { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
  .hq-mi-co__scores { display: grid; gap: 7px; margin-top: auto; padding-top: 10px; }
  .hq-mi-score { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
  .hq-mi-score__label { font-size: 11px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-score__bar { position: relative; display: block; height: 6px; overflow: hidden; border-radius: 999px; background: rgb(var(--fg-rgb) / 0.08); }
  .hq-mi-score__bar > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--blue-500); }
  .hq-mi-score--high .hq-mi-score__bar > span, .hq-mi-gauge--high .hq-mi-score__bar > span { background: linear-gradient(90deg, #ff8233, var(--orange)); box-shadow: 0 0 10px rgb(var(--orange-rgb) / 0.55); }
  .hq-mi-score--medium .hq-mi-score__bar > span, .hq-mi-gauge--medium .hq-mi-score__bar > span { background: rgb(var(--orange-rgb) / 0.6); }
  .hq-mi-score--low .hq-mi-score__bar > span, .hq-mi-gauge--low .hq-mi-score__bar > span { background: rgb(var(--fg-rgb) / 0.35); }
  .hq-mi-score--data .hq-mi-score__bar > span, .hq-mi-gauge--data .hq-mi-score__bar > span { background: linear-gradient(90deg, var(--blue-500), var(--blue-300)); }
  .hq-mi-score__value { min-width: 38px; font-family: var(--font-display); font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
  .hq-mi-score__value small { font-size: 11px; font-weight: 600; color: var(--text-subtle); }
  .hq-mi-co__foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 700; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-mi-co__foot > span { display: inline-flex; align-items: center; gap: 5px; }
  .hq-mi-co__foot .icon { width: 14px; height: 14px; color: var(--orange-300); }
  .hq-mi-co__go { margin-left: auto; }
  .hq-mi-co__go .icon { color: var(--text-subtle); }
  .hq-mi-co:hover .hq-mi-co__go .icon { color: var(--orange-300); }

  .hq-mi-rel { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.12); }
  .hq-mi-rel--worked, .hq-mi-rel--partner { color: var(--ok-text); background: rgb(var(--green-rgb) / 0.12); }
  .hq-mi-rel--manual { padding: 0 6px; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); }
  .hq-mi-rel--manual .icon { width: 12px; height: 12px; }

  /* ── A company's (or project's) page ───────────────────────────────── */
  .hq-mi-hero { display: flex; align-items: flex-start; gap: 18px; margin-bottom: var(--gap); padding: 20px 22px; }
  .hq-mi-hero__logo { width: 64px; height: 64px; border-radius: 18px; font-size: 21px; }
  .hq-mi-hero__logo .icon { width: 28px; height: 28px; color: var(--pearl-ink-orange); }
  .hq-mi-hero__main { display: grid; gap: 10px; min-width: 0; }
  .hq-mi-hero__legal { margin: 0; font-size: 14px; font-weight: 650; color: var(--text-muted); overflow-wrap: anywhere; }
  .hq-mi-hero__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
  .hq-mi-tagline { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--text); background: rgb(var(--fg-rgb) / 0.06); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-mi-tagline.is-muted { color: var(--text-subtle); }
  .hq-mi-hero__facts { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 2px 0 0; }
  .hq-mi-hero__facts > div { display: grid; gap: 2px; }
  .hq-mi-hero__facts dt { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-hero__facts dd { margin: 0; font-size: 14px; font-weight: 600; }
  .hq-mi-hero__facts a { color: var(--blue-300); text-decoration: none; }
  .hq-mi-hero__text { max-width: 72ch; margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-muted); }

  .hq-mi-scores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-bottom: 30px; }
  .hq-mi-gauge { display: grid; align-content: start; gap: 10px; padding: 18px 20px; }
  .hq-mi-gauge__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .hq-mi-gauge__title { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; }
  .hq-mi-gauge__value { margin: 0; font-family: var(--font-display); font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .hq-mi-gauge--high .hq-mi-gauge__value { color: var(--orange-300); }
  .hq-mi-gauge__value small { font-size: 16px; color: var(--text-subtle); }
  .hq-mi-gauge__bar { height: 8px; }
  .hq-mi-breakdown, .hq-mi-checks { display: grid; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; }
  .hq-mi-breakdown li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; color: var(--text-muted); }
  .hq-mi-breakdown__pts { font-weight: 750; color: var(--orange-300); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .hq-mi-breakdown__pts.is-zero { color: var(--text-subtle); }
  .hq-mi-checks { grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .hq-mi-checks li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; color: var(--text-subtle); }
  .hq-mi-checks li.is-ok { color: var(--text); }
  .hq-mi-checks .icon { flex: none; width: 15px; height: 15px; color: var(--blue-300); }
  .hq-mi-checks__dash { flex: none; width: 15px; height: 2px; border-radius: 2px; background: rgb(var(--fg-rgb) / 0.2); }

  .hq-mi-network { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: var(--gap); align-items: start; }
  .hq-mi-network__side { display: grid; gap: var(--gap); }
  .hq-mi-entries, .hq-mi-profile, .hq-mi-public { padding: 18px 20px; }
  .hq-mi-entry-list { display: grid; margin: 0 0 6px; padding: 0; list-style: none; }
  .hq-mi-entry { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; }
  .hq-mi-entry + .hq-mi-entry { border-top: 1px solid var(--line-soft); }
  .hq-mi-entry__icon { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-mi-entry__icon .icon { width: 16px; height: 16px; }
  .hq-mi-entry--note .hq-mi-entry__icon { color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.12); }
  .hq-mi-entry__main { flex: 1; min-width: 0; }
  .hq-mi-entry__kind { margin: 0 0 3px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-entry__kind strong { color: var(--text); letter-spacing: 0; text-transform: none; font-size: 13px; }
  .hq-mi-entry__value { display: block; margin: 0; font-size: 14px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; text-decoration: none; }
  a.hq-mi-entry__value { color: var(--blue-300); font-weight: 650; }
  .hq-mi-entry__meta { margin: 4px 0 0; font-size: 12px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-mi-entry__archive { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 9px; color: var(--text-subtle); background: transparent; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
  .hq-mi-entry__archive .icon { width: 15px; height: 15px; }
  .hq-mi-entry__archive:hover { color: var(--orange-300); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.55); }
  .hq-mi-archived { margin: 0 0 6px; font-size: 12.5px; color: var(--text-subtle); }
  .hq-mi-form-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-form-title .icon { width: 16px; height: 16px; color: var(--orange-300); }
  .hq-mi-entry-form { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
  .hq-mi-entry-form__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
  .hq-mi-entry-form .hq-form__actions, .hq-mi-profile .hq-form__actions { justify-content: flex-end; }
  .hq-mi-note { margin: 10px 0 0; font-size: 12.5px; color: var(--text-subtle); }
  .hq-mi-records { margin-top: 8px; }

  @media (max-width: 1099px) { .hq-mi-network { grid-template-columns: 1fr; } }
  @media (max-width: 699px) {
    .hq-mi-scores { grid-template-columns: 1fr; }
    .hq-mi-hero { flex-direction: column; }
    .hq-mi-entry-form__grid, .hq-mi-checks { grid-template-columns: 1fr; }
  }

  /* ── Adding a company ─────────────────────────────────────────────── */
  .hq-mi-new { max-width: 980px; }
  .hq-mi-new__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
  .hq-mi-types { display: grid; gap: 8px; }
  .hq-mi-types__label { font-size: 13px; font-weight: 650; }
  .hq-mi-types__list { display: flex; flex-wrap: wrap; gap: 8px; }
  .hq-mi-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 13px 0 10px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--text-muted); background: var(--glass-1); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
  .hq-mi-chip input { width: 16px; height: 16px; margin: 0; accent-color: var(--orange); }
  .hq-mi-chip:has(input:checked) { color: var(--text); background: rgb(var(--orange-rgb) / 0.1); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.55); }
  @media (max-width: 699px) { .hq-mi-new__grid { grid-template-columns: 1fr; } }
}
@layer materials {
  .hq-mi-name-field { display: grid; gap: 6px; }
  .hq-mi-name-field .hq-field__error a { color: var(--orange-300); font-weight: 700; }
  .hq-mi-confirm { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--orange-300); cursor: pointer; }
  .hq-mi-confirm input { width: 16px; height: 16px; margin: 0; accent-color: var(--orange); }
}
@layer materials {
  /* The new-analysis key on the left, its explanation in the "i" at the right edge. */
  .hq-mi-run { position: relative; z-index: 4; justify-content: space-between; flex-wrap: nowrap; }
  .hq-mi-run .hq-info__panel { right: 0; left: auto; }
}
@layer materials {
  /* Removing a company: a quiet key that opens a confirmation. */
  .hq-mi-remove { position: relative; z-index: 7; align-items: center; }
  .hq-mi-remove__box { position: relative; }
  .hq-mi-remove__toggle { display: inline-flex; align-items: center; gap: 7px; list-style: none; cursor: pointer; color: var(--text-muted); }
  .hq-mi-remove__toggle::-webkit-details-marker { display: none; }
  .hq-mi-remove__toggle .icon { width: 15px; height: 15px; }
  .hq-mi-remove__toggle:hover { color: var(--text); }
  .hq-mi-remove__panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); padding: 16px; border-radius: 16px; background: var(--grain), var(--satin), rgb(var(--navy-rgb) / 0.97); box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line-strong); }
  .hq-mi-remove__text { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text-muted); }
  .hq-mi-remove__label { font-size: 12.5px; font-weight: 650; }
  .hq-mi-remove__panel input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 14px; color: var(--text); background: rgb(var(--navy-rgb) / 0.55); }
  .hq-mi-remove__confirm { justify-self: end; }
  .hq-mi-removed { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; font-weight: 700; color: var(--text-muted); }
  .hq-mi-removed .icon { width: 15px; height: 15px; }
}
@layer materials {
  /* The recommended action in one word: contact is the attention colour. */
  .hq-mi-act { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; font-weight: 700; white-space: nowrap; cursor: help; }
  .hq-mi-act::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .hq-mi-act--contact { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.3); }
  .hq-mi-act--monitor { color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.25); }
  .hq-mi-act--analyse { color: var(--text-muted); background: rgb(var(--fg-rgb) / 0.06); box-shadow: inset 0 0 0 1px var(--line); }
  .hq-mi-table--opps th:nth-child(6) { width: 160px; }
}
@layer materials {
  /* ── One business opportunity ─────────────────────────────────────── */
  .hq-mi-opp-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px 28px; margin-bottom: var(--gap); padding: 20px 22px; }
  .hq-mi-opp-hero__main { display: grid; align-content: start; gap: 10px; min-width: 0; }
  .hq-mi-opp-hero__badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
  .hq-mi-opp-hero__badges .hq-mi-act { cursor: default; }
  .hq-mi-opp-hero__site { margin: 0; font-size: 13px; font-weight: 650; color: var(--text-subtle); }
  .hq-mi-opp-hero__summary { max-width: 72ch; margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-muted); }
  .hq-mi-opp-hero__facts { display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 0; margin: 0; padding-left: 24px; border-left: 1px solid var(--line-soft); }
  .hq-mi-opp-hero__facts > div { display: grid; gap: 3px; padding: 10px 0; }
  .hq-mi-opp-hero__facts > div:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
  .hq-mi-opp-hero__facts dt { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-opp-hero__facts dd { margin: 0; min-width: 0; overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .hq-mi-opp-hero__facts a { color: var(--text); text-decoration: none; }
  .hq-mi-opp-hero__facts a:hover { color: var(--orange-300); }

  .hq-mi-opp { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: var(--gap); align-items: start; margin-bottom: 30px; }
  .hq-mi-opp__main, .hq-mi-opp__side { display: grid; gap: var(--gap); min-width: 0; }
  .hq-mi-panel { padding: 18px 20px; }
  .hq-mi-panel .hq-card__head { position: relative; z-index: 3; margin-bottom: 10px; }
  .hq-mi-panel .hq-card__head .hq-tc-info { margin-left: auto; }
  .hq-mi-panel .hq-card__head .hq-info__panel { right: 0; left: auto; }

  .hq-mi-assess { display: grid; gap: 16px; padding: 20px 22px; }
  .hq-mi-assess__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .hq-mi-assess__title { display: inline-flex; align-items: center; gap: 10px; margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
  .hq-mi-verdict { display: grid; gap: 4px; padding: 14px 16px; border-radius: 14px; background: rgb(var(--fg-rgb) / 0.04); box-shadow: inset 0 0 0 1px var(--line); }
  .hq-mi-verdict__label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-verdict__value { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; }
  .hq-mi-verdict--yes .hq-mi-verdict__value { color: var(--orange-300); }
  .hq-mi-verdict__why { margin: 2px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-muted); }
  .hq-mi-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
  .hq-mi-metrics > div { display: grid; align-content: start; gap: 6px; padding: 12px 14px; border-radius: 14px; background: rgb(var(--fg-rgb) / 0.04); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-mi-metrics dt { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-metrics dd { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
  .hq-mi-metrics dd small { font-size: 12px; color: var(--text-subtle); }
  .hq-mi-metrics dd.is-text { font-family: var(--font-sans); font-size: 14px; font-weight: 650; line-height: 1.35; }
  .hq-mi-factors { display: grid; gap: 4px; }

  .hq-mi-rows { display: grid; margin: 0; }
  .hq-mi-rows > div { display: grid; grid-template-columns: minmax(140px, 0.4fr) minmax(0, 1fr); gap: 16px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
  .hq-mi-rows > div:first-child { border-top: 0; }
  .hq-mi-rows dt { font-size: 13px; font-weight: 650; color: var(--text-subtle); }
  .hq-mi-rows dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; font-size: 14px; color: var(--text); }
  .hq-mi-rows .facts__evidence { display: inline-flex; flex-wrap: wrap; gap: 6px; }
  .hq-mi-quote { display: block; width: 100%; margin: 4px 0 0; padding-left: 10px; border-left: 2px solid rgb(var(--orange-rgb) / 0.5); font-size: 13px; font-style: italic; line-height: 1.55; color: var(--text-muted); quotes: none; }

  .hq-mi-firm { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
  .hq-mi-firm:first-of-type { border-top: 0; padding-top: 2px; }
  .hq-mi-firm.is-target { margin: 0 -10px; padding: 12px 10px; border-radius: 12px; border-top: 0; background: rgb(var(--orange-rgb) / 0.07); box-shadow: inset 3px 0 0 var(--orange); }
  .hq-mi-firm__role { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-mi-firm__role strong { color: var(--orange-300); }
  .hq-mi-firm__name { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; color: var(--text); text-decoration: none; }
  .hq-mi-firm__name:hover { color: var(--orange-300); }
  .hq-mi-firm .contact-list { margin: 4px 0 0; }

  .hq-mi-note-form { gap: 4px; margin-bottom: 8px; }
  .hq-mi-note-form .hq-form__actions { justify-content: flex-end; }
  .hq-mi-notes { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
  .hq-mi-history { display: grid; margin: 8px 0 0; padding: 0; list-style: none; }
  .hq-mi-history li { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--text-muted); }
  .hq-mi-history__date { flex: none; min-width: 42px; font-weight: 700; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

  .hq-mi-source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
  .hq-mi-source { display: grid; align-content: start; gap: 8px; padding: 14px 16px; border-radius: 16px; background: var(--grain), var(--satin), var(--glass-1); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
  .hq-mi-source__domain { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 12px; font-weight: 750; color: var(--orange-300); }
  .hq-mi-source__domain .icon { width: 14px; height: 14px; }
  .hq-mi-source__domain span { margin-left: auto; font-weight: 600; color: var(--text-subtle); }
  .hq-mi-source__title { font-size: 14px; font-weight: 650; line-height: 1.4; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
  .hq-mi-source__title:hover { color: var(--blue-300); }

  @media (max-width: 1099px) {
    .hq-mi-opp, .hq-mi-opp-hero { grid-template-columns: 1fr; }
    .hq-mi-opp-hero__facts { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--line-soft); }
    .hq-mi-metrics { grid-template-columns: 1fr 1fr; }
  }
  @media (max-width: 639px) {
    .hq-mi-rows > div { grid-template-columns: 1fr; gap: 4px; }
  }
}
@layer materials {
  /* One page's own head, below the navigation that never moves. */
  .hq-mi-pagehead { position: relative; z-index: 6; display: grid; gap: 8px; margin: -4px 0 18px; }
  .hq-mi-pagehead .hq-back { justify-self: start; }
  .hq-mi-pagehead__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
  .hq-mi-pagehead__title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
  .hq-mi-pagehead .hq-controls { margin: 0; }
  .hq-mi-pagehead .hq-mi-remove__panel { left: auto; right: 0; }
  .hq-rep-section__head .hq-mi-add { flex: none; }
  .hq-rep-section__head:has(.hq-mi-add) .hq-tc-info { margin-left: auto; }
  @media (max-width: 639px) { .hq-mi-pagehead__title { font-size: 21px; } }
}

/* ------------------------------------------------------------------ */
/* System (V3): heading, orange navigation, four figures that stay in  */
/* the same place on every tab, then each tab's sections.              */
/* ------------------------------------------------------------------ */
@layer materials {
  .hq-sys-head { margin-bottom: 16px; }
  .hq-sys-nav { margin-bottom: 18px; }
  .hq-sys-stats { grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 1fr)); margin-bottom: 30px; }
  .hq-sys-stats .hq-rep-stat { min-height: 128px; }
  .hq-sys-stats .hq-rep-stat__note { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .hq-sys-stat__text { font-size: 24px; line-height: 1.15; }
  .hq-rep-stat--total .hq-sys-stat__text { font-size: 28px; }
  .hq-sys-stats .hq-sys-stat__file { display: block; white-space: nowrap; }
  .hq-sys-stat--alert { box-shadow: var(--shadow-1), inset 0 0 0 1px rgb(var(--orange-rgb) / 0.45), inset 0 -2px 0 rgb(var(--orange-rgb) / 0.7); }
  .hq-sys-stat--alert .hq-rep-stat__value { color: var(--orange-300); }
  @media (max-width: 1099px) { .hq-sys-stats { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 639px) { .hq-sys-stats > li:first-child { grid-column: 1 / -1; } .hq-sys-stat__text { font-size: 20px; } }

  /* Sections: title, count and "i"; the orange key under the title. */
  .hq-sys-section { margin-bottom: 34px; }
  .hq-sys-controls { margin: -2px 0 16px; }
  .hq-sys-section .hq-rep-section__head .hq-select { margin-left: 4px; }
  .hq-sys-section .hq-select .hq-menu { z-index: 30; }

  /* The card that holds a table or a list. */
  .hq-sys-card {
    min-width: 0; padding: 18px 20px; border-radius: 20px;
    background: var(--grain), var(--satin), var(--glass-1);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }
  .hq-sys-scroll { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
  .hq-sys-table { min-width: 720px; }
  .hq-sys-table tbody td { font-weight: 500; color: var(--text-muted); }
  .hq-sys-table tbody td.is-num { font-weight: 650; color: var(--text); }
  .hq-sys-table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
  .hq-sys-table tbody tr:hover { background: rgb(var(--fg-rgb) / 0.025); }
  .hq-sys-table tr.is-current th { box-shadow: inset 3px 0 0 var(--orange); padding-left: 12px; }
  .hq-sys-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
  .hq-sys-link .icon { flex: none; width: 16px; height: 16px; color: var(--orange-300); }
  .hq-sys-link:hover { color: var(--blue-300); }
  /* Workbooks by month: each month's earlier versions fold under its name. */
  .hq-sys-months__name { display: block; font-weight: 650; color: var(--text); }
  .hq-sys-versions summary { display: inline-block; margin-top: 3px; cursor: pointer; list-style: none; }
  .hq-sys-versions summary::-webkit-details-marker { display: none; }
  .hq-sys-versions summary .hq-table__sub { color: var(--blue-300); }
  .hq-sys-versions[open] summary .hq-table__sub { color: var(--text-subtle); }
  .hq-sys-versions__list { display: grid; gap: 6px; margin: 8px 0 2px; padding: 0; list-style: none; font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
  .hq-sys-versions__list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
  .hq-sys-versions__list .hq-sys-link { font-size: 12.5px; }
  .hq-sys-versions__state { color: var(--text-subtle); }
  .hq-sys-bad { color: rgb(var(--red-rgb)); }
  .hq-sys-empty { margin: 4px 0; font-size: 14px; color: var(--text-subtle); }

  .hq-sys-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--text-muted); background: rgb(var(--fg-rgb) / 0.07); box-shadow: inset 0 0 0 1px var(--line-soft); }
  .hq-sys-pill--ok { color: rgb(var(--green-rgb)); background: rgb(var(--green-rgb) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--green-rgb) / 0.3); }
  .hq-sys-pill--info { color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.13); box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.3); }
  .hq-sys-pill--active, .hq-sys-pill--warning { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.13); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.3); }
  .hq-sys-pill--error { color: rgb(var(--red-rgb)); background: rgb(var(--red-rgb) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--red-rgb) / 0.3); }

  /* The workbook check under the table. */
  .hq-sys-check { margin: 0; }
  .hq-sys-check .hq-quality .hq-card__head .hq-card__title { display: none; }

  /* Sources: status chips that filter, the filter bar, the register. */
  .hq-sys-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
  .hq-sys-chip { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 650; color: var(--text-muted); text-decoration: none; background: var(--glass-1); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
  .hq-sys-chip strong { min-width: 26px; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; text-align: center; color: var(--text); background: rgb(var(--fg-rgb) / 0.08); font-variant-numeric: tabular-nums; }
  .hq-sys-chip:hover { color: var(--text); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.45); }
  .hq-sys-chip[aria-current="true"] { color: var(--text); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.7), 0 0 0 3px rgb(var(--orange-rgb) / 0.14); }
  .hq-sys-chip[aria-current="true"] strong { color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.16); }
  .hq-sys-filter { grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(0, 1fr)) auto; margin-bottom: 14px; }
  @media (max-width: 1099px) { .hq-sys-filter { grid-template-columns: 1fr 1fr; } .hq-sys-filter .hq-task-filter__field--search { grid-column: 1 / -1; } }

  /* A page of its own below the navigation (a source). */
  .hq-sys-pagehead { position: relative; z-index: 6; display: grid; gap: 8px; margin: -6px 0 20px; }
  .hq-sys-pagehead .hq-back { justify-self: start; }
  .hq-sys-pagehead__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
  .hq-sys-pagehead__title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
  .hq-sys-pagehead__meta { margin: 4px 0 0; font-size: 13.5px; color: var(--text-subtle); overflow-wrap: anywhere; }
  .hq-sys-pagehead__meta .hq-sys-link { font-weight: 550; color: var(--blue-300); }
  .hq-sys-detail .panel { border-radius: 20px; background: var(--grain), var(--satin), var(--glass-1); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
  .hq-sys-detail .panel__header { position: relative; z-index: 3; }
  .hq-sys-panel-info { margin-left: auto; }
  .hq-sys-panel-info .hq-info__panel { right: 0; left: auto; }
  /* Sub-pages that keep their own page header below the System heading. */
  :is(.hq-sys-stats, .hq-sys-nav) ~ .breadcrumb { margin-top: -8px; }
  :is(.hq-sys-stats, .hq-sys-nav) ~ .page-header .page-title { font-size: 24px; }

  /* ---------------- AI costs ---------------- */
  .hq-ai__head .hq-ai-power { margin-left: auto; }
  .hq-ai__head .hq-tc-info { margin-left: 0; }
  .hq-ai-power { display: inline-flex; align-items: center; gap: 10px; margin: 0; }
  .hq-ai-power__note { font-size: 12px; color: var(--text-subtle); }
  .hq-switch__label { white-space: nowrap; }
  @media (max-width: 699px) {
    .hq-ai__head { flex-wrap: wrap; }
    .hq-ai__head .hq-rep-section__title { flex: 1 1 auto; }
    .hq-ai__head .hq-ai-power { order: 3; flex: 1 1 100%; margin-left: 0; flex-wrap: wrap; }
  }

  /* The switch: an orange track whose thumb slides left and right. */
  .hq-switch { display: inline-flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px 0 8px; border: 0; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 700; color: var(--text-muted); cursor: pointer; background: var(--glass-1); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-1); transition: box-shadow var(--dur) var(--ease-out), color var(--dur) var(--ease-out); }
  .hq-switch__track { position: relative; flex: none; width: 54px; height: 30px; border-radius: 999px; background: rgb(var(--fg-rgb) / 0.12); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45); transition: background 260ms var(--ease-out); }
  .hq-switch__thumb { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(180deg, #fff, #dfe3e8); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); transition: transform 280ms cubic-bezier(0.34, 1.4, 0.64, 1); }
  .hq-switch.is-on { color: var(--text); box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.55), 0 10px 24px -12px rgb(var(--orange-rgb) / 0.8); }
  .hq-switch.is-on .hq-switch__track { background: linear-gradient(180deg, #ff8233, var(--orange)); box-shadow: inset 0 1px 0 rgb(var(--orange-hi-rgb) / 0.6), 0 0 14px -2px rgb(var(--orange-rgb) / 0.7); }
  .hq-switch.is-on .hq-switch__thumb { transform: translateX(24px); }
  /* While the form is sent, the thumb already slides to its new side. */
  .hq-switch.is-flipping .hq-switch__thumb { transform: translateX(24px); }
  .hq-switch.is-on.is-flipping .hq-switch__thumb { transform: translateX(0); }
  .hq-switch:hover { color: var(--text); }
  .hq-switch:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
  @media (prefers-reduced-motion: reduce) { .hq-switch__thumb, .hq-switch__track { transition: none; } }

  .hq-ai-budget { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
  .hq-ai-meter { display: grid; gap: 10px; padding: 18px 20px; border-radius: 20px; background: var(--pearl-surface); color: var(--pearl-ink); box-shadow: var(--pearl-rim), 0 12px 30px -14px rgba(0, 0, 0, 0.8); }
  .hq-ai-meter__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .hq-ai-meter .hq-rep-stat__label, .hq-ai-meter .hq-rep-stat__note { color: rgb(var(--navy-rgb) / 0.66); }
  .hq-ai-meter .hq-rep-stat__note { margin: 0; font-size: 12.5px; }
  .hq-ai-meter .hq-rep-stat__label .icon { color: var(--pearl-ink-orange); background: rgb(var(--orange-rgb) / 0.14); }
  .hq-ai-meter__value { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .hq-ai-meter__value small { font-size: 15px; font-weight: 550; color: rgb(var(--navy-rgb) / 0.6); }
  .hq-ai-meter__bar { height: 10px; border-radius: 999px; overflow: hidden; background: rgb(var(--navy-rgb) / 0.12); }
  .hq-ai-meter__bar span { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, rgb(var(--orange-rgb) / 0.75), var(--orange)); }
  .hq-ai-meter[data-level="stopped"] .hq-ai-meter__bar span { background: rgb(var(--red-rgb)); }
  .hq-ai-meter .hq-sys-pill--ok { color: #007a55; }
  .hq-ai-periods { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hq-ai-periods .hq-rep-stat__value { font-size: 24px; }
  @media (max-width: 1099px) { .hq-ai-periods { grid-template-columns: 1fr 1fr; } }
  @media (max-width: 699px) { .hq-ai-budget { grid-template-columns: 1fr; } .hq-ai-periods > li:first-child { grid-column: auto; } }

  .hq-ai-filter { position: relative; z-index: 5; grid-template-columns: repeat(2, minmax(0, 0.9fr)) repeat(4, minmax(0, 1fr)) auto; margin-bottom: 12px; }
  .hq-ai-filter :is(.hq-date__input, input[type="date"]) { width: 100%; height: 42px; min-height: 42px; border-radius: 12px; font-size: 14px; }
  .hq-ai-filter .hq-datepop { z-index: 40; background-color: var(--pearl-solid); }
  @media (max-width: 1279px) { .hq-ai-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (max-width: 699px) { .hq-ai-filter { grid-template-columns: 1fr 1fr; } }

  .hq-ai-figures { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden; border-radius: 18px; background: var(--line-soft); box-shadow: inset 0 0 0 1px var(--line); }
  .hq-ai-figures > div { display: grid; align-content: start; gap: 6px; padding: 14px 16px; background: var(--grain), var(--satin), rgb(var(--navy-rgb)); }
  .hq-ai-figures dt { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-ai-figures dd { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .hq-ai-figures dd small { display: block; font-size: 11.5px; font-weight: 550; color: var(--text-subtle); }
  .hq-ai-figures .is-lead dd { color: var(--orange-300); }
  @media (max-width: 1099px) { .hq-ai-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (max-width: 639px) { .hq-ai-figures { grid-template-columns: 1fr 1fr; } .hq-ai-figures > div:last-child { grid-column: 1 / -1; } }

  .hq-ai-history { display: grid; gap: 14px; }
  .hq-ai-chart { position: relative; padding-top: 22px; }
  .hq-ai-chart__top { position: absolute; top: 0; left: 0; font-size: 11.5px; font-weight: 650; color: var(--text-subtle); }
  .hq-ai-chart__svg { display: block; width: 100%; height: 190px; overflow: visible; }
  .hq-ai-chart__grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 4; }
  .hq-ai-chart__bar { fill: var(--orange); }
  .hq-ai-chart__bar--estimate { fill: rgb(var(--orange-rgb) / 0.35); }
  .hq-ai-chart g:hover .hq-ai-chart__bar { fill: var(--orange-300); }
  .hq-ai-chart__axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11.5px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
  .hq-ai-days summary { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; color: var(--text-muted); cursor: pointer; list-style: none; }
  .hq-ai-days summary::-webkit-details-marker { display: none; }
  .hq-ai-days summary .icon { width: 16px; height: 16px; color: var(--orange-300); }
  .hq-ai-days[open] summary { margin-bottom: 10px; color: var(--text); }

  /* Three equal sections, then two of the same height. */
  .hq-ai-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; margin-bottom: 34px; }
  .hq-ai-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; margin-bottom: 34px; }
  .hq-ai-mini { display: flex; flex-direction: column; gap: 14px; }
  .hq-ai-mini__head { position: relative; z-index: 4; display: flex; align-items: center; gap: 10px; }
  .hq-ai-mini__head .hq-tc-info { margin-left: auto; }
  .hq-ai-mini__head .hq-info__panel { right: 0; left: auto; }
  .hq-ai-mini__head .hq-rep-section__count { margin-left: auto; }
  .hq-ai-mini__icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-ai-mini__icon .icon { width: 17px; height: 17px; }
  .hq-ai-mini__title { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
  .hq-ai-trio .hq-ai-mini { height: 440px; }
  .hq-ai-rank { flex: 1; display: block; min-height: 0; margin: 0 -6px; padding: 0 6px; overflow-y: auto; list-style: none; scrollbar-width: thin; }
  .hq-ai-rank > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
  .hq-ai-rank > li:first-child { border-top: 0; padding-top: 2px; }
  .hq-ai-rank__main { display: grid; min-width: 0; }
  .hq-ai-rank__name { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
  .hq-ai-rank__name--mono, .hq-ai-mono { font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; }
  .hq-ai-rank__key { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11.5px; color: var(--text-subtle); overflow-wrap: anywhere; }
  .hq-ai-rank__value { display: grid; justify-items: end; font-family: var(--font-display); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .hq-ai-rank__value small { font-size: 11px; font-weight: 550; color: var(--text-subtle); }
  .hq-ai-rank__meta { grid-column: 1 / -1; font-size: 12px; color: var(--text-subtle); }
  @media (max-width: 1099px) { .hq-ai-trio { grid-template-columns: 1fr; } .hq-ai-trio .hq-ai-mini { height: auto; max-height: 440px; } }
  @media (max-width: 899px) { .hq-ai-pair { grid-template-columns: 1fr; } }

  .hq-ai-ledger td, .hq-ai-ledger th { vertical-align: top; }
  .hq-ai-row-info .hq-info__panel { right: 0; left: auto; width: min(440px, 80vw); }
  .hq-ai-facts { display: grid; gap: 8px; margin: 0; }
  .hq-ai-facts > div { display: grid; grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.4fr); gap: 4px 12px; font-size: 13px; }
  .hq-ai-facts dt { color: var(--text-subtle); font-weight: 600; }
  .hq-ai-facts dd { margin: 0; overflow-wrap: anywhere; }
  .hq-ai-facts dd small { color: var(--text-subtle); }
  .hq-ai-facts--rows { gap: 0; }
  .hq-ai-facts--rows > div { padding: 9px 0; border-top: 1px solid var(--line-soft); }
  .hq-ai-facts--rows > div:first-child { border-top: 0; padding-top: 0; }
  .hq-ai-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
  .hq-ai-form input { width: 100%; height: 42px; padding: 0 12px; border: 0; border-radius: 12px; font: inherit; font-size: 14px; color: var(--text); background: rgb(var(--navy-rgb) / 0.6); box-shadow: inset 0 0 0 1px var(--line); }
  .hq-ai-form input:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgb(var(--orange-rgb) / 0.7), 0 0 0 3px rgb(var(--orange-rgb) / 0.18); }
  .hq-ai-form__foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .hq-ai-form__foot .hq-rep-stat__note { margin: 0; }
  .hq-ai-form__foot .hq-key { margin-left: auto; }
  @media (max-width: 639px) { .hq-ai-form { grid-template-columns: 1fr; } }

  .hq-ai-events { flex: 1; display: block; min-height: 0; margin: 0; padding: 0; list-style: none; overflow-y: auto; }
  .hq-ai-events > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
  .hq-ai-events > li:first-child { border-top: 0; padding-top: 0; }
  .hq-ai-events__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); transform: translateY(-1px); }
  .hq-ai-events__dot.is-change { background: var(--blue-300); }
  .hq-ai-events__time { font-size: 12px; color: var(--text-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
}

@layer materials {
  /* An imported workbook and the upload page. */
  .hq-sys-pagehead__title { display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
  .hq-sys-pagehead__row > .hq-tc-info .hq-info__panel { right: 0; left: auto; }
  .hq-sys-file-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 11px; color: var(--orange-300); background: rgb(var(--orange-rgb) / 0.12); }
  .hq-sys-file-icon .icon { width: 19px; height: 19px; }
  .hq-sys-decision { position: relative; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-bottom: 26px; padding: 18px 20px; border-radius: 20px; background: var(--pearl-surface); color: var(--pearl-ink); box-shadow: var(--pearl-rim), inset 0 -2px 0 rgb(var(--orange-rgb) / 0.6), 0 12px 30px -14px rgba(0, 0, 0, 0.8); }
  .hq-sys-decision__text { flex: 1 1 380px; min-width: 0; }
  .hq-sys-decision__title { margin: 0 0 4px; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
  .hq-sys-decision__text p { margin: 0; font-size: 13.5px; color: rgb(var(--navy-rgb) / 0.72); }
  .hq-sys-decision__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
  .hq-sys-decision .hq-button--ghost { color: var(--pearl-ink); box-shadow: inset 0 0 0 1px rgb(var(--navy-rgb) / 0.2); }
  .hq-sys-decision .hq-info__panel { right: 0; left: auto; }
  .hq-sys-state { display: flex; align-items: center; gap: 10px; margin: 0 0 26px; padding: 12px 16px; border-radius: 14px; font-size: 14px; color: var(--text-muted); background: var(--glass-1); box-shadow: inset 0 0 0 1px var(--line); }
  .hq-sys-state .icon { flex: none; width: 17px; height: 17px; color: var(--orange-300); }
  .hq-sys-records { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  @media (max-width: 1099px) { .hq-sys-records { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  @media (max-width: 639px) { .hq-sys-records { grid-template-columns: 1fr 1fr; } }
  .hq-sys-single { grid-template-columns: 1fr; }
  .hq-ai-pair .hq-ai-mini__head .hq-sys-pill:first-of-type { margin-left: auto; }
  .hq-ai-pair .hq-ai-mini__head .hq-sys-pill ~ .hq-tc-info { margin-left: 0; }
  .hq-sys-subhead { margin: 4px 0 -4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-subtle); }
  .hq-sys-findings { display: grid; margin: 0; padding: 0; list-style: none; }
  .hq-sys-findings > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 4px 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
  .hq-sys-findings > li:first-child { border-top: 0; }
  .hq-sys-findings > li > strong { font-variant-numeric: tabular-nums; }
  .hq-sys-findings .source-ref { grid-column: 2 / -1; font-size: 12px; color: var(--text-subtle); }
  .hq-sys-findings__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-300); transform: translateY(-1px); }
  .hq-sys-findings .is-error .hq-sys-findings__dot { background: rgb(var(--red-rgb)); }
  .hq-sys-findings .is-warning .hq-sys-findings__dot { background: var(--orange); }
  .hq-sys-findings .is-ok .hq-sys-findings__dot { background: rgb(var(--green-rgb)); }
  .hq-sys-changed { color: var(--orange-300) !important; }
  .hq-sys-reviews { display: grid; gap: 18px; margin-bottom: 34px; }
  .hq-sys-upload { max-width: 760px; }
  .hq-sys-upload__form { display: grid; gap: 14px; }
  .hq-sys-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 22px; border-radius: 16px; cursor: pointer; background: rgb(var(--navy-rgb) / 0.5); box-shadow: inset 0 0 0 1px var(--line); outline: 1px dashed rgb(var(--orange-rgb) / 0.45); outline-offset: -8px; }
  .hq-sys-drop__label { font-weight: 650; }
  .hq-sys-drop input[type="file"] { flex: 1 1 260px; min-width: 0; font: inherit; font-size: 13.5px; color: var(--text-muted); }
  .hq-sys-drop input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 14px; border: 0; border-radius: 10px; font: inherit; font-weight: 650; color: var(--text); background: rgb(var(--fg-rgb) / 0.1); cursor: pointer; }

  /* KARNET page (employees/karnet.html): one card per active project. */
  .hq-kpage__controls { align-items: center; }
  .hq-kpage__range { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-muted); }
  .hq-kpage__card { margin-bottom: 18px; }
  .hq-kpage__tabs { margin-bottom: 18px; }
  .hq-kpage__tabs .hq-tc-tabs__list { overflow-x: auto; scrollbar-width: none; }
  .hq-kpage__tabs .hq-tc-tabs__item { white-space: nowrap; }
  .hq-kpage__head { flex-wrap: wrap; align-items: center; row-gap: 6px; }
  .hq-kpage__code { display: inline-grid; place-items: center; height: 24px; padding: 0 9px; border-radius: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.22); }
  .hq-kpage__head .hq-card__title a { color: var(--text); text-decoration: none; }
  .hq-kpage__head .hq-card__title a:hover { color: var(--blue-300); }
  .hq-kpage__meta { margin-left: auto; font-variant-numeric: tabular-nums; }
  .hq-kpage__meta strong { font-weight: 650; color: var(--text); }
  .hq-kpage__empty { display: flex; align-items: center; gap: 10px; margin: 2px 0 0; font-size: 13.5px; color: var(--text-subtle); }
  .hq-kpage__empty .icon { flex: none; width: 16px; height: 16px; }
  .hq-kpage__grid { min-width: 720px; }
  .hq-kpage__grid .hq-kpage__id { width: 76px; padding-left: 8px; text-align: left; font-size: 12px; font-weight: 650; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--text-subtle); white-space: nowrap; }
  .hq-kpage__grid thead .hq-kpage__id { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
  .hq-kpage__grid .hq-kgrid__label { width: 210px; padding-left: 4px; }
  .hq-kpage__grid .hq-kgrid__total { width: 58px; }
  .hq-kpage__grid tbody tr > *, .hq-kpage__grid tfoot tr > * { height: 38px; }
  .hq-kpage__grid :is(td, th).is-weekend:not(.is-today) { background-color: rgb(var(--fg-rgb) / 0.025); }
  .hq-kpage__grid tfoot td.is-today { border-radius: 0 0 12px 12px; background: rgb(var(--blue-rgb) / 0.14); color: var(--blue-300); }
  .hq-kpage__grid tfoot .hq-kgrid__sum { color: var(--text-muted); }
  .hq-kpage__grid--month { min-width: calc(270px + var(--kdays, 31) * 24px); font-size: 12.5px; }
  .hq-kpage__grid--month .hq-kpage__id { width: 60px; }
  .hq-kpage__grid--month .hq-kgrid__label { width: 162px; }
  .hq-kpage__grid--month .hq-kgrid__total { width: 48px; }
  .hq-kpage__grid--month th, .hq-kpage__grid--month td { padding-inline: 1px; }
  .hq-kpage__grid--month .hq-kpage__id, .hq-kpage__grid--month .hq-kgrid__label { padding-left: 8px; }
  .hq-kpage__grid--month .hq-kgrid__dow { font-size: 9.5px; letter-spacing: 0.02em; }
  .hq-kpage__grid--month .hq-kgrid__date { font-size: 13.5px; }
  .hq-kpage__grid--month .hq-kgrid__day.is-today { border-radius: 9px 9px 0 0; }
  .hq-kpage__grid--month tfoot td.is-today { border-radius: 0 0 9px 9px; }
  .hq-kpage__grid--month .hq-kmark { width: 20px; height: 20px; border-radius: 6px; }
  .hq-kpage__grid--month .hq-kmark .icon { width: 12px; height: 12px; }
  .hq-kpage__grid--month .hq-kmark--x { font-size: 13px; }
  .hq-kpage__legend { margin: 4px 0 0; }
  .hq-kpage__hidden { margin-left: auto; }
  .hq-kpage__grid .hq-kpage__subcode { display: none; }
  @media (max-width: 639px) {
    .hq-kpage__meta { margin-left: 0; flex-basis: 100%; }
    /* Phones: the code moves under the name, which stays in view while the days scroll. */
    .hq-kpage__grid .hq-kpage__id { display: none; }
    .hq-kpage__grid .hq-kpage__subcode { display: block; }
    .hq-kpage__grid .hq-kgrid__label, .hq-kpage__grid--month .hq-kgrid__label { position: sticky; left: 0; z-index: 1; width: 132px; padding-left: 8px; background: var(--surface-solid); box-shadow: 1px 0 0 var(--line); }
    .hq-kpage__card .hq-karnet__scroll { margin: 0; padding: 0; }
    .hq-kpage__grid { min-width: 560px; }
    .hq-kpage__grid--month { min-width: calc(180px + var(--kdays, 31) * 24px); }
  }
}

/* Key indicator strips: every figure on the same line, whatever the length
   of the note under it (a two-line note no longer pushes the rows apart). */
@layer materials {
  .hq-pulse__item { grid-template-rows: auto auto 1fr; align-content: start; }
  .hq-pulse__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-pulse__note { align-self: start; }
}

/* ------------------------------------------------------------------ */
/* Drop-down lists and date fields everywhere (select.js, datepicker.js) */
/* ------------------------------------------------------------------ */
@layer materials {
  /* Every single-choice list: no system arrow; ETC HQ's chevron instead. */
  select:not([multiple]):not([size]) {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 38px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8ba1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px 16px !important;
    text-overflow: ellipsis;
    cursor: pointer;
  }
  select:not([multiple]):not([size]):hover { border-color: rgb(var(--blue-rgb) / 0.45); }
  select.is-open { border-color: var(--blue-500) !important; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 3px rgb(var(--blue-rgb) / 0.22) !important; }
  select:disabled { cursor: not-allowed; opacity: 0.6; }

  /* The list: a pearl panel over the page, as the Home month menu. */
  .hq-listbox {
    position: fixed;
    z-index: 90;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    border-radius: 14px;
    font-family: var(--font-sans);
    color: var(--pearl-ink);
    background: var(--pearl-grain-faint), var(--pearl-surface), var(--pearl-solid);
    box-shadow: var(--pearl-rim), 0 2px 4px rgba(0, 0, 0, 0.3), 0 30px 60px -20px rgba(0, 0, 0, 0.8);
    transform-origin: top left;
    animation: hq-listbox-in 160ms var(--ease-out);
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--navy-rgb) / 0.25) transparent;
  }
  .hq-listbox.is-up { transform-origin: bottom left; }
  .hq-listbox:focus { outline: none; }
  @keyframes hq-listbox-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
  .hq-listbox.is-up { animation-name: hq-listbox-in-up; }
  @keyframes hq-listbox-in-up { from { opacity: 0; transform: translateY(4px) scale(0.98); } }
  @media (prefers-reduced-motion: reduce) { .hq-listbox { animation: none; } }
  .hq-listbox__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--pearl-ink-muted);
    cursor: pointer;
    user-select: none;
  }
  .hq-listbox__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hq-listbox__option.is-active { color: var(--pearl-ink); background: rgb(var(--navy-rgb) / 0.07); }
  .hq-listbox__option.is-selected { color: var(--pearl-ink); background: rgb(var(--blue-rgb) / 0.12); box-shadow: inset 0 0 0 1px rgb(var(--blue-rgb) / 0.22); }
  .hq-listbox__option.is-selected.is-active { background: rgb(var(--blue-rgb) / 0.18); }
  .hq-listbox__option .icon { flex: none; width: 16px; height: 16px; color: var(--pearl-ink-blue); }
  .hq-listbox__option.is-disabled { color: var(--pearl-ink-subtle); cursor: default; opacity: 0.6; }
  .hq-listbox__group { padding: 10px 12px 4px; font-size: 11px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pearl-ink-subtle); }
  .hq-listbox__group ~ .hq-listbox__option { padding-left: 18px; }

  /* Date fields outside forms (filters): the typed field keeps the width
     and look of the field it replaces, with the calendar key inside it. */
  .hq-date { display: block; flex: 1 1 auto; min-width: 140px; }
  .hq-date .hq-date__input { width: 100%; min-width: 0; padding-right: 40px !important; font-variant-numeric: tabular-nums; }
  .hq-date__button { width: 30px; height: 30px; right: 5px; }
  .hq-date__button:disabled { cursor: not-allowed; opacity: 0.5; }
  .hq-date .hq-date__button { color: var(--blue-300); background: rgb(var(--blue-rgb) / 0.14); }
}

/* ------------------------------------------------------------------ */
/* Home: result by month (hq/components/year_results.html)             */
/* ------------------------------------------------------------------ */
@layer materials {
  .hq-yr__best { margin: -4px 0 14px; font-size: 13px; color: var(--text-subtle); }
  .hq-yr__best strong { color: var(--text-muted); font-weight: 650; }
  .hq-yr__best-value { margin-left: 4px; font-family: var(--font-display); font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
  .hq-yr__chart { --plot: 230px; --axis: 52px; position: relative; height: calc(var(--plot) + 30px); padding-left: var(--axis); }
  .hq-yr__grid { position: absolute; inset: 0 0 30px var(--axis); pointer-events: none; }
  .hq-yr__line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed rgb(var(--fg-rgb) / 0.08); }
  .hq-yr__tick { position: absolute; right: calc(100% + 10px); top: 0; transform: translateY(-50%); font-size: 11px; font-weight: 600; color: var(--text-subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .hq-yr__zero { position: absolute; left: 0; right: 0; top: var(--zero); height: 0; border-top: 1px solid rgb(var(--fg-rgb) / 0.28); }
  .hq-yr__cols { position: relative; display: flex; height: 100%; margin: 0; padding: 0; list-style: none; }
  .hq-yr__col { position: relative; flex: 1 1 0; min-width: 0; display: grid; grid-template-rows: var(--plot) 30px; border-radius: 12px; outline: none; cursor: default; transition: background-color var(--dur-fast) var(--ease-out); }
  .hq-yr__col:hover, .hq-yr__col:focus-visible { background: linear-gradient(180deg, rgb(var(--fg-rgb) / 0.0), rgb(var(--fg-rgb) / 0.045) 30%, rgb(var(--fg-rgb) / 0.045)); }
  .hq-yr__col:focus-visible { box-shadow: inset 0 0 0 1.5px rgb(var(--blue-rgb) / 0.6); }
  .hq-yr__plot { position: relative; }
  .hq-yr__bar {
    --tone-rgb: var(--green-rgb);
    position: absolute;
    left: 50%;
    bottom: calc(100% - var(--zero));
    width: min(58%, 64px);
    height: var(--h);
    min-height: 3px;
    border-radius: 10px 10px 3px 3px;
    background: linear-gradient(180deg, rgb(var(--tone-rgb) / 0.95), rgb(var(--tone-rgb) / 0.42));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgb(var(--tone-rgb) / 0.5);
    opacity: 0.72;
    transform: translateX(-50%);
    transform-origin: 50% 100%;
    transition: opacity var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
  }
  .hq-yr__col.is-negative .hq-yr__bar {
    --tone-rgb: var(--red-rgb);
    top: var(--zero);
    bottom: auto;
    border-radius: 3px 3px 10px 10px;
    background: linear-gradient(0deg, rgb(var(--tone-rgb) / 0.95), rgb(var(--tone-rgb) / 0.42));
    transform-origin: 50% 0;
  }
  .hq-yr__col.is-current .hq-yr__bar,
  .hq-yr__col:is(:hover, :focus-visible) .hq-yr__bar { opacity: 1; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 0 0 1px rgb(var(--tone-rgb) / 0.7), 0 0 22px -4px rgb(var(--tone-rgb) / 0.55); }
  .hq-yr__value { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); font-size: 11.5px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .hq-yr__col.is-negative .hq-yr__value { top: calc(100% + 6px); bottom: auto; color: var(--red); }
  .hq-yr__col.is-current .hq-yr__value { color: var(--text); }
  .hq-yr__label { align-self: center; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-subtle); }
  .hq-yr__col.is-current .hq-yr__label { color: var(--text); font-weight: 750; }
  .hq-yr__col.is-current .hq-yr__label::after { content: ""; display: block; width: 18px; height: 2px; margin: 3px auto 0; border-radius: 2px; background: var(--blue-400); }

  /* The month's exact figures: a pearl card above the month. */
  .hq-yr__tip {
    position: absolute;
    z-index: 5;
    left: 50%;
    top: 6px;
    display: grid;
    gap: 4px;
    min-width: 250px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 12.5px;
    color: var(--pearl-ink);
    background: var(--pearl-grain-faint), var(--pearl-surface), var(--pearl-solid);
    box-shadow: var(--pearl-rim), 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 48px -16px rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), visibility 0s linear var(--dur-fast);
  }
  .hq-yr__col:first-child .hq-yr__tip, .hq-yr__col:nth-child(2) .hq-yr__tip { left: 0; transform: translate(0, 4px); }
  .hq-yr__col:last-child .hq-yr__tip, .hq-yr__col:nth-last-child(2) .hq-yr__tip { left: auto; right: 0; transform: translate(0, 4px); }
  .hq-yr__col:is(:hover, :focus-visible) .hq-yr__tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
  .hq-yr__col:is(:first-child, :nth-child(2), :last-child, :nth-last-child(2)):is(:hover, :focus-visible) .hq-yr__tip { transform: none; }
  .hq-yr__tip-month { font-size: 11px; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pearl-ink-subtle); }
  .hq-yr__tip-result { margin-bottom: 4px; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--pearl-ink-green); }
  .hq-yr__col.is-negative .hq-yr__tip-result { color: var(--pearl-ink-error); }
  .hq-yr__tip-row > span { white-space: nowrap; }
  .hq-yr__tip-row { display: flex; justify-content: space-between; gap: 16px; padding-top: 4px; border-top: 1px solid rgb(var(--navy-rgb) / 0.08); color: var(--pearl-ink-muted); }
  .hq-yr__tip-row strong { font-weight: 700; color: var(--pearl-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

  @media (prefers-reduced-motion: no-preference) {
    .hq-yr__bar { animation: hq-yr-grow 700ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
  }
  @keyframes hq-yr-grow { from { transform: translateX(-50%) scaleY(0); } }
  @media (max-width: 767px) {
    .hq-yr__chart { --plot: 190px; --axis: 40px; }
    .hq-yr__value { display: none; }
    .hq-yr__bar { width: min(64%, 28px); border-radius: 6px 6px 2px 2px; }
    .hq-yr__tip { min-width: 190px; }
  }
}

/* ------------------------------------------------------------------ */
/* Notices (ui/components/toasts.html): float over the page, top right  */
/* under the profile on desktop, above the tab bar on phones.           */
/* ------------------------------------------------------------------ */
@layer materials {
  .hq-toasts {
    position: fixed;
    z-index: 95;
    right: var(--gutter);
    bottom: calc(var(--tabbar, 64px) + 14px + env(safe-area-inset-bottom));
    left: var(--gutter);
    display: grid;
    gap: 10px;
    justify-items: end;
    pointer-events: none;
  }
  @media (min-width: 1024px) {
    .hq-toasts {
      top: calc(var(--bar-top, 14px) + var(--bar-h, 60px) + 12px);
      bottom: auto;
      left: auto;
      right: calc(max(0px, (100% - var(--nav-w, 0px) - 1520px) / 2) + var(--gutter));
      width: min(420px, calc(100vw - 2 * var(--gutter)));
    }
  }
  .hq-toast {
    --tone-rgb: var(--blue-rgb);
    --tone-ink: var(--pearl-ink-blue);
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 12px;
    width: min(420px, 100%);
    padding: 12px 10px 12px 12px;
    overflow: hidden;
    border-radius: 16px;
    color: var(--pearl-ink);
    background: var(--pearl-grain-faint), var(--pearl-surface), var(--pearl-solid);
    box-shadow: var(--pearl-rim), 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 50px -18px rgba(0, 0, 0, 0.85);
    pointer-events: auto;
    animation: hq-toast-in 420ms var(--ease-out) both;
  }
  .hq-toast--success { --tone-rgb: var(--green-rgb); --tone-ink: var(--pearl-ink-green); }
  .hq-toast--warning { --tone-rgb: var(--orange-rgb); --tone-ink: var(--pearl-ink-orange); }
  .hq-toast--error { --tone-rgb: var(--red-rgb); --tone-ink: var(--pearl-ink-error); }
  .hq-toast__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: var(--tone-ink);
    background: rgb(var(--tone-rgb) / 0.16);
    box-shadow: inset 0 0 0 1px rgb(var(--tone-rgb) / 0.28);
  }
  .hq-toast__icon .icon { width: 18px; height: 18px; }
  .hq-toast__text { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
  .hq-toast__text .source-ref { color: var(--pearl-ink-muted); }
  .hq-toast__close {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: var(--pearl-ink-subtle);
    background: transparent;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  }
  .hq-toast__close .icon { width: 16px; height: 16px; }
  .hq-toast__close:hover { color: var(--pearl-ink); background: rgb(var(--navy-rgb) / 0.08); }
  .hq-toast__close:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }
  /* The time left before it leaves, as a hairline along the bottom. */
  .hq-toast__timer { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgb(var(--tone-rgb) / 0.75); transform-origin: left; animation: hq-toast-timer var(--life, 6000ms) linear forwards; }
  .hq-toast.is-paused .hq-toast__timer { animation-play-state: paused; }
  .hq-toast.is-leaving { animation: hq-toast-out 280ms var(--ease-in-out, ease-in) forwards; }
  @keyframes hq-toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.97); } }
  @keyframes hq-toast-out { to { opacity: 0; transform: translateX(16px) scale(0.98); } }
  @keyframes hq-toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
  @media (max-width: 1023px) { @keyframes hq-toast-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } } }
  @media (prefers-reduced-motion: reduce) { .hq-toast, .hq-toast.is-leaving { animation: none; } .hq-toast__timer { animation: none; display: none; } }

  /* Sidebar foot: the Django administration sits just above the profile,
     and the profile is the top bar's pill, its menu opening upwards. */
  .hq-sidebar__admin { flex: none; margin-top: auto; }
  .hq-sidebar__foot { position: relative; }
  .hq-sidebar__foot .hq-account--side { position: static; flex: 1; min-width: 0; }
  .hq-account--side .hq-account__button.hq-profile { max-width: 100%; }
  .hq-account--side .hq-profile__text { max-width: 112px; }
  .hq-account--side .hq-account__panel { top: auto; bottom: calc(100% + 10px); left: 0; right: 0; width: auto; transform-origin: bottom left; }
  .hq-rail .hq-sidebar .hq-account--side .hq-profile__text,
  .hq-rail .hq-sidebar .hq-account--side .hq-profile__chevron { display: none; }
  .hq-rail .hq-sidebar .hq-account--side { flex: none; }
  /* Collapsed rail: the menu opens beside the rail, at full width. */
  .hq-rail .hq-sidebar:has(.hq-account--side[open]) { overflow: visible; z-index: 40; }
  .hq-rail .hq-account--side .hq-account__panel { left: calc(100% + 16px); right: auto; bottom: 0; width: min(300px, calc(100vw - 120px)); transform-origin: bottom left; }
  .hq-rail .hq-sidebar .hq-account--side .hq-account__button.hq-profile { gap: 0; padding: 4px; }
}

/* ------------------------------------------------------------------ */
/* TESLA Voice: his answers in the chat                                */
/* ------------------------------------------------------------------ */
@layer materials {
  /* Messages: one portrait in the header is enough, none beside each answer. */
  .hq-ask__log .hq-chat__msg--tesla .hq-chat__bubble { max-width: min(100%, 760px); }
}
