/* ════════════════════════════════════════════════════════════════════════
   MOMENTUM — instrument-panel dark
   deep ink charcoal · ember amber accent · grain + glow atmosphere
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --bg0: #0b0e14;
  --bg1: #11151d;
  --bg2: #171c26;
  --bg3: #1e2430;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --text: #e8ebf2;
  --dim: #8b93a7;
  --faint: #525a6e;

  --ember: #ffb454;
  --ember-soft: rgba(255, 180, 84, 0.14);
  --ember-glow: rgba(255, 180, 84, 0.35);
  --teal: #4fd6be;
  --teal-soft: rgba(79, 214, 190, 0.13);
  --coral: #f2617a;
  --coral-soft: rgba(242, 97, 122, 0.13);
  --steel: #6ca4f8;
  --steel-soft: rgba(108, 164, 248, 0.13);
  --violet: #b58cf6;

  --font-display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", sans-serif;
  --font-mono: "Spline Sans Mono", Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 24px 70px rgba(0, 0, 0, 0.6);
}

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

::selection { background: var(--ember-soft); color: var(--ember); }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(255, 180, 84, 0.05), transparent 60%),
    radial-gradient(800px 600px at -10% 110%, rgba(108, 164, 248, 0.045), transparent 60%),
    var(--bg0);
  overflow: hidden;
}

/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 8px; border: 2px solid var(--bg0); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
::-webkit-scrollbar-corner { background: transparent; }

/* ═══════════════════════════════ layout ═══════════════════════════════ */

.app { display: flex; height: 100vh; padding-top: 40px; }

.sidebar {
  width: 218px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 12px 14px;
  border-right: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 18px;
}
.logo-mark {
  color: var(--ember);
  font-size: 15px;
  text-shadow: 0 0 14px var(--ember-glow);
  animation: spark-breathe 4s ease-in-out infinite;
}
@keyframes spark-breathe {
  0%, 100% { text-shadow: 0 0 8px var(--ember-glow); }
  50% { text-shadow: 0 0 20px var(--ember-glow); }
}
.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.01em;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-item.active { background: var(--ember-soft); color: var(--ember); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--ember);
  box-shadow: 0 0 10px var(--ember-glow);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg1);
  cursor: pointer;
  transition: border-color 0.15s;
}
.mini-timer:hover { border-color: var(--line-strong); }
.mini-timer.running { border-color: rgba(255, 180, 84, 0.35); }
.mini-timer.on-break { border-color: rgba(79, 214, 190, 0.35); }
.mini-timer-ring { width: 34px; height: 34px; transform: rotate(-90deg); flex-shrink: 0; }
.ring-bg { fill: none; stroke: var(--bg3); stroke-width: 3; }
.ring-fg {
  fill: none;
  stroke: var(--ember);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.5s linear;
}
.mini-timer.on-break .ring-fg { stroke: var(--teal); }
.mini-timer-text { display: flex; flex-direction: column; line-height: 1.25; }
#mini-timer-time { font-size: 14px; font-weight: 600; }
.mini-timer-phase { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }

.main { flex: 1; overflow: hidden; position: relative; }

/* mobile top bar + drawer scrim — hidden entirely above the sidebar-collapse breakpoint */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

.view {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 26px 34px 40px;
}
.view.active { display: block; animation: view-in 0.3s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* staggered children on view enter */
.stagger > * { animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.07s; }
.stagger > *:nth-child(3) { animation-delay: 0.12s; }
.stagger > *:nth-child(4) { animation-delay: 0.17s; }
.stagger > *:nth-child(5) { animation-delay: 0.22s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ═══════════════════════════ shared components ═══════════════════════════ */

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.view-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.view-sub { color: var(--dim); font-size: 13px; margin-top: 3px; }
.view-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg3); border-color: var(--faint); }
.btn.primary {
  background: var(--ember);
  border-color: var(--ember);
  color: #1a1206;
}
.btn.primary:hover { background: #ffc06e; box-shadow: 0 4px 18px var(--ember-glow); }
.btn.danger { color: var(--coral); border-color: rgba(242, 97, 122, 0.3); background: transparent; }
.btn.danger:hover { background: var(--coral-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: default; pointer-events: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

input[type="text"], input[type="date"], input[type="time"], input[type="number"],
select, textarea {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ember);
  box-shadow: 0 0 0 3px var(--ember-soft);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select { cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
textarea { resize: vertical; line-height: 1.6; }

input[type="checkbox"] {
  appearance: none;
  width: 17px; height: 17px;
  border: 1.5px solid var(--faint);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
}
input[type="checkbox"]:hover { border-color: var(--ember); }
input[type="checkbox"]:checked { background: var(--ember); border-color: var(--ember); }
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4.5px; top: 1.5px;
  width: 4px; height: 8px;
  border: solid #1a1206;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg1);
}
.seg button {
  padding: 6px 13px;
  border: none;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.seg button:not(:last-child) { border-right: 1px solid var(--line); }
.seg button.on { background: var(--ember-soft); color: var(--ember); }
.seg button:not(.on):hover { color: var(--text); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}
.empty .empty-glyph { font-size: 26px; display: block; margin-bottom: 10px; opacity: 0.5; }

/* priority dots */
.prio-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.prio-high { background: var(--coral); box-shadow: 0 0 7px rgba(242, 97, 122, 0.6); }
.prio-med  { background: var(--ember); box-shadow: 0 0 7px var(--ember-glow); }
.prio-low  { background: var(--steel); box-shadow: 0 0 7px rgba(108, 164, 248, 0.5); }

/* due chips */
.due-chip { color: var(--dim); background: rgba(255, 255, 255, 0.05); }
.due-chip.today { color: var(--ember); background: var(--ember-soft); }
.due-chip.overdue { color: var(--coral); background: var(--coral-soft); }

/* ═══════════════════════════════ modal ═══════════════════════════════ */

.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px 40px;
  overflow-y: auto;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  width: 100%;
  max-width: 620px;
  background: var(--bg1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  animation: modal-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 0;
}
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.modal-body { padding: 16px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 22px 20px;
}
.modal-foot .spacer { flex: 1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ═══════════════════════════════ toasts ═══════════════════════════════ */

.toasts {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--ember);
  border-radius: var(--r-sm);
  padding: 11px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  max-width: 320px;
}
.toast.success { border-left-color: var(--teal); }
.toast.error { border-left-color: var(--coral); }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } }
.toast.out { animation: toast-out 0.25s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* ═══════════════════════════════ dashboard ═══════════════════════════════ */

.dash-greeting {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.dash-greeting em {
  font-style: normal;
  color: var(--ember);
  text-shadow: 0 0 24px var(--ember-glow);
}
.dash-date { color: var(--dim); font-size: 13.5px; margin-top: 6px; }

.dash-quick {
  display: flex;
  gap: 8px;
  margin: 22px 0;
}
.dash-quick input { flex: 1; padding: 11px 14px; font-size: 14px; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  align-items: start;
}
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.dash-card { padding: 18px 20px; }
.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dash-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.dash-card-link {
  font-size: 12px;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
}
.dash-card-link:hover { color: var(--ember); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--bg2);
  border: 1px solid var(--line);
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--ember);
}
.stat-num.teal { color: var(--teal); }
.stat-num.steel { color: var(--steel); }
.stat-label { font-size: 11px; color: var(--dim); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.07em; }

.dash-focus-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: linear-gradient(120deg, rgba(255, 180, 84, 0.1), rgba(255, 180, 84, 0.02));
  border: 1px solid rgba(255, 180, 84, 0.25);
}
.dash-focus-cta .big-time { font-size: 26px; font-weight: 700; }
.dash-focus-cta .cta-sub { color: var(--dim); font-size: 12px; }
.dash-focus-cta .btn { margin-left: auto; }

/* shared task row (dashboard + todo) */
.task-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.13s;
  border: 1px solid transparent;
}
.task-row:hover { background: rgba(255, 255, 255, 0.035); }
.task-row .task-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row.done .task-title { color: var(--faint); text-decoration: line-through; }
.task-row .task-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.task-row .sub-progress { font-size: 11px; color: var(--dim); font-family: var(--font-mono); }
.label-chip { font-size: 10.5px; padding: 1px 8px; }

.dash-event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
}
.dash-event-row .ev-when {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--steel);
  width: 86px;
  flex-shrink: 0;
}

/* ═══════════════════════════════ todo view ═══════════════════════════════ */

.todo-add {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.todo-add input[type="text"] { flex: 1; padding: 11px 14px; font-size: 14px; }

.todo-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.todo-group { margin-bottom: 22px; }
.todo-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
}
.todo-group-head .count {
  font-family: var(--font-mono);
  background: var(--bg2);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10.5px;
}
.todo-group-head.overdue { color: var(--coral); }
.todo-group-head .tri { transition: transform 0.15s; font-size: 9px; }
.todo-group.collapsed .tri { transform: rotate(-90deg); }
.todo-group.collapsed .todo-group-body { display: none; }

/* ═══════════════════════════════ kanban ═══════════════════════════════ */

.kanban-wrap { height: 100%; display: flex; flex-direction: column; }
.board-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.board-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.board-tab:hover { color: var(--text); border-color: var(--faint); }
.board-tab.on { background: var(--ember-soft); border-color: rgba(255, 180, 84, 0.4); color: var(--ember); }
.board-tab[draggable="true"] { cursor: grab; }
.board-tab.dragging { opacity: 0.4; }

.kanban-cols {
  flex: 1;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 16px;
}
.kanban-col {
  width: 290px;
  flex-shrink: 0;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  max-height: 100%;
}
.kanban-col.drag-over { border-color: var(--ember); box-shadow: 0 0 0 3px var(--ember-soft); }
.kanban-col.dragging { opacity: 0.4; }
.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px 9px;
}
.col-drag-handle {
  cursor: grab;
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}
.col-drag-handle:hover { color: var(--dim); }
.col-drag-handle:active { cursor: grabbing; }
.kanban-col-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  flex: 1;
  cursor: text;
  border-radius: 5px;
  padding: 2px 5px;
  margin-left: -5px;
}
.kanban-col-name:focus { outline: 1px solid var(--ember); background: var(--bg2); }
.kanban-col-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  background: var(--bg2);
  padding: 1px 8px;
  border-radius: 999px;
}
.kanban-cards {
  padding: 4px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 50px;
  flex: 1;
}
.kanban-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
  cursor: grab;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.kanban-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; }
.kanban-card.done-card { opacity: 0.55; }
.kanban-card.done-card .kc-title { text-decoration: line-through; color: var(--dim); }
.kc-labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 7px; }
.kc-label { height: 5px; width: 28px; border-radius: 999px; }
.kc-title { font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.kc-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  flex-wrap: wrap;
}
.kc-meta:empty { display: none; }
.kanban-add-card {
  margin: 0 10px 10px;
  padding: 7px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  background: none;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.kanban-add-card:hover { color: var(--ember); border-color: var(--ember); background: var(--ember-soft); }
.kanban-add-col {
  width: 270px;
  flex-shrink: 0;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: none;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.kanban-add-col:hover { color: var(--ember); border-color: var(--ember); }

/* ═══════════════════════════════ calendar ═══════════════════════════════ */

.cal-grid-month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg1);
}
.cal-dow {
  padding: 9px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.cal-day {
  min-height: 104px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  cursor: pointer;
  transition: background 0.13s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: rgba(255, 255, 255, 0.025); }
.cal-day.other-month { opacity: 0.38; }
.cal-day-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
  width: 24px; height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.cal-day.today .cal-day-num {
  background: var(--ember);
  color: #1a1206;
  font-weight: 700;
  box-shadow: 0 0 12px var(--ember-glow);
}
.cal-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.cal-chip.is-task { background: var(--ember-soft); color: var(--ember); }
.cal-chip.is-task.is-done { opacity: 0.5; text-decoration: line-through; }
.cal-chip.is-event { background: var(--steel-soft); color: var(--steel); }
.cal-chip.is-overdue { background: var(--coral-soft); color: var(--coral); }
.cal-more { font-size: 10.5px; color: var(--faint); padding-left: 4px; }

/* week view */
.cal-week {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg1);
}
.cal-week-head {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}
.cal-week-dayhead {
  padding: 9px 6px;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  border-left: 1px solid var(--line);
}
.cal-week-dayhead .dnum { font-family: var(--font-mono); font-size: 16px; color: var(--text); display: block; }
.cal-week-dayhead.today .dnum { color: var(--ember); font-weight: 700; }
.cal-week-allday {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  min-height: 34px;
}
.cal-week-allday .ad-cell { border-left: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.cal-week-body {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  height: 540px;
  overflow-y: auto;
  position: relative;
}
.cal-hours { display: flex; flex-direction: column; }
.cal-hour-label {
  height: 45px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  text-align: right;
  padding-right: 7px;
  flex-shrink: 0;
  transform: translateY(-5px);
}
.cal-week-daycol {
  border-left: 1px solid var(--line);
  position: relative;
  background-image: repeating-linear-gradient(to bottom, transparent 0 44px, var(--line) 44px 45px);
}
.cal-week-event {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 6px;
  background: var(--steel-soft);
  border-left: 3px solid var(--steel);
  color: var(--steel);
  font-size: 11px;
  padding: 3px 6px;
  overflow: hidden;
  cursor: pointer;
}
.cal-now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--coral);
  box-shadow: 0 0 8px rgba(242, 97, 122, 0.7);
  pointer-events: none;
  z-index: 5;
}

/* ═══════════════════════════════ notes ═══════════════════════════════ */

.notes-layout {
  display: grid;
  grid-template-columns: 200px 270px 1fr;
  gap: 0;
  height: calc(100% - 0px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg1);
}
.notes-folders {
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  color: var(--dim);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.13s;
  width: 100%;
}
.folder-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.folder-item.on { background: var(--ember-soft); color: var(--ember); }
.folder-item .f-count { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; opacity: 0.7; }
.notes-folders-foot { margin-top: auto; padding-top: 8px; }

.notes-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.notes-list-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.notes-list-head input { width: 100%; }
.note-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.13s;
}
.note-item:hover { background: rgba(255, 255, 255, 0.03); }
.note-item.on { background: var(--bg2); box-shadow: inset 3px 0 0 var(--ember); }
.note-item-title { font-weight: 600; font-size: 13.5px; margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.note-item-title .pin { color: var(--ember); font-size: 10px; }
.note-item-preview {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item-meta { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.note-item-date { font-size: 10.5px; color: var(--faint); font-family: var(--font-mono); }
.tag-chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--steel-soft);
  color: var(--steel);
  font-weight: 600;
}

.note-editor { display: flex; flex-direction: column; min-width: 0; }
.note-editor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.note-title-input {
  flex: 1;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  font-family: var(--font-display) !important;
  font-size: 17px !important;
  font-weight: 700;
  padding: 4px 6px !important;
}
.note-tags-bar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.note-tags-bar input {
  background: none; border: none; box-shadow: none !important;
  font-size: 12px; padding: 2px 4px; width: 110px;
}
.tag-chip .x { cursor: pointer; opacity: 0.6; margin-left: 2px; }
.tag-chip .x:hover { opacity: 1; }
.note-panes { flex: 1; display: flex; min-height: 0; }
.note-pane-write, .note-pane-preview { flex: 1; min-width: 0; overflow-y: auto; }
.note-pane-write textarea {
  width: 100%; height: 100%;
  background: none; border: none; box-shadow: none !important;
  border-radius: 0;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  resize: none;
}
.note-pane-preview { padding: 18px 22px; border-left: 1px solid var(--line); }
.note-panes.mode-write .note-pane-preview { display: none; }
.note-panes.mode-preview .note-pane-write { display: none; }
.note-panes.mode-preview .note-pane-preview { border-left: none; }

/* rendered markdown */
.md { line-height: 1.7; font-size: 14px; }
.md h1, .md h2, .md h3, .md h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 1.2em 0 0.45em;
  line-height: 1.25;
}
.md h1:first-child, .md h2:first-child, .md h3:first-child { margin-top: 0; }
.md h1 { font-size: 24px; }
.md h2 { font-size: 19px; }
.md h3 { font-size: 16px; }
.md h4 { font-size: 14px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.md p { margin: 0.6em 0; }
.md a { color: var(--ember); text-decoration: none; border-bottom: 1px solid var(--ember-glow); }
.md code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
}
.md pre {
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  overflow-x: auto;
  margin: 0.8em 0;
}
.md pre code { background: none; border: none; padding: 0; }
.md ul, .md ol { padding-left: 1.5em; margin: 0.6em 0; }
.md li { margin: 0.22em 0; }
.md li.task-li { list-style: none; margin-left: -1.3em; display: flex; gap: 8px; align-items: baseline; }
.md blockquote {
  border-left: 3px solid var(--ember);
  background: var(--ember-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin: 0.8em 0;
  padding: 8px 14px;
  color: var(--dim);
}
.md hr { border: none; border-top: 1px solid var(--line-strong); margin: 1.4em 0; }
.md strong { color: var(--ember); font-weight: 700; }
.md img { max-width: 100%; border-radius: var(--r-sm); }
.md table { border-collapse: collapse; margin: 0.8em 0; }
.md th, .md td { border: 1px solid var(--line-strong); padding: 6px 12px; font-size: 13px; }
.md th { background: var(--bg2); font-weight: 600; }

/* ═══════════════════════════════ pomodoro ═══════════════════════════════ */

.pomo-layout {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 20px;
  align-items: start;
  max-width: 1060px;
}
.pomo-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 30px 38px;
  position: relative;
  overflow: hidden;
}
.pomo-stage::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 50% 42%, var(--ember-soft), transparent 55%);
  opacity: 0.8;
  pointer-events: none;
  transition: opacity 0.6s;
}
.pomo-stage.on-break::before {
  background: radial-gradient(circle at 50% 42%, var(--teal-soft), transparent 55%);
}
.pomo-phase-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
  margin-bottom: 16px;
  position: relative;
}
.pomo-stage.on-break .pomo-phase-label { color: var(--teal); }
.pomo-dial { position: relative; width: 300px; height: 300px; }
.pomo-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pomo-ring-bg { fill: none; stroke: var(--bg3); stroke-width: 5; }
.pomo-ring-fg {
  fill: none;
  stroke: var(--ember);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 9px var(--ember-glow));
  transition: stroke-dashoffset 0.9s linear, stroke 0.4s;
}
.pomo-stage.on-break .pomo-ring-fg { stroke: var(--teal); filter: drop-shadow(0 0 9px rgba(79, 214, 190, 0.4)); }
.pomo-dial-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.pomo-time {
  font-family: var(--font-mono);
  font-size: 58px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.pomo-session-dots { display: flex; gap: 7px; margin-top: 10px; }
.pomo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bg3); transition: all 0.3s; }
.pomo-dot.done { background: var(--ember); box-shadow: 0 0 8px var(--ember-glow); }
.pomo-controls { display: flex; gap: 10px; margin-top: 28px; position: relative; }
.pomo-task-pick { margin-top: 18px; position: relative; display: flex; align-items: center; gap: 8px; }
.pomo-task-pick select { max-width: 320px; }

.pomo-side { display: flex; flex-direction: column; gap: 16px; }
.pomo-side .dash-card { padding: 16px 18px; }
.focus-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
.focus-log-row:last-child { border-bottom: none; }
.focus-log-row .fl-time { font-family: var(--font-mono); color: var(--faint); font-size: 11px; width: 48px; flex-shrink: 0; }
.focus-log-row .fl-task { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-log-row .fl-min { font-family: var(--font-mono); color: var(--ember); font-size: 11px; }

/* ═══════════════════════════════ arcade ═══════════════════════════════ */

.arcade-wrap { max-width: 980px; }
.arcade-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.game-card {
  padding: 24px 22px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: left;
  font-family: var(--font-body);
  color: var(--text);
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--ember);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 3px var(--ember-soft);
}
.game-card .g-icon { font-size: 30px; display: block; margin-bottom: 14px; }
.game-card .g-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.game-card .g-desc { color: var(--dim); font-size: 12.5px; margin-top: 5px; line-height: 1.5; }
.game-card .g-hi {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ember);
}

.game-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.game-hud {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 640px;
}
.game-hud .g-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; flex: 1; }
.game-hud .g-score { font-family: var(--font-mono); font-size: 14px; color: var(--ember); }
.game-hud .g-score b { font-size: 18px; }
canvas.game-canvas {
  background: var(--bg0);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: 0 0 0 6px var(--bg1), 0 20px 60px rgba(0, 0, 0, 0.5);
  image-rendering: pixelated;
}
.game-help { color: var(--faint); font-size: 12px; font-family: var(--font-mono); }

/* ═══════════════════════════════ settings ═══════════════════════════════ */

.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ember);
  margin-top: 6px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0;
}
.settings-row .s-label { font-size: 13.5px; }
.settings-row .s-sub { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.settings-row input[type="number"] { width: 76px; text-align: center; }

.switch {
  position: relative;
  width: 38px; height: 22px;
  flex-shrink: 0;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--bg3);
  border-radius: 999px;
  transition: background 0.18s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--dim);
  transition: all 0.18s;
}
.switch input:checked + .track { background: var(--ember); }
.switch input:checked + .track::after { left: 19px; background: #1a1206; }

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--bg2);
  color: var(--dim);
}

/* subtask list in task modal */
.subtask-list { display: flex; flex-direction: column; gap: 4px; }
.subtask-row { display: flex; align-items: center; gap: 9px; padding: 3px 2px; }
.subtask-row input[type="text"] {
  flex: 1; background: none; border: none; box-shadow: none !important;
  padding: 3px 4px; font-size: 13px;
}
.subtask-row.done input[type="text"] { color: var(--faint); text-decoration: line-through; }
.subtask-row .icon-btn { width: 24px; height: 24px; opacity: 0; }
.subtask-row:hover .icon-btn { opacity: 1; }

.monthday-grid {
  display: grid;
  grid-template-columns: repeat(7, 36px);
  gap: 4px;
}
.monthday-grid button {
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.13s;
}
.monthday-grid button:hover { border-color: var(--faint); color: var(--text); }
.monthday-grid button.on {
  background: var(--ember-soft);
  border-color: var(--ember);
  color: var(--ember);
}
.monthday-grid button.last { grid-column: span 4; }

.day-pick { display: flex; gap: 6px; }
.day-pick button {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.13s;
}
.day-pick button:hover { border-color: var(--faint); color: var(--text); }
.day-pick button.on {
  background: var(--ember-soft);
  border-color: var(--ember);
  color: var(--ember);
  box-shadow: 0 0 8px var(--ember-soft);
}

.label-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.label-pick .chip { cursor: pointer; opacity: 0.5; transition: all 0.13s; }
.label-pick .chip.on { opacity: 1; box-shadow: 0 0 0 1.5px currentColor; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .pomo-layout { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 170px 220px 1fr; }
}

/* ═══════════════════════════ mobile / tablet ═══════════════════════════
   Below this the persistent 218px sidebar can't coexist with real content
   width, so it becomes an off-canvas drawer triggered by a hamburger button
   in a new top bar (app.js/boot.js toggle `.sidebar.open` + `.sidebar-backdrop.open`). */
@media (max-width: 860px) {
  .app { display: block; padding-top: 0; height: 100dvh; }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 8px 0 14px;
    border-bottom: 1px solid var(--line);
    background: var(--bg0);
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .mobile-topbar-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15.5px;
  }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(78vw, 280px);
    z-index: 80;
    padding-top: 10px;
    background: var(--bg0);
    box-shadow: var(--shadow-pop);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 79;
    background: rgba(5, 7, 11, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

  .main { height: calc(100dvh - 52px); }
  .view { padding: 18px 16px 28px; }
  .view-title { font-size: 22px; }

  /* tighten grids that assumed generous desktop width */
  .arcade-menu { grid-template-columns: repeat(2, 1fr); }
  .stat-row { gap: 7px; }
  .stat { padding: 11px; }
  .stat-num { font-size: 20px; }

  /* calendar week view: keep real column widths, scroll horizontally rather than crushing them */
  .cal-week { overflow-x: auto; }
  .cal-week-head, .cal-week-allday, .cal-week-body { min-width: 680px; }

  /* Notes: three fixed-width panes can't fit — collapse to a single pane, folders become a
     horizontally-scrolling strip, and opening a note swaps the whole view to the editor
     (notes.js toggles `.note-open` on `.notes-layout` and wires the `#nt-back` button). */
  .notes-layout { grid-template-columns: none; display: flex; flex-direction: column; height: calc(100dvh - 52px - 100px) !important; }
  .notes-folders {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    flex-shrink: 0;
  }
  .notes-folders .folder-item { width: auto; flex-shrink: 0; }
  .notes-folders-foot { margin-top: 0; margin-left: 4px; flex-shrink: 0; }
  .notes-list { border-right: none; flex: 1; min-height: 0; }
  .note-editor { display: none; }
  .notes-layout.note-open .notes-folders,
  .notes-layout.note-open .notes-list { display: none; }
  .notes-layout.note-open .note-editor { display: flex; flex: 1; min-height: 0; }
  .nt-back { display: inline-flex !important; }
  .note-editor-bar { flex-wrap: wrap; row-gap: 6px; }

  /* task/event modals stack their date/time triplets instead of squeezing three inputs in a row */
  .field-row { flex-wrap: wrap; }
  .field-row .field { flex: 1 1 130px; }
}

.nt-back { display: none; }

@media (max-width: 560px) {
  .modal-backdrop { padding: 24px 10px; }
  .modal-body { padding: 14px 16px 18px; }
  .modal-head { padding: 14px 16px 0; }
  .modal-foot { padding: 0 16px 16px; }

  .arcade-menu { grid-template-columns: 1fr; }
  .pomo-dial { width: min(300px, 78vw); height: min(300px, 78vw); }
  .pomo-time { font-size: 15vw; }
  .dash-greeting { font-size: 8vw; }

  .kanban-col { width: 82vw; }
}
