/* Daily v0.1 — Calm Precision UI (Warm Alabaster / Deep Charcoal Ink, Zero External CDNs) */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --surface-hover: #eae8e0;
  --border: #e3e1d8;
  --border-strong: #cfccc0;
  --text: #16181d;
  --text-2: #3f4450;
  --muted: #6f7582;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --ai: #6d28d9;
  --ai-soft: rgba(109, 40, 217, 0.10);
  --pos: #15803d;
  --pos-bg: rgba(21, 128, 61, 0.11);
  --pos-tint: rgba(21, 128, 61, 0.035);
  --warn: #b45309;
  --warn-bg: rgba(180, 83, 9, 0.12);
  --neg: #b91c1c;
  --neg-bg: rgba(185, 28, 28, 0.10);
  --neg-tint: rgba(185, 28, 28, 0.035);
  --shadow-sm: 0 1px 2px rgba(22, 24, 29, 0.04), 0 1px 1px rgba(22, 24, 29, 0.02);
  --shadow-md: 0 8px 24px rgba(22, 24, 29, 0.08), 0 2px 6px rgba(22, 24, 29, 0.04);
  --shadow-lg: 0 24px 56px rgba(15, 17, 21, 0.22);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.dark {
  --bg: #0d0f13;
  --surface: #151820;
  --surface-2: #1d212c;
  --surface-hover: #252a38;
  --border: #262b38;
  --border-strong: #373e50;
  --text: #f1f3f7;
  --text-2: #c4cad6;
  --muted: #8890a2;
  --accent: #4f86ff;
  --accent-soft: rgba(79, 134, 255, 0.16);
  --ai: #a78bfa;
  --ai-soft: rgba(167, 139, 250, 0.16);
  --pos: #4ade80;
  --pos-bg: rgba(74, 222, 128, 0.14);
  --pos-tint: rgba(74, 222, 128, 0.045);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.15);
  --neg: #f87171;
  --neg-bg: rgba(248, 113, 113, 0.14);
  --neg-tint: rgba(248, 113, 113, 0.045);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 28px 64px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sm-text { font-size: 12px; }
.pos { color: var(--pos); font-weight: 600; }
.neg { color: var(--neg); font-weight: 600; }
.hidden { display: none !important; }

/* ==================== TOPBAR ==================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: 0.08em;
  font-size: 13px;
}
.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  display: inline-block;
}

.tabs {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: 10px;
}
.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  font-size: 13px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab kbd, .btn kbd {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.55;
  margin-left: 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0 4px;
  line-height: 1.4;
}

.top-actions { display: flex; align-items: center; gap: 7px; }

/* ==================== LAYOUT ==================== */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 22px 64px;
}
.view { display: none; }
.view.active { display: block; animation: viewFade 0.18s var(--ease); }

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h3, .panel-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .split-2 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1.35fr 1fr 0.8fr; gap: 10px; }
.row-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ==================== INPUTS & BUTTONS ==================== */
input, select, button { font-family: inherit; font-size: 13px; }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.14s var(--ease), background 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
input:focus, select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.num-sm { width: 80px; }
.num-xs { width: 52px; padding: 4px 6px !important; text-align: center; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.08s var(--ease), box-shadow 0.14s var(--ease);
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.btn.primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}
.btn.primary:hover { opacity: 0.9; background: var(--text); }
.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--neg-bg); border-color: transparent; color: var(--neg); }
.btn.danger:hover { border-color: var(--neg); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.icon-btn { padding: 5px 8px; }

.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.14s var(--ease);
}
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

/* ==================== DAY HEADER & FILTER BAR ==================== */
.day-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.day-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.day-title-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.14s var(--ease);
}
.day-title-wrap:hover { background: var(--surface-2); }
.day-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.date-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
}

.quick-create {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 520px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 6px;
  box-shadow: var(--shadow-sm);
}
.quick-create input[type="text"] {
  flex: 1;
  min-width: 150px;
  border: none;
  background: transparent;
  padding: 5px 8px;
}
.quick-create input[type="text"]:focus { box-shadow: none; background: transparent; }
.quick-create select, .quick-create .num-sm {
  border-color: transparent;
  background: var(--surface-2);
  padding: 5px 7px;
  font-size: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-search { width: 158px; padding: 5px 10px !important; font-size: 12px; border-radius: 999px !important; }

.empty-card {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  margin-bottom: 18px;
}
.empty-card h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -0.015em; }
.empty-card code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-family: var(--mono); font-size: 12px; }

/* ==================== TACTILE HABIT CARDS ==================== */
.habit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}

.habit-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    opacity 0.16s var(--ease),
    transform 0.16s var(--ease),
    box-shadow 0.18s var(--ease),
    border-color 0.18s var(--ease),
    background 0.18s var(--ease);
}
.habit-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--card-accent, var(--accent));
  opacity: 0.92;
}
.habit-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.habit-card.status-met { background: linear-gradient(180deg, var(--pos-tint), var(--surface) 65%); }
.habit-card.status-exceeded { background: linear-gradient(180deg, var(--neg-tint), var(--surface) 65%); }

.habit-card.route-dim { opacity: 0.42; }
.habit-card.route-focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-md);
}
.habit-card.route-glow-pos {
  border-color: var(--pos);
  box-shadow: 0 0 0 2px var(--pos-bg), var(--shadow-md);
}
.habit-card.route-glow-neg {
  border-color: var(--neg);
  box-shadow: 0 0 0 2px var(--neg-bg), var(--shadow-md);
}
.habit-card.is-clickable { cursor: pointer; }
.habit-card.is-toggled {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-md);
}

/* Multi-toggle connected routing clusters on Today */
.focus-clusters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}
.focus-cluster {
  background: color-mix(in srgb, var(--surface) 60%, var(--bg));
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: viewFade 0.16s var(--ease);
}
.focus-anchor-wrap {
  max-width: 440px;
}
.focus-children {
  position: relative;
  margin-left: 10px;
  padding-left: 16px;
  border-left: 2px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.focus-children-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.focus-children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 10px;
}
.toggle-caret {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
.habit-card.is-toggled .toggle-caret { color: var(--accent); }

.hc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hc-name {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge.met, .badge.within_limit { background: var(--pos-bg); color: var(--pos); }
.badge.warning { background: var(--warn-bg); color: var(--warn); }
.badge.exceeded { background: var(--neg-bg); color: var(--neg); }

.hc-metrics {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.hc-val-wrap { display: inline-flex; align-items: baseline; gap: 5px; }
.hc-big {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.hc-denom {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.hc-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.bar-track {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.28s var(--ease), background 0.2s var(--ease);
}

.hc-routes { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
}
.chip.pos-chip { color: var(--pos); background: var(--pos-bg); }
.chip.neg-chip { color: var(--neg); background: var(--neg-bg); }
.chip.ai-chip { color: var(--ai); background: var(--ai-soft); }

.hc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 2px;
}
.hc-actions .btn-tap {
  flex: 1;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.hc-actions .btn-tap:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}
.hc-actions .btn-subtle {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.hc-actions .btn-subtle:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ==================== MODE SWITCH ==================== */
.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.14s var(--ease);
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.mode-btn[data-nudge-mode="tabpfn"].active {
  background: var(--ai);
  color: #fff;
}

/* ==================== VERTICAL DAY TIMELINE ==================== */
.event-list {
  display: flex;
  flex-direction: column;
  position: relative;
}
.ev-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.12s var(--ease);
}
.ev-row:last-child { border-bottom: none; }
.ev-row:hover { background: var(--bg); border-radius: 6px; }
.ev-row.snap-row {
  background: var(--ai-soft);
  border-radius: 8px;
  border-bottom: none;
  margin: 3px 0;
  padding: 8px 10px;
}

.ev-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ev-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  min-width: 42px;
}
.ev-time:hover { color: var(--text); text-decoration: underline dotted; }
.ev-amt {
  font-family: var(--mono);
  font-weight: 600;
  cursor: pointer;
}
.ev-amt:hover { text-decoration: underline dotted; }
.ev-note {
  color: var(--muted);
  font-size: 12px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.ev-note:hover { color: var(--text); text-decoration: underline dotted; }
.ev-note.empty-note { opacity: 0.35; }
.ev-note.empty-note:hover { opacity: 0.9; }

/* ==================== SETUP & EDGES ==================== */
.color-row { display: flex; align-items: center; gap: 7px; }
.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
  transition: transform 0.12s var(--ease);
}
.swatch:hover { transform: scale(1.14); }
.nudge-box {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
.nudge-box summary { cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text-2); }
.check-row { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.edge-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.edge-form select { flex: 1; min-width: 110px; }
.arrow { font-family: var(--mono); color: var(--muted); }

.compact-list, .edge-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.order-btns { display: inline-flex; gap: 2px; }
.order-btns .btn { padding: 3px 6px; font-size: 11px; }

/* ==================== ANALYSE ==================== */
.inline-setting { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.matrix th, .matrix td { padding: 8px 8px; border-bottom: 1px solid var(--border); text-align: center; }
.matrix th { font-weight: 500; color: var(--muted); font-size: 11px; }
.matrix tr:last-child td { border-bottom: none; }
.matrix th:first-child, .matrix td:first-child { text-align: left; font-family: var(--sans); font-weight: 500; }
.matrix th.col-today, .matrix td.col-today { background: var(--accent-soft); }
.matrix th.col-today { color: var(--accent); font-weight: 600; border-radius: 6px 6px 0 0; }

.cell-val { display: inline-block; min-width: 34px; padding: 3px 7px; border-radius: 6px; }
.cell-met, .cell-within_limit { background: var(--pos-bg); color: var(--pos); font-weight: 600; }
.cell-warning { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.cell-exceeded { background: var(--neg-bg); color: var(--neg); font-weight: 600; }
.cell-in_progress { background: var(--surface-2); color: var(--text); }
.cell-pending, .cell-neutral { color: var(--muted); }

.rhythm-item {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.rhythm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  flex-wrap: wrap;
}
.spark-markers { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 14px; align-items: center; margin-bottom: 3px; }
.marker-slot { display: flex; align-items: center; justify-content: center; gap: 2px; height: 14px; }
.dot-obs {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.dot-ai {
  display: inline-block;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: var(--ai);
}
.legend-inline { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); }
.leg-item { display: inline-flex; align-items: center; gap: 5px; }

.spark24 {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  height: 38px;
  align-items: end;
}
.spark-col {
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
}
.spark-ai-halo {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 3px 3px 0 0;
  background: var(--ai-soft);
  pointer-events: none;
}
.spark-bar {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--surface-2);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.spark-bar.is-ai-peak { box-shadow: inset 0 2px 0 var(--ai); }
.spark-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.hyp-card {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.hyp-card.ai-card { border-left: 3px solid var(--ai); }
.hyp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }

/* ==================== WEEKDAY & MOMENTAUFNAHME CONTROLS ==================== */
.day-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.day-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s var(--ease);
}
.day-pill.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
  font-weight: 600;
}

.mood-axis {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.mood-axis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.mood-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.mood-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 8px;
  padding: 8px 0;
  font-family: var(--mono);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s var(--ease);
}
.mood-btn:hover { border-color: var(--ai); color: var(--text); }
.mood-btn:active { transform: scale(0.95); }
.mood-btn.selected {
  background: var(--ai);
  border-color: var(--ai);
  color: #fff;
  box-shadow: 0 2px 8px var(--ai-soft);
}
.mood-anchors {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.cause-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s var(--ease);
}
.cause-pill:hover { border-color: var(--ai); }
.cause-pill.active {
  background: var(--ai);
  border-color: var(--ai);
  color: #fff;
}

/* ==================== MODALS & TOAST ==================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(13, 15, 19, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.16s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.sm-card { max-width: 400px; }

.retro-windows { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.retro-rows { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow-y: auto; }
.retro-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.retro-row.has-val { border-color: var(--accent); background: var(--accent-soft); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-val { font-family: var(--mono); font-weight: 700; min-width: 28px; text-align: center; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 80;
  background: var(--text);
  color: var(--surface);
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.toast-undo {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.toast-undo:hover { opacity: 0.78; }

.sync-pill {
  border: 1px solid var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 999px;
  padding: 3px 9px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
}
.sync-grid { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.qr-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px;
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.qr-box svg { width: 100%; height: 100%; display: block; }

.legal-footer {
  max-width: 1080px;
  margin: 0 auto 24px;
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}
.legal-footer a, .link-btn {
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.legal-footer a:hover, .link-btn:hover { color: var(--text); text-decoration: underline; }

/* ==================== MOBILE THUMB-FIRST BOTTOM NAV ==================== */
.mobile-nav { display: none; }

@media (max-width: 720px) {
  .topbar {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  }
  .topbar .tabs { display: none; }
  .tab kbd, .btn kbd { display: none; }
  .brand .mono { display: none; }
  #btn-open-mood span.lbl-full, #btn-open-retro span.lbl-full { display: none; }

  .container {
    padding: 14px 14px calc(86px + env(safe-area-inset-bottom, 0px));
  }
  .day-title { font-size: 17px; }
  .habit-grid { grid-template-columns: 1fr; gap: 10px; }
  .btn { min-height: 36px; }
  .hc-actions .btn { min-height: 42px; }
  .toast {
    left: 14px;
    right: 14px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    justify-content: space-between;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
  }
  .mnav-btn {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 8px 4px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s var(--ease);
  }
  .mnav-btn.active {
    background: var(--surface-2);
    color: var(--text);
  }
}
