/* Champion Care — Design tokens (premium telehealth, Fraunces + Outfit, cream/crimson palette)
   Class names match the existing demo so non-patient pages restyle without JSX edits.
   Light theme is default; .theme-dark on <html> opts into the dark variant. */
:root {
  /* Reference tokens (canonical names) */
  --ink:        #161616;
  --ink-2:      #2A2A2A;
  --ink-3:      #4A4A4A;
  --red:        #C8273A;
  --red-deep:   #9F1E2E;
  --red-soft:   #E45867;
  --rose:       #E8A4AC;
  --blush:      #F7E4E0;
  --blush-2:    #F0D2CC;
  --cream:      #FAF6F0;
  --cream-2:    #F2EBE0;
  --paper:      #FCFAF5;
  --surface:    #FFFFFF;
  --muted:      #7A716B;
  --muted-2:    #A89F98;
  --line:       rgba(22, 22, 22, 0.08);
  --line-2:     rgba(22, 22, 22, 0.15);
  --shadow-sm:  0 2px 6px rgba(22, 22, 22, 0.05);
  --shadow-md:  0 8px 24px rgba(22, 22, 22, 0.08);
  --shadow-lg:  0 24px 60px rgba(22, 22, 22, 0.12);
  --gold:       #C8A35A;
  --green:      #167a43;
  --green-soft: rgba(22, 122, 67, 0.10);

  /* Backwards-compat aliases. Existing JSX files reference --cc-* heavily,
     so we keep the names but remap them onto the new palette.
     --cc-canvas was semantically "ink/high-contrast" (dark text inside .light
     blocks, dark page bg in the old dark-first design). On a light-first
     palette it should resolve to ink. Background usages that need a light page
     surface now reference --paper or --surface directly. */
  --cc-canvas:      var(--ink);
  --cc-surface:     var(--surface);
  --cc-surface-2:   var(--cream-2);
  --cc-bone:        var(--cream);
  --cc-bone-2:      var(--cream-2);
  --cc-blood:       var(--red);
  --cc-blood-deep:  var(--red-deep);
  --cc-gold:        var(--gold);
  --cc-clinical:    #3B82F6;
  --cc-success:     #167a43;
  --cc-warn:        #B7791F;
  --cc-text:        var(--ink);
  --cc-text-mute:   var(--muted);
  --cc-hairline:    var(--line);
  --cc-hairline-light: var(--line);

  /* Typography */
  --display: 'Fraunces', Georgia, serif;
  --heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --body:    'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, monospace;
}

/* Dark theme: opt-in via .theme-dark on the html element. Mirrors the reference's
   .app.theme-dark — neutrals invert, crimson + gold stay constant. */
html.theme-dark {
  --ink:      #F2EBE0;
  --ink-2:    #DCD4C8;
  --ink-3:    #A8A09A;
  --paper:    #141414;
  --cream:    #1F1F1F;
  --cream-2:  #2A2A2A;
  --surface:  #1F1F1F;
  --muted:    #8E867F;
  --muted-2:  #6B6660;
  --line:     rgba(255, 255, 255, 0.08);
  --line-2:   rgba(255, 255, 255, 0.14);
  --blush:    #2A2020;
  --blush-2:  #332428;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* Display = Fraunces. Italics in <em> render in crimson. */
.display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.04;
  font-variation-settings: 'opsz' 144;
  text-transform: none;
}
.display em { font-style: italic; color: var(--red); font-weight: 400; }

/* Eyebrow — small crimson overline with a leading hairline */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
}
.eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--red);
  flex-shrink: 0;
}

.mono { font-family: var(--mono); }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--body);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 100px;
  transition: background 180ms ease, color 180ms ease, border-color 180ms, transform 100ms, box-shadow 180ms;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 0 8px 24px rgba(22, 22, 22, 0.18);
}
.btn-primary:hover { background: var(--ink-2); }

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}
.btn-gold:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-2);
}
.btn-ghost:hover { background: rgba(22, 22, 22, 0.04); border-color: var(--ink); }
html.theme-dark .btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }

/* The legacy "ghost-light" variant maps to the same ghost button on the new palette. */
.btn-ghost-light {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-2);
}
.btn-ghost-light:hover { background: rgba(22, 22, 22, 0.04); }

.btn-danger {
  background: rgba(200, 39, 58, 0.10);
  color: var(--red);
  border: 1px solid rgba(200, 39, 58, 0.20);
}
.btn-danger:hover { background: rgba(200, 39, 58, 0.16); }

.btn-lg { padding: 16px 28px; font-size: 15.5px; }
.btn-sm { padding: 8px 16px; font-size: 13px; gap: 6px; }

/* ───────── Hairlines / dividers ───────── */
.hr        { height: 1px; background: var(--line); border: none; }
.hr-light  { height: 1px; background: var(--line); border: none; }

/* ───────── Surfaces ───────── */
.surface   { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.surface-2 { background: var(--cream-2); border: 1px solid var(--line); border-radius: 18px; }

/* Soft cream cards used heavily in the reference (care services, settings rows) */
.surface-soft { background: var(--cream); border: 1px solid var(--line); border-radius: 18px; }

/* Striped placeholder (silhouette imagery — kept from old demo for marketing portraits) */
.placeholder {
  background-color: var(--cream-2);
  background-image: repeating-linear-gradient(135deg,
    rgba(22, 22, 22, 0.04) 0 8px,
    transparent 8px 18px);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 12px;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
}
.placeholder.light {
  background-color: var(--cream);
  color: var(--muted-2);
}
.placeholder.with-pop::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  background: var(--red);
  border-radius: 50%;
  bottom: 18%; right: 22%;
  box-shadow: 0 0 0 4px rgba(200, 18, 26, 0.18);
}

/* ───────── Layout ───────── */
.container      { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 32px; }

/* Removed legacy .light class — light is now the default. Keep the selector
   as a no-op for backwards compatibility with marketing JSX that toggles it. */
.light { background: var(--paper); color: var(--ink); }
.light .surface { background: var(--surface); border-color: var(--line); }
.light .surface-2 { background: var(--cream-2); border-color: var(--line); }
.light .hr { background: var(--line); }

/* Scrollbar */
.scroll-soft::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-soft::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 100px; }
.scroll-soft::-webkit-scrollbar-track { background: transparent; }

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp 280ms ease both; }

@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0.3; } }
.live-dot { animation: blink 1.6s infinite; }

/* ───────── Form ───────── */
.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 180ms, box-shadow 180ms;
}
.input::placeholder { color: var(--muted-2); }
.input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(200, 39, 58, 0.10);
}
.input.light-input { background: var(--surface); color: var(--ink); border-color: var(--line); }

/* ───────── Chips ───────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 150ms, color 150ms, border-color 150ms;
}
.chip:hover { border-color: var(--line-2); }
.chip.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.chip.light-chip { background: var(--surface); color: var(--ink); border-color: var(--line); }
.chip.light-chip.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }

/* ───────── Badges (status pills) ───────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.badge-active   { background: rgba(22, 122, 67, 0.10); color: var(--green); }
.badge-pending  { background: rgba(200, 163, 90, 0.18); color: #8C7438; }
.badge-blood    { background: rgba(200, 39, 58, 0.10); color: var(--red); }
.badge-gold     { background: rgba(200, 163, 90, 0.18); color: #8C7438; }
.badge-clinical { background: rgba(59, 130, 246, 0.10); color: #3B82F6; }
.badge-mute     { background: rgba(22, 22, 22, 0.06); color: var(--muted); }
html.theme-dark .badge-active   { background: rgba(74, 222, 128, 0.16); color: #6EE7A6; }
html.theme-dark .badge-pending  { background: rgba(212, 175, 55, 0.16); color: #D4AF37; }
html.theme-dark .badge-gold     { background: rgba(212, 175, 55, 0.16); color: #D4AF37; }
html.theme-dark .badge-mute     { background: rgba(255, 255, 255, 0.06); color: var(--muted); }

/* ───────── Avatar ───────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cream-2);
  border-radius: 50%;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  flex-shrink: 0;
  border: none;
  position: relative;
  overflow: hidden;
  font-family: var(--display);
  letter-spacing: -0.005em;
}
.avatar.has-pop {
  background: linear-gradient(135deg, var(--ink), var(--ink-2));
  color: var(--cream);
}
.avatar.bg-a { background: linear-gradient(135deg, #161616, #3A3A3A); color: var(--cream); }
.avatar.bg-b { background: linear-gradient(135deg, #C8273A, #9F1E2E); color: var(--cream); }
.avatar.bg-c { background: linear-gradient(135deg, #E8A4AC, #C57A85); color: var(--ink); }
.avatar.bg-d { background: linear-gradient(135deg, #4A4A4A, #2A2A2A); color: var(--cream); }
.avatar .online-dot {
  position: absolute; bottom: -2px; right: -2px;
  width: 14px; height: 14px;
  background: #4ade80;
  border: 3px solid var(--surface);
  border-radius: 50%;
}

/* ───────── App shell (sidebar + top bar) ───────── */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: var(--paper);
}

.side-nav {
  background: var(--cream);
  border-right: 1px solid var(--line);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.light .side-nav { background: var(--cream); border-right-color: var(--line); }

.side-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms, color 150ms;
}
.side-nav-item:hover { color: var(--ink); background: rgba(22, 22, 22, 0.04); }
.side-nav-item.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(22, 22, 22, 0.04), inset 0 0 0 1px var(--line);
  font-weight: 600;
}
.light .side-nav-item:hover { color: var(--ink); background: rgba(22, 22, 22, 0.04); }
.light .side-nav-item.active { color: var(--ink); background: var(--surface); }
html.theme-dark .side-nav-item:hover { background: rgba(255, 255, 255, 0.04); }
html.theme-dark .side-nav-item.active { background: var(--surface); }

.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.light .top-bar { background: var(--paper); border-bottom-color: var(--line); }

/* ───────── KPI card (used on dashboards) ───────── */
.kpi {
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.light .kpi { background: var(--surface); border-color: var(--line); }

/* ───────── Tables ───────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  padding: 14px 16px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  background: var(--cream);
}
.tbl td { padding: 16px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(22, 22, 22, 0.02); }
.light .tbl th { border-bottom-color: var(--line); }
.light .tbl td { border-bottom-color: var(--line); }
.light .tbl tr:hover td { background: rgba(22, 22, 22, 0.02); }
html.theme-dark .tbl tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* ───────── Sections ───────── */
.section    { padding: 96px 0; }
.section-sm { padding: 64px 0; }

/* ───────── Selection ───────── */
::selection { background: var(--red); color: var(--cream); }

/* ───────── Plan summary (dark hero card used on patient dashboard + account) ───────── */
.plan-summary {
  background: linear-gradient(135deg, var(--ink) 0%, #000 100%);
  color: var(--cream);
  border-radius: 22px;
  padding: 28px;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}
.plan-summary::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(200, 39, 58, 0.28), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.plan-summary .ps-price {
  display: inline-flex;
  align-items: center;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  color: var(--cream);
  background: rgba(250, 246, 240, 0.10);
  border: 1px solid rgba(250, 246, 240, 0.18);
  padding: 6px 14px;
  border-radius: 100px;
}

/* ───────── Care card (the reference's signature soft-cream service tile) ───────── */
.care-card {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 180ms, transform 100ms, box-shadow 180ms;
  text-align: left;
}
.care-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.care-card:active { transform: scale(0.99); }
.care-card .ic-wrap {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(22, 22, 22, 0.06);
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.care-card .care-name {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 4px;
}
.care-card .care-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
html.theme-dark .care-card .ic-wrap { background: rgba(255, 255, 255, 0.08); }

/* Dashed crimson care-card — "Request a service" affordance */
.care-card-request {
  border-style: dashed;
  border-color: rgba(232, 164, 172, 0.7);
  background: transparent;
}
.care-card-request:hover { background: rgba(200, 39, 58, 0.04); }

/* ───────── Visit card ───────── */
.visit-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  transition: border-color 180ms, transform 100ms, box-shadow 180ms;
  cursor: pointer;
}
.visit-card:hover {
  border-color: var(--line-2);
  box-shadow: 0 4px 12px rgba(22, 22, 22, 0.05);
}
.visit-card.upcoming {
  background: linear-gradient(135deg, var(--surface) 0%, var(--blush) 100%);
  border-color: rgba(200, 39, 58, 0.18);
}
.visit-card .pill-tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  background: rgba(200, 39, 58, 0.12);
  color: var(--red);
  border-radius: 100px;
  font-size: 9.5px;
  letter-spacing: 0.07em;
  font-weight: 600;
  text-transform: uppercase;
}
.visit-card .pill-tag.rated {
  background: rgba(200, 163, 90, 0.18);
  color: #8C7438;
}

/* ───────── Doctor card (browse) ───────── */
.doc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  transition: border-color 180ms, box-shadow 180ms, transform 100ms;
  cursor: pointer;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.doc-card:hover { border-color: var(--line-2); box-shadow: 0 4px 14px rgba(22, 22, 22, 0.05); }
.doc-card:active {
  transform: scale(0.99);
  border-color: var(--red);
  background: linear-gradient(135deg, rgba(200, 39, 58, 0.05), rgba(139, 26, 43, 0.02));
  box-shadow: 0 0 0 3px rgba(200, 39, 58, 0.14);
}

/* ───────── Record card / row (records page sections) ───────── */
.record-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.record-card .rec-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 600;
  text-transform: uppercase;
}
.record-card .rec-tag.severe { background: rgba(200, 39, 58, 0.12); color: var(--red); }
.record-card .rec-tag.mild,
.record-card .rec-tag.active,
.record-card .rec-tag.normal { background: rgba(22, 122, 67, 0.10); color: var(--green); }
html.theme-dark .record-card .rec-tag.mild,
html.theme-dark .record-card .rec-tag.active,
html.theme-dark .record-card .rec-tag.normal {
  background: rgba(74, 222, 128, 0.16);
  color: #6EE7A6;
}

/* ───────── Sheet / modal (bottom drawer pattern used by ManagePlan, RateVisit, etc.) ───────── */
.cc-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(22, 22, 22, 0.42);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex; justify-content: center; align-items: flex-end;
  animation: fadeUp 200ms ease;
}
.cc-sheet {
  width: 100%;
  max-width: 520px;
  background: var(--paper);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 18px 24px 28px;
  box-shadow: 0 -8px 40px rgba(22, 22, 22, 0.18);
  animation: slideUp 280ms cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cc-sheet-handle {
  width: 40px; height: 4px;
  background: var(--line-2);
  border-radius: 100px;
  margin: 0 auto 14px;
}
.cc-sheet h2 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

/* ───────── Toast (transient confirmation pill) ───────── */
.cc-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  animation: fadeUp 240ms ease;
}
html.theme-dark .cc-toast { background: var(--cream-2); color: var(--ink); }

/* ───────── Step indicator (booking funnel) ───────── */
.step-num {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  color: var(--muted-2);
  letter-spacing: -0.02em;
}

/* ───────── Stat / metric block (large numerals on marketing) ───────── */
.stat-num {
  font-family: var(--display);
  font-size: 72px;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variation-settings: 'opsz' 144;
}

/* ───────── Responsive (phones + iPad portrait) ───────── */
@media (max-width: 820px) {
  .container { padding: 0 16px; }
  .container-wide { padding: 0 16px; }
  .section { padding: 56px 0; }
  .section-sm { padding: 36px 0; }

  [style*="grid-template-columns: 1.05fr 1fr"],
  [style*="grid-template-columns: 1.1fr 1fr"],
  [style*="grid-template-columns: 1.2fr 1fr"],
  [style*="grid-template-columns: 1.3fr 1fr"],
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns: 1.5fr 1fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: 1fr 1.4fr"],
  [style*="grid-template-columns: 1fr 1.6fr 1fr"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns: 320px 1fr"],
  [style*="grid-template-columns: 200px 1fr"],
  [style*="grid-template-columns: 80px 1fr"],
  [style*="grid-template-columns: 2fr 1fr"]:not([style*="2fr 1fr 1fr"]),
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns: repeat(3,"],
  [style*="grid-template-columns: repeat(4,"],
  [style*="grid-template-columns: repeat(5,"],
  [style*="grid-template-columns: repeat(6,"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns: 2fr 1fr 1fr 1fr 1fr"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  [style*="padding: 120px 0 80px"] { padding: 56px 0 32px !important; }
  [style*="padding: 80px 0 64px"]  { padding: 40px 0 28px !important; }
  [style*="padding: 60px 0"]       { padding: 32px 0 !important; }

  /* Marketing nav: hide center links and Sign In on phones */
  header > .container > nav { display: none !important; }
  header > .container > div:last-child > .btn-ghost,
  header > .container > div:last-child > button.btn-ghost { display: none !important; }
  header > .container { padding: 14px 16px !important; }

  /* App shell collapses to single column + horizontal-scrolling top tabs */
  .app-shell { grid-template-columns: 1fr !important; min-height: 100vh; }
  .app-shell > main { min-width: 0; }
  .side-nav {
    flex-direction: row !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px !important;
    gap: 6px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
  }
  .side-nav > div { display: none !important; }
  .side-nav-item {
    flex: 0 0 auto;
    padding: 8px 14px !important;
    font-size: 13px;
    white-space: nowrap;
  }
  .side-nav-item.active { box-shadow: inset 0 -2px 0 var(--red) !important; background: transparent !important; }

  .top-bar { padding: 12px 16px !important; gap: 8px; }
  .top-bar input[type="text"],
  .top-bar input[type="search"],
  .top-bar input:not([type]) { display: none !important; }

  .surface:has(> table.tbl),
  .surface-2:has(> table.tbl) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  table.tbl { min-width: 640px; font-size: 12px; }
  table.tbl th, table.tbl td { padding: 10px 8px; }

  [data-portal-switcher] {
    top: 8px !important; right: 8px !important;
    padding: 2px !important; gap: 2px !important;
  }
  [data-portal-switcher] button { padding: 5px 8px !important; font-size: 10px !important; }

  .twk-panel { width: calc(100vw - 16px) !important; max-width: 320px !important; right: 8px !important; bottom: 8px !important; }

  [style*="display: flex"][style*="gap: 12"] { flex-wrap: wrap; }
}
