:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #64748B;
  --brand: #0F766E;
  --brand-hover: #115E59;
  --brand-soft: #CCFBF1;
  --brand-soft-bg: #F0FDFA;
  --brand-text: #115E59;
  --amber-bg: #FEF3C7;
  --amber-text: #92400E;
  --amber-border: #FDE68A;
  --sky-bg: #E0F2FE;
  --sky-text: #075985;
  --violet-bg: #EDE9FE;
  --violet-text: #5B21B6;
  --rose-bg: #FFE4E6;
  --rose-text: #BE123C;
  --rose-border: #FECDD3;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --header-bg: rgba(255, 255, 255, 0.9);
}

html.dark {
  --bg: #0B1120;
  --surface: #111827;
  --surface-2: #1E293B;
  --border: #1F2937;
  --text: #F1F5F9;
  --text-2: #CBD5E1;
  --text-3: #94A3B8;
  --brand: #14B8A6;
  --brand-hover: #0D9488;
  --brand-soft: rgba(20, 184, 166, 0.18);
  --brand-soft-bg: rgba(15, 118, 110, 0.16);
  --brand-text: #5EEAD4;
  --amber-bg: rgba(245, 158, 11, 0.16);
  --amber-text: #FCD34D;
  --amber-border: rgba(245, 158, 11, 0.35);
  --sky-bg: rgba(14, 165, 233, 0.18);
  --sky-text: #7DD3FC;
  --violet-bg: rgba(139, 92, 246, 0.2);
  --violet-text: #C4B5FD;
  --rose-bg: rgba(244, 63, 94, 0.16);
  --rose-text: #FDA4AF;
  --rose-border: rgba(244, 63, 94, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(17, 24, 39, 0.9);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

.hidden { display: none !important; }
.ico { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.ico-lg { width: 20px; height: 20px; }
.ico-sm { width: 14px; height: 14px; }

/* TOP HEADER */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand-box { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: #0F766E;
  color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.desktop-nav {
  display: none;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 12px;
}
.nav-btn {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-sm); }

.top-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--brand-soft-bg);
  border: 1px solid var(--brand-soft);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-text);
  font-variant-numeric: tabular-nums;
}
.progress-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.badge-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-text);
}

/* MAIN LAYOUT */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 16px calc(86px + env(safe-area-inset-bottom, 0px));
}
.lessons-layout { display: block; }
.sidebar { display: none; }
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* HERO CARD */
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(135deg, #0F172A 0%, #0F172A 55%, #115E59 100%);
  color: #FFFFFF;
  box-shadow: var(--shadow-md);
  border: 1px solid #1E293B;
}
.hero-grid { display: grid; grid-template-columns: 1fr; }
.hero-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.hero-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #99F6E4;
  border: 1px solid rgba(255,255,255,0.14);
}
.hero-pct { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.9); font-variant-numeric: tabular-nums; }
.hero-title { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.25; letter-spacing: -0.02em; }
.hero-desc { margin: 6px 0 0; font-size: 13px; color: #CBD5E1; line-height: 1.5; }
.hero-bar-wrap { display: flex; flex-direction: column; gap: 6px; }
.bar-track { height: 8px; width: 100%; border-radius: 999px; background: rgba(255,255,255,0.16); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: #14B8A6; transition: width 0.3s ease; }
.bar-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: #CBD5E1; font-variant-numeric: tabular-nums; }
.hero-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.btn-hero-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  background: #14B8A6;
  color: #042F2E;
  font-size: 13.5px; font-weight: 700;
  transition: background 0.15s;
}
.btn-hero-primary:hover { background: #2DD4BF; }
.btn-hero-sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.16);
  color: #FFFFFF;
  font-size: 13px; font-weight: 600;
}
.btn-hero-sec:hover { background: rgba(255,255,255,0.18); }
.hero-img-col { display: none; position: relative; min-height: 220px; }
.hero-img-col img { width: 100%; height: 100%; object-fit: cover; opacity: 0.92; }
.hero-img-fade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,23,42,0.75) 0%, transparent 45%); }

/* SEARCH & FILTERS CARD */
.controls-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.search-wrap { position: relative; }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%;
  padding: 11px 38px 11px 38px;
  font-size: 14px;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.clear-search {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.clear-search:hover { color: var(--text); background: var(--surface-2); }

.scroll-row {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scroll-row::-webkit-scrollbar { display: none; }

.mod-pill {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.mod-pill.active { background: #0F766E; color: #FFFFFF; }
.mod-pill-cnt { font-size: 11px; opacity: 0.8; font-variant-numeric: tabular-nums; }

.filter-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.filter-chip.active { background: var(--text); color: var(--surface); }

.results-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; font-size: 13px; color: var(--text-3); font-weight: 500; }
.link-reset { font-size: 12.5px; font-weight: 700; color: var(--brand-text); }
.link-reset:hover { text-decoration: underline; }

/* MODULE & VIDEO CARDS */
.module-group { display: flex; flex-direction: column; gap: 12px; }
.module-head-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.module-head-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px; }
.module-week { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-text); }
.module-title { margin: 2px 0 0; font-size: 18px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.28; }
.module-badge {
  font-size: 12px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.subtopics-toggle {
  margin-top: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px; font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.subtopics-toggle:hover { color: var(--brand-text); border-color: var(--brand); }
.subtopics-list {
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
}
.subtopics-list li { display: flex; gap: 8px; }
.sub-num { color: var(--brand-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.module-note {
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
}

.subgroup-heading {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-text);
  padding: 8px 4px 0;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.video-card:hover { box-shadow: var(--shadow-md); }
.video-card.watched {
  border-color: var(--brand);
  background: var(--brand-soft-bg);
}
.vcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.vcard-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.role-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.role-asosiy { background: var(--brand-soft); color: var(--brand-text); }
.role-qoshimcha { background: var(--sky-bg); color: var(--sky-text); }
.role-amaliy { background: var(--violet-bg); color: var(--violet-text); }
.role-older { background: var(--amber-bg); color: var(--amber-text); }
.mod-mini-tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.watched-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--brand-text); }

.save-btn {
  width: 36px; height: 36px;
  margin: -4px -4px 0 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: background 0.15s, color 0.15s;
}
.save-btn:hover { background: var(--surface-2); color: var(--text); }
.save-btn.saved { background: var(--brand-soft); color: var(--brand-text); }

.vcard-title { margin: 10px 0 0; font-size: 16px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; }
.vcard-title a:hover { color: var(--brand-text); text-decoration: underline; }
.vcard-meta {
  margin-top: 8px;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: 12px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.vcard-meta span { display: inline-flex; align-items: center; gap: 5px; }
.vcard-desc { margin: 10px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.vcard-desc strong { color: var(--text); font-weight: 600; }

.vcard-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-yt {
  flex: 1;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 12px;
  background: #0F766E;
  color: #FFFFFF;
  font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background 0.15s;
}
.btn-yt:hover { background: #115E59; }
.btn-check {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-check:hover { background: var(--surface-2); color: var(--text); }
.btn-check.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-text);
}

/* PLAN, SAVED, SOURCES VIEWS */
.page-wrap { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }
.btn-danger-soft {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 12px;
  font-size: 12.5px; font-weight: 700;
  background: var(--rose-bg); color: var(--rose-text); border: 1px solid var(--rose-border);
}
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.week-card { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.week-bar-track { height: 8px; width: 100%; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.week-bar-fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width 0.3s; }
.btn-soft {
  width: 100%;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-soft:hover { background: var(--brand-soft); color: var(--brand-text); }

.stat-card { padding: 14px; }
.stat-num { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 11.5px; color: var(--text-3); margin-top: 3px; line-height: 1.35; }

.amber-callout {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber-text);
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.55;
}
.amber-callout-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }

.source-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px;
  background: var(--brand-soft-bg);
  border: 1px solid var(--brand-soft);
  color: var(--brand-text);
  font-size: 12.5px; font-weight: 700;
}
.source-link:hover { background: var(--brand-soft); }

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 20px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--surface-2); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}

/* MOBILE BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav-grid {
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.mob-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 12px;
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
}
.mob-btn.active { background: var(--brand-soft-bg); color: var(--brand-text); }
.mob-badge {
  position: absolute; top: 4px; right: 16px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: #0F766E; color: #FFFFFF;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* MODAL & TOAST */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 380px; width: 100%;
  padding: 20px;
  box-shadow: var(--shadow-md);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn-modal-cancel { padding: 9px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.btn-modal-cancel:hover { background: var(--surface-2); }
.btn-modal-confirm { padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 700; background: #E11D48; color: #FFFFFF; }

.toast {
  position: fixed;
  top: 74px; right: 16px;
  z-index: 55;
  background: var(--text);
  color: var(--surface);
  font-size: 12.5px; font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* TABLET & DESKTOP BREAKPOINTS */
@media (min-width: 640px) {
  .topbar-inner { padding: 0 24px; }
  .shell { padding: 22px 24px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .hero-body { padding: 26px; }
  .hero-title { font-size: 24px; }
  .hero-actions { flex-direction: row; align-items: center; }
  .btn-yt { flex: none; }
  .subtopics-list { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .hero-grid { grid-template-columns: 1fr 250px; }
  .hero-img-col { display: block; }
}

@media (min-width: 1024px) {
  .desktop-nav { display: flex; }
  .bottom-nav { display: none; }
  .mobile-pills-wrap { display: none; }
  .shell { padding-bottom: 48px; }
  .lessons-layout {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
  }
  .sidebar {
    display: block;
    position: sticky;
    top: 80px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
  }
  .sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 10px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-3);
  }
  .side-btn {
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    border-radius: 11px;
    margin-bottom: 2px;
    transition: background 0.15s;
  }
  .side-btn:hover { background: var(--surface-2); }
  .side-btn.active { background: var(--brand-soft-bg); color: var(--brand-text); }
  .side-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; }
  .side-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-cnt { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }
  .side-bar { margin-top: 5px; height: 4px; width: 100%; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
  .side-bar-fill { height: 100%; border-radius: 999px; background: var(--brand); }
}

/* Mobile-first refinements */
html { scroll-padding-top: 78px; }
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
.topbar-inner { min-height: 60px; height: auto; padding-inline: 12px; gap: 8px; }
.progress-pill { padding-inline: 9px; }
.shell { padding: 14px 12px calc(92px + env(safe-area-inset-bottom, 0px)); }
.hero-card { border-radius: 18px; }
.hero-body { padding: 18px; }
.hero-title {
  font-size: clamp(21px, 6vw, 25px);
  line-height: 1.22;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero-actions { align-items: stretch; }
.hero-actions > * { min-height: 44px; }
.clear-search { width: 40px; height: 40px; }
.save-btn { width: 40px; height: 40px; }
.subtopics-toggle, .source-link, .btn-modal-cancel, .btn-modal-confirm { min-height: 42px; }
.scroll-row { min-width: 0; max-width: 100%; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
.mod-pill, .filter-chip { scroll-snap-align: start; }
.mod-pill { min-height: 40px; }
.filter-chip { min-height: 38px; }
.module-head-card, .video-card { padding: 15px; }
.vcard-meta span { min-width: 0; overflow-wrap: anywhere; }
.btn-check { min-height: 44px; }
.page-head { flex-direction: column; align-items: stretch; }
.page-head h2 { font-size: clamp(22px, 6vw, 26px); line-height: 1.2; text-wrap: balance; }
.btn-danger-soft { min-height: 44px; }
.grid-3 { grid-template-columns: 1fr; }
.bottom-nav { box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06); }
.mob-btn { min-height: 52px; }
.modal-box { max-height: calc(100dvh - 32px); overflow-y: auto; }

@media (min-width: 640px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-head { flex-direction: row; align-items: flex-end; }
}

@media (max-width: 380px) {
  .brand-sub { display: none; }
  .brand-title { font-size: 13.5px; }
  .brand-box { gap: 8px; }
  .brand-logo { width: 34px; height: 34px; border-radius: 11px; }
  .top-right { gap: 5px; }
  .progress-pill { padding: 5px 7px; font-size: 11px; }
  .icon-btn { width: 38px; height: 38px; }
  .bar-meta { gap: 10px; font-size: 10.5px; }
  .btn-yt, .btn-check { padding-inline: 10px; }
  .mob-badge { right: 8px; }
}

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