@import url('https://cdn.jsdelivr.net/npm/@fontsource/inter@5.0.17/index.css');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/source-serif-4@5.0.15/index.css');
@import url('https://cdn.jsdelivr.net/npm/@fontsource/jetbrains-mono@5.0.18/index.css');

:root {
  color-scheme: light;

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;

  /* Pure neutral backgrounds — no blue tint */
  --bg: #f9fafb;
  --bg-elev: #ffffff;
  --bg-soft: #f4f4f5;
  --bg-soft-2: #e4e4e7;

  /* Near-black neutral text */
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #71717a;

  /* Neutral gray borders */
  --line: #e4e4e7;
  --line-2: #d4d4d8;

  /* Blueprint blue accent (#2563eb Tailwind blue-600) */
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-3: #dbeafe;
  --accent-rgb: 37, 99, 235;

  --danger: #dc2626;
  --warning: #f59e0b;
  --success: #16a34a;

  --s-1: 6px;
  --s-2: 10px;
  --s-3: 14px;
  --s-4: 18px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 42px;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Subtle neutral shadows */
  --shadow-1: 0 1px 3px 0 rgba(0,0,0,0.08), 0 1px 2px -1px rgba(0,0,0,0.08);
  --shadow-2: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.08);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), 0.22);

  --dur-fast: 140ms cubic-bezier(.2,.8,.2,1);
  --dur-base: 220ms cubic-bezier(.2,.8,.2,1);

  --z-nav: 30;
  --z-menu: 50;
  --z-overlay: 100;

  --max-page: 1560px;
}

:root[data-accent='red'] {
  --accent: #d54b63;
  --accent-2: #ef6a82;
  --accent-3: #ffe3e9;
  --accent-rgb: 213, 75, 99;
}
:root[data-accent='green'] {
  --accent: #17956a;
  --accent-2: #39b085;
  --accent-3: #ddf7ed;
  --accent-rgb: 23, 149, 106;
}
:root[data-accent='yellow'] {
  --accent: #d79b00;
  --accent-2: #e7b129;
  --accent-3: #fff2cf;
  --accent-rgb: 215, 155, 0;
}
:root[data-accent='purple'] {
  --accent: #6b57d8;
  --accent-2: #8a70ef;
  --accent-3: #ece7ff;
  --accent-rgb: 107, 87, 216;
}

body.dark-mode {
  color-scheme: dark;

  /* Dark neutral — matches Figma dark mode */
  --bg: #0a0a0b;
  --bg-elev: #18181b;
  --bg-soft: #27272a;
  --bg-soft-2: #3f3f46;

  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;

  --line: #3f3f46;
  --line-2: #52525b;

  --accent-3: color-mix(in srgb, var(--accent) 20%, #18181b 80%);

  --shadow-1: 0 1px 3px 0 rgba(0,0,0,0.3), 0 1px 2px -1px rgba(0,0,0,0.3);
  --shadow-2: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
a:visited { color: inherit; }

button, input, textarea, select { font: inherit; color: inherit; }

/* ── App Shell: full-viewport sidebar layout ── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  z-index: var(--z-nav);
  flex-shrink: 0;
}

.app-main {
  height: 100vh;
  overflow-y: auto;
  background: var(--bg);
  padding: var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

/* Chat page: layout fills full height, no scroll on main */
.page-chat .app-main {
  padding: 0;
  overflow: hidden;
  gap: 0;
}

.page-chat .layout {
  display: flex;        /* override grid — flex gives chat-shell correct height */
  flex-direction: row;
  align-items: stretch; /* override .layout { align-items: start } */
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 0;
}

/* Conversations panel: hidden by default, revealed by toggle */
.page-chat .sidebar-shell { display: none; }
.page-chat .layout.sidebar-open .sidebar-shell {
  display: flex;
  flex-direction: column;
  width: 256px;
  min-width: 220px;
  flex-shrink: 0;
}

/* Chat sidebar toggle button */
.chat-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  color: var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast), color var(--dur-fast);
  padding: 0;
}
.chat-sidebar-toggle:hover { background: var(--bg-soft-2); color: var(--text); }
.layout.sidebar-open .chat-sidebar-toggle { color: var(--accent); }

/* ── Sidebar anatomy ── */
.sidebar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  flex: 1;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: background var(--dur-fast), color var(--dur-fast);
  text-decoration: none;
}

.sidebar-nav-link:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.sidebar-nav-link.active {
  background: var(--accent-3);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav-link .nav-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: .75;
}

.sidebar-nav-link.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
}

.sidebar-user-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.sidebar-user-meta strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-meta span {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-actions {
  display: flex;
  gap: 4px;
}

.sidebar-footer-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--r-sm);
  padding: 7px 10px;
  cursor: pointer;
  color: var(--text-3);
  font-size: 14px;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  flex: 1;
}

.sidebar-footer-btn:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--line-2);
}

.sidebar-footer-btn.danger:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--bg-soft) 92%);
  border-color: color-mix(in srgb, var(--danger) 20%, var(--line) 80%);
}

/* ── Page header (replaces .hero in app-shell pages) ── */
.page-header {
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.page-header h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -.01em;
}

/* ── Legacy container & topbar (used by login, privacy) ── */
.container {
  width: min(var(--max-page), calc(100vw - 32px));
  margin: 0 auto 32px;
  display: grid;
  gap: var(--s-5);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--s-4);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-elev);
  box-shadow: none;
}

.brand,
.account,
.app-brand,
.app-account {
  display: flex;
  align-items: center;
}

.app-account {
  justify-content: space-between;
  gap: var(--s-4);
  width: 100%;
}

.bp-logo-link {
  width: 52px;
  height: 52px;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  transition: transform var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.bp-logo-link:hover { background: var(--accent-3); }
.bp-logo-mark { width: 24px; height: 24px; display: inline-flex; }
.bp-logo-mark svg { width: 100%; height: 100%; display: block; }

/* In the sidebar the logo is a raw img — strip the button frame */
.sidebar-top .bp-logo-link {
  width: auto;
  height: auto;
  border: none;
  background: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
.sidebar-top .bp-logo-mark {
  width: 34px;
  height: 34px;
}
.sidebar-top .bp-logo-mark img {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 8px;
}

.app-nav {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  padding: 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.app-nav-link {
  padding: 8px 14px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-weight: 600;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.app-nav-link:hover { color: var(--text); background: var(--bg-soft); }
.app-nav-link.active {
  color: #fff;
  background: var(--accent);
}

.app-user-menu { position: relative; }
.user-menu-trigger {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  padding: 4px;
  cursor: pointer;
}
.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  letter-spacing: .01em;
  background: var(--accent);
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar.large { width: 54px; height: 54px; }

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  z-index: var(--z-menu);
  width: 300px;
  max-width: calc(100vw - 20px);
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--bg-elev) 96%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2);
}
.user-menu-header { display: flex; align-items: center; gap: 12px; }
.user-menu-meta { display: grid; gap: 2px; }
.user-menu-meta strong { font-size: 15px; }
.user-menu-meta span { font-size: 12px; color: var(--text-3); }
.user-menu-separator { height: 1px; background: var(--line); }
.user-menu-section { display: grid; gap: 6px; }
.user-menu-item {
  appearance: none;
  border: 1px solid transparent;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}
.user-menu-item:hover { border-color: var(--line-2); background: var(--bg-soft-2); }
.user-menu-item.danger { color: var(--danger); }
.menu-symbol { color: var(--text-3); }

.hero {
  display: flex;
  align-items: flex-end;
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 76px);
  line-height: .92;
  letter-spacing: -.02em;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}

.sidebar-shell,
.chat-shell,
.card,
.settings-card,
.planner-card,
.panel,
#builderPanel,
.auth-container,
.practice-modal,
.wrap,
.empty-state,
.planner-empty {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-1);
}

/* Builder panel: capped width so it doesn't stretch full page */
#builderPanel {
  max-width: 680px;
  padding: var(--s-5);
  display: grid;
  gap: var(--s-4);
}

/* Practice empty state: compact strip, not a big floating card */
#practiceEmpty {
  max-width: 680px;
  padding: var(--s-4) var(--s-5);
  display: flex;
  align-items: center;
  gap: var(--s-5);
}
#practiceEmpty h2 { margin: 0; font-size: 15px; white-space: nowrap; }
#practiceEmpty p { margin: 0; font-size: 13px; flex: 1; }
#practiceEmpty .row { margin: 0 !important; flex-shrink: 0; }

.sidebar-shell {
  position: relative;
  top: 0;
  width: 256px;  /* width applied via .sidebar-open context */
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 0;
  /* override card group: flush panel, right border as divider */
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: var(--bg-elev);
}

.section {
  padding: var(--s-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  display: grid;
  gap: var(--s-3);
}

/* Sections inside chat sidebar — flat divider style, no nested card */
.sidebar-shell .section {
  background: transparent;
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--line);
  padding: var(--s-3) 0;
  gap: var(--s-2);
}
.sidebar-shell .section:first-child {
  border-top: none;
  padding-top: 0;
}

/* Compact sidebar h2 headings */
.sidebar-shell h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
}

/* ── Collapsible study guide generator ── */
.sg-generate-details { list-style: none; }
.sg-generate-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  padding: 5px 0;
  list-style: none;
  outline: none;
  transition: opacity var(--dur-fast);
}
.sg-generate-trigger::-webkit-details-marker { display: none; }
.sg-generate-trigger:hover { opacity: .75; }
.sg-generate-body {
  display: grid;
  gap: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* Compact tool / filepick inside sidebar */
.sidebar-shell .tool {
  padding: var(--s-2);
  gap: var(--s-2);
}
.sidebar-shell .filepick {
  padding: 8px;
  gap: 8px;
}
.sidebar-shell .filepick-ico { width: 28px; height: 28px; border-radius: 7px; }
.sidebar-shell .filepick-name { font-size: 13px; }
.sidebar-shell .muted { font-size: 12px; }
.sidebar-shell label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 2px; display: block; }

.row,
.row-between,
.actions,
.chat-actions,
.item-actions,
.setup-actions,
.filter-row,
.detail-badges,
.review-top,
.review-grid,
.review-block,
.grade-head,
.assignment-head,
.assignment-footer,
.result-kpis,
.question-actions,
.sg-head-actions,
.sg-actions,
.nav-strip,
.planner-status-inner,
.chat-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.row-between,
.chat-header,
.section-header,
.grade-head,
.assignment-head,
.review-top,
.nav-strip,
.planner-status-inner,
.question-header {
  justify-content: space-between;
}

h2, .section-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -.01em;
  font-weight: 700;
}
h3 { margin: 0; font-size: 16px; font-weight: 700; }

label,
.planner-kicker,
.stat-label,
.detail-label,
.review-block h4,
.code-meta {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
}

.muted,
.subtle,
.item-sub,
.meta,
.section-copy,
.settings-note,
.assistant-meta,
.status-line,
.planner-status-copy,
.detail-empty,
.detail-copy,
.review-text,
.assignment-meta,
.grade-meta {
  color: var(--text-2);
  line-height: 1.45;
}

.btn,
.sbtn,
.tiny,
.a-btn,
.filter-chip,
.icon,
.tab,
.submit-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: var(--r-pill);
  min-height: 40px;
  padding: 10px 15px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast);
}

.btn:hover,
.sbtn:hover,
.tiny:hover,
.a-btn:hover,
.filter-chip:hover,
.icon:hover,
.tab:hover,
.submit-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-2);
  background: var(--bg-soft-2);
}

.btn:active,
.sbtn:active,
.tiny:active,
.a-btn:active,
.filter-chip:active,
.icon:active,
.tab:active,
.submit-btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled,
.sbtn:disabled,
.tiny:disabled,
.a-btn:disabled,
.filter-chip:disabled,
.icon:disabled,
.tab:disabled,
.submit-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
.sbtn.primary,
.icon.send,
.submit-btn,
.tab.active,
.app-nav-link.active,
.filter-chip.active {
  border-color: transparent;
  color: #fff;
  background: var(--accent);
}
.btn-primary:hover,
.sbtn.primary:hover,
.icon.send:hover,
.submit-btn:hover,
.tab.active:hover,
.filter-chip.active:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000 12%);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), .25);
}
.sbtn.danger,
.btn.danger,
.user-menu-item.danger {
  background: color-mix(in srgb, var(--danger) 16%, var(--bg-soft) 84%);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line) 72%);
  color: var(--danger);
}

input,
select,
textarea,
.input,
.input-sm,
.select-sm,
#canvasUrl,
.form-group input,
.form-group select,
#timeZoneSelect,
#accentColor {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-elev);
  color: var(--text);
  padding: 11px 13px;
  outline: none;
}
textarea.input {
  min-height: 56px;
  resize: none;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus,
.btn:focus-visible,
.sbtn:focus-visible,
.tiny:focus-visible,
.a-btn:focus-visible,
.filter-chip:focus-visible,
.icon:focus-visible,
.user-menu-trigger:focus-visible,
.tab:focus-visible,
.submit-btn:focus-visible {
  box-shadow: var(--ring);
  border-color: var(--accent);
}

/* Compact sizes for small action buttons */
.tiny,
.a-btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.sbtn {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 13px;
  white-space: nowrap;
}

.listbox { display: grid; gap: var(--s-2); }
.item {
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 10px 12px;
  display: grid;
  gap: 7px;
}
.item.active {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line) 54%);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev) 92%);
}
.item-title { font-size: 13px; font-weight: 600; }
.item-sub { font-size: 13px; }
.item-meta { display: grid; gap: 4px; }

.tool {
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: var(--s-3);
  display: grid;
  gap: var(--s-3);
}

.filepick {
  border-radius: var(--r-sm);
  border: 1px dashed var(--line-2);
  background: var(--bg-soft);
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
}
.filepick.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-soft) 92%);
}
.filepick-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.filepick-name { font-weight: 800; font-size: 16px; color: var(--text); }
.study-guide-controls { display: flex; gap: 10px; flex-wrap: wrap; }

.status,
#toolStatus,
#runnerStatus,
#resultsStatus,
#setupStatus,
#linkStatus,
#dashboardStatus,
#status {
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 11px 13px;
  color: var(--text-2);
  font-weight: 600;
}
.status.error,
#dashboardStatus.error { border-color: color-mix(in srgb, var(--danger) 34%, var(--line) 66%); color: var(--danger); }
.status.success,
#dashboardStatus.success { border-color: color-mix(in srgb, var(--success) 34%, var(--line) 66%); color: var(--success); }
.status.warning,
#dashboardStatus.warning { border-color: color-mix(in srgb, var(--warning) 34%, var(--line) 66%); color: var(--warning); }
.planner-status-action { margin-left: auto; }
.planner-status { border-radius: var(--r-sm); }

.chat-shell {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto auto;
  overflow: hidden;
}

.chat-header {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  background: var(--bg-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.chat-title strong {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.messages {
  padding: 10px 14px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { border-radius: var(--r-pill); background: color-mix(in srgb, var(--text-3) 40%, transparent); }

.empty {
  margin: 32px auto;
  max-width: 640px;
  text-align: center;
  display: grid;
  gap: 8px;
}
.empty h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: .95;
}
.empty p { margin: 0; font-size: 15px; color: var(--text-2); }
.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}
.prompt-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-2);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.prompt-chip:hover {
  background: var(--bg-soft);
  border-color: var(--line-2);
  color: var(--text);
}

.message {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}
.message.user .avatar { order: 2; }
.message.user .bubble { margin-left: auto; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.bubble {
  width: fit-content;
  max-width: min(860px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 10px 13px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}
.message.user .bubble {
  background: color-mix(in srgb, var(--accent) 9%, var(--bg-elev) 91%);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line) 72%);
}

.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 6px 0 8px 20px; }
.bubble li { margin: 3px 0; }
.bubble strong { font-weight: 800; }
.bubble em { font-style: italic; }
.bubble code {
  font-family: var(--font-mono);
  font-size: .88em;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 2px 6px;
}
.bubble pre {
  margin: 10px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 12px;
  overflow: auto;
}

.assistant-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.meta-chip,
.chip {
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.meta-chip.conf-high { border-color: color-mix(in srgb, var(--success) 40%, var(--line) 60%); }
.meta-chip.conf-med { border-color: color-mix(in srgb, var(--warning) 40%, var(--line) 60%); }
.meta-chip.conf-low { border-color: color-mix(in srgb, var(--danger) 40%, var(--line) 60%); }

.actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }

.typing-dots { display: flex; gap: 8px; }
.typing-dots .dot {
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--accent) 55%, #fff 45%);
  animation: bp-dot 1s ease-in-out infinite;
}
.typing-dots .dot:nth-child(2) { animation-delay: .12s; }
.typing-dots .dot:nth-child(3) { animation-delay: .24s; }
@keyframes bp-dot {
  0%,100% { transform: scale(.78); opacity: .42; }
  50% { transform: scale(1.12); opacity: 1; }
}

.composer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 12px 14px;
  display: grid;
  gap: 9px;
}
.file-preview {
  display: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 8px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.file-preview.active { display: flex; }
.file-preview-info { display: flex; gap: 10px; align-items: center; overflow: hidden; }
.file-preview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  flex-shrink: 0;
}
.file-preview-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remove-file {
  appearance: none;
  border: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  gap: 9px;
}
.icon {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 20px;
}
.composer-toolbar { display: flex; justify-content: space-between; }
.composer-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 7px 11px;
}
.composer-mode-symbol { color: var(--accent); font-weight: 800; }
.composer-select {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.command-chip,
.quick-chip,
.mode-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-2);
  border-radius: var(--r-pill);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.status-line { min-height: 20px; font-size: 13px; }
.status-line.show { color: var(--danger); }

.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sg-overlay,
.practice-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.sg-overlay[hidden],
.practice-overlay[hidden] { display: none !important; }

.sg-panel,
.practice-modal {
  width: min(1200px, calc(100vw - 16px));
  max-height: calc(100vh - 22px);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  box-shadow: var(--shadow-2);
}

.sg-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto;
  overflow: hidden;
}
.sg-head,
.sg-foot {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-soft);
}
.sg-foot { border-bottom: 0; border-top: 1px solid var(--line); }
.sg-head h3 { font-family: var(--font-display); font-size: 34px; margin: 0; }
.sg-meta { padding: 8px 14px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.sg-chip {
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  display: inline-flex;
  margin-right: 6px;
  margin-bottom: 5px;
}
.page { color: var(--text); }
.sub { color: var(--text-2); }
.sg-close {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  width: 40px;
  height: 40px;
  background: var(--bg-elev);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.sg-body { min-height: 0; overflow: auto; padding: 16px; }

.markdown-body { color: var(--text); line-height: 1.56; }
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 14px 0 8px;
  font-family: var(--font-display);
  line-height: 1.1;
}
.markdown-body h1 { font-size: 36px; }
.markdown-body h2 { font-size: 30px; }
.markdown-body h3 { font-size: 24px; }
.markdown-body p { margin: 0 0 10px; }
.markdown-body ul,
.markdown-body ol { margin: 0 0 11px 22px; }
.markdown-body a,
.bubble a,
.review-text a,
.detail-copy a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.markdown-body a:hover,
.bubble a:hover,
.review-text a:hover,
.detail-copy a:hover { text-decoration: underline; }

.planner-shell,
.settings-shell { display: grid; gap: var(--s-3); }
.planner-grid,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: var(--s-3);
}
.planner-card,
.settings-card,
#builderPanel,
.wrap,
.page-canvas .card {
  padding: var(--s-4);
  display: grid;
  gap: var(--s-3);
}

.assignment-list,
.grades-list,
.review-list { display: grid; gap: var(--s-2); }
.assignment-card,
.grade-card,
.review-item,
.detail-panel,
.field,
.advanced-options,
.question-shell,
.nav-strip,
.result-kpis,
.codebox,
.step,
.auth-container .form-section {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
}

.assignment-card {
  width: 100%;
  text-align: left;
  padding: 12px;
  cursor: pointer;
}
.assignment-card[aria-pressed='true'] {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line) 60%);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-soft) 92%);
}
.assignment-main, .grade-main { display: grid; gap: 4px; }
.assignment-title, .grade-title { font-size: 18px; font-weight: 800; }
.assignment-meta, .grade-meta { font-size: 14px; color: var(--text-2); }
.grade-card { padding: 12px; }
.grade-score { font-size: 38px; font-weight: 800; }

.planner-pill,
.badge {
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 800;
}
.planner-pill.high { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line) 70%); }
.planner-pill.medium { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, var(--line) 70%); }
.planner-pill.low { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, var(--line) 70%); }

.badge.correct { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, var(--line) 70%); }
.badge.partial { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, var(--line) 70%); }
.badge.incorrect { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line) 70%); }
.badge.skipped { background: color-mix(in srgb, var(--text-3) 20%, transparent); color: var(--text-2); border-color: var(--line); }

.detail-panel { padding: 12px; display: grid; gap: 10px; }
.detail-row {
  display: grid;
  grid-template-columns: 120px minmax(0,1fr);
  gap: 8px;
}
.detail-divider { height: 1px; background: var(--line); }

.practice-overlay { align-items: center; justify-items: center; }
.practice-modal {
  position: relative;
  overflow: hidden;
  padding: 12px;
}
.practice-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}
.panel {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  display: grid;
  gap: 12px;
}
.panel.hidden,
.hidden { display: none !important; }

.stack { display: grid; gap: var(--s-3); }
#builderPanel { background: var(--bg-elev); }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: var(--s-2);
}
.field-grid.compact { grid-template-columns: repeat(3, minmax(0,1fr)); }

.advanced-options summary {
  list-style: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 10px 12px;
  font-weight: 700;
}
.advanced-options[open] summary { margin-bottom: 10px; }

.question-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.question-nav button {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  font-weight: 800;
  cursor: pointer;
}
.question-nav button.active,
.question-nav button[aria-current='step'] {
  color: #fff;
  border-color: transparent;
  background: var(--accent);
}
.question-nav button.answered { border-color: color-mix(in srgb, var(--success) 50%, var(--line) 50%); }
.question-nav button.checked { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 32%, transparent); }

.question-shell { padding: 12px; display: grid; gap: 12px; }
.question-prompt {
  font-size: clamp(24px, 2.8vw, 40px);
  line-height: 1.1;
  letter-spacing: -.015em;
  font-weight: 800;
}
.options { display: grid; gap: 8px; }
.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--bg-elev);
}
.option:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line) 52%);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev) 92%);
}

.timer {
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--warning) 34%, var(--line) 66%);
  background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--warning);
  font-weight: 800;
  padding: 7px 12px;
}

.result-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
}
.stat {
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 10px;
}
.stat-value { font-size: 34px; font-weight: 800; line-height: 1; }

.review-item {
  padding: 10px;
  display: grid;
  gap: 8px;
}
.review-title { font-weight: 800; }
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.review-block { display: grid; gap: 6px; }
.hint {
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line) 66%);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 10px;
}

.page-canvas .card,
.wrap,
.settings-shell {
  width: min(1080px, 100%);
  margin-inline: auto;
}

.steps { display: grid; gap: 10px; }
.step {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.codebox { padding: 12px; display: grid; gap: 8px; }
.code {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: .06em;
  font-weight: 700;
}

.page-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--bg);
}
.auth-container {
  width: min(420px, calc(100vw - 32px));
  padding: var(--s-6) var(--s-6) var(--s-5);
  display: grid;
  gap: var(--s-4);
  box-shadow: var(--shadow-2);
}

/* ── Login branding ── */
.logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding-bottom: var(--s-2);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}
.title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}
.desc { margin: 0; font-size: 14px; color: var(--text-3); }

.form-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.tab {
  border-radius: calc(var(--r-md) - 3px) !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.tab.active {
  background: var(--bg-elev) !important;
  box-shadow: var(--shadow-1) !important;
  color: var(--text) !important;
}
.form-section { display: none; padding: 0; }
.form-section.active { display: grid; gap: 14px; }
.form-group { display: grid; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.help-text { margin: 0; font-size: 12px; color: var(--text-3); }

/* Login submit button — full width */
.submit-btn { width: 100%; justify-content: center; padding: 11px 20px; font-size: 15px; font-weight: 600; }

.oauth-block { display: grid; gap: 10px; }
#googleSignInWrap { width: 100%; }
#googleSignInButton { width: 100%; display: flex; justify-content: stretch; }
#googleSignInButton > div { width: 100% !important; }
.divider {
  text-align: center;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
}

.error-message,
.success-message {
  display: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-weight: 700;
}
.error-message.show,
.success-message.show { display: block; }
.error-message {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line) 70%);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.success-message {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, var(--line) 70%);
  background: color-mix(in srgb, var(--success) 10%, transparent);
}

.page-privacy .wrap {
  margin-top: 28px;
  margin-bottom: 28px;
  padding: var(--s-6);
}
.page-privacy h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 66px);
  line-height: .95;
}
.page-privacy h2 {
  margin: 22px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
}
.page-privacy p,
.page-privacy li { color: var(--text); line-height: 1.6; }
.page-privacy ul { margin: 8px 0 8px 22px; }

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 200px 1fr; }
  .planner-grid,
  .settings-grid,
  .field-grid.compact { grid-template-columns: minmax(0,1fr); }
  .topbar { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .app-account { flex-wrap: wrap; }
}

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0,1fr); }
  .sidebar-shell { position: static; }
  .page-chat .layout { flex-direction: column; }
  .field-grid,
  .review-grid,
  .result-kpis { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 56px 1fr; }
  .sidebar-brand-name,
  .sidebar-nav-link span:last-child,
  .sidebar-user-meta,
  .sidebar-footer-actions .sidebar-footer-btn:not(:first-child) { display: none; }
  .sidebar-nav-link { justify-content: center; padding: 10px 8px; }
  .sidebar-nav-link .nav-icon { opacity: 1; }
  .sidebar-top { justify-content: center; padding: 12px 8px; }
  .sidebar-footer { align-items: center; }
  .sidebar-footer-actions { flex-direction: column; }
  .sidebar-footer-actions .sidebar-footer-btn:first-child { display: flex; justify-content: center; }
  .sidebar-user { justify-content: center; padding: 4px; }
}

@media (max-width: 640px) {
  .app-shell { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .app-sidebar { display: none; }
  .app-main { height: auto; overflow: auto; padding: var(--s-4) var(--s-3); }
  .page-chat .app-main { height: 100dvh; overflow: hidden; }
  .composer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .chat-actions .tiny:not(:first-child) { display: none; }
  .container { width: calc(100vw - 16px); margin-top: 10px; gap: 14px; }
  .topbar { min-height: 60px; }
  .bp-logo-link { width: 44px; height: 44px; border-radius: var(--r-sm); }
  .app-nav { width: 100%; justify-content: space-between; }
  .app-nav-link { flex: 1 1 0; text-align: center; }
  .hero h1 { font-size: clamp(34px, 10vw, 52px); }
  h2, .section-title { font-size: clamp(26px, 7vw, 36px); }
  .chat-title strong { font-size: 14px; }
  .messages { padding: 12px; }
  .message { grid-template-columns: 36px minmax(0,1fr); gap: 8px; }
  .message.user { grid-template-columns: minmax(0,1fr) 36px; }
  .avatar { width: 36px; height: 36px; font-size: 12px; }
  .bubble { max-width: 100%; padding: 11px 12px; font-size: 15px; }
  .input-row { grid-template-columns: minmax(0,1fr) 40px 40px; }
  .icon { min-width: 40px; width: 40px; min-height: 40px; font-size: 18px; }
  .footer { flex-direction: column; align-items: flex-start; }
  .sg-panel,
  .practice-modal { width: calc(100vw - 8px); max-height: calc(100vh - 10px); }
  .auth-container { padding: var(--s-4); border-radius: var(--r-md); }
  .hero .title { font-size: clamp(36px, 11vw, 58px); }
  .auth-container .title { font-size: 20px; }
  .planner-grid,
  .settings-grid,
  .field-grid,
  .field-grid.compact,
  .review-grid,
  .result-kpis { grid-template-columns: minmax(0,1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
