@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --bg-hover: #f4f2ef;
  --bg-elevated: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-faint: #bbbbbb;
  --border: #eae8e4;
  --border-hover: #d0cdc9;
  --space-xs: 0.5rem;
  --space-s: 0.75rem;
  --space-m: 1.25rem;
  --space-l: 2rem;
  --space-xl: 3rem;
  --space-xxl: 4rem;
  --radius: 10px;
  --radius-lg: 16px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.03), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.02);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 0 1px rgba(68, 136, 255, 0.1);

  --agency: #4488ff;
  --agency-bg: #4488ff08;
  --agency-bg-solid: #eef4ff;
  --stage: #aa66ff;
  --stage-bg: #aa66ff08;
  --stage-bg-solid: #f3eeff;
  --studio: #e6b800;
  --studio-bg: #e6b80008;
  --studio-bg-solid: #fdf6e0;
  --backstage: #44cc66;
  --backstage-bg: #44cc6608;
  --backstage-bg-solid: #edfbf1;
  --overdue: #c89050;

  --status-live: #4488ff;
  --status-kept: #8899aa;
  --status-parked: #666666;
}

[data-theme="dark"] {
  --bg: #0c0c0c;
  --bg-card: #151515;
  --bg-hover: #1e1e1e;
  --bg-elevated: #1a1a1a;
  --text: #e8e6e3;
  --text-secondary: #aaaaaa;
  --text-muted: #666666;
  --text-faint: #333333;
  --border: #222222;
  --border-hover: #333333;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 0 1px rgba(68, 136, 255, 0.15);
  --agency-bg: #4488ff08;
  --agency-bg-solid: #111827;
  --stage-bg: #aa66ff08;
  --stage-bg-solid: #1a1128;
  --studio-bg: #e6b80008;
  --studio-bg-solid: #1c1a0e;
  --backstage-bg: #44cc6608;
  --backstage-bg-solid: #0e1c12;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background 0.3s ease, color 0.3s ease;
  min-block-size: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Fade-in animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.animate-in {
  animation: fadeUp 0.4s ease both;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }

/* ── Layout ── */
.container {
  max-inline-size: 1120px;
  margin: 0 auto;
  padding: var(--space-m) var(--space-l) var(--space-xxl);
}

/* ── Header ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-block-end: var(--space-m);
  padding-block-end: var(--space-s);
  border-block-end: 1px solid var(--border);
  animation: fadeIn 0.6s ease both;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header-title-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-s);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.header-greeting {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

.date {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 400;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.75rem;
  font-family: var(--font);
}

.theme-toggle:hover {
  border-color: var(--text-muted);
  color: var(--text);
  transform: scale(1.05);
}

/* ── Main Grid ── */
.main-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  margin-block-end: var(--space-l);
}

.main-grid-full { /* kept for compat */ }

/* ── Section ── */
.section-header {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-block-end: var(--space-s);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-block-end: 6px;
  border-block-end: 1px solid var(--border);
}

.section-count {
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0;
}

/* ── Timeline (unified calendar + tasks) ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.timeline-day {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 0;
  position: relative;
}

.timeline-day + .timeline-day { margin-block-start: 4px; }

.timeline-day {
  animation: fadeUp 0.35s ease both;
}
.timeline-day:nth-child(1) { animation-delay: 0.05s; }
.timeline-day:nth-child(2) { animation-delay: 0.1s; }
.timeline-day:nth-child(3) { animation-delay: 0.15s; }
.timeline-day:nth-child(4) { animation-delay: 0.2s; }
.timeline-day:nth-child(5) { animation-delay: 0.25s; }
.timeline-day:nth-child(6) { animation-delay: 0.3s; }
.timeline-day:nth-child(7) { animation-delay: 0.35s; }

/* ── Spine (center column) ── */
.timeline-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.timeline-spine::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-block-end: 0;
  inline-size: 1px;
  background: var(--border);
  block-size: 100%;
}

.timeline-day:first-child .timeline-spine::before { inset-block-start: 14px; }
.timeline-day:last-child .timeline-spine::before { inset-block-end: 0; }
.timeline-day:only-child .timeline-spine::before { display: none; }

.timeline {
  padding-block-end: var(--space-s);
}

.timeline-dot {
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: var(--border-hover);
  position: relative;
  z-index: 2;
  margin-block-start: 14px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.timeline-dot.is-today {
  inline-size: 9px;
  block-size: 9px;
  background: var(--text-secondary);
  box-shadow: 0 0 12px rgba(0,0,0,0.08);
}

.timeline-day-label {
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  writing-mode: horizontal-tb;
  white-space: nowrap;
  margin-block-start: 6px;
  font-family: var(--font-mono);
}

.timeline-day-label.is-today { color: var(--text-secondary); font-weight: 700; }

.timeline-day.is-today-row {
  background: rgba(255, 200, 100, 0.04);
  border-radius: var(--radius);
}

[data-theme="dark"] .timeline-day.is-today-row {
  background: rgba(255, 200, 100, 0.03);
}

/* ── Left lane (calendar events) ── */
.timeline-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px var(--space-s) 6px 0;
  align-items: stretch;
}

.cal-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px var(--space-s);
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  box-shadow: var(--shadow-sm);
  inline-size: 100%;
  flex-direction: row;
  min-block-size: 42px;
}

.cal-event.is-now {
  border-color: var(--border-hover);
}

.cal-area {
  inline-size: 3px;
  block-size: 24px;
  border-radius: 2px;
  flex-shrink: 0;
  order: 1;
}

.cal-content {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  order: 2;
}

.cal-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: end;
  font-weight: 500;
  line-height: 1.15;
  flex-shrink: 0;
  order: 3;
  letter-spacing: -0.02em;
}

.cal-title { flex: 1; font-weight: 500; text-align: start; }

/* ── Right lane (tasks) ── */
.timeline-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0 6px var(--space-s);
}

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

.task-group-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: var(--space-xs) 0 2px 0;
  margin-block-start: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.task-group-label:first-child { margin-block-start: 0; }
.task-group-label.overdue { color: var(--text-muted); }

.task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px var(--space-s);
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  min-block-size: 42px;
}

.task.overdue { border-color: var(--border-hover); }

/* ── Timeline section headers ── */
.timeline-header {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 0;
  margin-block-end: 4px;
}

.timeline-header-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding-block-end: 6px;
  border-block-end: 1px solid var(--border);
}

.timeline-header-left {
  text-align: end;
  padding-inline-end: var(--space-s);
}

.timeline-header-right {
  padding-inline-start: var(--space-s);
}

.timeline-header-center {
  border-block-end: 1px solid var(--border);
}

/* ── Mobile day label (hidden on desktop) ── */
.timeline-mobile-label {
  display: none;
}

/* ── Empty lane placeholder ── */
.timeline-empty {
  min-block-size: 36px;
}

/* ── Open Tasks Section ── */
.open-tasks-section {
  margin-block-start: var(--space-m);
}

.open-tasks-header {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-block-end: var(--space-s);
  padding-block-end: 6px;
  border-block-end: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.open-tasks-grid {
  columns: 2;
  column-gap: 4px;
}

.open-tasks-grid > * {
  break-inside: avoid;
  margin-block-end: 4px;
}

@media (max-width: 720px) {
  .open-tasks-grid {
    columns: 1;
  }
}

.task-area {
  inline-size: var(--task-bar-width, 3px);
  block-size: 24px;
  border-radius: 2px;
  flex-shrink: 0;
  transition: inline-size 0.3s ease;
}

.task-content { flex: 1; min-inline-size: 0; }

.task-title {
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-tags-inline {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin-inline-start: 6px;
  vertical-align: middle;
}

.task-meta {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-block-start: 2px;
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  flex-wrap: wrap;
}

.task-tag {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.task-tag.high { color: var(--text-muted); background: var(--bg); }
.task-tag.urgent { color: var(--text-secondary); font-weight: 500; background: var(--bg); }

.task-due {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  font-weight: 500;
}

.task-due.overdue { color: var(--text-secondary); font-weight: 500; }
.task-due.today { color: var(--text-secondary); font-weight: 500; }

/* ── Projects ── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-s);
}

.area-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-m) var(--space-m) var(--space-s);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.area-group::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  inline-size: var(--glow-width, 40%);
  block-size: 1.5px;
  border-radius: 0 0 2px 2px;
  background: var(--area-color, var(--border));
  box-shadow: 0 0 8px 2px color-mix(in srgb, var(--area-color, var(--border)) 25%, transparent);
}

/* no hover on non-clickable area groups */

.area-group-header {
  font-size: 0.7rem;
  font-weight: 600;
  margin-block-end: var(--space-s);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.area-group-dot {
  display: none;
}

.area-group-count {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-inline-start: auto;
  font-weight: 400;
}

/* Status group labels inside area groups */
.status-group-label {
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 6px 2px;
  margin-block-start: 4px;
}

.status-group-label:first-of-type { margin-block-start: 0; }

.project-item {
  font-size: 0.8rem;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
  border-radius: 6px;
  position: relative;
}

.project-item.clickable {
  cursor: pointer;
  transition: all 0.12s ease;
}

.project-item.clickable:hover {
  background: var(--bg-hover);
  transform: translateX(3px);
}

.project-item.has-notes .notes-hint {
  color: var(--text-faint);
  font-size: 0.6rem;
  margin-inline-start: 2px;
  transition: color 0.15s ease;
  user-select: none;
}

.project-item.has-notes:hover .notes-hint {
  color: var(--text-muted);
}

.project-status {
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-status:hover {
  transform: scale(2);
  transition: transform 0.15s;
}

.project-status.live {
  background: var(--status-live);
  box-shadow: 0 0 6px var(--status-live);
}
.project-status.kept { background: var(--status-kept); }
.project-status.parked { background: var(--status-parked); opacity: 0.4; }
.project-status { cursor: pointer; position: relative; }

.status-picker {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 0;
  margin: 2px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-inline-size: 70px;
}
.project-item.dimmed { opacity: 0.25; pointer-events: none; }
.status-picker-option {
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 450;
  letter-spacing: 0.02em;
  transition: background 0.1s;
}
.status-picker-option:first-child { border-radius: 7px 7px 0 0; }
.status-picker-option:last-child { border-radius: 0 0 7px 7px; }
.status-picker-option:hover { background: var(--bg-hover); }
.status-picker-option.active { font-weight: 600; }
.status-picker-option.s-live { color: var(--status-live); }
.status-picker-option.s-kept { color: var(--status-kept); }
.status-picker-option.s-parked { color: var(--text-muted); opacity: 0.7; }

.project-name { flex: 1; font-weight: 450; }
.project-name-live { font-weight: 550; }
.project-name-parked { color: var(--text-muted); font-weight: 400; }

.parked-footer {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-xs) 0 0;
  opacity: 0.4;
  font-family: var(--font-mono);
  margin-block-start: auto;
}

.task-title-edit {
  background: none;
  border: none;
  outline: none;
  font: inherit;
  color: inherit;
  inline-size: 100%;
  padding: 0;
  margin: 0;
}

@keyframes refreshPulse {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}
.refreshing #projectsGrid,
.refreshing #timelineContainer {
  animation: refreshPulse 0.4s ease-out;
}

/* Orbit — pill on header border line */
.orbit-bar {
  position: relative;
  block-size: 0;
  margin-block-start: calc(-1 * var(--space-s));
  margin-block-end: var(--space-s);
  z-index: 1;
  text-align: center;
  inset-block-start: -0.5px;
}
.orbit-pill {
  display: inline-block;
  position: relative;
  inset-block-start: -22px;
  padding: 0 10px;
  block-size: 14px;
  line-height: 14px;
  border-radius: 7px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 0.58rem;
  font-family: var(--font-mono);
  color: var(--text-faint);
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: border-color 0.15s, color 0.15s, inline-size 0.15s;
}
.orbit-pill:hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
  box-shadow: 0 0 6px rgba(255,255,255,0.04);
}
.orbit-pill-empty {
  padding: 0;
  inline-size: 40px;
}
.orbit-items {
  margin-block-start: var(--space-xs);
  margin-block-end: var(--space-s);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.orbit-age {
  font-size: 0.68rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  white-space: nowrap;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.project-name-kept { color: var(--text-secondary); font-weight: 400; }

/* Routine checklist */
.routine-footer {
  padding: 4px 8px 2px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-faint);
}
.routine-block { display: inline; }
.routine-block + .routine-block::before { content: ' · '; opacity: 0.25; }
.routine-name { cursor: pointer; opacity: 0.6; transition: opacity 0.15s; }
.routine-name:hover { opacity: 0.8; }
.routine-checklist {
  display: block;
  padding: 6px 0 4px 4px;
  font-size: 0.65rem;
  color: var(--text-secondary);
}
.routine-step {
  padding: 3px 0;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.routine-step:hover { opacity: 0.9; }
.routine-step-done {
  text-decoration: line-through;
  opacity: 0.3;
}
.routine-check {
  font-size: 0.7rem;
  margin-inline-end: 2px;
}

.project-task-count {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

/* ── Notes Panel (slide-over) ── */
.notes-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.notes-overlay.open {
  opacity: 1;
  visibility: visible;
}

.notes-panel {
  position: fixed;
  inset-block-start: 0;
  inset-inline-end: 0;
  inline-size: min(700px, 88vw);
  block-size: 100vh;
  background: var(--bg);
  border-inline-start: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notes-panel.open {
  transform: translateX(0);
}

.notes-panel-header {
  padding: var(--space-m) var(--space-l);
  border-block-end: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.notes-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notes-panel-area {
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
}

.notes-panel-meta {
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

.notes-open-folder {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.notes-open-folder:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--bg-hover);
}

.notes-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  transition: all 0.15s ease;
  font-weight: 500;
}

.notes-close:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.notes-tabs {
  display: flex;
  gap: 0;
  padding: 0 var(--space-l);
  border-block-end: 1px solid var(--border);
  flex-shrink: 0;
}

.notes-tab {
  padding: var(--space-s) var(--space-m);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-block-end: 2px solid transparent;
  transition: all 0.15s ease;
  background: none;
  border-block-start: none;
  border-inline-start: none;
  border-inline-end: none;
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notes-tab:hover { color: var(--text); }
.notes-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.notes-tab.is-empty {
  opacity: 0.3;
  font-style: italic;
}
.notes-tab.is-empty:hover {
  opacity: 0.6;
}
.notes-tab.is-empty.active {
  opacity: 0.5;
}

/* ── Empty tab create prompt ── */
.empty-tab-create {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-s);
  padding: var(--space-xl) var(--space-l);
  color: var(--text-muted);
}

.empty-tab-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

.empty-tab-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.empty-tab-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--bg-hover);
}

.empty-tab-hint {
  font-size: 0.65rem;
  color: var(--text-faint);
  font-style: italic;
}

.notes-tab.disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.notes-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-l);
}

/* ── Markdown Rendering ── */
.md-content {
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--text);
}

.md-content h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 var(--space-s) 0;
  letter-spacing: -0.03em;
  border-block-end: 1px solid var(--border);
  padding-block-end: var(--space-xs);
}

.md-content h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: var(--space-l) 0 var(--space-xs) 0;
  letter-spacing: -0.01em;
  color: var(--text);
}

.md-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: var(--space-m) 0 var(--space-xs) 0;
  color: var(--text-secondary);
}

.md-content p {
  margin-block-end: var(--space-s);
  color: var(--text-secondary);
}

.md-content ul, .md-content ol {
  margin: 0 0 var(--space-s) var(--space-m);
}

.md-content li {
  margin-block-end: 3px;
  color: var(--text-secondary);
}

.md-content code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
}

.md-content pre {
  background: var(--bg-hover);
  padding: var(--space-m);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-block-end: var(--space-s);
  border: 1px solid var(--border);
}

.md-content pre code {
  background: none;
  padding: 0;
}

.md-content a {
  color: var(--agency);
  text-decoration: none;
  border-block-end: 1px solid transparent;
  transition: border-color 0.15s;
}

.md-content a:hover { border-bottom-color: var(--agency); }

.md-content strong { font-weight: 600; color: var(--text); }

.md-content blockquote {
  border-inline-start: 3px solid var(--border);
  padding-inline-start: var(--space-s);
  color: var(--text-muted);
  margin-block-end: var(--space-s);
  font-style: italic;
}

.md-content hr {
  border: none;
  border-block-start: 1px solid var(--border);
  margin: var(--space-l) 0;
}

/* ── Tasks View ── */
.tasks-view { padding: 0; }

.tasks-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tasks-list .tasks-list {
  margin-inline-start: 20px;
  padding: 0;
}

.task-children {
  overflow: hidden;
}

.task-children.collapsed {
  display: none;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
  transition: opacity 0.3s ease;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.5;
}

.task-item.completing {
  opacity: 0;
  transform: translateX(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.task-checkbox {
  flex-shrink: 0;
  inline-size: 14px;
  block-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  margin-block-start: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.task-checkbox:hover {
  border-color: var(--text-secondary);
}

.task-checkbox.checked {
  background: var(--border);
  color: var(--bg);
}

.task-checkbox.checked::after { content: '\2713'; }

.task-toggle {
  flex-shrink: 0;
  inline-size: 14px;
  block-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-block-start: 3px;
  transition: transform 0.15s ease;
  user-select: none;
}

.task-toggle.collapsed { transform: rotate(-90deg); }

.task-text { flex: 1; }

.task-text strong { color: var(--text); }
.task-text em { font-style: italic; }
.task-text code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-hover);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Completed section reveal bar */
.tasks-completed-bar {
  position: relative;
  block-size: 1px;
  background: var(--border);
  margin: 16px 0 6px;
  cursor: pointer;
}

.tasks-completed-bar::after {
  content: '';
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 50%;
  transform: translate(-50%, -50%);
  inline-size: 40px;
  block-size: 14px;
  border-radius: 7px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  transition: all 0.25s ease;
}

.tasks-completed-bar:hover::after {
  inline-size: 54px;
  border-color: var(--text-muted);
  box-shadow: 0 0 6px rgba(255,255,255,0.04);
}

.tasks-completed-section {
  overflow: hidden;
  max-block-size: 0;
  opacity: 0;
  transition: max-block-size 0.35s ease, opacity 0.25s ease;
}

.tasks-completed-section.open {
  max-block-size: 2000px;
  opacity: 1;
}

/* ── Loose Notes List ── */
.loose-notes-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.loose-note-item {
  padding: 8px var(--space-s);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.loose-note-item:hover {
  border-color: var(--border-hover);
  transform: translateX(3px);
}

.loose-note-item .icon {
  color: var(--text-muted);
  font-size: 0.7rem;
  inline-size: 16px;
  text-align: center;
}

.loose-note-back {
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-block-end: var(--space-s);
  border: none;
  background: none;
  font-family: var(--font);
  padding: 4px 0;
  transition: color 0.15s;
}

.loose-note-back:hover { color: var(--text); }

/* ── Task completion (visual/localStorage) ── */
.task.locally-completed { opacity: 0; block-size: 0; padding: 0; margin: 0; border: none; overflow: hidden; pointer-events: none; transition: opacity 0.4s ease, block-size 0.4s ease, padding 0.4s ease, margin 0.4s ease; }
.task.locally-completed .task-title { text-decoration: line-through; }
.task.pending-complete .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-check-slot {
  inline-size: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-check {
  cursor: pointer;
  color: var(--text-faint);
  font-size: 0.85rem;
  transition: color 0.15s, transform 0.15s;
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
  inline-size: 20px;
  block-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.task-check:hover { color: var(--text-secondary); transform: scale(1.15); background: var(--bg-hover); }
.task-check.checked { color: var(--text-muted); }
.task-countdown {
  position: absolute;
  inset-block-start: -8px;
  inset-inline-end: -8px;
  inline-size: 24px;
  block-size: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  animation: countdownPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.15s ease, border-color 0.3s ease;
}

.task-countdown.pulse {
  animation: countdownPulse 0.4s ease;
}

@keyframes countdownPop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes countdownPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.task-undo-UNUSED {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--agency);
  cursor: pointer;
  margin-inline-start: 6px;
  padding: 1px 6px;
  border: 1px solid var(--agency);
  border-radius: 4px;
  background: none;
  transition: all 0.15s ease;
  animation: fadeIn 0.2s ease;
  white-space: nowrap;
}
.task-undo:hover { background: var(--agency); color: white; }
.undo-countdown {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-inline-start: 2px;
}
.task-undo:hover .undo-countdown { color: white; }

.sync-hint {
  font-size: 0.55rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  text-align: end;
  padding-block-start: var(--space-xs);
  animation: fadeIn 0.4s ease;
}

/* ── Balance bar ── */
.balance-bar {
  display: flex;
  gap: 3px;
  block-size: 4px;
  margin-block-end: var(--space-m);
  animation: fadeIn 0.6s ease both;
  animation-delay: 0.1s;
}

.balance-segment {
  border-radius: 2px;
  transition: flex 0.4s ease;
}

/* ── Empty state ── */
.empty {
  padding: var(--space-l);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  font-style: italic;
}

/* ── Empty area cards with color-coded dashed border ── */
.area-group.empty-area {
  border-color: var(--area-color, var(--border));
  border-style: dashed;
}

.area-group.empty-area .empty-dots {
  font-size: 1.2rem;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  text-align: center;
  padding: var(--space-l);
}

/* ── Footer ── */
footer {
  margin-block-start: var(--space-xl);
  padding-block-start: var(--space-m);
  border-block-start: 1px solid var(--border);
  font-size: 0.6rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  animation: fadeIn 0.8s ease both;
  animation-delay: 0.5s;
}

/* ── Keyboard hint ── */
.kbd-hint {
  position: fixed;
  inset-block-end: var(--space-m);
  inset-inline-start: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  pointer-events: none;
  opacity: 0.5;
  letter-spacing: 0.02em;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .container { padding: var(--space-m); }
  .projects-grid { grid-template-columns: 1fr; }
  .notes-panel { inline-size: 100vw; }
  header { flex-direction: column; gap: var(--space-s); }
  .cal-title { font-size: 0.75rem; }
  .task-title { font-size: 0.75rem; }

  /* Timeline: stack vertically on mobile */
  .timeline-header { display: none; }
  .timeline-day {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-s) 0;
    border-block-end: 1px solid var(--border);
  }
  .timeline-day + .timeline-day { margin-block-start: 0; }
  .timeline-spine { display: none; }
  .timeline-left { padding: 0; }
  .timeline-right { padding: 0; }
  .timeline-empty { display: none; min-block-size: 0; }

  /* Mobile day label */
  .timeline-mobile-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--font-mono);
    padding-block-end: 2px;
  }
  .timeline-mobile-label.is-today { color: var(--text-secondary); }
}

/* ── Scrollbar ── */
.notes-body::-webkit-scrollbar { inline-size: 6px; }
.notes-body::-webkit-scrollbar-track { background: transparent; }
.notes-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.notes-body::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── FAB (Floating Action Button) ── */
.fab {
  position: fixed;
  inset-block-end: calc(var(--space-l) + env(safe-area-inset-bottom, 0px));
  inset-inline-end: var(--space-l);
  inline-size: 48px;
  block-size: 48px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  border: none;
  font-size: 1.6rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  padding-block-end: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.fab:active { transform: scale(0.92); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  inline-size: 100%;
  max-inline-size: 500px;
  padding: var(--space-l);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal h3 {
  font-size: 0.8rem;
  font-weight: 600;
  margin-block-end: var(--space-m);
  color: var(--text);
}
.modal-field {
  margin-block-end: var(--space-s);
}
.modal-field label {
  display: block;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-block-end: 4px;
}
.modal-field input,
.modal-field select,
.modal-field textarea {
  inline-size: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px; /* prevents iOS zoom on focus */
  outline: none;
  box-sizing: border-box;
}
.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  border-color: var(--text-muted);
}
.modal-field textarea { resize: vertical; min-block-size: 60px; }
.modal-row {
  display: flex;
  gap: var(--space-s);
}
.modal-row .modal-field { flex: 1; }
.modal-actions {
  display: flex;
  gap: var(--space-s);
  margin-block-start: var(--space-m);
  justify-content: flex-end;
}
.modal-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
}
.modal-btn.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.modal-btn.danger {
  color: #c0392b;
  border-color: #c0392b;
}
.modal-btn:active { opacity: 0.7; }

/* ── Note Editor ── */
.note-edit-bar {
  display: flex;
  justify-content: flex-end;
  padding-block-end: var(--space-s);
}
.note-edit-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
}
.note-edit-btn:hover { border-color: var(--text-muted); }
.note-edit-btn.saving { opacity: 0.4; pointer-events: none; }
.note-editor {
  inline-size: 100%;
  min-block-size: 300px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
}
.note-editor:focus { border-color: var(--text-muted); }
.note-edit-actions {
  display: flex;
  gap: var(--space-s);
  justify-content: flex-end;
  padding-block-start: var(--space-s);
}
