/* ============================================
   ADHD Focus App — app.css
   Palette: off-white canvas, indigo accent, clean type
   ============================================ */

:root {
  --bg:          #F8F8F5;
  --surface:     #FFFFFF;
  --border:      #E5E5E0;
  --text:        #1A1A1A;
  --text-muted:  #6B7280;
  --text-light:  #9CA3AF;
  --accent:      #6366F1;
  --accent-soft: #EEF2FF;
  --accent-dark: #4F46E5;
  --green:       #22C55E;
  --green-soft:  #F0FDF4;
  --amber:       #F59E0B;
  --amber-soft:  #FFFBEB;
  --red:         #EF4444;
  --red-soft:    #FEF2F2;
  --sidebar-w:   220px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,.08);
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* ── Layout ────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  padding: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.3px;
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-user {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s;
}
.btn-logout:hover { color: var(--red); }

/* ── Main content ──────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}
.main-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 32px;
}

/* ── Page headers ──────────────────────────── */
.page-header {
  margin-bottom: 32px;
}
.page-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.4px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Grid ──────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Stat tiles ────────────────────────────── */
.stat-tile { text-align: center; padding: 20px 16px; }
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 36px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Focus Score ring ──────────────────────── */
.score-ring-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
}
.score-ring { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.score-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s ease;
}
.score-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-ring-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.score-ring-sub { font-size: 11px; color: var(--text-muted); }
.score-desc h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.score-desc p  { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); border: 1px solid transparent; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 7px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Alerts ─────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
}
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid #FECACA; }
.alert-success { background: var(--green-soft); color: #15803D; border: 1px solid #BBF7D0; }

/* ── Tasks list ─────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.task-item:hover { border-color: #D1D5DB; }
.task-item.done { opacity: .5; }
.task-item.done .task-title { text-decoration: line-through; }
.task-check {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
  background: transparent;
}
.task-check:hover { border-color: var(--accent); }
.task-item.done .task-check { background: var(--green); border-color: var(--green); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; line-height: 1.3; }
.task-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.task-notes { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.priority-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
}
.priority-high { background: var(--red-soft); color: var(--red); }
.priority-medium { background: var(--amber-soft); color: #B45309; }
.priority-low { background: var(--green-soft); color: #15803D; }
.task-actions { display: flex; gap: 4px; flex-shrink: 0; }
.task-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s;
}
.task-delete:hover { color: var(--red); }
.due-tag { font-size: 11px; color: var(--text-muted); }
.due-tag.overdue { color: var(--red); font-weight: 500; }

/* ── Habits — genuinely simple ──────────────────────────────
   One row = one tap target. Nothing else competes for attention.
   Editing lives behind "Manage habits", not inline on every row. */

.habits-today-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
}
.habits-today-text { font-size: 14px; color: var(--text); white-space: nowrap; }
.habits-today-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.habits-today-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s ease; }

.habit-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }

.habit-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.habit-check-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.habit-check-btn:hover { border-color: var(--accent); }
.habit-check-btn.checked { background: var(--green); border-color: var(--green); }
.habit-check-icon { color: #fff; font-size: 18px; line-height: 1; }
.habit-check-disabled {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%;
  border: 2px dashed var(--border); display: inline-block;
}

.habit-label {
  flex: 1; display: flex; align-items: center; gap: 10px;
  cursor: pointer; min-width: 0;
}
.habit-emoji { font-size: 22px; flex-shrink: 0; }
.habit-name { font-size: 15px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-streak { font-size: 13px; color: #B45309; font-weight: 600; flex-shrink: 0; }

.habit-row-muted { opacity: 0.45; }
.habit-section-label {
  font-size: 12px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: .04em;
  margin: 16px 0 4px 4px;
}

.habits-footer { max-width: 360px; margin: 0 auto; }

/* ── Shared modal system (used by habits, and reusable elsewhere) ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: 14px;
  padding: 24px;
  width: 100%; max-width: 440px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ── Emoji picker ── */
.emoji-row { display: flex; gap: 12px; align-items: flex-start; }
.emoji-preview {
  width: 48px; height: 48px; flex-shrink: 0;
  border: 2px solid var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.emoji-grid {
  flex: 1;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  max-height: 120px; overflow-y: auto;
}
.emoji-pick-btn {
  background: var(--bg); border: 1px solid transparent; border-radius: 8px;
  font-size: 18px; padding: 7px 0; cursor: pointer; transition: all .12s;
}
.emoji-pick-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ── Day picker ── */
.day-picker { display: flex; gap: 6px; }
.day-toggle-btn {
  flex: 1; aspect-ratio: 1; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: inherit;
}
.day-toggle-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.day-presets { display: flex; gap: 8px; margin-top: 10px; }
.day-presets button {
  flex: 1; padding: 7px 8px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text-muted); cursor: pointer; font-family: inherit; transition: all .15s;
}
.day-presets button:hover { border-color: var(--accent); color: var(--accent); }

/* ── Manage habits modal ── */
.manage-list { display: flex; flex-direction: column; gap: 4px; }
.manage-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.manage-row:last-child { border-bottom: none; }
.manage-emoji { font-size: 18px; flex-shrink: 0; }
.manage-name { flex: 1; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-edit, .manage-delete {
  background: none; border: none; font-size: 13px; font-weight: 500;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; font-family: inherit;
}
.manage-edit { color: var(--accent); }
.manage-edit:hover { background: var(--accent-soft); }
.manage-delete { color: var(--red); }
.manage-delete:hover { background: var(--red-soft); }


/* ── Focus Timer — calm, uniform with habits page ──────────── */

.timer-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.timer-main-card {
  text-align: center;
  padding: 36px 24px;
}

.timer-phase-label {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 20px;
}

.timer-visual { position: relative; width: 220px; height: 220px; margin: 0 auto 20px; }
.timer-ring-svg { width: 220px; height: 220px; transform: rotate(-90deg); }
.timer-ring-track { fill: none; stroke: var(--border); stroke-width: 10; }
.timer-ring-progress {
  fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset .25s linear, stroke .4s ease;
}
.timer-ring-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.timer-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 46px; font-weight: 600; color: var(--text);
  letter-spacing: -1px;
}

.timer-sessions { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.session-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.session-dot.done { background: var(--accent); }

.timer-phase-msg { font-size: 13px; color: var(--text-muted); min-height: 18px; margin-bottom: 18px; }

.timer-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.timer-btn-primary {
  padding: 12px 36px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: opacity .15s;
}
.timer-btn-primary:hover { opacity: .88; }
.timer-btn-secondary {
  padding: 12px 20px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.timer-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.timer-popout-link {
  background: none; border: none; color: var(--text-light);
  font-size: 13px; cursor: pointer; font-family: inherit;
  text-decoration: underline; text-decoration-color: var(--border);
}
.timer-popout-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

.timer-side { display: flex; flex-direction: column; gap: 16px; }

.timer-presets { display: flex; gap: 8px; }
.timer-preset-btn {
  flex: 1; padding: 10px 6px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.timer-preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.timer-toggle-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; font-size: 13px; color: var(--text);
}

.timer-stat-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; }
.timer-stat-num { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 600; color: var(--text); }
.timer-stat-label { font-size: 12px; color: var(--text-muted); }

@media (max-width: 768px) {
  .timer-layout { grid-template-columns: 1fr; }
  .timer-visual { width: 180px; height: 180px; }
  .timer-ring-svg { width: 180px; height: 180px; }
  .timer-clock { font-size: 38px; }
}

/* ── Planner ─────────────────────────────────── */
.planner-grid { position: relative; }
.planner-hour {
  display: grid;
  grid-template-columns: 56px 1fr;
  min-height: 60px;
  border-bottom: 1px solid var(--border);
}
.planner-hour:last-child { border-bottom: none; }
.planner-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-light);
  padding: 8px 8px 0 0;
  text-align: right;
}
.planner-slot { position: relative; padding: 4px 0; }
.planner-block {
  margin: 2px 4px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  position: relative;
}
.planner-block-delete {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.2); border: none; color: #fff;
  cursor: pointer; border-radius: 3px; font-size: 12px; padding: 1px 5px;
  opacity: 0; transition: opacity .15s;
}
.planner-block:hover .planner-block-delete { opacity: 1; }

/* ── Dashboard quick lists ───────────────────── */
.quick-tasks { display: flex; flex-direction: column; gap: 6px; }
.quick-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.quick-task-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.quick-task-dot.high { background: var(--red); }
.quick-task-dot.low  { background: var(--green); }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state-icon { font-size: 32px; margin-bottom: 10px; }

/* ── Login page ─────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-md);
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo-icon { font-size: 36px; color: var(--accent); display: block; line-height: 1; }
.auth-logo-name { font-size: 22px; font-weight: 600; letter-spacing: -.3px; margin-top: 8px; }
.auth-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.auth-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-switch a { color: var(--accent); font-weight: 500; }

/* ── Misc helpers ───────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
}
.badge-indigo { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: var(--green-soft); color: #15803D; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title { font-size: 15px; font-weight: 600; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-inner { padding: 20px 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .timer-clock { font-size: 56px; }
  .timer-settings { grid-template-columns: 1fr 1fr 1fr; }
}

/* ── New feature additions ──────────────────────────────────────────────────*/

/* Mood selector */
.mood-btn {
  display: inline-block;
  border-radius: 50%;
  transition: opacity .15s, transform .15s;
}
.mood-btn:hover { opacity: .8 !important; }

/* Brain dump kbd hint */
kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* Analytics grid */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Goal progress bars */
.goal-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}
.goal-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
}

/* XP level-up flash */
@keyframes levelUp {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.level-up { animation: levelUp .4s ease; }

/* Reminder datetime input */
input[type="datetime-local"] { color-scheme: light; }

/* Review modal fade in */
#review-modal { animation: fadeIn .25s ease; }
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Toast container */
#toast-container { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 768px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════
   V3 ADDITIONS
   Dark mode, mobile nav, subtasks, quick-add
   ══════════════════════════════════════════ */

/* ── Dark mode ──────────────────────────── */
html.dark {
  --bg:         #111113;
  --surface:    #1C1C1F;
  --border:     #2C2C30;
  --text:       #F0F0EE;
  --text-muted: #8A8A96;
  --text-light: #55555F;
  --accent-soft:#6366F120;
}
html.dark .card { background: var(--surface); border-color: var(--border); }
html.dark .form-input,
html.dark .form-select,
html.dark .form-textarea { background: #16161A; border-color: var(--border); color: var(--text); }
html.dark .btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
html.dark .btn-ghost:hover { background: var(--border); color: var(--text); }
html.dark .task-item,
html.dark .habit-row { background: var(--surface); border-color: var(--border); }
html.dark .quick-task-item { background: var(--border); }
html.dark .planner-hour { border-color: var(--border); }
html.dark .timer-preset { border-color: var(--border); }
html.dark .timer-preset:hover,
html.dark .timer-preset.active { background: var(--accent-soft); border-color: var(--accent); }
html.dark .priority-high   { background: #3B0A0A; color: #F87171; }
html.dark .priority-medium { background: #3B2800; color: #FCD34D; }
html.dark .priority-low    { background: #0A2E1A; color: #4ADE80; }
html.dark .badge-indigo { background: #6366F130; color: #A5B4FC; }
html.dark .badge-green  { background: #22C55E20; color: #4ADE80; }
html.dark .alert-error   { background: #3B0A0A; color: #F87171; border-color: #7F1D1D; }
html.dark .alert-success { background: #0A2E1A; color: #4ADE80; border-color: #14532D; }
html.dark #quick-add-modal > div,
html.dark #task-modal > div,
html.dark #breakdown-modal > div,
html.dark #templates-modal > div,
html.dark #recurring-modal > div,
html.dark #goal-modal > div,
html.dark #habit-modal > div,
html.dark #block-modal > div { background: var(--surface); }
html.dark .nav-item { color: var(--text-muted); }
html.dark .nav-item:hover { background: var(--border); color: var(--text); }
html.dark .sidebar { background: #16161A; border-color: var(--border); }
html.dark .sidebar-brand { border-color: var(--border); }
html.dark .auth-card { background: var(--surface); border-color: var(--border); }
html.dark body { background: var(--bg); color: var(--text); }

/* ── Mobile top bar ─────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 97;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
html.dark .mobile-topbar { background: #16161A; border-color: var(--border); }

/* ── Sidebar mobile open ────────────────── */
.sidebar-close { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); margin-left: auto; }

/* ── Quick-add tabs ─────────────────────── */
.qa-tab {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  font-family: inherit;
}
.qa-tab.active, .qa-tab:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ── Subtasks ───────────────────────────── */
.subtask-list { margin: 8px 0 4px 4px; display: flex; flex-direction: column; gap: 4px; }
.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.subtask-item.done .subtask-title { text-decoration: line-through; opacity: .6; }
.subtask-check {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  transition: all .15s;
  color: #fff;
}
.subtask-check:hover { border-color: var(--green); }
.subtask-item.done .subtask-check { background: var(--green); border-color: var(--green); }
.subtask-title { flex: 1; }
.subtask-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 14px;
  padding: 0 3px; border-radius: 3px;
  opacity: 0; transition: opacity .15s, color .15s;
}
.subtask-item:hover .subtask-delete { opacity: 1; }
.subtask-delete:hover { color: var(--red); }
.subtask-add {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  margin-left: 4px;
}
.subtask-input {
  flex: 1;
  padding: 5px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.subtask-input:focus { border-color: var(--accent); }

/* ── Toggle switch ──────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Mobile responsive ──────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .mobile-topbar { display: flex; }
  .main { margin-left: 0; padding-top: 56px; }
  .main-inner { padding: 20px 16px; }

  .sidebar {
    position: fixed;
    left: -240px;
    width: 240px;
    transition: left .25s ease;
    z-index: 99;
  }
  .sidebar.open { left: 0; }
  .sidebar-close { display: block; }

  #fab { bottom: 20px; right: 20px; width: 46px; height: 46px; font-size: 20px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .timer-clock { font-size: 56px; }
  .timer-settings { grid-template-columns: 1fr 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header .btn, .page-header div[style*="gap"] { width: 100%; }
  .score-ring-wrap { flex-direction: column; text-align: center; }
}

/* ── Achievement grid mobile ────────────── */
@media (max-width: 500px) {
  div[style*="auto-fill,minmax(200px"] { grid-template-columns: 1fr 1fr !important; }
}

/* ── Period picker for goals (v6) ───────────────────────────── */
.period-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.period-tab {
  flex: 1; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; text-align: center; font-family: inherit;
}
.period-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Planner date-jump (v6) ─────────────────────────────────── */
.planner-jump { display: flex; gap: 8px; align-items: center; }
.planner-jump input[type="date"] { padding: 7px 10px; }

/* ── Colour themes (v6) ──────────────────────────────────────
   Each theme overrides --accent / --accent-dark / --accent-soft.
   Applied via [data-theme] attribute on <html>, set by JS from
   localStorage. Works alongside dark mode (html.dark[data-theme]). */

[data-theme="calm"]     { --accent: #0EA5E9; --accent-dark: #0284C7; --accent-soft: #E0F2FE; }
[data-theme="warm"]     { --accent: #F97316; --accent-dark: #EA580C; --accent-soft: #FFEDD5; }
[data-theme="contrast"] {
  --accent: #000000; --accent-dark: #000000; --accent-soft: #E5E5E5;
  --text: #000000; --border: #000000; --text-muted: #333333;
}
html.dark[data-theme="calm"]     { --accent: #38BDF8; --accent-soft: #0EA5E920; }
html.dark[data-theme="warm"]     { --accent: #FB923C; --accent-soft: #F9731620; }
html.dark[data-theme="contrast"] {
  --accent: #FFFFFF; --accent-dark: #FFFFFF; --accent-soft: #333333;
  --text: #FFFFFF; --border: #FFFFFF; --bg: #000000; --surface: #000000; --text-muted: #CCCCCC;
}

.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-swatch {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text);
  transition: all .15s; font-family: inherit; text-align: left;
}
.theme-swatch:hover { border-color: var(--accent); }
.theme-swatch.active { border-color: var(--accent); background: var(--accent-soft); }
.theme-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,.1); }
