/* ═══════════════════════════════════════════════════════════════
   Syrinx CORE — Shared Design System
   All Syrinx apps inherit these tokens. App-specific styles go in
   each app's own CSS file, loaded AFTER this one.

   Usage:  <link rel="stylesheet" href="/static/syrinx-core.css">
   ═══════════════════════════════════════════════════════════════ */

/* ── Fonts ──
   Inter (UI/body) + Playfair Display (headlines) are the SYRINX brand faces;
   IBM Plex Mono covers figures/data; Roboto Mono remains for mono fallbacks. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@400&family=IBM+Plex+Mono:wght@400;500&family=Roboto+Mono:wght@400;500&display=swap');

/* Canonical Syrinx brand lockup. Apps render this class; the asset is defined once. */
.syrinx-brand-logo {
  display: inline-block;
  width: 180px;
  height: 34px;
  flex: 0 0 180px;
  background: url('/static/brand/syrinx-logo-horizontal.svg') center / contain no-repeat;
}
html.dark-mode .syrinx-brand-logo,
body.dark-mode .syrinx-brand-logo,
html[data-theme="dark"] .syrinx-brand-logo,
body[data-theme="dark"] .syrinx-brand-logo {
  background-image: url('/static/brand/syrinx-logo-horizontal-reversed.svg');
}

/* ── Light Mode Tokens (default) ── */
:root {
  /* SYRINX brand palette (branding/syrinx/tokens/colors.css) */
  --syrinx-espresso: #4A1F10;
  --syrinx-coral: #E06B4F;
  --syrinx-sand: #E9B9A6;
  --syrinx-cream: #FBF6EF;
  --syrinx-warm-neutral: #E6DCD2;
  /* Text-safe accent shades: brand Coral fails 4.5:1 on Cream, so text
     accents and focus rings use a deepened coral that passes. */
  --syrinx-coral-strong: #B14E35;
  --syrinx-coral-ink: #B04530;

  --en-deep: #4A1F10;
  --en-navy: #38160A;
  --syrinx-teal: var(--syrinx-coral-ink);
  --syrinx-teal-hover: #933825;
  --teal-glow: rgba(224,107,79,.16);
  --teal-subtle: rgba(224,107,79,.09);
  --teal-border: rgba(224,107,79,.30);

  /* Warm paper surfaces — Cream ground, warm off-white cards. */
  --bg: #FBF6EF;
  --surface: #FFFDF9;
  --surface-2: #F3EAE0;
  --subtle: rgba(74,31,16,.05);
  --border: #E6DCD2;
  --border-light: #F0E8DE;

  --text: var(--en-deep);
  --body: #5A3B2B;
  --dim: #7A5A48;
  --muted: #80634F;

  --accent: var(--syrinx-teal);
  --accent-light: var(--teal-subtle);
  --accent-hover: var(--syrinx-teal-hover);

  --red: #C0392B;
  --green: #2F7D4F;
  --gold: #96691A;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'Roboto Mono', Menlo, monospace;
  /* Numeric/tabular data face — reserve for figures, tickers, timestamps, and
     versions ONLY. Prose, labels, and headings use --font-sans / --font-serif.
     (Editorial refresh; opt-in via .syrinx-num — see DESIGN_MIGRATION.md.) */
  --font-num: 'IBM Plex Mono', 'Roboto Mono', ui-monospace, Menlo, monospace;
  --syrinx-meta-size: 11px;
  --syrinx-entity-code-size: 12px;
  --syrinx-entity-name-size: 13px;
  --syrinx-supporting-size: 13px;

  --shadow-sm: 0 1px 2px rgba(74,31,16,.06);
  --shadow-md: 0 4px 14px rgba(74,31,16,.08);
  --card-outline: rgba(74,31,16,.12);
  --card-outline-hover: rgba(224,107,79,.35);
  --card-shadow: 0 10px 28px rgba(74,31,16,.08);
  --card-shadow-hover: 0 16px 36px rgba(74,31,16,.12), 0 0 0 1px rgba(224,107,79,.10);

  --panel-info-bg: rgba(224,107,79,.07);
  --panel-info-border: rgba(224,107,79,.22);
  --panel-info-label: var(--syrinx-teal);
  --panel-uncertain-bg: rgba(74,31,16,.035);
  --panel-uncertain-border: rgba(74,31,16,.14);
  --panel-uncertain-label: var(--dim);
  --edge-intelligence-bg: #fafafa;
  --edge-intelligence-border: var(--border-light);
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Fixed contrast pair for light input surfaces on dark app chrome (not theme-inverted). */
  --syrinx-readable-ink: #4A1F10;
  --syrinx-readable-surface: #ffffff;
  --syrinx-readable-muted: #7A5A48;

  /* Legacy aliases (Hub compatibility) */
  --primary-gold: #C08A4E;
  --secondary-teal: var(--syrinx-teal);
  --bg-deep: var(--bg);
  --glass-blue: rgba(74,31,16,.05);
  --glass-border: var(--border);
  --text-primary: var(--text);
  --text-secondary: var(--body);
  --text-dim: var(--dim);
  --text-muted: var(--dim);
  --text-faint: var(--muted);
  --bg-app: var(--bg);
  --syrinx-teal-bright: var(--syrinx-coral);
  --accent-glow: var(--teal-glow);
}

/* ── Dark Mode Tokens ── */
html.dark-mode,
body.dark-mode,
html[data-theme="dark"],
body[data-theme="dark"] {
  --en-deep: #FBF6EF;
  --en-navy: #180A04;
  --syrinx-teal: #F08A6E;
  --syrinx-teal-hover: #F5A08A;
  --teal-glow: rgba(224,107,79,.25);
  --teal-subtle: rgba(224,107,79,.10);
  --teal-border: rgba(224,107,79,.35);

  /* Deep Espresso ground with warm raised surfaces. */
  --bg: #1E0D06;
  --surface: #2A1409;
  --surface-2: #381D10;
  --subtle: #331A0E;
  --border: rgba(251,246,239,.16);
  --border-light: rgba(251,246,239,.08);

  --text: #FBF6EF;
  --body: #EBDFD3;
  --dim: #D9C4B4;
  --muted: #B49481;

  --accent: var(--syrinx-teal);
  --accent-light: var(--teal-subtle);
  --accent-hover: var(--syrinx-teal-hover);

  --red: #F08A7A;
  --green: #7FCB8E;
  --gold: #E0B45C;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 18px rgba(0,0,0,.5);
  --card-outline: rgba(251,246,239,.16);
  --card-outline-hover: rgba(224,107,79,.45);
  --card-shadow: inset 0 1px 0 rgba(251,246,239,.06), 0 14px 38px rgba(0,0,0,.4), 0 0 0 1px rgba(251,246,239,.06);
  --card-shadow-hover: inset 0 1px 0 rgba(251,246,239,.07), 0 20px 52px rgba(0,0,0,.5), 0 0 24px rgba(224,107,79,.12), 0 0 0 1px rgba(224,107,79,.18);

  --panel-info-bg: rgba(224,107,79,.10);
  --panel-info-border: rgba(224,107,79,.28);
  --panel-info-label: var(--syrinx-teal);
  --panel-uncertain-bg: rgba(255,255,255,.035);
  --panel-uncertain-border: rgba(255,255,255,.1);
  --panel-uncertain-label: rgba(245,245,245,.55);
  --edge-intelligence-bg: #140903;
  --edge-intelligence-border: rgba(251,246,239,.10);

  /* Legacy aliases (Hub compatibility) */
  --primary-gold: #C08A4E;
  --secondary-teal: var(--syrinx-teal);
  --bg-deep: var(--bg);
  --glass-blue: #241209;
  --glass-border: var(--card-outline);
  --text-primary: var(--text);
  --text-secondary: var(--body);
  --text-dim: var(--dim);
  --text-muted: var(--dim);
  --text-faint: var(--muted);
  --bg-app: var(--bg);
  --syrinx-teal-bright: #F5A08A;
  --accent-glow: var(--teal-glow);
}

/* ── Body Defaults ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  transition: background .35s ease, color .35s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dark-mode,
body[data-theme="dark"] {
  background: #000;
  color: var(--text);
}

::selection { background: rgba(0,163,154,.15); color: var(--en-deep); }
body.dark-mode ::selection { background: rgba(33,196,173,.2); color: #f5f5f5; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }
body.dark-mode ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ── Theme Toggle Button ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--dim);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  width: 36px;
  height: 36px;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--syrinx-teal);
  background: var(--teal-subtle);
}
body.dark-mode .theme-toggle { border-color: rgba(255,255,255,.1); color: var(--muted); }
body.dark-mode .theme-toggle:hover { border-color: rgba(198,172,109,.3); background: rgba(198,172,109,.06); color: var(--text); }
.syrinx-theme-icon,
#syrinxThemeIcon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.syrinx-theme-icon svg,
#syrinxThemeIcon svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* ── Core SVG Icon Utilities ── */
.syrinx-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.syrinx-icon-nav {
  width: 20px;
  height: 20px;
}
.syrinx-icon-sm {
  width: 14px;
  height: 14px;
}
.syrinx-icon-md {
  width: 16px;
  height: 16px;
}
.syrinx-icon-lg {
  width: 24px;
  height: 24px;
}
.syrinx-muted {
  color: var(--muted);
}
.syrinx-accent {
  color: var(--accent);
}
.syrinx-gold {
  color: #b8860b;
}
.syrinx-spin {
  animation: syrinx-spin .8s linear infinite;
}
@keyframes syrinx-spin {
  to { transform: rotate(360deg); }
}

/* ── Common Card Pattern ── */
.syrinx-card,
.ci-card,
.ci-section-card {
  background: var(--surface);
  border: 1px solid var(--card-outline);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.syrinx-card:hover,
.ci-card:hover,
.ci-section-card:hover {
  border-color: var(--card-outline-hover);
  box-shadow: var(--card-shadow-hover);
}

/* ── Common Button Pattern ── */
.syrinx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  border: 1px solid transparent;
}
.syrinx-btn-primary {
  background: var(--syrinx-teal);
  color: #fff;
  border-color: var(--syrinx-teal);
}
.syrinx-btn-primary:hover {
  background: var(--syrinx-teal-hover);
  border-color: var(--syrinx-teal-hover);
}
body.dark-mode .syrinx-btn-primary { color: #010103; box-shadow: 0 2px 8px rgba(33,196,173,.25); }

.syrinx-btn-ghost {
  background: transparent;
  color: var(--dim);
  border-color: var(--border);
}
.syrinx-btn-ghost:hover {
  color: var(--text);
  border-color: var(--syrinx-teal);
  background: var(--teal-subtle);
}

/* ── Links ── Unclassed anchors are teal; headings keep ink and show teal on hover.
   :where() keeps specificity at zero so any component rule still wins. */
a:where(:not([class])) { color: var(--syrinx-teal); text-decoration: none; }
a:where(:not([class])):hover { color: var(--syrinx-teal-hover); text-decoration: underline; }
:where(h1, h2, h3, h4, h5, h6) a:where(:not([class])) { color: inherit; }

/* ── Hover tooltip (syrinx-tooltip.js replaces native title tooltips) ── */
.syrinx-hovertip {
  position: fixed;
  z-index: 2147483000;
  max-width: 280px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  white-space: pre-line;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .12s ease, transform .12s ease;
}
.syrinx-hovertip[data-side="top"] { transform: translateY(-2px); }
.syrinx-hovertip.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .syrinx-hovertip { transition: none; transform: none; }
}

/* ── Common Input Pattern ── */
.syrinx-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color .2s;
}
.syrinx-input:focus { border-color: var(--syrinx-teal); }
.syrinx-input::placeholder { color: var(--muted); }
body.dark-mode .syrinx-input { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); }
body.dark-mode .syrinx-input::placeholder { color: rgba(245,245,245,.25); }

/* Light-surface inputs stay readable on dark app chrome (URL bars, search fields). */
.syrinx-input-surface {
  background: var(--syrinx-readable-surface);
  color: var(--syrinx-readable-ink);
  -webkit-text-fill-color: var(--syrinx-readable-ink);
}
.syrinx-input-surface::placeholder { color: var(--syrinx-readable-muted); }
html.dark-mode .syrinx-input-surface,
body.dark-mode .syrinx-input-surface,
html[data-theme="dark"] .syrinx-input-surface,
body[data-theme="dark"] .syrinx-input-surface {
  background: var(--syrinx-readable-surface);
  color: var(--syrinx-readable-ink);
  border-color: #d8dee6;
  -webkit-text-fill-color: var(--syrinx-readable-ink);
}
html.dark-mode .syrinx-input-surface::placeholder,
body.dark-mode .syrinx-input-surface::placeholder,
html[data-theme="dark"] .syrinx-input-surface::placeholder,
body[data-theme="dark"] .syrinx-input-surface::placeholder {
  color: var(--syrinx-readable-muted);
}
html.dark-mode input.syrinx-input.syrinx-input-surface:focus,
body.dark-mode input.syrinx-input.syrinx-input-surface:focus,
html[data-theme="dark"] input.syrinx-input.syrinx-input-surface:focus,
body[data-theme="dark"] input.syrinx-input.syrinx-input-surface:focus {
  color: var(--syrinx-readable-ink);
  -webkit-text-fill-color: var(--syrinx-readable-ink);
}

/* ── Native Select & Input (filter bars) ── */
.filter-select,
.filter-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color .2s;
}
.filter-select:focus,
.filter-input:focus { border-color: var(--syrinx-teal); }
.filter-input::placeholder { color: var(--muted); }
.filter-select option { background: var(--surface); color: var(--text); }
body.dark-mode .filter-select,
body.dark-mode .filter-input,
body[data-theme="dark"] .filter-select,
body[data-theme="dark"] .filter-input {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
  color: #f5f5f5;
}
body.dark-mode .filter-select option,
body[data-theme="dark"] .filter-select option {
  background: #1a1a1e;
  color: #f5f5f5;
}
body.dark-mode .filter-input::placeholder,
body[data-theme="dark"] .filter-input::placeholder {
  color: rgba(245,245,245,.3);
}

/* ── Checkbox (custom) ── */
.syrinx-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--dim);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.35;
  user-select: none;
}

.syrinx-checkbox input[type="checkbox"],
input[type="checkbox"].syrinx-checkbox-input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
  position: relative;
}

.syrinx-checkbox input[type="checkbox"]:checked,
input[type="checkbox"].syrinx-checkbox-input:checked {
  background: var(--syrinx-teal);
  border-color: var(--syrinx-teal);
}

.syrinx-checkbox input[type="checkbox"]:checked::after,
input[type="checkbox"].syrinx-checkbox-input:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.syrinx-checkbox input[type="checkbox"]:focus-visible,
input[type="checkbox"].syrinx-checkbox-input:focus-visible {
  outline: none;
  border-color: var(--syrinx-teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.syrinx-checkbox input[type="checkbox"]:disabled,
input[type="checkbox"].syrinx-checkbox-input:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.syrinx-checkbox:has(input[type="checkbox"]:disabled) {
  cursor: not-allowed;
  opacity: .72;
}

body.dark-mode .syrinx-checkbox input[type="checkbox"]:not(:checked),
body[data-theme="dark"] .syrinx-checkbox input[type="checkbox"]:not(:checked),
body.dark-mode input[type="checkbox"].syrinx-checkbox-input:not(:checked),
body[data-theme="dark"] input[type="checkbox"].syrinx-checkbox-input:not(:checked) {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.18);
}

body.dark-mode .syrinx-checkbox input[type="checkbox"]:checked,
body[data-theme="dark"] .syrinx-checkbox input[type="checkbox"]:checked,
body.dark-mode input[type="checkbox"].syrinx-checkbox-input:checked,
body[data-theme="dark"] input[type="checkbox"].syrinx-checkbox-input:checked {
  background: var(--syrinx-teal);
  border-color: var(--syrinx-teal);
}

body.dark-mode .syrinx-checkbox input[type="checkbox"]:checked::after,
body[data-theme="dark"] .syrinx-checkbox input[type="checkbox"]:checked::after,
body.dark-mode input[type="checkbox"].syrinx-checkbox-input:checked::after,
body[data-theme="dark"] input[type="checkbox"].syrinx-checkbox-input:checked::after {
  border-color: #fff;
}

/* ── Syrinx Custom App Select (Vantage Pattern) ── */
.syrinx-app-select {
  position: relative;
  min-width: 220px;
  max-width: 100%;
  z-index: 1;
}

.syrinx-app-select.is-open {
  z-index: 70;
}

.syrinx-app-select-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background-color: var(--surface);
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .005)),
    linear-gradient(90deg, transparent calc(100% - 42px), var(--teal-subtle) calc(100% - 42px));
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.2;
  padding: 11px 14px;
  text-align: left;
  transition: all .18s ease;
}

.syrinx-app-select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.syrinx-app-select-trigger i {
  color: var(--syrinx-teal);
  font-size: 11px;
  transition: transform .18s ease;
}

.syrinx-app-select-trigger svg {
  color: var(--syrinx-teal);
  flex-shrink: 0;
  transition: transform .18s ease;
}

.syrinx-app-select.is-open .syrinx-app-select-trigger i {
  transform: rotate(180deg);
}

.syrinx-app-select.is-open .syrinx-app-select-trigger svg {
  transform: rotate(180deg);
}

.syrinx-app-select-trigger:hover,
.syrinx-app-select.is-open .syrinx-app-select-trigger,
.syrinx-app-select-trigger:focus-visible {
  border-color: var(--teal-border);
  box-shadow: var(--shadow-md), 0 0 0 2px var(--teal-subtle);
  outline: none;
}

.syrinx-app-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(360px, 54vh);
  overflow: auto;
  border: 1px solid var(--teal-border);
  border-radius: 16px;
  background-color: var(--surface);
  background-image: radial-gradient(circle at top left, var(--teal-subtle), transparent 34%);
  box-shadow: var(--card-shadow-hover);
  padding: 7px;
  display: none;
}

.syrinx-app-select.is-open .syrinx-app-select-menu {
  display: block;
}

.syrinx-app-select-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--body);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.25;
  padding: 10px 11px;
  text-align: left;
}

.syrinx-app-select-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.syrinx-app-select-option i {
  color: var(--syrinx-teal);
  font-size: 10px;
}

.syrinx-app-select-option svg {
  color: var(--syrinx-teal);
  flex-shrink: 0;
}

.syrinx-app-select-option:hover,
.syrinx-app-select-option:focus-visible {
  border-color: var(--teal-border);
  background: var(--teal-subtle);
  color: var(--text);
  outline: none;
}

.syrinx-app-select-option.is-selected {
  border-color: var(--teal-border);
  background: var(--teal-subtle);
  color: var(--syrinx-teal);
}

/* ── Pill / Chip ── */
.syrinx-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .3px;
}
.syrinx-pill-teal {
  background: var(--teal-subtle);
  color: var(--syrinx-teal);
  border: 1px solid var(--teal-border);
}
.syrinx-pill-gold {
  background: rgba(198,172,109,.08);
  color: var(--gold);
  border: 1px solid rgba(198,172,109,.25);
}

/* ── Typography Utilities ── */
.syrinx-mono { font-family: var(--font-mono); }
/* Tabular figures — use for any aligned numbers (prices, counts, timestamps). */
.syrinx-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
/* Eyebrow / section label — the editorial replacement for wide-tracked
   uppercase mono. Sans, restrained tracking, no glow. Opt-in; see
   DESIGN_MIGRATION.md. */
.syrinx-eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
}
.syrinx-dim { color: var(--dim); }
.syrinx-muted { color: var(--muted); }
.syrinx-teal { color: var(--syrinx-teal); }
.syrinx-gold { color: var(--gold); }

/* ── Editorial/data-page primitives ── */
.syrinx-page-frame {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}
.syrinx-meta {
  color: var(--dim);
  font: 500 var(--syrinx-meta-size)/1.5 var(--font-num);
  font-variant-numeric: tabular-nums;
}
.syrinx-supporting-text {
  font-size: var(--syrinx-supporting-size);
  line-height: 1.5;
}
.syrinx-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.syrinx-filter-pills button {
  padding: 7px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--dim);
  cursor: pointer;
  font: 600 var(--syrinx-meta-size)/1 var(--font-sans);
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.syrinx-filter-pills button:hover,
.syrinx-filter-pills button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.syrinx-filter-pills button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.syrinx-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 330px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.syrinx-segmented button {
  min-height: 42px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font: 700 var(--syrinx-meta-size)/1 var(--font-sans);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.syrinx-segmented button.is-active {
  color: var(--accent);
  background: var(--accent-light);
}
.syrinx-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  background: var(--surface);
}
.syrinx-metric-grid > div {
  padding: 18px 22px;
  border-right: 1px solid var(--border);
}
.syrinx-metric-grid > div:last-child { border-right: 0; }
.syrinx-metric-grid strong {
  display: block;
  font: 600 22px/1.1 var(--font-num);
  font-variant-numeric: tabular-nums;
}
.syrinx-metric-grid span {
  display: block;
  margin-top: 6px;
  color: var(--dim);
  font-size: var(--syrinx-meta-size);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.syrinx-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 2px 12px;
  border-bottom: 1px solid var(--border);
}
.syrinx-section-head h2 { margin: 0; letter-spacing: -.025em; }
.syrinx-section-head span {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.syrinx-section-head p {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: var(--syrinx-meta-size);
}
.syrinx-section-head > strong {
  color: var(--accent);
  font: 650 18px/1 var(--font-num);
}
.syrinx-icon-button {
  appearance: none;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--teal-border);
  border-radius: 5px;
  background: var(--teal-subtle);
  color: var(--dim);
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}
.syrinx-icon-button:hover {
  border-color: var(--teal-border);
  background: var(--teal-subtle);
  color: var(--accent);
}
.syrinx-data-date {
  padding: 26px 2px 9px;
  color: var(--dim);
  font: 700 var(--syrinx-meta-size)/1 var(--font-sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.syrinx-data-row {
  display: grid;
  grid-template-columns: var(--syrinx-data-columns, 180px 180px minmax(0, 1fr));
  gap: 22px;
  margin-top: -1px;
  padding: 19px 20px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.syrinx-data-entity strong {
  display: block;
  color: var(--accent);
  font: 650 var(--syrinx-entity-code-size)/1 var(--font-num);
}
.syrinx-data-entity span {
  display: block;
  margin-top: 6px;
  color: var(--body);
  font-size: var(--syrinx-entity-name-size);
  line-height: 1.35;
}
.syrinx-data-content { min-width: 0; }
.syrinx-data-content h3 { margin: 0; font-size: 13px; line-height: 1.4; }
.syrinx-data-content h3 a { color: var(--text); text-decoration: none; }
.syrinx-data-content h3 a:hover { color: var(--accent); }
.syrinx-data-content p {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--body);
  font-size: 11px;
  line-height: 1.5;
}
.syrinx-badge {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: var(--syrinx-meta-size);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.syrinx-source-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: var(--syrinx-meta-size);
  text-decoration: none;
}
.syrinx-state {
  padding: 70px 20px;
  text-align: center;
  color: var(--dim);
}
.syrinx-state-inline {
  padding: 22px;
  text-align: center;
  color: var(--dim);
  font-size: var(--syrinx-meta-size);
}
.syrinx-skeleton {
  display: block;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--subtle) 25%, var(--surface-2) 50%, var(--subtle) 75%);
  background-size: 200% 100%;
  animation: syrinx-skeleton-shift 1.4s ease-in-out infinite;
}
@keyframes syrinx-skeleton-shift {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
.syrinx-load-more {
  display: block;
  margin: 24px auto 0;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  font: 700 var(--syrinx-meta-size)/1 var(--font-sans);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.syrinx-load-more:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
@media (max-width: 760px) {
  .syrinx-page-frame { width: min(100% - 28px, 1180px); }
  .syrinx-segmented { width: 100%; min-width: 0; }
  .syrinx-metric-grid > div { padding: 14px; }
  .syrinx-data-row { grid-template-columns: 1fr; gap: 7px; padding: 17px; }
  .syrinx-data-entity { display: flex; align-items: baseline; gap: 9px; }
  .syrinx-data-entity span { margin-top: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   Intelligence Hero — Graph Pulse / Signal Activity / Freshness
   ═══════════════════════════════════════════════════════════════ */
.intel-hero {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .intel-hero { grid-template-columns: 1fr; } }

.intel-hero-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.intel-hero-panel:hover {
  border-color: var(--teal-border);
  box-shadow: var(--shadow-md);
}
body.dark-mode .intel-hero-panel,
body[data-theme="dark"] .intel-hero-panel {
  background: rgba(255,255,255,.025);
  border-color: rgba(255,255,255,.07);
  box-shadow: none;
}
body.dark-mode .intel-hero-panel:hover,
body[data-theme="dark"] .intel-hero-panel:hover {
  border-color: var(--teal-border);
  box-shadow: 0 0 20px rgba(33,196,173,.06);
}

.intel-hero-icon {
  color: var(--syrinx-teal);
  font-size: 14px;
  margin-bottom: 4px;
}
.intel-hero-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 12px;
}
.intel-hero-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Graph Pulse rows ── */
.pulse-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.pulse-metric {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  min-width: 48px;
}
.pulse-dim {
  font-size: 12px;
  color: var(--dim);
}

/* ── Signal Activity rows ── */
.signal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
}
.signal-source {
  font-size: 12px;
  color: var(--body);
  display: flex;
  align-items: center;
  gap: 6px;
}
.signal-source i {
  color: var(--muted);
  font-size: 11px;
  width: 14px;
  text-align: center;
}
.signal-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.signal-hot {
  background: rgba(239,68,68,.1);
  color: var(--red);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}
body.dark-mode .signal-hot { background: rgba(248,113,113,.12); }
.signal-new {
  background: rgba(16,185,129,.1);
  color: var(--green);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}
body.dark-mode .signal-new { background: rgba(52,211,153,.12); }
.signal-warm {
  color: var(--dim);
  font-weight: 500;
}
.signal-dim {
  color: var(--muted);
  font-weight: 400;
  font-size: 10px;
}

/* ── Data Freshness rows ── */
.freshness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
}
.freshness-source {
  font-size: 12px;
  color: var(--body);
  display: flex;
  align-items: center;
  gap: 6px;
}
.freshness-source i {
  color: var(--muted);
  font-size: 11px;
  width: 14px;
  text-align: center;
}
.freshness-ts {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 4px;
}
.freshness-ts.fresh {
  background: rgba(13,148,136,.08);
  color: var(--green);
}
.freshness-ts.warm {
  background: rgba(212,160,23,.08);
  color: var(--gold);
}
.freshness-ts.stale {
  background: rgba(239,68,68,.06);
  color: var(--red);
}
body.dark-mode .freshness-ts.fresh { background: rgba(52,211,153,.1); }
body.dark-mode .freshness-ts.warm  { background: rgba(198,172,109,.1); }
body.dark-mode .freshness-ts.stale { background: rgba(248,113,113,.08); }

/* ── Compact Totals Bar ── */
.graph-totals-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 8px;
}
.gt-chip {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--dim);
  background: var(--subtle);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 4px 12px;
  letter-spacing: .2px;
}
.gt-chip strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  margin-right: 3px;
}
body.dark-mode .gt-chip,
body[data-theme="dark"] .gt-chip {
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.06);
}

/* ════════════════════════════════════════════════════════════
   Syrinx Visualization Primitives
   Shared chart / data-vis building blocks for RAG workflows.
   All components inherit the core design-token palette.
   ════════════════════════════════════════════════════════════ */

/* ── Stat Cards Grid ── */
.syrinx-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.syrinx-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.syrinx-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--dim);
}
.syrinx-stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.syrinx-stat-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Metric Delta (inline up/down indicator) ── */
.syrinx-delta {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.syrinx-delta-up { color: var(--green); }
.syrinx-delta-down { color: var(--red); }
.syrinx-delta-flat { color: var(--muted); }
.syrinx-delta::before {
  font-size: 9px;
}
.syrinx-delta-up::before { content: "▲"; }
.syrinx-delta-down::before { content: "▼"; }
.syrinx-delta-flat::before { content: "—"; }

/* ── Phase Badges ── */
.syrinx-phase {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.5;
  white-space: nowrap;
}
.syrinx-phase-preclinical { background: var(--subtle); color: var(--dim); }
.syrinx-phase-1 { background: rgba(99,102,241,.12); color: #818cf8; }
.syrinx-phase-2 { background: rgba(14,165,233,.12); color: #38bdf8; }
.syrinx-phase-3 { background: rgba(0,163,154,.12); color: var(--syrinx-teal); }
.syrinx-phase-approved { background: rgba(16,185,129,.12); color: var(--green); }
body.dark-mode .syrinx-phase-preclinical { background: rgba(255,255,255,.06); }
body.dark-mode .syrinx-phase-1 { background: rgba(99,102,241,.18); }
body.dark-mode .syrinx-phase-2 { background: rgba(14,165,233,.18); }
body.dark-mode .syrinx-phase-3 { background: rgba(0,163,154,.18); }
body.dark-mode .syrinx-phase-approved { background: rgba(16,185,129,.18); }

/* ── Horizontal Stacked Bar ── */
.syrinx-stacked-bar {
  display: flex;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--subtle);
}
.syrinx-stacked-bar-seg {
  height: 100%;
  min-width: 4px;
  transition: width .5s ease;
}
.syrinx-stacked-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.syrinx-stacked-bar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--dim);
}
.syrinx-stacked-bar-legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Ring / Donut Chart (CSS-only, conic-gradient) ── */
.syrinx-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.syrinx-ring::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: var(--surface);
}
.syrinx-ring-center {
  position: relative;
  z-index: 1;
  text-align: center;
}
.syrinx-ring-center-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: block;
  line-height: 1.1;
}
.syrinx-ring-center-label {
  font-size: 10px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .12em;
}

/* ── Sparkline Container ── */
.syrinx-sparkline {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  vertical-align: middle;
}
.syrinx-sparkline-bar {
  width: 4px;
  border-radius: 1px 1px 0 0;
  background: var(--syrinx-teal);
  opacity: .7;
  transition: height .3s ease;
}
.syrinx-sparkline-bar:last-child { opacity: 1; }

/* ── Heatmap Cell ── */
.syrinx-heatmap {
  display: grid;
  gap: 2px;
}
.syrinx-heat-cell {
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  min-height: 28px;
  padding: 4px;
}
.syrinx-heat-0 { background: var(--subtle); color: var(--muted); }
.syrinx-heat-1 { background: rgba(0,163,154,.10); }
.syrinx-heat-2 { background: rgba(0,163,154,.22); }
.syrinx-heat-3 { background: rgba(0,163,154,.38); }
.syrinx-heat-4 { background: rgba(0,163,154,.55); color: #fff; }
.syrinx-heat-5 { background: rgba(0,163,154,.75); color: #fff; }
body.dark-mode .syrinx-heat-0 { background: rgba(255,255,255,.04); }
body.dark-mode .syrinx-heat-1 { background: rgba(33,196,173,.10); }
body.dark-mode .syrinx-heat-2 { background: rgba(33,196,173,.20); }
body.dark-mode .syrinx-heat-3 { background: rgba(33,196,173,.34); }
body.dark-mode .syrinx-heat-4 { background: rgba(33,196,173,.50); }
body.dark-mode .syrinx-heat-5 { background: rgba(33,196,173,.70); }

/* ── Data Palette (consistent series colors for charts) ── */
:root {
  --chart-1: var(--syrinx-teal);
  --chart-2: #818cf8;
  --chart-3: #f59e0b;
  --chart-4: #ec4899;
  --chart-5: #38bdf8;
  --chart-6: #a78bfa;
  --chart-7: #fb923c;
  --chart-8: #34d399;
}

/* ── Comparison Table Enhancements ── */
.syrinx-table-highlight-row {
  background: var(--teal-subtle) !important;
}
.syrinx-table-bar-cell {
  position: relative;
}
.syrinx-table-bar-cell::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 0 2px 2px;
  background: var(--syrinx-teal);
  width: var(--bar-pct, 0%);
  transition: width .5s ease;
  opacity: .35;
}

/* ── Dark-mode legibility upgrades (Jun 2026) ──
   Paired with the lifted surface/border tokens above. On true-black UIs,
   drop shadows are invisible, so separation comes from an edge highlight
   (baked into --card-shadow) plus subtle row striping for dense tables. */
body.dark-mode table tbody tr:nth-child(even),
body[data-theme="dark"] table tbody tr:nth-child(even) {
  background: rgba(255,255,255,.022);
}

/* ── Responsive breakpoints ── */
@media (max-width: 600px) {
  .syrinx-stats { grid-template-columns: repeat(2, 1fr); }
  .syrinx-ring { width: 90px; height: 90px; }
  .syrinx-ring-center-value { font-size: 16px; }
}

/* ═══════════════════════════════════════════════════════════════
   Syrinx "Alive" cues  (opt-in)

   Small, restrained signals that the platform is live and data-backed —
   ported from the Syrinx marketing page. Every one is OPT-IN (you add a class
   or data-attribute to the specific element) and token-driven, so nothing
   animates unless an app asks for it. The fleet-wide reduced-motion block
   below neutralizes all of these for users who opted out of motion.

   This deliberately follows the motion-restraint rule: no always-running
   decorative glows applied globally. These mark genuinely live things
   (real-time feeds, fresh figures) and build-on-scroll reveals.
   ═══════════════════════════════════════════════════════════════ */

/* Live heartbeat dot — a real-time indicator for "Live" / "updating" labels.
   Usage: <span class="syrinx-live-dot"></span> Live
   The dot pulses opacity and emits a soft expanding ring in brand teal. */
.syrinx-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--syrinx-teal);
  box-shadow: 0 0 0 0 var(--teal-glow);
  animation: syrinx-live-pulse 2s ease-in-out infinite, syrinx-live-ring 2s ease-out infinite;
  vertical-align: middle;
}
@keyframes syrinx-live-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes syrinx-live-ring {
  0%   { box-shadow: 0 0 0 0 var(--teal-glow); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(0,0,0,0); }
}

/* Scroll reveal — content rises + fades as it enters the viewport.
   Usage: add .syrinx-reveal to a block (or each child of a grid). The shared
   initializer in syrinx-theme.js adds .in via IntersectionObserver. If JS is
   absent, a no-JS fallback (below) keeps everything visible. */
.syrinx-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.22,.61,.36,1);
  will-change: opacity, transform;
}
.syrinx-reveal.in { opacity: 1; transform: none; }
/* Fallback: no JS -> never leave content hidden. */
.no-js .syrinx-reveal, html:not(.syrinx-js) .syrinx-reveal { opacity: 1; transform: none; }

/* Figure shimmer — brief brightening to flag a freshly-read figure.
   The shared initializer (or app code) toggles .syrinx-shimmer on an element;
   it self-clears after the animation. Pair with .syrinx-num / .syrinx-stat-value. */
.syrinx-shimmer { animation: syrinx-figure-shimmer .9s ease-out; }
@keyframes syrinx-figure-shimmer {
  0%   { filter: brightness(1); }
  35%  { filter: brightness(1.75); }
  100% { filter: brightness(1); }
}

/* ── Motion restraint ──
   Decorative always-running animations (looping glows, pulses, scanlines,
   auto-scroll) are the strongest "AI-made" tell and an accessibility problem.
   Honor the OS-level reduced-motion preference fleet-wide. Purely additive:
   only affects users who have already opted out of motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Syrinx RESPONSIVE PRIMITIVES  (Sep 2026 — iPhone-friendly pass)

   Shared, opt-in building blocks so apps get consistent mobile behavior
   from ONE place instead of re-inventing breakpoints per app. Everything
   here is ADDITIVE: new tokens, new classes, and rules scoped to small
   viewports or to explicit opt-in classes. Nothing changes the desktop
   rendering of existing markup.

   Breakpoint convention (matches the values already used across the fleet):
     ≤900px  tablet / large phone landscape
     ≤760px  phone landscape / small tablet portrait
     ≤600px  phone portrait  (iPhone SE 375 … Pro Max 430 all fall here)
     ≤380px  narrowest phones (iPhone SE / mini)

   Validate with:  python -m scripts.responsive_audit.harness <app>
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* iOS safe-area insets (notch / home indicator / rounded corners). Zero on
     every non-iOS surface, so referencing these is always safe. */
  --syrinx-safe-top: env(safe-area-inset-top, 0px);
  --syrinx-safe-right: env(safe-area-inset-right, 0px);
  --syrinx-safe-bottom: env(safe-area-inset-bottom, 0px);
  --syrinx-safe-left: env(safe-area-inset-left, 0px);

  /* Apple HIG minimum comfortable tap target. Use for any interactive control
     that would otherwise be smaller on touch screens. */
  --syrinx-tap-min: 44px;

  /* Standard horizontal page padding, tightened on small screens via the
     breakpoints below. Apps can reference this instead of hardcoding gutters. */
  --syrinx-page-pad: 40px;
}

/* Prevent iOS Safari from auto-inflating text in landscape / after rotation,
   which silently breaks carefully-sized layouts. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Never let the document scroll sideways: horizontal scrolling is opt-in per
   component (via .syrinx-tscroll), never an accident of an overflowing child. */
html, body { max-width: 100%; }

/* ── Safe-area helpers ── */
.syrinx-safe-x { padding-left: max(var(--syrinx-page-pad), var(--syrinx-safe-left)); padding-right: max(var(--syrinx-page-pad), var(--syrinx-safe-right)); }
.syrinx-safe-b { padding-bottom: var(--syrinx-safe-bottom); }
.syrinx-safe-t { padding-top: var(--syrinx-safe-top); }

/* ── Touch-target floor ──
   Opt-in: add .syrinx-touch to a control (or a container to cover its buttons/
   links) to guarantee a 44px hit area without changing the visual box on
   pointer devices. Only enforced on coarse pointers (touch), so desktop
   density is untouched. */
@media (pointer: coarse) {
  .syrinx-touch,
  .syrinx-touch button,
  .syrinx-touch a,
  .syrinx-touch [role="button"],
  .syrinx-touch input,
  .syrinx-touch select {
    min-height: var(--syrinx-tap-min);
  }
  .syrinx-touch-sq { min-width: var(--syrinx-tap-min); min-height: var(--syrinx-tap-min); }
}

/* ── Deliberate horizontal table scroll ──
   Wrap a wide/dense table in <div class="syrinx-tscroll"> so tabular comparison
   scrolls sideways WITHIN the component instead of forcing the whole page to
   overflow. Momentum scroll on iOS + a subtle edge cue. */
.syrinx-tscroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
.syrinx-tscroll > table { min-width: max-content; }

/* ── Responsive grid helper ──
   Fluid auto-fit grid that collapses columns as width shrinks without any
   media query. Set --syrinx-grid-min per use (default 220px). */
.syrinx-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--syrinx-grid-min, 220px), 1fr));
  gap: var(--syrinx-grid-gap, 14px);
}

/* ── Fluid type helpers ──
   Clamp oversized display headings so a desktop-sized <h1> doesn't blow out a
   375px screen. Opt-in; apply to the specific heading, not globally. */
.syrinx-fluid-h1 { font-size: clamp(1.6rem, 6vw, 2.6rem); line-height: 1.12; }
.syrinx-fluid-h2 { font-size: clamp(1.3rem, 4.5vw, 1.9rem); line-height: 1.18; }

/* Truncate a single long line (e.g. a very long company name) with an ellipsis
   inside a flex/grid cell without breaking the row. */
.syrinx-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Clamp prose to N lines (set --syrinx-lines). */
.syrinx-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--syrinx-lines, 2);
  overflow: hidden;
}

/* ── Bottom-sheet / drawer primitive ──
   A mobile-first sheet that slides up from the bottom (drawers on desktop can
   keep their own styles; this is the shared touch pattern). Structure:
     <div class="syrinx-sheet-overlay" hidden>
       <div class="syrinx-sheet"> …content… </div>
     </div>
   Toggle `hidden` and the `.is-open` class from app JS. */
.syrinx-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(15, 20, 35, .38);
  opacity: 0;
  transition: opacity .2s ease;
  backdrop-filter: blur(4px);
}
.syrinx-sheet-overlay[hidden] { display: none; }
.syrinx-sheet-overlay.is-open { opacity: 1; }
.syrinx-sheet {
  width: 100%;
  max-width: 640px;
  max-height: min(88vh, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--syrinx-safe-bottom);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 -18px 60px rgba(10, 22, 40, .28);
  transform: translateY(12px);
  opacity: 0;
  transition: transform .24s cubic-bezier(.16, 1, .3, 1), opacity .2s ease;
}
.syrinx-sheet-overlay.is-open .syrinx-sheet { transform: translateY(0); opacity: 1; }
/* Drag-handle affordance at the top of the sheet. */
.syrinx-sheet::before {
  content: "";
  align-self: center;
  width: 38px;
  height: 4px;
  margin: 9px 0 3px;
  border-radius: 999px;
  background: var(--muted);
  opacity: .5;
  flex: 0 0 auto;
}
.syrinx-sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 20px 20px; }
@media (min-width: 601px) {
  /* On larger screens the sheet can center as a dialog instead of hugging the
     bottom edge — apps that want the centered look add .syrinx-sheet-centered. */
  .syrinx-sheet-centered { align-items: center; }
  .syrinx-sheet-centered .syrinx-sheet { border-radius: 16px; border-bottom: 1px solid var(--border); max-height: min(80vh, 720px); }
  .syrinx-sheet-centered .syrinx-sheet::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .syrinx-sheet-overlay, .syrinx-sheet { transition: none; }
}

/* ── Small-screen page padding tightening ──
   Anything using --syrinx-page-pad automatically gets tighter gutters on phones,
   so pages don't waste 40px of a 375px screen. */
@media (max-width: 760px) { :root { --syrinx-page-pad: 20px; } }
@media (max-width: 600px) { :root { --syrinx-page-pad: 16px; } }
@media (max-width: 380px) { :root { --syrinx-page-pad: 13px; } }

/* ── Shared skeleton behavior on small screens ──
   Skeleton blocks with an explicit desktop width should never exceed the
   viewport on a phone. */
@media (max-width: 600px) {
  .syrinx-skeleton { max-width: 100%; }
}
