/* ── ILMI — Editorial / Warm system ── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: var(--sans);
  font-size: var(--tx-base);
  color: var(--text);
  background: var(--bg);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01','ss02';
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--sans); cursor: pointer; }
input, select, textarea { font-family: var(--sans); }

/* Subtle paper grain */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(rgba(94,86,75,0.03) 1px, transparent 1px),
    radial-gradient(rgba(94,86,75,0.02) 1px, transparent 1px);
  background-size: 32px 32px, 16px 16px;
  background-position: 0 0, 8px 8px;
  opacity: 0.7;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }
* { scrollbar-width: thin; scrollbar-color: var(--bg3) transparent; }

/* Typography */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.015em; color: var(--text); }
h1 { font-weight: 600; }
.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); letter-spacing: 0.02em; }

/* App shell */
.app-shell {
  display: flex;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════
   SIDEBAR — warm cream rail
═══════════════════════════════════════════════ */
.sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  border-right: 1px solid var(--sb-border);
  padding: 18px 0 14px;
  z-index: 40;
}

.sb-logo {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  margin-bottom: 28px; flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s;
}
.sb-logo:hover { background: var(--accent-deep); }
.sb-logo svg { width: 16px; height: 16px; }
.sb-logo-text { display: none; }

.sb-user {
  margin-top: auto;
  padding: 0; flex-shrink: 0;
}
.sb-user-card {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--text); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 14px;
  cursor: pointer; flex-shrink: 0;
}
.sb-user-info, .sb-user-name, .sb-user-sub, .sb-avatar { display: none; }

.sb-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 0; flex-shrink: 0;
}
.sb-nav-item {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  background: transparent; border: none; cursor: pointer;
  transition: all 0.15s;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sb-nav-item span { display: none; }
.sb-nav-item svg { width: 17px; height: 17px; }
.sb-nav-item:hover { color: var(--text); background: rgba(26,23,20,0.04); }
.sb-nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.sb-nav-item.active::before {
  content: ''; position: absolute;
  left: -10px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 18px;
  background: var(--accent);
}

.sb-nav-item::after,
.sb-bottom-link::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--text); color: var(--bg);
  padding: 5px 10px; border-radius: 5px;
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.12s;
  z-index: 100;
}
.sb-nav-item:hover::after,
.sb-bottom-link:hover::after { opacity: 1; }

.sb-section-label, .sb-subjects, #sbExamCard { display: none; }

.sb-bottom {
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 0 0; flex-shrink: 0;
  border-top: 1px solid var(--sb-border);
  margin-top: 14px;
  width: 40px;
}
.sb-bottom-link {
  width: 40px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--dim);
  cursor: pointer; transition: color 0.15s;
  position: relative;
  font-size: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sb-bottom-link svg { width: 14px; height: 14px; }
.sb-bottom-link:hover { color: var(--text); }
.sb-bottom-link.danger:hover { color: var(--accent); }

.sb-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 39;
  background: rgba(26,23,20,0.50);
}

/* ═══════════════════════════════════════════════
   MAIN
═══════════════════════════════════════════════ */
.app-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}
.view { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.view.active { display: flex; }

/* ═══════════════════════════════════════════════
   DASHBOARD — like an editorial front page
═══════════════════════════════════════════════ */
.today-scroll {
  flex: 1; overflow-y: auto;
  padding: 56px 64px 80px;
  max-width: 1100px; margin: 0 auto; width: 100%;
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px; margin-top: 56px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.section-label {
  font-family: var(--serif);
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--text);
}
.section-stats { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* Hero */
.today-hero {
  display: block;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 32px;
}
.hero-left {
  background: transparent; border: none; padding: 0; box-shadow: none;
  display: block;
}
.hero-left::before { display: none; }
.hero-eyebrow {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--dim); margin-bottom: 14px;
}
.hero-greeting {
  font-family: var(--serif);
  font-size: clamp(36px, 4.5vw, 56px); font-weight: 500;
  letter-spacing: -0.025em; line-height: 1.05;
  color: var(--text); margin-bottom: 12px;
}
.hero-greeting::after { content: none; }
.hero-sub {
  font-size: 15px; color: var(--muted); margin-bottom: 0;
  max-width: 580px; line-height: 1.55;
}

.streak-block, .hero-right { display: none; }

/* Stats — minimal numeric row */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 32px 0 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-card {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 22px 24px;
  cursor: default;
  transition: background 0.15s;
  position: relative;
  overflow: visible;
}
.stat-card:last-child { border-right: none; }
.stat-card::before, .stat-card::after { display: none; }
.stat-card:hover { background: var(--surface); transform: none; box-shadow: none; }
.stat-icon { display: none; }
.stat-num {
  font-family: var(--serif);
  font-size: 38px; font-weight: 500;
  color: var(--text);
  line-height: 1; margin-bottom: 10px;
  letter-spacing: -0.02em;
}
.stat-label {
  font-family: var(--mono);
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em;
  margin-bottom: 4px;
}
.stat-caption { font-size: 12px; color: var(--dim); }

/* NBA — call-to-action band */
.nba-card {
  display: flex; align-items: center; gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 28px;
  margin-top: 28px;
  cursor: pointer;
  transition: border-color 0.15s;
  box-shadow: var(--shadow-sm);
}
.nba-card::before { display: none; }
.nba-card:hover { border-color: var(--accent); transform: none; box-shadow: var(--shadow-sm); }
.nba-card.urgent { border-color: var(--accent); }
.nba-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--bg); flex-shrink: 0;
  box-shadow: none;
}
.nba-icon svg { width: 14px; height: 14px; }
.nba-card.urgent .nba-icon { background: var(--accent); color: var(--bg); }
.nba-body { flex: 1; min-width: 0; }
.nba-eyebrow {
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--accent); margin-bottom: 4px; font-weight: 700;
}
.nba-card.urgent .nba-eyebrow { color: var(--accent); }
.nba-title { font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--text); margin-bottom: 4px; line-height: 1.3; letter-spacing: -0.015em; }
.nba-meta { font-size: 13px; color: var(--muted); }
.nba-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--text); color: var(--bg); border: none;
  padding: 10px 18px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  flex-shrink: 0; transition: background 0.15s;
  box-shadow: none;
  font-family: var(--sans);
}
.nba-cta:hover { background: var(--accent); transform: none; box-shadow: none; }
.nba-card.urgent .nba-cta { background: var(--accent); }
.nba-card.urgent .nba-cta:hover { background: var(--accent-deep); }

/* ── Path card (daily study mission) ── */
.path-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 28px;
  margin-top: 28px;
  box-shadow: var(--shadow-sm);
}
.path-card::before { display: none; }
.path-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.path-plan-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.path-time-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
}
.path-day-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.path-day-num {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.path-dot { font-size: 18px; color: var(--dim); }
.path-subject-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--sans);
}
.path-focus-topic {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.path-prog-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.path-prog-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.path-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.path-prog-pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}
.path-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.path-start-btn:hover { background: var(--accent-deep); }

/* Subjects — list, not card-grid (editorial) */
.subject-rings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
}
.rd-card,
.subject-ring-card {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 24px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex; flex-direction: column;
  position: relative;
  box-shadow: none;
}
.rd-card::before, .rd-card::after { display: none; }
.subject-ring-card:hover, .rd-card:hover {
  background: var(--surface);
  transform: none; box-shadow: none;
}
.rd-subject-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  position: relative; z-index: 1;
}
.rd-subject-icon svg { width: 16px; height: 16px; }

.rd-card-top {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin-bottom: 14px; position: relative;
  padding-top: 0;
}
.mini-ring, .rd-ring { width: 40px; height: 40px; flex-shrink: 0; position: relative; }
.mini-ring svg, .rd-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.6s; filter: none; }
.mini-ring-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--text);
}
.mini-ring-num.empty { color: var(--dim); font-size: 9px; }

.rd-days {
  font-size: 10px; font-weight: 700; font-family: var(--mono);
  padding: 3px 9px; border-radius: 100px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.10em;
}
.rd-days.urgent, .rd-days.critical, .rd-days.today { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.rd-days.soon  { color: var(--accent); border-color: var(--accent-border); }
.rd-days.far   { color: var(--muted); }
.rd-days.passed{ color: var(--dim); }

.rd-card-name,
.subject-ring-name {
  font-family: var(--serif);
  font-size: 18px; font-weight: 500; color: var(--text);
  line-height: 1.25; margin-bottom: 12px;
  letter-spacing: -0.015em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rd-verdict {
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); align-self: flex-start;
  font-family: var(--mono);
  background: transparent; border: none; padding: 0;
}
.rd-verdict.tier-safe   { color: var(--green); }
.rd-verdict.tier-ok     { color: var(--accent); }
.rd-verdict.tier-risk   { color: var(--orange); }
.rd-verdict.tier-danger { color: var(--accent); }

.subject-ring-status {
  font-size: 10px; font-weight: 700; padding: 0; background: transparent; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em; font-family: var(--mono);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 0;
  margin-bottom: 60px;
}
.timeline::before { display: none; }
.timeline-item {
  position: relative;
  padding: 18px 0;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 0;
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.timeline-item:hover { background: var(--surface); }
.timeline-dot { display: none; }
.timeline-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.timeline-subject { font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; }
.timeline-date { font-size: 11px; color: var(--dim); font-family: var(--mono); flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.10em; }
.timeline-summary { font-size: 14px; color: var(--muted); line-height: 1.55; max-width: 720px; }
.timeline-empty,
.empty-state {
  padding: 32px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 16px;
}
.empty-state-icon, .timeline-empty .empty-state-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid var(--border);
}
.timeline-empty-text, .empty-state-text { font-size: 14px; color: var(--muted); font-family: var(--serif); }

/* ═══════════════════════════════════════════════
   STUDIO MODE PICKER
═══════════════════════════════════════════════ */
.studio-wrap {
  flex: 1; overflow-y: auto;
  padding: 64px 64px 80px;
  max-width: 1000px; margin: 0 auto; width: 100%;
}
.studio-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  background: none; border: none; cursor: pointer;
  margin-bottom: 32px; transition: color 0.15s;
}
.studio-back:hover { color: var(--text); }
.studio-title {
  font-family: var(--serif);
  text-align: left;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 500;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
  line-height: 1.05;
}
.studio-sub {
  text-align: left;
  font-size: 16px; color: var(--muted);
  margin-bottom: 48px;
  max-width: 580px; line-height: 1.55;
}
.studio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin: 0;
}
.studio-card {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 28px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex; flex-direction: column; gap: 10px;
  text-align: left;
  font-family: var(--sans);
  color: var(--text);
  position: relative; overflow: hidden;
}
.studio-card::before { display: none; }
.studio-card:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: none; box-shadow: none;
}
.studio-card-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--accent);
  margin-bottom: 6px;
}
.studio-card-icon::after { display: none; }
.studio-card-icon svg { width: 17px; height: 17px; }
.studio-card-head { display: flex; flex-direction: column; gap: 2px; }
.studio-card-eyebrow {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--muted);
}
.studio-card-title {
  font-family: var(--serif);
  font-size: 22px; font-weight: 500;
  letter-spacing: -0.02em; color: var(--text);
}
.studio-card-desc {
  font-size: 14px; color: var(--muted); line-height: 1.55;
  flex: 1;
  max-width: 38ch;
}
.studio-card-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  margin-top: 8px;
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.10em;
}

.studio-subj-pick {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 0;
}
.studio-subj-loading {
  font-size: 13px; color: var(--dim);
  width: 100%;
}
.studio-subj-pick-label {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--muted); width: 100%; margin-bottom: 18px;
}
.studio-subj-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: all 0.15s;
  font-family: var(--sans);
  min-height: 44px;
}
.studio-subj-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: none; box-shadow: none;
}
.studio-subj-chip-ic {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2);
  color: var(--muted);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.studio-subj-chip-ic svg { width: 11px; height: 11px; }
.studio-subj-chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.studio-subj-chip.active .studio-subj-chip-ic {
  background: var(--bg);
  color: var(--text);
  border-color: var(--bg);
}

/* ═══════════════════════════════════════════════
   CHAT — no left panel by default, full-width centered column
═══════════════════════════════════════════════ */
.chat-view { flex-direction: row !important; position: relative; }

.lesson-panel {
  position: absolute;
  top: 60px; right: 0; bottom: 0;
  width: 320px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 30;
  box-shadow: -4px 0 16px rgba(26,23,20,0.06);
  animation: drawerIn 0.18s cubic-bezier(0.16,1,0.3,1);
}
@keyframes drawerIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.lp-row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.lp-close {
  width: 26px; height: 26px; border-radius: 50%;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.lp-close:hover { color: var(--text); border-color: var(--text); }
.lp-header { padding: 22px 22px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.lp-eyebrow {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--muted); margin-bottom: 6px;
}
.lp-subject { font-family: var(--serif); font-size: 22px; font-weight: 500; color: var(--text); margin-bottom: 18px; line-height: 1.2; letter-spacing: -0.02em; }
.lp-progress-block { display: flex; flex-direction: column; gap: 8px; }
.lp-progress-row { display: flex; align-items: center; justify-content: space-between; }
.lp-progress-label { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; }
.lp-mastery-track { height: 4px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.lp-mastery-fill {
  height: 100%; border-radius: 4px;
  background: var(--accent);
  transition: width 0.5s; min-width: 2px;
}
.lp-mastery-pct { font-family: var(--mono); font-size: 12px; color: var(--text); font-weight: 700; }
.lp-stats {
  display: flex; gap: 14px; margin-top: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.lp-stat-pill { display: inline-flex; align-items: center; gap: 5px; }
.lp-stat-pill .lp-pill-dot { width: 6px; height: 6px; border-radius: 50%; }
.lp-stat-pill.mastered .lp-pill-dot { background: var(--green); }
.lp-stat-pill.weak     .lp-pill-dot { background: var(--accent); }

.lp-topics { flex: 1; overflow-y: auto; padding: 14px 16px 18px; }
.lp-section-title {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--muted); padding: 16px 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.lp-topic-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.lp-topic-row:last-child { border-bottom: none; }
.lp-topic-row:hover { background: var(--bg2); }
.lp-status-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border); flex-shrink: 0;
}
.lp-topic-row.mastered .lp-status-dot { background: var(--green); border-color: var(--green); }
.lp-topic-row.struggling .lp-status-dot { background: var(--accent); border-color: var(--accent); }
.lp-topic-text { font-size: 14px; color: var(--text); line-height: 1.4; }
.lp-topic-row.struggling .lp-topic-text { color: var(--accent); }
.lp-topic-row.mastered .lp-topic-text { color: var(--muted); }

.lp-exam-card {
  margin: 0 16px 16px;
  padding: 18px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-md); flex-shrink: 0;
  text-align: center;
}
.lp-exam-label { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); margin-bottom: 6px; }
.lp-exam-days { font-family: var(--serif); font-size: 42px; font-weight: 500; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.lp-exam-unit { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.10em; }

/* Chat panel */
.chat-panel {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}
.chat-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  height: 60px; flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 18px;
}
.chat-topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.chat-subject-block { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chat-subject-name { font-family: var(--serif); font-size: 18px; font-weight: 500; color: var(--text); line-height: 1.2; letter-spacing: -0.015em; }
.chat-subject-meta { font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.06em; }
.chat-modes {
  display: flex; gap: 0;
  background: transparent; padding: 0;
  border-radius: 0; border: none;
}
.chat-mode-btn {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 8px 14px; border-radius: 0;
  border: none; background: transparent;
  color: var(--muted);
  cursor: pointer; transition: color 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
  text-transform: uppercase; letter-spacing: 0.12em;
  border-bottom: 2px solid transparent;
}
.chat-mode-btn svg { width: 12px; height: 12px; }
.chat-mode-btn:hover { color: var(--text); }
.chat-mode-btn.active {
  background: transparent; color: var(--text);
  border-bottom-color: var(--accent);
  box-shadow: none;
}
.chat-topbar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { border-color: var(--text); color: var(--text); background: transparent; }
.mastery-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 5px 12px; border-radius: 100px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.hamburger-btn {
  display: none;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); align-items: center; justify-content: center;
  cursor: pointer;
}
.mobile-menu-btn {
  display: none;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  margin-bottom: 16px;
}

/* Messages */
.messages {
  flex: 1; overflow-y: auto;
  padding: 36px 32px 24px;
  display: flex; flex-direction: column; gap: 24px;
  max-width: 760px; margin: 0 auto; width: 100%;
}
.welcome { display: none; }

.message-row {
  display: flex; gap: 16px;
  width: 100%;
}
.message-row.user { flex-direction: row-reverse; align-self: flex-end; }
.message-row.ilmi { align-self: flex-start; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 13px; font-weight: 600; flex-shrink: 0;
  margin-top: 2px;
}
.message-row.ilmi .avatar {
  background: var(--accent); color: var(--bg);
  box-shadow: none; border-radius: 8px;
}
.message-row.ilmi .avatar svg { width: 16px; height: 16px; }
.message-row.user .avatar {
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border);
}

.msg-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 600px; }
.message-row.user .msg-wrap { align-items: flex-end; }

.bubble {
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 15px; line-height: 1.65;
  display: inline-block;
  max-width: 100%;
  word-wrap: break-word;
  width: fit-content;
  font-family: var(--sans);
}
.message-row.ilmi .bubble {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 4px 0;
  border-radius: 0;
  box-shadow: none;
  line-height: 1.7;
  font-size: 16px;
}
.message-row.user .bubble {
  background: var(--text);
  color: var(--bg);
  border-radius: 14px 14px 4px 14px;
  box-shadow: none;
}
.message-row.user.compact .bubble { background: var(--bg2); color: var(--text); border: 1px solid var(--border); }

.bubble p { margin: 0 0 12px; }
.bubble p:last-child { margin: 0; }
.bubble strong { font-weight: 700; color: var(--text); }
.bubble em { font-style: italic; }
.bubble code {
  background: var(--bg2);
  padding: 2px 6px; border-radius: 4px;
  font-family: var(--mono); font-size: 13px;
  color: var(--accent);
}
.message-row.user .bubble code { background: rgba(255,255,255,0.15); color: var(--bg); }

.knowledge-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--accent); margin-top: 10px;
  text-transform: uppercase; letter-spacing: 0.14em;
}
.knowledge-tag svg { width: 11px; height: 11px; }

.msg-actions {
  display: flex; gap: 4px; opacity: 0;
  transition: opacity 0.15s;
  margin-top: 4px;
}
.message-row:hover .msg-actions { opacity: 1; }
.action-btn {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  color: var(--dim); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}
.action-btn svg { width: 11px; height: 11px; }
.action-btn:hover { border-color: var(--text); color: var(--text); }
.action-btn.voted-up { color: var(--green); border-color: var(--green); }
.action-btn.voted-down { color: var(--accent); border-color: var(--accent); }

/* Typing */
.typing-row { display: flex; gap: 16px; align-items: flex-start; align-self: flex-start; }
.typing-bubble {
  display: flex; gap: 4px; align-items: center;
  padding: 14px 0;
  background: transparent; border: none;
  border-radius: 0;
  box-shadow: none;
}
.typing-bubble .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite;
}
.typing-bubble .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{opacity:0.3} 40%{opacity:1} }
.stream-cursor { animation: blink 0.7s infinite; color: var(--accent); }

/* Exam banner */
.exam-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 32px;
  background: var(--accent-soft); border-bottom: 1px solid var(--accent-border);
  font-family: var(--mono); font-size: 12px; color: var(--accent); flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.10em; font-weight: 700;
}
.exam-banner.hidden { display: none; }
.exam-banner-close { margin-left: auto; background: none; border: none; color: var(--accent); cursor: pointer; opacity: 0.7; font-size: 14px; }
.exam-banner-close:hover { opacity: 1; }

/* Input */
.input-area {
  padding: 12px 32px 22px;
  flex-shrink: 0;
  max-width: 760px; margin: 0 auto; width: 100%;
}
.input-wrap {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 8px 8px 8px 12px;
  transition: border-color 0.18s;
  box-shadow: none;
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-wrap textarea {
  flex: 1; background: none; border: none; outline: none; resize: none;
  font-size: 15px; color: var(--text); line-height: 1.55;
  max-height: 160px; overflow-y: auto;
  padding: 8px 6px;
  font-family: var(--sans);
}
.input-wrap textarea::placeholder { color: var(--dim); }
.upload-icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all 0.15s;
}
.upload-icon-btn svg { width: 16px; height: 16px; }
.upload-icon-btn:hover { background: var(--bg2); color: var(--text); }
.send-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent);
  border: none; color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: background 0.15s;
  box-shadow: none;
}
.send-btn svg { width: 14px; height: 14px; }
.send-btn:disabled { opacity: 0.40; cursor: not-allowed; background: var(--bg3); color: var(--muted); }
.send-btn:not(:disabled):hover { background: var(--accent-deep); transform: none; box-shadow: none; }

.input-footer {
  text-align: center;
  font-size: 11px; color: var(--dim);
  margin-top: 8px; padding: 0 6px;
}
.dot-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ═══════════════════════════════════════════════
   PRACTICE
═══════════════════════════════════════════════ */
.practice-landing { flex: 1; overflow: hidden; display: flex; }
.practice-scroll {
  flex: 1; overflow-y: auto;
  padding: 56px 64px 80px;
  max-width: 1100px; margin: 0 auto; width: 100%;
}
.practice-page-hero {
  display: grid; grid-template-columns: 1fr auto;
  gap: 32px; align-items: end;
  margin-bottom: 0;
  padding-bottom: 32px; border-bottom: 1px solid var(--border);
}
.practice-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--muted); margin-bottom: 14px; font-weight: 700;
}
.practice-page-title {
  font-family: var(--serif);
  font-size: clamp(36px, 4.5vw, 56px); font-weight: 500;
  letter-spacing: -0.025em; line-height: 1.05;
  color: var(--text); margin-bottom: 12px;
}
.practice-page-sub {
  font-size: 15px; color: var(--muted); max-width: 560px; line-height: 1.6;
}
.practice-stats-bar {
  display: flex; gap: 0;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 0;
  box-shadow: none;
}
.pstat-item { text-align: center; padding: 16px 24px; border-right: 1px solid var(--border); }
.pstat-item:last-child { border-right: none; }
.pstat-val { font-family: var(--serif); font-size: 24px; font-weight: 500; color: var(--text); line-height: 1; }
.pstat-lbl { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; }

.pmode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin-bottom: 0;
}
.pmode-card {
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 28px;
  cursor: pointer; transition: background 0.15s;
  display: flex; flex-direction: column; gap: 12px;
  text-align: left; font-family: var(--sans); color: var(--text);
  position: relative; overflow: hidden;
}
.pmode-card::before { display: none; }
.pmode-card:hover {
  background: var(--surface);
  transform: none; box-shadow: none; border-color: var(--border);
}
.pmode-card.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pmode-card-top { display: flex; align-items: center; justify-content: space-between; }
.pmode-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--accent) !important;
}
.pmode-icon svg { width: 18px; height: 18px; }
.pmode-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 3px 9px; border-radius: 100px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.pmode-badge.live { color: var(--green); border-color: var(--green-border); }
.pmode-title { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.pmode-desc { font-size: 14px; color: var(--muted); line-height: 1.55; flex: 1; }
.pmode-footer {
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  margin-top: 6px;
  display: flex; align-items: center; justify-content: space-between;
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700;
}

.practice-subject-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border); border-left: 1px solid var(--border);
}
.practice-subj-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  cursor: pointer; transition: background 0.15s;
  font-family: var(--sans); color: var(--text); text-align: left;
}
.practice-subj-btn:hover { background: var(--surface); transform: none; box-shadow: none; }
.practice-subj-btn.selected { background: var(--accent-soft); border-color: var(--border); box-shadow: none; }
.psubj-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: none;
  background: var(--bg2) !important;
  border: 1px solid var(--border) !important;
  color: var(--muted) !important;
}
.psubj-icon svg { width: 14px; height: 14px; }
.practice-subj-btn:hover .psubj-icon { transform: none; }
.psubj-info { flex: 1; min-width: 0; }
.psubj-name { font-family: var(--serif); font-size: 15px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; }
.psubj-status { font-size: 12px; color: var(--muted); margin-top: 3px; }
.psubj-pct-pill { font-family: var(--mono); font-size: 11px; font-weight: 700; flex-shrink: 0; color: var(--text) !important; }

/* Practice session */
.practice-session { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.practice-session.active { display: flex; }
.psession-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.psession-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: none; border: none; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700;
}
.psession-back:hover { color: var(--text); }
.psession-meta { display: flex; align-items: center; gap: 16px; }
.psession-subject { font-family: var(--serif); font-size: 16px; font-weight: 500; color: var(--text); }
.psession-progress { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.10em; }
.psession-score { font-family: var(--mono); font-size: 14px; font-weight: 700; }
.score-good { color: var(--green); }
.score-bad { color: var(--accent); }
.score-sep, .score-total { color: var(--dim); margin: 0 4px; }
.psession-body { flex: 1; overflow-y: auto; padding: 56px 32px; display: flex; flex-direction: column; align-items: center; }

.flashcard-wrap { perspective: 1200px; max-width: 600px; width: 100%; }
.flashcard { aspect-ratio: 1.5/1; cursor: pointer; }
.flashcard-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.16,1,0.3,1);
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 36px;
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  box-shadow: var(--shadow-md);
}
.flashcard-back { transform: rotateY(180deg); background: var(--bg2); }
.flashcard-label {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--accent);
}
.flashcard-text { font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.35; letter-spacing: -0.02em; color: var(--text); }
.flashcard-tap-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: auto;
  text-transform: uppercase; letter-spacing: 0.10em;
}
.flash-actions { display: flex; gap: 12px; margin-top: 28px; }
.flash-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 11px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  transition: all 0.15s;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.flash-knew { color: var(--green); border-color: var(--green-border); }
.flash-knew:hover { background: var(--green); color: var(--bg); border-color: var(--green); }
.flash-miss { color: var(--accent); border-color: var(--accent-border); }
.flash-miss:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.flash-next { background: var(--text); color: var(--bg); border-color: var(--text); }
.flash-next:hover { background: var(--accent); border-color: var(--accent); }

.flash-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.flash-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.flash-loading-text { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }

.mcq-wrap { max-width: 700px; width: 100%; display: flex; flex-direction: column; gap: 22px; }
.mcq-progress-bar { height: 2px; background: var(--bg3); border-radius: 0; overflow: hidden; }
.mcq-progress-fill { height: 100%; background: var(--accent); transition: width 0.4s; }
.mcq-question { font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.35; letter-spacing: -0.02em; color: var(--text); }
.mcq-options { display: flex; flex-direction: column; gap: 10px; }
.mcq-option {
  padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 15px; cursor: pointer; transition: all 0.15s;
  text-align: left; color: var(--text);
}
.mcq-option:hover { border-color: var(--text); }
.mcq-option.correct { border-color: var(--green); background: var(--green-light); color: var(--green); }
.mcq-option.wrong { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.mcq-explanation {
  padding: 18px 20px; background: var(--bg2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0; font-size: 14px; line-height: 1.6;
  font-family: var(--serif);
}
.mcq-next-btn {
  align-self: flex-end;
  padding: 11px 22px; border-radius: var(--r-sm);
  background: var(--text); color: var(--bg); border: none;
  font-family: var(--mono); font-size: 11px; font-weight: 700; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.mcq-next-btn:hover { background: var(--accent); }

/* ═══════════════════════════════════════════════
   MATERIALS / CALENDAR / PROFILE
═══════════════════════════════════════════════ */
.mat-scroll, .cal-scroll, .prof-scroll {
  flex: 1; overflow-y: auto;
  padding: 56px 64px 80px;
}
.cal-inner, .prof-inner { max-width: 1000px; margin: 0 auto; }
.mat-scroll { max-width: 1000px; margin: 0 auto; width: 100%; }

.mat-page-header, .cal-page-header {
  margin-bottom: 36px;
  padding-bottom: 32px; border-bottom: 1px solid var(--border);
}
.mat-page-eyebrow, .cal-page-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--muted); margin-bottom: 14px; font-weight: 700;
}
.mat-page-title, .cal-page-title {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 48px); font-weight: 500;
  letter-spacing: -0.025em; line-height: 1.05; margin-bottom: 12px;
}
.mat-page-sub, .cal-page-sub { font-size: 15px; color: var(--muted); max-width: 600px; line-height: 1.55; }

.mat-upload-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 28px; margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}
.mat-drop-zone {
  border: 1px dashed var(--border2); border-radius: var(--r-sm);
  padding: 44px 20px; text-align: center; cursor: pointer;
  transition: all 0.15s; position: relative;
  background: transparent;
}
.mat-drop-zone:hover { border-color: var(--accent); background: var(--accent-soft); }
.mat-drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mat-drop-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--bg2); border: 1px solid var(--border); color: var(--muted); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.mat-drop-title { font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }
.mat-drop-hint { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.10em; }
.mat-browse-btn {
  padding: 9px 20px; border-radius: var(--r-sm);
  background: var(--text); color: var(--bg); border: none;
  font-family: var(--mono); font-size: 11px; font-weight: 700; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.mat-browse-btn:hover { background: var(--accent); }

.mat-upload-preview { display: none; flex-direction: column; gap: 14px; }
.mat-upload-preview[style*="display: flex"], .mat-upload-preview[style*="display:flex"] { display: flex !important; }
.mat-preview-file {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.mat-file-ext {
  width: 38px; height: 38px; border-radius: 6px;
  background: var(--accent); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
}
.mat-file-info { flex: 1; min-width: 0; }
.mat-file-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-file-size { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.mat-remove-btn { width: 28px; height: 28px; border-radius: 50%; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mat-remove-btn:hover { color: var(--accent); border-color: var(--accent); }
.mat-upload-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.mat-upload-field { display: flex; flex-direction: column; gap: 6px; }
.mat-upload-field label { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.mat-upload-field select, .ob-field select, .ob-field input, .auth-field input, .add-sess-field input, .add-sess-field select {
  padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); font-size: 14px;
  font-family: var(--sans);
}
.mat-submit-btn, .upload-submit, .add-sess-submit {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 18px; border-radius: var(--r-sm);
  background: var(--text); color: var(--bg); border: none;
  font-family: var(--mono); font-size: 11px; font-weight: 700; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.12em;
  width: 100%;
}
.mat-submit-btn:hover, .upload-submit:hover, .add-sess-submit:hover { background: var(--accent); }
.mat-upload-result { font-size: 12px; padding: 8px 0; color: var(--muted); }
.mat-info-strip {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 32px; font-family: var(--mono); font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.10em; font-weight: 700;
}

/* Materials list */
.mat-subject-group {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 28px 0;
  margin-bottom: 0;
  box-shadow: none;
}
.mat-subject-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.mat-subject-name { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.015em; color: var(--text); }
.mat-subject-count {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 100px;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.mat-subject-count.has-docs { color: var(--accent); border-color: var(--accent-border); }
.mat-doc-list { display: flex; flex-direction: column; gap: 0; }
.mat-doc-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  transition: none;
}
.mat-doc-row:last-child { border-bottom: none; }
.mat-doc-row:hover { background: var(--surface); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.mat-doc-type {
  width: 36px; height: 44px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  color: var(--bg); flex-shrink: 0;
  background: var(--accent);
}
.mat-doc-type.pdf  { background: var(--accent); }
.mat-doc-type.pptx { background: var(--orange); }
.mat-doc-type.docx { background: var(--accent2); }
.mat-doc-type.other { background: var(--bg3); color: var(--muted); }
.mat-doc-body { flex: 1; min-width: 0; }
.mat-doc-name { font-family: var(--serif); font-size: 15px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.mat-doc-date { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.10em; }
.mat-doc-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 100px;
  text-transform: uppercase; letter-spacing: 0.12em;
  flex-shrink: 0;
  background: transparent; border: 1px solid var(--border);
}
.mat-doc-badge.approved { color: var(--green); border-color: var(--green-border); }
.mat-doc-badge.pending  { color: var(--orange); border-color: rgba(163,97,29,0.22); }
.mat-doc-badge.rejected { color: var(--accent); border-color: var(--accent-border); }
.prof-upload-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.prof-upload-row:last-child { border-bottom: none; }
.prof-upload-body { flex: 1; min-width: 0; }
.prof-upload-name { font-family: var(--serif); font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-upload-subj { font-family: var(--mono); font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }
.prof-upload-note { font-size: 12px; color: var(--accent); margin-top: 4px; line-height: 1.4; }
.mat-empty-subj {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0;
  font-family: var(--serif); font-size: 14px; color: var(--muted);
  background: transparent; border: none;
  border-radius: 0;
}

/* Calendar */
.cal-month-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 28px; margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}
.cal-month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.cal-nav-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cal-nav-btn:hover { color: var(--text); border-color: var(--text); }
.cal-month-title { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.015em; }

.cal-dow-row, .cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}
.cal-dow {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); text-align: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.cal-days-grid { gap: 0; }
.cal-day {
  aspect-ratio: 1;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
  transition: background 0.15s;
  cursor: default;
  min-height: 56px;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:not(.empty):hover { background: var(--bg2); }
.cal-day.empty { background: transparent; }
.cal-day.past { opacity: 0.40; }
.cal-day.today { background: var(--accent); }
.cal-day-num {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--text);
}
.cal-day.today .cal-day-num { color: var(--bg); }
.cal-day-dots { display: flex; gap: 4px; align-items: center; }
.cal-day-dots .cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-dot.exam { background: var(--accent); }
.cal-dot.session { background: var(--green); }
.cal-day.today .cal-dot { background: var(--bg); }
.cal-legend { display: flex; gap: 18px; margin-top: 18px; font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }

.cal-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.cal-col-label { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cal-add-btn { padding: 4px 10px; border-radius: 100px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 0.10em; }
.cal-add-btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

#calExamList, #calSessionList { display: flex; flex-direction: column; gap: 0; }
.cal-exam-item, .cal-session-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-size: 14px;
}
.cal-exam-days, .cal-session-time {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 100px;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.10em;
  flex-shrink: 0;
}
.cal-exam-days.urgent { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Profile */
.prof-hero {
  display: flex; align-items: center; gap: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 32px;
  margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.prof-hero::before { display: none; }
.prof-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--bg);
  box-shadow: none;
}
.prof-hero-info { flex: 1; min-width: 0; }
.prof-hero-name { font-family: var(--serif); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 4px; }
.prof-hero-uni { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.prof-hero-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prof-hero-chips .chip {
  padding: 4px 10px; border-radius: 100px;
  background: transparent; color: var(--muted);
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.prof-card, .prof-plan-card, .prof-danger-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 28px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.prof-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.prof-card-head .prof-card-title { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.prof-card-title { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.prof-edit-btn { font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); background: none; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: var(--r-sm); transition: color 0.15s, background 0.15s; }
.prof-edit-btn:hover { color: var(--accent); background: var(--bg2); }
.prof-field { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.prof-field:last-child { border-bottom: none; }
.prof-field-label { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.10em; font-weight: 700; }
.prof-field-val { font-family: var(--serif); font-size: 15px; font-weight: 500; color: var(--text); }
.prof-plan-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.prof-plan-badge { padding: 4px 10px; border-radius: 100px; font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; }
.prof-plan-badge.free { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.prof-plan-badge.premium { background: var(--accent); color: var(--bg); }
.prof-plan-name { font-family: var(--serif); font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.prof-plan-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.prof-plan-feature { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.prof-plan-feature:not(.active) { color: var(--dim); }
.prof-upgrade-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px; background: var(--bg2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); margin-top: 18px;
}
.prof-upgrade-label { font-family: var(--serif); font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.prof-upgrade-price { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.10em; font-weight: 700; }
.prof-upgrade-btn { padding: 10px 18px; border-radius: var(--r-sm); background: var(--accent); color: var(--bg); border: none; font-family: var(--mono); font-size: 11px; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 0.12em; }
.prof-upgrade-btn:hover { background: var(--accent-deep); }
.prof-danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.prof-danger-label { font-family: var(--serif); font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.prof-danger-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.prof-logout-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: var(--r-sm); background: transparent; border: 1px solid var(--border); color: var(--text); cursor: pointer; font-family: var(--mono); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; }
.prof-logout-btn:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* ═══════════════════════════════════════════════
   AUTH / ONBOARDING / MODALS
═══════════════════════════════════════════════ */
.auth-overlay, .profile-overlay, .upload-overlay, .add-sess-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,23,20,0.50);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
  padding: 24px;
}
.auth-overlay[style*="flex"], .profile-overlay[style*="flex"], .upload-overlay[style*="flex"], .add-sess-overlay[style*="flex"],
.auth-overlay.open, .profile-overlay.open, .upload-overlay.open, .add-sess-overlay.open { display: flex !important; }

.auth-card, .profile-ob-card, .upload-modal, .add-sess-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 40px;
  max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-logo svg { width: 32px; height: 32px; }
.auth-logo-text { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; }
.auth-card h2 { font-family: var(--serif); font-size: 28px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 8px; }
.auth-card p { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.auth-field, .ob-field, .upload-field, .add-sess-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.auth-field label, .ob-field label, .upload-field label, .add-sess-field label {
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
}
.auth-field input:focus, .ob-field input:focus, .add-sess-field input:focus {
  outline: none; border-color: var(--accent);
}
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: none; background: none; color: var(--dim); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pw-toggle:hover { color: var(--text); }
.auth-btn, .btn-continue {
  width: 100%; padding: 13px;
  background: var(--text);
  color: var(--bg); border: none; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background 0.15s;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  text-transform: uppercase; letter-spacing: 0.14em;
}
.auth-btn:hover, .btn-continue:hover { background: var(--accent); transform: none; box-shadow: none; }
.btn-back { display: block; width: 100%; margin-top: 10px; padding: 10px; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.btn-back:hover { color: var(--text); }
.auth-error { font-size: 12px; color: var(--accent); margin-bottom: 12px; }
.auth-switch { font-size: 13px; color: var(--muted); text-align: center; margin-top: 18px; }
.auth-switch a { color: var(--accent); cursor: pointer; font-weight: 600; }

.step-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 24px; }
.step-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bg3); transition: all 0.2s; }
.step-dot.active { background: var(--accent); width: 24px; border-radius: 4px; }
.profile-step { display: none; }
.profile-step.visible { display: block; animation: fadeIn 0.25s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.profile-step h2 { font-family: var(--serif); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 8px; }
.profile-step .subtitle { font-size: 14px; color: var(--muted); margin-bottom: 24px; }

/* ── Welcome Tour ── */
.tour-overlay {
  display: none; position: fixed; inset: 0; z-index: 210;
  background: rgba(26,23,20,0.55); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 24px;
}
.tour-overlay[style*="flex"] { display: flex !important; }
.tour-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 40px 36px;
  max-width: 420px; width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeIn 0.3s;
}
.tour-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  color: var(--accent);
}
.tour-card h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 10px; }
.tour-card p { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 28px; }
.tour-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 24px; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bg3); transition: all 0.2s; }
.tour-dot.active { background: var(--accent); width: 20px; border-radius: 4px; }

.upload-modal-header, .add-sess-header { display: flex; align-items: start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.upload-modal-header h3, .add-sess-header h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: -0.015em; margin-bottom: 4px; }
.upload-modal-header p, .add-sess-header p { font-size: 13px; color: var(--muted); }
.upload-close, .add-sess-close { width: 30px; height: 30px; border-radius: 50%; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.upload-close:hover, .add-sess-close:hover { color: var(--text); border-color: var(--text); }
.upload-drop { border: 1px dashed var(--border2); border-radius: var(--r-sm); padding: 32px; text-align: center; cursor: pointer; transition: all 0.15s; position: relative; margin-bottom: 14px; background: transparent; }
.upload-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.upload-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-drop-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--bg2); border: 1px solid var(--border); color: var(--muted); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.upload-drop-title { font-family: var(--serif); font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.upload-drop-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.10em; }
.upload-preview { display: none; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 12px; }
.upload-preview[style*="display: flex"], .upload-preview[style*="display:flex"] { display: flex !important; }
.upload-ext { width: 36px; height: 36px; border-radius: 6px; background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 700; flex-shrink: 0; }
.upload-filename { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-filesize { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.upload-remove { width: 26px; height: 26px; border-radius: 50%; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.upload-remove:hover { color: var(--accent); }
.upload-meta, .upload-result { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.add-sess-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Welcome legacy hidden */
.welcome-subjects, .hint-chips, .welcome-divider { display: none; }

/* Session summary card */
.sess-summary-card {
  margin: 16px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  animation: sessSummaryIn 0.4s cubic-bezier(0.16,1,0.3,1);
  font-family: var(--serif);
}
@keyframes sessSummaryIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Weak topics list */
.weak-topics-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--border); }
.weak-topic-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  border-radius: 0;
  cursor: pointer; transition: background 0.15s;
}
.weak-topic-row:hover { background: var(--surface); }

/* Responsive */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .studio-grid, .pmode-grid { grid-template-columns: 1fr; }
  .cal-bottom { grid-template-columns: 1fr; }
  .practice-subject-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 720px) {
  .sidebar {
    position: fixed; left: -240px; top: 0; bottom: 0;
    width: 240px; min-width: 240px;
    align-items: flex-start; padding: 18px 0 14px;
    transition: left 0.25s;
  }
  .sidebar.open { left: 0; }
  .sidebar.open .sb-logo { margin-left: 14px; }
  .sidebar.open .sb-nav { width: 100%; padding: 0 8px; }
  .sidebar.open .sb-nav-item {
    width: 100%; height: 46px;
    justify-content: flex-start; padding: 0 14px; gap: 14px;
    border-radius: 8px;
  }
  .sidebar.open .sb-nav-item span { display: block; font-size: 14px; font-weight: 500; color: inherit; }
  .sidebar.open .sb-nav-item::after { display: none; }
  .sidebar.open .sb-nav-item.active::before { left: 0; top: 0; bottom: 0; transform: none; width: 3px; height: 100%; border-radius: 0 2px 2px 0; }
  .sidebar.open .sb-bottom { width: 100%; padding: 14px 8px 0; }
  .sidebar.open .sb-bottom-link {
    width: 100%; height: 40px; border-radius: 8px;
    justify-content: flex-start; padding: 0 14px; gap: 14px;
  }
  .sidebar.open .sb-bottom-link span { display: block; font-size: 13px; font-weight: 500; }
  .sidebar.open .sb-bottom-link::after { display: none; }
  .sidebar.open .sb-user { width: 100%; padding: 0 8px; }
  .sidebar.open .sb-user-card {
    width: 100%; border-radius: 8px; height: 50px;
    justify-content: flex-start; padding: 0 14px; gap: 12px;
  }
  .sidebar.open .sb-avatar { display: flex; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); color: var(--text); align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
  .sidebar.open .sb-user-info { display: flex; flex-direction: column; min-width: 0; }
  .sidebar.open .sb-user-name { display: block; font-size: 14px; font-weight: 600; color: var(--bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar.open .sb-user-sub { display: block; font-size: 11px; color: rgba(239,233,221,0.6); margin-top: 1px; }
  .sb-overlay.visible { display: block; left: 240px; } /* never cover the open sidebar */
  .hamburger-btn { display: flex; }
  .mobile-menu-btn { display: flex; position: sticky; top: 12px; z-index: 10; }
  .lesson-panel { width: 100%; top: 0; }
  .mat-upload-fields { grid-template-columns: 1fr; }
  .today-scroll, .practice-scroll, .mat-scroll, .cal-scroll, .prof-scroll, .studio-wrap { padding: 32px 20px 60px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .messages, .input-area { padding-left: 18px; padding-right: 18px; }
  .practice-page-hero { grid-template-columns: 1fr; }
  .add-sess-row { grid-template-columns: 1fr; }
  .chat-topbar { padding: 0 18px; }
}
@media (max-width: 480px) {
  /* Grids → single column */
  .stats-row { grid-template-columns: 1fr; }
  .practice-subject-grid { grid-template-columns: 1fr; }

  /* Stat number: fluid size */
  .stat-num { font-size: clamp(26px, 7vw, 38px); }

  /* Message bubble max-width */
  .msg-wrap { max-width: 90vw; }

  /* Chat input padding */
  .input-area { padding: 10px 14px 18px; }

  /* Practice mode cards */
  .pmode-card { padding: 18px 16px; }

  /* Flashcard — fluid height so text never overflows into buttons */
  .flashcard { aspect-ratio: unset; height: 52dvh; min-height: 260px; }
  .flashcard-face { padding: 20px; overflow-y: auto; }
  .flashcard-text { font-size: clamp(15px, 4.2vw, 22px); }
  .psession-body { padding: 20px 16px 16px; gap: 16px; }

  /* MCQ padding */
  .mcq-option { padding: 12px 14px; }
  .mcq-question { font-size: 20px; }

  /* Auth / onboarding modal */
  .auth-card, .profile-ob-card, .upload-modal, .add-sess-modal { padding: 24px 20px; }

  /* Touch targets */
  .icon-btn { width: 40px; height: 40px; }

  /* Scroll areas */
  .today-scroll, .practice-scroll, .mat-scroll, .cal-scroll, .prof-scroll, .studio-wrap { padding: 24px 16px 60px; }
}
