/* ── CSS Variables (Light mode default) ─────────────────────────────────────── */
:root {
  --navy:      #1e3a5f;
  --blue:      #2980b9;
  --green:     #27ae60;
  --red:       #e74c3c;
  --orange:    #f39c12;
  --bg:        #f0f2f5;
  --card-bg:   #ffffff;
  --text:      #1a1a2e;
  --text-muted:#6c757d;
  --border:    #dee2e6;
  --sidebar-bg:#1e3a5f;
  --sidebar-text:#ffffff;
  --input-bg:  #ffffff;
  --shadow:    0 2px 12px rgba(0,0,0,.08);
  --option-hover:#f0f4ff;
  --option-sel: #dceeff;
  --correct-bg: #e6f9ed;
  --correct-clr:#1a7a3d;
  --wrong-bg:   #fde8e6;
  --wrong-clr:  #c0392b;
}

/* ── Dark Mode ───────────────────────────────────────────────────────────────── */
body.dark-mode {
  --bg:        #0d1117;
  --card-bg:   #161b22;
  --text:      #c9d1d9;
  --text-muted:#8b949e;
  --border:    #30363d;
  --sidebar-bg:#010409;
  --input-bg:  #21262d;
  --shadow:    0 2px 12px rgba(0,0,0,.4);
  --option-hover:#1c2128;
  --option-sel: #1c3553;
  --correct-bg: #0d2b1a;
  --correct-clr:#3fb950;
  --wrong-bg:   #2d1117;
  --wrong-clr:  #f85149;
  --navy:      #388bfd;
  --blue:      #58a6ff;
}

/* ── Base ────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: background .2s, color .2s;
  margin: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
#sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: 250px; z-index: 1050;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  transform: translateX(-100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column;
  box-shadow: 3px 0 20px rgba(0,0,0,.3);
}
#sidebar.open { transform: translateX(0); }
#sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 1040;
  background: rgba(0,0,0,.45);
}
#sidebar-overlay.show { display: block; }
.sidebar-header {
  padding: 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-brand { font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap:.5rem; }
.sidebar-close { background: none; border: none; color: rgba(255,255,255,.6); font-size: 1.2rem; cursor: pointer; }
.sidebar-close:hover { color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.2rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--blue); }
.sidebar-nav .nav-section {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 1rem 1.2rem .3rem;
  text-transform: uppercase;
}
.sidebar-footer { padding: .8rem 1.2rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; color: rgba(255,255,255,.5); }

/* ── Navbar ──────────────────────────────────────────────────────────────────── */
.bg-navy { background-color: var(--navy) !important; }
.text-navy { color: var(--navy) !important; }
.btn-navy  { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover { background: #16304f; color: #fff; }
.btn-outline-navy { color: var(--navy); border-color: var(--navy); }
.btn-outline-navy:hover { background: var(--navy); color: #fff; }
.navbar { box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.nav-link { font-size: .9rem; color: rgba(255,255,255,.8) !important; }
.nav-link.active, .nav-link:hover { color: #fff !important; }
.theme-toggle { background: none; border: 1.5px solid rgba(255,255,255,.4); border-radius: 20px;
  color: #fff; padding: .2rem .7rem; font-size: .85rem; cursor: pointer; transition: .15s; }
.theme-toggle:hover { background: rgba(255,255,255,.15); }

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.main-content { min-height: calc(100vh - 56px - 48px); }
.footer { background: var(--sidebar-bg); color: rgba(255,255,255,.5); }
.card { background: var(--card-bg); border-color: var(--border) !important; }
.card-header { background: transparent; border-color: var(--border); color: var(--text); }
.form-control, .form-select { background: var(--input-bg); color: var(--text); border-color: var(--border); }
.form-control:focus, .form-select:focus { background: var(--input-bg); color: var(--text); }
.table { color: var(--text); }
.table-light { background: var(--bg); }
.table-hover tbody tr:hover { background: var(--option-hover); }

/* ── Stat cards ──────────────────────────────────────────────────────────────── */
.stat-card {
  border-radius: 14px; padding: 1.1rem 1.2rem;
  position: relative; overflow: hidden; transition: transform .2s;
  box-shadow: var(--shadow);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .75rem; opacity: .85; margin-top: .3rem; }
.stat-icon  { position: absolute; top: 12px; right: 14px; font-size: 2.2rem; opacity: .18; }

/* ── Question card ───────────────────────────────────────────────────────────── */
.question-card { border-radius: 10px; box-shadow: var(--shadow); }
.q-stem { font-size: .95rem; line-height: 1.6; color: var(--text); }
.q-stem p { margin-bottom: .4rem; }
.q-stem img, .explanation-box img {
  max-height: 180px; max-width: 100%;
  border-radius: 6px; margin: .4rem 0;
  cursor: zoom-in; display: block;
  object-fit: contain;
  transition: box-shadow .15s;
}
.q-stem img:hover, .explanation-box img:hover { box-shadow: 0 4px 16px rgba(0,0,0,.3); }

/* ── Options ─────────────────────────────────────────────────────────────────── */
.options-list { display: flex; flex-direction: column; gap: .4rem; }
.option-item {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .65rem .9rem; border: 1.5px solid var(--border);
  border-radius: 8px; cursor: pointer; background: var(--card-bg);
  font-size: .92rem; transition: all .15s; color: var(--text);
}
.option-item:hover { border-color: var(--navy); background: var(--option-hover); }
.option-item.selected { border-color: var(--navy); background: var(--option-sel); }
.option-item.option-correct { border-color: var(--green); background: var(--correct-bg); color: var(--correct-clr); }
.option-item.option-wrong   { border-color: var(--red);   background: var(--wrong-bg);   color: var(--wrong-clr); }
.option-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; min-width: 26px;
  background: var(--navy); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: .8rem;
}
.option-correct .option-letter { background: var(--green); }
.option-wrong   .option-letter { background: var(--red); }

/* ── Timer ───────────────────────────────────────────────────────────────────── */
.timer-circle {
  display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 80px; height: 80px; border-radius: 50%;
  border: 4px solid var(--navy); background: var(--card-bg);
  font-weight: 800; transition: border-color .3s, background .3s;
}
.timer-circle span { font-size: 1.6rem; line-height: 1; color: var(--text); }
.timer-circle small { font-size: .65rem; color: var(--text-muted); }
.timer-warning { border-color: var(--orange) !important; }
.timer-danger  { border-color: var(--red) !important; animation: pulse .6s infinite alternate; }
.timer-notice {
  display: block; padding: .3rem .9rem;
  background: #fff3cd; border: 1px solid var(--orange);
  border-radius: 20px; font-size: .85rem; color: #856404; margin-top: 6px;
}
.timer-circle.timer-danger span { font-size: 1.3rem; }
@keyframes pulse {
  from { background: var(--card-bg); }
  to   { background: var(--wrong-bg); }
}

/* ── Exam total timer ────────────────────────────────────────────────────────── */
.exam-timer-bar {
  background: var(--card-bg); border-radius: 12px;
  padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow);
}
.exam-time-left { font-size: 1.5rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.exam-time-left.warn { color: #ffd700; }
.exam-time-left.danger { color: #ff6b6b; animation: pulse .6s infinite alternate; }

/* ── Explanation ─────────────────────────────────────────────────────────────── */
.explanation-box {
  background: var(--bg); border-left: 4px solid var(--blue);
  border-radius: 4px; padding: 1rem 1.2rem;
  font-size: .9rem; line-height: 1.7; color: var(--text);
}
.explanation-box p:last-child { margin-bottom: 0; }
.learning-points ul { padding-left: 1.2rem; font-size: .9rem; }
.learning-points li { margin-bottom: .3rem; }
.result-banner { padding: .7rem 1rem; border-radius: 8px; font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }
.result-correct { background: var(--correct-bg); color: var(--correct-clr); border: 1px solid var(--green); }
.result-wrong   { background: var(--wrong-bg);   color: var(--wrong-clr);   border: 1px solid var(--red); }
.result-timeout { background: #fff3cd; color: #856404; border: 1px solid var(--orange); }

/* ── Summary card ────────────────────────────────────────────────────────────── */
.summary-card { background: linear-gradient(135deg, #1e3a5f, #2980b9); color: #fff; border-radius: 16px; padding: 2rem; text-align: center; }
.summary-score { font-size: 4rem; font-weight: 900; }

/* ── Notes ───────────────────────────────────────────────────────────────────── */
.note-editor {
  resize: vertical; min-height: 90px; font-size: .88rem; line-height: 1.6;
  border: 1.5px solid var(--border); border-radius: 8px; padding: .6rem .8rem;
  width: 100%; background: var(--input-bg); color: var(--text); transition: border-color .15s;
  font-family: inherit;
}
.note-editor:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(41,128,185,.15); }
.note-saved { color: var(--green); font-size: .8rem; }

/* In-practice note section */
.note-section { border-top: 2px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.note-section-header { display:flex; align-items:center; font-size:.9rem; color:var(--text); }
.note-toolbar {
  display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem;
}
.note-tool-btn {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: .25rem .65rem; font-size: .78rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .3rem; transition: .15s;
  white-space: nowrap;
}
.note-tool-btn:hover { background: var(--option-hover); border-color: var(--blue); }
.note-tool-btn.btn-save-note { background: var(--navy); color: #fff; border-color: var(--navy); }
.note-tool-btn.btn-save-note:hover { opacity: .88; }
.note-link-form { background: var(--bg); border-radius: 8px; padding: .5rem; border: 1px solid var(--border); }

/* Attachment items inline */
.note-att-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.note-att-item { position: relative; }
.note-att-img {
  width: 80px; height: 80px; object-fit: cover; border-radius: 8px;
  cursor: zoom-in; border: 1.5px solid var(--border); display: block;
  transition: box-shadow .15s;
}
.note-att-img:hover { box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.note-att-del {
  position: absolute; top: -6px; right: -6px;
  background: var(--red); color: #fff; border: none;
  border-radius: 50%; width: 20px; height: 20px;
  font-size: .6rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.note-att-item:hover .note-att-del { opacity: 1; }
.note-att-file {
  display: flex; align-items: center; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .35rem .6rem; max-width: 240px; gap: .3rem;
}
.note-att-file a { font-size:.82rem; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:160px; }
.note-att-file .note-att-del { position:static; opacity:1; width:18px; height:18px; font-size:.55rem; flex-shrink:0; }
.note-display {
  background: var(--bg); border-left: 3px solid var(--blue);
  border-radius: 4px; padding: .6rem .9rem;
  font-size: .88rem; line-height: 1.65; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}

/* ── Topic Selector ──────────────────────────────────────────────────────────── */
.topic-selector { max-width: 900px; margin: 0 auto; }
.topic-group { background: var(--card-bg); border-radius: 12px; margin-bottom: .8rem; box-shadow: var(--shadow); overflow: hidden; }
.topic-group-header {
  display: flex; align-items: center; gap:.7rem;
  padding: .8rem 1.1rem; cursor: pointer;
  font-weight: 700; font-size: .95rem;
  user-select: none; border-bottom: 1px solid var(--border);
}
.topic-group-header:hover { background: var(--option-hover); }
.group-check { width: 18px; height: 18px; cursor: pointer; accent-color: var(--navy); }
.group-collapse-icon { margin-left: auto; transition: transform .2s; }
.group-collapse-icon.open { transform: rotate(180deg); }
.topic-list { padding: .3rem 0; display: none; }
.topic-list.expanded { display: block; }
.topic-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .5rem 1.1rem; font-size: .88rem; cursor: pointer;
  transition: background .1s;
}
.topic-row:hover { background: var(--option-hover); }
.topic-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--navy); }
.topic-emoji { font-size: 1.1rem; width: 24px; text-align: center; }
.topic-name  { flex: 1; }
.topic-progress { flex: 0 0 100px; }
.topic-progress .progress { height: 6px; border-radius: 3px; background: var(--border); margin-bottom: 2px; }
.topic-progress .progress-bar { background: var(--blue); border-radius: 3px; }
.topic-count { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.topic-count strong { color: var(--text); }

/* ── Start bar (bottom of topic selector) ────────────────────────────────────── */
.start-bar {
  position: sticky; bottom: 0; background: var(--card-bg);
  border-top: 1px solid var(--border); padding: .8rem 1rem;
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  box-shadow: 0 -4px 16px rgba(0,0,0,.1); z-index: 100;
}
.start-bar .count-badge { background: var(--navy); color: #fff; border-radius: 20px; padding: .2rem .7rem; font-size: .85rem; font-weight: 700; }
.start-bar .q-count { font-size: .85rem; color: var(--text-muted); }
.exam-mode-toggle { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text); cursor: pointer; }
.exam-mode-toggle input { cursor: pointer; accent-color: #f39c12; }

/* ── Exam mode styles ────────────────────────────────────────────────────────── */
.exam-header { background: var(--navy); color: #fff; padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.exam-q-number { font-size: .85rem; opacity: .75; }

/* ── Activity Heatmap ────────────────────────────────────────────────────────── */
.heatmap-wrap { overflow-x: auto; }
.heatmap { display: flex; gap: 3px; }
.heatmap-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell {
  width: 13px; height: 13px; border-radius: 2px;
  background: var(--border); transition: transform .1s;
}
.heatmap-cell:hover { transform: scale(1.3); }
.heatmap-cell.l1 { background: #0e4429; }
.heatmap-cell.l2 { background: #006d32; }
.heatmap-cell.l3 { background: #26a641; }
.heatmap-cell.l4 { background: #39d353; }
body.dark-mode .heatmap-cell.l1 { background: #0e4429; }
body.dark-mode .heatmap-cell.l2 { background: #006d32; }
body.dark-mode .heatmap-cell.l3 { background: #26a641; }
body.dark-mode .heatmap-cell.l4 { background: #39d353; }
.heatmap-labels { display: flex; gap: 3px; padding-bottom: 3px; }
.heatmap-month-label { font-size: .65rem; color: var(--text-muted); }

/* ── Goal progress bars ──────────────────────────────────────────────────────── */
.goal-bar-wrap { margin-bottom: .6rem; }
.goal-bar-label { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: 3px; color: var(--text-muted); }
.goal-bar-label strong { color: var(--text); }

/* ── Lightbox ────────────────────────────────────────────────────────────────── */
#lightbox {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.92);
  align-items: center; justify-content: center;
  flex-direction: column;
}
#lightbox.show { display: flex; }
#lightbox img {
  max-width: 90vw; max-height: 85vh;
  border-radius: 6px; transition: transform .1s;
  cursor: grab; user-select: none;
}
#lightbox img.grabbing { cursor: grabbing; }
#lb-close {
  position: absolute; top: 14px; right: 18px;
  background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 1.5rem; border-radius: 50%; width: 38px; height: 38px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
#lb-close:hover { background: rgba(255,255,255,.3); }
#lb-hint { color: rgba(255,255,255,.45); font-size: .78rem; margin-top: 8px; }
#lb-zoom-level { color: rgba(255,255,255,.6); font-size: .82rem; position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); }

/* ── Browse explanation panel ────────────────────────────────────────────────── */
.explanation-panel { color: var(--text); }

/* ── Misc ────────────────────────────────────────────────────────────────────── */
.btn-xs { padding: .15rem .45rem; font-size: .75rem; line-height: 1.4; }
.goal-stat-row { display: flex; align-items: center; }
.badge { font-size: .75rem; }
.table th { font-weight: 600; font-size: .85rem; }
.table td { font-size: .85rem; vertical-align: middle; }
.bg-success-subtle { background-color: #d4edda !important; }
body.dark-mode .bg-success-subtle { background-color: #0d2b1a !important; }
.note-text { font-size: .92rem; color: var(--text); line-height: 1.6; }
.q-stem-preview { font-size: .82rem; }
.auth-bg { background: linear-gradient(135deg, #1e3a5f 0%, #2980b9 100%); }
.list-group-item { background: var(--card-bg); color: var(--text); border-color: var(--border); }
.list-group-item:hover { background: var(--option-hover); }
.dropdown-menu { background: var(--card-bg); border-color: var(--border); }
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: var(--option-hover); }
.alert { border-radius: 8px; }

/* ── Dashboard ───────────────────────────────────────────────────────────────── */
.streak-badge {
  display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(135deg, #ff6b00, #ff9d00);
  color: #fff; border-radius: 12px; padding: .5rem .9rem; min-width: 72px;
  box-shadow: 0 2px 8px rgba(255,107,0,.35);
}
.streak-flame { font-size: 1.4rem; line-height: 1; }
.streak-num   { font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
.streak-label { font-size: .65rem; opacity: .85; white-space: nowrap; }

.task-checklist { display: flex; flex-direction: column; gap: .4rem; }
.task-item { display: flex; align-items: center; gap: .55rem; font-size: .88rem; color: var(--text-muted); }
.task-item.done { color: var(--text); }
.task-item i { width: 16px; flex-shrink: 0; }

.exam-countdown-card {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: #fff; border-radius: 12px;
}
.exam-countdown-card .card-body { padding: 1rem; }
.countdown-num { font-size: 3.5rem; font-weight: 900; line-height: 1; color: #fff; }
.countdown-label { font-size: .9rem; opacity: .85; }

/* ── Heatmap (new layout) ────────────────────────────────────────────────────── */
.heatmap-scroll { overflow-x: auto; padding-bottom: .5rem; }
.heatmap-grid { display: inline-flex; flex-direction: column; gap: 0; }
.heatmap-months { display: flex; gap: 3px; height: 16px; padding-left: 0; margin-bottom: 2px; position: relative; }
.heatmap-month-label { font-size: .65rem; color: var(--text-muted); width: 16px; white-space: nowrap; }
.heatmap-weeks { display: flex; gap: 3px; }
.heatmap-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.heatmap-legend .small { font-size: .7rem; }

/* ── Dashboard Hero Card ─────────────────────────────────────────────────────── */
.dash-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #2980b9 100%);
  border-radius: 18px; padding: 1.8rem 2rem; color: #fff;
  box-shadow: 0 6px 28px rgba(30,58,95,.35); position: relative; overflow: hidden;
}
.dash-hero::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255,255,255,.05); pointer-events: none;
}
.dash-hero-date  { font-size: .78rem; color: rgba(255,255,255,.6); letter-spacing: .04em; }
.dash-hero-name  { font-size: 1.85rem; font-weight: 900; line-height: 1.2; }
.dash-hero-motive { font-size: .88rem; color: rgba(255,255,255,.8); margin-top: .25rem; }
.dash-streak-pill {
  background: rgba(255,107,0,.22); border: 1.5px solid rgba(255,180,0,.45);
  border-radius: 14px; padding: .55rem 1rem; text-align: center; min-width: 80px;
}
.dash-streak-fire { font-size: 1.6rem; line-height: 1; }
.dash-streak-num  { font-size: 2rem; font-weight: 900; color: #ffd700; line-height: 1.1; }
.dash-streak-lbl  { font-size: .62rem; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .06em; }
.dash-ring-wrap   { position: relative; display: inline-block; flex-shrink: 0; }
.dash-ring-inner  { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dash-ring-num    { font-size: 1.5rem; font-weight: 900; color: #fff; line-height: 1; }
.dash-ring-sub    { font-size: .6rem; color: rgba(255,255,255,.65); text-align: center; line-height: 1.3; }

/* ── Stat cards v2 ───────────────────────────────────────────────────────────── */
.scv2 {
  border-radius: 14px; padding: 1.2rem 1.4rem;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
.scv2:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,.15); }
.scv2 .scv2-icon { position: absolute; top: 10px; right: 14px; font-size: 2.5rem; opacity: .12; }
.scv2 .scv2-val  { font-size: 2.1rem; font-weight: 900; line-height: 1; }
.scv2 .scv2-lbl  { font-size: .75rem; margin-top: .35rem; opacity: .85; font-weight: 600; }
.scv2 .scv2-sub  { font-size: .68rem; margin-top: .1rem; opacity: .65; }

/* ── Quick actions grid ──────────────────────────────────────────────────────── */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .45rem; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; padding: .8rem .3rem; border-radius: 10px; text-decoration: none;
  background: var(--bg); color: var(--text); border: 1.5px solid var(--border);
  text-align: center; transition: all .15s; line-height: 1.2;
}
.quick-item:hover { border-color: var(--navy); background: var(--option-hover); color: var(--text); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.quick-item i    { font-size: 1.2rem; }
.quick-item span { font-size: .7rem; font-weight: 600; }
.quick-item small { font-size: .65rem; opacity: .75; }
.qi-primary { background: var(--navy) !important; color: #fff !important; border-color: var(--navy) !important; }
.qi-primary:hover { background: #16304f !important; color: #fff !important; }
.qi-danger  { background: #e74c3c !important; color: #fff !important; border-color: #e74c3c !important; }
.qi-danger:hover { background: #c0392b !important; color: #fff !important; }
.quick-item-wide { grid-column: 1/-1; flex-direction: row; justify-content: flex-start; gap: .6rem; padding: .55rem .8rem; }

/* ── Stats page ──────────────────────────────────────────────────────────────── */
.stats-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #2980b9 100%);
  border-radius: 18px; padding: 2rem; color: #fff;
  box-shadow: 0 6px 28px rgba(30,58,95,.35); margin-bottom: 1.5rem;
}
.stats-hero-big  { font-size: 4.5rem; font-weight: 900; line-height: 1; }
.stats-hero-lbl  { font-size: .85rem; color: rgba(255,255,255,.7); margin-top: .3rem; }
.stats-hero-sep  { width: 1px; background: rgba(255,255,255,.2); margin: 0 .5rem; align-self: stretch; }
.stats-hero-kv   { text-align: center; padding: .3rem .8rem; }
.stats-hero-kv .n { font-size: 2rem; font-weight: 900; line-height: 1.1; }
.stats-hero-kv .l { font-size: .78rem; color: rgba(255,255,255,.7); }

/* ── CSS bar chart (7-day activity) ─────────────────────────────────────────── */
.bar-chart-outer { display: flex; align-items: flex-end; gap: 5px; height: 130px; }
.bar-day-wrap { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; justify-content: flex-end; gap: 3px; }
.bar-day-bar  { width: 100%; border-radius: 4px 4px 0 0; min-height: 3px; transition: height .4s; }
.bar-day-cnt  { font-size: .67rem; font-weight: 700; color: var(--text); line-height: 1; }
.bar-day-lbl  { font-size: .65rem; color: var(--text-muted); }

/* ── Topic group rows in stats table ─────────────────────────────────────────── */
.tg-header td {
  background: var(--bg) !important; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted);
  padding: .4rem 1rem !important; border-top: 2px solid var(--border) !important;
}

/* ── Info tile strip ─────────────────────────────────────────────────────────── */
.info-tile { border-radius: 10px; padding: .9rem 1.1rem; }
.info-tile .it-val { font-size: 1.6rem; font-weight: 900; line-height: 1; }
.info-tile .it-lbl { font-size: .75rem; opacity: .8; margin-top: .2rem; }

/* ── Website highlighter (matches extension appearance) ──────────────────────── */
#whl-btn {
  position: fixed !important;
  right: 20px !important;
  bottom: 80px !important;
  width: 48px !important;
  height: 48px !important;
  background: #1a1a2e !important;
  color: #f59e0b !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.35) !important;
  z-index: 9990 !important;
  transition: background .2s, transform .15s, box-shadow .2s !important;
  user-select: none !important;
  border: 2px solid #0f3460 !important;
}
#whl-btn:hover {
  background: #16213e !important;
  transform: scale(1.08) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.4) !important;
}
#whl-btn.whl-active {
  background: #f59e0b !important;
  color: #1a1a2e !important;
  border-color: #d97706 !important;
  box-shadow: 0 0 0 3px rgba(245,158,11,.35), 0 4px 16px rgba(0,0,0,.35) !important;
}
body.whl-mode, body.whl-mode * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='20' viewBox='0 0 24 20'%3E%3Cline x1='5' y1='1' x2='5' y2='19' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='1' y1='1' x2='9' y2='1' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='1' y1='19' x2='9' y2='19' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cline x1='5' y1='1' x2='5' y2='19' stroke='%23111' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='1' y1='1' x2='9' y2='1' stroke='%23111' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='1' y1='19' x2='9' y2='19' stroke='%23111' stroke-width='1.2' stroke-linecap='round'/%3E%3Cg transform='translate(22,2) rotate(45)'%3E%3Crect x='-3' y='0' width='6' height='9' rx='1.8' fill='%23FFE066' stroke='%23b38600' stroke-width='0.8'/%3E%3Crect x='-3' y='8' width='6' height='3' rx='0.5' fill='%23f59e0b' stroke='%23b38600' stroke-width='0.8'/%3E%3Cpolygon points='-2,11 2,11 0,14' fill='%23d97706'/%3E%3Crect x='-2' y='1' width='1.5' height='5' rx='0.7' fill='white' opacity='0.4'/%3E%3C/g%3E%3C/svg%3E") 5 10, text !important;
}
.whl-mark {
  border-radius: 2px !important;
  padding: 0 1px !important;
  cursor: pointer !important;
  transition: filter .15s !important;
}
.whl-mark:hover { filter: brightness(.88) !important; }
#whl-picker {
  position: fixed !important;
  display: flex !important;
  gap: 8px !important;
  align-items: center !important;
  background: #1a1a2e !important;
  border: 1px solid #0f3460 !important;
  border-radius: 30px !important;
  padding: 7px 12px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.45) !important;
  z-index: 9989 !important;
}
.whl-swatch {
  width: 22px !important;
  height: 22px !important;
  border-radius: 50% !important;
  display: block !important;
  cursor: pointer !important;
  border: 2px solid transparent !important;
  transition: transform .12s, border-color .12s !important;
}
.whl-swatch:hover { transform: scale(1.15) !important; }
.whl-swatch-active {
  border-color: #fff !important;
  transform: scale(1.15) !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,.4) !important;
}
.whl-tooltip {
  position: fixed !important;
  background: #1a1a2e !important;
  border: 1px solid #0f3460 !important;
  border-radius: 8px !important;
  padding: 6px 8px !important;
  z-index: 9991 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.5) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  pointer-events: all !important;
}
.whl-swatch-row {
  display: flex !important;
  gap: 5px !important;
  align-items: center !important;
}
.whl-del-btn {
  background: #ef4444 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  font-weight: 600 !important;
  width: 100% !important;
  font-family: inherit !important;
  transition: background .15s !important;
}
.whl-del-btn:hover { background: #dc2626 !important; }
