@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=IBM+Plex+Mono:wght@400;600&family=IBM+Plex+Sans:wght@300;400;600&display=swap');

:root {
  --bg:            #09090e;
  --surface:       #111118;
  --card:          #15151e;
  --card2:         #1a1a25;
  --border:        #242436;
  --border2:       #30304a;
  --text:          #ece9ff;
  --muted:         #5a5a7a;
  --muted2:        #8888aa;

  /* Purple family */
  --accent:        #c4b5fd;   /* lavender */
  --violet:        #a78bfa;   /* violet */
  --amethyst:      #bf94ff;   /* bright amethyst */
  --grape:         #9061ea;   /* deep grape */
  --lilac:         #e4d4fe;   /* near-white lilac */
  --amber:         #fcd34d;
  --coral:         #fca5a5;
  --mint:          #6ee7b7;

  /* Pastel habit colors */
  --lavender: #c4b5fd;
  --sky:      #7dd3fc;
  --rose:     #f9a8d4;

  /* Glow tints */
  --purple-glow:   rgba(139, 92, 246, 0.12);
  --amethyst-glow: rgba(191, 148, 255, 0.10);
  --amber-glow:    rgba(252, 211, 77,  0.10);
  --grape-glow:    rgba(144, 97,  234, 0.10);
}

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

html { overflow-x: clip; }
body { overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 19px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}

/* Mesh background glow */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 45% at 50% -5%,  rgba(124, 106, 247, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 40% 35% at 0%   105%, rgba(144,  97, 234, 0.09) 0%, transparent 50%),
    radial-gradient(ellipse 35% 30% at 110% 80%,  rgba(191, 148, 255, 0.07) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 100px;
}

/* ── Page header ── */
.page-header { margin-bottom: 28px; }

.header-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 8px;
}

.back-arrow {
  position: absolute;
  left: 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 1;
  transition: opacity 0.2s, transform 0.2s;
  opacity: 0.75;
}
.back-arrow:hover { opacity: 1; transform: scale(1.08); }

.notif-bell {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  padding: 0;
  transition: color 0.2s;
}
.notif-bell:hover { color: var(--text); }

.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}
.notif-badge.hidden { display: none; }

/* Notification drawer */
.notif-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 340px; height: 100dvh;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  z-index: 200;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}
.notif-drawer.hidden { display: none; }
.notif-drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted2);
}
.notif-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1; transition: color 0.2s;
}
.notif-close:hover { color: var(--text); }
.notif-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
}
.notif-item.unread { border-color: var(--accent); }
.notif-item-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.notif-item-body  { font-size: 12px; color: var(--muted2); margin-bottom: 6px; }
.notif-item-time  { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.notif-test-btn {
  background: rgba(196,181,253,0.1); border: 1px solid var(--accent);
  border-radius: 999px; color: var(--accent);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.08em;
  padding: 4px 12px; cursor: pointer; transition: background 0.2s;
}
.notif-test-btn:hover { background: rgba(196,181,253,0.18); }

@media (max-width: 600px) {
  .notif-drawer { width: 100%; border-left: none; border-top: 1px solid var(--border2); }
}

.page-header-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px; color: var(--amethyst);
  letter-spacing: 5px; text-transform: uppercase; opacity: 0.75;
}
.page-header-h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(40px, 5vw, 80px);
  line-height: 1; letter-spacing: 3px; text-align: center;
}
.page-header-h1 span { color: var(--amethyst); }

/* ── Main layout ── */
.habits-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
.habits-layout > * { min-width: 0; }
@media (max-width: 900px) { .habits-layout { grid-template-columns: 1fr; } }

@media (max-width: 600px) {
  .container { padding: 20px 20px 80px; }
  .page-header-h1 { font-size: clamp(32px, 10vw, 48px); letter-spacing: 1px; }
  .stats-strip { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-block { padding: 14px 10px; }
  .panel-body { padding: 18px 20px 28px; }

  /* Streak badge: absolute bottom-right corner on mobile */
  .habit-row { padding-bottom: 28px; }
  .habit-streak {
    position: absolute;
    bottom: 7px; right: 10px;
    font-size: 12px;
    padding: 2px 8px;
  }
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
}
.card-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; letter-spacing: 0.14em;
  color: var(--amethyst); text-transform: uppercase;
  margin-bottom: 18px;
  display: flex; justify-content: space-between; align-items: center;
  opacity: 0.8;
}

/* ── Today section ── */
.today-date {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 33px; letter-spacing: 2px;
  color: var(--text); margin-bottom: 4px;
}
.today-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px; color: var(--muted2); margin-bottom: 16px;
}

/* Progress bar */
.progress-wrap { margin-bottom: 20px; }
.progress-label {
  display: flex; justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px; color: var(--muted2); margin-bottom: 8px;
}
.progress-label span:last-child { color: var(--amethyst); font-weight: 600; }
.progress-track {
  height: 6px; background: var(--border2);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--amethyst));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ── Habit list ── */
.habit-list { display: flex; flex-direction: column; gap: 8px; }

.habit-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.habit-row:hover {
  border-color: var(--border2);
  background: color-mix(in srgb, var(--card2) 85%, rgba(139,92,246,0.2));
}
.habit-row.done { border-color: rgba(139,92,246,0.2); }

/* Pill color indicator — replaces ::before bar */
.habit-row .habit-pill {
  width: 4px;
  height: 60%;
  min-height: 28px;
  border-radius: 999px;
  background: var(--habit-color, var(--muted));
  flex-shrink: 0;
}

/* Check button */
.habit-check {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--habit-color, var(--border2));
  background: transparent;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; position: relative;
  color: transparent; font-size: 19px;
}
.habit-row.done .habit-check {
  background: var(--habit-color);
  border-color: var(--habit-color);
  color: #09090e;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--habit-color) 25%, transparent);
}
.habit-row.done .habit-check::after {
  content: '✓';
  position: absolute; font-size: 18px; font-weight: 700; color: #09090e;
}

/* Emoji */
.habit-emoji { font-size: 25px; flex-shrink: 0; line-height: 1; }

/* Name + meta */
.habit-info { flex: 1; min-width: 0; }
.habit-name {
  font-size: 19px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.2s;
}
.habit-row.done .habit-name { color: var(--muted2); text-decoration: line-through; text-decoration-color: var(--muted); }
.habit-freq {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; color: var(--muted); margin-top: 2px;
}

/* Quantitative counter */
.habit-counter { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.counter-btn {
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--card);
  color: var(--muted2); font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; line-height: 1;
}
.counter-btn:hover { border-color: var(--amethyst); color: var(--amethyst); }
.counter-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 17px; color: var(--text);
  min-width: 40px; text-align: center;
}

/* Streak badge */
.habit-streak {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px; color: var(--muted2); flex-shrink: 0;
  display: flex; align-items: center; gap: 3px; white-space: nowrap;
  background: var(--card); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 999px;
}
.habit-streak.hot {
  color: var(--amber);
  background: var(--amber-glow);
  border-color: rgba(252,211,77,0.3);
}

/* Reminder badge */
.reminder-badge {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  color: var(--coral); padding: 3px 9px;
  border: 1px solid rgba(252,165,165,0.3); border-radius: 999px;
  background: rgba(252,165,165,0.06); flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Not due today */
.habit-row.not-due { opacity: 0.32; pointer-events: none; }

/* Empty state */
.habits-empty {
  text-align: center; padding: 48px 20px;
  color: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 17px;
}
.habits-empty-icon { font-size: 37px; margin-bottom: 12px; opacity: 0.4; }

/* ── Calendar heatmap ── */
.calendar-wrap { margin-bottom: 20px; }
.cal-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
.cal-month {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 25px; letter-spacing: 2px; color: var(--text);
}
.cal-nav { display: flex; gap: 6px; }
.cal-nav-btn {
  width: 30px; height: 30px;
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 999px; color: var(--muted2);
  cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cal-nav-btn:hover { border-color: var(--amethyst); color: var(--amethyst); }

.cal-days-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px; margin-bottom: 3px;
}
.cal-day-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  color: var(--muted); text-align: center;
  letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 0;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-cell {
  aspect-ratio: 1; border-radius: 10px;
  background: var(--border); cursor: default;
  transition: transform 0.15s; position: relative;
}
.cal-cell.today    { outline: 2px solid var(--amethyst); outline-offset: 1px; }
.cal-cell.selected { outline: 2px solid var(--amber);    outline-offset: 1px; }
.cal-cell.other-month { opacity: 0.2; }
.cal-cell:hover { transform: scale(1.12); z-index: 1; }
.cal-cell-num {
  position: absolute; bottom: 2px; right: 3px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  color: rgba(255,255,255,0.3); line-height: 1;
}
.cal-perfect {
  position: absolute; top: 2px; left: 3px;
  font-size: 13px; line-height: 1;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(252,211,77,0.9), 0 0 16px rgba(252,211,77,0.4);
}

/* ── Stats strip ── */
.stats-strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.stat-block {
  border: 1px solid var(--border); border-radius: 999px;
  padding: 16px 20px; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px;
}
/* Per-card color tints */
.stat-block:nth-child(1) {
  background: var(--purple-glow);
  border-color: rgba(167, 139, 250, 0.25);
}
.stat-block:nth-child(2) {
  background: var(--amber-glow);
  border-color: rgba(252, 211, 77, 0.2);
}
.stat-block:nth-child(3) {
  background: var(--grape-glow);
  border-color: rgba(144, 97, 234, 0.2);
}
.stat-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px;
}
.stat-block:nth-child(1) .stat-label { color: var(--violet); }
.stat-block:nth-child(2) .stat-label { color: var(--amber); }
.stat-block:nth-child(3) .stat-label { color: var(--grape); }

.stat-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 40px; line-height: 1; letter-spacing: 1px;
}
.stat-block:nth-child(1) .stat-val { color: var(--amethyst); }
.stat-block:nth-child(2) .stat-val { color: var(--amber); }
.stat-block:nth-child(3) .stat-val { color: var(--lilac); }

.stat-sub { display: none; }

/* ── Side panel (add/edit) ── */
.panel-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 90;
  backdrop-filter: blur(4px);
}
.panel-backdrop.hidden { display: none; }

.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 400px;
  overflow-x: hidden; background: var(--surface);
  border-left: 1px solid var(--border2); z-index: 100;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22,1,0.36,1);
  box-shadow: -16px 0 48px rgba(0,0,0,0.5);
}
.side-panel.open { transform: translateX(0); }

@media (max-width: 768px) {
  .side-panel {
    left: 0; right: 0; width: 100%;
    top: auto; bottom: 0; height: 92dvh;
    border-left: none; border-radius: 22px 22px 0 0;
    border-top: 1px solid var(--border2);
    transform: translateY(100%);
  }
  .side-panel.open { transform: translateY(0); }
}

.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.panel-title {
  font-family: 'Bebas Neue', sans-serif; font-size: 29px;
  letter-spacing: 2px; color: var(--text);
}
.panel-close {
  background: none; border: none; color: var(--muted);
  font-size: 27px; cursor: pointer; transition: color 0.15s;
}
.panel-close:hover { color: var(--text); }

.panel-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 22px 24px 32px;
  display: flex; flex-direction: column; gap: 18px;
}
.panel-body > * { min-width: 0; }

/* Form fields */
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field label {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  letter-spacing: 0.1em; color: var(--amethyst); text-transform: uppercase; opacity: 0.8;
}
.form-field input,
.form-field select,
.form-field textarea {
  background: var(--card); border: 1px solid var(--border2);
  color: var(--text); font-family: 'IBM Plex Mono', monospace; font-size: 17px;
  padding: 10px 14px; border-radius: 12px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s; width: 100%; min-width: 0;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--amethyst);
  box-shadow: 0 0 0 3px rgba(191,148,255,0.10);
}
.form-field textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-width: 0; }
.form-row > * { min-width: 0; }

/* Color picker */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 999px;
  cursor: pointer; border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s; position: relative;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.active { border-color: white; transform: scale(1.08); }
.color-swatch.active::after {
  content: '✓'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: rgba(0,0,0,0.7); font-weight: 700;
}

/* Weekday picker */
.weekday-picker { display: flex; gap: 6px; }
.wd-btn {
  flex: 1; padding: 7px 4px; border-radius: 999px;
  border: 1px solid var(--border2); background: var(--card);
  color: var(--muted2); font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  cursor: pointer; text-align: center; transition: all 0.15s; user-select: none;
}
.wd-btn.active { border-color: var(--amethyst); color: var(--amethyst); background: var(--amethyst-glow); }

/* Divider */
.panel-divider { height: 1px; background: var(--border); }

/* Action buttons */
.panel-actions { display: flex; gap: 10px; }
.btn {
  font-family: 'IBM Plex Mono', monospace; font-size: 16px;
  letter-spacing: 0.05em; padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--border2); background: var(--card);
  color: var(--text); cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn:hover { border-color: var(--amethyst); color: var(--amethyst); }
.btn-accent {
  border-color: rgba(191,148,255,0.4);
  background: var(--amethyst-glow); color: var(--amethyst); flex: 1;
}
.btn-accent:hover { background: rgba(191,148,255,0.18); border-color: var(--amethyst); }
.btn-danger { border-color: rgba(252,165,165,0.3); color: var(--coral); }
.btn-danger:hover { background: rgba(252,165,165,0.08); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  font-family: 'IBM Plex Mono', monospace; font-size: 17px;
  padding: 12px 20px; border-radius: 999px;
  background: var(--card2); border: 1px solid var(--border2);
  color: var(--text); z-index: 300;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: none; }
.toast.ok  { border-color: rgba(110,231,183,0.4); color: var(--mint); }
.toast.err { border-color: rgba(252,165,165,0.4); color: var(--coral); }

/* ── Confirm Modal ── */
.confirm-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); z-index: 400; display: flex;
  align-items: center; justify-content: center; opacity: 0;
  pointer-events: none; transition: opacity 0.2s;
}
.confirm-backdrop.open { opacity: 1; pointer-events: auto; }
.confirm-modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 24px; width: 320px;
  max-width: 90vw; text-align: center;
  transform: scale(0.95) translateY(10px); transition: transform 0.2s;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.confirm-backdrop.open .confirm-modal { transform: none; }
.confirm-modal h3 {
  font-family: 'Bebas Neue', sans-serif; font-size: 24px;
  letter-spacing: 1px; color: var(--text); margin-bottom: 8px;
}
.confirm-modal p {
  font-family: 'IBM Plex Mono', monospace; font-size: 14px;
  color: var(--muted2); margin-bottom: 24px;
}
.confirm-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.confirm-actions button {
  flex: 1;
}

/* ── Emoji picker ── */
.ep-e {
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; cursor: pointer; font-size: 20px;
  padding: 4px; line-height: 1; transition: background 0.15s, border-color 0.15s;
  min-width: 0; overflow: hidden; box-sizing: border-box; width: 100%;
}
.ep-e:hover { background: var(--card2); border-color: var(--border2); }

/* ── Loading ── */
.loading {
  display: flex; align-items: center; gap: 10px;
  font-family: 'IBM Plex Mono', monospace; font-size: 17px;
  color: var(--muted); padding: 40px 0; justify-content: center;
}
.loading::before {
  content: ''; width: 16px; height: 16px;
  border: 2px solid var(--border2); border-top-color: var(--amethyst);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login screen ── */
.login-screen {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-screen.hidden { display: none; }
.login-card {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 32px;
}
.login-icon { margin-bottom: 4px; }
.login-title {
  font-family: 'IBM Plex Mono', monospace; font-size: 22px;
  font-weight: 700; letter-spacing: 0.08em; color: var(--text);
  margin: 0;
}
.login-sub { font-size: 13px; color: var(--muted); margin: 0; }
.login-input {
  width: 100%; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 8px; color: var(--text); padding: 12px 14px;
  font-size: 14px; font-family: 'IBM Plex Mono', monospace;
  outline: none; transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--accent); }
.login-btn { width: 100%; padding: 12px; font-size: 14px; }
.login-error { font-size: 12px; color: var(--rose, #fca5a5); margin: -8px 0; min-height: 16px; }

/* ── Logout button ── */
.logout-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 4px 6px; opacity: 0.6; transition: opacity 0.2s;
  line-height: 1;
}
.logout-btn:hover { opacity: 1; }

/* ── Add habit FAB ── */
.fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 54px; height: 54px; border-radius: 999px;
  background: linear-gradient(135deg, var(--grape), var(--amethyst));
  border: none; color: #fff; font-size: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(144,97,234,0.45);
  transition: transform 0.2s, box-shadow 0.2s; z-index: 50; line-height: 1;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 32px rgba(191,148,255,0.55); }

/* ── Notification banner ── */
.notif-banner {
  background: var(--amber-glow); border: 1px solid rgba(252,211,77,0.2);
  border-radius: 999px; padding: 10px 20px;
  font-family: 'IBM Plex Mono', monospace; font-size: 15px;
  color: var(--amber); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.notif-banner button {
  margin-left: auto;
  background: rgba(252,211,77,0.1); border: 1px solid rgba(252,211,77,0.3);
  border-radius: 999px; color: var(--amber);
  font-family: 'IBM Plex Mono', monospace; font-size: 14px;
  padding: 4px 14px; cursor: pointer;
}
.notif-banner button:hover { background: rgba(252,211,77,0.18); }
.notif-banner.hidden { display: none; }

::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 999px; }

/* ── Entrance animations ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
.page-header                     { animation: fadeUp 0.4s ease both 0.04s; }
.stats-strip                     { animation: fadeUp 0.4s ease both 0.10s; }
.habits-layout > div:first-child { animation: fadeUp 0.42s ease both 0.16s; }
.habits-layout > div:last-child  { animation: fadeUp 0.42s ease both 0.22s; }

/* Staggered habit rows — only on first load (.entering added by JS once) */
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } }
.habit-list.entering .habit-row                { animation: rowIn 0.26s ease both; }
.habit-list.entering .habit-row:nth-child(1)   { animation-delay: 0.03s; }
.habit-list.entering .habit-row:nth-child(2)   { animation-delay: 0.08s; }
.habit-list.entering .habit-row:nth-child(3)   { animation-delay: 0.13s; }
.habit-list.entering .habit-row:nth-child(4)   { animation-delay: 0.18s; }
.habit-list.entering .habit-row:nth-child(5)   { animation-delay: 0.23s; }
.habit-list.entering .habit-row:nth-child(6)   { animation-delay: 0.28s; }
.habit-list.entering .habit-row:nth-child(7)   { animation-delay: 0.33s; }
.habit-list.entering .habit-row:nth-child(n+8) { animation-delay: 0.38s; }

/* Check pop — applied by JS on specific element only */
@keyframes checkPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.3); }
  65%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.habit-check.pop { animation: checkPop 0.25s ease; }

/* ── Swipe slide transitions ── */
@keyframes exitLeft       { to   { transform: translateX(-40px); opacity: 0; } }
@keyframes exitRight      { to   { transform: translateX( 40px); opacity: 0; } }
@keyframes enterFromRight { from { transform: translateX( 40px); opacity: 0; } }
@keyframes enterFromLeft  { from { transform: translateX(-40px); opacity: 0; } }

#habitList.exit-left        { animation: exitLeft        0.18s ease forwards; pointer-events: none; }
#habitList.exit-right       { animation: exitRight       0.18s ease forwards; pointer-events: none; }
#habitList.enter-from-right { animation: enterFromRight  0.22s ease both; }
#habitList.enter-from-left  { animation: enterFromLeft   0.22s ease both; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
