/* ----- Reset + base ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
a { color: inherit; text-decoration: none; }

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.checkbox:focus-visible { outline-offset: 1px; }

/* ----- Theme tokens ----- */
:root, html[data-theme="light"] {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-alt: #F4F4F5;
  --sidebar-bg: #F7F7F8;
  --border: rgba(15, 15, 17, 0.07);
  --border-strong: rgba(15, 15, 17, 0.12);
  --text: #1A1A1F;
  --text-muted: #8B8B92;
  --text-faint: #B5B5BC;
  --accent: #4F46E5;
  --accent-soft: #EEF2FF;
  --done: #34D399;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --kbd-bg: #EFEFF1;
  --shadow-soft: 0 1px 2px rgba(15,15,17,.04), 0 1px 8px rgba(15,15,17,.04);
  --shadow-hover: 0 2px 4px rgba(15,15,17,.06), 0 8px 24px rgba(15,15,17,.06);
  --shadow-modal: 0 10px 40px rgba(15,15,17,.16), 0 2px 6px rgba(15,15,17,.08);
}
html[data-theme="dark"] {
  --bg: #0F0F11;
  --surface: #16161A;
  --surface-alt: #1E1E23;
  --sidebar-bg: #131316;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #E8E8EA;
  --text-muted: #8C8C95;
  --text-faint: #5E5E66;
  --accent: #818CF8;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --done: #34D399;
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --kbd-bg: #232328;
  --shadow-soft: 0 1px 2px rgba(0,0,0,.4), 0 1px 8px rgba(0,0,0,.2);
  --shadow-hover: 0 2px 4px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.3);
  --shadow-modal: 0 10px 40px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.3);
}

:root {
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --transition: 160ms cubic-bezier(.4, 0, .2, 1);
}

body {
  font-family: 'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow: hidden;
}

kbd {
  font-family: inherit;
  font-size: 11px;
  background: var(--kbd-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
}

.muted { color: var(--text-faint); }

/* ----- App grid ----- */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
}
body[data-view="today"] .app,
body[data-view="tomorrow"] .app {
  grid-template-columns: 240px 1fr 380px;
}

/* ----- Sidebar ----- */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark { color: var(--accent); font-size: 16px; }

.nav-section { display: flex; flex-direction: column; gap: 1px; }
.nav-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 8px 8px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(127,127,127,.08); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-icon { font-size: 10px; width: 12px; text-align: center; opacity: .7; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-shortcut {
  font-size: 11px;
  color: var(--text-faint);
  font-feature-settings: 'tnum';
  opacity: 0;
  transition: opacity var(--transition);
}
.nav-item:hover .nav-shortcut { opacity: 1; }

.channel-row {
  display: flex;
  align-items: stretch;
  gap: 1px;
  border-radius: var(--radius-sm);
  position: relative;
}
.channel-row .channel-item { flex: 1; padding-right: 4px; }
.channel-edit-btn {
  width: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: -2px;
  opacity: 0;
  transition: all var(--transition);
}
.channel-row:hover .channel-edit-btn { opacity: 1; }
.channel-edit-btn:hover { background: rgba(127,127,127,.10); color: var(--text); }

.channel-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}
.channel-edit-form-row { display: flex; gap: 6px; align-items: center; }
.channel-edit-form input[type="text"] {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  outline: none;
  background: var(--bg);
  color: var(--text);
}
.channel-edit-form input[type="text"]:focus { border-color: var(--accent); }
.channel-edit-form input[type="color"] {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
}
.channel-edit-form-actions { display: flex; gap: 4px; justify-content: flex-end; }
.channel-edit-form button {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  color: var(--text-muted);
}
.channel-edit-form button.save { background: var(--accent); color: white; }
.channel-edit-form button.delete { color: var(--danger); }
.channel-edit-form button.delete:hover { background: var(--danger-soft); }
.channel-edit-form button:hover:not(.save):not(.delete) { background: var(--surface-alt); color: var(--text); }

.channel-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-add { color: var(--text-faint); }
.nav-add:hover { color: var(--text); }

.sidebar-clients-toggle {
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-clients-chevron {
  font-size: 10px;
  transition: transform 0.15s ease;
}
.sidebar-clients-section:not(.is-collapsed) .sidebar-clients-chevron {
  transform: rotate(90deg);
}
.sidebar-clients-section.is-collapsed .sidebar-clients-list {
  display: none;
}

.theme-toggle {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--transition);
}
.theme-toggle:hover { background: rgba(127,127,127,.08); color: var(--text); }

/* ----- Main ----- */
.main { padding: 32px 40px 16px; overflow-y: auto; }

.list-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.list-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.list-meta { font-size: 12px; color: var(--text-muted); font-feature-settings: 'tnum'; margin-left: auto; }

.progress-thin {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 3px;
  margin-bottom: 14px;
  overflow: hidden;
}
.progress-thin-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Confetti overlay (fires when today's progress hits 100%). */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: 18%;
  width: 8px;
  height: 12px;
  border-radius: 1px;
  animation: confetti-fall var(--dur, 1.5s) cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes confetti-fall {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, 360px)) rotate(var(--rot, 0)); opacity: 0; }
}

.list-settings { position: relative; }
.list-settings-btn {
  background: transparent;
  color: var(--text-faint);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.list-settings-btn:hover { color: var(--text); background: var(--surface-alt); }
.list-settings-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.list-settings-popover.hidden { display: none; }
.list-settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.list-settings-row:hover { background: var(--surface-alt); }
.list-settings-row input[type="checkbox"] { cursor: pointer; }

/* Hide-done pref: drop completed top-level tasks AND completed subtasks.
   Doesn't apply on /done — that view's whole purpose is showing them. */
body.pref-hide-done:not([data-view="done"]) .task.is-done,
body.pref-hide-done:not([data-view="done"]) .subtask.is-done { display: none; }

.task-list { display: flex; flex-direction: column; gap: 2px; }

/* ----- Task row ----- */
.task, .subtask {
  background: transparent;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.task:hover, .subtask:hover { background: rgba(127,127,127,.05); }
.task.is-done > .task-row .task-title,
.subtask.is-done > .task-row .task-title {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--text-faint);
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-height: 36px;
  position: relative;
  cursor: grab;
}
.task-row:active { cursor: grabbing; }
/* Interactive children: restore pointer cursor so the affordance for click vs drag
   is clear. The whole row is still draggable (SortableJS distinguishes by movement),
   but the cursor over a button/link signals "click me". */
.task-row .checkbox,
.task-row .task-title,
.task-row a,
.task-row button { cursor: pointer; }
.task-row:active .task-title,
.task-row:active .checkbox { cursor: grabbing; }

.checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: transparent;
  font-size: 12px;
  line-height: 1;
  padding: 3px;
  box-sizing: content-box;
  margin: -3px;
}
.checkbox:hover { border-color: var(--accent); }
.task.is-done > .task-row > .checkbox,
.subtask.is-done > .task-row > .checkbox {
  background: var(--done);
  border-color: var(--done);
  color: white;
}
.checkbox-mark {
  display: inline-block;
  animation: checkmark 200ms cubic-bezier(.4, 0, .2, 1);
}
@keyframes checkmark {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.task-title {
  flex: 1;
  font-size: 14px;
  font-weight: 450;
  color: var(--text);
  cursor: pointer;
  transition: color var(--transition);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: color-mix(in srgb, var(--chip-color) 14%, transparent);
  color: color-mix(in srgb, var(--chip-color) 80%, var(--text));
  white-space: nowrap;
}
.channel-chip .channel-dot { width: 6px; height: 6px; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: rgba(127,127,127,.10);
  color: var(--text-muted);
  white-space: nowrap;
}
.tag-chip::before { content: '#'; opacity: 0.6; margin-right: 1px; }

.subtask-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 4px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 11px;
  font-feature-settings: 'tnum';
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.subtask-toggle:hover { background: var(--accent-soft); color: var(--text); }
.subtask-toggle-chevron {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  transition: transform 0.15s ease;
  transform-origin: 50% 50%;
}
.task:not(.is-collapsed) > .task-row .subtask-toggle-chevron { transform: rotate(90deg); }
.subtask-count { font-feature-settings: 'tnum'; }

.task.is-collapsed > .subtask-list { display: none; }

.recurring-badge { font-size: 11px; color: var(--text-faint); }

.drag-handle {
  /* Whole-row drag makes the ⋮⋮ glyph redundant; hide it by default and only
     restore it on the Plan board where the explicit handle is a useful
     board-style affordance (kept by the .plan-column override below). */
  display: none;
}

/* In the Plan board, keep the explicit handle as a board-style affordance.
   Whole-row drag still works; the handle is purely visual reassurance. */
.plan-column .drag-handle {
  display: inline-block;
  opacity: 0.35;
  width: 20px;
  letter-spacing: 0;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-faint);
  font-size: 14px;
  user-select: none;
  transition: opacity var(--transition);
}
.plan-column .task:hover .drag-handle { opacity: 1; }

.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 26px;
  margin-bottom: 4px;
}
.subtask .task-row { padding: 4px 12px; min-height: 28px; }
.subtask .task-title { font-size: 13px; color: var(--text-muted); }

.task-empty { padding: 24px 12px; color: var(--text-muted); font-size: 13px; text-align: center; }

.add-task-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: var(--radius);
  color: var(--text-faint);
  font-size: 13px;
  width: 100%;
  transition: background var(--transition), color var(--transition);
}
.add-task-btn:hover { background: rgba(127,127,127,.05); color: var(--text-muted); }
.add-task-plus { font-size: 14px; }
.add-task-btn kbd { margin-left: auto; }

/* ----- Detail modal ----- */
.detail-modal {
  position: fixed;
  inset: 0;
  background: rgba(15,15,17,.32);
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
}
.detail-modal.hidden { display: none; }
.detail-modal-inner {
  width: min(560px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 24px 28px;
}
.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}
.detail-empty-icon { font-size: 32px; color: var(--text-faint); margin-bottom: 12px; }
.detail-empty p { margin: 4px 0; }
.detail-empty-hint { font-size: 12px; color: var(--text-faint); margin-top: 8px; }

.detail-content { display: flex; flex-direction: column; gap: 16px; }
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.detail-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.detail-close {
  width: 26px; height: 26px;
  border-radius: 6px;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  transition: all var(--transition);
}
.detail-close:hover { background: var(--surface-alt); color: var(--text); }

.detail-title {
  border: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.012em;
  background: transparent;
  outline: none;
  padding: 4px 0;
  width: 100%;
  color: var(--text);
}
.detail-title:focus { background: var(--surface-alt); border-radius: var(--radius-sm); padding: 4px 8px; margin: 0 -8px; }

/* Description: view/edit swap */
.detail-description-wrap { position: relative; }
.detail-description-view {
  min-height: 40px;
  padding: 8px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  cursor: text;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.detail-description-view:hover { background: var(--surface-alt); padding: 8px; margin: 0 -8px; }
.detail-description-view p { margin: 0 0 8px; }
.detail-description-view p:last-child { margin-bottom: 0; }
.detail-description-view ul, .detail-description-view ol { padding-left: 18px; margin: 4px 0 8px; }
.detail-description-view li { margin: 2px 0; }
.detail-description-view code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  background: var(--surface-alt);
  padding: 1px 4px;
  border-radius: 3px;
}
.detail-description-view pre {
  background: var(--surface-alt);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.detail-description-view a { color: var(--accent); text-decoration: underline; }
.detail-description-view strong { color: var(--text); font-weight: 600; }

.detail-description-edit {
  display: none;
  width: 100%;
  border: 0;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin: 0 -8px;
  resize: vertical;
  min-height: 100px;
  outline: none;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  font-family: inherit;
}
.detail-description-wrap.editing .detail-description-view { display: none; }
.detail-description-wrap.editing .detail-description-edit { display: block; }

.detail-section { display: flex; flex-direction: column; gap: 6px; }
.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.detail-channel, .detail-recurrence {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  transition: border var(--transition);
}
.detail-channel:focus, .detail-recurrence:focus { border-color: var(--accent); }

/* Combobox (searchable dropdown) — input + hidden value + filterable popover.
   Used wherever a <select> would be too long to scan (client/project/task
   pickers). Markup contract: src/views/partials/_combobox.ejs. */
.combobox { position: relative; display: inline-flex; align-items: stretch; min-width: 0; }
.combobox-input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border var(--transition);
}
.combobox-input:focus { border-color: var(--accent); }
.combobox-caret {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-faint); font-size: 11px;
  pointer-events: auto;
}
.combobox-options {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  list-style: none; padding: 4px; margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1500;
}
.combobox-options.hidden { display: none; }
.combobox-option {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
}
.combobox-option:hover,
.combobox-option.is-highlighted { background: var(--surface-alt); }
.combobox-option.is-selected { color: var(--accent); font-weight: 500; }
.combobox-option-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.combobox-option-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combobox-option-secondary { color: var(--text-faint); font-size: 11px; flex-shrink: 0; }

.schedule-buttons {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  padding: 3px;
  border-radius: var(--radius-sm);
}
.schedule-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 5px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.schedule-btn:hover { color: var(--text); }
.schedule-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}


.detail-tags-input {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  color: var(--text);
  transition: border var(--transition);
}
.detail-tags-input:focus { border-color: var(--accent); }
.detail-tags-display { display: flex; flex-wrap: wrap; gap: 4px; }

.detail-subtask-list { display: flex; flex-direction: column; gap: 1px; }
.detail-subtask-list .task-row { padding: 4px 0; }

.detail-add-subtask input {
  border: 0;
  border-bottom: 1px dashed var(--border);
  background: transparent;
  padding: 6px 0;
  font-size: 13px;
  outline: none;
  width: 100%;
  color: var(--text-muted);
}
.detail-add-subtask input:focus { border-bottom-color: var(--accent); border-bottom-style: solid; color: var(--text); }

.detail-footer {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.detail-delete {
  font-size: 12px;
  color: var(--text-faint);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.detail-delete:hover { color: var(--danger); background: var(--danger-soft); }
.detail-promote-btn {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.detail-promote-btn:hover { color: var(--text); background: var(--surface-alt); }

/* ----- Quick-add modal ----- */
.quick-add {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 90vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 1000;
}
.quick-add.hidden { display: none; }
.quick-add::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15,15,17,.18);
  z-index: -1;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 100vh;
  top: -30vh;
}
.quick-add-form { display: flex; align-items: center; gap: 8px; padding: 14px 18px; }
.quick-add-form input[type="text"] {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
  padding: 6px 0;
  color: var(--text);
}
.quick-add-form select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  background: var(--surface-alt);
  color: var(--text);
}
.quick-add-combobox { flex: 0 0 200px; }
.quick-add-combobox .combobox-input {
  font-size: 12px;
  padding: 4px 24px 4px 8px;
  background: var(--surface-alt);
}
.quick-add-form button[type="submit"] {
  background: var(--accent);
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: opacity var(--transition);
}
.quick-add-form button[type="submit"]:hover { opacity: 0.9; }
.quick-add-hint {
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: white;
  opacity: 0.7;
}

/* ----- Search modal ----- */
.search {
  position: fixed;
  inset: 0;
  background: rgba(15,15,17,.20);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.search.hidden { display: none; }
.search-inner {
  width: min(640px, 90vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}
.search-header { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.search-header input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
  color: var(--text);
}
#search-results { overflow-y: auto; padding: 4px 0; }
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background var(--transition);
}
.search-result:hover, .search-result.focused { background: var(--accent-soft); }
.search-result-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.search-result-meta { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.search-empty { padding: 20px; color: var(--text-muted); font-size: 13px; text-align: center; }

/* ----- Timeline pane (Today / Tomorrow) ----- */
.timeline-pane {
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 0 40px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.timeline-header {
  padding: 0 20px 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.timeline-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint);
}
.timeline-total { font-size: 12px; color: var(--text-muted); font-feature-settings: 'tnum'; }
.timeline-loading { padding: 24px 20px; font-size: 12px; }

.timeline {
  position: relative;
  margin: 0 12px 0 56px;
}

/* Hide any task <li> that Sortable temporarily inserts into the timeline pane while
   a drag is in flight. The actual drop is handled by onAdd; without this, the user
   sees their dragged row pinned to the top of the schedule pane instead of following
   the cursor. */
.timeline-pane .task,
.timeline-pane .subtask,
.timeline[data-date] > .task,
.timeline[data-date] > .subtask { display: none !important; }
.timeline-hour {
  position: absolute;
  left: -56px; right: 0;
  border-top: 1px dashed var(--border);
  pointer-events: none;
}
.timeline-hour-label {
  font-size: 10.5px;
  color: var(--text-faint);
  font-feature-settings: 'tnum';
  position: absolute;
  top: -7px; left: 8px;
  background: var(--surface);
  padding: 0 4px;
}

.timeline-block {
  position: absolute;
  left: 40%; right: 4px;
  background: color-mix(in srgb, var(--block-color) 16%, var(--surface));
  border-left: 3px solid var(--block-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px 4px;
  overflow: hidden;
  transition: box-shadow var(--transition), opacity var(--transition);
}

/* Google Calendar events (read-only, left lane) */
.timeline-event {
  position: absolute;
  left: 4px;
  width: calc(38% - 6px);
  background: repeating-linear-gradient(
    135deg,
    var(--surface-alt) 0 6px,
    transparent 6px 12px
  );
  background-color: var(--surface);
  border-left: 2px solid var(--text-faint);
  border-radius: var(--radius-sm);
  padding: 3px 6px 3px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  transition: background var(--transition);
}
.timeline-event:hover { background-color: var(--surface-alt); }
.timeline-event-time {
  font-size: 10px;
  color: var(--text-faint);
  font-feature-settings: 'tnum';
  line-height: 1.2;
}
.timeline-event-title {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 1px;
}

.timeline-allday {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px 16px 10px;
  margin: 0 8px 6px;
  border-bottom: 1px dashed var(--border);
}
.timeline-allday-event {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-alt);
  border-left: 2px solid var(--text-faint);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-allday-event:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface-alt)); color: var(--text); }
.timeline-allday-event::before { content: '📅'; margin-right: 5px; opacity: 0.6; font-size: 10px; }
.timeline-block:hover { box-shadow: var(--shadow-soft); }
.timeline-block.is-done {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}
.timeline-block.dragging { opacity: 0.4; }
.timeline-block.unscheduling {
  opacity: 0.55;
  outline: 2px dashed #DC2626;
  outline-offset: -2px;
}
html[data-theme="dark"] .timeline-block.unscheduling { outline-color: #F87171; }
.timeline-block-handle {
  cursor: grab;
  user-select: none;
  height: calc(100% - 6px);
}
.timeline-block-handle:active { cursor: grabbing; }
.timeline-block-time {
  font-size: 10.5px;
  color: var(--text-muted);
  font-feature-settings: 'tnum';
  line-height: 1.2;
}
.timeline-block-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 1px;
}
.timeline-block-resize {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 7px;
  cursor: ns-resize;
}
.timeline-block-resize:hover {
  background: color-mix(in srgb, var(--block-color) 35%, transparent);
}

.timeline-drop-indicator {
  position: absolute;
  left: 4px; right: 4px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
}
.timeline.is-drop-target {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

/* Priority flag on task rows + select buttons */
.prio-flag {
  flex-shrink: 0;
  width: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  margin-right: -2px;
}
.prio-flag-high { color: #DC2626; }
.prio-flag-low  { color: var(--text-faint); font-weight: 700; }
html[data-theme="dark"] .prio-flag-high { color: #F87171; }

.task.prio-low > .task-row > .task-title { color: var(--text-muted); }

.priority-buttons .priority-high.active { color: #DC2626; }
.priority-buttons .priority-low.active  { color: var(--text-muted); }
html[data-theme="dark"] .priority-buttons .priority-high.active { color: #F87171; }

/* Time pill on task rows */
.time-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  font-feature-settings: 'tnum';
  white-space: nowrap;
}

/* /priority page — triage wizard at the top + 3 priority buckets below. */
.priority-main {
  padding: 16px 20px;
  max-width: 980px;
  display: flex;
  flex-direction: column;
}
.priority-wizard-section {
  margin-bottom: 24px;
}
.priority-wizard {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.priority-wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.priority-wizard-counter strong { color: var(--accent); font-weight: 700; font-feature-settings: 'tnum'; }
.priority-wizard-hint { font-size: 11px; color: var(--text-faint); }
.priority-wizard-hint kbd {
  font-size: 10px;
  padding: 0 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  margin: 0 1px;
}
.priority-wizard-task {
  padding: 10px 0 14px;
}
.priority-wizard-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.3;
}
.priority-wizard-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.priority-wizard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.priority-btn {
  flex: 1 1 0;
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.priority-btn:hover { border-color: var(--accent); background: var(--surface-alt); }
.priority-btn-high:hover  { color: #d97706; border-color: #d97706; background: color-mix(in srgb, #d97706 10%, var(--surface)); }
.priority-btn-low         { color: var(--text-muted); }
.priority-btn-skip        { color: var(--text-muted); flex: 0 1 auto; }
.priority-btn kbd {
  font-size: 10px;
  padding: 1px 5px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-family: inherit;
}
.priority-wizard-done {
  text-align: center;
  padding: 28px 16px;
}
/* Mobile: wizard buttons need a 44×44 minimum tap target. */
@media (max-width: 640px) {
  .priority-btn { min-height: 44px; min-width: 0; flex-basis: 40%; }
  .priority-btn-skip { flex-basis: 100%; }
}
.priority-wizard-done-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 20px;
  margin-bottom: 8px;
}
.priority-wizard-done h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 8px 0 4px;
}
.priority-wizard-done p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

.priority-overview { display: flex; flex-direction: column; gap: 18px; }
.priority-bucket-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.priority-bucket-title { font-size: 13px; font-weight: 600; margin: 0; }
.priority-bucket-count {
  font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  background: var(--surface-alt); color: var(--text-muted);
  font-feature-settings: 'tnum';
}
.priority-bucket-high   .priority-bucket-title { color: #d97706; }
.priority-bucket-low    .priority-bucket-title { color: var(--text-muted); }
.priority-bucket-list   { margin: 0; padding: 0; list-style: none; }

/* Right-click context menu on task rows — small floating panel positioned at
   cursor. Shift+RightClick falls through to the native browser menu. */
.task-ctx-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  padding: 4px;
  min-width: 160px;
  z-index: 2000;
  font-size: 12.5px;
}
.task-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.task-ctx-item:hover { background: var(--surface-alt); }
.task-ctx-item.is-danger { color: var(--red, #dc2626); }
.task-ctx-item.is-danger:hover { background: color-mix(in srgb, var(--red, #dc2626) 10%, var(--surface-alt)); }
.task-ctx-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* `⋮` dots button — surfaces the right-click menu as a discoverable affordance.
   Faint by default, full opacity on row hover or focus. */
.task-ctx-dots {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; min-height: 24px;
  padding: 1px 3px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.task-row:hover .task-ctx-dots,
.task-ctx-dots:focus-visible { opacity: 0.85; }
.task-ctx-dots:hover { background: var(--surface-alt); color: var(--text); opacity: 1; }

/* MRR tier badges — derived from client.mrr at render time (thresholds in
   db.js:mrrToTier). T1 = highest-value client, T3 = smallest recurring. Shown
   next to channel chip on task rows + on client cards + on /client/:id header. */
.mrr-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-feature-settings: 'tnum';
  border: 1px solid transparent;
}
/* T1 uses teal (not amber) to stay out of the priority-flag color gamut —
   the high-priority ⚑ is already amber/red, and we don't want T1 + ⚑ to fight. */
.mrr-tier-1 {
  background: color-mix(in srgb, #0d9488 18%, transparent);
  color: #0d9488;
  border-color: color-mix(in srgb, #0d9488 35%, transparent);
}
.mrr-tier-2 {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}
.mrr-tier-3 {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
}
html[data-theme="dark"] .mrr-tier-1 {
  background: color-mix(in srgb, #5eead4 14%, transparent);
  color: #5eead4;
  border-color: color-mix(in srgb, #5eead4 30%, transparent);
}
.client-mrr-value {
  font-size: 12px;
  color: var(--text-muted);
  font-feature-settings: 'tnum';
  margin-left: -4px;
}

/* MRR input inside the client-edit popover */
.channel-edit-mrr {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  margin-top: 4px;
}
.channel-edit-mrr > span:first-child {
  min-width: 32px;
  font-weight: 500;
}
.channel-edit-mrr input[type="number"] {
  flex: 1;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  font-feature-settings: 'tnum';
}
.channel-edit-mrr-unit {
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-faint);
}

/* Estimate pill — duration without a fixed start_time. Subdued vs time-pill
   so the eye still goes to time-blocked tasks first. */
.duration-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  font-feature-settings: 'tnum';
  white-space: nowrap;
}

/* Date pill — future-scheduled tasks (shown wherever they're visible) */
.date-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-feature-settings: 'tnum';
  white-space: nowrap;
}

/* Scheduled view: group headings */
.task-group-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.task-group-heading:first-of-type { padding-top: 4px; }
.task-group-count {
  font-size: 10px;
  font-weight: 500;
  background: var(--surface-alt);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}
.task-list-sub { margin-top: 0; }

/* ---------- Week view ---------- */
.week-main { padding: 12px 16px 16px; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.week-toolbar {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.week-nav { display: flex; gap: 4px; }
.week-nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px;
  padding: 0 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.week-nav-btn:hover { color: var(--text); border-color: var(--accent); }
.week-nav-today { font-weight: 600; }
.week-title { font-size: 18px; font-weight: 600; color: var(--text); margin: 0; flex: 1; }

/* Stale-tasks nudge on /week — only renders when backend reports staleCount > 0. */
.stale-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  margin-bottom: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber, #d97706);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text);
}
.stale-banner-icon { color: var(--amber, #d97706); font-size: 14px; }
.stale-banner-text { flex: 1; }
.stale-banner-cta {
  color: var(--accent); font-weight: 600;
  white-space: nowrap;
}
.stale-banner-dismiss {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.stale-banner-dismiss:hover { background: var(--surface); color: var(--text); }
body.stale-dismissed .stale-banner { display: none; }

/* /week layout: 7-day grid (left) + collapsible backlog rail (right). */
.week-layout {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 0;
}
/* /week is now a 7-column planning board (replaces the old timeline grid).
   Each column is a vertical drop-zone — drop a task into another column to
   change its scheduled_date (same Sortable wiring as /plan). */
.week-plan-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
/* Hide-weekends pref: drop Sat/Sun and reflow to 5 even columns. Set on body via
   the settings popover (data-pref="hide-weekends"). Task counts in the header
   still reflect all 7 days — hidden columns are visual only, not data-level. */
body.pref-hide-weekends .week-plan-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
body.pref-hide-weekends .week-plan-col.is-weekend {
  display: none;
}
.week-plan-col {
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.week-plan-col.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.week-plan-col-header {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px 6px;
  position: sticky; top: 0;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.week-plan-weekday {
  font-size: 10.5px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.week-plan-daynum {
  font-size: 16px; font-weight: 600; color: var(--text);
  font-feature-settings: 'tnum';
}
.week-plan-col.is-today .week-plan-weekday { color: var(--accent); }
.week-plan-col.is-today .week-plan-daynum  { color: var(--accent); }
.week-plan-count {
  font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-feature-settings: 'tnum';
  margin-left: auto;
}
.week-plan-col-header .capacity-pill {
  flex-basis: 100%;
  margin-top: 2px;
  font-size: 10px;
}
.week-plan-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px 16px;
  list-style: none;
  margin: 0;
  min-height: 60px;
}
.week-plan-empty {
  color: var(--text-faint);
  font-size: 11px;
  text-align: center;
  padding: 16px 6px;
  pointer-events: none;
  font-style: italic;
}
/* Hide the empty placeholder the moment a real task is in the list (e.g. after
   per-column quick-add appends a new row). Reload reveals it again if the list
   truly empties out. */
.week-plan-list:has(li.task) .week-plan-empty { display: none; }

/* Calendar events strip between the column header and the task list. Muted
   styling so meetings don't outshout tasks; they're context, not work items. */
.week-plan-events {
  list-style: none; margin: 0;
  padding: 4px 6px 0;
  display: flex; flex-direction: column; gap: 2px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 6px;
  margin-bottom: 2px;
}
.week-plan-event {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  min-width: 0;
}
.week-plan-event a {
  display: flex; gap: 6px; min-width: 0; flex: 1;
  text-decoration: none;
  color: inherit;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background var(--transition);
}
.week-plan-event a:hover { background: var(--surface-alt); color: var(--text); }
.week-plan-event-time {
  font-feature-settings: 'tnum';
  font-weight: 600;
  flex-shrink: 0;
  color: var(--text-faint);
}
.week-plan-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.week-plan-event.is-all-day .week-plan-event-time { font-style: italic; font-weight: 500; }

/* Per-column quick-add — pinned to the bottom of each column, looks like
   placeholder text by default; brightens on focus. */
.week-quickadd-form {
  padding: 4px 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  flex-shrink: 0;
}
.week-quickadd-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: all var(--transition);
}
.week-quickadd-input::placeholder {
  color: var(--text-faint);
}
.week-quickadd-input:focus {
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
}

/* Compact rows for narrow column layout: row wraps so the title (clamped to 2
   lines) gets its own line, then chips/badges flow on a second row. The date-pill
   is hidden — the column header already shows the date, no need to repeat it. */
.week-plan-list .task { padding: 2px 4px; }
.week-plan-list .task-row {
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 6px 8px;
  min-height: 0;
}
.week-plan-list .task-title {
  flex: 1 1 100%;
  min-width: 0;
  white-space: normal;
  font-size: 12.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.week-plan-list .task .channel-chip,
.week-plan-list .task .project-chip,
.week-plan-list .task .tag-chip,
.week-plan-list .task .time-pill,
.week-plan-list .task .duration-pill { font-size: 10px; padding: 0 5px; }
.week-plan-list .task .project-chip { max-width: 90px; }
.week-plan-list .task .date-pill { display: none; }
.week-plan-list .task .drag-handle { display: none; }
.week-plan-list .task .subtask-toggle { padding: 0 4px; font-size: 10px; }
.week-plan-list .task .checkbox { width: 16px; height: 16px; }
.week-plan-list .task .track-btn { width: 16px; height: 16px; }
/* Tighten signal-to-noise: recurrence/subtask chevron + ⋮ menu are hidden until
   row-hover so the column reads as title + chip + tier first. They stay
   reachable via right-click and the detail modal. */
.week-plan-list .task .recurring-badge,
.week-plan-list .task .subtask-toggle,
.week-plan-list .task .task-ctx-dots,
.backlog-rail-list .task .recurring-badge,
.backlog-rail-list .task .subtask-toggle,
.backlog-rail-list .task .task-ctx-dots { display: none; }
.week-plan-list .task .task-row:hover .recurring-badge,
.week-plan-list .task .task-row:hover .subtask-toggle,
.week-plan-list .task .task-row:hover .task-ctx-dots,
.backlog-rail-list .task .task-row:hover .recurring-badge,
.backlog-rail-list .task .task-row:hover .subtask-toggle,
.backlog-rail-list .task .task-row:hover .task-ctx-dots { display: inline-flex; }

/* Mobile: stack columns vertically; one big scrollable list. */
@media (max-width: 900px) {
  .week-plan-grid,
  body.pref-hide-weekends .week-plan-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    overflow-y: auto;
  }
  body.pref-hide-weekends .week-plan-col.is-weekend { display: none; }
  .week-main { overflow: visible; height: auto; }
  .week-plan-grid { overflow: visible; }
  .week-plan-col { max-height: none; }
  .week-plan-list { max-height: none; overflow: visible; }
  .week-toolbar { flex-wrap: wrap; }
  .week-title { font-size: 15px; }
  /* Backlog rail loses its purpose without horizontal columns — fold it away. */
  .backlog-rail { display: none; }
  .week-layout { display: block; }
}

/* Backlog rail — right side of /week. Drag in to schedule onto a day; drag
   out (onto a day column) to schedule; drop here from a day to unschedule
   (data-scheduled-date="" empty string → POST sets scheduled_date = null). */
.backlog-rail {
  width: 220px;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: width var(--transition);
}
.backlog-rail-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 6px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.backlog-rail-title {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  flex: 1;
}
.backlog-rail-count {
  font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-feature-settings: 'tnum';
}
.backlog-rail-collapse {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: transform var(--transition), color var(--transition);
}
.backlog-rail-collapse:hover { color: var(--text); }
.backlog-rail-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px 12px;
  list-style: none;
  margin: 0;
  min-height: 60px;
}
/* Match compact row treatment with the day columns */
.backlog-rail-list .task { padding: 2px 4px; }
.backlog-rail-list .task-row {
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 6px 8px;
  min-height: 0;
}
.backlog-rail-list .task-title {
  flex: 1 1 100%;
  min-width: 0;
  white-space: normal;
  font-size: 12.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.backlog-rail-list .task .channel-chip,
.backlog-rail-list .task .project-chip,
.backlog-rail-list .task .tag-chip,
.backlog-rail-list .task .time-pill,
.backlog-rail-list .task .duration-pill { font-size: 10px; padding: 0 5px; }
.backlog-rail-list .task .project-chip { max-width: 90px; }
.backlog-rail-list .task .drag-handle { display: none; }
.backlog-rail-list .task .subtask-toggle { padding: 0 4px; font-size: 10px; }
.backlog-rail-list .task .checkbox { width: 16px; height: 16px; }
.backlog-rail-list .task .track-btn { width: 16px; height: 16px; }

/* Hide the empty placeholder when at least one real task is in the rail. */
.backlog-rail-list:has(li.task) .week-plan-empty { display: none; }

/* Collapsed state: 32px sliver. Title rotated vertically; list hidden so the
   user can still see what's there without losing horizontal space. */
body.pref-backlog-rail-collapsed .backlog-rail {
  width: 32px;
}
body.pref-backlog-rail-collapsed .backlog-rail-list {
  display: none;
}
body.pref-backlog-rail-collapsed .backlog-rail-header {
  flex-direction: column;
  padding: 8px 4px;
  gap: 8px;
  height: 100%;
  border-bottom: none;
}
body.pref-backlog-rail-collapsed .backlog-rail-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  flex: 0;
  text-align: center;
}
body.pref-backlog-rail-collapsed .backlog-rail-collapse {
  transform: rotate(180deg);
}

/* Schedule section: native date picker */
.schedule-date-row {
  margin-top: 6px;
  display: flex;
}
.schedule-date-input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border var(--transition);
}
.schedule-date-input:focus { border-color: var(--accent); }
.schedule-date-input.has-value { border-color: var(--accent); color: var(--accent); }

/* Detail timeblock row */
.detail-timeblock-row { display: flex; gap: 6px; align-items: center; }
.detail-timeblock-row input[type=time] { flex: 0 0 auto; min-width: 0; }
.detail-timeblock-row select { flex: 1; min-width: 0; }
.detail-timeblock-clear {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--text-faint);
  font-size: 18px; line-height: 1;
  flex: 0 0 auto;
}
.detail-timeblock-clear:hover { background: var(--danger-soft); color: var(--danger); }

/* ----- Plan view (no right column) ----- */
.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  height: calc(100vh - 100px);
  padding: 0;
  min-width: 0;
}
.plan-column {
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.plan-column-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.plan-column-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.plan-column-meta { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.plan-column .task-list { flex: 1; overflow-y: auto; min-width: 0; }
.plan-column .task-title { font-size: 13px; }
.plan-column .channel-chip { font-size: 10px; padding: 1px 6px; }

/* ----- Ritual ----- */
.ritual-wrap {
  max-width: 640px;
  margin: 5vh auto;
  padding: 32px 28px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.ritual-step-counter {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.ritual-task-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 4px 0 16px; }
.ritual-task-meta { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.ritual-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ritual-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--surface-alt);
  color: var(--text);
  transition: all var(--transition);
}
.ritual-btn:hover { background: var(--accent-soft); color: var(--accent); }
.ritual-btn.primary { background: var(--accent); color: white; }
.ritual-btn.primary:hover { opacity: 0.9; background: var(--accent); color: white; }
.ritual-done { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.ritual-done-icon { font-size: 32px; margin-bottom: 12px; }

/* ----- Clients overview ----- */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.client-card {
  display: block;
  padding: 18px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  color: var(--text);
}
.client-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.client-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.client-card-name { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.client-card-domain { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.client-card-notes { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 6px 0 12px; }
.client-card-stats { display: flex; gap: 18px; padding-top: 10px; border-top: 1px solid var(--border); }
.client-card-stat { display: flex; flex-direction: column; }
.client-card-stat-num { font-size: 16px; font-weight: 600; font-feature-settings: 'tnum'; }
.client-card-stat-label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* Single client view */
.client-header { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.client-header-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.client-domain-link { font-size: 13px; color: var(--text-muted); margin-left: 4px; }
.client-domain-link:hover { color: var(--accent); }
.client-notes-display { color: var(--text-muted); font-size: 13px; line-height: 1.55; margin: 0; max-width: 60ch; }

.section-title { font-size: 14px; font-weight: 600; margin: 0 0 12px; color: var(--text); }
.section-header { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 12px; }
.section-subhead { color: var(--text-muted); font-size: 13px; cursor: pointer; padding: 6px 0; user-select: none; }
.section-subhead:hover { color: var(--text); }

.client-goals-section, .client-tasks-section, .client-add-goal-section,
.goal-progress-section, .goal-tasks-section { margin-bottom: 28px; }

/* Shared visual primitives — class names are historical (goals feature removed);
   now used exclusively by Projects views (app_project.ejs, app_projects.ejs, app_client.ejs). */
.goal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.goal-card, .goal-card-mini {
  display: block;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  color: var(--text);
}
.goal-card:hover, .goal-card-mini:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.goal-card-mini { padding: 12px 14px 10px; }
.goal-card-header, .goal-card-mini-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.goal-card-title { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -.01em; line-height: 1.35; }
.goal-card-mini .goal-card-title { font-size: 13.5px; }
.goal-card-date { font-size: 11px; color: var(--text-faint); font-feature-settings: 'tnum'; white-space: nowrap; }
.goal-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.goal-card-metric, .goal-card-metric-inline { font-size: 12px; color: var(--text-muted); font-style: italic; }
.goal-card-progress-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; font-feature-settings: 'tnum'; }

.progress-bar-wrap {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 99px;
  overflow: hidden;
  margin: 6px 0 0;
}
.progress-bar-wrap.large { height: 10px; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--done)));
  border-radius: 99px;
  transition: width var(--transition);
}

/* Goal detail */
.goal-header { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.goal-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  margin-bottom: 10px;
}
.goal-breadcrumb:hover { color: var(--text); }
.goal-title-edit { font-size: 28px; padding: 4px 0; margin-bottom: 12px; letter-spacing: -.015em; }
.goal-meta-row { display: flex; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
.goal-meta-item { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.goal-metric-edit {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  color: var(--text);
}
.goal-metric-edit:focus { border-color: var(--accent); }
.goal-description-edit {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  color: var(--text);
}
.goal-description-edit:focus { border-color: var(--accent); }
.goal-progress-badge { font-size: 18px; font-weight: 600; color: var(--accent); font-feature-settings: 'tnum'; }
.progress-source-row { margin: 10px 0 14px; }
.progress-manual-row { display: flex; align-items: center; gap: 10px; }
.progress-manual-row input[type=range] { flex: 1; max-width: 280px; }

.goal-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Add-goal form */
.add-goal-details { padding: 8px 0; }
.add-goal-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
  background: var(--surface-alt);
  border-radius: var(--radius);
}
.add-goal-form input, .add-goal-form select, .add-goal-form textarea {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  color: var(--text);
  font-family: inherit;
}
.add-goal-form input:focus, .add-goal-form select:focus, .add-goal-form textarea:focus { border-color: var(--accent); }
.add-goal-form input[name="title"] { grid-column: 1 / -1; }
.add-goal-form textarea { grid-column: 1 / -1; }
.add-goal-form button { grid-column: 2; justify-self: end; }
.primary-btn {
  background: var(--accent);
  color: white;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: opacity var(--transition);
}
.primary-btn:hover { opacity: 0.9; }

.project-badge { font-size: 11px; color: var(--text-muted); }

.project-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: rgba(127,127,127,.10);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}
.project-chip:hover { color: var(--text); background: rgba(127,127,127,.16); }
.project-chip-icon { font-size: 10px; opacity: 0.7; }

/* ----- Sortable drag ----- */
.sortable-ghost { opacity: 0.4; background: var(--accent-soft) !important; }
.sortable-chosen { cursor: grabbing; }
.sortable-drag { background: var(--surface) !important; box-shadow: var(--shadow-modal); }

.task.selected, .subtask.selected {
  background: var(--accent-soft);
  outline: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.task.focused, .subtask.focused { background: rgba(127,127,127,.08); }

/* ----- Mobile responsive ----- */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0;
    z-index: 50;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--transition);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-modal); }
  .timeline-pane { display: none; }
  body[data-view="today"] .app,
  body[data-view="tomorrow"] .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .main { padding: 16px 20px; overflow-x: hidden; }
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .mobile-topbar button {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
  }
  .mobile-topbar-title {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
  }
  body { height: auto; min-height: 100vh; }
  .app { height: auto; min-height: calc(100vh - 44px); }
  .main { overflow-y: visible; }
  .plan-grid { grid-template-columns: 1fr; height: auto; }
}
@media (max-width: 900px) {
  .task-row {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 6px 12px;
  }
  .task-row .prio-flag { order: -1; flex-shrink: 0; }
  .task-row .checkbox { order: -1; flex-shrink: 0; }
  .task-row .task-title { flex: 1 1 0; min-width: 80px; font-size: 13px; }
  .task-row { overflow: hidden; }
  .list-header { flex-wrap: wrap; gap: 6px; }
  .capacity-pill { font-size: 10px; white-space: nowrap; }
  .task-row .channel-chip { font-size: 10px; padding: 1px 6px; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .task-row .track-btn { display: none; }
  .task-row .duration-pill,
  .task-row .time-pill,
  .task-row .mrr-tier,
  .task-row .project-chip,
  .task-row .tag-chip,
  .task-row .date-pill,
  .task-row .recurring-badge,
  .task-row .subtask-toggle,
  .task-row .task-ctx-dots { display: none; }
}
@media (min-width: 901px) {
  .mobile-topbar { display: none; }
}

/* ----- Time tracking ----- */
:root, html[data-theme="light"] { --tracking: #EF4444; --tracking-soft: #FEE2E2; }
html[data-theme="dark"]         { --tracking: #F87171; --tracking-soft: rgba(248,113,113,0.15); }

#timer-widget { position: fixed; right: 16px; bottom: 16px; z-index: 40; }
.detail-modal:not(.hidden) ~ #timer-widget { opacity: 0.45; }
.detail-modal:not(.hidden) ~ #timer-widget:hover { opacity: 1; }

.timer-widget-idle { position: relative; }
.timer-widget-idle > summary {
  list-style: none;
  width: 44px; height: 44px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--tracking);
  font-size: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.timer-widget-idle > summary::-webkit-details-marker { display: none; }
.timer-widget-idle > summary:hover { transform: scale(1.06); box-shadow: var(--shadow-modal); }
.timer-widget-popover {
  position: absolute; right: 0; bottom: 52px;
  width: 280px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column; gap: 8px;
}
.timer-widget-popover input[type="text"],
.timer-widget-popover select {
  width: 100%; padding: 6px 8px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
}
.timer-widget-popover-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.timer-widget-popover-start {
  padding: 8px; border-radius: var(--radius-sm);
  background: var(--tracking); color: white; font-weight: 600;
}
.timer-widget-popover-start:hover { filter: brightness(1.08); }

.timer-widget-active {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 14px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--tracking);
  box-shadow: var(--shadow-modal);
  min-width: 220px; max-width: 360px;
}
.timer-widget-active .timer-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
  animation: timer-pulse 1.4s ease-in-out infinite;
}
.timer-widget-active .timer-title {
  flex: 1; min-width: 0;
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timer-widget-active .timer-elapsed {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--tracking);
}
.timer-widget-active .timer-stop {
  width: 28px; height: 28px; border-radius: 14px;
  background: var(--tracking-soft); color: var(--tracking);
  display: grid; place-items: center;
  font-size: 12px;
  transition: background var(--transition);
}
.timer-widget-active .timer-stop:hover { background: var(--tracking); color: white; }
@keyframes timer-pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.35 } }

/* Track button on task rows */
.track-btn {
  width: 24px; height: 24px; flex-shrink: 0;
  border-radius: 12px;
  color: var(--text-muted);
  opacity: 0;
  font-size: 10px;
  display: grid; place-items: center;
  transition: opacity var(--transition), color var(--transition), background var(--transition);
}
.task:hover .track-btn { opacity: 0.55; }
.track-btn:hover { opacity: 1; background: var(--surface-alt); }
.track-btn::before { content: '▶'; }
.track-btn.is-tracking {
  opacity: 1;
  color: var(--tracking);
  background: var(--tracking-soft);
}
.track-btn.is-tracking::before { content: '⏸'; }

/* Detail-panel tracking section */
.detail-tracking-summary {
  display: flex; align-items: baseline; gap: 6px;
  margin: 6px 0 10px;
  color: var(--text-muted);
}
.detail-tracking-total strong { color: var(--text); font-weight: 600; }
.detail-tracking-actions { margin-bottom: 10px; }
.detail-tracking-btn {
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--tracking-soft); color: var(--tracking);
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}
.detail-tracking-btn:hover { background: var(--tracking); color: white; }
.detail-tracking-btn.is-active { background: var(--tracking); color: white; }
.detail-tracking-btn.is-active:hover { filter: brightness(1.1); }

.detail-tracking-list { display: flex; flex-direction: column; gap: 2px; }
.detail-tracking-entry {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}
.detail-tracking-entry:hover { background: var(--surface-alt); }
.detail-tracking-entry.is-running { color: var(--tracking); }
.detail-tracking-when { font-variant-numeric: tabular-nums; }
.detail-tracking-dur { font-weight: 600; color: var(--text); margin-left: auto; }
.detail-tracking-entry.is-running .detail-tracking-dur { color: var(--tracking); }
.detail-tracking-note {
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.detail-tracking-del {
  width: 18px; height: 18px;
  color: var(--text-faint);
  opacity: 0;
  font-size: 14px; line-height: 1;
  transition: opacity var(--transition), color var(--transition);
}
.detail-tracking-entry:hover .detail-tracking-del { opacity: 1; }
.detail-tracking-del:hover { color: var(--danger); }
.detail-tracking-empty { color: var(--text-muted); font-size: 13px; margin: 4px 0; }

/* Idle widget — recents + free-form popover */
.timer-widget-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 2px 2px;
}
.timer-widget-recents { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.timer-widget-recents form { margin: 0; }
.timer-widget-recent-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--text);
  transition: background var(--transition);
}
.timer-widget-recent-btn:hover { background: var(--surface-alt); }
.timer-widget-recent-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.timer-widget-recent-label {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  line-height: 1.2;
}
.timer-widget-recent-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timer-widget-recent-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.timer-widget-recent-play {
  color: var(--text-faint);
  font-size: 10px;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}
.timer-widget-recent-btn:hover .timer-widget-recent-play {
  opacity: 1; color: var(--tracking);
}
.timer-widget-divider {
  height: 1px; background: var(--border);
  margin: 2px 0;
}
.timer-widget-form { display: contents; }

/* Active widget — clickable face + hidden edit form */
.timer-widget-active { position: relative; flex-wrap: wrap; }
.timer-widget-face {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  background: none; border: none; padding: 0;
  color: inherit; cursor: pointer;
  text-align: left;
}
.timer-widget-active.is-editing {
  padding: 12px;
  width: 320px; min-width: 320px; max-width: 320px;
  border-radius: var(--radius-lg);
  display: block;
}
.timer-widget-active.is-editing .timer-widget-face { display: none; }
.timer-widget-active.is-editing .timer-stop { display: none; }
.timer-widget-edit { display: none; }
.timer-widget-active.is-editing .timer-widget-edit { display: block; }
.timer-widget-edit-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.timer-widget-edit-label {
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}
.timer-widget-edit-row > input,
.timer-widget-edit-row > select {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px;
  box-sizing: border-box;
}
.timer-widget-edit-actions {
  display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px;
}
.timer-widget-edit-cancel,
.timer-widget-edit-save {
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
}
.timer-widget-edit-cancel { color: var(--text-muted); background: var(--surface-alt); }
.timer-widget-edit-cancel:hover { color: var(--text); }
.timer-widget-edit-save { color: white; background: var(--tracking); }
.timer-widget-edit-save:hover { filter: brightness(1.08); }

/* Detail panel — inline edit per entry */
.detail-tracking-entry > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}
.detail-tracking-entry > summary::-webkit-details-marker { display: none; }
.detail-tracking-entry > summary:hover { background: var(--surface-alt); }
.detail-tracking-entry[open] > summary { background: var(--surface-alt); }
.detail-tracking-edit {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 6px 6px;
  margin-top: 2px;
  min-width: 0;
}
.detail-tracking-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}
.detail-tracking-edit-row label,
.detail-tracking-edit-note {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
  font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
}
.detail-tracking-edit input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; font-weight: normal;
  text-transform: none; letter-spacing: normal;
  box-sizing: border-box;
}
.detail-tracking-edit-actions {
  display: flex; gap: 6px; justify-content: flex-end;
}
.detail-tracking-edit-cancel,
.detail-tracking-edit-save {
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  text-transform: none; letter-spacing: normal;
}
.detail-tracking-edit-cancel { color: var(--text-muted); background: var(--surface-alt); }
.detail-tracking-edit-save { color: white; background: var(--accent); }
.detail-tracking-edit-save:hover { filter: brightness(1.08); }

/* ----- Tracking overview page ----- */
.tracking-filter,
.reports-filter {
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.tracking-filter label,
.reports-filter label {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
}
.tracking-filter input,
.tracking-filter select,
.reports-filter input,
.reports-filter select {
  padding: 6px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; font-weight: normal;
  text-transform: none; letter-spacing: normal;
}
.tracking-filter button,
.reports-filter button {
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: white;
  font-size: 13px; font-weight: 600;
  transition: filter var(--transition);
}
.tracking-filter button:hover,
.reports-filter button:hover { filter: brightness(1.08); }
.tracking-auto-log {
  margin-left: auto;
  display: inline-flex !important; flex-direction: row !important;
  align-items: center; gap: 6px;
  font-size: 12px !important; text-transform: none !important; letter-spacing: 0 !important;
  font-weight: 500 !important; color: var(--text) !important;
  cursor: pointer;
}
.tracking-auto-log input[type="checkbox"] { width: 14px; height: 14px; }

/* Manual time-entry form: collapsed by default, expands on click. */
.tracking-add-entry {
  margin: 12px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.tracking-add-entry[open] {
  border-style: solid;
  background: var(--surface);
}
.tracking-add-entry-summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  list-style: none;
}
.tracking-add-entry-summary::-webkit-details-marker { display: none; }
.tracking-add-entry-summary:hover { color: var(--text); }
.tracking-add-entry-plus { font-size: 16px; opacity: 0.7; }
.tracking-add-entry-form {
  padding: 4px 14px 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.tracking-add-entry-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.tracking-add-entry-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
}
.tracking-add-entry-form label > span:first-child { display: flex; align-items: center; gap: 6px; }
.tracking-add-entry-hint { font-size: 10px; opacity: 0.7; text-transform: none; letter-spacing: 0; font-weight: 400; }
.tracking-add-entry-form input[type="text"],
.tracking-add-entry-form input[type="datetime-local"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: normal;
  text-transform: none; letter-spacing: normal;
}
.tracking-add-entry-form .combobox { width: 100%; }
.tracking-add-entry-form .combobox-input {
  background: var(--surface-alt);
  font-weight: normal;
  text-transform: none; letter-spacing: normal;
}
.tracking-add-entry-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.tracking-add-entry-actions button {
  padding: 6px 14px; font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text); cursor: pointer;
  font-weight: 500;
}
.tracking-add-entry-actions .primary-btn {
  background: var(--accent); color: white; border-color: var(--accent);
}
.tracking-add-entry-actions .primary-btn:hover { filter: brightness(1.08); }

/* "estimate" pill on auto-logged entries — distinguishes them from real tracked time. */
.tracking-entry-source {
  display: inline-flex; align-items: center;
  padding: 0 6px; height: 16px;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: 3px;
}
.tracking-entry.is-estimate > summary { opacity: 0.85; }
.tracking-entry.is-estimate .tracking-entry-dur { font-style: italic; }
.reports-csv-link {
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--surface-alt); color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
}
.reports-csv-link:hover { color: var(--text); }

.tracking-empty, .reports-empty {
  padding: 32px 20px; color: var(--text-muted);
  font-size: 14px;
}

.tracking-day { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.tracking-day-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.tracking-day-date { font-weight: 600; font-size: 14px; }
.tracking-day-total {
  font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--text-muted);
}
.tracking-day-list { display: flex; flex-direction: column; gap: 2px; }

.tracking-entry { background: transparent; }
.tracking-entry > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text);
}
.tracking-entry > summary::-webkit-details-marker { display: none; }
.tracking-entry > summary:hover { background: var(--surface-alt); }
.tracking-entry[open] > summary { background: var(--surface-alt); }
.tracking-entry-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.tracking-entry-dot-empty {
  background: transparent;
  border: 1px dashed var(--border-strong);
}
.tracking-entry-title {
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 1; min-width: 0;
}
.tracking-entry-note {
  color: var(--text-muted); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 180px;
}
.tracking-entry-chip {
  font-size: 11px;
  padding: 1px 6px;
  background: var(--surface-alt);
  border-radius: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.tracking-entry-chip-project { font-style: italic; }
.tracking-entry-when {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 12px;
}
.tracking-entry-dur {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 40px; text-align: right;
}
.tracking-entry.is-running .tracking-entry-dur,
.tracking-entry.is-running .tracking-entry-when { color: var(--tracking); }
.tracking-entry-del {
  width: 22px; height: 22px;
  color: var(--text-faint);
  opacity: 0;
  font-size: 16px; line-height: 1;
  transition: opacity var(--transition), color var(--transition);
}
.tracking-entry > summary:hover .tracking-entry-del { opacity: 1; }
.tracking-entry-del:hover { color: var(--danger); }

.tracking-entry-edit {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  margin: 4px 0 8px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  min-width: 0;
}
.tracking-entry-edit-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; min-width: 0;
}
.tracking-entry-edit-row label,
.tracking-entry-edit-note {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
  min-width: 0;
}
.tracking-entry-edit input {
  width: 100%; min-width: 0;
  padding: 5px 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; font-weight: normal;
  text-transform: none; letter-spacing: normal;
  box-sizing: border-box;
}
.tracking-entry-edit-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.tracking-entry-edit-actions button {
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border);
}
.tracking-entry-edit-save {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
}
.tracking-entry-edit-save:hover { filter: brightness(1.08); }

/* ----- Reports page ----- */
.reports-table {
  width: 100%; border-collapse: collapse;
  margin: 16px 20px 32px;
  width: calc(100% - 40px);
}
.reports-table thead th {
  text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
  padding: 6px 8px 10px;
  border-bottom: 1px solid var(--border);
}
.reports-table tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.reports-table tbody tr:hover td { background: var(--surface-alt); }
.reports-col-name { width: 30%; }
.reports-col-bar { width: 50%; }
.reports-col-total { width: 12%; text-align: right; font-variant-numeric: tabular-nums; }
.reports-col-count { width: 8%; text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.reports-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.reports-dot-empty {
  background: transparent; border: 1px dashed var(--border-strong);
}
.reports-name { font-weight: 500; }
.reports-sub {
  display: inline-block; margin-left: 6px;
  font-size: 11px; color: var(--text-muted);
}
.reports-bar-track {
  width: 100%; height: 8px;
  background: var(--surface-alt);
  border-radius: 4px; overflow: hidden;
}
.reports-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width var(--transition);
}

/* ----- Time budget ----- */
:root, html[data-theme="light"] {
  --budget-ok:   #10B981;
  --budget-warn: #F59E0B;
  --budget-over: var(--tracking);
  --budget-track: var(--surface-alt);
}
html[data-theme="dark"] {
  --budget-ok:   #34D399;
  --budget-warn: #FBBF24;
  --budget-over: var(--tracking);
}

.client-budget-section,
.project-budget-section {
  padding: 16px 20px;
}
.budget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.budget-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.budget-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
}
.budget-numbers {
  font-size: 13px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.budget-numbers strong { color: var(--text); }
.budget-of { margin: 0 2px; }
.budget-period { margin-left: 4px; }

.budget-bar-track {
  position: relative;
  width: 100%; height: 10px;
  background: var(--budget-track);
  border-radius: 5px;
  overflow: hidden;
}
.budget-bar-fill {
  height: 100%; border-radius: 5px;
  transition: width var(--transition), background var(--transition);
}
.budget-bar-ok   { background: var(--budget-ok); }
.budget-bar-warn { background: var(--budget-warn); }
.budget-bar-over { background: var(--budget-over); }

.budget-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
  font-size: 12px;
}
.budget-state { color: var(--text-muted); }
.budget-state-warn { color: var(--budget-warn); font-weight: 600; }
.budget-state-over { color: var(--budget-over); font-weight: 600; }

/* ----- Capacity pill (Today/Tomorrow list-header) ----- */
.capacity-pill {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-feature-settings: 'tnum';
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.capacity-pill-sep { opacity: 0.4; font-weight: 400; }
.capacity-pill-cap { font-weight: 400; opacity: 0.7; }
.capacity-pill-meeting { font-weight: 500; opacity: 0.85; }
.capacity-pill-warn {
  background: color-mix(in srgb, var(--budget-warn) 18%, var(--surface-alt));
  color: var(--budget-warn);
  border-color: color-mix(in srgb, var(--budget-warn) 40%, transparent);
}
.capacity-pill-over {
  background: color-mix(in srgb, var(--budget-over) 18%, var(--surface-alt));
  color: var(--budget-over);
  border-color: color-mix(in srgb, var(--budget-over) 40%, transparent);
}

.budget-edit { position: relative; }
.budget-edit-toggle {
  list-style: none; cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
}
.budget-edit-toggle::-webkit-details-marker { display: none; }
.budget-edit-toggle:hover { background: var(--surface-alt); }
.budget-edit[open] > .budget-form,
.budget-empty[open] > .budget-form {
  display: flex;
}

.budget-empty-cta {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  border: 1px dashed var(--border-strong);
}
.budget-empty-cta::-webkit-details-marker { display: none; }
.budget-empty-cta:hover {
  color: var(--text); border-color: var(--text-muted);
}

.budget-form {
  display: none; flex-direction: column; gap: 8px;
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  min-width: 0;
}
.budget-edit .budget-form {
  position: absolute; right: 0; top: 100%;
  margin-top: 4px;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  z-index: 10;
}
.budget-form-row {
  display: grid; grid-template-columns: 60px 1fr;
  gap: 8px; align-items: center;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); font-weight: 600;
  min-width: 0;
}
.budget-form-row input,
.budget-form-row select {
  width: 100%; min-width: 0;
  padding: 5px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; font-weight: normal;
  text-transform: none; letter-spacing: normal;
  box-sizing: border-box;
}
.budget-form-actions { display: flex; gap: 6px; justify-content: space-between; }
.budget-form-save,
.budget-form-delete {
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
}
.budget-form-save { background: var(--accent); color: white; }
.budget-form-save:hover { filter: brightness(1.08); }
.budget-form-delete { background: transparent; color: var(--danger); }
.budget-form-delete:hover { background: var(--danger-soft); }

/* Small budget pill on /clients overview cards */
.client-card-budget {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.client-card-budget-bar {
  width: 80px; height: 4px;
  background: var(--budget-track);
  border-radius: 2px; overflow: hidden;
}
.client-card-budget-fill {
  height: 100%; border-radius: 2px;
  transition: width var(--transition), background var(--transition);
}

@media (max-width: 600px) {
  #timer-widget { right: 12px; bottom: 12px; }
  .timer-widget-active { min-width: 180px; max-width: 250px; padding: 6px 10px 6px 12px; }
  .timer-widget-active.is-editing { min-width: 260px; max-width: 320px; }
  .timer-widget-popover { right: -8px; width: 260px; }
  .tracking-filter, .reports-filter { gap: 8px; }
  .reports-table { margin: 8px; width: calc(100% - 16px); font-size: 12px; }
  .reports-col-bar { display: none; }
}

/* ----- Undo toast ----- */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  animation: toast-in 200ms ease-out;
}
.undo-toast.is-leaving { animation: toast-out 200ms ease-in forwards; }
.undo-toast-btn {
  color: var(--accent);
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
}
html[data-theme="dark"] .undo-toast { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
html[data-theme="dark"] .undo-toast-btn { color: var(--accent); }
@keyframes toast-in  { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(-50%) translateY(0); } to { opacity: 0; transform: translateX(-50%) translateY(12px); } }

/* ----- Integrations ----- */
.integrations { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}
.integration-head { display: flex; align-items: center; gap: 14px; }
.integration-icon { font-size: 26px; line-height: 1; }
.integration-meta { flex: 1; min-width: 0; }
.integration-title { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.integration-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }
.integration-badge {
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  padding: 3px 8px; border-radius: 999px;
  background: var(--surface-alt); color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.integration-badge-ok { background: rgba(52,211,153,0.12); color: #047857; border-color: rgba(52,211,153,0.3); }
.integration-badge-warn { background: var(--accent-soft); color: var(--accent); border-color: rgba(79,70,229,0.18); }
html[data-theme="dark"] .integration-badge-ok {
  background: rgba(110,231,183,0.16);
  color: #6EE7B7;
  border-color: rgba(110,231,183,0.32);
}

.integration-lead { font-size: 14px; color: var(--text); margin: 0 0 10px; line-height: 1.55; }
.integration-body { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.integration-note { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.55; }
.integration-note code,
.integration-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
}
.integration-facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px;
  margin: 0; font-size: 13px;
}
.integration-facts > div { display: contents; }
.integration-facts dt { color: var(--text-muted); }
.integration-facts dd { margin: 0; color: var(--text); }
.integration-help { font-size: 13px; color: var(--text-muted); }
.integration-help summary { cursor: pointer; padding: 4px 0; user-select: none; }
.integration-help ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.integration-help a { color: var(--accent); }
.btn-primary, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background var(--transition), border-color var(--transition);
  align-self: flex-start;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
