/* Yoke — design system tokens + shared component CSS.
 * Ported verbatim from the design-handoff bundle (styles-hybrid.css +
 * styles-app.css). Light is the default; dark mode applies when the
 * <html> element has data-theme="dark". Theme persists via localStorage
 * (see /static/yoke-theme.js).
 */

:root {
  --bg: #E9EDF4;
  --bg-2: #E2E7F1;
  --surface: #FFFFFF;
  --surface-2: #EDF0F6;
  /* Solid white card surface, exposed as a non-self-referential token so the
   * .yoke-legacy layer can map --card to white without the var() cycle that
   * would otherwise collapse --card onto --surface-2. Mirrors --surface. */
  --card-bg: #FFFFFF;
  --text: #0A0E1A;
  --text-2: #434A60;
  --muted: #6E7790;
  --muted-2: #9AA0B2;

  --line: rgba(10, 14, 26, 0.12);
  --line-2: rgba(10, 14, 26, 0.20);

  --blue: #2563EB;
  --blue-soft: #3B82F6;
  --mint: #10B981;
  --violet: #8B5CF6;
  --amber: #D97706;
  --pink: #DB2777;
  --rose: #E11D48;

  --nav-bg: rgba(255, 255, 255, 0.78);
  --hero-tint-1: rgba(37, 99, 235, 0.07);
  --hero-tint-2: rgba(139, 92, 246, 0.05);

  --shadow-sm: 0 1px 2px rgba(10,14,26,0.06), 0 1px 3px rgba(10,14,26,0.04);
  --shadow-md: 0 10px 28px -10px rgba(10,14,26,0.16);
  --shadow-lg: 0 30px 80px -30px rgba(10,14,26,0.24);
  --shadow-glow: 0 0 0 1px rgba(37,99,235,0.22), 0 10px 30px -10px rgba(37,99,235,0.30);

  --grad-text: linear-gradient(180deg, #0A0E1A 0%, #4A5168 100%);
  --grad-accent: linear-gradient(120deg, var(--blue) 0%, var(--violet) 50%, var(--pink) 100%);
  --grad-logo: linear-gradient(135deg, var(--blue) 0%, var(--violet) 100%);

  --modal-back: rgba(10, 14, 26, 0.35);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --container: 1240px;

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #070912;
  --bg-2: #0B0F1C;
  --surface: #0F1320;
  --surface-2: #161B2C;
  --card-bg: #0F1320;
  --text: #E8ECF5;
  --text-2: #B0B8CC;
  --muted: #6B7388;
  --muted-2: #4A516A;

  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);

  --blue: #4A8BFF;
  --blue-soft: #6FA3FF;
  --mint: #34D399;
  --violet: #A78BFA;
  --amber: #FBBF24;
  --pink: #F472B6;
  --rose: #FB7185;

  --nav-bg: rgba(7, 9, 18, 0.65);
  --hero-tint-1: rgba(74, 139, 255, 0.18);
  --hero-tint-2: rgba(167, 139, 250, 0.08);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 16px 40px -16px rgba(0,0,0,0.6);
  --shadow-lg: 0 60px 120px -40px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 0 1px rgba(74,139,255,0.4), 0 10px 30px -10px rgba(74,139,255,0.6);

  --grad-text: linear-gradient(180deg, #FFFFFF 0%, #94A2C7 100%);
  --modal-back: rgba(3, 5, 12, 0.7);
}

/* Only apply this base body styling to pages that opt in via the
 * yoke-surface class — that way existing dashboards/reports with their
 * own inline <style> blocks aren't disturbed. */
.yoke-surface {
  margin: 0; padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s ease, color 0.4s ease;
  overflow-x: hidden;
  background-image:
    radial-gradient(1200px 700px at 50% -200px, var(--hero-tint-1), transparent 60%),
    radial-gradient(900px 600px at 90% 30%, var(--hero-tint-2), transparent 60%);
  min-height: 100vh;
}
.yoke-surface * { box-sizing: border-box; }
.yoke-surface a { color: inherit; text-decoration: none; }
.yoke-surface button { font-family: inherit; cursor: pointer; }
.yoke-surface .container { max-width: var(--container); margin: 0 auto; padding: 0 28px; }
.yoke-surface section { position: relative; }

/* ── Nav ───────────────────────────────────────── */
.yoke-surface .nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  transition: background 0.4s ease, border-color 0.4s ease;
}
.yoke-surface .nav-inner { display: flex; align-items: center; gap: 32px; height: 64px; }
.yoke-surface .nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.04em; font-size: 14px; }
.yoke-surface .nav-brand .wordmark { font-size: 17px; letter-spacing: 0.18em; }
.yoke-surface .nav-links { display: flex; gap: 28px; margin-left: 12px; font-size: 14px; color: var(--text-2); }
.yoke-surface .nav-links a { padding: 6px 0; transition: color 0.2s; }
.yoke-surface .nav-links a:hover { color: var(--text); }
.yoke-surface .nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* ── Theme toggle (iOS pill) ──────────────────── */
.theme-switch {
  position: relative;
  width: 60px; height: 32px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center;
  padding: 0 4px;
  transition: background 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
}
.theme-switch[data-on="true"] { background: var(--blue); border-color: transparent; }
.theme-switch .knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 999px;
  background: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.32s cubic-bezier(0.4, 1.4, 0.6, 1), background 0.3s;
  box-shadow: 0 2px 4px rgba(10,14,26,0.18), 0 0 0 0.5px rgba(10,14,26,0.04);
}
.theme-switch[data-on="true"] .knob { transform: translateX(28px); background: #0F1320; }
.theme-switch .icon { width: 14px; height: 14px; color: var(--amber); transition: opacity 0.25s, transform 0.25s; }
.theme-switch[data-on="true"] .icon { color: #FBBF24; }
.theme-switch .track-icons { display: flex; justify-content: space-between; width: 100%; padding: 0 6px; color: var(--muted); font-size: 9px; }
.theme-switch .track-icons svg { width: 12px; height: 12px; opacity: 0.5; }

/* ── Buttons ──────────────────────────────────── */
.yoke-surface .btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
  white-space: nowrap;
}
.yoke-surface .btn:active { transform: translateY(1px); }
.yoke-surface .btn-ghost { background: transparent; color: var(--text-2); }
.yoke-surface .btn-ghost:hover { color: var(--text); }
.yoke-surface .btn-outline { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.yoke-surface .btn-outline:hover { background: var(--surface-2); border-color: rgba(10,14,26,0.20); }
:root[data-theme="dark"] .yoke-surface .btn-outline:hover { border-color: rgba(255,255,255,0.20); }
.yoke-surface .btn-primary { background: var(--blue); color: #fff; box-shadow: var(--shadow-glow); }
.yoke-surface .btn-primary:hover { background: var(--blue-soft); }
.yoke-surface .btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }

/* ── Hero ─────────────────────────────────────── */
.yoke-surface .hero { padding: 120px 0 70px; text-align: center; }
.yoke-surface .eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px; font-family: var(--font-mono); color: var(--text-2);
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-sm);
}
.yoke-surface .eyebrow .dot {
  width: 18px; height: 18px; border-radius: 999px;
  background: var(--grad-logo);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: white;
}
.yoke-surface .hero h1 {
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.98; font-weight: 600; letter-spacing: -0.04em;
  margin: 28px auto 0; max-width: 14ch; text-wrap: balance;
}
.yoke-surface .hero h1 .gradient { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.yoke-surface .hero h1 .accent { background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent; font-style: italic; font-weight: 500; }
.yoke-surface .hero p.lead { max-width: 56ch; margin: 26px auto 0; font-size: 19px; line-height: 1.5; color: var(--text-2); text-wrap: pretty; }
.yoke-surface .hero-cta { display: inline-flex; gap: 12px; margin-top: 36px; }
.yoke-surface .hero-meta { margin-top: 22px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ── Showcase ─────────────────────────────────── */
.yoke-surface .showcase { padding: 30px 0 90px; }
.yoke-surface .showcase-shell { position: relative; max-width: 1340px; margin: 0 auto; padding: 0 28px; }
.yoke-surface .showcase-window {
  position: relative;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.yoke-surface .showcase-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  transition: background 0.4s ease;
}
.yoke-surface .showcase-tabs .lights { display: flex; gap: 6px; margin-right: 16px; }
.yoke-surface .showcase-tabs .lights span { width: 11px; height: 11px; border-radius: 999px; background: rgba(10,14,26,0.14); }
:root[data-theme="dark"] .yoke-surface .showcase-tabs .lights span { background: rgba(255,255,255,0.12); }
.yoke-surface .showcase-tab {
  padding: 7px 14px; border-radius: 8px;
  font-size: 13px; color: var(--muted);
  background: transparent; border: none;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.18s;
}
.yoke-surface .showcase-tab:hover { color: var(--text-2); }
.yoke-surface .showcase-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .yoke-surface .showcase-tab.active { background: rgba(255,255,255,0.06); box-shadow: none; }
.yoke-surface .showcase-tab .icon { width: 14px; height: 14px; }
.yoke-surface .showcase-tab-url { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.yoke-surface .showcase-tab-url .live {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.18);
  animation: livepulse 2s infinite;
}
@keyframes livepulse { 0%,100% { box-shadow: 0 0 0 4px rgba(16,185,129,0.18); } 50% { box-shadow: 0 0 0 6px rgba(16,185,129,0.04); } }
.yoke-surface .showcase-screen {
  background: #0B0F1C;
  padding: 24px;
  display: flex; align-items: center; justify-content: center;
  min-height: 460px;
  position: relative;
}
.yoke-surface .showcase-screen img { width: 100%; max-width: 1080px; display: block; border-radius: 14px; opacity: 0; animation: imgIn 0.45s ease forwards; }
@keyframes imgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.yoke-surface .showcase-caption { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: rgba(255,255,255,0.4); text-transform: uppercase; }

/* ── Marquee ──────────────────────────────────── */
.yoke-surface .marquee {
  padding: 50px 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  transition: background 0.4s;
}
.yoke-surface .marquee-label { text-align: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; margin-bottom: 24px; }
.yoke-surface .marquee-track { display: flex; gap: 60px; animation: marquee 36s linear infinite; width: max-content; }
.yoke-surface .marquee-track span { font-size: 22px; color: var(--text-2); font-weight: 500; white-space: nowrap; opacity: 0.7; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── Section heading ─────────────────────────── */
.yoke-surface .section { padding: 110px 0; }
.yoke-surface .section-head { max-width: 760px; margin: 0 auto 56px; text-align: center; }
.yoke-surface .section-eyebrow { font-family: var(--font-mono); font-size: 12px; color: var(--blue); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 14px; }
.yoke-surface .section h2 {
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 500; letter-spacing: -0.03em; line-height: 1.05;
  margin: 0;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-wrap: balance;
}
.yoke-surface .section p.section-lead { max-width: 56ch; margin: 22px auto 0; font-size: 17px; line-height: 1.55; color: var(--text-2); text-wrap: pretty; }

/* ── Bento ────────────────────────────────────── */
.yoke-surface .bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.yoke-surface .bento-card {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 28px;
  overflow: hidden;
  min-height: 280px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.yoke-surface .bento-card.span-2 { grid-column: span 2; }
.yoke-surface .bento-card.span-3 { grid-column: span 3; }
.yoke-surface .bento-card.span-4 { grid-column: span 4; }
.yoke-surface .bento-card.span-6 { grid-column: span 6; }
.yoke-surface .bento-card.tall { min-height: 380px; }
.yoke-surface .bento-card h3 { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 10px; }
.yoke-surface .bento-card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; max-width: 42ch; }
.yoke-surface .bento-card .bento-tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--blue); text-transform: uppercase; margin-bottom: 14px; }
.yoke-surface .bento-art { margin-top: auto; position: relative; padding-top: 20px; }
.yoke-surface .spark { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.yoke-surface .spark i { flex: 1; background: linear-gradient(180deg, var(--blue), rgba(37,99,235,0.30)); border-radius: 3px 3px 0 0; }
:root[data-theme="dark"] .yoke-surface .spark i { background: linear-gradient(180deg, var(--blue), rgba(74,139,255,0.30)); }
.yoke-surface .fleet-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.yoke-surface .fleet-grid i {
  aspect-ratio: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono); font-size: 9px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-style: normal;
}
.yoke-surface .fleet-grid i.active { background: rgba(37,99,235,0.10); border-color: rgba(37,99,235,0.40); color: var(--blue); }

/* ── Demo form ────────────────────────────────── */
.yoke-surface .demo { padding: 110px 0; }
.yoke-surface .demo-card {
  max-width: 980px; margin: 0 auto;
  background:
    radial-gradient(700px 400px at 30% 0%, rgba(37,99,235,0.08), transparent 60%),
    radial-gradient(500px 400px at 100% 100%, rgba(139,92,246,0.06), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 60px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 50px;
  box-shadow: var(--shadow-lg);
  transition: background 0.4s, border-color 0.4s;
}
.yoke-surface .demo-card h2 { font-size: 42px; letter-spacing: -0.03em; font-weight: 500; margin: 0 0 16px; text-wrap: balance; }
.yoke-surface .demo-card p { color: var(--text-2); font-size: 15px; line-height: 1.55; }
.yoke-surface .demo-bullets { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.yoke-surface .demo-bullet { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: var(--text-2); }
.yoke-surface .demo-bullet svg { flex-shrink: 0; margin-top: 2px; color: var(--mint); }
.yoke-surface .demo-form { display: flex; flex-direction: column; gap: 14px; }
.yoke-surface .field { display: flex; flex-direction: column; gap: 6px; }
.yoke-surface .field label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.yoke-surface .field input, .yoke-surface .field textarea, .yoke-surface .field select {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit; font-size: 14px;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.yoke-surface .field input:focus, .yoke-surface .field textarea:focus, .yoke-surface .field select:focus {
  outline: none; border-color: var(--blue); background: var(--surface);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
}
:root[data-theme="dark"] .yoke-surface .field input:focus,
:root[data-theme="dark"] .yoke-surface .field textarea:focus,
:root[data-theme="dark"] .yoke-surface .field select:focus { box-shadow: 0 0 0 4px rgba(74,139,255,0.18); }
.yoke-surface .field textarea { resize: vertical; min-height: 90px; }

/* ── Footer ──────────────────────────────────── */
.yoke-surface .footer { border-top: 1px solid var(--line); padding: 60px 0 40px; margin-top: 40px; background: var(--surface); transition: background 0.4s, border-color 0.4s; }
.yoke-surface .footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 50px; }
.yoke-surface .footer h4 { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500; margin: 0 0 14px; }
.yoke-surface .footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.yoke-surface .footer a { color: var(--text-2); font-size: 14px; }
.yoke-surface .footer a:hover { color: var(--text); }
.yoke-surface .footer-bottom { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--muted); padding-top: 24px; border-top: 1px solid var(--line); }

/* ── Op rows ──────────────────────────────────── */
.yoke-surface .op-row { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; padding: 60px 0; }
.yoke-surface .op-row + .op-row { border-top: 1px solid var(--line); }
.yoke-surface .op-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 28px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; box-shadow: var(--shadow-sm); }
.yoke-surface .op-stat-l { font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.yoke-surface .op-stat-v { font-size: 28px; margin-top: 6px; font-weight: 500; font-variant-numeric: tabular-nums; }
.yoke-surface .op-card-live { grid-column: span 3; margin-top: 12px; padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); font-family: var(--font-mono); }

/* ── Reveal ──────────────────────────────────── */
.yoke-surface .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2,0.8,0.2,1); }
.yoke-surface .reveal.in { opacity: 1; transform: none; }

/* ── App nav — shared chrome (works on both .yoke-surface and .yoke-legacy) ── */
.app-nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  transition: background 0.4s, border-color 0.4s;
  padding: 0;  /* override any legacy header padding */
}
.app-nav-inner { display: flex; align-items: center; height: 64px; gap: 18px; max-width: var(--container); margin: 0 auto; padding: 0 28px; }
.app-nav .nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.app-nav .nav-brand .wordmark { font-size: 17px; letter-spacing: 0.18em; font-weight: 600; }
.crumb {
  display: inline-flex; align-items: center;
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.20);
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 500;
}
:root[data-theme="dark"] .crumb { background: rgba(74,139,255,0.10); border-color: rgba(74,139,255,0.30); color: var(--blue-soft); }
.app-nav .right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.app-nav .nav-link { padding: 8px 14px; font-size: 14px; color: var(--text-2); border-radius: 8px; transition: background 0.18s, color 0.18s; text-decoration: none; }
.app-nav .nav-link:hover { color: var(--text); background: var(--surface-2); }
.app-nav .divider { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }

.yoke-surface .app-shell { max-width: 1240px; margin: 0 auto; padding: 64px 28px 120px; }
.yoke-surface .app-welcome { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 56px; flex-wrap: wrap; }
.yoke-surface .app-welcome h1 { font-size: 56px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 12px; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.yoke-surface .app-welcome p { color: var(--text-2); font-size: 17px; margin: 0; }
.yoke-surface .app-welcome .who { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; display: flex; flex-direction: column; gap: 6px; text-align: right; align-items: flex-end; white-space: nowrap; }
.yoke-surface .app-welcome .who b { color: var(--text); font-weight: 500; text-transform: none; letter-spacing: 0; font-family: var(--font-sans); font-size: 15px; }
.yoke-surface .app-welcome .who .role { color: var(--text-2); }
.yoke-surface .app-welcome .who .when { color: var(--muted); }

.yoke-surface .app-section { margin-bottom: 56px; }
.yoke-surface .app-section-title { display: flex; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.22em; color: var(--muted); text-transform: uppercase; margin: 0 0 22px; }
.yoke-surface .app-section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.yoke-surface .tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.yoke-surface .tile {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 280px;
  padding: 28px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.22s ease, border-color 0.22s, background 0.4s;
  text-decoration: none; color: inherit; cursor: pointer; overflow: hidden;
}
.yoke-surface .tile::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 0% 0%, var(--tile-tint, rgba(37,99,235,0.07)), transparent 60%);
  opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
}
.yoke-surface .tile:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-md); }
.yoke-surface .tile:hover::before { opacity: 1; }
.yoke-surface .tile-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tile-bg, rgba(37,99,235,0.10));
  border: 1px solid var(--tile-border, rgba(37,99,235,0.18));
  color: var(--tile-fg, var(--blue));
  margin-bottom: 22px;
}
.yoke-surface .tile-icon svg { width: 26px; height: 26px; }
/* Full-colour emoji icons bring their own colour — use a neutral chip behind. */
.yoke-surface .tile-icon.emoji { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.10); }
.yoke-surface .tile-icon.emoji .tile-emoji { width: 40px; height: 40px; display: block; }
.yoke-surface .coming-badge { margin-top: 4px; display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--amber); background: rgba(217,119,6,0.12); border: 1px solid rgba(217,119,6,0.25); border-radius: 999px; padding: 4px 12px; }
.yoke-surface .tile.is-coming { cursor: default; }
.yoke-surface .tile.is-coming:hover { transform: none; }
.yoke-surface .tile h3 { font-size: 22px; letter-spacing: -0.02em; font-weight: 600; margin: 0 0 10px; }
.yoke-surface .tile p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.yoke-surface .tile p .note { color: var(--blue); font-style: italic; }
:root[data-theme="dark"] .yoke-surface .tile p .note { color: var(--blue-soft); }
.yoke-surface .tile-link { margin-top: auto; padding-top: 24px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--blue); font-weight: 500; transition: gap 0.2s; }
:root[data-theme="dark"] .yoke-surface .tile-link { color: var(--blue-soft); }
.yoke-surface .tile:hover .tile-link { gap: 10px; }

.yoke-surface .tile.t-admin       { --tile-tint: rgba(225, 29, 72, 0.10);  --tile-bg: rgba(225, 29, 72, 0.10);  --tile-border: rgba(225, 29, 72, 0.20);  --tile-fg: var(--rose); }
.yoke-surface .tile.t-dashboards  { --tile-tint: rgba(37, 99, 235, 0.10);  --tile-bg: rgba(37, 99, 235, 0.12);  --tile-border: rgba(37, 99, 235, 0.22);  --tile-fg: var(--blue); }
.yoke-surface .tile.t-reports     { --tile-tint: rgba(16, 185, 129, 0.10); --tile-bg: rgba(16, 185, 129, 0.12); --tile-border: rgba(16, 185, 129, 0.22); --tile-fg: var(--mint); }
.yoke-surface .tile.t-proposals   { --tile-tint: rgba(217, 119, 6, 0.10);  --tile-bg: rgba(217, 119, 6, 0.12);  --tile-border: rgba(217, 119, 6, 0.22);  --tile-fg: var(--amber); }
.yoke-surface .tile.t-trip        { --tile-tint: rgba(139, 92, 246, 0.10); --tile-bg: rgba(139, 92, 246, 0.12); --tile-border: rgba(139, 92, 246, 0.22); --tile-fg: var(--violet); }
.yoke-surface .tile.t-quote       { --tile-tint: rgba(219, 39, 119, 0.10); --tile-bg: rgba(219, 39, 119, 0.12); --tile-border: rgba(219, 39, 119, 0.22); --tile-fg: var(--pink); }
.yoke-surface .tile.t-quote-new   { --tile-tint: rgba(37, 99, 235, 0.10);  --tile-bg: rgba(37, 99, 235, 0.12);  --tile-border: rgba(37, 99, 235, 0.22);  --tile-fg: var(--blue); }

.yoke-surface .sync-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.yoke-surface .sync-chip .live { width: 6px; height: 6px; border-radius: 999px; background: var(--mint); box-shadow: 0 0 0 4px rgba(16,185,129,0.18); animation: livepulse 2s infinite; }

/* ── Modal (login) ────────────────────────────────── */
.yoke-surface .modal-back {
  position: fixed; inset: 0;
  background: var(--modal-back);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  animation: modalfade 0.2s ease;
}
@keyframes modalfade { from { opacity: 0; } to { opacity: 1; } }
.yoke-surface .modal {
  width: 100%; max-width: 440px;
  background: radial-gradient(400px 300px at 50% 0%, rgba(37,99,235,0.10), transparent 60%), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  position: relative;
  animation: modalpop 0.25s cubic-bezier(0.2,0.8,0.2,1);
  box-shadow: 0 40px 80px -20px rgba(10,14,26,0.25);
}
:root[data-theme="dark"] .yoke-surface .modal { background: radial-gradient(400px 300px at 50% 0%, rgba(74,139,255,0.18), transparent 60%), var(--surface); box-shadow: 0 40px 80px -20px rgba(0,0,0,0.6); }
@keyframes modalpop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.yoke-surface .modal-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; color: var(--text-2); display: flex; align-items: center; justify-content: center; }
.yoke-surface .modal-brand { display: flex; align-items: center; justify-content: center; margin-bottom: 22px; }
.yoke-surface .modal h3 { text-align: center; font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 6px; }
.yoke-surface .modal p.sub { text-align: center; color: var(--text-2); font-size: 14px; margin: 0 0 28px; }
.yoke-surface .modal-form { display: flex; flex-direction: column; gap: 14px; }
.yoke-surface .modal-divider { margin: 18px 0; display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.14em; }
.yoke-surface .modal-divider::before, .yoke-surface .modal-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.yoke-surface .modal-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-2); }
.yoke-surface .modal-foot a { color: var(--blue); }
.yoke-surface .error-msg { font-size: 12px; color: var(--rose); font-family: var(--font-mono); }

/* ── Legacy compatibility layer ─────────────────────────────────
 * Every pre-design pages declared its own dark-only :root tokens
 * (--bg, --card, --surface, --fg, --muted, --accent, --border,
 * --positive, --negative, --accent2..5). Adding `class="yoke-legacy"`
 * to the <body> maps those names to the new theme tokens, so light/dark
 * works without touching the page's component CSS. The page must NOT
 * declare its own :root { --bg: ... } block — that would override
 * the theme. Existing layouts keep working under this layer; full
 * design-fidelity refactor is a separate per-page job.
 */
.yoke-legacy {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  /* --card is the solid card surface (white in light, dark panel in dark).
   * It must point at --card-bg, NOT var(--surface): legacy redefines --surface
   * to the subdued tone just below, and a var(--surface) reference here would
   * resolve to that subdued value (CSS custom-property substitution uses the
   * element's own computed --surface), collapsing every card onto one flat
   * tone. Pointing at --card-bg (never overridden on legacy) avoids the cycle. */
  --card: var(--card-bg);
  --card2: var(--surface-2);
  --surface: var(--surface-2);  /* legacy "--surface" was the more-subdued tone */
  --fg: var(--text);
  --muted: var(--text-2);
  --accent: var(--blue);
  --accent2: var(--mint);
  --accent3: var(--violet);
  --accent4: var(--amber);
  --accent5: var(--pink);
  --border: var(--line);
  --positive: var(--mint);
  --negative: var(--rose);
  --warn: var(--amber);
  --sold: var(--blue);
  --actual: var(--mint);
  --expense: var(--pink);
  --flights-color: var(--violet);
  --hours-color: var(--mint);
}
/* The legacy header logo image was a PNG inverted with a CSS filter
 * for the dark background. In light mode that goes white-on-white;
 * undo the inversion when the theme is light. */
:root[data-theme="light"] .yoke-legacy .header-logo-icon,
:root[data-theme="light"] .yoke-legacy .brand img,
:root[data-theme="light"] .yoke-legacy .login-brand img {
  filter: none;
}

/* ── Logo mark image — used in every app-nav and the login modal.
 * The PNG is dark-on-transparent, so it reads natively on light surfaces.
 * Invert + brighten in dark mode to render as white-on-dark. */
.yoke-logo-mark {
  display: inline-block;
  vertical-align: middle;
  height: 22px; width: auto;
  transition: filter 0.4s ease;
}
:root[data-theme="dark"] .yoke-logo-mark { filter: invert(1) brightness(10); }
/* The login-modal logo is rendered at 32×32 — let the page's own width attr
 * take effect by not forcing a height here.  */
.modal .yoke-logo-mark { height: 32px; }

/* ── Filter bars on legacy pages — unified design-system look ─────────────
 * Every dashboard and report has a `.filter-bar` row of selects + period chips
 * + a `.btn-refresh` action. These overrides bring all of them in line with
 * the design system: surface-2 inputs with rounded 10px corners + focus glow,
 * pill chips, and a primary-pill refresh button.
 * Specificity is `.yoke-legacy .filter-bar select` (2 classes + type) which
 * beats the per-page `.filter-bar select` (1 class + type).
 */
.yoke-legacy .filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background 0.4s, border-color 0.4s;
}
.yoke-legacy .filter-bar > label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.yoke-legacy .filter-bar select,
.yoke-legacy .filter-bar input,
.yoke-legacy .filter-bar .ms-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.yoke-legacy .filter-bar select:focus,
.yoke-legacy .filter-bar input:focus,
.yoke-legacy .filter-bar .ms-btn:focus,
.yoke-legacy .filter-bar select:hover,
.yoke-legacy .filter-bar .ms-btn:hover {
  outline: none;
  border-color: var(--blue);
}
.yoke-legacy .filter-bar select:focus,
.yoke-legacy .filter-bar input:focus,
.yoke-legacy .filter-bar .ms-btn:focus {
  box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
}
:root[data-theme="dark"] .yoke-legacy .filter-bar select:focus,
:root[data-theme="dark"] .yoke-legacy .filter-bar input:focus,
:root[data-theme="dark"] .yoke-legacy .filter-bar .ms-btn:focus {
  box-shadow: 0 0 0 4px rgba(74,139,255,0.18);
}

.yoke-legacy .ms-menu {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 10px;
}

.yoke-legacy .period-chip {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.yoke-legacy .period-chip:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.yoke-legacy .period-chip.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* Primary "Refresh" button → design-system pill */
.yoke-legacy .btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: background 0.2s, transform 0.15s;
}
.yoke-legacy .btn-refresh:hover { background: var(--blue-soft); }
.yoke-legacy .btn-refresh:active { transform: translateY(1px); }

/* Other inline `.btn` / `.btn-secondary` button variants used on report pages
 * (trip-report, settings, etc.) — turn them into design-system pills too. */
.yoke-legacy .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: background 0.2s, transform 0.15s;
}
.yoke-legacy .btn:hover { background: var(--blue-soft); }
.yoke-legacy .btn:active { transform: translateY(1px); }
.yoke-legacy .btn-secondary,
.yoke-legacy .btn.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-2);
  box-shadow: none;
}
.yoke-legacy .btn-secondary:hover,
.yoke-legacy .btn.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--blue);
  color: var(--blue);
}

/* ── KPI / chart / table card upgrades on legacy pages ──────────────
 * The dashboards and reports already define their own .kpi-card, .chart-card,
 * .table-card layouts. These overrides bring them in line with the design-
 * system bento aesthetic — bigger radius, softer shadow, more generous
 * padding — without disturbing the per-card accent borders pages set.
 */
.yoke-legacy .kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.3rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.yoke-legacy .kpi-card .kpi-label {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}
.yoke-legacy .kpi-card .kpi-value {
  font-variant-numeric: tabular-nums;
}

.yoke-legacy .chart-card,
.yoke-legacy .table-card,
.yoke-legacy .section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.yoke-legacy .chart-card h2,
.yoke-legacy .table-card h2,
.yoke-legacy .section h2 {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.yoke-legacy .chart-card-header h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--blue);
  text-transform: uppercase;
  font-weight: 500;
}
:root[data-theme="dark"] .yoke-legacy .chart-card-header h2 { color: var(--blue-soft); }
.yoke-legacy .chart-card-header .chart-total {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.yoke-legacy .chart-card-header .chart-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* The toolbar above table cards (e.g. on Settings) — make the heading look
 * like a section eyebrow + headline pair. */
.yoke-legacy .toolbar h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ── Per-page crumb accents — keep the page identity that page-specific
 *    badges used to provide. yoke-theme.js sets data-page on <html>. */
:root[data-page="admin"]        .crumb { background: rgba(225, 29, 72, 0.10); border-color: rgba(225, 29, 72, 0.30); color: var(--rose); }
:root[data-page="dashboards"]   .crumb { background: rgba(37, 99, 235, 0.10); border-color: rgba(37, 99, 235, 0.30); color: var(--blue); }
:root[data-page="charter"]      .crumb { background: rgba(37, 99, 235, 0.10); border-color: rgba(37, 99, 235, 0.30); color: var(--blue); }
:root[data-page="subcharter"]   .crumb { background: rgba(217, 119, 6, 0.10); border-color: rgba(217, 119, 6, 0.30); color: var(--amber); }
:root[data-page="aircraft"]     .crumb { background: rgba(16, 185, 129, 0.10); border-color: rgba(16, 185, 129, 0.30); color: var(--mint); }
:root[data-page="owner"]        .crumb { background: rgba(139, 92, 246, 0.10); border-color: rgba(139, 92, 246, 0.30); color: var(--violet); }
:root[data-page="reports"]      .crumb { background: rgba(16, 185, 129, 0.10); border-color: rgba(16, 185, 129, 0.30); color: var(--mint); }
:root[data-page="flights"]      .crumb { background: rgba(139, 92, 246, 0.10); border-color: rgba(139, 92, 246, 0.30); color: var(--violet); }
:root[data-page="expenses"]     .crumb { background: rgba(219, 39, 119, 0.10); border-color: rgba(219, 39, 119, 0.30); color: var(--pink); }
:root[data-page="trip-lookup"]  .crumb { background: rgba(139, 92, 246, 0.10); border-color: rgba(139, 92, 246, 0.30); color: var(--violet); }
:root[data-page="quote-lookup"] .crumb { background: rgba(219, 39, 119, 0.10); border-color: rgba(219, 39, 119, 0.30); color: var(--pink); }
:root[data-page="trip-report"]  .crumb { background: rgba(16, 185, 129, 0.10); border-color: rgba(16, 185, 129, 0.30); color: var(--mint); }
:root[data-page="quote-new"]    .crumb { background: rgba(37, 99, 235, 0.10); border-color: rgba(37, 99, 235, 0.30); color: var(--blue); }
:root[data-page="settings"]     .crumb { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
:root[data-page="security"]     .crumb { background: rgba(37, 99, 235, 0.10); border-color: rgba(37, 99, 235, 0.30); color: var(--blue); }

/* In dark mode, lift the colors to the lighter tone for legibility. */
:root[data-theme="dark"][data-page="admin"]        .crumb { color: #FB7185; }
:root[data-theme="dark"][data-page="charter"]      .crumb,
:root[data-theme="dark"][data-page="dashboards"]   .crumb,
:root[data-theme="dark"][data-page="quote-new"]    .crumb,
:root[data-theme="dark"][data-page="security"]     .crumb { color: var(--blue-soft); }
:root[data-theme="dark"][data-page="subcharter"]   .crumb { color: #FBBF24; }
:root[data-theme="dark"][data-page="aircraft"]     .crumb,
:root[data-theme="dark"][data-page="reports"]      .crumb,
:root[data-theme="dark"][data-page="trip-report"]  .crumb { color: #34D399; }
:root[data-theme="dark"][data-page="owner"]        .crumb,
:root[data-theme="dark"][data-page="flights"]      .crumb,
:root[data-theme="dark"][data-page="trip-lookup"]  .crumb { color: #A78BFA; }
:root[data-theme="dark"][data-page="expenses"]     .crumb,
:root[data-theme="dark"][data-page="quote-lookup"] .crumb { color: #F472B6; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  .yoke-surface .nav-links { display: none; }
  .yoke-surface .hero { padding: 80px 0 40px; }
  .yoke-surface .bento-card { grid-column: span 6 !important; }
  .yoke-surface .demo-card { grid-template-columns: 1fr; padding: 36px 28px; }
  .yoke-surface .footer-grid { grid-template-columns: 1fr 1fr; }
  .yoke-surface .op-row { grid-template-columns: 1fr; gap: 30px; }
  .yoke-surface .showcase-screen { padding: 12px; min-height: 280px; }
  .yoke-surface .tile-grid { grid-template-columns: 1fr; }
  .yoke-surface .app-welcome h1 { font-size: 40px; }
  .yoke-surface .app-shell { padding: 32px 20px 60px; }
}

/* ────────────────────────────────────────────────────────────────────
 * MOBILE — every legacy dashboard and report page.
 * Applies anywhere the body has .yoke-legacy. Tightens spacing, stacks
 * grids into a single column, makes the app-nav and filter bar wrap,
 * and gives tables a horizontal scroll wrapper so they don't blow out
 * the viewport.
 * ──────────────────────────────────────────────────────────────────── */

/* Always-on table scroll wrapper (works at any width but is essential mobile) */
.yoke-legacy .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.yoke-legacy .table-card table { min-width: 100%; }

/* Tablet — 1024px and below */
@media (max-width: 1024px) {
  .yoke-legacy .chart-grid,
  .yoke-legacy .chart-grid-2,
  .yoke-legacy .chart-grid-3 { grid-template-columns: 1fr; gap: 1rem; }
  .yoke-legacy main { padding: 1.25rem 1rem; }
}

/* Phone — 720px and below */
@media (max-width: 720px) {
  /* App-nav: tighten and allow wrapping, hide redundant items */
  .app-nav-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    gap: 10px;
    padding: 10px 14px;
  }
  .app-nav .nav-brand .wordmark { font-size: 14px; letter-spacing: 0.14em; }
  .app-nav .crumb {
    font-size: 9.5px;
    letter-spacing: 0.14em;
    padding: 5px 12px;
  }
  /* The right group keeps theme switch + log out; back-link + Guide collapse
     into a compact menu position by being smaller, but still visible. */
  .app-nav .right { gap: 2px; }
  .app-nav .nav-link { padding: 6px 8px; font-size: 12px; }
  .app-nav .divider { display: none; }

  /* Page chrome */
  .yoke-legacy main { padding: 1rem .75rem 2.5rem; }
  .yoke-legacy .toolbar { flex-direction: column; align-items: stretch; gap: .75rem; }
  .yoke-legacy .toolbar h1 { font-size: 1.3rem; }

  /* Filter bars — stack to a column, full-width controls */
  .yoke-legacy .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: .55rem;
    padding: 12px 14px;
  }
  .yoke-legacy .filter-bar > label {
    margin-top: .25rem;
  }
  .yoke-legacy .filter-bar select,
  .yoke-legacy .filter-bar input,
  .yoke-legacy .filter-bar .ms-btn,
  .yoke-legacy .filter-bar .ms-wrap,
  .yoke-legacy .filter-bar .btn-refresh,
  .yoke-legacy .filter-bar .btn { width: 100%; }
  .yoke-legacy .filter-bar .period-chip { flex: 1 1 40%; }
  .yoke-legacy .ms-menu { left: 0; right: 0; width: auto; min-width: 0; }

  /* KPI grid: single column with snug cards */
  .yoke-legacy .kpi-row { grid-template-columns: 1fr; gap: .75rem; margin-bottom: 1.25rem; }
  .yoke-legacy .kpi-card { padding: 1rem 1.1rem; }
  .yoke-legacy .kpi-card .kpi-value { font-size: 1.35rem; }

  /* Chart cards: ensure usable height even when stacked */
  .yoke-legacy .chart-card,
  .yoke-legacy .table-card,
  .yoke-legacy .section { padding: 20px 18px; border-radius: 16px; }
  .yoke-legacy .chart-wrap { height: 240px !important; }
  .yoke-legacy .chart-wrap.tall { height: 260px !important; }

  /* Trip-report / lookup detail page: stack grids + actions */
  .yoke-legacy .trip-header-grid { grid-template-columns: 1fr 1fr !important; gap: .5rem; }
  .yoke-legacy .ft-row { grid-template-columns: 1fr; }
  .yoke-legacy .actions-bar { flex-wrap: wrap; }
  .yoke-legacy .actions-bar .btn,
  .yoke-legacy .actions-bar .btn-refresh { flex: 1 1 40%; min-width: 0; }
  .yoke-legacy .lookup-row { flex-direction: column; align-items: stretch; }
  .yoke-legacy .lookup-input { width: 100%; }

  /* Settings: modal becomes near-fullscreen */
  .yoke-legacy .modal { max-width: 100%; padding: 1.25rem; margin: 0 .5rem; }
  .yoke-legacy .modal-reports { grid-template-columns: 1fr; }

  /* Tables: smaller font, tighter padding, no row-actions wrap-break */
  .yoke-legacy table { font-size: .78rem; }
  .yoke-legacy thead th,
  .yoke-legacy tbody td { padding: .4rem .35rem; }
  .yoke-legacy .row-actions { display: flex; flex-wrap: wrap; gap: .25rem; }
  .yoke-legacy .row-actions button { font-size: .7rem; padding: .25rem .45rem; }

  /* App-hub welcome + tiles already responsive at 900px in .yoke-surface;
     reinforce here for narrow screens. */
  .yoke-surface .app-welcome { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .yoke-surface .app-welcome h1 { font-size: 34px; }
  .yoke-surface .app-welcome .who { text-align: left; align-items: flex-start; }
  .yoke-surface .app-shell { padding: 24px 14px 60px; }
  .yoke-surface .tile { padding: 22px; min-height: 220px; }
  .yoke-surface .tile h3 { font-size: 19px; }
  .yoke-surface .tile p { font-size: 13px; }

  /* Marketing site: hero scaling */
  .yoke-surface .hero { padding: 60px 0 30px; }
  .yoke-surface .hero h1 { max-width: none; }
  .yoke-surface .hero-meta { font-size: 11px; }
  .yoke-surface .hero-cta { flex-direction: column; align-items: stretch; }
  .yoke-surface .hero-cta .btn { width: 100%; justify-content: center; }
  .yoke-surface .marquee { padding: 30px 0 20px; }
  .yoke-surface .marquee-track span { font-size: 16px; }
  .yoke-surface .section { padding: 60px 0; }
  .yoke-surface .demo-card { padding: 28px 20px; gap: 20px; }
  .yoke-surface .demo-card h2 { font-size: 28px; }
  .yoke-surface .footer { padding: 40px 0 30px; }
  .yoke-surface .footer-grid { grid-template-columns: 1fr; gap: 28px; margin-bottom: 30px; }
  .yoke-surface .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  /* Login + auth screens: cards stay readable */
  .yoke-surface .modal { width: 100%; max-width: 100%; padding: 1.75rem 1.5rem; border-radius: 16px; }
  .yoke-surface .login-theme { top: 12px; right: 12px; }

  /* Sync chip in nav — drop the "synced X min ago" suffix on the smallest
     screens; the dot still conveys liveness. */
  .yoke-surface .sync-chip,
  .yoke-legacy .sync-chip { font-size: 10px; padding: 4px 10px 4px 8px; }
}

/* ── Collapsible filter bar (mobile only) ──────────────────────────
 * The .filters-toggle button is injected by yoke-theme.js into every
 * .filter-bar. Hidden on desktop, full-width on mobile. When the bar
 * has .is-collapsed (default on mobile), every child except the toggle
 * and the Refresh button is hidden — so the user always sees the
 * "Filters" pill plus a Refresh action on the same row. */
.filters-toggle { display: none; }

@media (max-width: 720px) {
  .filters-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 1 1 auto;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
  }
  .filters-toggle:hover {
    border-color: var(--blue);
    color: var(--blue);
  }
  .filters-toggle .ft-chev {
    display: inline-flex;
    color: var(--muted);
    transition: transform 0.22s ease;
  }
  .filter-bar:not(.is-collapsed) .filters-toggle .ft-chev {
    transform: rotate(180deg);
    color: var(--blue);
  }
  .filter-bar:not(.is-collapsed) .filters-toggle {
    border-color: var(--blue);
    color: var(--blue);
  }

  /* Collapsed: filter bar becomes a single row of toggle + refresh */
  .yoke-legacy .filter-bar.is-collapsed {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }
  .yoke-legacy .filter-bar.is-collapsed > *:not(.filters-toggle):not(.btn-refresh) {
    display: none !important;
  }
  .yoke-legacy .filter-bar.is-collapsed .btn-refresh {
    width: auto;
    flex: 0 0 auto;
    padding: 0 16px;
  }
}

/* Extra-small phones (under 380px): collapse the back-link and Guide. */
@media (max-width: 380px) {
  .app-nav .nav-link:not(:last-child) { display: none; }
}
