:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --surface-muted: #f3f6fc;

  --border: #e2e8f4;
  --border-soft: #edf2fb;
  --border-strong: #d3ddef;

  --text: #0f172a;
  --text-strong: #0b1230;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --primary: #1d4ed8;
  --primary-strong: #1e40af;
  --primary-hover: #1e3aa8;
  --primary-soft: #eff4ff;
  --primary-tint: #dbeafe;

  --accent-violet: #6366f1;
  --accent-violet-soft: #ede9fe;
  --accent-amber: #f59e0b;
  --accent-amber-soft: #fef3c7;
  --accent-cyan: #0891b2;
  --accent-cyan-soft: #e0f2fe;

  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --success: #166534;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --shadow-card: 0 12px 30px rgba(60, 84, 138, 0.06);
  --shadow-card-hover: 0 20px 44px rgba(60, 84, 138, 0.1);
  --shadow-pop: 0 24px 60px rgba(60, 84, 138, 0.14);

  --sidebar-width: 248px;
  --sidebar-width-collapsed: 76px;
}

html[data-theme="dark"] {
  --bg: #020617;
  --surface: #0f172a;
  --surface-soft: #111c31;
  --surface-muted: #162033;

  --border: #334155;
  --border-soft: #1e293b;
  --border-strong: #475569;

  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;

  --primary: #60a5fa;
  --primary-strong: #3b82f6;
  --primary-hover: #93c5fd;
  --primary-soft: rgba(59, 130, 246, 0.18);
  --primary-tint: rgba(96, 165, 250, 0.22);

  --danger-bg: rgba(127, 29, 29, 0.24);
  --danger-border: rgba(248, 113, 113, 0.4);
  --success-bg: rgba(20, 83, 45, 0.32);
  --success-border: rgba(74, 222, 128, 0.32);

  --shadow-card: 0 16px 36px rgba(2, 6, 23, 0.34);
  --shadow-card-hover: 0 24px 48px rgba(2, 6, 23, 0.42);
  --shadow-pop: 0 30px 72px rgba(2, 6, 23, 0.52);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  font-weight: 700;
}

p { margin: 0; }

.global-theme-toggle {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: auto;
  min-height: 40px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
  color: var(--text-strong);
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.global-theme-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.global-theme-toggle-label > span:last-child {
  display: none;
}

.global-theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.global-theme-toggle-track {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  padding: 3px;
  border-radius: 999px;
  background: #d6dff1;
  transition: background 0.18s ease;
}

.global-theme-toggle-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease;
}

.global-theme-toggle[aria-checked="true"] {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(51, 65, 85, 0.92);
  color: #f8fafc;
}

.global-theme-toggle[aria-checked="true"] .global-theme-toggle-icon {
  color: #cbd5e1;
}

.global-theme-toggle[aria-checked="true"] .global-theme-toggle-track {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

.global-theme-toggle[aria-checked="true"] .global-theme-toggle-thumb {
  transform: translateX(18px);
}

/* ========== Shell ========== */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.app-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  z-index: 30;
  transition: width 0.2s ease;
}

.app-sidebar-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  padding: 22px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 32px 56px 64px;
  background: var(--bg);
}

.app-main-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

/* ========== Sidebar — brand ========== */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0px 6px 18px;
}

.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
}

.sidebar-brand-img {
  width: auto;
  display: block;
}

.sidebar-brand-img-dark {
  display: none;
}

.sidebar-brand-img-full {
  height: 52px;
}

.sidebar-brand-img-icon {
  display: none;
  height: 32px;
}

.sidebar-collapse-btn {
  position: absolute;
  top: 14px;
  right: -16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: color 0.18s ease, background 0.18s ease;
}

.sidebar-collapse-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.sidebar-mobile-close {
  display: none;
}

/* ========== Sidebar — nav ========== */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}

.sidebar-nav-link:hover,
.sidebar-nav-link:focus-visible {
  background: var(--surface-muted);
  outline: none;
}

.sidebar-nav-link.is-active {
  background: var(--bg);
  color: var(--primary);
}

.sidebar-nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: currentColor;
}

.sidebar-nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== Sidebar — footer ========== */
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-footer .sidebar-nav-link.is-user {
  padding: 10px 8px;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  flex-shrink: 0;
}

.sidebar-user-avatar-image {
  object-fit: cover;
}

.sidebar-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.sidebar-user-text strong {
  font-size: 0.92rem;
  font-weight: 700;
}

.sidebar-user-text span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
}

.sidebar-user-chevron {
  color: var(--text-subtle);
  flex-shrink: 0;
}

/* Collapsed (desktop) */
.app-shell.is-collapsed .app-sidebar { width: var(--sidebar-width-collapsed); }
.app-shell.is-collapsed .sidebar-brand {
  justify-content: center;
}
.app-shell.is-collapsed .sidebar-brand-link {
  justify-content: center;
}
.app-shell.is-collapsed .sidebar-brand-img-full { display: none; }
.app-shell.is-collapsed .sidebar-brand-img-icon { display: block; }
.app-shell.is-collapsed .sidebar-nav-label,
.app-shell.is-collapsed .sidebar-user-text,
.app-shell.is-collapsed .sidebar-user-chevron,
.app-shell.is-collapsed .sidebar-brand-text { display: none; }
.app-shell.is-collapsed .sidebar-nav-link { justify-content: center; padding: 10px; }
.app-shell.is-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/* ========== Mobile topbar ========== */
.app-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-topbar img { height: 46px; }

.topbar-brand-logo-dark {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-credits {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  background: #edf7ef;
  color: #2f6b3b;
  font-size: 0.82rem;
  font-weight: 700;
}

html[data-theme="dark"] .topbar-credits {
  background: rgba(20, 83, 45, 0.38);
  color: #bbf7d0;
}

html[data-theme="dark"] .sidebar-brand-img-light,
html[data-theme="dark"] .topbar-brand-logo-light {
  display: none;
}

html[data-theme="dark"] .sidebar-brand-img-dark,
html[data-theme="dark"] .topbar-brand-logo-dark {
  display: block;
}

.topbar-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 25;
}

.app-shell.sidebar-open .sidebar-overlay { display: block; }

/* ========== Headings / module headers ========== */
.module-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.module-eyebrow {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.module-header.is-study .module-eyebrow {
  background: #eef2ff;
  color: #3354c8;
}

.module-header.is-activities .module-eyebrow {
  background: #edfbe8;
  color: #59c73f;
}

.module-header.is-revision .module-eyebrow {
  background: #fff4e8;
  color: #fb8c00;
}

.module-header.is-practice .module-eyebrow {
  background: #f5e8fb;
  color: #b535e0;
}

.module-header h1 {
  font-size: clamp(1.6rem, 2.4vw, 1.95rem);
  line-height: 1.2;
}

.module-header > p {
  color: var(--text-muted);
  max-width: 78ch;
  font-size: 1rem;
}

.module-divider {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.dashboard-header {
  margin-bottom: 18px;
}

.dashboard-header h1 {
  font-size: clamp(2rem, 3.2vw, 2.6rem);
  line-height: 1.15;
  margin-bottom: 8px;
}

.dashboard-header p { color: var(--text-muted); font-size: 1.02rem; }

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ========== Dashboard cards ========== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.dashboard-quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.dashboard-quick-links--secondary {
  margin: 48px 0 0;
}

.dashboard-quick-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dashboard-quick-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pop);
}

.dashboard-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 26px 26px 26px 30px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}

.dashboard-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--card-accent, var(--primary));
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.dashboard-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-icon-bg, var(--primary-soft));
  color: var(--card-icon-color, var(--primary));
  flex-shrink: 0;
}

.dashboard-card-icon svg { width: 26px; height: 26px; }

.dashboard-card-body { min-width: 0; }
.dashboard-card-body h2 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  line-height: 1.25;
  color: var(--text-strong);
}
.dashboard-card-body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.dashboard-card-arrow {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.dashboard-card.is-study {
  --card-accent: #1d4ed8;
  --card-icon-bg: #eef2ff;
  --card-icon-color: #3354c8;
}
.dashboard-card.is-activities {
  --card-accent: #4ade80;
  --card-icon-bg: #edfbe8;
  --card-icon-color: #59c73f;
}
.dashboard-card.is-revision {
  --card-accent: #fb923c;
  --card-icon-bg: #fff4e8;
  --card-icon-color: #fb8c00;
}
.dashboard-card.is-practice {
  --card-accent: #c026d3;
  --card-icon-bg: #f5e8fb;
  --card-icon-color: #b535e0;
}

/* ========== Cards / panels ========== */
.module-form-card,
.module-output-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.module-output {
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-margin-top: 18px;
}

.module-empty-state {
  padding: 56px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}

.module-empty-state-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text-subtle);
}

.module-empty-state-title {
  font-weight: 700;
  color: var(--text);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}

/* ========== Forms ========== */
.activity-form {
  display: grid;
  gap: 18px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-group label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-strong);
}

.text-field {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.text-field::placeholder { color: var(--text-subtle); }

.text-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

textarea.text-field { min-height: 140px; resize: vertical; }

.field-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Combobox */
.combobox { position: relative; }
.combobox-input { padding-right: 40px; }
.combobox.is-open .combobox-input {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.combobox-trigger {
  position: absolute;
  top: 50%;
  right: 12px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transform: translateY(-50%);
}

.combobox-trigger-icon {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.18s ease;
}

.combobox.is-open .combobox-trigger-icon {
  transform: rotate(225deg) translateY(-1px);
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.combobox-options {
  max-height: 260px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.combobox-option,
.combobox-empty {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
}

.combobox-option {
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.combobox-option:hover,
.combobox-option:focus-visible,
.combobox-option.is-selected {
  background: var(--primary-soft);
  color: var(--primary-strong);
  outline: none;
}

.combobox-empty { color: var(--text-muted); }

/* Mixed fields */
.mixed-fields {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.mixed-fields-title {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 0.95rem;
}

.mixed-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mixed-fields-help {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.checkbox-field label {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
}

/* Radio cards */
.revision-mode-grid {
  display: grid;
  gap: 10px;
}

@media (min-width: 640px) {
  .revision-mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.revision-mode-option {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border 0.15s, background 0.15s, box-shadow 0.15s;
}

.revision-mode-option input { margin-top: 4px; accent-color: var(--primary); }

.revision-mode-option span { display: grid; gap: 4px; }
.revision-mode-option strong { font-weight: 700; }
.revision-mode-option small { color: var(--text-muted); line-height: 1.5; font-size: 0.85rem; }

.revision-mode-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.08);
}

.revision-file-input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.revision-file-input-shell:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.revision-file-input-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.revision-file-field {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.95rem;
}

.revision-file-field:focus {
  border: 0;
  box-shadow: none;
}

.revision-file-field::file-selector-button {
  margin-right: 12px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.revision-file-field::file-selector-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
}

html[data-theme="dark"] .revision-file-input-shell {
  background: var(--surface);
}

html[data-theme="dark"] .revision-file-field::file-selector-button {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text-strong);
}

html[data-theme="dark"] .revision-file-field::file-selector-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: #dbeafe;
}

.is-hidden { display: none !important; }

/* ========== Buttons ========== */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border 0.18s ease, opacity 0.18s ease;
  text-decoration: none;
  line-height: 1;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--primary-hover);
}

.primary-button[disabled] { opacity: 0.7; cursor: wait; }

.secondary-button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.secondary-button.is-static {
  cursor: default;
  pointer-events: none;
}

.result-actions form,
.form-actions form {
  display: inline-flex;
}

.button-with-icon svg { flex-shrink: 0; }
.button-with-google {
  gap: 10px;
}

.google-button-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-button-form {
  display: inline-flex;
}

.sidebar-logout-button {
  width: 100%;
  background: transparent;
  border: 0;
  text-align: left;
}

@keyframes generation-spin {
  to { transform: rotate(360deg); }
}

/* ========== Flash & errors ========== */
.flash {
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  width: min(1080px, calc(100% - 32px));
  font-size: 0.94rem;
}

.flash-notice { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.flash-alert { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

.credit-warning-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 18px 20px;
  border: 1px solid #d7e8d9;
  border-radius: var(--radius-lg);
  background: #f7fbf7;
  box-shadow: var(--shadow-card);
}

.credit-warning-banner strong {
  display: block;
  margin-bottom: 4px;
}

.credit-warning-banner p {
  color: var(--text-muted);
}

/* ========== Marketing ========== */
.marketing-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(68, 107, 255, 0.1), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.95), transparent 26%),
    linear-gradient(180deg, #f5f7fb 0%, #f4f7fc 100%);
}

.marketing-container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.marketing-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(245, 247, 251, 0.88);
  border-bottom: 1px solid rgba(226, 232, 244, 0.9);
}

.marketing-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 18px;
}

.marketing-brand {
  display: inline-flex;
  align-items: center;
}

.marketing-brand-logo {
  height: 44px;
  width: auto;
}

.marketing-header-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.marketing-nav,
.marketing-actions,
.marketing-actions-large {
  display: flex;
  align-items: center;
  gap: 12px;
}

.marketing-mobile-menu {
  display: none;
  position: relative;
}

.marketing-mobile-menu-toggle {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-strong);
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.marketing-mobile-menu-toggle::-webkit-details-marker {
  display: none;
}

.marketing-mobile-nav {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(226, 232, 244, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-pop);
}

.marketing-mobile-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-strong);
  font-weight: 600;
}

.marketing-mobile-nav a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.marketing-nav a {
  color: var(--text-strong);
  font-weight: 500;
}

.marketing-nav a:hover {
  color: var(--primary);
}

.marketing-hero {
  padding: 44px 0 36px;
}

.marketing-hero-grid,
.credits-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(400px, 1.05fr);
  gap: 15px;
  align-items: start;
}

.credits-methods-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.credits-recharge-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 255, 0.96));
  border: 1px solid rgba(226, 232, 244, 0.95);
  border-radius: 26px;
  box-shadow: var(--shadow-card);
}

.credits-summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  min-height: 0;
  padding: 24px;
}

.credits-recharge-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.credits-summary-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.credits-summary-head .pricing-plan,
.credits-summary-head .credits-balance-label {
  margin-bottom: 0;
}

.credits-summary-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  flex-shrink: 0;
}

.credits-summary-icon.is-balance {
  background: linear-gradient(180deg, #eef4ff 0%, #e8f0ff 100%);
  color: #1d4ed8;
}

.credits-summary-icon.is-pack {
  background: linear-gradient(180deg, #eefdf5 0%, #e7f9ef 100%);
  color: #0f9f5b;
}

.credits-summary-content,
.credits-pack-copy,
.credits-purchase-panel {
  min-width: 0;
}

.credits-summary-content {
  display: grid;
  gap: 4px;
}

.credits-purchase-panel {
  display: grid;
  gap: 16px;
}

.credits-buy-button {
  width: 100%;
  max-width: 100%;
  justify-content: center;
  justify-self: stretch;
  gap: 10px;
  margin-top: 0;
  min-width: 0;
  white-space: normal;
  padding: 13px 20px;
  font-size: 0.98rem;
}

.credits-checkout-shell {
  display: grid;
  gap: 16px;
  margin-top: 6px;
  min-width: 0;
}

.credits-status-card,
.credits-pix-card,
.credits-unavailable-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.credits-status-card[data-status="approved"] {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.credits-status-card[data-status="pending"] {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.credits-status-card[data-status="rejected"],
.credits-status-card[data-status="cancelled"],
.credits-status-card[data-status="refunded"] {
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

.credits-payment-brick {
  min-height: 240px;
  width: 100%;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.credits-error-banner {
  padding: 14px 16px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
}

.credits-pix-card h3,
.credits-status-card h3 {
  margin: 0 0 8px;
}

.credits-pix-image {
  display: block;
  width: min(100%, 240px);
  margin: 14px auto;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
}

.credits-pix-code {
  width: 100%;
  resize: vertical;
  font-size: 0.92rem;
}

.credits-dev-button {
  justify-content: center;
}

.credits-orders-card {
  padding: 24px;
}

.credits-orders-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.credit-orders-history {
  margin-bottom: 10px;
}

.credit-order-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 98px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
}

.credit-order-status-pending {
  background: #eff6ff;
  color: #1d4ed8;
}

.credit-order-status-approved {
  background: #ecfdf5;
  color: #047857;
}

.credit-order-status-rejected,
.credit-order-status-cancelled,
.credit-order-status-refunded {
  background: #fef2f2;
  color: #b91c1c;
}

.credits-assurance-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 255, 0.96));
  border: 1px solid rgba(226, 232, 244, 0.95);
  border-radius: 26px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.credits-assurance-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 24px 28px;
}

.credits-assurance-item + .credits-assurance-item {
  border-left: 1px solid rgba(226, 232, 244, 0.95);
}

.credits-assurance-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #eef4ff 0%, #edf2ff 100%);
  color: #1d4ed8;
}

.credits-assurance-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-strong);
}

.credits-assurance-item p {
  color: var(--text-muted);
}

html[data-theme="dark"] .credits-balance-card,
html[data-theme="dark"] .credits-recharge-card,
html[data-theme="dark"] .module-output-card .credit-history-item,
html[data-theme="dark"] .credits-status-card,
html[data-theme="dark"] .credits-pix-card,
html[data-theme="dark"] .credits-unavailable-card,
html[data-theme="dark"] .credits-payment-brick,
html[data-theme="dark"] .credits-assurance-card {
  background: #111c31;
  border-color: #334155;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.34);
}

html[data-theme="dark"] .credits-balance-card,
html[data-theme="dark"] .credits-recharge-card {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.98), rgba(15, 23, 42, 0.98));
}

html[data-theme="dark"] .credit-history-item {
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.98), rgba(15, 23, 42, 0.98));
}

html[data-theme="dark"] .credits-summary-icon.is-balance,
html[data-theme="dark"] .credit-history-item-icon,
html[data-theme="dark"] .credits-assurance-icon {
  background: rgba(37, 99, 235, 0.16);
  color: #93c5fd;
}

html[data-theme="dark"] .credits-summary-icon.is-pack {
  background: rgba(5, 150, 105, 0.18);
  color: #6ee7b7;
}

html[data-theme="dark"] .credits-balance-card strong,
html[data-theme="dark"] .credits-recharge-card h2,
html[data-theme="dark"] .pricing-value,
html[data-theme="dark"] .module-output-card h2,
html[data-theme="dark"] .credit-history-item strong,
html[data-theme="dark"] .credits-assurance-item strong {
  color: #f8fafc;
}

html[data-theme="dark"] .pricing-plan.is-success {
  color: #6ee7b7;
}

html[data-theme="dark"] .credits-balance-card span,
html[data-theme="dark"] .pricing-description,
html[data-theme="dark"] .credit-history-item p,
html[data-theme="dark"] .credit-history-order-id,
html[data-theme="dark"] .credits-status-card p,
html[data-theme="dark"] .credits-pix-card p,
html[data-theme="dark"] .credits-unavailable-card p,
html[data-theme="dark"] .credits-assurance-item p {
  color: #cbd5e1;
}

html[data-theme="dark"] .credits-status-card h3,
html[data-theme="dark"] .credits-pix-card h3,
html[data-theme="dark"] .credits-unavailable-card strong {
  color: #f8fafc;
}

html[data-theme="dark"] .credits-pix-image {
  border-color: #475569;
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.34);
}

html[data-theme="dark"] .credits-pix-code {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .credit-history-order-id {
  background: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .credits-assurance-item + .credits-assurance-item {
  border-left-color: #334155;
}

html[data-theme="dark"] .credit-order-status-pending {
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
}

html[data-theme="dark"] .credit-order-status-approved {
  background: rgba(21, 128, 61, 0.2);
  color: #86efac;
}

html[data-theme="dark"] .credit-order-status-rejected,
html[data-theme="dark"] .credit-order-status-cancelled,
html[data-theme="dark"] .credit-order-status-refunded {
  background: rgba(185, 28, 28, 0.18);
  color: #fca5a5;
}

.marketing-copy h1 {
  margin-top: 18px;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
}

.marketing-copy h1 span {
  color: #2563eb;
}

.marketing-lead {
  margin-top: 24px;
  max-width: 30rem;
  color: var(--text-muted);
  font-size: 1.18rem;
  line-height: 1.75;
}

.marketing-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 244, 0.95);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(60, 84, 138, 0.08);
}

.marketing-hero-actions {
  margin-top: 28px;
}

.marketing-hero-actions .auth-button-form {
  width: auto;
}

.marketing-hero-actions .primary-button {
  min-width: 210px;
  justify-content: center;
}

.marketing-showcase {
  position: relative;
}

.marketing-step-card,
.marketing-module-card,
.pricing-card,
.marketing-cta-card,
.credits-balance-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 244, 0.95);
  border-radius: 26px;
  box-shadow: var(--shadow-card);
}

.marketing-module-card h3,
.marketing-step-card h3 {
  display: block;
  margin-bottom: 6px;
}

.marketing-module-card p,
.marketing-step-card p,
.pricing-description,
.credits-balance-card span {
  color: var(--text-muted);
}

.marketing-modules-grid,
.marketing-steps {
  display: grid;
  gap: 28px;
}

.marketing-module-card,
.marketing-step-card {
  padding: 34px;
}

.marketing-section {
  padding: 46px 0 56px;
  border-top: 1px solid rgba(226, 232, 244, 0.86);
  scroll-margin-top: 85px;
}

.marketing-section-header {
  margin-bottom: 34px;
  text-align: center;
}

.marketing-section-header h2 {
  margin-top: 12px;
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1.14;
}

.marketing-section-header p:last-child {
  margin: 14px auto 0;
  max-width: 42rem;
  color: var(--text-muted);
  font-size: 1.06rem;
}

.marketing-steps,
.marketing-modules-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.marketing-step-card span {
  width: 36px;
  height: 36px;
  margin-bottom: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #4f7bff 0%, #2563eb 100%);
  color: #fff;
  font-weight: 800;
}

.marketing-steps-flow {
  position: relative;
}

.marketing-steps-flow::before {
  content: "";
  position: absolute;
  left: 16.66%;
  right: 16.66%;
  top: 50%;
  border-top: 2px dashed rgba(96, 165, 250, 0.55);
  transform: translateY(-50%);
}

.marketing-steps-flow .marketing-step-card {
  position: relative;
  z-index: 1;
}

.marketing-module-card .dashboard-card-icon {
  margin-bottom: 22px;
}

.dashboard-card-icon.is-study,
.marketing-mini-card.is-study .dashboard-card-icon {
  background: #eef2ff;
  color: #3354c8;
}

.dashboard-card-icon.is-activities,
.marketing-mini-card.is-activities .dashboard-card-icon {
  background: #edfbe8;
  color: #59c73f;
}

.dashboard-card-icon.is-revision,
.marketing-mini-card.is-revision .dashboard-card-icon {
  background: #fff4e8;
  color: #fb8c00;
}

.dashboard-card-icon.is-practice,
.marketing-mini-card.is-practice .dashboard-card-icon {
  background: #f5e8fb;
  color: #b535e0;
}

.pricing-card,
.marketing-cta-card,
.credits-balance-card {
  padding: 34px;
}

.pricing-card {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(360px, 1fr) minmax(220px, 0.76fr);
  align-items: center;
  gap: 36px;
  padding: 38px 42px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 255, 0.96));
}

.pricing-plan,
.credits-balance-label {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pricing-plan.is-success {
  color: #0f9f5b;
}

.credits-pack-copy h2 {
  font-size: clamp(1.75rem, 2.6vw, 2rem);
  line-height: 1.05;
}

.pricing-value {
  margin: 6px 0 8px;
  font-size: clamp(2.2rem, 3.5vw, 2.7rem);
  font-weight: 800;
  color: var(--text-strong);
  line-height: 1;
}

.marketing-cta-card {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(250px, 320px);
  align-items: center;
  gap: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.92));
}

.credits-balance-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 2.1rem;
  line-height: 1;
}

.module-output-spaced {
  margin-top: 24px;
}

.credit-history-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.credit-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.credit-history-item-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.credit-history-item-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(180deg, #eef4ff 0%, #edf2ff 100%);
  color: #1d4ed8;
  flex-shrink: 0;
}

.credit-history-item-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.credit-history-item p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.credit-amount-positive,
.credit-amount-negative {
  font-weight: 800;
}

.credit-amount-positive { color: #2f6b3b; }
.credit-amount-negative { color: #b45309; }

.form-errors {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.form-errors h2 { margin: 0 0 8px; font-size: 0.98rem; color: var(--danger); }
.form-errors ul { margin: 0; padding-left: 18px; }

.marketing-browser-frame {
  overflow: hidden;
  border: 1px solid rgba(226, 232, 244, 0.98);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 28px 60px rgba(60, 84, 138, 0.14);
}

.marketing-browser-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(226, 232, 244, 0.9);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.marketing-browser-dots {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.marketing-browser-dots i {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.marketing-browser-dots i:nth-child(1) { background: #ff6a5f; }
.marketing-browser-dots i:nth-child(2) { background: #ffbe2e; }
.marketing-browser-dots i:nth-child(3) { background: #2aca75; }

.marketing-browser-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.marketing-browser-ring,
.marketing-browser-avatar {
  display: inline-flex;
  border-radius: 999px;
  background: var(--surface-muted);
}

.marketing-browser-ring {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
}

.marketing-browser-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(180deg, #ffe3d5, #d7e5ff);
  border: 1px solid rgba(211, 221, 239, 0.8);
}

.marketing-browser-body {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  min-height: 500px;
}

.marketing-browser-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 12px;
  border-right: 1px solid rgba(226, 232, 244, 0.9);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.marketing-browser-brand {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.marketing-browser-brand-image {
  width: 30px;
  height: auto;
}

.marketing-browser-nav-item {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
}

.marketing-browser-nav-item.is-active {
  background: #eef4ff;
  border-color: #dbe7ff;
}

.marketing-browser-nav-item.is-bottom {
  margin-top: auto;
}

.marketing-browser-content {
  display: grid;
  gap: 22px;
  padding: 28px;
}

.marketing-browser-eyebrow {
  color: #6b7a99;
  font-size: 0.92rem;
  font-weight: 700;
}

.marketing-browser-copy h2 {
  margin-top: 8px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.15;
}

.marketing-browser-copy p:last-child {
  margin-top: 12px;
  color: var(--text-muted);
  line-height: 1.75;
}

.marketing-browser-placeholder {
  min-height: 290px;
  border: 2px dashed #d7e3fb;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.94), rgba(241, 246, 255, 0.82)),
    repeating-linear-gradient(
      45deg,
      rgba(219, 234, 254, 0.18),
      rgba(219, 234, 254, 0.18) 16px,
      rgba(255, 255, 255, 0.7) 16px,
      rgba(255, 255, 255, 0.7) 32px
    );
  display: grid;
  place-items: center;
}

.marketing-browser-placeholder span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 14px 20px;
  border-radius: 999px;
  border: 1px solid #d8e3f8;
  background: rgba(255, 255, 255, 0.88);
  color: #6b7a99;
  font-weight: 700;
}

.marketing-modules-grid-expanded {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.marketing-module-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.marketing-module-card.is-study {
  border-color: rgba(147, 197, 253, 0.9);
}

.marketing-module-card.is-activities {
  border-color: rgba(187, 247, 208, 0.92);
}

.marketing-module-card.is-revision {
  border-color: rgba(253, 230, 138, 0.92);
}

.marketing-module-card.is-practice {
  border-color: rgba(233, 213, 255, 0.92);
}

.marketing-module-points {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.marketing-module-points li {
  position: relative;
  padding-left: 22px;
  color: #45556f;
  line-height: 1.55;
}

.marketing-module-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%);
  opacity: 0.22;
}

.marketing-module-card.is-study .marketing-module-points li { color: #3156c7; }
.marketing-module-card.is-activities .marketing-module-points li { color: #2f9e44; }
.marketing-module-card.is-revision .marketing-module-points li { color: #ea7c16; }
.marketing-module-card.is-practice .marketing-module-points li { color: #a63edb; }

.marketing-inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-top: auto;
  margin-left: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--primary);
  background: rgba(255, 255, 255, 0.95);
}

.pricing-card-copy {
  max-width: 34rem;
}

.pricing-card-copy-main {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.pricing-card-copy-block {
  display: grid;
  gap: 4px;
}

.pricing-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f0f5ff, #dfe8ff);
  color: #2563eb;
}

.pricing-card-icon svg {
  width: 48px;
  height: 48px;
}

.pricing-subvalue {
  color: #60708c;
  font-size: 1rem;
}

.pricing-card-details {
  display: grid;
  gap: 20px;
  min-width: 0;
  padding: 4px 0 4px 34px;
  border-left: 1px solid rgba(226, 232, 244, 0.98);
}

.pricing-credit-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f5fcf4 0%, #ebf8ed 100%);
  border: 1px solid rgba(187, 247, 208, 0.8);
}

.pricing-credit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: #2f9e44;
  background: rgba(255, 255, 255, 0.82);
}

.pricing-credit-banner strong {
  display: block;
  color: var(--text-strong);
  font-size: 1.05rem;
  line-height: 1.3;
}

.pricing-credit-banner strong span {
  color: #2f9e44;
  font-size: 1.2em;
}

.pricing-credit-banner p {
  margin-top: 4px;
  color: #5e6d88;
}

.pricing-feature-list {
  display: grid;
  gap: 16px;
}

.pricing-feature-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.pricing-feature-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
  color: var(--text-strong);
}

.pricing-feature-item p {
  color: #5e6d88;
  line-height: 1.55;
}

.pricing-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.pricing-feature-icon.is-violet {
  background: #f2eaff;
  color: #7c3aed;
}

.pricing-feature-icon.is-amber {
  background: #fff2df;
  color: #f59e0b;
}

.pricing-feature-icon.is-blue {
  background: #e8efff;
  color: #2563eb;
}

.pricing-card-actions {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding-top: 8px;
}

.pricing-card-actions .auth-button-form,
.pricing-card-actions .primary-button {
  width: 100%;
  max-width: 306px;
}

.pricing-card-actions .primary-button {
  justify-content: center;
  min-height: 56px;
  border-radius: 16px;
  font-size: 1.02rem;
}

.pricing-card-actions p {
  color: #60708c;
  font-size: 0.95rem;
}

.pricing-card-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.pricing-visual-sheet {
  position: relative;
  width: 180px;
  height: 220px;
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #f0f5ff 100%);
  border: 1px solid rgba(220, 228, 244, 0.95);
  box-shadow: 16px 18px 40px rgba(60, 84, 138, 0.15);
  transform: rotate(8deg);
}

.pricing-visual-sheet::before {
  content: "";
  position: absolute;
  inset: 14px -12px -14px 14px;
  z-index: -1;
  border-radius: 28px;
  background: linear-gradient(180deg, #2f67f6 0%, #1d4ed8 100%);
}

.pricing-visual-line,
.pricing-visual-check {
  position: absolute;
}

.pricing-visual-line {
  left: 48px;
  right: 28px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #89aefc, #b6cbff);
}

.pricing-visual-line.is-short {
  right: 56px;
}

.pricing-visual-line:nth-of-type(1) { top: 42px; }
.pricing-visual-line:nth-of-type(3) { top: 92px; }
.pricing-visual-line:nth-of-type(5) { top: 142px; }
.pricing-visual-line:nth-of-type(7) { top: 176px; }

.pricing-visual-check {
  left: 22px;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  box-shadow: 0 6px 14px rgba(60, 84, 138, 0.14);
}

.pricing-visual-check::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(40deg);
}

.pricing-visual-check.is-green { background: linear-gradient(180deg, #7add6c, #34b34a); }
.pricing-visual-check.is-blue { background: linear-gradient(180deg, #8ab4ff, #4f86ff); }
.pricing-visual-check:nth-of-type(2) { top: 36px; }
.pricing-visual-check:nth-of-type(4) { top: 86px; }
.pricing-visual-check:nth-of-type(6) { top: 136px; }

.pricing-visual-badge {
  position: absolute;
  right: -18px;
  bottom: -14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3f7cff 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.28);
}

.marketing-trust-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
  color: #60708c;
  font-size: 0.98rem;
}

.marketing-trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.marketing-trust-row span:not(:last-child)::after {
  content: "•";
  color: #94a3b8;
}

.marketing-footer {
  padding: 26px 0 42px;
  border-top: 1px solid rgba(226, 232, 244, 0.86);
}

.marketing-footer p {
  text-align: center;
  color: #60708c;
  font-size: 0.98rem;
}

/* ============================================================
 * Generated content — preserved styles for activity / study /
 * revision / practice sheets. PDFs use their own layouts.
 * ============================================================ */

.activity-sheet,
.study-sheet,
.revision-sheet,
.practice-activity-sheet,
.practice-result-card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.activity-header,
.revision-header,
.study-header {
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.activity-title,
.revision-title,
.study-title {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.15;
}

.activity-meta,
.revision-meta,
.study-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.meta-separator { margin: 0 8px; }

/* Reading comprehension */
.reading-passages { margin-bottom: 22px; }
.reading-title { margin: 0 0 10px; font-size: 1.2rem; }
.reading-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.reading-text { font-size: 1rem; line-height: 1.75; }
.reading-text p { margin: 0 0 12px; }
.reading-text p:last-child { margin-bottom: 0; }

/* Question list */
.questions-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.question-item + .question-item { margin-top: 16px; }

.question-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.question-text {
  margin: 0 0 12px;
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.5;
}

.question-content { min-width: 0; text-align: left; }

.options-list { margin: 0; padding: 0; list-style: none; }
.option-item { display: block; margin-bottom: 8px; }
.option-label { display: inline-block; min-width: 28px; font-weight: 700; }

.question-matching-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 14px;
}

.question-matching-column {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.question-matching-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.question-matching-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.question-matching-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.question-matching-left-number,
.question-matching-right-marker {
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
}

.question-matching-list-right li {
  grid-template-columns: 42px 1fr;
}

.question-matching-instruction {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.true-false-instruction { margin: 0 0 12px; line-height: 1.6; }
.true-false-statements { margin: 0; padding-left: 0; list-style: none; }
.true-false-statement { margin-bottom: 8px; line-height: 1.7; }

.subjective-answer-lines {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.answer-line {
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--border-strong);
  min-height: 22px;
}

/* Answer key */
.answer-key {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 2px dashed var(--border);
}

.answer-key-page-break { page-break-before: always; break-before: page; }
.answer-key-title { margin: 0 0 12px; font-size: 1.2rem; }
.answer-key-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.answer-key-item + .answer-key-item { margin-top: 6px; }
.answer-key-block { margin-top: 4px; }

/* Practice */
.practice-shell { margin-bottom: 24px; }
.practice-result-summary { margin-bottom: 18px; }
.practice-result-card h2 { margin: 0 0 8px; font-size: 1.4rem; }
.practice-result-score { margin: 0; color: var(--text-muted); }

.practice-answer-form { display: grid; gap: 18px; }

.practice-questions-list { margin: 0; padding: 0; list-style: none; }

.practice-question-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.practice-question-card + .practice-question-card { margin-top: 14px; }

.practice-question-card.is-correct {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.practice-question-card.is-incorrect {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.practice-question-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.practice-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.practice-badge-correct { background: #dcfce7; color: var(--success); }
.practice-badge-incorrect { background: #fee2e2; color: var(--danger); }

.practice-options { display: grid; gap: 8px; }

.practice-matching-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.practice-matching-column {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.practice-matching-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.practice-matching-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.practice-matching-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.practice-matching-left-number,
.practice-matching-right-marker {
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
}

.practice-matching-list-right li {
  grid-template-columns: 42px 1fr;
}

.practice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.95rem;
}

.practice-option input[type="radio"] { margin: 0; accent-color: var(--primary); }

.practice-option-correct { border-color: var(--success-border); background: var(--success-bg); }
.practice-option-incorrect { border-color: var(--danger-border); background: var(--danger-bg); }

.practice-feedback {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.92rem;
}

.practice-feedback p { margin: 0; }
.practice-feedback p + p { margin-top: 4px; }

.practice-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.reading-viewer {
  --reading-scale: 1;
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.reading-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.reading-viewer-control-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
}

.reading-viewer-control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-strong);
  cursor: pointer;
}

.reading-viewer-zoom-value {
  min-width: 56px;
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-strong);
}

.reading-viewer-viewport {
  position: relative;
  overflow: hidden;
  transition: min-height 0.2s ease;
}

.reading-viewer-content {
  width: calc(100% / var(--reading-scale));
  transform: scale(var(--reading-scale));
  transform-origin: top left;
  transition: transform 0.2s ease;
}

html[data-theme="dark"] .reading-viewer-control-group {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(51, 65, 85, 0.92);
  color: #f8fafc;
}

html[data-theme="dark"] .reading-viewer-control-button {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

html[data-theme="dark"] .reading-viewer-zoom-value {
  color: #f8fafc;
}

html[data-theme="dark"] .activity-sheet,
html[data-theme="dark"] .study-sheet,
html[data-theme="dark"] .revision-sheet,
html[data-theme="dark"] .practice-result-card {
  background: #0f172a;
  border-color: #334155;
  color: #e5eefc;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

html[data-theme="dark"] .activity-header,
html[data-theme="dark"] .revision-header,
html[data-theme="dark"] .study-header,
html[data-theme="dark"] .answer-key {
  border-color: #334155;
}

html[data-theme="dark"] .activity-title,
html[data-theme="dark"] .revision-title,
html[data-theme="dark"] .study-title,
html[data-theme="dark"] .revision-topic-title,
html[data-theme="dark"] .study-section-card h3,
html[data-theme="dark"] .study-concept-item h3,
html[data-theme="dark"] .question-text,
html[data-theme="dark"] .reading-title,
html[data-theme="dark"] .answer-key-title {
  color: #f8fafc;
}

html[data-theme="dark"] .activity-meta,
html[data-theme="dark"] .revision-meta,
html[data-theme="dark"] .study-meta,
html[data-theme="dark"] .practice-result-score,
html[data-theme="dark"] .practice-feedback,
html[data-theme="dark"] .study-concept-item p,
html[data-theme="dark"] .study-review-text {
  color: #cbd5e1;
}

html[data-theme="dark"] .study-rich-text,
html[data-theme="dark"] .practice-result-card,
html[data-theme="dark"] .question-card,
html[data-theme="dark"] .reading-card,
html[data-theme="dark"] .study-introduction-card,
html[data-theme="dark"] .study-section-card,
html[data-theme="dark"] .study-summary-card,
html[data-theme="dark"] .study-concepts-card,
html[data-theme="dark"] .study-review-card,
html[data-theme="dark"] .study-concept-item,
html[data-theme="dark"] .revision-empty-card,
html[data-theme="dark"] .revision-topic-card,
html[data-theme="dark"] .revision-callout,
html[data-theme="dark"] .revision-question-card,
html[data-theme="dark"] .practice-option {
  color: #e5eefc;
}

html[data-theme="dark"] .reading-card,
html[data-theme="dark"] .question-card,
html[data-theme="dark"] .study-section-card,
html[data-theme="dark"] .study-concepts-card,
html[data-theme="dark"] .study-concept-item,
html[data-theme="dark"] .revision-empty-card,
html[data-theme="dark"] .revision-topic-card,
html[data-theme="dark"] .revision-question-card,
html[data-theme="dark"] .practice-option,
html[data-theme="dark"] .question-matching-column {
  background: #111c31;
  border-color: #334155;
}

html[data-theme="dark"] .study-introduction-card,
html[data-theme="dark"] .study-summary-card {
  background: #0b2a23;
  border-color: #14532d;
}

html[data-theme="dark"] .study-review-card,
html[data-theme="dark"] .revision-why-card,
html[data-theme="dark"] .revision-example-card {
  background: #10233f;
  border-color: #1d4ed8;
}

html[data-theme="dark"] .study-key-points,
html[data-theme="dark"] .revision-key-points-card,
html[data-theme="dark"] .revision-summary-card {
  background: #0b2a23;
  border-color: #059669;
}

html[data-theme="dark"] .study-example-card,
html[data-theme="dark"] .revision-mistakes-card {
  background: #31210c;
  border-color: #b45309;
}

html[data-theme="dark"] .study-block-label,
html[data-theme="dark"] .eyebrow {
  color: #60a5fa;
}

html[data-theme="dark"] .study-section-index,
html[data-theme="dark"] .revision-topic-index {
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
}

html[data-theme="dark"] .study-bullet-list li::before,
html[data-theme="dark"] .study-review-bullet {
  background: #60a5fa;
}

html[data-theme="dark"] .answer-line,
html[data-theme="dark"] .revision-answer-lines span {
  border-color: #475569;
}

@media (min-width: 861px) {
  .module-output-with-viewer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 18px;
    row-gap: 18px;
  }

  .module-output-with-viewer > h2 {
    grid-column: 1 / -1;
  }

  .module-output-with-viewer > .result-actions {
    grid-column: 1;
    grid-row: 2;
    margin-bottom: 0;
  }

  .module-output-with-viewer > .reading-viewer {
    display: contents;
  }

  .module-output-with-viewer > .reading-viewer > .reading-viewer-toolbar {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    margin-top: 0;
  }

  .module-output-with-viewer > .reading-viewer > .reading-viewer-viewport {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

/* Study sheet content */
.study-introduction-card,
.study-section-card,
.study-summary-card,
.study-concepts-card,
.study-review-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.study-introduction-card { margin-bottom: 18px; background: var(--success-bg); border-color: var(--success-border); }
.study-summary-card { background: var(--success-bg); border-color: var(--success-border); }
.study-concepts-card { background: var(--surface-soft); margin-bottom: 18px; }
.study-review-card { background: var(--accent-cyan-soft); border-color: #bae6fd; margin-bottom: 18px; }

.study-introduction-card h3,
.study-section-card h3 { margin: 0 0 10px; font-size: 1.1rem; }

.study-rich-text { font-size: 1rem; line-height: 1.8; }
.study-rich-text p { margin: 0 0 12px; }
.study-rich-text p:last-child { margin-bottom: 0; }

.study-block-label {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.study-sections { display: grid; gap: 16px; margin-bottom: 18px; }

.study-section-heading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.study-section-card h3 { margin-bottom: 0; font-size: 1.2rem; }

.study-section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.study-callout { margin-top: 16px; padding: 16px 18px; border-radius: var(--radius); }
.study-key-points { background: #ecfdf5; border: 1px solid #bbf7d0; }
.study-example-card { background: #fffbeb; border: 1px solid #fde68a; }

.study-bullet-list, .study-review-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.study-bullet-list li {
  position: relative;
  padding-left: 18px;
  line-height: 1.7;
}

.study-bullet-list li::before {
  content: "";
  position: absolute;
  top: 0.65em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  transform: translateY(-50%);
}

.study-concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.study-concept-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.study-concept-item h3 { margin: 0 0 6px; font-size: 1rem; }

.study-review-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1.7;
}

.study-review-bullet {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.6em;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.study-review-text { flex: 1; min-width: 0; }

.study-transform-card {
  margin-top: 20px;
  padding: 24px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 48%, #eefcf6 100%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.study-transform-card h3 {
  margin: 0 0 10px;
  font-size: 1.35rem;
  color: var(--ink-strong);
}

.study-transform-card p:last-of-type {
  margin-bottom: 0;
}

.study-transform-button {
  margin-top: 18px;
  min-height: 56px;
  padding-inline: 22px;
}

/* Revision sheet */
.revision-empty-card,
.revision-topic-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.revision-topics { display: grid; gap: 16px; }

.revision-topic-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.revision-topic-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.revision-topic-title { margin: 0; font-size: 1.2rem; line-height: 1.3; }

.revision-block { color: var(--text); }

.revision-block + .revision-callout,
.revision-callout + .revision-callout,
.revision-callout + .revision-questions { margin-top: 16px; }

.revision-callout { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); }
.revision-why-card { background: var(--accent-cyan-soft); border-color: #bae6fd; }
.revision-key-points-card { background: #ecfdf5; border-color: #bbf7d0; }
.revision-example-card { background: #fffbeb; border-color: #fde68a; }
.revision-mistakes-card { background: var(--danger-bg); border-color: var(--danger-border); }
.revision-summary-card { background: var(--accent-violet-soft); border-color: #ddd6fe; }

.revision-questions { margin-top: 16px; }

.revision-question-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.revision-question-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.revision-question-text { margin: 0 0 10px; font-weight: 700; line-height: 1.6; }

.revision-options-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.revision-options-list li { display: flex; gap: 8px; line-height: 1.7; }

.revision-question-card-online.is-correct { border-color: var(--success-border); background: var(--success-bg); }
.revision-question-card-online.is-incorrect { border-color: var(--danger-border); background: var(--danger-bg); }

.revision-options-interactive { display: grid; gap: 8px; }
.revision-question-matching-board { margin-bottom: 14px; }
.revision-question-matching-column { background: var(--surface); }

.revision-true-false-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.revision-true-false-list li { display: flex; gap: 8px; line-height: 1.7; }
.revision-true-false-marker { min-width: 26px; font-weight: 700; }

.revision-answer-lines { display: grid; gap: 10px; margin-top: 10px; }
.revision-answer-lines span {
  display: block;
  height: 18px;
  border-bottom: 1px solid var(--border-strong);
}

.revision-result-summary { margin-bottom: 18px; }
.revision-result-card { width: 100%; }

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.records-stack {
  display: grid;
  gap: 18px;
}

.record-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.record-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.record-card-header h2 {
  margin: 6px 0 0;
  font-size: 1.1rem;
}

.record-card-title-link {
  color: inherit;
  text-decoration: none;
}

.record-card-title-link:hover {
  text-decoration: underline;
}

.record-meta,
.record-snippet {
  margin: 14px 0 0;
  color: var(--text-muted);
}

.record-snippet {
  color: var(--text);
  line-height: 1.6;
}

.record-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.12);
  color: #0f766e;
}

.record-pill.is-success {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

.record-pill.is-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #991b1b;
}

.record-pill.is-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}

.generation-status-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.generation-status-header,
.generation-result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.generation-status-message {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
}

.generation-status-loading {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 24px;
}

.generation-status-loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  animation: generation-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.generation-status-loading-text {
  display: inline-flex;
  align-items: baseline;
  font-weight: 600;
  color: var(--text);
}

.generation-status-loading-dots {
  display: inline-block;
  width: 18px;
  color: var(--text-muted);
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .app-main { padding: 28px 32px 48px; }
  .dashboard-grid { gap: 18px; }
  .dashboard-quick-links { gap: 16px; }

  .marketing-hero-grid,
  .credits-grid,
  .marketing-cta-card {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .pricing-card {
    grid-template-columns: 1fr;
    padding: 34px 30px;
  }

  .credits-recharge-card {
    padding: 22px 20px;
    gap: 16px;
  }

  .credits-summary-card,
  .credits-recharge-header {
    grid-template-columns: 1fr;
  }

  .pricing-card-details {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid rgba(226, 232, 244, 0.98);
    padding-top: 26px;
  }

  .pricing-card-visual {
    width: 100%;
    justify-content: flex-end;
  }

  .marketing-modules-grid-expanded {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .marketing-steps-flow::before {
    display: none;
  }

  .marketing-nav,
  .marketing-actions {
    flex-wrap: wrap;
  }

  .marketing-steps,
  .marketing-modules-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }

  .app-topbar { display: flex; }

  .global-theme-toggle {
    right: 68px;
    min-height: 40px;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: auto;
    width: min(282px, calc(100vw - 28px));
    max-width: 88vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-pop);
  }

  .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }

  .sidebar-collapse-btn { display: none; }

  .sidebar-mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--text);
    cursor: pointer;
    margin-left: auto;
  }

  .sidebar-brand { padding-right: 0; }

  .app-sidebar-panel {
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }

  .app-main {
    padding: 20px 18px 40px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dashboard-quick-links,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card {
    padding: 20px 20px 20px 24px;
    gap: 14px;
  }

  .dashboard-card-icon { width: 44px; height: 44px; }
  .dashboard-card-icon svg { width: 22px; height: 22px; }

  .module-form-card,
  .module-output-card,
  .activity-sheet,
  .study-sheet,
  .revision-sheet,
  .practice-activity-sheet,
  .practice-result-card { padding: 18px; }

  .form-row-2,
  .form-row-3,
  .form-row-4 { grid-template-columns: 1fr; }

  .practice-question-header { flex-direction: column; }
  .question-matching-board,
  .practice-matching-board { grid-template-columns: 1fr; }

  .marketing-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .marketing-nav {
    display: none;
  }

  .marketing-header-side {
    margin-left: auto;
  }

  .marketing-mobile-menu {
    display: block;
  }

  .marketing-copy h1 {
    max-width: none;
  }

  .marketing-actions-large,
  .credit-warning-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .marketing-actions {
    width: auto;
  }

  .marketing-actions .auth-button-form,
  .marketing-actions .secondary-button {
    width: auto;
  }

  .marketing-actions-large,
  .marketing-actions-large .auth-button-form,
  .marketing-actions-large .primary-button {
    width: 100%;
  }

  .marketing-browser-body {
    grid-template-columns: 1fr;
  }

  .marketing-browser-sidebar {
    flex-direction: row;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid rgba(226, 232, 244, 0.9);
  }

  .marketing-browser-nav-item.is-bottom {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .app-main {
    padding: 14px 10px 32px;
  }

  .reading-viewer {
    gap: 14px;
  }

  .reading-viewer-toolbar {
    justify-content: stretch;
  }

  .reading-viewer-control-group {
    width: 100%;
  }

  .marketing-section {
    padding: 40px 0 48px;
  }

  .marketing-container {
    width: min(1120px, calc(100% - 20px));
  }

  .marketing-header-inner {
    gap: 14px;
    padding: 18px 0 16px;
  }

  .marketing-brand-logo {
    height: 34px;
  }

  .marketing-header-side {
    gap: 8px;
  }

  .marketing-actions {
    gap: 8px;
  }

  .marketing-actions .secondary-button {
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.92rem;
    white-space: nowrap;
  }

  .marketing-actions .google-button-icon {
    width: 16px;
    height: 16px;
  }

  .marketing-mobile-menu-toggle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .marketing-hero {
    padding: 28px 0 30px;
  }

  .marketing-copy h1 {
    margin-top: 0;
    font-size: clamp(1.95rem, 7.8vw, 2.55rem);
    line-height: 1.04;
  }

  .marketing-lead {
    margin-top: 18px;
    font-size: 1.08rem;
    line-height: 1.62;
  }

  .marketing-hero-actions {
    margin-top: 22px;
    align-items: stretch;
  }

  .marketing-hero-actions .auth-button-form,
  .marketing-hero-actions .primary-button {
    width: 100%;
  }

  .marketing-hero-actions .primary-button {
    min-height: 54px;
    min-width: 0;
    border-radius: 16px;
    font-size: 1rem;
  }

  .pricing-card {
    padding: 22px 20px;
    gap: 20px;
    border-radius: 24px;
  }

  .credits-recharge-card {
    padding: 18px 14px;
    gap: 12px;
  }

  .credits-summary-card,
  .credits-recharge-header,
  .credits-assurance-card,
  .credits-assurance-item {
    grid-template-columns: 1fr;
  }

  .credits-summary-card {
    align-items: start;
    min-height: auto;
    gap: 0;
  }

  .credits-summary-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .credits-summary-head {
    gap: 10px;
    margin-bottom: 10px;
  }

  .credits-buy-button {
    width: 100%;
    justify-self: stretch;
  }

  .credits-status-card,
  .credits-pix-card,
  .credits-unavailable-card,
  .credits-payment-brick {
    padding: 12px;
  }

  .credits-checkout-shell {
    gap: 12px;
  }

  .credits-payment-brick {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pricing-card-copy-main {
    align-items: center;
    gap: 16px;
  }

  .pricing-card-icon {
    width: 80px;
    height: 80px;
  }

  .pricing-card-icon svg {
    width: 34px;
    height: 34px;
  }

  .pricing-card-copy-block {
    gap: 2px;
  }

  .pricing-plan {
    margin-bottom: 4px;
    font-size: 0.78rem;
  }

  .credits-balance-card strong {
    font-size: 1.85rem;
  }

  .credits-pack-copy h2 {
    font-size: 1.45rem;
  }

  .credits-orders-card {
    padding: 18px;
  }

  .credit-history-item {
    padding: 16px 14px;
    flex-direction: column;
    align-items: stretch;
  }

  .credit-history-item-main {
    gap: 12px;
  }

  .credit-history-item-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .credits-assurance-card {
    margin-top: 16px;
  }

  .credits-assurance-item {
    padding: 18px 16px;
  }

  .credits-assurance-item + .credits-assurance-item {
    border-left: 0;
    border-top: 1px solid rgba(226, 232, 244, 0.95);
  }

  html[data-theme="dark"] .credits-assurance-item + .credits-assurance-item {
    border-top-color: #334155;
  }

  .pricing-value {
    margin: 4px 0 6px;
    font-size: 2.15rem;
  }

  .pricing-subvalue {
    font-size: 0.96rem;
  }

  .pricing-card-details {
    gap: 18px;
    padding-top: 20px;
  }

  .pricing-credit-banner {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
  }

  .pricing-credit-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .pricing-feature-item {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .pricing-feature-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .pricing-feature-item strong {
    font-size: 0.98rem;
  }

  .pricing-feature-item p {
    font-size: 0.96rem;
  }

  .pricing-card-actions {
    gap: 10px;
    padding-top: 2px;
  }

  .pricing-card-actions .primary-button {
    min-height: 52px;
    padding-inline: 18px;
    font-size: 0.98rem;
  }

  .pricing-card-actions p {
    font-size: 0.92rem;
    text-align: center;
    width: 100%;
  }

  .pricing-card-actions .auth-button-form,
  .pricing-card-actions .primary-button {
    max-width: none;
  }

  .pricing-card-visual {
    display: none;
  }

  .marketing-trust-row {
    margin-top: 20px;
    gap: 10px;
    font-size: 0.92rem;
    line-height: 1.5;
  }

  .marketing-trust-row span {
    gap: 10px;
  }

  .marketing-trust-row span:not(:last-child)::after {
    margin-left: 0;
  }

  .marketing-footer {
    padding: 22px 0 30px;
  }

  .marketing-footer p {
    font-size: 0.92rem;
  }
}

@media (max-width: 480px) {
  .app-main { padding: 12px 8px 28px; }

  .credits-recharge-card {
    padding: 16px 12px;
    border-radius: 20px;
  }

  .credits-status-card,
  .credits-pix-card,
  .credits-unavailable-card {
    padding: 10px;
  }

  .module-header h1, .dashboard-header h1 { font-size: 1.5rem; }

  .dashboard-card { grid-template-columns: auto 1fr; }
  .dashboard-card-arrow { display: none; }

  .mixed-fields-grid { grid-template-columns: 1fr; }

  .topbar-credits {
    display: none;
  }
}

/* Print niceties for any non-PDF print attempts */
@media print {
  .app-sidebar, .app-topbar, .global-theme-toggle, .module-header, .module-form-card,
  .module-divider, .result-actions { display: none !important; }
  .app-main { padding: 0 !important; }
  body { background: #fff; }
}
