/* ═══════════════════════════════════════════════════════════
   CONTEXTCLOCK — Design System
   Palette: Volcanic Glass + Indigo Accents
   Fonts: Clash Display + Outfit
═══════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg-base:       #111113;
  --bg-surface:    #1A1A1E;
  --bg-elevated:   #222228;
  --bg-hover:      #2A2A32;
  --border:        #2E2E38;
  --border-light:  #3A3A46;

  --text-primary:  #F0EEF8;
  --text-secondary:#9896A8;
  --text-muted:    #5C5A6A;

  --accent:        #FF6B2B;
  --accent-soft:   #FF8C55;
  --accent-glow:   rgba(255, 107, 43, 0.18);
  --accent-2:      #7B68EE;
  --accent-2-soft: #9D8FF5;
  --accent-2-glow: rgba(123, 104, 238, 0.18);

  --success:       #4ADE80;
  --warning:       #FBBF24;
  --danger:        #F87171;

  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     18px;
  --radius-xl:     24px;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.6);
  --shadow-accent: 0 4px 24px rgba(255,107,43,0.25);

  --sidebar-w:     240px;
  --transition:    0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

h1, h2, h3, h4 {
  font-family: 'Clash Display', sans-serif;
  font-weight: 600;
  line-height: 1.15;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════
   ONBOARDING OVERLAY
═══════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.overlay.active { opacity: 1; pointer-events: all; }

.onboarding-container {
  width: 100%;
  max-width: 480px;
  position: relative;
}

.onboarding-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 3rem;
  font-family: 'Clash Display', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.logo-mark {
  font-size: 1.4rem;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent));
}

.onboarding-step {
  display: none;
  animation: fadeSlideUp 0.4s ease forwards;
}
.onboarding-step.active { display: block; }

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

.step-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.step-title {
  font-family: 'Clash Display', sans-serif;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.1;
}
.step-title em {
  font-style: normal;
  color: var(--accent);
}

.step-body {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 380px;
  line-height: 1.7;
}

.onboarding-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  transition: border-color var(--transition);
  outline: none;
}
.onboarding-input:focus { border-color: var(--accent); }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.choice-btn {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition);
  text-align: center;
}
.choice-btn:hover { border-color: var(--border-light); background: var(--bg-hover); }
.choice-btn.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: var(--shadow-accent);
}

.choice-icon { font-size: 1.6rem; }
.choice-label { font-family: 'Clash Display', sans-serif; font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.choice-sub { font-size: 0.7rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  font-family: 'Clash Display', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.8rem 1.8rem;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.btn-primary:hover {
  background: var(--accent-soft);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--border-light); background: var(--bg-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }

.btn-start {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff;
  font-family: 'Clash Display', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition);
  box-shadow: var(--shadow-accent);
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(255,107,43,0.4); }

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border: 1.5px solid rgba(248, 113, 113, 0.3);
  font-size: 0.875rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

/* ═══════════════════════════════════════════
   APP SHELL
═══════════════════════════════════════════ */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.app-shell.hidden { display: none; }

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

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Clash Display', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.logo-text { color: var(--text-primary); }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  text-align: left;
  width: 100%;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { color: var(--text-primary); background: var(--bg-elevated); }
.nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.5rem;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Clash Display', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-status { font-size: 0.7rem; color: var(--text-muted); }

/* ── Mobile Header ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 200;
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition);
}

.mobile-logo {
  font-family: 'Clash Display', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-add-btn {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 2rem 2.5rem;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ── Views ── */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ── View Header ── */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.view-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.view-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   CONTEXT BAR
═══════════════════════════════════════════ */
.context-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.context-pill.high { border-color: var(--success); color: var(--success); background: rgba(74,222,128,0.08); }
.context-pill.medium { border-color: var(--warning); color: var(--warning); background: rgba(251,191,36,0.08); }
.context-pill.low { border-color: var(--danger); color: var(--danger); background: rgba(248,113,113,0.08); }

/* ═══════════════════════════════════════════
   HERO SECTION — Score Ring + Top Task
═══════════════════════════════════════════ */
.hero-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
}

/* Diagonal accent line */
.hero-section::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

/* Score Ring */
.score-ring-container {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  margin: auto;
}

.score-ring {
  width: 160px;
  height: 160px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 10;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1),
              stroke 0.5s ease;
  filter: drop-shadow(0 0 6px var(--accent));
}

.score-ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.score-number {
  font-family: 'Clash Display', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.score-label {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.3rem;
  line-height: 1.3;
}

/* Top Task Panel */
.top-task-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
}

.top-task-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.top-task-title {
  font-family: 'Clash Display', sans-serif;
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.top-task-reason {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.top-task-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.top-task-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   TASK QUEUE
═══════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.task-queue {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Task Card */
.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.task-card:hover {
  border-color: var(--border-light);
  background: var(--bg-elevated);
  transform: translateX(3px);
}
.task-card.rank-1 {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--bg-surface), rgba(255,107,43,0.05));
}
.task-card.rank-1::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 3px 0 0 3px;
}
.task-card.done {
  opacity: 0.45;
}
.task-card.in-progress {
  border-color: var(--accent-2);
  background: linear-gradient(135deg, var(--bg-surface), rgba(123,104,238,0.05));
}

.task-rank {
  font-family: 'Clash Display', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}
.task-rank.top { color: var(--accent); }

.task-card-body { min-width: 0; }

.task-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.3rem;
}
.task-card.done .task-card-name { text-decoration: line-through; color: var(--text-muted); }

.task-card-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  letter-spacing: 0.04em;
}
.tag-cat   { background: var(--bg-hover); color: var(--text-secondary); }
.tag-energy { background: rgba(251,191,36,0.12); color: var(--warning); }
.tag-time  { background: rgba(123,104,238,0.12); color: var(--accent-2-soft); }
.tag-priority-urgent { background: rgba(248,113,113,0.15); color: var(--danger); }
.tag-priority-high   { background: rgba(255,107,43,0.12); color: var(--accent-soft); }
.tag-priority-medium { background: rgba(74,222,128,0.1); color: var(--success); }
.tag-priority-low    { background: var(--bg-hover); color: var(--text-muted); }
.tag-duration { background: var(--bg-hover); color: var(--text-muted); }

.task-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.score-badge {
  font-family: 'Clash Display', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
  min-width: 44px;
  text-align: center;
}
.score-badge.high { color: var(--success); border-color: rgba(74,222,128,0.3); }
.score-badge.medium { color: var(--warning); border-color: rgba(251,191,36,0.3); }
.score-badge.low { color: var(--danger); border-color: rgba(248,113,113,0.3); }

.task-card-actions {
  display: flex;
  gap: 0.3rem;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
  font-size: 0.8rem;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn.complete:hover { color: var(--success); }
.icon-btn.edit:hover { color: var(--accent-2-soft); }
.icon-btn.delete:hover { color: var(--danger); }

/* ═══════════════════════════════════════════
   ALL TASKS VIEW
═══════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.45rem 1rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.filter-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.filter-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }

.all-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Full task row (all tasks view) */
.task-row {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition);
}
.task-row:hover { border-color: var(--border-light); background: var(--bg-elevated); }

.task-row-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-row-check:hover { border-color: var(--success); }
.task-row-check.checked { background: var(--success); border-color: var(--success); }
.task-row-check.checked::after { content: '✓'; font-size: 0.65rem; color: #000; font-weight: 700; }

.task-row-body { flex: 1; min-width: 0; }
.task-row-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.2rem; }
.task-row.done .task-row-name { text-decoration: line-through; color: var(--text-muted); }
.task-row-sub { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 0.5rem; flex-wrap: wrap; }

.task-row-score {
  font-family: 'Clash Display', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.task-row-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }

/* ═══════════════════════════════════════════
   ANALYTICS VIEW
═══════════════════════════════════════════ */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-light); }
.stat-card.accent { border-color: var(--accent); background: linear-gradient(135deg, var(--bg-surface), var(--accent-glow)); }

.stat-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }
.stat-value { font-family: 'Clash Display', sans-serif; font-size: 2rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

/* Heatmap */
.heatmap-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 60px repeat(24, 1fr);
  gap: 3px;
  min-width: 600px;
}

.heatmap-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  font-weight: 500;
}

.heatmap-hour-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  padding-bottom: 4px;
}

.heatmap-cell {
  height: 22px;
  border-radius: 3px;
  background: var(--bg-elevated);
  transition: all var(--transition);
}
.heatmap-cell:hover { transform: scale(1.2); }
.heatmap-cell.l1 { background: rgba(255,107,43,0.15); }
.heatmap-cell.l2 { background: rgba(255,107,43,0.35); }
.heatmap-cell.l3 { background: rgba(255,107,43,0.6); }
.heatmap-cell.l4 { background: rgba(255,107,43,0.85); }

/* Category Bars */
.category-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cat-bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 40px;
  align-items: center;
  gap: 1rem;
}

.cat-bar-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }

.cat-bar-track {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-bar-count { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-align: right; }

/* Completions List */
.completions-list { display: flex; flex-direction: column; gap: 0.5rem; }

.completion-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.completion-name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.completion-meta { font-size: 0.72rem; color: var(--text-muted); }
.completion-score { font-family: 'Clash Display', sans-serif; font-size: 0.85rem; font-weight: 700; color: var(--success); }

/* ═══════════════════════════════════════════
   SETTINGS VIEW
═══════════════════════════════════════════ */
.settings-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.settings-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.settings-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-row label { font-size: 0.875rem; color: var(--text-secondary); flex-shrink: 0; }

.settings-input, .settings-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
  min-width: 180px;
}
.settings-input:focus, .settings-select:focus { border-color: var(--accent); }
.settings-select option { background: var(--bg-elevated); }

.slider-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.slider-row label { display: flex; justify-content: space-between; width: 100%; }
.slider-row label span { color: var(--accent); font-weight: 600; }

.settings-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
  outline: none;
}
.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent);
}

.danger-zone { border-color: rgba(248,113,113,0.2); }

/* ═══════════════════════════════════════════
   MODALS
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-sm { max-width: 400px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.modal-body { padding: 1.5rem; }
.modal-desc { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 1.5rem; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* Form Elements */
.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-select option { background: var(--bg-elevated); }
.form-textarea { resize: vertical; min-height: 60px; }

/* Category Picker */
.category-picker, .duration-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cat-btn, .dur-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
}
.cat-btn:hover, .dur-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.cat-btn.active, .dur-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* Energy Slider */
.energy-slider-container { text-align: center; }

.energy-emoji {
  font-size: 3rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  display: block;
}

.energy-range {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
  outline: none;
  margin-bottom: 0.5rem;
}
.energy-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 2px solid var(--accent);
}

.energy-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.energy-value-display {
  font-family: 'Clash Display', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}
.energy-display-label { font-size: 1rem; color: var(--text-muted); }

/* Clarity Picker */
.clarity-picker {
  display: flex;
  gap: 0.5rem;
}
.clarity-btn {
  flex: 1;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
  text-align: center;
}
.clarity-btn:hover { border-color: var(--border-light); }
.clarity-btn.active { color: var(--accent-2-soft); border-color: var(--accent-2); background: var(--accent-2-glow); }

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 0.7rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  z-index: 9000;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .mobile-header { display: flex; }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: 72px;
    max-width: 100vw;
  }

  .hero-section {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .score-ring-container { margin: 0 auto; }
  .top-task-actions { justify-content: center; }
  .top-task-meta { justify-content: center; }

  .form-row { grid-template-columns: 1fr; }

  .choice-grid { grid-template-columns: 1fr; }

  .header-actions { width: 100%; }
  .header-actions .btn-secondary { display: none; }

  .analytics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .view-title { font-size: 1.5rem; }
  .analytics-grid { grid-template-columns: 1fr 1fr; }
  .task-card { grid-template-columns: auto 1fr; }
  .task-card-right { display: none; }
}

/* ── Sidebar overlay on mobile ── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-backdrop.show { display: block; }