/* The Catalyst Hub - The Catalyst design system for the web.
   One token set; light by default, dark in neutral greys, purple on the sidebar, buttons and accents.
   Modules add their own styles in static/modules/<module>.css using these tokens only. */

/* Inter: a small Latin subset (WOFF, about 130 KB each, preloaded by base.html) is used for nearly all text; the full
   font is only fetched if a page shows a character outside the subset (the later rule wins where both apply). */
@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("fonts/InterDisplay-SemiBold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter Display"; src: url("fonts/InterDisplay-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.latin.woff") format("woff"); font-weight: 400; font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+1E00-1EFF, U+2000-20CF, U+2100-214F, U+2190-23FF, U+25A0-26FF, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.latin.woff") format("woff"); font-weight: 500; font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+1E00-1EFF, U+2000-20CF, U+2100-214F, U+2190-23FF, U+25A0-26FF, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.latin.woff") format("woff"); font-weight: 600; font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+1E00-1EFF, U+2000-20CF, U+2100-214F, U+2190-23FF, U+25A0-26FF, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.latin.woff") format("woff"); font-weight: 700; font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+1E00-1EFF, U+2000-20CF, U+2100-214F, U+2190-23FF, U+25A0-26FF, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Display"; src: url("fonts/InterDisplay-SemiBold.latin.woff") format("woff"); font-weight: 600; font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+1E00-1EFF, U+2000-20CF, U+2100-214F, U+2190-23FF, U+25A0-26FF, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Display"; src: url("fonts/InterDisplay-Bold.latin.woff") format("woff"); font-weight: 700; font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+1E00-1EFF, U+2000-20CF, U+2100-214F, U+2190-23FF, U+25A0-26FF, U+FEFF, U+FFFD; }

:root {
  /* brand */
  --purple: #3B1F73; --night: #15102A; --lavender: #D9CCFF; --violet: #6D28D9; --paper: #FAF9F7;
  --lavender-soft: #F1ECFF; --lavender-faint: #F7F4FF;

  /* surfaces and text (light) */
  --bg: var(--paper); --surface: #FFFFFF; --surface-2: #F7F5FB; --surface-3: #F0EDF6;
  --border: #E9E4F2; --border-strong: #D9D2E7;
  --text: #17132A; --text-2: #4A4560; --muted: #6E6883; --faint: #6B6580;
  --control-border: #8A84A0; --focus-ring: #6D28D9;
  --accent: var(--violet); --accent-text: #5B21B6; --accent-soft: var(--lavender-soft);
  --primary: var(--purple); --primary-hover: #2E175C; --on-primary: #FFFFFF;
  --focus: 0 0 0 3px rgba(109, 40, 217, .28);

  /* status - always shown with a word, never colour alone */
  --good: #137535; --good-soft: #E8F6EE; --warn: #A04A06; --warn-soft: #FEF3E2;
  --danger: #B91C1C; --danger-soft: #FDECEC; --info: var(--accent-text); --info-soft: var(--lavender-soft);
  --neutral: #57536B; --neutral-soft: #F0EEF4;

  /* header panel */
  --hero-bg: linear-gradient(115deg, #FFFFFF 0%, #FFFFFF 38%, #EEE7FF 100%);
  --hero-border: #E6DEFA; --watermark: rgba(59, 31, 115, .07);

  /* sidebar stays night in every theme */
  --side-bg: var(--night); --side-text: #E9E4FA; --side-muted: rgba(217, 204, 255, .62);
  --side-hover: rgba(217, 204, 255, .08); --side-active: rgba(217, 204, 255, .14); --side-line: rgba(217, 204, 255, .12);

  /* shape */
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(23, 19, 42, .04), 0 1px 1px rgba(23, 19, 42, .03);
  --shadow-2: 0 6px 24px -10px rgba(23, 19, 42, .14), 0 2px 6px rgba(23, 19, 42, .04);
  --shadow-pop: 0 24px 60px -18px rgba(21, 16, 42, .35);

  /* spacing scale (4-48) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --control-h: 40px; --lh: 1.55;
  --topbar-h: 62px; --tabbar-h: 0px; --tap: 44px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
  --side-w: 280px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Display", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

/* dark: neutral greys, purple only on sidebar, buttons and accents */
:root[data-theme="dark"] {
  --bg: #111113; --surface: #1A1A1D; --surface-2: #202024; --surface-3: #27272C;
  --border: #2B2B31; --border-strong: #3A3A42;
  --text: #EDEDF0; --text-2: #C9C9D1; --muted: #A0A0AB; --faint: #8E8E99;
  --control-border: #7A7A86; --focus-ring: #A78BFA;
  --accent: #A78BFA; --accent-text: #C4B5FD; --accent-soft: rgba(167, 139, 250, .14);
  --primary: #6D28D9; --primary-hover: #7C3AED;
  --focus: 0 0 0 3px rgba(167, 139, 250, .35);
  --good: #4ADE80; --good-soft: rgba(74, 222, 128, .12); --warn: #FBBF24; --warn-soft: rgba(251, 191, 36, .12);
  --danger: #F87171; --danger-soft: rgba(248, 113, 113, .13); --info: #C4B5FD; --info-soft: rgba(167, 139, 250, .14);
  --neutral: #B4B4BE; --neutral-soft: rgba(180, 180, 190, .12);
  --hero-bg: radial-gradient(120% 140% at 100% 0%, rgba(109, 40, 217, .20) 0%, rgba(109, 40, 217, 0) 55%), #1A1A1D;
  --hero-border: #2E2B38; --watermark: rgba(217, 204, 255, .06);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 8px 28px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #111113; --surface: #1A1A1D; --surface-2: #202024; --surface-3: #27272C;
    --border: #2B2B31; --border-strong: #3A3A42;
    --text: #EDEDF0; --text-2: #C9C9D1; --muted: #A0A0AB; --faint: #8E8E99;
  --control-border: #7A7A86; --focus-ring: #A78BFA;
    --accent: #A78BFA; --accent-text: #C4B5FD; --accent-soft: rgba(167, 139, 250, .14);
    --primary: #6D28D9; --primary-hover: #7C3AED;
    --focus: 0 0 0 3px rgba(167, 139, 250, .35);
    --good: #4ADE80; --good-soft: rgba(74, 222, 128, .12); --warn: #FBBF24; --warn-soft: rgba(251, 191, 36, .12);
    --danger: #F87171; --danger-soft: rgba(248, 113, 113, .13); --info: #C4B5FD; --info-soft: rgba(167, 139, 250, .14);
    --neutral: #B4B4BE; --neutral-soft: rgba(180, 180, 190, .12);
    --hero-bg: radial-gradient(120% 140% at 100% 0%, rgba(109, 40, 217, .20) 0%, rgba(109, 40, 217, 0) 55%), #1A1A1D;
    --hero-border: #2E2B38; --watermark: rgba(217, 204, 255, .06);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 8px 28px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14.5px/var(--lh) var(--font);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; margin: 0; color: var(--text); }
h2 { font-size: 18px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 15.5px; font-weight: 600; line-height: 1.35; }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
code, .mono { font-family: var(--font-mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s5) 0; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
html { scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px); scroll-padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); }
main:focus { outline: none; }
.skip-link { position: absolute; left: var(--s3); top: -100px; z-index: 200; padding: 10px var(--s4); border-radius: 10px; background: var(--primary);
  color: var(--on-primary); font-weight: 600; }
.skip-link:focus { top: calc(var(--s3) + var(--safe-top)); text-decoration: none; }
.icon { flex: none; vertical-align: middle; }
.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; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.stack > * + * { margin-top: var(--s4); }
.stack-sm > * + * { margin-top: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.row.tight { gap: var(--s2); } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.kicker { font: 600 11.5px/1.2 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--side-bg) 0, var(--side-bg) var(--side-w), transparent var(--side-w)); }
.sidebar { background: var(--side-bg); color: var(--side-text); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid #000; }
.sidebar-scroll { overflow-y: auto; flex: 1 1 auto; padding: 0 var(--s3) var(--s4); scrollbar-width: thin;
  scrollbar-color: rgba(217, 204, 255, .2) transparent; }
.lockup { display: flex; align-items: center; gap: var(--s3); padding: var(--s5) var(--s5) var(--s3); color: var(--lavender); text-decoration: none; }
.lockup:hover { text-decoration: none; }
.lockup .mark { color: var(--lavender); }
.lockup-text { display: flex; flex-direction: column; line-height: 1.05; }
.lockup-company { font: 700 11.5px/1.2 var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: #FFFFFF; }
.lockup-product { font: 700 21px/1.1 var(--font-display); color: var(--lavender); letter-spacing: -.01em; margin-top: 3px; }
.nav-section { margin-top: var(--s3); }
.nav-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; border-radius: 8px; }
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section > summary:hover { color: #fff; }
.nav-section > summary:focus-visible, .sidebar :focus-visible { outline: 2px solid var(--lavender); outline-offset: 1px; box-shadow: none; }
.nav-chevron { opacity: .7; transition: transform .15s; }
.nav-section:not([open]) .nav-chevron { transform: rotate(-90deg); }
.nav-label { font: 600 10.5px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; color: var(--side-muted);
  padding: var(--s2) var(--s3); }
.nav-item { display: flex; align-items: center; gap: var(--s3); padding: 7px var(--s3); margin: 1px 0; border-radius: 10px;
  color: var(--side-text); text-decoration: none; font-weight: 500; position: relative; }
.nav-item .icon { color: var(--side-muted); }
.nav-item:hover { background: var(--side-hover); text-decoration: none; }
.nav-item.active { background: var(--side-active); color: #FFFFFF; }
.nav-item.active .icon { color: var(--lavender); }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--lavender), var(--violet)); }
.nav-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; font: 600 11.5px/20px var(--font);
  text-align: center; background: rgba(217, 204, 255, .18); color: #FFFFFF; }
.nav-badge.warn { background: #B45309; } .nav-badge.danger { background: #B91C1C; }
.side-foot { border-top: 1px solid var(--side-line); padding: var(--s4) var(--s4) var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.side-me { display: flex; align-items: center; gap: var(--s3); color: var(--side-text); text-decoration: none; min-width: 0; border-radius: 10px; padding: 4px; }
.side-me:hover { background: var(--side-hover); text-decoration: none; }
.side-me-name, .side-me-role { display: block; }
.side-me-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-me-role { font-size: 12px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-controls { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.theme-switch { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(217, 204, 255, .08); gap: 2px; }
.theme-switch button { all: unset; cursor: pointer; width: 30px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--side-muted); }
.theme-switch button:hover { color: #fff; }
.theme-switch button[aria-pressed="true"] { background: rgba(217, 204, 255, .2); color: #fff; }

.side-link { all: unset; cursor: pointer; font-size: 12.5px; color: var(--side-muted); display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; min-height: 24px; border-radius: 6px; }
.side-link:hover { color: #fff; background: var(--side-hover); }

.side-simple[aria-pressed="true"] { color: var(--lavender); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s8); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--border); }
.search-trigger { display: inline-flex; align-items: center; gap: var(--s2); height: 38px; padding: 0 var(--s3); min-width: 260px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; }
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd { margin-left: auto; }
.search-trigger span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 500 11px/1 var(--font); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  color: var(--text-2); border: 1px solid var(--border); background: var(--surface); }
.icon-btn:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 2px var(--surface); }
.menu-btn { display: none; }
.content { padding: var(--s2) var(--s8) var(--s12); width: 100%; max-width: 1360px; }
.content.wide { max-width: none; }
.dev-ribbon { font: 600 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft);
  padding: 6px 10px; border-radius: 999px; }

/* ------------------------------------------------------------------ page header (Catalyst section slide) */
.page-head { position: relative; overflow: hidden; background: var(--hero-bg); border: 1px solid var(--hero-border);
  border-radius: var(--r-xl); padding: var(--s8) var(--s8) var(--s6); margin-bottom: var(--s6); box-shadow: var(--shadow-1); }
.page-head .kicker { display: block; }
.page-head .accent-bar { display: block; width: 44px; height: 4px; border-radius: 4px; margin: var(--s3) 0 var(--s4);
  background: linear-gradient(90deg, var(--violet), var(--lavender)); }
.page-head h1 { font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; max-width: 34ch; }
.page-head .subtitle { color: var(--text-2); margin-top: var(--s2); max-width: 70ch; font-size: 15px; }
.page-head .actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s5); position: relative; z-index: 1; }
.page-head .watermark { position: absolute; right: -40px; top: 50%; transform: translateY(-50%); width: 260px; height: 260px; color: var(--watermark); pointer-events: none; }
.page-head .watermark svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------------ at a glance */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); margin: 0 0 var(--s6); }
.tile { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s4) var(--s5); color: var(--text); box-shadow: var(--shadow-1); min-width: 0; }
a.tile:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow-2); }
.tile-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.tile-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none; }
.tile-value { font: 700 28px/1.15 var(--font-display); letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tile.good .tile-label::before { background: var(--good); } .tile.warn .tile-label::before { background: var(--warn); }
.tile.danger .tile-label::before { background: var(--danger); } .tile.accent .tile-label::before { background: var(--violet); }
.tile.danger .tile-value { color: var(--danger); } .tile.warn .tile-value { color: var(--warn); }

/* ------------------------------------------------------------------ cards and layout */
.grid { display: grid; gap: var(--s5); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 360px; }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 16px; }
.card-head .kicker { font-size: 10.5px; }
.card-head .more { margin-left: auto; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 2px; min-height: 24px; }
.card-body { padding: var(--s5); }
.card-body.flush { padding: 0; }
.card-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card + .card, .grid + .card, .card + .grid, .grid + .grid, .glance + .card { margin-top: var(--s5); }
.grid > .card, .grid > * { margin-top: 0; }
.section-title { display: flex; align-items: baseline; gap: var(--s3); margin: var(--s8) 0 var(--s3); }
.divider-label { display: flex; align-items: center; gap: var(--s3); font: 600 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); margin: var(--s5) 0 var(--s3); }
.divider-label::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------------ lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--border); min-height: 52px; }
.list > li:last-child { border-bottom: 0; }
.list > li.link-row:hover { background: var(--surface-2); }
.list .title { font-weight: 500; color: var(--text); }
.list .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.list .meta > * + *::before { content: "·"; margin-right: var(--s2); color: var(--faint); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.card-body > .table-wrap { margin: 0; }
.card-body.flush > .table-wrap { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 600 12px/1.3 var(--font); color: var(--muted); background: var(--surface-2); padding: 10px var(--s4);
  border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table td { padding: 11px var(--s4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: "↕"; opacity: .6; margin-left: 6px; font-size: 11px; }
.table th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; } .table th[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; border-radius: 4px; }
.th-sort:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td a:not(.btn):not(.chip):not(.status) { display: inline-block; min-height: 24px; padding: 2px 0; }   /* 2.5.8 target size */
.table .actions { text-align: right; white-space: nowrap; }

/* ------------------------------------------------------------------ status, chips, avatars */
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font: 600 12px/1 var(--font);
  background: var(--neutral-soft); color: var(--neutral); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.good { background: var(--good-soft); color: var(--good); } .status.warn { background: var(--warn-soft); color: var(--warn); }
.status.danger { background: var(--danger-soft); color: var(--danger); } .status.info { background: var(--info-soft); color: var(--info); }
.status.plain::before { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.prio { display: inline-flex; align-items: center; gap: 4px; font: 600 12px/1 var(--font); color: var(--muted); }
.prio.p1 { color: var(--danger); } .prio.p2 { color: var(--warn); } .prio.p3 { color: var(--accent-text); }
.avatar { --s: 28px; width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font: 600 calc(var(--s) * .38)/1 var(--font); color: #fff; background: var(--purple); letter-spacing: .02em; }
.avatar.a1 { background: #6D28D9; } .avatar.a2 { background: #1F6F78; } .avatar.a3 { background: #9D3C6A; }
.avatar.a4 { background: #3E5BA9; } .avatar.a5 { background: #8A5A12; }
.sidebar .avatar { box-shadow: 0 0 0 2px rgba(217, 204, 255, .25); }
.person { display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; }
.person-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatars { display: inline-flex; } .avatars .avatar { box-shadow: 0 0 0 2px var(--surface); } .avatars .avatar + .avatar { margin-left: -8px; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--control-h); padding: 0 var(--s4);
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 14px/1 var(--font);
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { text-decoration: none; border-color: var(--faint); background: var(--surface-2); }
.btn.primary { background-color: var(--primary); background-image: linear-gradient(135deg, var(--primary) 0%, var(--violet) 140%);
  border-color: transparent; color: var(--on-primary); box-shadow: 0 1px 2px rgba(59, 31, 115, .3); }
.btn.primary:hover { background-color: var(--primary-hover); background-image: linear-gradient(135deg, var(--primary-hover) 0%, var(--violet) 120%); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { height: 32px; padding: 0 var(--s3); font-size: 13px; border-radius: 8px; }
.btn.icon-only { width: var(--control-h); padding: 0; }
.btn.small.icon-only { width: 32px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.page-head .btn:not(.primary) { background: color-mix(in srgb, var(--surface) 85%, transparent); }
form.inline { display: inline; margin: 0; }

/* ------------------------------------------------------------------ forms */
.form { display: grid; gap: var(--s4); }
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.field > label, .label { font: 600 13px/1.3 var(--font); color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.field .error { font-size: 12.5px; color: var(--danger); }
.input, select.input, textarea.input { width: 100%; height: var(--control-h); padding: 0 var(--s3); border-radius: 10px; border: 1px solid var(--control-border);
  background: var(--surface); color: var(--text); font: 400 14.5px/1.4 var(--font); }
textarea.input { height: auto; min-height: 96px; padding: 10px var(--s3); resize: vertical; line-height: var(--lh); }
select.input { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover { border-color: var(--text-2); }
.input:focus { outline: none; border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring), var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input.invalid { border-color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: var(--s2); font-size: 14px; cursor: pointer; }
.check { min-height: 24px; }
.check input { width: 18px; height: 18px; accent-color: var(--violet); margin: 0; }
.form-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; padding-top: var(--s2); }
.reason-line { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.reason-line .input { flex: 1 1 240px; }
.quick-add { display: flex; gap: var(--s2); align-items: center; padding: var(--s2); border: 1px solid var(--control-border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-1); }
.quick-add:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 1px var(--focus-ring), var(--focus); }
.quick-add .input { border: 0; box-shadow: none; height: 40px; }
.quick-add .input:focus { box-shadow: none; }
.quick-add .icon { color: var(--violet); margin-left: var(--s2); }

/* ------------------------------------------------------------------ notices (quiet cards with an edge and a dot) */
.notice { position: relative; display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4) var(--s3) var(--s5); border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1); margin-bottom: var(--s5); line-height: 1.5; }
.notice::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--info); }
.notice .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); margin-top: 7px; flex: none; }
.notice.ok::before, .notice.ok .dot { background: var(--good); }
.notice.warn::before, .notice.warn .dot { background: var(--warn); }
.notice.error::before, .notice.error .dot { background: var(--danger); }
.notice strong { font-weight: 600; }
.card-body > .notice:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ empty states */
.empty { text-align: center; padding: var(--s10) var(--s6); color: var(--muted); }
.empty .illus { width: 88px; height: 88px; margin: 0 auto var(--s4); color: var(--accent); opacity: .9; }
.empty h3, .empty .empty-title { color: var(--text); margin-bottom: var(--s2); }
.empty .empty-title { font: 600 15.5px/1.35 var(--font-display); letter-spacing: -.01em; max-width: none; }
.empty p { max-width: 46ch; margin: 0 auto var(--s4); }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--s5); overflow-x: auto; }
.tabs a { padding: 10px var(--s4); color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--violet); }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; max-width: 100%;
  overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented a { white-space: nowrap; flex: none; padding: 6px 12px; min-height: 28px; display: inline-flex; align-items: center; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 13px; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ meters */
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--lavender)); }
.meter.warn > span { background: var(--warn); } .meter.danger > span { background: var(--danger); }

/* ------------------------------------------------------------------ detail lists */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; } .kv dd { margin: 0; min-width: 0; }

/* ------------------------------------------------------------------ command palette and dialogs */
.palette-backdrop { position: fixed; inset: 0; background: rgba(21, 16, 42, .45); backdrop-filter: blur(2px); z-index: 100; display: none; }
.palette-backdrop.open { display: block; }
.palette { position: fixed; z-index: 101; top: 12vh; left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; display: none; }
.palette.open { display: block; }
.palette input { width: 100%; border: 0; padding: var(--s5); font: 400 16px var(--font); background: transparent; color: var(--text); border-bottom: 1px solid var(--border); }
.palette input:focus { outline: none; }
.palette ul { list-style: none; margin: 0; padding: var(--s2); max-height: 50vh; overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); border-radius: 10px; color: var(--text); }
.palette li a .section { margin-left: auto; font-size: 12px; color: var(--muted); }
.palette .palette-empty { padding: 10px 12px; }
.palette li a:hover, .palette li a.sel { background: var(--accent-soft); text-decoration: none; }
dialog.confirm { border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s6); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); max-width: 440px; }
dialog.confirm::backdrop { background: rgba(21, 16, 42, .45); }

/* ------------------------------------------------------------------ public pages (sign-in): title-slide split */
.public { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.public-hero { background: var(--night); color: #fff; padding: var(--s12); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.public-hero .orbit { position: absolute; right: -140px; bottom: -120px; width: 560px; height: 560px; color: rgba(217, 204, 255, .09); }
.public-hero .orbit svg { width: 100%; height: 100%; }
.public-hero h1 { color: #fff; font-size: 44px; line-height: 1.08; letter-spacing: -.025em; max-width: 13ch; }
.public-hero .kicker { color: var(--lavender); }
.public-hero p { color: rgba(233, 228, 250, .78); max-width: 42ch; font-size: 16px; margin-top: var(--s4); }
.public-form { display: flex; align-items: center; justify-content: center; padding: var(--s12) var(--s6); }
.public-card { width: min(420px, 100%); }
.public-card h2 { font-size: 26px; margin: var(--s2) 0 var(--s2); }
.public-card .lead { color: var(--muted); margin-bottom: var(--s6); }
.public-card .btn.primary { width: 100%; height: 44px; }

/* ------------------------------------------------------------------ footer */
.footer { margin-top: var(--s10); padding-top: var(--s4); border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: var(--s3);
  color: var(--faint); font-size: 12px; flex-wrap: wrap; }
.footer .brand { letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1280px) { :root { --side-w: 252px; } .content, .topbar { padding-left: var(--s6); padding-right: var(--s6); } .grid.side { grid-template-columns: minmax(0, 1fr) 300px; } }
@media (max-width: 1080px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.main-side, .grid.side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  :root { --tabbar-h: 64px; --topbar-h: 60px; --control-h: 44px; }
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .grid.two, .grid.three, .form.two { grid-template-columns: minmax(0, 1fr); }
  .public { grid-template-columns: minmax(0, 1fr); } .public-hero { padding: var(--s8) var(--s6); min-height: 0; } .public-hero h1 { font-size: 32px; }
}
/* without JavaScript the sidebar is reachable from the top of the page on small screens */
html:not(.js) .sidebar { position: static; transform: none; width: auto; height: auto; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .sidebar, .topbar, .tabbar, .fab, .page-head .actions { display: none !important; } .shell { display: block; } }

/* ------------------------------------------------------------------ administration */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.admin-card { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); color: var(--text); box-shadow: var(--shadow-1); min-width: 0; }
.admin-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.admin-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.admin-title { display: block; font-weight: 600; }
.admin-text { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--r); padding: var(--s3) var(--s4) var(--s2); margin: 0; }
.perm-group legend { font: 600 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); padding: 0 6px; }
.perm-check { display: flex; align-items: flex-start; padding: 6px 0; line-height: 1.45; }
.perm-check input { margin-top: 2px; }
.list > li.selected { background: var(--accent-soft); }
details > summary { list-style: none; cursor: pointer; min-height: 24px; }
details > summary::-webkit-details-marker { display: none; }
.file-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; }
input[type=file].input { height: auto; min-height: var(--control-h); }

/* ================================================================== phones, tablets and the installable app
   Below 900 px The Catalyst Hub is laid out for touch: a compact sticky header with the page title, a bottom tab bar with
   the person's four most used destinations and "More" (the full navigation as a sheet), 44 px targets for primary
   actions, single-column forms with 16 px inputs (no zoom on iPhone), and room for the iPhone safe areas. */
[hidden] { display: none !important; }
.topbar-title { display: none; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.sheet-close { display: none; place-items: center; width: var(--tap); height: var(--tap); margin-right: var(--s3); border: 0; border-radius: 10px;
  background: transparent; color: var(--side-text); cursor: pointer; }
.sheet-close:hover { background: var(--side-hover); }
.icon-btn { width: 40px; height: 40px; }

/* sync status (offline, waiting, syncing) */
.sync-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font: 600 12px/1 var(--font);
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sync-chip.offline { background: var(--warn-soft); color: var(--warn); } .sync-chip.offline .sync-dot { background: var(--warn); }
.sync-chip.pending .sync-dot, .sync-chip.syncing .sync-dot { background: var(--accent); }
.pwa-pending-done { opacity: .6; }
.pwa-pending { font-size: 13px; color: var(--muted); margin: var(--s2) 0 0; }

/* bottom tab bar */
.tabbar { display: none; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(140%) blur(12px);
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left); }
.tabbar ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); max-width: 640px; }
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tabbar-h);
  padding: 6px 2px; color: var(--muted); font: 600 11.5px/1.2 var(--font); text-decoration: none; border-radius: 12px; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { color: var(--accent-text); }
.tab.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab:focus-visible { outline-offset: -3px; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; text-align: center;
  font: 700 10.5px/18px var(--font); color: #FFFFFF; background: var(--primary); box-shadow: 0 0 0 2px var(--surface); }
.tab-badge.warn { background: #A04A06; } .tab-badge.danger { background: #B91C1C; }

/* floating "create" button and the quick actions sheet (My day and Tasks) */
.fab { display: none; }
dialog.sheet { border: 0; padding: var(--s5) var(--s5) calc(var(--s5) + var(--safe-bottom)); width: 100%; max-width: 560px; max-height: 88vh;
  margin: auto; border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); overflow-y: auto; }
dialog.sheet::backdrop { background: rgba(21, 16, 42, .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.sheet-head h2 { font-size: 20px; }
.sheet-task { margin-bottom: var(--s4); }
.sheet-task .label { display: block; margin-bottom: var(--s2); }
.sheet-task .quick-add .input { flex: 1 1 auto; min-width: 0; }
.sheet-actions { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.sheet-actions a { display: flex; align-items: center; gap: var(--s3); min-height: 60px; padding: var(--s2) var(--s4); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-weight: 600; }
.sheet-actions a:hover { background: var(--surface-2); text-decoration: none; }
.sheet-actions a > span { display: flex; flex-direction: column; gap: 1px; }
.sheet-actions .muted { font-weight: 400; }
.sheet-actions .icon { color: var(--accent-text); }

/* tables that become stacked cards on phones. Opt in with <table class="table stack-on-phone">: hub.js labels each
   cell from its column header (data-label) and keeps table roles; or render data-label yourself and add
   data-labelled (the data_table macro in partials/ui.html does both, so it also works without JavaScript).
   Use it where the table is the page's primary content; keep wide reference tables scrolling in .table-wrap. */
@media (max-width: 600px) {
  .table.stack-on-phone[data-labelled] thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table.stack-on-phone[data-labelled], .table.stack-on-phone[data-labelled] tbody, .table.stack-on-phone[data-labelled] tfoot,
  .table.stack-on-phone[data-labelled] tr { display: block; width: 100%; }
  .table.stack-on-phone[data-labelled] tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
  .table.stack-on-phone[data-labelled] tbody tr:last-child { border-bottom: 0; }
  .table.stack-on-phone[data-labelled] td { display: grid; grid-template-columns: minmax(88px, 36%) minmax(0, 1fr); gap: var(--s3); align-items: baseline;
    padding: 3px 0; border: 0; text-align: left; white-space: normal; background: none; }
  .table.stack-on-phone[data-labelled] td::before { content: attr(data-label); font: 600 12px/1.4 var(--font); color: var(--muted); }
  .table.stack-on-phone[data-labelled] td[data-label=""], .table.stack-on-phone[data-labelled] td:first-child { display: block; }
  .table.stack-on-phone[data-labelled] td[data-label=""]::before, .table.stack-on-phone[data-labelled] td:first-child::before { content: none; }
  .table.stack-on-phone[data-labelled] td:first-child { font-weight: 600; padding-bottom: 6px; }
  .table.stack-on-phone[data-labelled] td.num { text-align: left; }
  .table.stack-on-phone[data-labelled] td.actions { display: flex; flex-wrap: wrap; gap: var(--s2); padding-top: var(--s2); white-space: normal; }
  .table.stack-on-phone[data-labelled] td.actions::before { content: none; }
  .table.stack-on-phone[data-labelled] tbody tr:hover td { background: none; }
}

@media (max-width: 900px) {
  .has-tabbar { --tabbar-h: 64px; }
  .has-fab { --fab-room: 80px; }
  html { scroll-padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--fab-room, 0px) + 16px); }
  /* navigation sheet */
  html.js .sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(320px, 88vw); height: 100%; transform: translateX(-102%);
    visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(21, 16, 42, .45); z-index: 50; }
  body.nav-open { overflow: hidden; }
  .sheet-close { display: inline-grid; }
  .nav-item { min-height: var(--tap); }
  .nav-section > summary { min-height: 40px; }
  .theme-switch button { width: 44px; height: 40px; }
  .side-link { min-height: 40px; padding: 0 10px; }
  /* compact sticky header with the page title */
  .topbar { gap: var(--s2); padding: calc(8px + var(--safe-top)) calc(var(--s4) + var(--safe-right)) 8px calc(var(--s4) + var(--safe-left)); min-height: var(--topbar-h); }
  .topbar-title { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 700 17px/1.2 var(--font-display); letter-spacing: -.01em; color: var(--text); }
  .topbar > .grow { display: none; }
  .search-trigger { order: 2; flex: none; min-width: 0; width: var(--tap); height: var(--tap); padding: 0; justify-content: center; }
  .topbar > .sync-chip, .topbar > .dev-ribbon { order: 1; }
  .topbar > .icon-btn { order: 3; }
  .search-trigger .search-text, .search-trigger kbd, .dev-ribbon { display: none; }
  .icon-btn { width: var(--tap); height: var(--tap); border-radius: 12px; }
  /* content clears the tab bar; the tab bar and button appear */
  .content { padding-left: calc(var(--s6) + var(--safe-left)); padding-right: calc(var(--s6) + var(--safe-right));
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--fab-room, 0px) + var(--s6)); }
  .tabbar { display: block; }
  .fab { display: grid; place-items: center; position: fixed; z-index: 41; right: calc(var(--s4) + var(--safe-right));
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--s4)); width: 58px; height: 58px; border-radius: 18px; color: #FFFFFF;
    background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 130%); box-shadow: var(--shadow-pop); }
  .fab:hover { text-decoration: none; filter: brightness(1.08); }
  .fab:focus-visible { outline-offset: 3px; }
  dialog.sheet { margin: auto auto 0; max-width: 640px; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  /* touch targets and inputs */
  .btn { min-height: var(--tap); height: auto; }
  .btn.small { min-height: 36px; height: auto; }
  .btn.primary, .btn.small.primary { min-height: var(--tap); }
  .input, select.input, textarea.input, .palette input { font-size: 16px; }
  .input, select.input { height: var(--tap); }
  .tabs a { min-height: var(--tap); display: inline-flex; align-items: center; }
  .segmented a { min-height: 36px; }
  .palette { top: calc(var(--s3) + var(--safe-top)); }
  .palette li a { min-height: var(--tap); }
  .footer { margin-top: var(--s8); }
}
@media (max-width: 600px) {
  .content { padding-left: calc(var(--s4) + var(--safe-left)); padding-right: calc(var(--s4) + var(--safe-right)); }
  .page-head { padding: var(--s6) var(--s5) var(--s5); border-radius: var(--r-lg); }
  .page-head h1 { font-size: 24px; }
  .page-head .watermark { width: 180px; height: 180px; right: -60px; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: var(--s3) var(--s4); } .tile-value { font-size: 22px; }
  .list > li { padding: var(--s3) var(--s4); }
  .card-head, .card-body { padding-left: var(--s4); padding-right: var(--s4); }
  .card-head { flex-wrap: wrap; }
  .btn { white-space: normal; padding-top: 8px; padding-bottom: 8px; line-height: 1.25; max-width: 100%; }
  .btn.small { padding-top: 6px; padding-bottom: 6px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px var(--s4); } .kv dd { margin-bottom: var(--s2); }
  .form-actions .btn.primary { flex: 1 1 auto; }
  .topbar-claude { display: none; }   /* Claude is one tap away in More; keeps room for the title */
}

/* the offline page (served by /pwa/offline, kept by the service worker) */
.offline-top { display: flex; align-items: center; gap: var(--s3); padding: calc(var(--s4) + var(--safe-top)) var(--s6) var(--s4); background: var(--night); color: var(--lavender); }
.offline-brand { font: 700 15px/1 var(--font-display); color: #FFFFFF; letter-spacing: .02em; }
.offline-main { margin: 0 auto; max-width: 880px; padding-top: var(--s6); }
.offline-note { margin-top: var(--s5); }

/* ================================================================== smooth page changes
   Inside the Hub, hub.js changes pages softly: it fetches the next page and swaps the main area only, so the sidebar,
   top bar and tab bar never move or repaint. What changes cross-fades: a copy of the old content fades out (140 ms)
   over the new content, which fades in and rises 8 px (200 ms); parts that stay the same (a page header above tabs)
   don't move. A thin bar appears at the top when the next page takes longer than 150 ms.
   Full page loads that remain (without JavaScript, signing in, the demo company) use a cross-document view transition
   with the same motion on the main area only: the page itself never cross-fades and the bars are swapped in place.
   Off for people who prefer less motion. */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
.tabbar { view-transition-name: tabbar; }
.topbar { view-transition-name: topbar; }
.shell > .main > .content { view-transition-name: content; }
::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root),
::view-transition-group(sidebar), ::view-transition-old(sidebar), ::view-transition-new(sidebar),
::view-transition-group(tabbar), ::view-transition-old(tabbar), ::view-transition-new(tabbar),
::view-transition-group(topbar), ::view-transition-old(topbar), ::view-transition-new(topbar),
::view-transition-group(content) { animation: none; }
::view-transition-old(content) { animation: hub-fade-out 90ms cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(content) { animation: hub-rise-in 200ms cubic-bezier(.2, .7, .2, 1) 60ms both; }
@keyframes hub-fade-out { to { opacity: 0; } }
@keyframes hub-rise-in { from { opacity: 0; transform: translateY(8px); } }
.hub-progress { position: fixed; z-index: 300; top: 0; left: 0; right: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, var(--violet), var(--lavender)); transform-origin: 0 50%; transform: scaleX(0); opacity: 0; }
.hub-progress.on { opacity: 1; transform: scaleX(.85); transition: transform 8s cubic-bezier(.05, .7, .1, 1), opacity .12s linear; }
.hub-progress.done { opacity: 0; transform: scaleX(1); transition: transform .18s ease-out, opacity .2s linear .15s; }
html[data-hub-loading] { cursor: progress; }
.content.hub-ghost { position: fixed; inset: 0; z-index: 10; width: auto; max-width: none; padding: 0; margin: 0;
  pointer-events: none; overflow: hidden; contain: strict; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .hub-progress.on { transition: opacity .12s linear; }
}

/* QR codes (authenticator set-up): always dark on white with a quiet zone, so phones read them in either theme */
.qr-box { display: inline-flex; padding: 6px; border-radius: 12px; background: #fff; border: 1px solid var(--border); line-height: 0; }
.qr-box .qr { display: block; width: 196px; height: 196px; max-width: 100%; }

/* ------------------------------------------------------------------ language switcher (i18n; partials/language.html)
   Sidebar footer, signed-out pages and My account. Each language is named in its own language. */
.lang-switch { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; flex-wrap: wrap; }
.lang-switch > button:not(.btn) { all: unset; cursor: pointer; font-size: 12.5px; font-weight: 500; padding: 0 10px; min-height: 26px;
  display: inline-flex; align-items: center; border-radius: 7px; }
.lang-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; }
.lang-side { background: rgba(217, 204, 255, .08); align-self: flex-start; }
.lang-side .lang-icon { color: var(--side-muted); }
.lang-side > button { color: var(--side-muted); }
.lang-side > button:hover { color: #fff; }
.lang-side > button[aria-pressed="true"] { background: rgba(217, 204, 255, .2); color: #fff; }
.lang-public { margin-top: var(--s8); background: var(--surface-2); border: 1px solid var(--border); width: fit-content; }
.lang-public .lang-icon { color: var(--muted); }
.lang-public > button { color: var(--text-2); }
.lang-public > button:hover { color: var(--text); }
.lang-public > button[aria-pressed="true"] { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 2px rgba(23, 19, 42, .08); }
.lang-public > button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.lang-account { padding: 0; gap: var(--s2); }
@media (max-width: 900px) {
  .lang-switch > button:not(.btn) { min-height: 40px; padding: 0 14px; }
  .lang-icon { height: 40px; }
}
/* Longer translations (Polish): long single words in tiles break, and segmented choices wrap on phones,
   instead of pushing the page sideways */
.tile-value { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .segmented.tk-kind { flex-wrap: wrap; overflow: visible; }
  .tk-kind label { flex: 1 1 auto; min-width: 0; }
  .tk-kind span { white-space: normal; }
}
