/* ════════════════════════════════════════
   CA INTER STUDY PLANNER — MASTER STYLESHEET
   ════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* DARK MODE (default) */
  --bg:        #0b0f1a;
  --bg2:       #111827;
  --bg3:       #1a2235;
  --card:      #151e2d;
  --border:    #1f2d45;
  --accent:    #6366f1;
  --accent2:   #8b5cf6;
  --green:     #10b981;
  --yellow:    #f59e0b;
  --red:       #ef4444;
  --blue:      #3b82f6;
  --text:      #e2e8f0;
  --text-muted: #64748b;
  --sidebar-w: 250px;
  --radius:    14px;
  --shadow:    0 4px 28px rgba(0,0,0,.4);
}

/* ════ LIGHT MODE ════ */
body.light {
  --bg:        #f0f4f8;
  --bg2:       #ffffff;
  --bg3:       #e8eef5;
  --card:      #ffffff;
  --border:    #d1dce8;
  --accent:    #4f46e5;
  --accent2:   #7c3aed;
  --green:     #059669;
  --yellow:    #d97706;
  --red:       #dc2626;
  --blue:      #2563eb;
  --text:      #0f172a;
  --text-muted: #6b7280;
  --shadow:    0 4px 18px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══════════ UTILITY CLASSES ═══════════ */
.hidden { display: none !important; }
.btn {
  padding: 10px 20px;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* ═══════════ SCROLLBAR ═══════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo-icon { font-size: 28px; }
.logo-title { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); }
.logo-sub { font-size: 11px; color: var(--text-muted); }

.nav-links { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.nav-icon { font-size: 18px; }

.sidebar-countdown {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(99,102,241,.3);
}
.countdown-label { font-size: 11px; color: #a5b4fc; text-transform: uppercase; letter-spacing: .05em; }
.countdown-number { font-family: 'Space Grotesk', sans-serif; font-size: 42px; font-weight: 700; color: #c7d2fe; line-height: 1; margin: 4px 0; }
.countdown-sub { font-size: 10px; color: #818cf8; }

/* ═══════════ MAIN CONTENT ═══════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 0 0 40px;
  min-height: 100vh;
}

/* ═══════════ TOPBAR ═══════════ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-btn { background: none; border: 1px solid var(--border); color: var(--text); padding: 6px 10px; border-radius: 8px; font-size: 16px; cursor: pointer; }
.topbar-greeting { font-size: 18px; font-weight: 700; }
.topbar-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.streak-badge {
  background: linear-gradient(135deg, #78350f, #92400e);
  border: 1px solid #b45309;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
}
.live-clock {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .05em;
}

/* ═══════════ TAB SECTIONS ═══════════ */
.tab-section { display: none; padding: 28px 32px; animation: fadeUp .3s ease; }
.tab-section.active { display: block; }

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

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

/* ═══════════ CARDS ═══════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 16px;
}

/* ═══════════ STATS ═══════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid transparent;
}
.s-blue   { background: linear-gradient(135deg,#1e3a5f,#1e40af30); border-color: #1e40af50; }
.s-purple { background: linear-gradient(135deg,#2e1065,#7c3aed30); border-color: #7c3aed50; }
.s-green  { background: linear-gradient(135deg,#064e3b,#10b98130); border-color: #10b98150; }
.s-orange { background: linear-gradient(135deg,#451a03,#f59e0b30); border-color: #f59e0b50; }
.stat-icon { font-size: 28px; }
.stat-value { font-family: 'Space Grotesk',sans-serif; font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ═══════════ TWO-COL ═══════════ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

/* ═══════════ SUBJECT PROGRESS ═══════════ */
.subject-progress-list { display: flex; flex-direction: column; gap: 14px; }
.sp-header { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.sp-name { font-weight: 600; }
.sp-pct { color: var(--accent); font-weight: 700; }
.sp-bar { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.sp-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* ═══════════ EXAM COUNTDOWN BIG ═══════════ */
.exam-countdown-big { text-align: center; padding: 16px 0; }
.ecb-days { font-family: 'Space Grotesk',sans-serif; font-size: 64px; font-weight: 800; background: linear-gradient(135deg,var(--accent),var(--accent2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.ecb-label { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing:.05em; }
.ecb-detail { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.motivation-quote {
  background: var(--bg3);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 8px;
  font-style: italic;
  font-size: 13px;
  color: #94a3b8;
  margin-top: 12px;
}

.today-focus-list { font-size: 13px; color: var(--text-muted); line-height: 1.8; }

/* ═══════════ WEEKLY CHART ═══════════ */
.weekly-chart {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  height: 120px;
  padding-top: 10px;
}
.wc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.wc-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.wc-bar {
  width: 100%;
  background: linear-gradient(to top, var(--accent), var(--accent2));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height .5s ease;
  cursor: pointer;
  position: relative;
}
.wc-bar:hover::after {
  content: attr(data-hours) 'h';
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.wc-day { font-size: 11px; color: var(--text-muted); }
.wc-hrs { font-size: 11px; color: var(--accent); font-weight: 600; }

/* ═══════════ INFO BANNER ═══════════ */
.info-banner {
  background: linear-gradient(135deg, #1e3a5f, #1e40af20);
  border: 1px solid #3b82f640;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  margin-bottom: 24px;
  color: #93c5fd;
}

/* ═══════════ SUBJECTS GRID ═══════════ */
.subjects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }

.subject-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform .2s, box-shadow .2s;
}
.subject-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(99,102,241,.15); }

.sc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.sc-name { font-size: 15px; font-weight: 700; }
.sc-group { font-size: 10px; padding: 3px 8px; border-radius: 10px; font-weight: 600; }
.g1 { background: #1e3a5f; color: #93c5fd; }
.g2 { background: #2e1065; color: #c4b5fd; }

.sc-topics { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

.sc-hours-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sc-hours-row label { font-size: 12px; color: var(--text-muted); flex: 1; }
.sc-hours-row input { width: 70px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 4px 8px; border-radius: 6px; font-size: 13px; }

.sc-progress-row { display: flex; align-items: center; gap: 8px; }
.sc-progress-row label { font-size: 12px; color: var(--text-muted); }
.sc-progress-row input[type=range] { flex: 1; accent-color: var(--accent); }
.sc-pct-display { font-size: 12px; font-weight: 700; color: var(--accent); width: 36px; text-align: right; }

.sc-bar { height: 6px; border-radius: 3px; background: var(--bg3); margin-top: 10px; overflow: hidden; }
.sc-bar-fill { height: 100%; border-radius: 3px; }

/* ═══════════ STRATEGY TABLE ═══════════ */
.strategy-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.strategy-table th { text-align: left; padding: 10px 12px; background: var(--bg3); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.strategy-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.strategy-table tr:last-child td { border-bottom: none; }

/* ═══════════ FORMS ═══════════ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.form-group input, .form-group select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }

.log-entry-row { display: flex; gap: 8px; margin-bottom: 12px; }
.log-entry-row input, .log-entry-row select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.btn-primary {
  padding: 11px 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: opacity .2s, transform .15s;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-small {
  padding: 7px 14px;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s;
}
.btn-small:hover { opacity: .85; }

/* ═══════════ TODAY LOG ═══════════ */
.today-log-list { display: flex; flex-direction: column; gap: 8px; }
.log-item { display: flex; justify-content: space-between; align-items: center; background: var(--bg3); padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.log-item-name { font-weight: 600; }
.log-item-hours { color: var(--green); font-weight: 700; }
.log-total { font-size: 14px; font-weight: 700; color: var(--accent); margin-top: 12px; text-align: right; }
.empty-state { font-size: 13px; color: var(--text-muted); text-align: center; padding: 20px; }

/* ═══════════ SCHEDULE ═══════════ */
#scheduleTable { display: flex; flex-direction: column; gap: 6px; }
.sch-row { display: grid; grid-template-columns: 100px 1fr 80px; gap: 12px; align-items: center; background: var(--bg3); padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.sch-time { font-weight: 600; color: var(--accent); }
.sch-type { font-size: 11px; padding: 2px 8px; border-radius: 8px; text-align: center; }
.sch-study { background: #1e3a5f; color: #93c5fd; }
.sch-break { background: #064e3b; color: #6ee7b7; }
.sch-sleep { background: #1c1917; color: #a8a29e; }

/* ═══════════ POMODORO ═══════════ */
.pomodoro-center { display: grid; grid-template-columns: 1fr 400px; gap: 24px; align-items: start; }

.pomodoro-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.pomo-mode-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.pomo-mode-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
}
.pomo-mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.pomo-subject-select select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 24px;
  outline: none;
}

.pomo-ring-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
}
.pomo-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-ring-bg { fill: none; stroke: var(--bg3); stroke-width: 12; }
.pomo-ring-fg {
  fill: none;
  stroke: url(#pomoGrad);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 553; /* 2π×88 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .5s linear;
  stroke: var(--accent);
}

.pomo-time {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
}
.pomo-label { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

.pomo-controls { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.btn-pomo-ctrl {
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: #fff;
}
.btn-pomo-reset { background: var(--bg3); border: 1px solid var(--border); color: var(--text-muted); }
.btn-pomo-ctrl:hover { opacity: .85; transform: translateY(-2px); }

.pomo-stats { display: flex; gap: 32px; justify-content: center; }
.pomo-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pomo-stat span { font-family: 'Space Grotesk',sans-serif; font-size: 24px; font-weight: 700; color: var(--accent); }
.pomo-stat small { font-size: 11px; color: var(--text-muted); }

.distraction-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.distraction-input-row input { flex: 1; background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 13px; outline: none; }
.distraction-input-row input:focus { border-color: var(--accent); }

.distraction-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.distraction-item { display: flex; justify-content: space-between; align-items: center; background: #2d1b1b; border: 1px solid #7f1d1d40; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.distraction-item span { color: #fca5a5; }
.di-del { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 16px; }
.distraction-tip { background: var(--bg3); padding: 12px; border-radius: 8px; font-size: 12px; color: var(--text-muted); }

/* ═══════════ TIME TRACKER ═══════════ */
.screen-time-summary { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sts-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sts-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.productive .sts-dot { background: var(--green); }
.neutral .sts-dot { background: #64748b; }
.wasteful .sts-dot { background: var(--red); }
.sts-item span:last-of-type { flex: 1; }
.sts-item strong { margin-left: auto; }

.screen-bar-wrap { margin-bottom: 16px; }
.screen-bar { height: 12px; border-radius: 6px; background: var(--bg3); overflow: hidden; display: flex; }
.sb-productive { background: var(--green); transition: width .5s; }
.sb-neutral { background: #64748b; transition: width .5s; }
.sb-wasteful { background: var(--red); transition: width .5s; }

.app-log-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.ali-item { display: flex; align-items: center; gap: 10px; background: var(--bg3); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.ali-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ali-name { flex: 1; font-weight: 500; }
.ali-mins { color: var(--text-muted); }
.ali-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; margin-left: 4px; }

/* ═══════════ TIPS GRID ═══════════ */
.tips-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tip-card { background: var(--bg3); border-radius: 12px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.tip-icon { font-size: 24px; flex-shrink: 0; }
.tip-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.tip-text strong { color: var(--text); display: block; margin-bottom: 4px; }

/* ═══════════ HABITS ═══════════ */
.habits-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.habit-item { display: flex; align-items: center; gap: 12px; background: var(--bg3); padding: 12px 14px; border-radius: 10px; cursor: pointer; transition: background .2s; }
.habit-item:hover { background: var(--bg); }
.habit-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; transition: all .2s; }
.habit-item.done .habit-check { background: var(--green); border-color: var(--green); }
.habit-name { flex: 1; font-size: 14px; }
.habit-item.done .habit-name { text-decoration: line-through; color: var(--text-muted); }
.habit-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; }

.habit-add-row { display: flex; gap: 8px; }
.habit-add-row input { flex: 1; background: var(--bg3); border: 1px solid var(--border); color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: 13px; outline: none; }
.habit-add-row input:focus { border-color: var(--accent); }

/* ═══════════ HABIT WEEK GRID ═══════════ */
.habit-week-grid { display: flex; flex-direction: column; gap: 8px; }
.hwg-row { display: grid; grid-template-columns: 120px repeat(7, 1fr); gap: 6px; align-items: center; font-size: 12px; }
.hwg-name { color: var(--text-muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hwg-cell { width: 24px; height: 24px; border-radius: 6px; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 11px; }
.hwg-cell.done { background: var(--green); }
.hwg-cell.miss { background: #7f1d1d50; }
.hwg-header { color: var(--text-muted); text-align: center; font-size: 11px; }

/* ═══════════ QUOTE ROTATOR ═══════════ */
.quote-rotator {
  background: var(--bg3);
  border-left: 3px solid var(--accent2);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-style: italic;
  color: #94a3b8;
  margin-bottom: 10px;
  min-height: 60px;
  transition: opacity .3s;
}
.quote-btns { text-align: right; }

/* ═══════════ STREAK CALENDAR ═══════════ */
.streak-calendar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sc-day { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; cursor: pointer; transition: transform .15s; }
.sc-day:hover { transform: scale(1.1); }
.sc-day.done   { background: linear-gradient(135deg,var(--green),#059669); color: #fff; }
.sc-day.missed { background: #2d1b1b; color: #ef4444; }
.sc-day.today  { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; box-shadow: 0 0 12px rgba(99,102,241,.5); }
.sc-day.future { background: var(--bg3); color: var(--text-muted); }

.streak-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.sl-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.sl-dot { width: 14px; height: 14px; border-radius: 4px; }
.sl-dot.done  { background: var(--green); }
.sl-dot.missed{ background: #2d1b1b; border: 1px solid #ef4444; }
.sl-dot.today { background: var(--accent); }
.sl-dot.future{ background: var(--bg3); }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .subjects-grid { grid-template-columns: 1fr; }
  .tips-grid { grid-template-columns: repeat(2, 1fr); }
  .pomodoro-center { grid-template-columns: 1fr; }
}

/* Tablet View */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .main-content { margin-left: 0; }
}

/* Mobile View */
@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
  .main-content { margin-left: 0; }
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tab-section { padding: 20px 16px; }
  .topbar { padding: 12px 16px; }
  .topbar-greeting { font-size: 16px; }
  .topbar-right { gap: 10px; }
  .streak-badge { font-size: 11px; padding: 5px 10px; }
  .live-clock { font-size: 16px; }
}

/* Sidebar Overlay for Mobile/Tablet */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
  display: none;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
  display: block;
}

/* ═══════════ CALENDAR ═══════════ */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 14px 22px;
}
.cal-nav-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  line-height: 1;
}
.cal-nav-btn:hover { background: var(--accent); border-color: var(--accent); }
.cal-month-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
}

.cal-grid-wrap { padding: 20px; margin-bottom: 20px; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.cal-weekdays > div {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-cell {
  min-height: 80px;
  background: var(--bg3);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.cal-cell:hover { border-color: var(--accent); background: var(--bg2); }
.cal-cell.today {
  border-color: var(--accent);
  background: linear-gradient(135deg, #1e1b4b50, #312e8130);
}
.cal-cell.other-month { opacity: .35; pointer-events: none; }
.cal-cell.exam-day { border-color: var(--red) !important; background: #2d1b1b; }
.cal-cell.selected { border-color: var(--accent2); box-shadow: 0 0 0 2px var(--accent2)50; }

.cal-day-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.cal-cell.today .cal-day-num {
  color: var(--accent);
}

.cal-badges {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cal-badge.study    { background: #1e3a5f; color: #93c5fd; }
.cal-badge.revision { background: #1e40af30; color: #a5b4fc; border: 1px solid #6366f130; }
.cal-badge.mock     { background: #7f1d1d50; color: #fca5a5; }
.cal-badge.break    { background: #064e3b50; color: #6ee7b7; }
.cal-badge.other    { background: #451a0350; color: #fcd34d; }

.cal-more { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* Event Panel */
.cal-event-panel {
  margin-bottom: 20px;
  animation: fadeUp .25s ease;
}
.cal-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cal-panel-date {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}
.cal-panel-close {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}
.cal-panel-close:hover { background: var(--red); color: #fff; border-color: var(--red); }

.cal-event-add {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.cal-event-add input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.cal-event-add input:focus { border-color: var(--accent); }
.cal-event-add select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  cursor: pointer;
}
.cal-event-add .btn-primary { width: auto; padding: 9px 18px; white-space: nowrap; }

.cal-events-list { display: flex; flex-direction: column; gap: 8px; }
.cal-event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  padding: 10px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}
.cal-event-item.study    { border-left-color: var(--blue); }
.cal-event-item.revision { border-left-color: var(--accent); }
.cal-event-item.mock     { border-left-color: var(--red); }
.cal-event-item.break    { border-left-color: var(--green); }
.cal-event-item.other    { border-left-color: var(--yellow); }
.cal-event-icon { font-size: 18px; }
.cal-event-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
.cal-event-sub { font-size: 12px; color: var(--text-muted); }
.cal-event-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  transition: color .2s;
}
.cal-event-del:hover { color: var(--red); }

/* Legend */
.cal-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
  align-items: center;
  margin-top: 4px;
}
.cl-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}
.cl-dot.study    { background: var(--blue); }
.cl-dot.revision { background: var(--accent); }
.cl-dot.mock     { background: var(--red); }
.cl-dot.break    { background: var(--green); }
.cl-dot.other    { background: var(--yellow); }

@media (max-width: 900px) {
  .cal-event-add { grid-template-columns: 1fr 1fr; }
  .cal-event-add .btn-primary { grid-column: span 2; }
  .cal-cell { min-height: 60px; }
}

/* ════ THEME TOGGLE ════ */
.theme-toggle {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s;
}
.theme-toggle:hover { background: var(--accent); border-color: var(--accent); transform: rotate(20deg) scale(1.1); }

/* ════ GCAL TOPBAR ════ */
.gcal-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.gcal-topbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gcal-topbar-right { display: flex; align-items: center; gap: 8px; }

.gcal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-right: 4px;
}
.gcal-today-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.gcal-today-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.gcal-arrow-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  line-height: 1;
}
.gcal-arrow-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.gcal-period-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  min-width: 160px;
}

/* View Tabs */
.gcal-view-tabs {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.gcal-view-btn {
  padding: 7px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.gcal-view-btn.active { background: var(--accent); color: #fff; }
.gcal-view-btn:hover:not(.active) { background: var(--border); color: var(--text); }

/* ════ MONTH GRID ════ */
.gcal-month-grid { padding: 0; overflow: hidden; }
.gcal-weekday-header {
  display: grid;
  grid-template-columns: repeat(7,1fr);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.gcal-weekday-header > div {
  padding: 10px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.gcal-month-cells {
  display: grid;
  grid-template-columns: repeat(7,1fr);
}
.gcal-day-cell {
  min-height: 110px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  cursor: pointer;
  transition: background .15s;
  overflow: hidden;
}
.gcal-day-cell:nth-child(7n) { border-right: none; }
.gcal-day-cell:hover { background: var(--bg3); }
.gcal-day-cell.today { background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.08)); }
.gcal-day-cell.other-month { opacity: .38; pointer-events: none; }
.gcal-day-cell.exam-day { background: rgba(239,68,68,.08); }
.gcal-day-cell.selected { outline: 2px solid var(--accent2); outline-offset: -2px; }
.gcal-day-num-wrap { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.gcal-day-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .2s;
}
.gcal-day-cell.today .gcal-day-num { background: var(--accent); color: #fff; }
.gcal-day-cell.exam-day .gcal-day-num { color: var(--red); font-weight: 800; }
.gcal-exam-dot { font-size: 10px; color: var(--red); }
.gcal-event-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity .15s;
  display: block;
}
.gcal-event-chip:hover { opacity: .8; }
.gcal-event-chip.study    { background: #3b82f620; color: var(--blue); border-left: 3px solid var(--blue); }
.gcal-event-chip.revision { background: #6366f120; color: var(--accent); border-left: 3px solid var(--accent); }
.gcal-event-chip.mock     { background: #ef444420; color: var(--red); border-left: 3px solid var(--red); }
.gcal-event-chip.break    { background: #10b98120; color: var(--green); border-left: 3px solid var(--green); }
.gcal-event-chip.other    { background: #f59e0b20; color: var(--yellow); border-left: 3px solid var(--yellow); }
.gcal-more-events { font-size: 11px; color: var(--text-muted); padding: 1px 6px; cursor: pointer; }
.gcal-more-events:hover { color: var(--accent); }

/* ════ TIME GRID (Week / Day) ════ */
.gcal-view { animation: fadeUp .25s ease; }
.gcal-time-grid { padding: 0; overflow: hidden; }
.gcal-tg-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 5;
}
.gcal-tg-gutter { width: 56px; flex-shrink: 0; border-right: 1px solid var(--border); }
.gcal-tg-day-head {
  flex: 1;
  padding: 10px 4px;
  text-align: center;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.gcal-tg-day-head:hover { background: var(--bg3); }
.gcal-tg-day-head:last-child { border-right: none; }
.gcal-tg-dayname { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.gcal-tg-daynum {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 4px auto 0;
}
.gcal-tg-day-head.today .gcal-tg-daynum { background: var(--accent); color: #fff; }

.gcal-tg-body {
  display: flex;
  max-height: 600px;
  overflow-y: auto;
}
.gcal-tg-times {
  width: 56px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.gcal-tg-hour-label {
  height: 60px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 2px 8px 0 0;
  font-size: 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.gcal-tg-cols {
  flex: 1;
  display: flex;
  position: relative;
}
.gcal-tg-col {
  flex: 1;
  border-right: 1px solid var(--border);
  position: relative;
}
.gcal-tg-col:last-child { border-right: none; }
.gcal-tg-cell {
  height: 60px;
  border-bottom: 1px solid var(--border)30;
  cursor: pointer;
  transition: background .12s;
}
.gcal-tg-cell:hover { background: var(--accent)15; }
.gcal-tg-event {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  transition: opacity .15s, transform .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.gcal-tg-event:hover { opacity: .85; transform: scale(1.02); }
.gcal-tg-event.study    { background: var(--blue); color: #fff; }
.gcal-tg-event.revision { background: var(--accent); color: #fff; }
.gcal-tg-event.mock     { background: var(--red); color: #fff; }
.gcal-tg-event.break    { background: var(--green); color: #fff; }
.gcal-tg-event.other    { background: var(--yellow); color: #fff; }
.gcal-now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--red);
  z-index: 3;
}
.gcal-now-line::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
}

/* ════ CL DOT - exam ════ */
.cl-dot.exam { background: var(--red); }

/* ════ COLOR PICKER ════ */
.color-pick-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}
.color-pick-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.color-pick-btn.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}
.color-pick-btn.selected::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

/* ════ EVENT MODAL ════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s ease;
  backdrop-filter: blur(4px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}
.modal-date-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}
.modal-close {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}
.modal-close:hover { background: var(--red); color: #fff; border-color: var(--red); }

.modal-body { padding: 16px 24px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-field { display: flex; flex-direction: column; gap: 5px; }
.modal-field label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-input, .modal-select, .modal-textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.modal-input:focus, .modal-select:focus, .modal-textarea:focus { border-color: var(--accent); }
.modal-textarea { resize: vertical; min-height: 60px; }
.modal-save { margin-top: 4px; }

.modal-events-section {
  border-top: 1px solid var(--border);
  padding: 16px 24px 20px;
}
.modal-es-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing:.05em; margin-bottom: 10px; }
.modal-ev-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: 10px;
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}
.modal-ev-item.study    { border-left-color: var(--blue); }
.modal-ev-item.revision { border-left-color: var(--accent); }
.modal-ev-item.mock     { border-left-color: var(--red); }
.modal-ev-item.break    { border-left-color: var(--green); }
.modal-ev-item.other    { border-left-color: var(--yellow); }
.modal-ev-info { flex: 1; }
.modal-ev-title { font-size: 14px; font-weight: 600; }
.modal-ev-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.modal-ev-sub  { font-size: 11px; color: var(--text-muted); }
.modal-ev-del {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 18px; padding: 0 4px;
  transition: color .2s; line-height: 1;
}
.modal-ev-del:hover { color: var(--red); }

/* Light mode adjustments for GCal */
body.light .gcal-tg-event.study    { background: #2563eb; }
body.light .gcal-tg-event.revision { background: #4f46e5; }
body.light .modal-overlay { background: rgba(0,0,0,.35); }
body.light .sidebar { box-shadow: 2px 0 12px rgba(0,0,0,.1); }
body.light .stat-card { border-color: var(--border); }
body.light .s-blue   { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); }
body.light .s-purple { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.3); }
body.light .s-green  { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); }
body.light .s-orange { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); }
body.light .nav-item.active { box-shadow: 0 2px 12px rgba(79,70,229,.25); }

/* ════ 3-PHASE SUBJECT TRACKING ════ */
.sp-phases {
  height: 8px;
  border-radius: 4px;
  background: var(--bg3);
  overflow: hidden;
  display: flex;
  gap: 2px;
  margin-top: 6px;
}
.sp-phase-bar { height: 100%; border-radius: 2px; transition: width .4s ease; }

.phase-block { margin-bottom: 10px; }
.phase-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.phase-pct { color: var(--text); font-weight: 700; }
.phase-track { display: flex; align-items: center; gap: 8px; }
.phase-track input[type=range] { flex: 1; accent-color: var(--accent); cursor: pointer; }
.phase-bar {
  width: 80px;
  height: 7px;
  border-radius: 4px;
  background: var(--bg3);
  overflow: hidden;
  flex-shrink: 0;
}
.phase-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }
.phase-oc { background: #3b82f6; }
.phase-r1 { background: #8b5cf6; }
.phase-r2 { background: #10b981; }

.sc-overall-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.sc-overall-row strong { font-size: 18px; font-family: 'Space Grotesk', sans-serif; }

.phase-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.phase-tag.oc { background: rgba(59,130,246,.15); color: var(--blue); }
.phase-tag.r1 { background: rgba(139,92,246,.15); color: var(--accent2); }
.phase-tag.r2 { background: rgba(16,185,129,.15); color: var(--green); }

/* Accordion Topics */
.phase-label::before {
  content: '▼';
  font-size: 10px;
  margin-right: 6px;
  display: inline-block;
  transition: transform .2s;
  color: var(--text-muted);
}
.phase-topic-list.expanded { display: block; animation: slideDown .2s; }
.phase-topic-list.expanded + .phase-label::before { transform: rotate(-90deg); }
.phase-topic-list {
  display: none;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 6px;
}
@keyframes slideDown { from {opacity:0; transform:translateY(-4px);} to {opacity:1; transform:translateY(0);} }

.topic-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .2s;
  border-radius: 4px;
}
.topic-check:hover { background: var(--bg3); }
.topic-check input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
  width: 14px; height: 14px;
  cursor: pointer;
}

/* ════ SLEEP TRACKER ════ */
.sleep-today-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.sleep-today-card.sleep-great { background: rgba(16,185,129,.12); border-color: #10b98140; }
.sleep-today-card.sleep-ok    { background: rgba(245,158,11,.12); border-color: #f59e0b40; }
.sleep-today-card.sleep-bad   { background: rgba(239,68,68,.12);  border-color: #ef444440; }
.stc-icon { font-size: 36px; flex-shrink: 0; }
.stc-info { flex: 1; }
.stc-duration { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.stc-times { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.stc-quality { font-size: 12px; font-weight: 600; margin-top: 4px; }
.sleep-today-card.sleep-great .stc-quality { color: #10b981; }
.sleep-today-card.sleep-ok    .stc-quality { color: #f59e0b; }
.sleep-today-card.sleep-bad   .stc-quality { color: #ef4444; }
.sleep-bar { border-radius: 6px 6px 0 0 !important; }

/* ════ MOCK TESTS TRACKER ════ */
.mock-chart-container {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  height: 200px;
  padding-top: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  padding-bottom: 8px;
}
.mock-chart-container::-webkit-scrollbar { height: 6px; }
.mock-col { flex: 0 0 50px; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.mock-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.mock-bar {
  width: 32px;
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height .5s ease;
  cursor: pointer;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 6px;
}
.mock-score-label {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.mock-bar:hover { filter: brightness(1.2); }
.mock-date-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ═══════════ RESPONSIVE DESIGN ═══════════ */
@media (max-width: 1024px) {
  .main-content {
    margin-left: 0;
  }
  .sidebar { 
    transform: translateX(-100%); 
    width: 280px; 
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    background: var(--bg2);
  }
  .sidebar.open { transform: translateX(0); }
  body.light .sidebar { box-shadow: 4px 0 24px rgba(0,0,0,0.1); }
  
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  
  .topbar { padding: 12px 20px; }
  .tab-section { padding: 24px 20px; }
  
  /* Make Google Calendar table horizontally scrollable */
  .gcal-month-grid { overflow-x: auto; }
  .gcal-tg-wrap { overflow-x: auto; }
  .gcal-tg-days { min-width: 600px; }
  .gcal-tg-body { min-width: 600px; }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; }
  
  /* Topbar stacking */
  .topbar { flex-direction: column; align-items: flex-start; gap: 16px; padding: 16px; }
  .topbar-left { width: 100%; justify-content: flex-start; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .live-clock { font-size: 16px; }
  .streak-badge { font-size: 12px; padding: 6px 10px; }
  
  /* UI Tweaks */
  .section-title { font-size: 20px; margin-bottom: 20px; }
  .cal-legend { flex-wrap: wrap; gap: 8px; }
  
  /* Mobile-specific improvements */
  .menu-btn { display: flex; align-items: center; justify-content: center; }
  .pomodoro-center { grid-template-columns: 1fr; }
  .gcal-topbar { flex-direction: column; align-items: stretch; }
  .gcal-topbar-left, .gcal-topbar-right { width: 100%; justify-content: space-between; }
  
  /* Improve touch targets */
  .nav-item { padding: 14px 16px; font-size: 15px; }
  .btn-primary, .btn { min-height: 44px; }
  .theme-toggle { width: 44px; height: 44px; }
  
  .study-plan-table th, .study-plan-table td { padding: 10px; font-size: 12px; }
  
  /* Modals */
  .modal-box { width: 95%; max-width: 100%; padding: 24px 16px; }
  
  /* Mock Chart Scroll */
  .mock-chart-container { min-height: 160px; }
  
  /* Habit Grid Scroll */
  .habit-grid { overflow-x: auto; white-space: nowrap; padding-bottom: 8px; }
  .hg-dates, .hg-row { min-width: 600px; }
}

@media (max-width: 480px) {
  .topbar-greeting { font-size: 16px; }
  .logo-title { font-size: 14px; }
  .sidebar-countdown { padding: 12px; }
  .countdown-number { font-size: 32px; }
  
  .pm-timer-display { font-size: 64px; }
  .btn, .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
  .two-col-modal { grid-template-columns: 1fr; }
  
  /* Adjust Time Tracker Flex */
  .tracker-controls { flex-direction: column; width: 100%; }
}
