/* ============================================================
   TRACKIT! v2 — style.css
   Instrument Serif display · Manrope body · DM Mono data
   Refined editorial-minimalist productivity aesthetic
   ============================================================ */

/* ── Tokens ── */
:root {
  --bg:           #f6f5f2;
  --bg-2:         #efeee9;
  --surface:      #ffffff;
  --surface-2:    #f9f8f5;
  --border:       #e4e3de;
  --border-2:     #d4d3cc;
  --text:         #18180f;
  --text-2:       #5a594f;
  --text-3:       #9b9a90;
  --text-inv:     #f6f5f2;
  --accent:       #3a7a5c;
  --accent-dim:   #edf5f0;
  --accent-border:#b4d9c5;
  --danger:       #b94040;
  --danger-dim:   #fdf0f0;
  --sidebar-w:    240px;
  --topbar-h:     52px;
  --font-serif:   'Instrument Serif', Georgia, serif;
  --font-sans:    'Manrope', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --r-sm:         4px;
  --r:            8px;
  --r-lg:         14px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.07);
  --shadow:       0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.13);
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --t:            160ms;
}

[data-theme="dark"] {
  --bg:           #111109;
  --bg-2:         #1a1a12;
  --surface:      #1f1f17;
  --surface-2:    #252518;
  --border:       #2a2a20;
  --border-2:     #38382c;
  --text:         #f0efe8;
  --text-2:       #9b9a8c;
  --text-3:       #5a5a4f;
  --text-inv:     #111109;
  --accent:       #5aad82;
  --accent-dim:   #1a2e24;
  --accent-border:#2e5c40;
  --danger:       #d46060;
  --danger-dim:   #2a1515;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.3);
  --shadow:       0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.45);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
button { cursor: pointer; font-family: inherit; border: none; background: none; transition: all var(--t) var(--ease); }
input, textarea { font-family: inherit; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform var(--t) var(--ease), background var(--t) var(--ease);
}
.sidebar-top { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.brand-mark {
  width: 30px; height: 30px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 400;
  flex-shrink: 0;
}
.brand-name { font-size: 1rem; font-weight: 600; letter-spacing: -0.02em; }
.brand-dot { color: var(--accent); }

.btn-new-habit {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r);
  font-size: 0.8125rem;
  color: var(--text-2);
  font-weight: 500;
}
.btn-new-habit svg { width: 13px; height: 13px; flex-shrink: 0; }
.btn-new-habit:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.habit-list { flex: 1; overflow-y: auto; padding: 8px 8px; }
.habit-list::-webkit-scrollbar { width: 3px; }
.habit-list::-webkit-scrollbar-track { background: transparent; }
.habit-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.habit-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 0.825rem;
  color: var(--text-2);
  font-weight: 500;
  position: relative;
  overflow: hidden;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.habit-item:hover { background: var(--bg); color: var(--text); }
.habit-item.active { background: var(--bg-2); color: var(--text); }
.habit-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.habit-item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.habit-item-pct {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  font-weight: 400;
  flex-shrink: 0;
}
.habit-item.active .habit-item-pct { color: var(--text-2); }

.habit-list-empty {
  padding: 16px 10px;
  font-size: 0.8rem;
  color: var(--text-3);
  text-align: center;
  font-style: italic;
}

.sidebar-bottom {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-action {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r);
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 500;
  text-align: left;
}
.sb-action svg { width: 14px; height: 14px; flex-shrink: 0; }
.sb-action:hover { background: var(--bg); color: var(--text-2); }
.sidebar-version {
  padding: 8px 10px 4px;
  font-size: 0.7rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-weight: 300;
}

/* ── Mobile top bar ── */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 60;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.topbar-menu, .topbar-add {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  border-radius: var(--r-sm);
}
.topbar-menu svg, .topbar-add svg { width: 18px; height: 18px; }
.topbar-menu:hover, .topbar-add:hover { background: var(--bg); color: var(--text); }
.topbar-title { font-weight: 600; font-size: 0.9rem; letter-spacing: -0.01em; }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 49;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Main ── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.view { padding: 48px 52px; max-width: 860px; }

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 60px;
}
.empty-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.empty-title {
  font-family: var(--font-serif);
  font-size: clamp(3.5rem, 8vw, 5.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.empty-accent { color: var(--accent); }
.empty-sub {
  font-size: 1rem;
  color: var(--text-2);
  font-weight: 300;
  line-height: 1.7;
  max-width: 420px;
  margin-bottom: 36px;
}
.btn-primary-lg {
  padding: 13px 24px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 52px;
}
.btn-primary-lg:hover { opacity: 0.8; transform: translateY(-1px); }
.btn-primary-lg:active { transform: translateY(0); }

.empty-features {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 10px 28px;
}
.ef-item { font-size: 0.82rem; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.ef-icon { color: var(--accent); font-size: 0.7rem; }

/* ── Detail header ── */
.detail-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 32px;
}
.detail-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.detail-color-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.detail-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.detail-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.detail-meta {
  font-size: 0.8rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-weight: 300;
}
.detail-actions { display: flex; gap: 6px; }
.action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  font-size: 0.775rem;
  color: var(--text-2);
  font-weight: 500;
}
.action-btn svg { width: 12px; height: 12px; }
.action-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border-2); }
.action-btn.danger:hover { background: var(--danger-dim); color: var(--danger); border-color: var(--danger); }

/* ── Stats strip ── */
.stats-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--surface);
}
.stat-card {
  flex: 1;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.stat-card:last-child { border-right: none; }
.stat-num {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
}
.stat-lbl {
  font-size: 0.68rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  white-space: nowrap;
}
.accent-card .stat-num { color: var(--accent); }

/* ── Progress bar ── */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}
.progress-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 500ms var(--ease);
}
.progress-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  white-space: nowrap;
  font-weight: 400;
}

/* ── Grid ── */
.grid-section { margin-bottom: 48px; }
.grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.grid-title { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-2); }
.grid-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.gl-item { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; color: var(--text-3); }
.gl-dot {
  width: 9px; height: 9px;
  border-radius: 2px;
  border: 1px solid;
}
.gl-done { background: var(--accent-dim); border-color: var(--accent-border); }
.gl-noted { background: #fef3e2; border-color: #f5c976; }
[data-theme="dark"] .gl-noted { background: #2a2000; border-color: #5a4000; }
.gl-todo { background: var(--surface-2); border-color: var(--border-2); }
.gl-sep { font-size: 0.7rem; color: var(--text-3); font-style: italic; }

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 5px;
}

/* Day cell */
.day-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-3);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease),
              color var(--t) var(--ease), transform var(--t) var(--ease),
              box-shadow var(--t) var(--ease);
}
.day-cell:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.day-cell:active { transform: translateY(0); box-shadow: none; }
.day-cell.done {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 500;
}
.day-cell.has-note { box-shadow: inset 0 -2px 0 0 #f5c976; }
[data-theme="dark"] .day-cell.has-note { box-shadow: inset 0 -2px 0 0 #5a4000; }
.day-cell.done.has-note { box-shadow: inset 0 -2px 0 0 #f5c976; }
.cell-check {
  position: absolute;
  top: 2px; right: 3px;
  font-size: 0.5rem;
  color: var(--accent);
  opacity: 0.75;
  font-family: var(--font-sans);
}
.cell-note-dot {
  position: absolute;
  bottom: 3px; right: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #f5c976;
}
[data-theme="dark"] .cell-note-dot { background: #8a6400; }

/* Pop animation */
@keyframes cellPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.88); }
  65%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.day-cell.pop { animation: cellPop 230ms var(--ease) forwards; }

/* ── Notes timeline ── */
.notes-section { border-top: 1px solid var(--border); padding-top: 28px; }
.notes-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.notes-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}
.notes-list { display: flex; flex-direction: column; gap: 12px; }
.note-entry {
  display: flex;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  animation: fadeUp 250ms var(--ease);
}
@keyframes fadeUp { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }
.note-entry-day {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  padding-top: 2px;
  min-width: 44px;
}
.note-entry-text { font-size: 0.875rem; color: var(--text-2); line-height: 1.6; font-weight: 300; }
.notes-empty { font-size: 0.825rem; color: var(--text-3); font-style: italic; padding: 4px 0; }

/* ── Archive view ── */
.arch-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.arch-title { font-family: var(--font-serif); font-size: 2rem; font-weight: 400; letter-spacing: -0.02em; }
.arch-list { display: flex; flex-direction: column; gap: 12px; }
.arch-card {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: 14px;
}
.arch-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.arch-info { flex: 1; }
.arch-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 3px; }
.arch-sub { font-size: 0.78rem; color: var(--text-3); font-family: var(--font-mono); font-weight: 300; }
.arch-pct { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 400; color: var(--text-2); }
.arch-restore {
  padding: 6px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 0.775rem;
  color: var(--text-2);
  font-weight: 500;
}
.arch-restore:hover { border-color: var(--accent); color: var(--accent); }
.arch-empty { font-size: 0.9rem; color: var(--text-3); font-style: italic; padding: 16px 0; }

/* ── Shared buttons ── */
.text-btn { font-size: 0.825rem; color: var(--text-3); font-weight: 500; padding: 4px 0; border-bottom: 1px solid transparent; }
.text-btn:hover { color: var(--text-2); border-color: var(--border-2); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
  animation: backdropIn 160ms var(--ease);
}
@keyframes backdropIn { from { opacity:0; } to { opacity:1; } }
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 200ms var(--ease);
}
.modal-sm { max-width: 400px; }
@keyframes modalIn { from { opacity:0; transform: scale(0.96) translateY(8px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  color: var(--text-3);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* Form elements */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.775rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.form-input::placeholder { color: var(--text-3); }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  line-height: 1.6;
}
.form-textarea::placeholder { color: var(--text-3); }
.form-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.char-count { font-size: 0.7rem; color: var(--text-3); text-align: right; font-family: var(--font-mono); }
.form-input[type="date"] { color-scheme: light; }
[data-theme="dark"] .form-input[type="date"] { color-scheme: dark; }

.dur-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.dur-btn {
  padding: 7px 14px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  transition: all var(--t) var(--ease);
}
.dur-btn:hover { border-color: var(--accent); color: var(--accent); }
.dur-btn.active { background: var(--text); border-color: var(--text); color: var(--bg); }

.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
  position: relative;
}
.cp-btn:hover { transform: scale(1.15); }
.cp-btn.active { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px currentColor; transform: scale(1.1); }

.note-day-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 300;
}
.note-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-2);
  padding: 4px 0;
}

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  display: block;
  width: 40px; height: 22px;
  background: var(--border-2);
  border-radius: 99px;
  position: relative;
  transition: background var(--t) var(--ease);
  cursor: pointer;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--t) var(--ease);
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }

.btn-primary-sm {
  padding: 9px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.btn-primary-sm:hover { opacity: 0.82; }
.btn-ghost {
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  color: var(--text-2);
  font-weight: 500;
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); border-color: var(--border-2); }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r);
  font-size: 0.825rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 280ms var(--ease);
  pointer-events: auto;
  max-width: 300px;
}
@keyframes toastIn { from { opacity:0; transform: translateY(12px) scale(0.96); } to { opacity:1; transform: translateY(0) scale(1); } }
.toast.out { animation: toastOut 220ms var(--ease) forwards; }
@keyframes toastOut { to { opacity:0; transform: translateY(8px) scale(0.96); } }
.toast.success { background: var(--accent); }
.toast.danger { background: var(--danger); color: white; }

/* ── Confetti canvas ── */
#confettiCanvas {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 998;
  width: 100%; height: 100%;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    transition: transform 220ms var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .main { margin-left: 0; padding-top: var(--topbar-h); }
  .view { padding: 28px 20px; }
  .stats-strip { flex-wrap: wrap; }
  .stat-card { flex: 1 1 calc(33% - 1px); min-width: 80px; }
  .empty-features { grid-template-columns: repeat(2, auto); }
  .empty-title { font-size: 3rem; }
}

@media (max-width: 480px) {
  .view { padding: 20px 14px; }
  .stat-card { padding: 12px 10px 10px; }
  .stat-num { font-size: 1.1rem; }
  .day-grid { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; }
  .detail-actions { flex-wrap: wrap; }
  .empty-features { grid-template-columns: repeat(2, auto); gap: 8px 20px; }
}

/* ── Print styles ── */
@media print {
  .sidebar, .topbar, .detail-actions, .toast-container { display: none; }
  .main { margin-left: 0; }
  .view { padding: 0; }
}
