/* =============================================================================
   UPBI Hub Tracker — foundation: design tokens, app shell, primitives

   VISUAL SYSTEM
     Ported from the main UPBI dashboard so the Hub reads as the same product.
     See UPBI-VISUAL-PARITY-AUDIT.md §3 (tokens), §4 (components), §9 (the 38-row
     differences table this file implements).

     The identity is UPBI navy #071d33/#0b2b4a with a TEAL accent #0d9488 — NOT
     Notre Dame navy + gold, which is a different institution's palette and appears
     nowhere in the dashboard. Every --nd-* token and every gold rule was retired.

   CSP
     No style="" attribute, no element.style.*: the Content-Security-Policy carries
     no 'unsafe-inline'. Computed widths use the .hub-w-* utilities at the end.
   ============================================================================= */

/* ---------------------------------------------------------------- tokens ---- */
:root {
  /* Brand — UPBI */
  --navy:        #071d33;
  --navy2:       #0b2b4a;
  --navy3:       #12395f;
  --accent:      #0d9488;   /* teal */
  --accent-2:    #0f766e;
  --accent-bg:   #ccfbf1;
  --mint:        #5eead4;   /* the selected-rail marker; only ever on navy */

  /* Neutrals */
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --canvas:      #f1f5f9;
  --border:      #e2e8f0;
  --border2:     #cbd5e1;
  --text:        #0f172a;
  --text2:       #475569;
  --text3:       #64748b;

  /* Status */
  --ok:      #0d9488;  --ok-bg:   #ccfbf1;  --ok-br:   #5eead4;
  --info:    #1d4ed8;  --info-bg: #dbeafe;  --info-br: #93c5fd;
  --warn:    #b45309;  --warn-bg: #fef3c7;  --warn-br: #fcd34d;
  --danger:  #b91c1c;  --danger-bg:#fee2e2; --danger-br:#fca5a5;

  /* Legacy aliases — hub-operations.css was written against these names. */
  --line:   var(--border);
  --line-2: #eef2f6;
  --card:   var(--surface);
  --bg:     var(--canvas);
  --ink:    var(--text);
  --ink-2:  var(--text2);
  --ink-3:  var(--text3);
  --canvas-2: var(--surface2);
  --teal:   var(--accent);
  --teal-100: var(--accent-bg);
  --red:    var(--danger);
  --red-100: var(--danger-bg);
  --amber:  var(--warn);
  --amber-100: var(--warn-bg);

  /* Type. The main dashboard's stack, loaded the same way it loads it (a Google
     Fonts <link>, permitted by the CSP for exactly those two hosts): Inter for UI
     and body, Manrope for headings and numerals. The fallbacks match the
     dashboard's own ('Inter',system-ui,sans-serif). Numerals are always tabular. */
  --font: 'Inter', system-ui, sans-serif;
  --font-num: 'Manrope', system-ui, sans-serif;
  --font-head: 'Manrope', system-ui, sans-serif;

  /* Space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  /* Shape — raised from 3–5px, the main reason the Hub read as an admin template */
  --r-sm: 6px; --r: 10px; --r-lg: 16px; --r-panel: 22px; --r-pill: 999px;
  --shadow:    0 10px 28px rgba(15, 23, 42, .06);
  --shadow-lg: 0 16px 42px rgba(15, 23, 42, .07);
  --shadow-xl: 0 24px 70px rgba(0, 0, 0, .40);
  --focus-ring: 0 0 0 3px rgba(13, 148, 136, .16);

  --rail-w: 236px;
  --topbar-h: 68px;

  /* ---- COMPATIBILITY LAYER ----------------------------------------------
     hub-operations.css still consumes an older token vocabulary across ~180
     screen-component rules. Rather than touch every one of them (and risk
     silently changing a screen nobody re-reviewed), the old names are mapped
     onto the new palette here, in one place. Anything named --nd-* is a Notre
     Dame token that no longer exists on its own terms — it now resolves to the
     UPBI equivalent, so no rule renders unstyled and no gold survives.
     New CSS should use the tokens above; these exist to be deleted later. */
  --fs-xs:  11px;  --fs-sm:  12px;  --fs-md:  13px;
  --fs-lg:  15px;  --fs-xl:  19px;  --fs-2xl: 24px;
  --nd-navy:     var(--navy);
  --nd-navy-700: var(--navy2);
  --nd-navy-300: var(--border2);
  --nd-gold:     var(--accent);   /* gold is not a UPBI colour; teal is the accent */
}

/* ---------------------------------------------------------------- reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0; padding: 0;
  font-family: var(--font);
  font-size: 14px; line-height: 1.55;
  color: var(--text); background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-head); font-weight: 700; letter-spacing: -.025em; color: var(--text); }
h1 { font-size: 24px; } h2 { font-size: 24px; } h3 { font-size: 19px; } h4 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent-2); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

/* The UA applies `hidden` at display:none, but an author rule such as
   .ht-app{display:flex} outranks it. Without this, a hidden surface paints. */
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid rgba(13, 148, 136, .28); outline-offset: 2px; }
/* On the navy rail the teal ring disappears; mint is the readable equivalent. */
.ht-rail :focus-visible { outline: 2px solid rgba(94, 234, 212, .75); outline-offset: 2px; }

.ht-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ht-noscript {
  max-width: 460px; margin: 12vh auto; padding: var(--s7);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); text-align: center;
}

/* ---------------------------------------------------------------- brand ----- */
/* The real UPBI lockup. It is an opaque blue plate with its own rounded corners —
   never give it a background, ring or shadow. Ratio 1.83:1. The <span> is the
   text fallback for a missing file and is hidden whenever the image is present. */
.ht-brand-logo { display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; height: 34px; width: auto; overflow: hidden; }
.ht-brand-logo img { height: 100%; width: auto; object-fit: contain; display: block; }
.ht-brand-logo > span { display: none; font-weight: 800; letter-spacing: .04em; color: #fff; }
/* If the image fails, :has() lets the text stand in without any inline handler. */
@supports selector(:has(*)) {
  .ht-brand-logo:not(:has(img)) > span { display: inline; }
}
.ht-brand-logo-md { height: 44px; }
.ht-brand-logo-lg { height: 58px; }

.ht-brand { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.ht-brand-text {
  font-size: 13px; font-weight: 700; letter-spacing: .01em; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- boot ------ */
/* Shown only while <body class="ht-booting">. Before this the Hub painted a blank
   white page for as long as the session took to resolve. */
.ht-boot {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--navy), var(--navy2));
}
body:not(.ht-booting) .ht-boot { display: none; }
.ht-boot-card {
  text-align: center; padding: var(--s8) var(--s7);
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-xl);
  min-width: 260px;
}
.ht-boot-card .ht-brand-logo { margin: 0 auto var(--s4); }
.ht-boot-t { font-size: 17px; font-family: var(--font-head); font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.ht-boot-s { margin-top: 4px; font-size: 13px; color: var(--text2); }
.ht-boot-mark {
  display: block; width: 120px; height: 4px; margin: var(--s5) auto 0;
  border-radius: var(--r-pill); background: var(--border);
  overflow: hidden; position: relative;
}
.ht-boot-mark::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--mint));
  animation: htSlide 1.1s ease-in-out infinite;
}
@keyframes htSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.ht-boot-hint { margin-top: var(--s4); font-size: 11.5px; color: var(--text3); }

/* Nothing else paints until app.js chooses a surface. <noscript> and the boot
   screen are exempt — they are the only things a stalled load should show. */
body.ht-booting > *:not(noscript):not(.ht-boot) { visibility: hidden; }

/* ---------------------------------------------------------------- login ----- */
.ht-login {
  min-height: 100vh; display: grid; place-items: center; padding: var(--s6);
  background: linear-gradient(160deg, var(--navy), var(--navy2));
}
.ht-login-card {
  width: 100%; max-width: 408px; padding: 34px 32px;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-xl);
}
.ht-login-card .ht-brand { justify-content: center; margin-bottom: var(--s5); }
.ht-login-card h1 { text-align: center; font-size: 22px; }
.ht-login-lead { text-align: center; color: var(--text2); font-size: 13px; margin: var(--s2) 0 var(--s6); }
.ht-login-foot {
  margin: var(--s6) 0 0; padding-top: var(--s5); border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text3); text-align: center;
}
.ht-login-error {
  margin-bottom: var(--s4); padding: var(--s3) var(--s4);
  background: var(--danger-bg); border: 1px solid var(--danger-br);
  border-radius: var(--r); color: #991b1b; font-size: 13px;
}

/* ---------------------------------------------------------------- fields ---- */
.ht-field { margin-bottom: var(--s4); }
.ht-field label, .hub-label {
  display: block; margin-bottom: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3);
}
.ht-input, .hub-input, .hub-select, .hub-textarea {
  width: 100%; padding: 9px 12px; min-height: 38px;
  font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--r);
  transition: border-color .14s, box-shadow .14s;
}
.ht-input { min-height: 44px; }
.hub-textarea { min-height: 132px; resize: vertical; line-height: 1.6; }
.ht-input:focus, .hub-input:focus, .hub-select:focus, .hub-textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring);
}
.ht-input[aria-invalid="true"], .hub-input[aria-invalid="true"], .hub-textarea[aria-invalid="true"] {
  border-color: var(--danger); background: #fffafa;
}
.hub-hint { font-size: 12px; color: var(--text3); margin-top: 6px; }
.hub-field { margin-bottom: var(--s5); }

/* ---------------------------------------------------------------- buttons --- */
.ht-btn, .hub-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; min-height: 34px;
  font-family: var(--font); font-size: 12px; font-weight: 700; line-height: 1;
  color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--r);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s;
}
.ht-btn:hover, .hub-btn:hover { background: var(--surface2); border-color: var(--border2); }
.ht-btn:disabled, .hub-btn:disabled { opacity: .5; cursor: not-allowed; }
.ht-btn svg, .hub-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ht-btn-primary, .hub-btn-primary {
  background: var(--navy); border-color: var(--navy); color: #fff;
}
.ht-btn-primary:hover, .hub-btn-primary:hover { background: var(--navy2); border-color: var(--navy2); color: #fff; }
.ht-btn-primary:disabled { opacity: .55; }

/* The teal call-to-action. Replaces the retired gold accent button. */
.hub-btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.hub-btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

.hub-btn-danger { color: var(--danger); border-color: var(--danger-br); background: var(--surface); }
.hub-btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.hub-btn-quiet { border-color: transparent; background: transparent; color: var(--accent-2); }
.hub-btn-quiet:hover { background: var(--surface2); border-color: transparent; }

.hub-btn-sm { min-height: 30px; padding: 5px 11px; font-size: 11.5px; }
.ht-btn-block { width: 100%; min-height: 44px; font-size: 13px; }

/* The standard "Details / Full view" pill affordance from the dashboard. */
.pa, .hub-pa {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 5px 12px; min-height: 26px; border-radius: var(--r-pill);
  background: var(--surface2); border: 1.5px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--text2);
  cursor: pointer; transition: color .14s, border-color .14s;
}
.pa:hover, .hub-pa:hover { color: var(--navy); border-color: var(--navy); }

/* ---------------------------------------------------------------- app shell - */
.ht-app { min-height: 100vh; display: flex; background: var(--canvas); }

/* ---- navy rail ---- */
.ht-rail {
  position: fixed; top: 0; left: 0; z-index: 40;
  width: var(--rail-w); height: 100vh; flex: 0 0 var(--rail-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy), var(--navy2));
  box-shadow: 8px 0 24px rgba(7, 29, 51, .16);
}
.ht-rail-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: var(--s5) var(--s4) var(--s4);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.ht-rail-foot {
  margin-top: auto; padding: var(--s4);
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.ht-drawer-close {
  display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: 0 0 32px;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: rgba(255, 255, 255, .75); cursor: pointer;
}
.ht-drawer-close:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.ht-drawer-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; }

/* ---- nav ---- */
.ht-nav { display: flex; flex-direction: column; gap: 2px; padding: var(--s4) var(--s3); }
.ht-nav-item {
  display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left;
  padding: 9px 11px; border: 0; border-radius: var(--r);
  background: transparent; color: rgba(255, 255, 255, .70);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .14s, color .14s;
}
.ht-nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.ht-nav-ic { display: inline-flex; flex: 0 0 18px; width: 18px; height: 18px; opacity: .72; }
.ht-nav-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ht-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Selected: four signals — tinted fill, white text, inset mint bar, bright icon.
   A solid navy block (the previous treatment) reads as a dead area, not a state. */
.ht-nav-item.is-active {
  background: rgba(24, 169, 135, .20); color: #fff;
  box-shadow: inset 3px 0 0 var(--mint);
}
.ht-nav-item.is-active .ht-nav-ic { opacity: 1; color: var(--mint); }

/* ---- identity + sign out ---- */
.ht-user { display: flex; align-items: center; gap: var(--s3); min-width: 0; margin-bottom: var(--s3); }
.ht-user-av {
  display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
}
.ht-user-av svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.ht-user-id { display: flex; flex-direction: column; min-width: 0; }
.ht-user-email {
  font-size: 12px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ht-user-role { font-size: 11px; color: rgba(255, 255, 255, .58); }
.ht-user-role:empty { display: none; }
.ht-signout {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  padding: 8px; border-radius: var(--r);
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .85); font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background .14s, color .14s;
}
.ht-signout:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.ht-signout svg { width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- page column ---- */
.ht-col { flex: 1; min-width: 0; margin-left: var(--rail-w); display: flex; flex-direction: column; }

.ht-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s4);
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  padding: 0 2.2rem;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.ht-menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r);
  color: var(--text2); cursor: pointer;
}
.ht-menu-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; }

/* The live page title. One stack per destination; :has() reveals the one whose page
   is active, so it can never drift out of step with the route and no script keeps
   it in sync. .ht-tb-fb is the fallback where :has() is unsupported. */
.ht-tb-titles { flex: 1; min-width: 0; }
.ht-tb-page { display: none; flex-direction: column; min-width: 0; }
.ht-tb-fb { display: flex; }
.ht-tb-t {
  font-size: 16px; font-family: var(--font-head); font-weight: 700; letter-spacing: -.025em; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ht-tb-s {
  font-size: 12px; color: var(--text3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@supports selector(:has(*)) {
  .ht-app:has(.page.active) .ht-tb-fb { display: none; }
  .ht-app:has(#hub-home.active)          [data-tb-page="hub-home"],
  .ht-app:has(#hub-entrepreneurs.active) [data-tb-page="hub-entrepreneurs"],
  .ht-app:has(#hub-profile.active)       [data-tb-page="hub-profile"],
  .ht-app:has(#hub-new-session.active)   [data-tb-page="hub-new-session"],
  .ht-app:has(#hub-sessions.active)      [data-tb-page="hub-sessions"],
  .ht-app:has(#hub-review.active)        [data-tb-page="hub-review"],
  .ht-app:has(#hub-reporting.active)     [data-tb-page="hub-reporting"] { display: flex; }
}
.ht-scrim { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(7, 29, 51, .48); }

.ht-main { flex: 1; min-width: 0; padding: 2rem 2.2rem 4rem; }
.ht-main .page { display: none; }
.ht-main .page.active { display: block; }
.ht-main .content { max-width: min(1480px, 100%); margin: 0 auto; }
/* A wide table must scroll INSIDE .hub-table-wrap, never widen the page. Without an
   explicit min-width:0 the flex/grid chain lets the table's intrinsic width win and the
   whole document gains a horizontal scrollbar. */
.ht-main .page, .ht-main .content, .hub-shell, .hub-shell-body { min-width: 0; }
.hub-table-wrap { max-width: 100%; }

/* ---------------------------------------------------------------- page head - */
.hub-page-header { margin-bottom: 1.5rem; }
.hub-page-header h2 { font-size: 24px; letter-spacing: -.02em; }
.hub-shell-desc, .hub-page-sub { margin-top: 5px; color: var(--text2); font-size: 13px; max-width: 72ch; }
.hub-shell-desc:empty { display: none; }
.hub-page-bar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s5); flex-wrap: wrap; margin-bottom: 1.5rem;
}
.hub-page-bar .hub-page-header { margin-bottom: 0; }

.hub-section { margin-bottom: var(--s7); }
.hub-section:last-child { margin-bottom: 0; }
.hub-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4);
}
.hub-section-head h3 { font-size: 19px; }
.hub-section-note { font-size: 12px; color: var(--text3); }
/* The teal kicker above a section title — a strong, cheap brand cue. */
.hub-kicker {
  display: block; margin-bottom: 4px;
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
}

/* ---------------------------------------------------------------- cards ----- */
.hub-card {
  background: var(--surface); border: 0; border-radius: var(--r-panel);
  box-shadow: var(--shadow-lg); padding: var(--s5) var(--s6);
}
.hub-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap;
  margin: calc(var(--s5) * -1) calc(var(--s6) * -1) var(--s5);
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, #fff, #fbfdff);
  border-bottom: 1px solid rgba(226, 232, 240, .7);
  border-radius: var(--r-panel) var(--r-panel) 0 0;
}
.hub-card-title { font-size: 13px; font-family: var(--font-head); font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.hub-card-hint { font-size: 12px; color: var(--text3); }

.hub-grid { display: grid; gap: var(--s4); }
.hub-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hub-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hub-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Metric tile — top accent bar, tinted icon chip, big tabular numeral, hover lift. */
.hub-metric, .kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 0; border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: var(--s5);
  transition: transform .14s, box-shadow .14s;
}
.hub-metric:hover, .kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.hub-metric::before, .kpi::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent);
}
/* The headline metric on a card. Emphasis, not alarm — so navy, not amber. */
.hub-metric-accent::before { background: var(--navy2); }
.hub-metric-label, .kpi-l {
  font-size: 10.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text3);
}
.hub-metric-value, .kpi-v {
  display: block; margin-top: 6px;
  font-family: var(--font-num); font-size: 26px; font-weight: 700;
  letter-spacing: -.03em; line-height: 1.05; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hub-metric-sub { margin-top: 5px; font-size: 12px; color: var(--text3); }
.kpi-ic {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-bg); color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04); margin-bottom: var(--s3);
}
.kpi-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- badges ---- */
.hub-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: var(--surface2); color: var(--text2); border: 1px solid var(--border);
}
.hub-badge-neutral { background: var(--surface2); color: var(--text2); border-color: var(--border); }
.hub-badge-info    { background: var(--info-bg);  color: var(--info);  border-color: var(--info-br); }
.hub-badge-ok      { background: var(--ok-bg);    color: var(--accent-2); border-color: var(--ok-br); }
.hub-badge-warn    { background: var(--warn-bg);  color: var(--warn);  border-color: var(--warn-br); }
.hub-badge-alert   { background: var(--danger-bg);color: var(--danger);border-color: var(--danger-br); }
/* Retained name, repointed: gold is not a UPBI colour. Used for "never seen yet". */
.hub-badge-gold    { background: var(--info-bg);  color: var(--info);  border-color: var(--info-br); }
/* Status is a mark PLUS a word — never colour alone. */
.hub-badge-mark { font-size: 10px; line-height: 1; }

/* ---------------------------------------------------------------- tables ---- */
.hub-table-wrap { overflow-x: auto; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow); }
.hub-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hub-table caption { text-align: left; padding: var(--s4) var(--s5) 0; font-size: 12px; color: var(--text3); }
.hub-table th, .hub-table td { text-align: left; vertical-align: middle; }
.hub-table thead th {
  padding: 11px 14px; background: var(--surface2); color: var(--text3);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.hub-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); }
.hub-table tbody tr:last-child td { border-bottom: 0; }
.hub-table tbody tr:hover td { background: #f8fbfd; transition: background .16s ease; }
.hub-num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
/* A row's own name, as a control. It is the primary way into a record, so it gets a
   real target: WCAG 2.2 asks for 24x24 CSS px and at padding:0 these were 20px tall.
   The target grows VERTICALLY only -- an earlier -6px inline margin bled the button
   6px past its own cell and put a scrollbar under the card-collapsed table on mobile.
   max-width keeps a long name wrapping inside the cell instead of widening it. */
.hub-table-row-btn {
  border: 0; background: none; margin: 0; padding: 4px 0; min-height: 26px; max-width: 100%;
  display: inline-flex; align-items: center;
  font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; text-align: left;
}
.hub-table-row-btn:hover { color: var(--accent-2); text-decoration: underline; }

/* ---------------------------------------------------------------- states ---- */
.ht-state { min-height: 100vh; display: grid; place-items: center; padding: var(--s6); }
.hub-state-card {
  max-width: 460px; margin: 0 auto; padding: var(--s7);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  text-align: center;
}
.hub-state-ic {
  display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto var(--s4);
  border-radius: var(--r-pill); background: var(--surface2); color: var(--text2);
  font-family: var(--font-num); font-size: 17px; font-weight: 700;
}
.hub-state-card h3 { margin-bottom: 6px; }
.hub-state-card p { color: var(--text2); font-size: 13px; }

/* New-deployment notice: the main dashboard uses the same bottom-center pattern.
   It is deliberately non-modal, never forces a reload, and stays clear of app content. */
.ht-update-banner {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 10000;
  display: flex; align-items: center; gap: var(--s4);
  max-width: calc(100% - 32px); padding: 10px 12px 10px 15px;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--r);
  background: var(--navy); color: #fff;
  box-shadow: 0 12px 34px rgba(2, 6, 23, .28);
  font-size: 13px; font-weight: 600; line-height: 1.4;
}
.ht-update-message { min-width: 0; }
.ht-update-refresh {
  flex: 0 0 auto; min-height: 36px; padding: 7px 13px;
  border: 0; border-radius: var(--r-sm);
  background: #5eead4; color: #073b3a;
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.ht-update-refresh:hover { background: #99f6e4; color: #042f2e; }
.ht-update-refresh:active { transform: translateY(1px); }

/* Compact and matter-of-fact, like the dashboard's own empty rows: a line or two of
   quiet text, not a 40px-padded dashed billboard announcing the absence of data. */
.hub-empty, .hub-empty-state {
  padding: var(--s4) var(--s5); text-align: left;
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r);
}
.hub-empty h4 { margin-bottom: 3px; color: var(--text2); font-size: 13px; font-weight: 600; }
.hub-empty p { color: var(--text3); font-size: 12.5px; max-width: 62ch; margin: 0; }

.hub-status-banner {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3) var(--s4); margin-bottom: var(--s5);
  border-radius: var(--r); font-size: 13px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text2);
}
.hub-status-banner.is-info  { background: var(--info-bg);   border-color: var(--info-br);   color: #1e3a8a; }
.hub-status-banner.is-ok    { background: var(--ok-bg);     border-color: var(--ok-br);     color: #115e59; }
.hub-status-banner.is-warn  { background: var(--warn-bg);   border-color: var(--warn-br);   color: #92400e; }
.hub-status-banner.is-error { background: var(--danger-bg); border-color: var(--danger-br); color: #991b1b; }
.hub-status-ic {
  flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: rgba(15, 23, 42, .08); font-size: 11px; font-weight: 700;
}
.hub-status-label { font-weight: 700; margin-right: 5px; }

/* Skeletons — a loading table must never flash as an empty one. */
.skeleton-line, .hub-skel {
  display: block; height: 12px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------------------------------------------------------------- pager ----- */
.hub-pager {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-top: var(--s4);
}
.hub-pager-at { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- dev bar --- */
.hub-dev-banner {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s2) var(--s4); margin-bottom: var(--s5);
  background: #2a2118; color: #f3e5c4; border-radius: var(--r); font-size: 12px;
}
.hub-dev-tag { font-weight: 800; letter-spacing: .03em; }
.hub-dev-banner label { color: #d3c39c; }
.hub-dev-banner select {
  padding: 3px var(--s2); font-family: inherit; font-size: 12px;
  background: #1b1510; color: #f3e5c4; border: 1px solid #4b3d2a; border-radius: var(--r-sm);
}
.hub-dev-desc { color: #bda87c; flex: 1 1 260px; min-width: 0; }

/* ---------------------------------------------------------------- utility --- */
.hub-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.hub-row-end { justify-content: flex-end; }
.hub-stack > * + * { margin-top: var(--s3); }
.hub-muted { color: var(--text3); }
.hub-strong { font-weight: 700; color: var(--text); }
.hub-nowrap { white-space: nowrap; }
.hub-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.hub-actions-end { justify-content: flex-end; }

.hub-bar { height: 8px; border-radius: var(--r-pill); background: #edf2f7; overflow: hidden; }
.hub-bar-fill { display: block; height: 100%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), #22c55e); }
/* A SECOND series colour, for bars that are a breakdown rather than progress.
   It was amber, which is this system's warning colour: a need appearing in a
   third of someone's consultations is not a warning, and gold is not a UPBI
   colour at all. Deep navy reads as data, and amber stays meaningful. */
.hub-bar-fill.is-alt   { background: var(--navy2); }
.hub-bar-fill.is-teal  { background: var(--accent); }
.hub-bar-fill.is-amber { background: var(--warn); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .hub-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The rail becomes a drawer. app.js toggles .ht-drawer-open on <body>. */
@media (max-width: 900px) {
  .ht-rail {
    transform: translateX(-100%); transition: transform .22s ease;
    padding-top: env(safe-area-inset-top);
  }
  body.ht-drawer-open .ht-rail { transform: translateX(0); }
  body.ht-drawer-open .ht-scrim { display: block; }
  body.ht-drawer-open { overflow: hidden; }
  .ht-drawer-close { display: inline-flex; }
  .ht-menu-btn { display: inline-flex; }
  .ht-col { margin-left: 0; }
  .ht-topbar { padding: 0 1rem; }
  .ht-main { padding: 1rem 1rem 3rem; }
}

@media (max-width: 520px) {
  .ht-update-banner {
    left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
    transform: none; max-width: none;
  }
}

/* Tables become cards. Each <td> must carry data-l="Column name".
   The breakpoint is 1080px, not the dashboard's 760px, because the Hub's directory
   carries nine columns and needs ~1150px to lay out honestly. Below that it is a card
   list, which reads better than a horizontally-scrolled table nobody scrolls. */
@media (max-width: 1080px) {
  .hub-table thead { display: none; }
  .hub-table, .hub-table tbody, .hub-table tr, .hub-table td { display: block; width: 100%; }
  /* The caption must be re-declared as a block. Left as display:table-caption inside a
     parent that is no longer a table, it forms an anonymous table box and shrinks to
     fit -- on a 390px screen every caption rendered as a column of single characters
     down the left edge of the card list. */
  .hub-table caption { display: block; width: 100%; padding: 0 0 var(--s3); }
  .hub-table tr {
    margin-bottom: var(--s3); padding: var(--s3);
    border: 1px solid var(--border); border-radius: var(--r);
  }
  .hub-table td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: var(--s3); }
  .hub-table td::before {
    content: attr(data-l); flex: 0 0 auto;
    font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--text3);
  }
  .hub-table td:empty { display: none; }
  .hub-grid-2, .hub-grid-3, .hub-grid-4 { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .ht-rail, .ht-topbar, .ht-scrim, .ht-update-banner, .hub-dev-banner, .hub-actions { display: none !important; }
  .ht-col { margin-left: 0; }
  .ht-main { padding: 0; }
  .hub-card, .hub-metric, .hub-table-wrap { box-shadow: none; border: 1px solid #bbb; }
}

/* The topbar now carries the live page title AND its subtitle, so the static in-page
   <h2> that index.html ships for each page is a second copy of the same words on every
   screen. Hide the STATIC one only (it is a direct child of .hub-shell); a heading a
   module renders inside .hub-shell-body is its own content and is untouched. */
.hub-shell > .hub-page-header { display: none; }
