/* ═══════════════════════════════════════════════════════════════════════════
   IELTS PREP — Professional Design System (Light Theme Only)
   Font: Plus Jakarta Sans  |  Palette: Slate, Steel Blue, Crimson
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────────────────── */

:root {
  --bg-base:        #f8fafc;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-elevated:    #f1f5f9;
  --bg-input:       #ffffff;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-glow:    rgba(37,99,235,0.15);
  --accent-soft:    rgba(37,99,235,0.08);
  --accent-2:       #0ea5e9;
  --accent-2-soft:  rgba(14,165,233,0.08);

  --success:        #059669;
  --success-bg:     rgba(5,150,105,0.08);
  --danger:         #dc2626;
  --danger-bg:      rgba(220,38,38,0.08);
  --warning:        #d97706;
  --warning-bg:     rgba(217,119,6,0.08);
  --purple:         #7c3aed;
  --purple-bg:      rgba(124,58,237,0.08);

  --listening-color: #0284c7;
  --reading-color:   #059669;
  --writing-color:   #d97706;
  --speaking-color:  #7c3aed;

  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  8px;
  --radius-xl:  12px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.02);
  --shadow-glow: 0 0 16px rgba(37,99,235,0.08);

  --transition: all 0.15s ease;
  --transition-slow: all 0.25s ease;
}

/* ─── Dark Theme Overrides ────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-base:        #090d16;
  --bg-surface:     #111827;
  --bg-card:        #1f2937;
  --bg-elevated:    #374151;
  --bg-input:       #111827;
  --border:         #1f2937;
  --border-strong:  #374151;

  --text-primary:   #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted:     #6b7280;
  --text-inverse:   #090d16;

  --accent:         #3b82f6;
  --accent-hover:   #60a5fa;
  --accent-glow:    rgba(59,130,246,0.25);
  --accent-soft:    rgba(59,130,246,0.15);
  --accent-2:       #38bdf8;
  --accent-2-soft:  rgba(56,189,248,0.15);

  --success:        #10b981;
  --success-bg:     rgba(16,185,129,0.15);
  --danger:         #f43f5e;
  --danger-bg:      rgba(244,63,94,0.15);
  --warning:        #fbbf24;
  --warning-bg:     rgba(251,191,36,0.15);
  --purple:         #8b5cf6;
  --purple-bg:      rgba(139,92,246,0.15);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.25);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 16px rgba(59,130,246,0.15);
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23d1d5db' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ─── Reset & Base ──────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14.5px;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Layout ────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: 210px;
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.logo-sub {
  font-size: 9.5px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

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

.nav-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 6px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-item .nav-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2px;
}

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }

/* ─── Main Content ──────────────────────────────────────────────────────── */
.main-content { margin-left: 210px; flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ─── Top Bar ───────────────────────────────────────────────────────────── */
.topbar {
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 8px; }

.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border-strong); margin: 0 2px; }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

/* ─── Page Content ──────────────────────────────────────────────────────── */
.page-content { flex: 1; padding: 20px; max-width: 1200px; width: 100%; }

/* ─── Page Header ───────────────────────────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-title { font-size: 23px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.card:hover { border-color: var(--border-strong); }

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-color, var(--accent));
}

.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-icon { font-size: 18px; margin-bottom: 2px; color: var(--text-secondary); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.1; letter-spacing: -0.03em; }
.stat-label { font-size: 10.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ─── Grid Layouts ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.15); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-cyan { background: var(--accent-2); color: #fff; }
.btn-cyan:hover { background: #0284c7; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-icon { padding: 6px; border-radius: var(--radius-md); }

/* ─── Delete Row Button ──────────────────────────────────────────────────── */
.btn-del-row {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  font-family: inherit;
  flex-shrink: 0;
}
.btn-del-row:hover { background: var(--danger-bg); color: var(--danger); }

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-blue    { background: var(--accent-soft); color: var(--accent); border-color: rgba(37,99,235,0.12); }
.badge-green   { background: var(--success-bg); color: var(--success); border-color: rgba(5,150,105,0.12); }
.badge-red     { background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,0.12); }
.badge-yellow  { background: var(--warning-bg); color: var(--warning); border-color: rgba(217,119,6,0.12); }
.badge-purple  { background: var(--purple-bg); color: var(--purple); border-color: rgba(124,58,237,0.12); }
.badge-cyan    { background: var(--accent-2-soft); color: var(--accent-2); border-color: rgba(14,165,233,0.12); }

.badge-listening { background: rgba(2,132,199,0.06); color: var(--listening-color); border-color: rgba(2,132,199,0.12); }
.badge-reading   { background: rgba(5,150,105,0.06); color: var(--reading-color); border-color: rgba(5,150,105,0.12); }
.badge-writing   { background: rgba(217,119,6,0.06); color: var(--writing-color); border-color: rgba(217,119,6,0.12); }
.badge-speaking  { background: rgba(124,58,237,0.06); color: var(--speaking-color); border-color: rgba(124,58,237,0.12); }

/* ─── Forms ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 10px;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23475569' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  appearance: none;
  -webkit-appearance: none;
}

/* ─── Tabs ──────────────────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 16px;
}
.tabs-bar.single-section-tabs { justify-content: flex-start; }
.tabs-bar.single-section-tabs .tab-btn { flex: 0 1 190px; }
.session-out-of-scope { display: none !important; }

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.tab-btn:hover { color: var(--text-primary); background: var(--bg-surface); }
.tab-btn.active[data-section="Listening"] { background: var(--bg-surface); color: var(--listening-color); box-shadow: var(--shadow-sm); border-bottom: 2px solid var(--listening-color); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.tab-btn.active[data-section="Reading"]   { background: var(--bg-surface); color: var(--reading-color); box-shadow: var(--shadow-sm); border-bottom: 2px solid var(--reading-color); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.tab-btn.active[data-section="Writing"]   { background: var(--bg-surface); color: var(--writing-color); box-shadow: var(--shadow-sm); border-bottom: 2px solid var(--writing-color); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.tab-btn.active[data-section="Speaking"]  { background: var(--bg-surface); color: var(--speaking-color); box-shadow: var(--shadow-sm); border-bottom: 2px solid var(--speaking-color); border-radius: var(--radius-md) var(--radius-md) 0 0; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Part Settings Row ─────────────────────────────────────────────────── */
.part-settings {
  display: flex;
  gap: 10px;
  padding: 10px 0 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.part-settings .form-group { margin-bottom: 0; }
.part-settings .form-group:first-child { flex: 2; min-width: 160px; }
.part-settings .form-group:not(:first-child) { min-width: 80px; flex: 1; }

/* ─── Question Table ────────────────────────────────────────────────────── */
.question-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 2px;
}

.question-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 4px 6px;
  text-align: left;
}

.question-table td { padding: 3px; vertical-align: middle; }
.question-table tr.q-row { background: var(--bg-elevated); }
.question-table td:first-child { padding-left: 8px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.question-table td:last-child  { padding-right: 6px;  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.q-num { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); width: 28px; }
.q-answer-input  { font-size: 13.5px; }
.q-note-input    { font-size: 12px; }

.correct-toggle {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  font-family: inherit;
}
.correct-toggle[data-val="1"]  { background: var(--success-bg); border-color: var(--success); color: var(--success); font-weight: 700; }
.correct-toggle[data-val="0"]  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger);  font-weight: 700; }
.correct-toggle[data-val=""]   { color: var(--text-muted); }

/* ─── Part Accordion ────────────────────────────────────────────────────── */
.part-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
}

.part-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  gap: 10px;
}
.part-header:hover { background: var(--bg-elevated); }

.part-header-left { display: flex; align-items: center; gap: 8px; }
.part-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.part-title { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
.part-subtitle { font-size: 12.5px; color: var(--text-secondary); }

.part-chevron { color: var(--text-muted); transition: transform 0.15s ease; font-size: 10px; }
.part-block.open .part-chevron { transform: rotate(180deg); }

.part-body { display: none; padding: 0 14px 14px; border-top: 1px solid var(--border); }
.part-block.open .part-body { display: block; }

/* ─── Timer ─────────────────────────────────────────────────────────────── */
.session-timer {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}
.timer-target { padding-left: 10px; border-left: 1px solid var(--border); display:flex; flex-direction:column; gap:1px; font-size:12px; font-weight:700; }
.timer-target.over-target, .timer-digits.over-target { color: var(--danger) !important; }
.timer-digits.over-target { background: var(--danger-bg); outline: 2px solid var(--danger); border-radius: var(--radius-sm); padding: 2px 6px; }
.timer-alert { animation: timerAlert 1s ease-in-out 3; }
@keyframes timerAlert { 50% { transform: scale(1.08); background: var(--danger-bg); } }
.timer-digits {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.timer-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
.timer-section-info { font-size: 14px; color: var(--text-secondary); font-weight: 600; }
.timer-limit { font-size: 12.5px; color: var(--text-muted); }
.timer-running { color: var(--accent) !important; }

.section-scoreboard { display:flex; align-items:center; gap:12px; margin:0 0 12px; padding:10px 14px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--bg-elevated); color:var(--text-primary); }
.section-scoreboard strong { display:block; font-size:20px; line-height:1.1; }
.section-scoreboard > span { font-size:12px; font-weight:600; color:var(--text-secondary); }
.listening-scoreboard { border-color:rgba(2,132,199,.18); background:rgba(2,132,199,.06); color:var(--listening-color); }
.reading-scoreboard { border-color:rgba(5,150,105,.18); background:var(--success-bg); color:var(--reading-color); }
.writing-scoreboard { border-color:rgba(217,119,6,.18); background:var(--warning-bg); color:var(--writing-color); }
.speaking-scoreboard { border-color:rgba(124,58,237,.18); background:var(--purple-bg); color:var(--speaking-color); }

/* ─── Score Pill ────────────────────────────────────────────────────────── */
.score-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ─── Book Cards ────────────────────────────────────────────────────────── */
.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  display: block;
  box-shadow: var(--shadow-sm);
}

.book-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.book-name { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.book-meta { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

/* ─── Test Card ─────────────────────────────────────────────────────────── */
.test-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.test-card:hover { border-color: var(--border-strong); }
.test-card-left { flex: 1; min-width: 0; }
.test-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.test-meta { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.test-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── Mode Badge ────────────────────────────────────────────────────────── */
.mode-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 600; }

/* ─── Progress Bar ──────────────────────────────────────────────────────── */
.progress-bar-wrap { height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 2px; background: var(--accent); }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 20px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 16.5px; font-weight: 700; color: var(--text-primary); }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ─── Empty State ───────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 20px 12px; color: var(--text-muted); }
.empty-state h3 { font-size: 14px; font-weight: 700; color: var(--text-secondary); margin-bottom: 2px; }
.empty-state p { font-size: 12px; max-width: 280px; margin: 0 auto 8px; }

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 6px; }

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  max-width: 320px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  animation: slideInRight 0.2s ease, fadeOut 0.25s ease 2.3s forwards;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

/* ─── Word Count ─────────────────────────────────────────────────────────── */
.word-count-display { font-size: 10.5px; color: var(--text-muted); text-align: right; margin-top: 3px; font-weight: 600; }
.word-count-display.warn { color: var(--warning); }
.word-count-display.ok   { color: var(--success); }

/* ─── Analytics Table ───────────────────────────────────────────────────── */
.analytics-table { width: 100%; border-collapse: collapse; }
.analytics-table th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.analytics-table td { padding: 8px 10px; font-size: 13.5px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.analytics-table tr:hover td { background: var(--bg-elevated); }

/* ─── Section Save Bar ───────────────────────────────────────────────────── */
.section-save-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.correct-tally { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ─── Writing / Speaking Wrappers ───────────────────────────────────────── */
.writing-task-wrap { background: var(--bg-elevated); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 12px; border: 1px solid var(--border); }
.writing-task-title { font-size: 15px; font-weight: 700; margin-bottom: 3px; color: var(--text-primary); }
.writing-task-hint { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.speaking-part-wrap { background: var(--bg-elevated); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); }
.cue-card-box { background: var(--bg-card); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); padding: 10px; margin-bottom: 10px; }

/* ─── Chart ─────────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; height: 180px; }
.chart-wrap-tall { height: 260px; }

/* ─── Divider ───────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ─── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

.animate-fade-in  { animation: fadeIn 0.2s ease; }

/* ─── Utility ───────────────────────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: 6px; }
.gap-3         { gap: 10px; }
.mt-2          { margin-top: 6px; }
.mt-3          { margin-top: 10px; }
.mb-2          { margin-bottom: 6px; }
.mb-3          { margin-bottom: 10px; }
.mb-4          { margin-bottom: 12px; }
.text-sm       { font-size: 12.5px; }
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.font-bold     { font-weight: 600; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full        { width: 100%; }
.hidden        { display: none !important; }

/* ─── Onboarding Container ──────────────────────────────────────────────── */
.onboarding-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-slow);
}

.onboarding-container:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.onboarding-badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.onboarding-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.onboarding-close-btn {
  background: none;
  border: none;
  font-size: 15px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.onboarding-close-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.onboarding-intro {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
}

.onboarding-steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.onboarding-step-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  position: relative;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.onboarding-step-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.step-number-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.step-icon-wrapper {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon-wrapper svg {
  width: 20px;
  height: 20px;
  display: block;
}

.onboarding-step-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.onboarding-step-card p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.onboarding-step-card p strong {
  color: var(--text-primary);
}

/* ─── App Footer ────────────────────────────────────────────────────────── */
.app-footer {
  margin-top: 32px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.app-footer-text {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .sidebar { width: 50px; }
  .sidebar .logo-text, .sidebar .logo-sub, .sidebar .nav-item span:not(.nav-icon), .sidebar .nav-label { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 8px; }
  .main-content { margin-left: 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .session-timer { top: 4px; flex-wrap: wrap; }
  .timer-target { margin-left: auto; }
  .onboarding-steps-grid { grid-template-columns: 1fr; }
  .onboarding-header { align-items: flex-start; }
  .onboarding-header > div { flex-direction: column; align-items: flex-start !important; gap: 4px !important; }
}
