:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-alt: #f1f5fe;
  --surface-warm: #fffaf0;
  --border: #e1e8f5;
  --text: #1c243b;
  --muted: #5f6c88;
  --primary: #3b5bdb;
  --primary-hover: #2f4bc4;
  --primary-soft: #edf2ff;
  --teal: #0ca678;
  --teal-soft: #e6fcf5;
  --success: #0f9d58;
  --success-soft: #e7f8ef;
  --warning: #d97706;
  --warning-soft: #fff4db;
  --danger: #e03131;
  --danger-soft: #fff0f0;
  --purple: #7048e8;
  --purple-soft: #f3f0ff;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(28, 36, 59, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "PingFang HK", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  background: radial-gradient(circle at top right, #eef3ff 0%, var(--bg) 42%, #f9fbff 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ==========================================================================
   Textbook-Authentic Math Typography (Zero Programming Symbols!)
   ========================================================================== */
.math-expr {
  font-family: "STIX Two Math", "Cambria Math", "Times New Roman", Georgia, serif;
  white-space: nowrap;
}

.math-var {
  font-style: italic;
  font-family: "STIX Two Math", "Cambria Math", "Times New Roman", Georgia, serif;
  padding-right: 1px;
}

.math-fn {
  font-style: normal;
  font-family: "STIX Two Math", "Cambria Math", "Times New Roman", Georgia, serif;
}

.math-op {
  padding: 0 3px;
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
}

.math-sup {
  font-size: 0.72em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
  top: -0.52em;
  margin-left: 1px;
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
}

.math-sub {
  font-size: 0.72em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
  bottom: -0.28em;
  margin-left: 1px;
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
}

/* Stacked Textbook Fraction */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
  line-height: 1.1;
  font-size: 0.88em;
}

.math-frac .math-num {
  padding: 0 4px 2px;
  border-bottom: 1.5px solid currentColor;
  text-align: center;
}

.math-frac .math-den {
  padding: 2px 4px 0;
  text-align: center;
}

/* Textbook Radical with Vinculum (Top Overbar) */
.math-sqrt {
  display: inline-flex;
  align-items: baseline;
  vertical-align: baseline;
  margin: 0 2px;
}

.math-root-idx {
  font-size: 0.65em;
  position: relative;
  top: -0.55em;
  margin-right: -3px;
}

.math-rad {
  font-size: 1.14em;
  line-height: 1;
  margin-right: 0;
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
}

.math-rad-body {
  border-top: 1.5px solid currentColor;
  padding: 1px 3px 0 2px;
  margin-left: -1px;
  line-height: 1.25;
}

/* Limits: lim with subscript stacked underneath */
.math-lim {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
  margin: 0 3px;
}

.math-lim-sub {
  font-size: 0.66em;
  margin-top: 2px;
}

/* Definite Integral & Summation Operators */
.math-bigop {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
}

.math-int-sym {
  font-size: 1.45em;
  line-height: 1;
}

.math-int-limits {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.65em;
  line-height: 1.05;
  margin-left: 1px;
}

.math-int-limits .math-lim-top,
.math-int-limits .math-lim-bot {
  position: static;
  font-size: 1em;
}

.math-sumop {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
  margin: 0 3px;
}

.math-sum-sym {
  font-size: 1.25em;
}

.math-sum-top,
.math-sum-bot {
  font-size: 0.62em;
}

/* ==========================================================================
   Friendly & Playful Studio Layout
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, #4263eb, #0ca678);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(66, 99, 235, 0.25);
}

.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

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

.locale-switcher {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}

.locale-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.14s ease;
}

.locale-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.nav-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 24px 0;
  max-width: 1180px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.nav-tab {
  border: 1.5px solid transparent;
  background: rgba(255, 255, 255, 0.65);
  padding: 9px 16px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: var(--surface);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-tab.active {
  background: var(--surface);
  color: var(--primary);
  border-color: rgba(59, 91, 219, 0.25);
  box-shadow: var(--shadow);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 60px;
}

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

.card + .card {
  margin-top: 16px;
}

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

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
}

.kpi-val {
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: -0.4px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* Quest Progress Strip */
.quest-bar-wrap {
  margin: 12px 0 16px;
}

.quest-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.quest-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4263eb, #0ca678);
  transition: width 0.35s ease;
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface-alt);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-accent {
  background: linear-gradient(135deg, #4263eb, #0ca678);
  color: #fff;
  border: none;
}

.btn-accent:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

label.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(59, 91, 219, 0.22);
  border-color: var(--primary);
}

.form-group {
  margin-bottom: 14px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-gray { background: var(--surface-alt); color: var(--muted); }

/* Auth Landing */
.auth-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 28px;
  align-items: start;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; }
}

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

.hero-panel {
  padding: 24px 26px;
  border-radius: 22px;
  background: linear-gradient(145deg, #2740a8 0%, #3b5bdb 55%, #0ca678 100%);
  color: #fff;
  box-shadow: 0 16px 38px rgba(39, 64, 168, 0.22);
}

.hero-panel h1 {
  margin: 10px 0 8px;
  font-size: 25px;
  line-height: 1.25;
}

.hero-panel p {
  opacity: 0.94;
  font-size: 14.5px;
  margin: 0 0 10px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 7px;
  font-size: 13.5px;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.14);
  padding: 7px 11px;
  border-radius: 11px;
}

/* Practice & Check-up Canvas */
.practice-layout {
  display: grid;
  grid-template-columns: 1.42fr 0.88fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .practice-layout { grid-template-columns: 1fr; }
}

.stem-box {
  background: linear-gradient(180deg, #f8faff 0%, #f1f5fe 100%);
  border: 1.5px solid #dbe4ff;
  border-radius: 16px;
  padding: 20px 22px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.75;
  margin: 14px 0 18px;
}

.options-list {
  display: grid;
  gap: 11px;
}

.option-btn {
  text-align: left;
  padding: 14px 16px;
  border-radius: 13px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  transition: all 0.13s ease;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateX(2px);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(59, 91, 219, 0.16);
}

.option-btn.correct {
  border-color: var(--success);
  background: var(--success-soft);
  animation: popOk 0.35s ease;
}

.option-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

@keyframes popOk {
  0% { transform: scale(0.98); }
  50% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

.option-key {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-alt);
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 14px;
}

.conf-row {
  display: flex;
  gap: 9px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.conf-chip {
  flex: 1;
  min-width: 100px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
}

.conf-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.feedback-banner {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  line-height: 1.7;
}

.feedback-banner.ok {
  background: var(--success-soft);
  border-color: rgba(15, 157, 88, 0.35);
}

.feedback-banner.err {
  background: var(--surface-warm);
  border-color: rgba(217, 119, 6, 0.38);
}

.cheer-banner {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--purple-soft);
  border: 1px solid rgba(112, 72, 232, 0.28);
  font-size: 13.5px;
}

/* Coach Chat Panel */
.tutor-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tutor-messages {
  max-height: 330px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border-radius: 13px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.chat-msg {
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.chat-msg.tutor {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  max-width: 96%;
}

.chat-msg.student {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  max-width: 86%;
}

/* Skill Map Grid */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 13px;
  margin-top: 14px;
}

.concept-tile {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.concept-tile:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.progress-track {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-alt);
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
}

.progress-fill.mastered { background: var(--success); }
.progress-fill.gap { background: var(--danger); }
.progress-fill.needs_review { background: var(--warning); }

/* Topic History Drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: min(540px, 95vw);
  height: 100%;
  background: var(--surface);
  overflow-y: auto;
  padding: 24px;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
}

/* Topbar & Shell Extras */
.topbar-select {
  width: auto !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  font-weight: 600;
}

.loading-shell {
  text-align: center;
  padding: 48px;
}

/* Password Inline Reveal */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrap input {
  padding-right: 64px;
}

.pw-toggle {
  position: absolute;
  right: 8px;
  border: none;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
}

.pw-toggle:hover {
  color: var(--primary);
}

/* Compact Quest HUD Bar (keeps active math question above the fold) */
.quest-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.hud-progress-block {
  flex: 1;
  min-width: 220px;
}

.hud-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.hud-pill.accent {
  background: var(--teal-soft);
  border-color: rgba(12, 166, 120, 0.25);
  color: #087f5b;
}

.hud-pill.primary {
  background: var(--primary-soft);
  border-color: rgba(59, 91, 219, 0.22);
  color: var(--primary);
}

/* Day-0 Welcome Banner */
.day0-banner {
  background: linear-gradient(135deg, #edf2ff 0%, #e6fcf5 100%);
  border: 1.5px solid rgba(59, 91, 219, 0.22);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.day0-banner h3 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--text);
}

.day0-banner p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 620px;
}

/* Collapsible Math Scratchpad */
.scratchpad-panel {
  margin: 12px 0 16px;
  background: #fdfcf7;
  border: 1.5px dashed #cbd5e1;
  border-radius: 13px;
  padding: 12px 14px;
}

.scratchpad-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.symbol-toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.sym-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: "STIX Two Math", "Cambria Math", Georgia, serif;
  font-size: 13.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sym-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.scratchpad-input {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  font-size: 14.5px;
  line-height: 1.55;
  background: #ffffff;
}

/* Dual Feedback & Quick Reminder Chips */
.why-right-box {
  margin-top: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(15, 157, 88, 0.08);
  border-left: 3px solid var(--success);
  font-size: 14px;
}

.note-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.note-chip {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.note-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.note-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.kbd-hint {
  font-size: 11.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Coach Thinking Dots */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  align-self: flex-start;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseDot 1.1s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes pulseDot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Daily Minutes Presets */
.preset-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.preset-chip {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.preset-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

/* Track Picker */
.track-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: var(--surface-alt);
}

.track-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.track-option:hover {
  border-color: rgba(59, 91, 219, 0.45);
}

.track-option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(59, 91, 219, 0.12);
}

.track-option input[type="checkbox"] {
  width: auto;
  margin-top: 3px;
  accent-color: var(--primary);
}

.optional-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface-alt);
  margin-bottom: 16px;
}

.optional-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
}

/* Hero Action Stack */
.hero-actions {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  gap: 10px;
}

.btn-hero-primary {
  background: #ffffff;
  color: #2740a8;
  border: none;
  font-weight: 800;
  width: 100%;
  padding: 12px 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
}

.btn-hero-primary:hover:not(:disabled) {
  background: #f8faff;
  color: #1e3391;
}

.btn-hero-secondary {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  font-weight: 700;
  width: 100%;
  padding: 10px 16px;
}

.btn-hero-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.24);
}

/* Toast Notifications */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, 90vw);
}

.toast {
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  background: #1c243b;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  animation: toastIn 0.2s ease;
}

.toast.ok { background: #0f766e; }
.toast.err { background: #c92a2a; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tables */
table.clean-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.clean-table th,
table.clean-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
}

table.clean-table th {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-alt);
}

.alert-error {
  padding: 10px 14px;
  border-radius: 11px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  margin-bottom: 12px;
}

.muted { color: var(--muted); font-size: 13px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.flex-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }
