/* Step2board — hand-authored CSS driven by docs/design.md tokens. No framework/build step. */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:wght@400;500;600&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --color-primary: #0D4F52;
  --color-primary-hover: #0A3F42;
  --color-on-primary: #F5F8F7;
  --color-accent: #12807A;
  --color-on-accent: #F5F8F7;
  --color-premium: #9C7A2E;
  --color-premium-soft: #F2E9D2;
  --color-on-premium-soft: #5C4A1B;
  --color-background: #FFFFFF;
  --color-surface: #F7F8F8;
  --color-surface-raised: #FFFFFF;
  --color-on-background: #14191A;
  --color-on-surface: #14191A;
  --color-on-surface-muted: #5B6567;
  --color-border: #E1E5E5;
  --color-border-strong: #C7CDCD;
  --color-success: #1F7A54;
  --color-success-soft: #E4F3EA;
  --color-on-success-soft: #12563A;
  --color-error: #B4402F;
  --color-error-soft: #FBEAE7;
  --color-on-error-soft: #7F2C20;
  --color-warning: #A8641A;
  --color-warning-soft: #F7ECDD;
  --color-on-warning-soft: #734411;
  --color-info: #2A6F97;
  --color-info-soft: #E7F1F7;
  --color-on-info-soft: #1D4E6B;
  --color-primary-soft: #DCEEEC;
  --color-on-primary-soft: #0D4F52;
  --color-xp: #9C7A2E;
  --color-xp-soft: #F2E9D2;
  --color-streak: #B24A2E;
  --color-streak-soft: #F7E4DC;
  --color-locked: #8A9294;
  --color-overlay: rgba(15, 20, 21, 0.48);

  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --rounded-none: 0px;
  --rounded-sm: 6px;
  --rounded-md: 10px;
  --rounded-lg: 14px;
  --rounded-xl: 20px;
  --rounded-full: 999px;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;

  --shadow-sm: 0 1px 2px rgba(15,20,21,0.06), 0 1px 1px rgba(15,20,21,0.04);
  --shadow-md: 0 4px 12px rgba(15,20,21,0.10);

  /* Soft pastel palette for the Subject/Source/System browse cards — cycled by index,
     paired with each item's own emoji rather than bespoke illustrations. */
  --card-color-1: #DCEEE0; --card-color-2: #E5E0F5; --card-color-3: #F5E0E5; --card-color-4: #F5EAD5;
  --card-color-5: #DCE8F5; --card-color-6: #F5DCE5; --card-color-7: #D5F0E8; --card-color-8: #EAE0F0;
}

:root[data-theme="dark"] {
  --color-primary: #4FBDB4;
  --color-primary-hover: #6ECFC6;
  --color-on-primary: #0B1615;
  --color-accent: #4FBDB4;
  --color-on-accent: #0B1615;
  --color-premium: #D7B667;
  --color-premium-soft: #332A16;
  --color-on-premium-soft: #EAD9A6;
  --color-background: #0F1516;
  --color-surface: #161D1E;
  --color-surface-raised: #1C2426;
  --color-on-background: #EBF0EF;
  --color-on-surface: #EBF0EF;
  --color-on-surface-muted: #9CA8A9;
  --color-border: #293233;
  --color-border-strong: #3A4547;
  --color-success: #4FAE81;
  --color-success-soft: #16261E;
  --color-on-success-soft: #9FDABB;
  --color-error: #E08475;
  --color-error-soft: #2C1917;
  --color-on-error-soft: #F3B8AC;
  --color-warning: #D69A56;
  --color-warning-soft: #2B2013;
  --color-on-warning-soft: #F0C994;
  --color-info: #7FB6D9;
  --color-info-soft: #16232B;
  --color-on-info-soft: #BFE0F2;
  --color-primary-soft: #17302E;
  --color-on-primary-soft: #7DDBD2;
  --color-xp: #D7B667;
  --color-xp-soft: #332A16;
  --color-streak: #E08D6F;
  --color-streak-soft: #33201A;
  --color-locked: #6E787A;
  --color-overlay: rgba(2, 6, 6, 0.64);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35), 0 1px 1px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);

  --card-color-1: #1A2B20; --card-color-2: #23203A; --card-color-3: #2E1F26; --card-color-4: #2E2818;
  --card-color-5: #1A2530; --card-color-6: #2E1D25; --card-color-7: #172A24; --card-color-8: #241E30;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-on-background);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

h1.display, .text-display { font-family: var(--font-display); font-weight: 500; font-size: 2.5rem; line-height: 1.15; letter-spacing: -0.01em; }
h1, .text-h1 { font-family: var(--font-display); font-weight: 500; font-size: 1.875rem; line-height: 1.2; letter-spacing: -0.01em; }
h2, .text-h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; line-height: 1.25; }
h3, .text-h3 { font-family: var(--font-body); font-weight: 600; font-size: 1.125rem; line-height: 1.3; }
h4, .text-h4 { font-family: var(--font-body); font-weight: 600; font-size: 0.9375rem; line-height: 1.35; letter-spacing: 0.01em; }
.text-body-lg { font-size: 1.0625rem; line-height: 1.6; }
.text-body-sm { font-size: 0.8125rem; line-height: 1.5; }
.text-caption { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-on-surface-muted); }
.text-muted { color: var(--color-on-surface-muted); }
.text-mono { font-family: var(--font-mono); }

/* Layout utilities */
.container { max-width: 1120px; margin: 0 auto; padding: 0 var(--space-4); }
.container-narrow { max-width: 640px; margin: 0 auto; padding: 0 var(--space-4); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); } .gap-6 { gap: var(--space-6); } .gap-8 { gap: var(--space-8); }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .result-stats-grid { grid-template-columns: repeat(2, 1fr) !important; } }
.mt-2 { margin-top: var(--space-2); } .mt-4 { margin-top: var(--space-4); } .mt-6 { margin-top: var(--space-6); } .mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); } .mb-4 { margin-bottom: var(--space-4); } .mb-6 { margin-bottom: var(--space-6); }
.w-full { width: 100%; }

/* App shell */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); max-width: 1120px; margin: 0 auto; gap: var(--space-2); }
/* Admin's topbar and body share the same 1440px max-width and side padding so the logo's
   left edge lines up exactly with the sidebar's left edge below it on every admin page —
   both use the same shared layout, so this holds consistently, not per-page. */
.topbar-inner.admin-layout { max-width: 1440px; }
@media (max-width: 420px) {
  .topbar-inner { padding: var(--space-2) var(--space-3); }
  .topbar-inner .flex.items-center.gap-3 { gap: var(--space-1); }
  .topbar-inner .btn-ghost.btn-sm span.admin-label { display: none; }
  .theme-switch button { width: 26px; height: 26px; }
  .brand { font-size: 1.05rem; }
}
.brand { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; color: var(--color-primary); display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); }
.main-content { flex: 1; padding: var(--space-6) 0 var(--space-16); }

.bottom-nav {
  position: sticky; bottom: 0; z-index: 30;
  background: var(--color-surface-raised);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  padding: var(--space-2) 0;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.6875rem; font-weight: 600; color: var(--color-on-surface-muted);
  padding: 4px 10px; border-radius: var(--rounded-sm);
}
.bottom-nav a.active, .bottom-nav button.active { color: var(--color-primary); }
.bottom-nav svg { width: 20px; height: 20px; }
.bottom-nav button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.6875rem; font-weight: 600; color: var(--color-on-surface-muted);
  padding: 4px 10px; border-radius: var(--rounded-sm); background: none; border: none; cursor: pointer; font-family: var(--font-body);
}
@media (min-width: 861px) { .bottom-nav { display: none; } }

/* Fixed back button shown only on iOS home-screen (standalone) PWAs via JS in app.js —
   those have no browser chrome and no OS-level back gesture, unlike Android. Floats above
   the bottom nav so it never overlaps it. */
.ios-back-btn {
  position: fixed; left: 16px; bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 40; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface-raised); color: var(--color-on-surface);
  border: 1px solid var(--color-border-strong); box-shadow: var(--shadow-md);
  cursor: pointer; padding: 0;
}
@media (min-width: 861px) { .ios-back-btn { display: none !important; } }
/* Admin layout has no bottom nav to clear, so its back button sits lower. */
.ios-back-btn--no-bottom-nav { bottom: calc(16px + env(safe-area-inset-bottom)); }

.more-sheet-overlay { position: fixed; inset: 0; background: var(--color-overlay); z-index: 150; display: flex; align-items: flex-end; }
.more-sheet { background: var(--color-surface-raised); border-radius: var(--rounded-lg) var(--rounded-lg) 0 0; padding: 16px; width: 100%; box-shadow: var(--shadow-md); display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-height: 70vh; overflow-y: auto; }
.more-sheet a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 6px; text-align: center; border: 1px solid var(--color-border); border-radius: var(--rounded-lg);
  background: var(--color-surface); color: var(--color-on-surface); font-size: 0.75rem; font-weight: 600; line-height: 1.2;
}
.more-sheet a svg { width: 22px; height: 22px; }
.more-sheet a.active { color: var(--color-primary); border-color: var(--color-primary); background: var(--color-primary-soft); }
.more-sheet button#more-nav-close { grid-column: 1 / -1; margin-top: 4px; padding: 12px; border-radius: var(--rounded-md); border: 1px solid var(--color-border-strong); background: var(--color-surface); font-weight: 600; font-family: var(--font-body); cursor: pointer; }
@media (min-width: 861px) { .more-sheet-overlay { display: none !important; } }

.side-nav { display: none; }
@media (min-width: 861px) {
  .side-nav {
    display: flex; flex-direction: column; gap: 2px;
    width: 220px; flex-shrink: 0; padding: var(--space-4) var(--space-2);
  }
  .side-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--rounded-sm);
    font-size: 0.875rem; font-weight: 500; color: var(--color-on-surface-muted);
    transition: background 0.15s ease, color 0.15s ease;
  }
  .side-nav a:hover { background: var(--color-surface); color: var(--color-on-surface); }
  .side-nav a.active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 600; }
  /* .app-shell is a column flex container, which makes this a flex item — without an
     explicit width, auto side-margins on a flex item shrink it to fit its content instead
     of stretching to max-width like a normal block, so it wouldn't reliably reach its cap
     (and wouldn't line up with .topbar-inner, which isn't inside a flex parent). */
  .with-side-nav { display: flex; width: 100%; gap: var(--space-8); max-width: 1120px; margin: 0 auto; padding: 0 var(--space-4); box-sizing: border-box; }
  .with-side-nav .page-body { flex: 1; min-width: 0; }
  /* Admin manages dense tables/forms, not long-form reading — give it noticeably more
     width than the student app's reading-optimized column, and trim the sidebar a touch
     so the extra room goes to the content, not the nav. */
  .with-side-nav.admin-layout { max-width: 1440px; }
  .admin-layout .side-nav { width: 196px; }
  .admin-layout .page-body.container { max-width: none; }
}

/* Pagination — see pagination_links() in components/helpers.php */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: var(--space-6); flex-wrap: wrap; }
.pagination-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px; box-sizing: border-box;
  border-radius: var(--rounded-sm); border: 1px solid var(--color-border);
  background: var(--color-surface-raised); color: var(--color-on-surface);
  font-family: var(--font-body); font-size: 0.8125rem; font-weight: 600; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pagination-btn:hover:not(.active):not(.disabled) { background: var(--color-surface); border-color: var(--color-border-strong); }
.pagination-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); cursor: default; }
.pagination-btn.disabled { opacity: 0.4; pointer-events: none; }
.pagination-ellipsis { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 36px; color: var(--color-on-surface-muted); font-size: 0.8125rem; }

/* Buttons */
.btn {
  font-family: var(--font-body); font-weight: 600; font-size: 0.8125rem; letter-spacing: 0.01em;
  border: none; cursor: pointer; height: 44px; padding: 0 20px; border-radius: var(--rounded-md);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .15s ease, opacity .15s ease;
}
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:disabled { background: var(--color-border); color: var(--color-on-surface-muted); cursor: not-allowed; }
.btn-secondary { background: var(--color-surface); color: var(--color-on-surface); border: 1px solid var(--color-border-strong); }
.btn-secondary:hover { background: var(--color-border); }
.btn-ghost { background: transparent; color: var(--color-primary); height: 40px; padding: 0 14px; }
.btn-ghost:hover { background: var(--color-surface); }
.btn-destructive { background: var(--color-error); color: #fff; }
.btn-destructive:hover { opacity: 0.9; }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.75rem; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8125rem; font-weight: 600; color: var(--color-on-surface); }
.field .hint { font-size: 0.75rem; color: var(--color-on-surface-muted); }
.field .error { font-size: 0.75rem; color: var(--color-error); }
.input, select.input, textarea.input {
  font-family: var(--font-body); font-size: 0.9375rem; height: 44px; padding: 0 14px;
  border-radius: var(--rounded-sm); border: 1px solid var(--color-border-strong);
  background: var(--color-surface-raised); color: var(--color-on-surface); width: 100%;
}
textarea.input { height: auto; padding: 10px 14px; min-height: 96px; resize: vertical; }
.input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 18%, transparent); }
.input.has-error { background: var(--color-error-soft); border-color: var(--color-error); }

/* Tabs */
.tabs { display: inline-flex; gap: 2px; background: var(--color-surface); padding: 4px; border-radius: var(--rounded-md); }
.tab { font-weight: 600; font-size: 0.8125rem; padding: 8px 14px; border-radius: var(--rounded-sm); color: var(--color-on-surface-muted); border: none; background: none; cursor: pointer; }
.tab.active { background: var(--color-surface-raised); color: var(--color-primary); box-shadow: var(--shadow-sm); }

/* Details/summary used for inline admin edit forms */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* Card */
.card { background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--rounded-lg); padding: var(--space-5); }
.card-flat { background: var(--color-surface-raised); border-radius: var(--rounded-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }

/* Stat tiles — Dashboard's XP/Streak/Goal row and Quick Access shortcuts. */
.stat-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 4px; padding: var(--space-4) var(--space-3); border-radius: var(--rounded-xl);
  background: var(--card-bg, var(--color-surface)); border: 1px solid var(--color-border);
  text-decoration: none; color: var(--color-on-surface);
}
.stat-tile-link { transition: transform 0.15s ease, box-shadow 0.15s ease; cursor: pointer; }
.stat-tile-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-tile-emoji { font-size: 1.75rem; line-height: 1; margin-bottom: 4px; }
.stat-tile-value { font-size: 1.375rem; font-weight: 700; }
.stat-tile-label { font-size: 0.75rem; color: var(--color-on-surface-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }

/* Browse cards — Subject/Source/System pickers (Study builder drill-down). */
.browse-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 640px) { .browse-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .browse-grid { grid-template-columns: repeat(4, 1fr); } }
.browse-card {
  position: relative; display: block; min-height: 148px; padding: var(--space-4);
  border-radius: var(--rounded-xl); background: var(--card-bg, var(--color-surface));
  text-decoration: none; color: var(--color-on-surface); overflow: hidden;
  border: 1px solid var(--color-border); transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.browse-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.browse-card .browse-card-title { font-weight: 700; font-size: 0.9375rem; line-height: 1.3; margin-bottom: 4px; padding-right: 30%; }
.browse-card .browse-card-subtitle { font-size: 0.75rem; color: var(--color-on-surface-muted); font-weight: 500; }
.browse-card .browse-card-emoji {
  position: absolute; right: 10px; bottom: 8px; font-size: 2.75rem; line-height: 1;
  opacity: 0.9; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.08));
}
.browse-card.selected { outline: 3px solid var(--color-primary); outline-offset: -3px; }
.browse-card-lock-badge {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.6875rem; font-weight: 700; padding: 3px 8px; border-radius: var(--rounded-full);
  background: var(--color-overlay); color: #fff;
}
.browse-card .browse-card-check {
  position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-primary); color: var(--color-on-primary); display: none;
  align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700;
}
.browse-card.selected .browse-card-check { display: flex; }
.browse-breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--color-on-surface-muted); margin-bottom: var(--space-4); }
.browse-breadcrumb a { color: var(--color-primary); text-decoration: none; font-weight: 600; }
.browse-breadcrumb a:hover { text-decoration: underline; }

/* Browse list — the final drill-down level (Systems) and "My Books": rows instead of
   cards, each with a colored icon chip, a thin progress bar, and a trailing checkbox. */
.browse-list { display: flex; flex-direction: column; gap: var(--space-2); }
.browse-list-item {
  position: relative; display: flex; align-items: center; gap: var(--space-3);
  padding: 12px var(--space-4); border-radius: var(--rounded-lg); background: var(--color-surface);
  border: 1px solid var(--color-border); text-decoration: none; color: var(--color-on-surface);
  cursor: pointer; transition: background 0.15s ease;
}
.browse-list-item:hover { background: var(--card-bg, var(--color-xp-soft)); }
.browse-list-item.selected { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.browse-list-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--rounded-md);
  background: var(--card-bg, var(--color-xp-soft)); display: flex; align-items: center;
  justify-content: center; font-size: 1.25rem;
}
.browse-list-body { flex: 1; min-width: 0; }
.browse-list-title { font-weight: 600; font-size: 0.9375rem; }
.browse-list-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.browse-list-count { font-size: 0.75rem; color: var(--color-on-surface-muted); white-space: nowrap; }
.browse-list-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--color-border-strong); overflow: hidden; max-width: 140px; }
.browse-list-bar > span { display: block; height: 100%; background: var(--color-success); border-radius: 2px; }
.browse-list-pct { font-size: 0.75rem; font-weight: 600; color: var(--color-on-surface-muted); white-space: nowrap; }
.browse-list-check {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-border-strong);
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700;
  color: transparent;
}
.browse-list-item.selected .browse-list-check { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }

/* -- Selection state for the Practice builder's Choose Sources rows (.subject-row reuses
      the same .browse-list-check trailing indicator, but had no .selected style of its own,
      so a checked row never looked any different from an unchecked one). */
.subject-row.selected { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.subject-row.selected .browse-list-check { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }

/* Badges */
.badge { display: inline-flex; align-items: center; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.02em; padding: 3px 10px; border-radius: var(--rounded-full); white-space: nowrap; }
.badge-free { background: var(--color-success-soft); color: var(--color-on-success-soft); }
.badge-premium { background: var(--color-premium-soft); color: var(--color-on-premium-soft); }
.badge-xp { background: var(--color-xp-soft); color: var(--color-xp); }
.badge-streak { background: var(--color-streak-soft); color: var(--color-streak); }

/* Alerts / toasts */
.alert { padding: 14px 16px; border-radius: var(--rounded-md); font-size: 0.8125rem; margin-bottom: 10px; }
.alert-info { background: var(--color-info-soft); color: var(--color-on-info-soft); }
.alert-warning { background: var(--color-warning-soft); color: var(--color-on-warning-soft); }
.alert-error { background: var(--color-error-soft); color: var(--color-on-error-soft); }
.alert-success { background: var(--color-success-soft); color: var(--color-on-success-soft); }

#toast-region { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--rounded-md); font-size: 0.8125rem; font-weight: 500; box-shadow: var(--shadow-md); }
.toast.success { background: var(--color-success-soft); color: var(--color-on-success-soft); }
.toast.error { background: var(--color-error-soft); color: var(--color-on-error-soft); }

/* Progress */
.progress { height: 8px; border-radius: var(--rounded-full); background: var(--color-border); overflow: hidden; }
.progress .fill { height: 100%; background: var(--color-accent); border-radius: var(--rounded-full); }

/* Empty state */
.empty-state { text-align: center; padding: var(--space-12) var(--space-6); color: var(--color-on-surface-muted); border: 1px dashed var(--color-border-strong); border-radius: var(--rounded-lg); }
.empty-state p { margin-bottom: var(--space-4); }

/* Skeleton */
.skeleton { background: var(--color-border); border-radius: var(--rounded-sm); position: relative; overflow: hidden; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent); animation: shimmer 1.6s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Rich content (question stem/options/explanation, rendered from stored HTML) */
.rich-content table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.875rem; }
.rich-content table th, .rich-content table td { border: 1px solid var(--color-border-strong); padding: 8px 10px; text-align: left; }
.rich-content table th { background: var(--color-surface); font-weight: 600; }
.rich-content img { border-radius: var(--rounded-sm); margin: 12px 0; }
.rich-content p { margin-bottom: 10px; }
.rich-content ul, .rich-content ol { margin: 0 0 10px 1.4em; }

/* Guest / auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6); background: var(--color-surface); }
.auth-card { width: 100%; max-width: 400px; background: var(--color-surface-raised); border-radius: var(--rounded-lg); padding: var(--space-8); box-shadow: var(--shadow-md); }
.auth-card .brand { justify-content: center; margin-bottom: var(--space-6); }

/* Theme toggle (small icon control used in topbar) */
.theme-switch { display: flex; gap: 2px; background: var(--color-surface); border-radius: var(--rounded-full); padding: 3px; }
.theme-switch button { border: none; background: transparent; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--color-on-surface-muted); }
.theme-switch button.active { background: var(--color-surface-raised); color: var(--color-primary); box-shadow: var(--shadow-sm); }

/* ======================================================================
   Student UI v2 — Home / Subjects / Practice premium redesign.
   Shared components so all three screens read as one coherent system.
   ====================================================================== */

/* -- Page hero (greeting) — sans-serif on purpose, unlike the rest of the
      app's Newsreader headings: a greeting is a spoken-voice line, not a
      document heading, and the brief calls out serif here specifically. */
.hero-greeting { font-family: var(--font-body); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.01em; color: var(--color-on-background); }
.hero-sub { color: var(--color-on-surface-muted); font-size: 0.9375rem; margin-top: 2px; }

/* -- Mini profile row: compact, not a giant card. */
.mini-profile { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.mini-profile-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  background: var(--color-primary-soft); color: var(--color-on-primary-soft);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem;
}
.mini-profile-name { font-weight: 600; font-size: 0.9375rem; }
.mini-profile-meta { font-size: 0.8125rem; color: var(--color-on-surface-muted); }

/* -- Stat grid: icon-chip cards, 2 columns on phones, 4 across from tablet up. */
.stat-grid-v2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-top: var(--space-5); }
@media (min-width: 640px) { .stat-grid-v2 { grid-template-columns: repeat(4, 1fr); } }
.stat-card-v2 {
  background: var(--color-surface-raised); border: 1px solid var(--color-border);
  border-radius: var(--rounded-lg); padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.stat-card-v2:hover { border-color: var(--color-border-strong); transform: translateY(-1px); }
.stat-card-icon {
  width: 34px; height: 34px; border-radius: var(--rounded-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--chip-bg); color: var(--chip-fg);
}
.stat-card-icon svg { width: 17px; height: 17px; }
.stat-card-value { font-size: 1.375rem; font-weight: 700; line-height: 1; font-family: var(--font-body); }
.stat-card-label { font-size: 0.75rem; color: var(--color-on-surface-muted); font-weight: 500; }

/* -- Daily Goal: a real progress component, not a bare fraction. */
.goal-card { background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--rounded-lg); padding: var(--space-5); margin-top: var(--space-4); }
.goal-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-3); }
.goal-card-title { font-weight: 600; font-size: 0.9375rem; }
.goal-card-fraction { font-family: var(--font-body); font-weight: 700; font-size: 1.0625rem; }
.goal-card-fraction span { color: var(--color-on-surface-muted); font-weight: 500; font-size: 0.875rem; }
.goal-bar { height: 8px; border-radius: var(--rounded-full); background: var(--color-surface); overflow: hidden; }
.goal-bar > span { display: block; height: 100%; border-radius: var(--rounded-full); background: linear-gradient(90deg, var(--color-primary), var(--color-accent)); transition: width 0.4s ease; }
.goal-card-caption { font-size: 0.8125rem; color: var(--color-on-surface-muted); margin-top: var(--space-2); }

/* -- Continue Learning: the single most important card on Home. */
.continue-card {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-surface-raised));
  border: 1px solid var(--color-border); border-radius: var(--rounded-xl);
  padding: var(--space-5); margin-top: var(--space-5);
}
.continue-card-eyebrow { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-on-primary-soft); }
.continue-card-title { font-family: var(--font-body); font-weight: 700; font-size: 1.1875rem; margin-top: 4px; }
.continue-card-meta { font-size: 0.8125rem; color: var(--color-on-surface-muted); margin-top: 2px; }
.continue-card-cta {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%;
  background: var(--color-primary); color: var(--color-on-primary);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease; box-shadow: var(--shadow-sm);
}
.continue-card-cta:hover { transform: scale(1.06); box-shadow: var(--shadow-md); }
.continue-card-cta svg { width: 20px; height: 20px; }

/* -- Quick actions: icon + title + short description, consistent sizing. */
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-top: var(--space-5); }
@media (min-width: 640px) { .action-grid { grid-template-columns: repeat(3, 1fr); } }
.action-card {
  display: flex; flex-direction: column; gap: var(--space-2); text-align: left;
  background: var(--color-surface-raised); border: 1px solid var(--color-border);
  border-radius: var(--rounded-lg); padding: var(--space-4); color: var(--color-on-surface);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; cursor: pointer;
}
.action-card:hover { border-color: var(--color-border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.action-card:active { transform: translateY(0); }
.action-card-icon { width: 34px; height: 34px; border-radius: var(--rounded-md); display: flex; align-items: center; justify-content: center; background: var(--chip-bg); color: var(--chip-fg); }
.action-card-icon svg { width: 17px; height: 17px; }
.action-card-title { font-weight: 600; font-size: 0.875rem; margin-top: 2px; }
.action-card-desc { font-size: 0.75rem; color: var(--color-on-surface-muted); }

/* -- Recent activity: compact rows, not cards. */
.activity-list { margin-top: var(--space-3); }
.activity-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--color-border); text-decoration: none; color: var(--color-on-surface); }
.activity-row:first-child { border-top: none; }
.activity-mode { flex-shrink: 0; width: 34px; height: 34px; border-radius: var(--rounded-md); display: flex; align-items: center; justify-content: center; background: var(--chip-bg); color: var(--chip-fg); }
.activity-mode svg { width: 16px; height: 16px; }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 0.875rem; font-weight: 600; }
.activity-meta { font-size: 0.75rem; color: var(--color-on-surface-muted); margin-top: 1px; }
.activity-score { flex-shrink: 0; font-size: 0.8125rem; font-weight: 700; padding: 3px 10px; border-radius: var(--rounded-full); }

/* -- Section headings shared by Home/Subjects/Practice. */
.section-head { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-8); margin-bottom: var(--space-1); }
.section-head h2 { font-family: var(--font-body); font-weight: 700; font-size: 1rem; }
.section-head a { font-size: 0.8125rem; font-weight: 600; color: var(--color-primary); }

/* -- Subject browser rows (Subjects page) — premium, not a plain rectangle. */
.subject-row {
  display: flex; align-items: center; gap: var(--space-4); text-decoration: none; color: var(--color-on-surface);
  background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--rounded-lg);
  padding: var(--space-4); transition: border-color 0.15s ease, transform 0.15s ease;
}
.subject-row:hover { border-color: var(--color-border-strong); transform: translateY(-1px); }
.subject-row-icon { flex-shrink: 0; width: 46px; height: 46px; border-radius: var(--rounded-md); display: flex; align-items: center; justify-content: center; font-size: 1.375rem; background: var(--chip-bg); }
.subject-row-body { flex: 1; min-width: 0; }
.subject-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.subject-row-name { font-weight: 700; font-size: 0.9375rem; }
.subject-row-accuracy { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: var(--rounded-full); flex-shrink: 0; white-space: nowrap; }
.subject-row-meta { display: flex; align-items: center; gap: var(--space-2); margin-top: 6px; }
.subject-row-count { font-size: 0.75rem; color: var(--color-on-surface-muted); white-space: nowrap; }
.subject-row-bar { flex: 1; height: 5px; border-radius: var(--rounded-full); background: var(--color-surface); overflow: hidden; }
.subject-row-bar > span { display: block; height: 100%; background: var(--color-primary); border-radius: var(--rounded-full); }
.subject-row-last { font-size: 0.6875rem; color: var(--color-locked); margin-top: 4px; }
.subject-row-arrow { flex-shrink: 0; color: var(--color-on-surface-muted); }

/* -- Subjects list as square cards (same visual language as the Sources browse-grid one
      level down) instead of full-width rows. */
.subject-card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 640px) { .subject-card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .subject-card-grid { grid-template-columns: repeat(4, 1fr); } }
.subject-card {
  position: relative; display: block; min-height: 156px; padding: var(--space-4);
  border-radius: var(--rounded-xl); background: var(--card-bg, var(--color-surface));
  text-decoration: none; color: var(--color-on-surface); overflow: hidden;
  border: 1px solid var(--color-border); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.subject-card-emoji { position: absolute; right: 10px; bottom: 8px; font-size: 2.75rem; line-height: 1; opacity: 0.9; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.08)); }
.subject-card-image { position: absolute; right: 10px; bottom: 8px; width: 56px; height: 56px; border-radius: var(--rounded-md); object-fit: cover; box-shadow: var(--shadow-sm); }
.subject-card-title { font-weight: 700; font-size: 0.9375rem; line-height: 1.3; margin-bottom: 6px; padding-right: 34%; }
.subject-card-count { font-size: 0.75rem; color: var(--color-on-surface-muted); font-weight: 500; }
.subject-card-accuracy { display: inline-flex; margin-top: 8px; font-size: 0.6875rem; font-weight: 700; padding: 2px 8px; border-radius: var(--rounded-full); }
.subject-card-bar { margin-top: 8px; height: 4px; border-radius: var(--rounded-full); background: var(--color-border-strong); overflow: hidden; max-width: 100%; }
.subject-card-bar > span { display: block; height: 100%; background: var(--color-primary); border-radius: var(--rounded-full); }
.subject-card-last { font-size: 0.625rem; color: var(--color-locked); margin-top: 6px; }

/* -- My Books grid: image-forward shop-style cards for Sources that have a real cover
      (falls back to an emoji tile when a Source has no uploaded cover). Pricing/cart are
      intentionally not part of this — access is still granted at the Subject level, this
      is presentation only. */
.book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 640px) { .book-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .book-grid { grid-template-columns: repeat(4, 1fr); } }
.book-card {
  display: flex; flex-direction: column;
  background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--rounded-lg);
  overflow: hidden; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.book-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.book-card-link { display: flex; flex-direction: column; flex: 1; text-decoration: none; color: var(--color-on-surface); }
.book-card-cover { position: relative; aspect-ratio: 3/4; background: var(--color-primary-soft); display: flex; align-items: center; justify-content: center; }
.book-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card-cover-fallback { font-size: 2.5rem; }
.book-card-lock-badge {
  position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.6875rem; font-weight: 700; padding: 3px 8px; border-radius: var(--rounded-full);
  background: var(--color-overlay); color: #fff;
}
.book-card-body { padding: var(--space-3); display: flex; flex-direction: column; gap: 2px; flex: 1; }
.book-card-title { font-weight: 700; font-size: 0.8125rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card-subject { font-size: 0.6875rem; color: var(--color-on-surface-muted); }
.book-card-count { font-size: 0.6875rem; color: var(--color-on-surface-muted); margin-top: 4px; }
.book-card-progress { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.book-card-bar { flex: 1; height: 4px; border-radius: var(--rounded-full); background: var(--color-surface); overflow: hidden; }
.book-card-bar > span { display: block; height: 100%; background: var(--color-success); border-radius: var(--rounded-full); }
.book-card-pct { font-size: 0.6875rem; font-weight: 700; color: var(--color-on-surface-muted); }
.book-card-cart-form { padding: 0 var(--space-3) var(--space-3); }
.book-card-cart-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 0.75rem; font-weight: 700; padding: 8px; border-radius: var(--rounded-sm);
  border: 1px solid var(--color-primary); background: transparent; color: var(--color-primary); cursor: pointer;
}
.book-card-cart-btn:hover { background: var(--color-primary-soft); }

/* -- Overall progress strip at the top of Subjects. */
.progress-strip { display: flex; gap: var(--space-6); padding: var(--space-4) 0; }
.progress-strip-item { }
.progress-strip-value { font-family: var(--font-body); font-weight: 700; font-size: 1.25rem; }
.progress-strip-label { font-size: 0.75rem; color: var(--color-on-surface-muted); }

/* -- Practice presets — premium interactive cards, not plain buttons. */
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 640px) { .preset-grid { grid-template-columns: repeat(4, 1fr); } }
.preset-card {
  display: flex; flex-direction: column; gap: var(--space-2); text-align: left; color: var(--color-on-surface);
  background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--rounded-lg);
  padding: var(--space-4); cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.preset-card:hover { border-color: var(--color-primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.preset-card.active { border-color: var(--color-primary); background: var(--color-primary-soft); }
.preset-card-icon { width: 30px; height: 30px; border-radius: var(--rounded-md); display: flex; align-items: center; justify-content: center; background: var(--chip-bg); color: var(--chip-fg); flex-shrink: 0; }
.preset-card-icon svg { width: 15px; height: 15px; }
.preset-card-title { font-weight: 700; font-size: 0.875rem; }
.preset-card-desc { font-size: 0.75rem; color: var(--color-on-surface-muted); }

/* -- Practice builder: Chapters multi-select dropdown. */
.chapters-field { position: relative; }
.chapters-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; max-height: 260px; overflow-y: auto;
  background: var(--color-surface-raised); border: 1px solid var(--color-border-strong); border-radius: var(--rounded-md);
  box-shadow: var(--shadow-md); padding: 6px;
}
.chapters-panel label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--rounded-sm); font-size: 0.875rem; cursor: pointer; }
.chapters-panel label:hover { background: var(--color-surface); }

/* -- Segmented control (question count, difficulty, mode pills). */
.segmented { display: inline-flex; background: var(--color-surface); border-radius: var(--rounded-full); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { display: flex; align-items: center; justify-content: center; padding: 7px 16px; border-radius: var(--rounded-full); font-size: 0.8125rem; font-weight: 600; color: var(--color-on-surface-muted); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.segmented label.active { background: var(--color-surface-raised); color: var(--color-primary); box-shadow: var(--shadow-sm); }

/* -- Big primary CTA (Start Practice). */
.cta-primary-lg {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 15px; border-radius: var(--rounded-lg); border: none; cursor: pointer;
  background: var(--color-primary); color: var(--color-on-primary);
  font-family: var(--font-body); font-weight: 700; font-size: 0.9375rem; letter-spacing: 0.01em;
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease; box-shadow: var(--shadow-sm);
}
.cta-primary-lg:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cta-primary-lg:active:not(:disabled) { transform: translateY(0); }
.cta-primary-lg:disabled { opacity: 0.45; cursor: not-allowed; }

/* -- Bottom nav polish: elevated surface, safe-area padding, pill active state. */
.bottom-nav {
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
  box-shadow: 0 -1px 0 var(--color-border), var(--shadow-sm);
}
.bottom-nav a, .bottom-nav button { position: relative; transition: color 0.15s ease; }
.bottom-nav a .nav-pill-bg, .bottom-nav button .nav-pill-bg {
  position: absolute; top: -2px; left: 50%; transform: translateX(-50%); width: 32px; height: 22px;
  border-radius: var(--rounded-full); background: var(--color-primary-soft); opacity: 0; transition: opacity 0.15s ease; z-index: -1;
}
.bottom-nav a.active .nav-pill-bg, .bottom-nav button.active .nav-pill-bg { opacity: 1; }

/* -- Subscriptions: "choose a subject" grid — same pastel/emoji card language as the
      Study browse cards, plus a lock/unlocked status pill. */
.sub-subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
@media (min-width: 640px) { .sub-subject-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .sub-subject-grid { grid-template-columns: repeat(4, 1fr); } }
.sub-subject-card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 168px;
  padding: var(--space-4); border-radius: var(--rounded-xl); background: var(--card-bg, var(--color-surface));
  text-decoration: none; color: var(--color-on-surface); overflow: hidden;
  border: 1px solid var(--color-border); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sub-subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.sub-subject-emoji { position: absolute; right: 12px; top: 12px; font-size: 2.5rem; line-height: 1; opacity: 0.9; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.08)); }
.sub-subject-cover { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.35; }
.sub-subject-body { position: relative; z-index: 1; }
.sub-subject-title { font-weight: 700; font-size: 0.9375rem; line-height: 1.3; margin-bottom: 4px; padding-right: 20%; }
.sub-subject-price { font-size: 0.75rem; font-weight: 600; color: var(--color-on-surface-muted); }
.sub-subject-status {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 4px; margin-top: var(--space-3);
  font-size: 0.6875rem; font-weight: 700; padding: 3px 10px; border-radius: var(--rounded-full); width: fit-content;
}
.sub-subject-status svg { width: 12px; height: 12px; }
.sub-subject-status.is-locked { background: var(--color-premium-soft); color: var(--color-on-premium-soft); }
.sub-subject-status.is-unlocked { background: var(--color-success-soft); color: var(--color-on-success-soft); }

/* -- All Access: one premium gradient banner (not a grid of near-duplicate cards) —
      reads as the "everything included" upsell rather than another plan among plans. */
.allaccess-banner {
  border-radius: var(--rounded-xl); padding: var(--space-6);
  background: linear-gradient(135deg, var(--color-premium-soft) 0%, var(--color-surface-raised) 75%);
  border: 1px solid var(--color-premium); position: relative; overflow: hidden;
}
.allaccess-banner-head { display: flex; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-5); }
.allaccess-banner-icon {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--rounded-md); display: flex; align-items: center; justify-content: center;
  background: var(--color-premium); color: var(--color-premium-soft);
}
.allaccess-banner-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; color: var(--color-on-premium-soft); }
.allaccess-banner-sub { font-size: 0.8125rem; color: var(--color-on-surface-muted); margin-top: 2px; max-width: 46ch; }
.allaccess-plan-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.allaccess-plan-pill {
  flex: 1 1 160px; min-width: 150px; background: var(--color-surface-raised); border: 1px solid var(--color-border);
  border-radius: var(--rounded-lg); padding: var(--space-4); text-align: center;
}
.allaccess-plan-label { font-size: 0.75rem; font-weight: 700; color: var(--color-on-surface-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.allaccess-plan-price { font-family: var(--font-display); font-size: 1.375rem; font-weight: 600; margin-top: 6px; color: var(--color-on-premium-soft); }
.allaccess-plan-price span { font-size: 0.75rem; font-weight: 500; color: var(--color-on-surface-muted); }
.allaccess-plan-duration { font-size: 0.75rem; color: var(--color-on-surface-muted); margin-top: 2px; }

/* -- Subject plan-picker (per-subject checkout): pricing cards with a computed
      "best value" (lowest cost/day) badge, rather than plain identical boxes. */
.plan-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); }
.plan-card {
  position: relative; background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--rounded-lg);
  padding: var(--space-5); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.plan-card.is-best { border-color: var(--color-premium); background: linear-gradient(160deg, var(--color-premium-soft) 0%, var(--color-surface-raised) 60%); }
.plan-card-badge {
  position: absolute; top: -11px; right: var(--space-4); display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.02em; padding: 3px 10px; border-radius: var(--rounded-full);
  background: var(--color-premium); color: var(--color-premium-soft);
}
.plan-card-badge svg { width: 11px; height: 11px; }
.plan-card-label { font-weight: 700; font-size: 0.9375rem; margin-bottom: var(--space-2); }
.plan-card-price { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1; }
.plan-card-price span { font-size: 0.8125rem; font-weight: 500; color: var(--color-on-surface-muted); margin-left: 2px; }
.plan-card-duration { font-size: 0.75rem; color: var(--color-on-surface-muted); margin-top: 4px; }
.plan-card-perday { font-size: 0.6875rem; color: var(--color-locked); margin-top: 2px; margin-bottom: var(--space-4); }

/* -- Contact Us: hero + a real grid of contact cards + one featured CTA, replacing a row
      of plain buttons floating above an empty card. */
.contact-page { max-width: 1040px; margin: 0 auto; }
.contact-hero { text-align: center; padding: var(--space-6) 0 var(--space-8); }
.contact-hero-eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-primary); margin-bottom: var(--space-2); }
.contact-hero-title { font-size: 2.25rem; }
.contact-hero-sub { font-size: 1rem; color: var(--color-on-surface-muted); margin: var(--space-2) auto 0; max-width: 46ch; }

.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (max-width: 900px) { .contact-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-card {
  position: relative; display: flex; flex-direction: column; gap: var(--space-3);
  background: var(--color-surface-raised); border: 1px solid var(--color-border);
  border-radius: var(--rounded-lg); padding: var(--space-5);
  text-decoration: none; color: var(--color-on-surface);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.contact-card:hover { transform: translateY(-3px); border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.contact-card:active { transform: translateY(-1px); }
.contact-card-top { display: flex; align-items: center; justify-content: space-between; }
.contact-card-icon {
  width: 42px; height: 42px; border-radius: var(--rounded-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-primary-soft); color: var(--color-on-primary-soft);
  transition: background 0.2s ease, color 0.2s ease;
}
.contact-card-arrow {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface); color: var(--color-on-surface-muted);
  opacity: 0; transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.contact-card:hover .contact-card-icon { background: var(--color-primary); color: var(--color-on-primary); }
.contact-card:hover .contact-card-arrow { opacity: 1; transform: translateX(0); color: var(--color-primary); }
.contact-card-title { font-weight: 700; font-size: 1rem; }
.contact-card-desc { font-size: 0.8125rem; color: var(--color-on-surface-muted); line-height: 1.45; }

.contact-cta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap;
  background: linear-gradient(135deg, var(--color-primary-soft) 0%, var(--color-surface-raised) 70%);
  border: 1px solid var(--color-border); border-radius: var(--rounded-xl);
  padding: var(--space-6); margin-top: var(--space-6);
}
.contact-cta-eyebrow { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-on-primary-soft); }
.contact-cta-title { font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; margin-top: 6px; }
.contact-cta-sub { font-size: 0.875rem; color: var(--color-on-surface-muted); margin-top: 6px; max-width: 46ch; }
.contact-cta-btn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none; }
@media (max-width: 560px) { .contact-cta { padding: var(--space-5); } .contact-cta-btn { width: 100%; justify-content: center; } }
