/* ── Base: inherit site design system ── */
:root {
  --fg: #C8C8C8;
  --bg: #0e0e0e;
  --bg-panel: rgba(14, 14, 14, 0.97);
  --accent: #e0e0e0;
  --muted: #6b6b6b;
  --heading: #e0e0e0;
  --text: #C8C8C8;
  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.15);
  --glass: rgba(20, 20, 20, 0.65);
  --glass-hover: rgba(28, 28, 28, 0.8);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,.4);
  --font: "Fira Code", monospace;

  /* Status colors (neutral red/yellow/green) */
  --c-not-started: #b05555;
  --c-in-progress: #c8a838;
  --c-done: #5a9e6f;
  --c-overdue: #c05555;

  /* Priority colors */
  --c-critical: #c05555;
  --c-high: #d4832a;
  --c-medium: #4a7fb5;
  --c-low: #6b6b6b;

  /* Event type colors */
  --c-assignment: #d4a843;
  --c-class: #4a7fb5;
  --c-personal: #5a9e6f;
  --c-preply: #8a5ac0;
  --c-email: #6b8fa0;

  --sidebar-w: 200px;
  --bottom-nav-h: 56px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  overflow: hidden;
}

/* ── Layout ── */
#app { height: 100vh; display: flex; flex-direction: column; }

/* Auth / Onboarding screens */
.full-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.full-screen.hidden { display: none; }

/* ── Auth Screen ── */
.auth-box {
  width: 100%;
  max-width: 340px;
  padding: 2.5rem 2rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}
.auth-logo {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .25rem;
  letter-spacing: -.05em;
}
.auth-sub {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 2rem;
}
.auth-field {
  width: 100%;
  padding: .7rem .9rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font);
  font-size: .88rem;
  outline: none;
  transition: border-color .2s;
  margin-bottom: .75rem;
}
.auth-field:focus { border-color: var(--border-bright); }
.auth-btn {
  width: 100%;
  padding: .7rem;
  background: rgba(255,255,255,.1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.auth-btn:hover { background: rgba(255,255,255,.18); }
.auth-btn:active { transform: scale(.98); }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.auth-error {
  margin-top: .75rem;
  font-size: .8rem;
  color: var(--c-overdue);
  text-align: center;
}

/* ── Onboarding ── */
.onboard-box {
  width: 100%;
  max-width: 500px;
  padding: 2rem 1.75rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  max-height: 90vh;
  overflow-y: auto;
}
.onboard-box::-webkit-scrollbar { width: 3px; }
.onboard-box::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }
.onboard-header { margin-bottom: 1.5rem; }
.onboard-logo { font-size: 2rem; font-weight: 700; color: var(--accent); }
.onboard-step-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: .25rem; }
.onboard-progress {
  display: flex;
  gap: .4rem;
  margin-bottom: 1.5rem;
}
.onboard-pip {
  height: 3px;
  flex: 1;
  background: var(--border);
  border-radius: 2px;
  transition: background .3s;
}
.onboard-pip.done { background: var(--accent); }
.onboard-pip.active { background: var(--muted); }

.onboard-section { display: none; }
.onboard-section.active { display: block; }

.onboard-q {
  font-size: .92rem;
  color: var(--accent);
  margin-bottom: 1rem;
  font-weight: 600;
}
.onboard-hint {
  font-size: .76rem;
  color: var(--muted);
  margin-top: -.5rem;
  margin-bottom: .8rem;
}

.form-group { margin-bottom: .9rem; }
.form-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; display: block; margin-bottom: .3rem; }
.form-input {
  width: 100%;
  padding: .55rem .75rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font);
  font-size: .85rem;
  outline: none;
  transition: border-color .2s;
}
.form-input:focus { border-color: var(--border-bright); }
.form-input::placeholder { color: var(--muted); }
.form-input.time24 { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.form-input.time24-invalid { border-color: var(--c-overdue, #ef4444); }
textarea.form-input.autogrow {
  resize: none;
  overflow: hidden;
  min-height: 2.4rem;
  line-height: 1.45;
}
.form-select {
  width: 100%;
  padding: .55rem .75rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font);
  font-size: .85rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.form-select option { background: #1a1a1a; }
.form-row { display: flex; gap: .6rem; }
.form-row .form-group { flex: 1; }

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .5rem .7rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 40px;
  align-items: center;
  cursor: text;
}
.tag-input-wrap:focus-within { border-color: var(--border-bright); }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .5rem;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .75rem;
  color: var(--fg);
}
.tag-chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  padding: 0;
}
.tag-chip-remove:hover { color: var(--accent); }
.tag-ghost-input {
  background: none;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--font);
  font-size: .82rem;
  min-width: 80px;
  flex: 1;
}

.onboard-nav { display: flex; gap: .7rem; margin-top: 1.5rem; }
.btn {
  padding: .6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: rgba(255,255,255,.12);
  border-color: var(--border-bright);
  color: var(--accent);
}
.btn-primary:hover { background: rgba(255,255,255,.2); }
.btn-secondary {
  background: transparent;
  color: var(--muted);
}
.btn-secondary:hover { color: var(--fg); }
.btn-danger {
  background: rgba(192,85,85,.15);
  border-color: rgba(192,85,85,.3);
  color: #e07070;
}
.btn-danger:hover { background: rgba(192,85,85,.25); }
.btn-full { width: 100%; justify-content: center; display: flex; }

/* ── Main App Layout ── */
#main-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
#main-app.hidden { display: none; }

/* Sidebar (desktop) */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  z-index: 100;
}
.sidebar-logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  padding: 0 1.25rem 1.5rem;
  letter-spacing: -.05em;
}
.sidebar-logo span { font-size: .72rem; color: var(--muted); font-weight: 400; display: block; letter-spacing: 0; }

/* Logo image sizes (auth screen, onboarding, sidebar) */
.logo-img { width: 72px; height: 72px; border-radius: 16px; }
.logo-img-sm { width: 34px; height: 34px; border-radius: 8px; vertical-align: middle; margin-bottom: .35rem; }
.nav-items { flex: 1; display: flex; flex-direction: column; gap: .15rem; padding: 0 .6rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .83rem;
  cursor: pointer;
  transition: color .2s, background .2s;
  user-select: none;
  border: none;
  background: none;
  font-family: var(--font);
  text-align: left;
  width: 100%;
}
.nav-item:hover { color: var(--fg); background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--accent); background: rgba(255,255,255,.06); }
.nav-item .nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.sidebar-footer { padding: .6rem; border-top: 1px solid var(--border); margin-top: .5rem; }

/* Main content area */
#content {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
}
#content::-webkit-scrollbar { width: 4px; }
#content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Views */
.view { display: none; padding: 1.5rem; min-height: 100%; }
.view.active { display: block; }

/* ── Dashboard ── */
.dash-greeting {
  margin-bottom: 1.5rem;
}
.dash-greeting h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.02em;
}
.dash-greeting .dash-date {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .15rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  transition: border-color .2s;
}
.dash-card:hover { border-color: var(--border-bright); }
.dash-card-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .5rem;
  font-weight: 600;
}

/* Progress bars */
.progress-wrap { margin-top: .4rem; }
.progress-row { display: flex; align-items: center; gap: .7rem; margin-bottom: .5rem; }
.progress-label { font-size: .76rem; color: var(--muted); width: 55px; flex-shrink: 0; }
.progress-bar-outer {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .5s ease;
}
.progress-bar-inner.green { background: var(--c-done); }
.progress-bar-inner.amber { background: var(--c-in-progress); }
.progress-pct { font-size: .74rem; color: var(--muted); width: 32px; text-align: right; flex-shrink: 0; }

/* Stats row */
.stat-row { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .5rem; }
.stat-item { display: flex; flex-direction: column; }
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-num.red { color: var(--c-overdue); }
.stat-num.amber { color: var(--c-in-progress); }
.stat-num.green { color: var(--c-done); }
.stat-label { font-size: .7rem; color: var(--muted); margin-top: .1rem; }

/* Sleep card */
.sleep-info { display: flex; align-items: baseline; gap: .5rem; }
.sleep-countdown { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.sleep-countdown.urgent { color: var(--c-overdue); }
.sleep-sub { font-size: .76rem; color: var(--muted); }

/* Upcoming list */
.upcoming-list { display: flex; flex-direction: column; gap: .4rem; }
.upcoming-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem .5rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.025);
  font-size: .8rem;
}
.upcoming-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.upcoming-time { color: var(--muted); font-size: .74rem; flex-shrink: 0; min-width: 60px; }
.upcoming-title { color: var(--fg); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Priority list */
.priority-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .65rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.025);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background .15s;
}
.priority-item:hover { background: rgba(255,255,255,.05); }
.priority-item.overdue { border-left-color: var(--c-overdue, #d47474); }
.prio-status-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
}
.prio-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  flex-shrink: 0;
}
.prio-dot.in-progress {
  background: #e5c063;
  box-shadow: 0 0 6px rgba(229,192,99,.7);
  animation: prio-pulse 1.6s ease-in-out infinite;
}
.prio-dot.overdue { background: #d47474; }
.prio-dot.idle { background: rgba(255,255,255,.2); }
@keyframes prio-pulse {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; }
}
.prio-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.prio-title-row { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.prio-title { color: var(--fg); font-size: .82rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.prio-course {
  font-size: .66rem; padding: .08rem .4rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.prio-meta { display: flex; gap: .55rem; font-size: .7rem; color: var(--muted); align-items: center; }
.prio-due { }
.prio-due.overdue { color: #d47474; font-weight: 500; }
.prio-est { opacity: .8; }
.prio-status-tag {
  padding: .05rem .35rem; border-radius: 3px; font-size: .66rem; text-transform: uppercase;
  letter-spacing: .03em;
}
.prio-status-tag.in-progress { background: rgba(229,192,99,.15); color: #e5c063; }
.prio-score {
  position: relative;
  font-size: .72rem; font-variant-numeric: tabular-nums;
  color: var(--muted); opacity: .65; flex-shrink: 0;
  min-width: 24px; text-align: right;
  padding: .15rem .35rem; border-radius: 6px;
  cursor: help;
  transition: background .15s, opacity .15s;
}
.prio-score.has-ai { opacity: .9; background: rgba(255,255,255,.04); color: var(--fg); }
.prio-score.fallback { opacity: .45; font-style: italic; }
.prio-score:hover { opacity: 1; background: rgba(255,255,255,.08); }
.prio-score .prio-tooltip { display: none; }
.prio-score:hover .prio-tooltip { display: block; }
.prio-tooltip {
  position: absolute; right: 0; top: calc(100% + 4px);
  width: 240px; z-index: 50;
  background: #151515; border: 1px solid var(--border-bright, rgba(255,255,255,.18));
  border-radius: 8px; padding: .55rem .65rem;
  box-shadow: 0 6px 22px rgba(0,0,0,.55);
  font-size: .68rem; color: var(--fg); line-height: 1.35;
  text-align: left; font-style: normal;
  cursor: default;
}
.prio-reason { font-size: .72rem; color: var(--fg); margin-bottom: .35rem; line-height: 1.4; font-weight: 500; }
.prio-bar-row { display: flex; align-items: center; gap: .4rem; margin: .12rem 0; font-size: .64rem; }
.prio-bar-label { flex-shrink: 0; width: 62px; color: var(--muted); text-transform: lowercase; }
.prio-bar-track { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.prio-bar-fill { height: 100%; background: linear-gradient(90deg, #5d8fc4, #7ac492); border-radius: 3px; }
.prio-bar-val { flex-shrink: 0; width: 20px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.prio-stamp { margin-top: .35rem; font-size: .62rem; color: var(--muted); opacity: .7; }
.prio-reason-row { margin-top: .15rem; font-size: .7rem; line-height: 1.3; color: var(--muted); opacity: .82; }
.prio-reason-inline { font-style: italic; }

/* ── Insights pane ── */
.insights-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; padding-bottom: .8rem;
  border-bottom: 1px solid var(--border);
}
.insights-title { font-weight: 600; font-size: .95rem; color: var(--fg); }
.insights-sub { font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.btn-small {
  padding: .35rem .7rem; font-size: .72rem; border-radius: 6px;
  background: transparent; border: 1px solid var(--border-bright, rgba(255,255,255,.2));
  color: var(--fg); cursor: pointer; font-family: var(--font);
}
.btn-small:hover { background: rgba(255,255,255,.06); }
.insights-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .85rem;
}
.insight-dim {
  border: 1px solid var(--border); border-radius: 8px; padding: .65rem .75rem;
  background: rgba(255,255,255,.015);
}
.insight-dim.empty { opacity: .55; }
.insight-dim-head {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: .55rem; font-size: .72rem;
}
.insight-dim-label { font-weight: 600; color: var(--accent, #d4a843); text-transform: lowercase; }
.insight-cov {
  flex: 1; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.06); overflow: hidden;
}
.insight-cov-fill {
  height: 100%; background: linear-gradient(90deg, #5d8fc4, #7ac492);
}
.insight-dim-cov { font-size: .66rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.insight-empty { font-size: .7rem; color: var(--muted); font-style: italic; }
.insight-item {
  padding: .35rem 0; border-bottom: 1px dashed rgba(255,255,255,.06);
}
.insight-item:last-child { border-bottom: none; }
.insight-item-text { font-size: .76rem; color: var(--fg); line-height: 1.4; }
.insight-item-meta {
  display: flex; gap: .5rem; align-items: center;
  margin-top: .25rem; font-size: .62rem; color: var(--muted);
}
.insight-conf { font-variant-numeric: tabular-nums; }
.insight-src { opacity: .65; text-transform: lowercase; }
.insight-del {
  margin-left: auto; background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: .9rem; padding: 0 .3rem; line-height: 1;
}
.insight-del:hover { color: var(--c-overdue, #d47474); }

/* ── Tasks View ── */
.view-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.view-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  flex: 1;
}
.filter-bar { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter-btn {
  padding: .3rem .7rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: .74rem;
  cursor: pointer;
  transition: all .2s;
}
.filter-btn:hover { color: var(--fg); border-color: var(--border-bright); }
.filter-btn.active { color: var(--accent); border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.06); }

.task-list { display: flex; flex-direction: column; gap: .5rem; }
.task-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.task-card:hover { border-color: var(--border-bright); background: var(--glass-hover); }
.task-card.done { opacity: .5; }
.task-status-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: border-color .2s, background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-status-btn.not_started { border-color: var(--c-not-started); background: rgba(176,85,85,.1); }
.task-status-btn.in_progress { border-color: var(--c-in-progress); background: rgba(200,168,56,.18); }
.task-status-btn.done { border-color: var(--c-done); background: rgba(90,158,111,.2); }
.task-status-btn.done::after { content: ''; display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--c-done); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: .87rem; color: var(--fg); font-weight: 500; }
.task-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; align-items: center; }
.task-tag {
  font-size: .68rem;
  padding: .1rem .35rem;
  border-radius: 4px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  color: var(--muted);
}
.task-tag.overdue { color: var(--c-overdue); border-color: rgba(192,85,85,.3); }
.task-tag.today { color: var(--c-in-progress); border-color: rgba(212,168,67,.3); }
.task-priority-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.priority-critical { background: var(--c-critical); }
.priority-high { background: var(--c-high); }
.priority-medium { background: var(--c-medium); }
.priority-low { background: var(--c-low); }

/* Add task button */
.add-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: .82rem;
  cursor: pointer;
  transition: all .2s;
  margin-top: .5rem;
}
.add-btn:hover { color: var(--fg); border-color: var(--border-bright); background: rgba(255,255,255,.03); }

/* ── Calendar View ── */
.cal-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cal-nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.cal-nav-btn:hover { color: var(--fg); border-color: var(--border-bright); }
.cal-month-label { font-size: 1rem; font-weight: 700; color: var(--accent); }
.cal-view-btns { display: flex; gap: .3rem; margin-left: auto; }
.cal-view-btn {
  padding: .25rem .6rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: .74rem;
  cursor: pointer;
  transition: all .2s;
}
.cal-view-btn.active { color: var(--accent); border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.06); }

.cal-grid-wrap { overflow-x: auto; }
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 560px;
}
.cal-day-header {
  background: var(--bg-panel);
  padding: .4rem .3rem;
  font-size: .68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
}
.cal-day {
  background: var(--bg);
  padding: .4rem .35rem;
  min-height: 80px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
/* Schedule view: semester tab row */
.sched-sem-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .55rem; }
.sched-sem-tab {
  padding: .3rem .65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.sched-sem-tab:hover { color: var(--fg); border-color: var(--border-bright); background: rgba(255,255,255,.05); }
.sched-sem-tab.active { color: var(--accent); border-color: var(--accent); background: rgba(255,255,255,.04); }
.sched-sem-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-in-progress); display: inline-block; }

/* Cell hover highlights only when the pointer is over empty cell background,
   not when hovering a chip inside it. Chip hover is handled separately so the
   two don't stack. The type-class hover rules below match the specificity of
   the base type-class background rules (e.g. `.cal-event-chip.assignment`),
   otherwise the generic `:hover` rule loses the cascade fight and chips look
   unchanged on hover. */
.cal-day:hover:not(:has(.cal-event-chip:hover)) { background: rgba(255,255,255,.03); }
.cal-event-chip.assignment:hover,
.cal-event-chip.class:hover,
.cal-event-chip.personal:hover,
.cal-event-chip.preply:hover,
.cal-event-chip.email:hover,
.cal-event-chip.task-not_started:hover,
.cal-event-chip.task-in_progress:hover { background: rgba(255,255,255,.13); }
.cal-event-chip.task-done:hover,
.cal-event-chip.stale:hover { background: rgba(255,255,255,.07); }
.cal-day.other-month { opacity: .3; }
.cal-day.today .cal-day-num {
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day.selected { background: rgba(255,255,255,.04); }
/* Mobile dot summary - hidden on desktop, visible in mobile media block below. */
.cal-day-dots { display: none; }
.cal-day-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.cal-day-dot-more { font-size: .56rem; color: var(--muted); line-height: 1; margin-left: 2px; }
.cal-day-num { font-size: .78rem; color: var(--fg); width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.cal-day-add {
  position: absolute;
  top: .3rem;
  right: .3rem;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  background: rgba(255,255,255,.05);
  color: var(--muted);
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day:hover .cal-day-add { opacity: 1; }
.cal-day-add:hover { color: var(--fg); border-color: var(--fg); background: rgba(255,255,255,.1); }
.cal-events { margin-top: .2rem; display: flex; flex-direction: column; gap: 1px; }
.cal-event-chip {
  font-size: .62rem;
  padding: .14rem .3rem .14rem .35rem;
  border-radius: 3px;
  overflow: hidden;
  line-height: 1.3;
  border-left: 3px solid transparent;
}
.cal-event-chip .chip-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-chip .chip-course {
  font-size: .52rem;
  opacity: .68;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-chip .chip-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}
.cal-event-chip .chip-dot.not-started { background: #c87a7a; }
.cal-event-chip .chip-dot.in-progress {
  background: #d4b84a;
  box-shadow: 0 0 4px rgba(212,184,74,.75);
  animation: pulseDot 1.6s ease-in-out infinite;
}
@keyframes pulseDot {
  0%,100% { opacity: 1; }
  50% { opacity: .45; }
}
.cal-event-chip.recurring-pill {
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-style: italic;
  border-left-color: rgba(255,255,255,.18);
}
.day-row-status-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: .25rem .55rem;
  font-size: .68rem;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
  min-width: 52px;
  text-align: center;
}
.day-row-status-btn:hover { color: var(--fg); border-color: var(--fg); }
.day-row-status-btn.status-btn-not_started { color: #c87a7a; border-color: rgba(200,122,122,.4); }
.day-row-status-btn.status-btn-in_progress {
  color: #d4b84a;
  border-color: rgba(212,184,74,.55);
  box-shadow: 0 0 4px rgba(212,184,74,.3);
}
.day-row-status-btn.status-btn-done { color: #7ac492; border-color: rgba(122,196,146,.4); }
/* Unified neutral chip background. Course identity is carried entirely by
   the left border color (set inline via U.getCourseColor). Type-class rules
   no longer tint the background so the whole chip stays a calm gray and the
   colored stripe is the only thing pulling your eye. */
.cal-event-chip.assignment,
.cal-event-chip.class,
.cal-event-chip.personal,
.cal-event-chip.preply,
.cal-event-chip.email,
.cal-event-chip.task-not_started,
.cal-event-chip.task-in_progress { background: rgba(255,255,255,.045); color: var(--fg); }
.cal-event-chip.task-done { background: rgba(255,255,255,.025); color: var(--muted); text-decoration: line-through; opacity: .7; }
/* Fallback border when no course color is resolved: neutral light gray. */
.cal-event-chip:not([style*="border-left-color"]) { border-left-color: rgba(255,255,255,.22); }
.cal-event-chip.stale { text-decoration: line-through; opacity: .38; filter: grayscale(.6); }
.day-row.stale .row-title { text-decoration: line-through; opacity: .5; }
.day-row-edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  padding: .25rem .5rem;
  font-size: .7rem;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
}
.day-row-edit-btn:hover { color: var(--fg); border-color: var(--fg); }
.day-row-notes { font-size: .72rem; color: var(--muted); margin-top: .3rem; white-space: pre-wrap; line-height: 1.4; word-break: break-word; }
.day-row-notes a, .upcoming-item a { color: #8ab5c8; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.day-row-notes a:hover, .upcoming-item a:hover { color: #b2d2e0; }

/* Per-semester course editor */
.sem-course-list { display: flex; flex-direction: column; gap: .75rem; }
.sem-course-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .6rem;
  background: var(--glass);
}
.sem-course-head {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.sem-course-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.sem-course-name { flex: 1; font-size: .82rem; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: .9rem;
}
.icon-btn:hover { color: var(--danger); border-color: var(--danger); }
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
  margin-top: .45rem;
}
.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer;
  padding: 0;
  transition: transform .1s, border-color .1s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.color-custom {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.color-hex {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 4px;
  padding: .2rem .4rem;
  font-size: .7rem;
  font-family: monospace;
  width: 80px;
}

.cal-day.selected { outline: 2px solid var(--c-in-progress); outline-offset: -2px; }

/* Week view */
.cal-week-grid {
  display: grid;
  grid-template-columns: 50px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 560px;
}
.cal-week-header-cell, .cal-week-day-col { border-right: 1px solid var(--border); }
.cal-week-header-cell:last-child, .cal-week-day-col:last-child { border-right: none; }
.cal-time-col { border-right: 1px solid var(--border); }
.cal-week-header {
  background: var(--bg-panel);
  padding: .4rem .3rem;
  text-align: center;
  font-size: .72rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.cal-week-header.today { color: var(--accent); }

/* ── Quick status popup ── */
.qs-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.qs-box {
  background: var(--bg-card, #1a1a1a); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.1rem 1rem .9rem;
  min-width: 260px; max-width: 92vw;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.qs-title { font-size: .92rem; color: var(--fg); margin-bottom: .2rem; }
.qs-hint { font-size: .72rem; color: var(--muted); margin-bottom: .7rem; }
.qs-options { display: flex; flex-direction: column; gap: .35rem; }
.qs-btn {
  padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--fg); font-size: .82rem; cursor: pointer;
  text-align: left; text-transform: capitalize; transition: all .15s;
}
.qs-btn:hover { background: rgba(255,255,255,.05); }
.qs-btn.qs-not_started { border-left: 3px solid #c87a7a; }
.qs-btn.qs-in_progress { border-left: 3px solid #d4c443; }
.qs-btn.qs-done        { border-left: 3px solid #7ac492; }
.qs-btn.qs-cancelled   { border-left: 3px solid #8da0b8; opacity: .8; }
.qs-cancel {
  margin-top: .7rem; width: 100%; padding: .45rem; border: none;
  background: transparent; color: var(--muted); font-size: .76rem; cursor: pointer;
}
.qs-cancel:hover { color: var(--fg); }

/* ── Course meeting editor ── */
.course-meetings summary::-webkit-details-marker { display: none; }
.course-meetings summary::marker { content: ''; }
.course-meetings summary::before {
  content: '▸'; display: inline-block; margin-right: .3rem;
  transition: transform .15s;
}
.course-meetings[open] summary::before { transform: rotate(90deg); }
.meeting-row input[type="time"] { color-scheme: dark; }

/* In-session row highlight in day view */
.day-row.in-session { background: rgba(212, 196, 67, 0.08); }

/* Syllabus drop zone per course */
.course-syllabus summary::-webkit-details-marker { display: none; }
.course-syllabus summary::marker { content: ''; }
.course-syllabus summary::before {
  content: '▸'; display: inline-block; margin-right: .3rem;
  transition: transform .15s;
}
.course-syllabus[open] summary::before { transform: rotate(90deg); }
.syllabus-zone {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: .7rem;
  text-align: center;
  font-size: .78rem;
  color: var(--muted);
  background: rgba(255,255,255,0.02);
  transition: border-color .15s, background .15s;
}
.syllabus-zone.drag-over {
  border-color: var(--accent, #d4c443);
  background: rgba(212, 196, 67, 0.08);
  color: var(--fg);
}
.syllabus-status {
  display: flex; gap: .5rem; align-items: center;
  padding: .35rem .5rem; margin-bottom: .4rem;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  font-size: .76rem;
}
.syllabus-file { font-weight: 600; color: var(--fg); }
.syllabus-meta { color: var(--muted); flex: 1; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(18,18,18,.97);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}
.modal-box::-webkit-scrollbar { width: 3px; }
.modal-box::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-size: 1rem; font-weight: 700; color: var(--accent); }
.modal-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: .1rem .3rem;
}
.modal-close-btn:hover { color: var(--fg); }
.modal-actions { display: flex; gap: .6rem; margin-top: 1.25rem; justify-content: flex-end; }

/* ── Settings View ── */
.settings-section {
  margin-bottom: 1.5rem;
}
.settings-section-title {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .75rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 0;
  gap: 1rem;
}
.setting-label { font-size: .84rem; color: var(--fg); }
.setting-hint { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
/* Toggle */
.toggle-wrap { display: flex; align-items: center; }
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.1);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s;
  border: 1px solid var(--border);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-slider { background: rgba(90,158,111,.25); border-color: rgba(90,158,111,.4); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--c-done); }

/* ── Bottom Nav (mobile) ── */
#bottom-nav {
  display: none;
  height: var(--bottom-nav-h);
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.bottom-nav-items { display: flex; height: 100%; }
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  cursor: pointer;
  color: var(--muted);
  font-size: .62rem;
  border: none;
  background: none;
  font-family: var(--font);
  transition: color .2s;
}
.bottom-nav-item:hover { color: var(--fg); }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-icon { font-size: 1.1rem; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,20,.95);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: .55rem 1.1rem;
  font-size: .8rem;
  color: var(--fg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 1000;
  max-width: 320px;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(192,85,85,.4); color: #e07070; }
.toast.success { border-color: rgba(90,158,111,.4); color: #7ac492; }

/* ── Loading spinner ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: .85rem;
}
.empty-state-icon { font-size: 2rem; margin-bottom: .75rem; opacity: .4; }

/* ── Mobile hamburger + drawer backdrop (desktop hides both) ── */
.mobile-hamburger {
  display: none;
  position: fixed;
  top: max(.6rem, env(safe-area-inset-top));
  left: .6rem;
  z-index: 150;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(20,20,20,.85);
  backdrop-filter: blur(6px);
  color: var(--fg);
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s, border-color .15s;
}
.mobile-hamburger:hover { background: rgba(40,40,40,.9); border-color: var(--border-bright); }

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0,0,0,0);
  transition: background .22s ease;
}
body.drawer-open .drawer-backdrop { background: rgba(0,0,0,.55); }

/* Push notifications are mobile-only. Hide push UI on desktop, show note. */
.push-only-wrap { display: none; }
.push-desktop-note { display: block; opacity: .7; font-style: italic; }

/* ── Responsive: Mobile ── */
@media (max-width: 768px) {
  .push-only-wrap { display: revert; }
  .push-desktop-note { display: none; }
  #bottom-nav { display: none !important; }
  #main-app { flex-direction: column; }
  #content { flex: 1; overflow-y: auto; padding-top: 3rem; }
  .view { padding: 1rem .9rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .cal-grid-wrap { overflow-x: hidden; }
  .cal-month-grid { min-width: 0; }
  .cal-week-grid { min-width: 0; }
  /* Google-calendar-style: compact tiles, day number centered, colored dots
     below. Event chips + add button are hidden - the full day view is one tap
     away via the day sheet. */
  .cal-day {
    min-height: 52px;
    padding: .3rem .1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }
  .cal-day-num { font-size: .76rem; }
  .cal-day .cal-events { display: none; }
  .cal-day .cal-day-add { display: none; }
  .cal-day-dots {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    padding: 0 2px;
  }
  .cal-event-chip { font-size: .58rem; }

  /* Day sheet - full-screen overlay for a single day's items. */
  .mobile-day-sheet {
    position: fixed;
    inset: 0;
    z-index: 180;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .mobile-day-sheet.hidden { display: none; }
  .mobile-day-sheet-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: calc(.6rem + env(safe-area-inset-top)) .9rem .6rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    position: sticky;
    top: 0;
    z-index: 1;
  }
  .mobile-day-sheet-back,
  .mobile-day-sheet-add {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    color: var(--fg);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  .mobile-day-sheet-title { flex: 1; font-size: 1rem; font-weight: 600; color: var(--fg); }
  .mobile-day-sheet-body { padding: .9rem; padding-bottom: calc(.9rem + env(safe-area-inset-bottom)); }

  /* Hamburger visible */
  .mobile-hamburger { display: flex; }

  /* Sidebar becomes slide-out drawer */
  #sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 160;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.9,.3,1);
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
    width: 260px;
    padding-top: calc(.8rem + env(safe-area-inset-top));
    will-change: transform;
  }
  body.drawer-open #sidebar { transform: translateX(0); }
  body.drawer-open .drawer-backdrop { display: block; }

  /* Modals go full-sheet on small screens */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-box { width: 100%; max-width: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 0; border: none; padding-top: calc(1rem + env(safe-area-inset-top)); padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 1100px) and (min-width: 769px) {
  :root { --sidebar-w: 175px; }
}

/* ── Sleep view mini ── */
.sleep-log-list { display: flex; flex-direction: column; gap: .4rem; }
.sleep-log-item {
  display: flex;
  gap: .7rem;
  align-items: center;
  padding: .45rem .7rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .8rem;
}
.sleep-log-date { color: var(--muted); min-width: 80px; }
.sleep-log-times { color: var(--fg); flex: 1; }
.sleep-log-quality { color: var(--muted); font-size: .72rem; }

/* ── Inline editable text ── */
.inline-edit { cursor: text; border-bottom: 1px dashed transparent; transition: border-color .2s; }
.inline-edit:hover { border-color: var(--border-bright); }
.inline-edit:focus { outline: none; border-color: var(--accent); }

/* ── Scrollbar global ── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ── Chat markdown ── */


/* ── Goals ── */
.goal-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem 1rem;
  margin-bottom: 1rem;
}
.goal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .6rem; flex-wrap: wrap; }
.goal-title { font-size: 1rem; color: var(--fg); font-weight: 600; text-transform: lowercase; }
.goal-meta { font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.goal-range { display: flex; gap: .25rem; }
.goal-range-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: .18rem .55rem; font-size: .7rem; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font); }
.goal-range-btn.active { background: rgba(122,196,146,.12); border-color: rgba(122,196,146,.4); color: var(--c-done, #7ac492); }
.goal-chart { width: 100%; margin: .3rem 0 .6rem; }
.goal-svg { width: 100%; height: auto; display: block; }
.goal-chart-empty { font-size: .78rem; color: var(--muted); padding: 1.2rem .5rem; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.goal-log-form { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.goal-log-input { flex: 1; min-width: 120px; background: rgba(0,0,0,.3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .6rem; color: var(--fg); font-family: var(--font); font-size: .85rem; }
.goal-log-input:focus { outline: none; border-color: var(--border-bright); }
.goal-trend { font-size: .7rem; color: var(--muted); margin-top: .55rem; font-style: italic; }

.goal-prompt {
  background: rgba(122,196,146,.06);
  border: 1px solid rgba(122,196,146,.22);
  border-radius: var(--radius);
  padding: .6rem .8rem;
  margin-bottom: .5rem;
}
.goal-prompt-text { font-size: .8rem; color: var(--fg); margin-bottom: .4rem; }
.goal-prompt form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.goal-prompt-input { flex: 0 1 120px; background: rgba(0,0,0,.3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .35rem .55rem; color: var(--fg); font-family: var(--font); font-size: .8rem; }
.goal-prompt-input:focus { outline: none; border-color: var(--border-bright); }
.goal-prompt-link { font-size: .72rem; color: var(--muted); margin-left: auto; text-decoration: none; }

/* ── Day zoom panel ── */
.day-zoom { border: 1px solid var(--border); border-radius: var(--radius); background: var(--glass); padding: .9rem; margin-top: .9rem; }
.day-zoom-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.day-zoom-title { font-size: 1rem; color: var(--accent); font-weight: 600; }
.day-zoom-section { margin-bottom: .75rem; }
.day-zoom-section-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .3rem; }

/* ── Task timer indicator ── */
.timer-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem; color: var(--c-in-progress); padding: .1rem .4rem; border: 1px solid rgba(200,168,56,.3); border-radius: 3px; }
.timer-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c-in-progress); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Settings (list + pane layout) ── */
.settings-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--glass);
}
.settings-list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .95rem 1.1rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s;
  width: 100%;
}
.settings-list-item:last-child { border-bottom: 0; }
.settings-list-item:hover { background: var(--glass-hover); }
.settings-list-main { flex: 1; }
.settings-list-label { font-size: .92rem; color: var(--fg); margin-bottom: .15rem; }
.settings-list-hint { font-size: .74rem; color: var(--muted); }
.settings-list-chevron { color: var(--muted); font-size: 1.1rem; line-height: 1; }

.pane-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.2rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--border);
}
.pane-back {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 1rem;
  cursor: pointer;
  font-family: var(--font);
  line-height: 1;
  transition: all .15s;
  flex-shrink: 0;
}
.pane-back:hover { background: var(--glass-hover); border-color: var(--border-bright); }
.pane-title { font-size: 1.1rem; color: var(--fg); font-weight: 600; }
.pane-sub { font-size: .74rem; color: var(--muted); margin-top: .1rem; }

.pane-body { display: flex; flex-direction: column; gap: 1rem; }
.pane-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.pane-divider { border-top: 1px solid var(--border); margin: .5rem 0; }
.pane-help { margin-top: .75rem; font-size: .78rem; color: var(--muted); }
.pane-help summary { cursor: pointer; color: var(--fg); padding: .35rem 0; }
.pane-help summary:hover { color: var(--accent); }
.pane-help ol { margin: .4rem 0 0 1.2rem; line-height: 1.7; color: var(--muted); }

.form-hint { font-size: .72rem; color: var(--muted); margin-bottom: .4rem; line-height: 1.5; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .4rem;
  margin-top: .3rem;
}
.check-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .82rem;
  color: var(--fg);
  cursor: pointer;
  padding: .35rem .5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--glass);
  transition: all .15s;
}
.check-row:hover { border-color: var(--border-bright); }
.check-row input[type=checkbox] { accent-color: var(--accent); }

.integration-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass);
  padding: 1rem 1.1rem;
}
.integration-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.integration-title { font-size: .92rem; color: var(--fg); font-weight: 600; }
.integration-sub { font-size: .74rem; color: var(--muted); margin-top: .2rem; }
.integration-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.integration-dot.ok { background: var(--c-done); box-shadow: 0 0 0 3px rgba(90,158,111,.15); }
.integration-dot.warn { background: var(--c-in-progress); box-shadow: 0 0 0 3px rgba(200,168,56,.15); }
.integration-dot.off { background: var(--muted); }

.account-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--glass);
  padding: 1rem 1.1rem;
}
.account-name { font-size: 1rem; color: var(--fg); font-weight: 600; }
.account-sub { font-size: .74rem; color: var(--muted); margin-top: .15rem; }

/* ── Schedule view ── */
.sched-filter-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: .3rem .7rem; border-radius: 999px; font-family: var(--font); font-size: .74rem; cursor: pointer; transition: all .15s; }
.sched-filter-btn:hover { color: var(--fg); border-color: var(--border-bright); }
.sched-filter-btn.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.sched-group { margin-bottom: 1.1rem; }
.sched-group-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .35rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }
.sched-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.sched-row:hover { background: var(--glass); }
.sched-row-left { display: flex; align-items: center; gap: .5rem; min-width: 90px; flex-shrink: 0; }
.sched-time { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 45px; }
.sched-event-dot { width: 10px; height: 10px; border-radius: 50%; background: #7ac492; flex-shrink: 0; }
.sched-event-dot[data-type="assignment"] { background: #d4a843; }
.sched-event-dot[data-type="class"] { background: #6a9fd4; }
.sched-event-dot[data-type="preply"] { background: #b07add; }
.sched-event-dot[data-type="email"] { background: #8ab5c8; }
.sched-row-body { flex: 1; min-width: 0; }
.sched-row-title { font-size: .88rem; color: var(--fg); margin-bottom: .15rem; }
.sched-row-meta { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .7rem; color: var(--muted); align-items: center; }
.sched-kind-badge { padding: .05rem .35rem; border-radius: 3px; font-size: .66rem; border: 1px solid var(--border-bright); }
.sched-kind-badge.task { color: var(--c-in-progress); border-color: rgba(200,168,56,.35); }
.sched-kind-badge.event { color: #7ac492; border-color: rgba(122,196,146,.35); }
.sched-source-badge { padding: .05rem .35rem; border-radius: 3px; font-size: .66rem; background: rgba(255,255,255,.05); color: var(--muted); }
.sched-updated { margin-left: auto; font-style: italic; opacity: .7; }
.sched-del-btn { background: transparent; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: .2rem .4rem; border-radius: 4px; transition: all .12s; }
.sched-del-btn:hover { color: var(--c-overdue); background: rgba(192,85,85,.1); }

/* ── Weekly schedule grid ── */
#schedule-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; }
@media (max-width: 900px) { #schedule-week { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { #schedule-week { grid-template-columns: 1fr; } }
.sched-day { border: 1px solid var(--border); border-radius: var(--radius); background: var(--glass); display: flex; flex-direction: column; min-height: 140px; }
.sched-day.today { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg) inset; }
.sched-day-head { display: flex; align-items: center; justify-content: space-between; padding: .5rem .65rem; border-bottom: 1px solid var(--border); }
.sched-day-label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.sched-day.today .sched-day-label { color: var(--fg); }
.sched-day-add { background: transparent; border: 1px solid var(--border); color: var(--muted); width: 22px; height: 22px; border-radius: 4px; cursor: pointer; line-height: 1; font-size: .9rem; transition: all .12s; }
.sched-day-add:hover { color: var(--fg); border-color: var(--border-bright); background: rgba(255,255,255,.04); }
.sched-day-body { padding: .4rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.sched-day-empty { color: var(--muted); font-size: .72rem; opacity: .5; padding: .3rem .2rem; }
.sched-item { background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .55rem; cursor: pointer; transition: all .12s; }
.sched-item:hover { background: rgba(255,255,255,.07); border-color: var(--border-bright); }
.sched-item-time { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: .1rem; }
.sched-item-title { font-size: .82rem; color: var(--fg); line-height: 1.25; }
.sched-item-meta { font-size: .66rem; color: var(--muted); margin-top: .15rem; }
.cal-event-chip.recurring { opacity: .82; border-left: 2px solid var(--fg); padding-left: .3rem; }

/* Notepad */
.notepad-wrap {
  flex: 1; display: flex; flex-direction: column;
  padding: 0 1rem 1rem;
}
.notepad-editor {
  flex: 1; min-height: 60vh;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  color: var(--fg);
  font-family: 'Fira Code', monospace;
  font-size: .85rem;
  line-height: 1.7;
  outline: none;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.notepad-editor:empty::before {
  content: attr(placeholder);
  color: var(--muted);
  opacity: .5;
}
.notepad-editor img {
  max-width: 100%;
  border-radius: 8px;
  margin: .5rem 0;
  display: block;
}
.notepad-editor:focus {
  border-color: var(--border-bright);
}
.notepad-status {
  font-size: .72rem;
  color: var(--muted);
  margin-left: auto;
}


/* ── Accessibility helpers ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable]:focus-visible {
  outline: 1.5px solid rgba(255,255,255,.45);
  outline-offset: 1px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Boot skeletons ── */
.dash-card.skeleton { min-height: 110px; }
.skel-line {
  height: .8rem;
  border-radius: 6px;
  margin: .55rem 0;
  background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.10) 50%, rgba(255,255,255,.05) 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.4s ease-in-out infinite;
}
.skel-line.w30 { width: 30%; }
.skel-line.w40 { width: 40%; }
.skel-line.w55 { width: 55%; }
.skel-line.w60 { width: 60%; }
.skel-line.w65 { width: 65%; }
.skel-line.w70 { width: 70%; }
@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Goal card stats + stepper ── */
.goal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .6rem 0 .75rem;
}
.goal-stat {
  flex: 1 1 90px;
  min-width: 90px;
  padding: .5rem .6rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.goal-stat-val { font-size: .92rem; font-weight: 700; color: var(--fg); }
.goal-stat-val.good { color: var(--c-done); }
.goal-stat-val.bad { color: var(--c-overdue); }
.goal-stat-label { font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-top: .15rem; }
.goal-step-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  color: var(--fg);
  font-size: 1rem;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s;
}
.goal-step-btn:hover { background: rgba(255,255,255,.09); }
@media (max-width: 768px) {
  .goal-log-form { flex-wrap: wrap; }
  .goal-log-form .goal-log-input { min-width: 110px; }
}
