/* ==========================================================================
   UP PGT ECONOMICS (CODE 11) - 100% PHONE-RESPONSIVE STYLESHEET
   Pure English Medium | Multi-Step Mobile App Design
   ========================================================================== */

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

:root {
  /* DARK THEME (DEFAULT) */
  --bg-app: #090d16;
  --bg-header: rgba(13, 17, 28, 0.94);
  --bg-card: #111827;
  --bg-card-elevated: #162035;
  --bg-card-hover: #1b263e;
  --bg-input: #151d30;
  --bg-sheet: #111827;
  --bg-subtle: rgba(255, 255, 255, 0.05);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(255, 255, 255, 0.22);
  --border-active: #6366f1;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);

  --success: #10b981;
  --success-light: #34d399;
  --success-glow: rgba(16, 185, 129, 0.3);

  --warning: #f59e0b;
  --warning-light: #fbbf24;

  --info: #0ea5e9;
  --info-light: #38bdf8;

  --danger: #ef4444;
  --danger-light: #f87171;

  --purple: #8b5cf6;
  --purple-light: #a78bfa;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --bg-app: #f4f6fb;
  --bg-header: rgba(255, 255, 255, 0.94);
  --bg-card: #ffffff;
  --bg-card-elevated: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --bg-sheet: #ffffff;
  --bg-subtle: rgba(0, 0, 0, 0.04);

  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-card: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.18);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   RESET & MOBILE-FIRST BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: 
    radial-gradient(circle at 10% 5%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 15%, rgba(16, 185, 129, 0.08) 0%, transparent 45%);
}

.app-shell {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 12px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.brand-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 4px 10px var(--primary-glow);
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-tag-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.code-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--primary-glow);
  color: var(--primary-light);
  letter-spacing: 0.5px;
}

.mode-pill {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.header-right-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hdr-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hdr-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   MAIN BODY & MULTI-STEP APP PAGES
   ========================================================================== */
.app-body {
  flex: 1;
  padding: 12px 12px calc(72px + var(--safe-bottom));
  width: 100%;
}

.app-page {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.app-page.active {
  display: flex;
  animation: pageFade 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ==========================================================================
   PAGE 1: ROADMAP (HOME)
   ========================================================================== */
.roadmap-hero {
  background: linear-gradient(145deg, var(--bg-card-elevated) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

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

.hero-ring-box {
  position: relative;
  width: 74px;
  height: 74px;
  flex-shrink: 0;
}

.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}
[data-theme="light"] .ring-bg {
  stroke: rgba(0, 0, 0, 0.08);
}

.ring-fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

.ring-sub {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.hero-metrics-list {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.metric-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.metric-lbl {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.metric-item.success .metric-num { color: var(--success-light); }
.metric-item.warning .metric-num { color: var(--warning-light); }

/* Milestone Mini Grid (6 items) */
.milestone-mini-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.m-mini-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 2px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.m-mini-icon {
  font-size: 0.85rem;
}

.m-mini-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 1px 0;
}

.m-mini-txt {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Page Section Titles */
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.page-h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.page-p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.step-badge-counter {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  background: var(--primary-glow);
  color: var(--primary-light);
  border-radius: var(--radius-full);
}

/* 8-Step Unit Cards */
.unit-step-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unit-step-card {
  background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-card-elevated) 100%);
  border: 1px solid var(--border-card);
  border-left: 5px solid var(--unit-accent, var(--primary));
  border-radius: var(--radius-lg);
  padding: 13px 15px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s ease, box-shadow 0.15s ease;
}

.unit-step-card:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.unit-step-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 70px;
  height: 70px;
  background: radial-gradient(circle, var(--unit-accent, var(--primary)) 0%, transparent 70%);
  opacity: 0.12;
  pointer-events: none;
}

.step-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.step-left-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-num-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.step-code-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--unit-accent, var(--primary-light));
}

.step-status-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.step-middle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-title-text {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.step-go-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.step-bottom-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-track {
  width: 100%;
  height: 5px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.step-fill {
  height: 100%;
  background: var(--unit-accent, var(--primary));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.step-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   PAGE 2: DEDICATED UNIT VIEW
   ========================================================================== */
.unit-banner {
  background: linear-gradient(145deg, var(--bg-card-elevated) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ub-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 5px 10px;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.ub-step-counter {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--primary-glow);
  color: var(--primary-light);
}

.ub-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ub-code-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ub-code-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary-light);
}

.ub-topics-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.ub-heading {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.ub-bar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.ub-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ub-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ub-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Search Bar */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-ico {
  position: absolute;
  left: 12px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.mobile-search-input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 34px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
}

.mobile-search-input:focus {
  border-color: var(--primary);
}

.topics-list, .notes-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Unit Pagination Footer */
.unit-step-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
}

.step-nav-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.step-nav-btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* ==========================================================================
   TOPIC CARD (PHONE-OPTIMIZED)
   ========================================================================== */
.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.topic-card.status-mastered {
  border-left: 4px solid var(--success);
}
.topic-card.status-in_progress {
  border-left: 4px solid var(--warning);
}
.topic-card.status-notes_done {
  border-left: 4px solid var(--info);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-top-tags {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-badges-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.c-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
}

.c-badge.high-yield {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(239, 68, 68, 0.2) 100%);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.25);
  animation: badgePulse 2.5s infinite ease-in-out;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 6px rgba(245, 158, 11, 0.2); }
  50% { transform: scale(1.04); box-shadow: 0 0 12px rgba(245, 158, 11, 0.45); }
}

.c-badge.pyq-core {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(5, 150, 105, 0.2) 100%);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.c-badge.pct {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

/* Status Select & Star Row */
.card-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-dropdown {
  padding: 4px 6px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  max-width: 140px;
}

.status-dropdown.status-mastered {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-light);
  border-color: rgba(16, 185, 129, 0.35);
}

.status-dropdown.status-in_progress {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning-light);
  border-color: rgba(245, 158, 11, 0.35);
}

.star-rating-row {
  display: flex;
  gap: 2px;
}

.star-item {
  font-size: 0.9rem;
  color: var(--text-dim);
  cursor: pointer;
}

.star-item.filled {
  color: #fbbf24;
}

/* 6 Tactile Milestone Toggle Buttons (Grid 3x2) */
.milestones-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.milestone-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  min-height: 34px;
  transition: all 0.12s ease;
}

.milestone-pill:active {
  transform: scale(0.95);
}

.milestone-pill.checked {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--primary);
  color: var(--primary-light);
}

.milestone-pill.checked.theory {
  background: rgba(14, 165, 233, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
}

.milestone-pill.checked.notes {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--warning-light);
  color: var(--warning-light);
}

.milestone-pill.checked.graphs {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--success-light);
  color: var(--success-light);
}

.milestone-pill.checked.pyq {
  background: rgba(239, 68, 68, 0.18);
  border-color: var(--danger-light);
  color: var(--danger-light);
}

.milestone-pill.checked.rev1 {
  background: rgba(139, 92, 246, 0.18);
  border-color: var(--purple-light);
  color: var(--purple-light);
}

.milestone-pill.checked.rev2 {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--success);
  color: var(--success-light);
}

/* Card Notes Preview */
.card-notes-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  border: 1px solid var(--border-subtle);
}

.note-preview-text {
  flex: 1;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-preview-text.has-notes {
  color: var(--text-main);
  font-weight: 500;
}

.btn-open-notes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-wa-cheer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
  transition: all 0.12s ease;
}

.btn-wa-cheer:active {
  transform: scale(0.94);
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
}

/* In-depth Collapsible Drawer */
.details-drawer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}

.drawer-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 0;
}

.drawer-arrow {
  transition: transform 0.18s ease;
  font-size: 0.72rem;
}

.drawer-trigger.open .drawer-arrow {
  transform: rotate(180deg);
}

.drawer-content {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.drawer-content.open {
  display: flex;
}

.subtopics-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.box-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.subtopics-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtopic-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-main);
  line-height: 1.35;
}

.subtopic-bullet {
  color: var(--primary-light);
  font-size: 0.8rem;
}

.tags-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-economist {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-sm);
  color: var(--purple-light);
  font-size: 0.7rem;
  font-weight: 600;
}

.tag-formula {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--radius-sm);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
}

.exam-tip-box {
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.78rem;
  color: var(--warning-light);
  line-height: 1.4;
}

.tip-header {
  font-weight: 800;
  margin-bottom: 2px;
}

/* ==========================================================================
   FEATURE PAGES (High-Yield, Revision, Notes)
   ========================================================================== */
.section-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sec-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.section-banner.warning .sec-badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning-light);
}
.section-banner.purple .sec-badge {
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple-light);
}
.section-banner.info .sec-badge {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

.sec-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.sec-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.filter-chips-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-chips-row::-webkit-scrollbar { display: none; }

.f-chip {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.f-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Notes Cards */
.note-dir-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-dir-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-dir-unit {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary-light);
}

.note-dir-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.note-dir-body {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--text-main);
  white-space: pre-wrap;
  line-height: 1.45;
}

/* ==========================================================================
   MOBILE BOTTOM TAB BAR
   ========================================================================== */
.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-header);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 2px calc(6px + var(--safe-bottom));
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
  max-width: 600px;
  margin: 0 auto;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
  border-radius: var(--radius-sm);
  transition: color 0.12s ease;
}

.tab-item.active {
  color: var(--primary-light);
}

.tab-ico {
  font-size: 1.15rem;
  line-height: 1;
}

.tab-txt {
  font-size: 0.65rem;
  font-weight: 700;
}

/* ==========================================================================
   SLIDE-UP BOTTOM SHEET (SCRIM & CONTAINER)
   ========================================================================== */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sheet-scrim.active {
  opacity: 1;
  pointer-events: auto;
}

.sheet-container {
  width: 100%;
  max-width: 600px;
  background: var(--bg-sheet);
  border-top: 1px solid var(--border-card);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  padding: 10px 14px calc(20px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet-scrim.active .sheet-container {
  transform: translateY(0);
}

.sheet-grabber {
  width: 40px;
  height: 4px;
  background: var(--border-card);
  border-radius: var(--radius-full);
  margin: 0 auto;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sheet-badge-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary-light);
  text-transform: uppercase;
}

.sheet-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.sheet-x {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: 30px;
  height: 30px;
  font-size: 1.15rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.menu-action-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.menu-action-item.danger {
  color: var(--danger-light);
}

.m-act-icon {
  font-size: 1.3rem;
}

.m-act-text strong {
  display: block;
  font-size: 0.88rem;
}

.m-act-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.confidence-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.conf-title {
  font-size: 0.8rem;
  font-weight: 700;
}

.stars-picker {
  display: flex;
  gap: 3px;
}

.s-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-dim);
  cursor: pointer;
}

.s-btn.active {
  color: #fbbf24;
}

.notes-lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.notes-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.45;
  outline: none;
  resize: vertical;
}

.notes-textarea:focus {
  border-color: var(--primary);
}

.quick-chips-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quick-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.quick-chips-scroll {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick-chips-scroll::-webkit-scrollbar { display: none; }

.q-chip {
  flex-shrink: 0;
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.sheet-foot {
  display: flex;
  gap: 8px;
}

.sheet-btn-cancel {
  flex: 1;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.sheet-btn-save {
  flex: 2;
  padding: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-weight: 800;
.sheet-btn-secondary {
  flex: 1;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.sheet-btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #25D366;
  color: #25D366;
}

/* WhatsApp Form Styles */
.menu-action-item.highlight {
  border-color: rgba(37, 211, 102, 0.35);
  background: rgba(37, 211, 102, 0.08);
}
.menu-action-item.highlight:hover {
  background: rgba(37, 211, 102, 0.14);
  border-color: #25D366;
}

.wa-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wa-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.wa-check-lbl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}
.wa-check-lbl input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #25D366;
  cursor: pointer;
}

.wa-preview-box {
  background: rgba(37, 211, 102, 0.08);
  border: 1px dashed rgba(37, 211, 102, 0.4);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #25D366;
  line-height: 1.4;
}

/* WhatsApp Cheer Button on Topic Cards */
.btn-wa-cheer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(37, 211, 102, 0.12);
  border: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: var(--radius-sm);
  color: #25D366;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}
.btn-wa-cheer:hover {
  background: rgba(37, 211, 102, 0.22);
  border-color: #25D366;
}
.btn-wa-cheer:active {
  transform: scale(0.95);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-area {
  position: fixed;
  bottom: calc(65px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.toast.success {
  border-color: var(--success);
  color: var(--success-light);
}
