/*
 * PLAN: tasks, projects, notes, routines (DECISIONS §24)
 * ---------------------------------------------------------------------------
 * Global classes (components and pages under Components/Plan, Pages/Plan, Layout/TaskDetailSheet and RoutineSheet).
 * Project and routine colours come in as --pc (an --event-* colour), the task checkbox colour as --check.
 * Motion: the check pops with the bouncy spring and throws sparks; a ticked row lingers, then folds away;
 * rings, bars and segments fill with the brand spring. Reduced motion keeps the state changes, drops movement.
 */

/* ======================= Checkbox ======================= */
.oc-check {
  --check: var(--color-primary);
  --size: 26px;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--check) 70%, var(--color-text-tertiary));
  border-radius: 50%;
  background: transparent;
  color: var(--oc-paper);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-base) var(--ease-spring-bouncy);
}
.oc-check::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; } /* 44px hit area */
.oc-check:hover { background: color-mix(in srgb, var(--check) 12%, transparent); }
.oc-check:active { transform: scale(0.86); transition-duration: var(--dur-instant); }
.oc-check:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 3px; }
.oc-check--lg { --size: 34px; }
.oc-check-mark { width: 70%; height: 70%; overflow: visible; }
.oc-check-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset var(--dur-base) var(--ease-out);
}
.oc-check.is-on { background: var(--check); border-color: var(--check); }
.oc-check.is-on .oc-check-mark path { stroke-dashoffset: 0; transition-delay: 60ms; }
.oc-check.is-burst { animation: oc-check-pop var(--dur-slower) var(--ease-spring-bouncy); }
@keyframes oc-check-pop { 0% { transform: scale(0.7); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Eight sparks thrown out in the task's colour. */
.oc-check-burst { position: absolute; inset: 0; pointer-events: none; }
.oc-check-burst i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px;
  border-radius: 50%;
  background: var(--check);
  transform: rotate(var(--a)) translateY(0) scale(1);
  animation: oc-spark 620ms var(--ease-out) forwards;
}
.oc-check-burst i:nth-child(even) { width: 4px; height: 4px; background: var(--oc-dawn); }
@keyframes oc-spark {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--size) * -0.95)) scale(0.3); }
}

/* ======================= Task rows ======================= */
.oc-tasklist { display: flex; flex-direction: column; gap: 6px; }
.oc-tasklist + .oc-tasklist, .oc-tasklist + .oc-capture { margin-top: var(--space-2); }

/* Folding away: the row lingers ticked, then its height collapses (grid rows 1fr → 0fr) as it fades. */
.oc-task-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--dur-base) var(--ease-in-out), opacity var(--dur-base) var(--ease-out),
              margin var(--dur-base) var(--ease-in-out);
}
.oc-task-fold { min-height: 0; overflow: hidden; padding: 2px; margin: -2px; }
.oc-task-wrap.is-leaving { grid-template-rows: 0fr; opacity: 0; margin-block-end: -6px; }
.oc-task-wrap.is-leaving .oc-task { transform: translateX(10px) scale(0.98); }
.oc-tasklist > .oc-task-wrap { animation: oc-rise var(--dur-slow) var(--ease-spring) both; }

.oc-task {
  --task-color: var(--color-primary);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 12px var(--space-3) 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-base) var(--ease-spring), opacity var(--dur-base) var(--ease-out);
}
.oc-task > .oc-check { margin-top: 1px; }
.oc-task-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.oc-task-body:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 4px; border-radius: var(--radius-xs); }
.oc-task-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; line-height: var(--leading-snug); font-weight: var(--weight-medium); }
.oc-task-star { color: var(--color-accent-strong); flex: none; position: relative; top: 1px; }
.oc-task-star .oc-icon { fill: currentColor; }
/* The strike-through draws itself across the title. */
.oc-task-text {
  min-width: 0;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / 0% 1.5px;
  transition: background-size var(--dur-slow) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.oc-task.is-done .oc-task-text { background-size: 100% 1.5px; color: var(--color-text-tertiary); }
.oc-task.is-done { box-shadow: none; background: color-mix(in srgb, var(--color-surface) 60%, transparent); }

.oc-task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--text-footnote); color: var(--color-text-secondary); }
.oc-task-due, .oc-task-tag, .oc-task-project { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.oc-task-due.is-today { color: var(--color-accent-text); font-weight: var(--weight-semibold); }
.oc-task-due.is-overdue { color: var(--color-danger-text); font-weight: var(--weight-semibold); }
.oc-task-tag.is-complete { color: var(--color-success-text); }
.oc-task-project { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.oc-task-project i { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.oc-tasklist.is-done .oc-task { opacity: 0.85; }

/* ======================= Quick add ======================= */
.oc-capture { display: flex; flex-direction: column; gap: var(--space-2); }
.oc-capture-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 54px;
  padding: 0 6px 0 14px;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--color-border);
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
.oc-capture-field:focus-within { box-shadow: var(--shadow-md), inset 0 0 0 2px var(--color-primary); }
.oc-capture--compact .oc-capture-field { min-height: 46px; box-shadow: inset 0 0 0 1px var(--color-border); background: var(--color-fill); }
.oc-capture--compact .oc-capture-field:focus-within { background: var(--color-surface); box-shadow: inset 0 0 0 2px var(--color-primary); }
.oc-capture-plus {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
  transition: transform var(--dur-slow) var(--ease-spring-bouncy);
}
.oc-capture-field:focus-within .oc-capture-plus { transform: rotate(90deg); }
.oc-capture-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  outline: none;
  background: none;
  color: var(--color-text);
  font: inherit;
  font-size: max(16px, var(--text-body));
}
.oc-capture-input::placeholder { color: var(--color-text-tertiary); }
.oc-capture-go {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-spring-bouncy), opacity var(--dur-fast) var(--ease-out);
}
.oc-capture-go:disabled { opacity: 0; transform: scale(0.4); pointer-events: none; }
.oc-capture-go:active { transform: scale(0.88); }
.oc-capture--compact .oc-capture-go { width: 34px; height: 34px; }
.oc-capture.is-sent .oc-capture-field { animation: oc-capture-sent var(--dur-slower) var(--ease-spring-bouncy); }
@keyframes oc-capture-sent { 30% { transform: scale(0.98); box-shadow: var(--shadow-md), inset 0 0 0 2px var(--color-success); } }
.oc-capture-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-inline: 10px; }
.oc-capture-chip {
  --chip: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--chip) 14%, var(--color-surface));
  color: color-mix(in srgb, var(--chip) 60%, var(--color-text));
  font-size: var(--text-footnote);
  font-weight: var(--weight-semibold);
  animation: oc-chip-in var(--dur-slow) var(--ease-spring-bouncy) both;
}
.oc-capture-chip.is-star { --chip: var(--oc-dawn); }
.oc-capture-chip .oc-icon { flex: none; }
.oc-capture-chip-mark { font-size: 14px; line-height: 1; }
@keyframes oc-chip-in { from { opacity: 0; transform: translateY(-4px) scale(0.85); } }
.oc-capture-literal {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--color-fill);
  color: var(--color-text-secondary);
  cursor: pointer;
}
.oc-capture-hint { padding-inline: 16px; font-size: var(--text-footnote); color: var(--color-text-tertiary); }

/* ======================= Marks (emoji / letter) ======================= */
.oc-project-mark, .oc-routine-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--pc, var(--event-iris)) 20%, var(--color-surface));
  color: color-mix(in srgb, var(--pc, var(--event-iris)) 70%, var(--color-text));
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: var(--weight-bold);
  line-height: 1;
}
.oc-project-mark--xl { width: 76px; height: 76px; border-radius: 26px; font-size: 40px; }
.oc-routine-mark--lg { width: 48px; height: 48px; border-radius: 16px; font-size: 26px; }
/* Sized by the mark's font-size, like the emoji it replaces. One detail is Cue Orange, except on an orange mark
   (coral), where it would disappear; the nearest element that sets the colour decides. */
[style*="--pc: var(--event-"], [style*="--chip: var(--event-"] { --oc-mark-accent: var(--oc-cue); }
[style*="var(--event-coral)"] { --oc-mark-accent: currentColor; }
.oc-mark-icon { width: 1.15em; height: 1.15em; --oc-icon-accent: var(--oc-mark-accent, var(--oc-cue)); }
.plan-starter-icon .oc-mark-icon { width: 28px; height: 28px; }
.project-emoji-item .oc-mark-icon { width: 24px; height: 24px; }

/* ======================= Project tiles ======================= */
.plan-projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.oc-project-tile {
  --pc: var(--event-iris);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 132px;
  padding: var(--space-4);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--pc) 24%, transparent), transparent 60%),
    var(--color-surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--pc) 16%, transparent);
  color: inherit;
  text-decoration: none;
  transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-out);
}
.oc-project-tile:active { transform: scale(0.97); transition-duration: var(--dur-instant); }
@media (hover: hover) { .oc-project-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md), inset 0 0 0 1px color-mix(in srgb, var(--pc) 30%, transparent); } }
.oc-project-tile.is-archived { filter: saturate(0.4); opacity: 0.8; }
.oc-project-tile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.oc-project-ring .oc-ring-value { stroke: var(--pc); }
/* Project rings fill from empty when they appear. */
.oc-project-ring .oc-ring-value, .project-hero-ring .oc-ring-value { animation: oc-ring-fill var(--dur-slower) var(--ease-spring) backwards; }
@keyframes oc-ring-fill { from { stroke-dashoffset: var(--circ); } }
.oc-project-ring .oc-ring-track { stroke: color-mix(in srgb, var(--pc) 16%, var(--color-fill)); }
.oc-project-ring-pct { font-size: 10px; font-weight: var(--weight-bold); color: var(--color-text-secondary); }
.oc-project-name {
  margin-top: auto;
  font-family: var(--font-display);
  font-size: var(--text-callout);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.oc-project-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: var(--text-footnote); color: var(--color-text-secondary); }
.oc-project-sub > span { display: inline-flex; align-items: center; gap: 4px; }
.oc-project-sub .is-soon { color: var(--color-warning-text); font-weight: var(--weight-semibold); }
.oc-project-sub .is-late { color: var(--color-danger-text); font-weight: var(--weight-semibold); }
.oc-project-tile--add {
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--color-fill-strong);
  color: var(--color-text-secondary);
  font: inherit;
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.oc-project-tile--add:hover { background: var(--color-fill); }

/* ======================= Note cards (paper with a folded corner) ======================= */
.plan-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); align-items: start; }
.oc-note-card {
  --nc: var(--color-text-tertiary);
  --fold: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 112px;
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  clip-path: polygon(0 0, calc(100% - var(--fold)) 0, 100% var(--fold), 100% 100%, 0 100%);
  transition: transform var(--dur-base) var(--ease-spring);
}
.oc-note-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: var(--fold);
  height: var(--fold);
  border-bottom-left-radius: 6px;
  background: linear-gradient(225deg, transparent 50%, color-mix(in srgb, var(--nc) 30%, var(--color-fill-strong)) 50%);
}
.oc-note-card.is-tinted { background: color-mix(in srgb, var(--nc) 13%, var(--color-surface)); }
.oc-note-card:active { transform: scale(0.97) rotate(-0.4deg); transition-duration: var(--dur-instant); }
@media (hover: hover) { .oc-note-card:hover { transform: translateY(-2px) rotate(-0.6deg); } }
.oc-note-card-pin { position: absolute; top: 10px; right: 22px; color: var(--color-accent-text); }
.oc-note-card-title { font-family: var(--font-display); font-weight: var(--weight-semibold); line-height: var(--leading-tight); padding-right: var(--space-4); overflow-wrap: anywhere; }
.oc-note-card-body {
  font-size: var(--text-footnote);
  color: var(--color-text-secondary);
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.oc-note-card-foot { display: flex; align-items: center; gap: var(--space-2); margin-top: auto; font-size: var(--text-caption); color: var(--color-text-tertiary); }
.oc-note-card-steps { display: inline-flex; align-items: center; gap: 3px; font-weight: var(--weight-semibold); color: var(--color-text-secondary); }
.oc-note-card-steps.is-complete { color: var(--color-success-text); }
.oc-note-card-when { margin-left: auto; }
.oc-note-card--add {
  align-items: center;
  justify-content: center;
  border: 0;
  clip-path: none;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--color-fill-strong);
  color: var(--color-text-secondary);
  font: inherit;
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.oc-note-card--add::after { display: none; }

/* ======================= Routine cards ======================= */
.oc-routine-card {
  --pc: var(--event-iris);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border: 0;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--pc) 11%, var(--color-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 22%, transparent);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-spring);
}
.oc-routine-card:active { transform: scale(0.97); }
.oc-routine-card-head { display: flex; align-items: center; gap: var(--space-2); }
.oc-routine-card .oc-routine-mark { width: 30px; height: 30px; border-radius: 10px; font-size: 16px; }
.oc-routine-card-name { flex: 1; min-width: 0; font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-routine-card-count { display: inline-flex; font-size: var(--text-footnote); font-weight: var(--weight-bold); color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); }
.oc-routine-card.is-complete .oc-routine-card-count { color: var(--color-success-text); animation: oc-pop var(--dur-slow) var(--ease-spring-bouncy); }
.oc-routine-segs { display: flex; gap: 4px; }
.oc-routine-segs i {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--pc) 18%, var(--color-fill));
  overflow: hidden;
  position: relative;
}
.oc-routine-segs i::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--pc);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-slow) var(--ease-spring);
}
.oc-routine-segs i.is-on::after { transform: scaleX(1); }
.oc-routine-segs--lg i { height: 8px; }

/* ======================= A day's tasks (Today, Calendar) ======================= */
.oc-planday { margin-top: var(--space-2); }
.oc-planday-link { display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-subhead); font-weight: var(--weight-semibold); color: var(--color-primary-text); text-decoration: none; }
.oc-planday-strip {
  display: flex;
  gap: var(--space-2);
  margin: 0 calc(var(--space-4) * -1) var(--space-3);
  padding: 2px var(--space-4) 4px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--space-4); /* snap to the page's edge, not into the bleed */
  scrollbar-width: none;
}
.oc-planday-strip::-webkit-scrollbar { display: none; }
.oc-planday-strip > * { scroll-snap-align: start; flex: none; }
/* A mouse wheel can't scroll the strip sideways: a grid in line with the rest of the page. */
@media (hover: hover) and (pointer: fine) {
  .oc-planday-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    margin-inline: 0;
    padding-inline: 0;
    overflow-x: visible;
  }
  .oc-planday-strip > * { min-width: 0; }
}
.oc-planday-project {
  --pc: var(--event-iris);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 180px;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs), inset 3px 0 0 var(--pc);
  color: inherit;
  text-decoration: none;
}
.oc-planday-project:hover { text-decoration: none; }
.oc-planday-project .oc-project-mark { width: 30px; height: 30px; border-radius: 10px; font-size: 16px; }
.oc-planday-project-text { display: flex; flex-direction: column; min-width: 0; }
.oc-planday-project-name { font-weight: var(--weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-planday-project-sub { font-size: var(--text-footnote); color: var(--color-text-secondary); white-space: nowrap; }
.oc-planday-done { display: flex; align-items: center; gap: 6px; margin: var(--space-2) 2px; font-size: var(--text-footnote); color: var(--color-success-text); }
.oc-planday .oc-capture { margin-top: var(--space-2); }
/* Today: tasks without a day or project, under the day's own (M24). */
.oc-planday-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-4) 2px var(--space-2);
  font-size: var(--text-footnote);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}
.oc-planday-sub span { letter-spacing: 0; color: var(--color-text-quaternary, var(--color-text-tertiary)); }
.oc-planday-more { display: inline-flex; align-items: center; gap: 2px; margin: var(--space-2) 2px 0; font-size: var(--text-subhead); font-weight: var(--weight-medium); color: var(--color-primary-text); text-decoration: none; }

/* Today: notes (pinned first, then the latest), a strip on phones and a grid next to the day on a computer (M24). */
.oc-today-notes { margin-top: var(--space-2); }
.oc-today-notes-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.oc-today-notes-list .oc-note-card { min-height: 0; }
.oc-planday-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-2) 0 var(--space-3);
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-fill);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-footnote);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.oc-planday-add:hover { color: var(--color-text); }
.cal-plan { margin-bottom: var(--space-4); }

/* ======================= Plan page ======================= */
.plan-skeleton { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-6); }
.plan-capture { margin-bottom: var(--space-5); }

.plan-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--color-hero);
  color: var(--color-on-hero);
  box-shadow: var(--shadow-md);
  isolation: isolate;
}
.plan-hero-glow {
  position: absolute;
  right: -60px;
  top: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--oc-cue) 55%, transparent), transparent 70%);
  z-index: -1;
  transition: transform var(--dur-slower) var(--ease-spring);
}
.plan-hero.is-complete .plan-hero-glow { transform: scale(1.6); }
.plan-hero-ring .oc-ring-track { stroke: color-mix(in srgb, var(--oc-paper) 14%, transparent); }
.plan-hero-ring .oc-ring-value { stroke: var(--color-accent); transition-duration: var(--dur-slower); }
.plan-hero.is-complete .plan-hero-ring .oc-ring-value { stroke: var(--color-success); }
.plan-hero-ring-num { font-family: var(--font-display); font-size: var(--text-title2); font-weight: var(--weight-bold); letter-spacing: var(--tracking-display); }
.plan-hero-ring-num small { font-size: var(--text-subhead); color: var(--color-on-hero-muted); font-weight: var(--weight-semibold); }
.plan-hero-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.plan-hero-title { font-size: var(--text-title2); }
.plan-hero-line { color: var(--color-on-hero-muted); }
.plan-hero-overdue { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--oc-dawn); }
.plan-hero-party, .routine-run-party { position: absolute; left: 66px; top: 50%; width: 0; height: 0; pointer-events: none; }
.plan-hero-party i, .routine-run-party i {
  position: absolute;
  width: 7px;
  height: 10px;
  margin: -5px -3.5px;
  border-radius: 2px;
  background: var(--oc-cue);
  animation: oc-confetti 1.1s var(--ease-out) both;
  animation-delay: calc(var(--k) * 40ms);
}
.plan-hero-party i:nth-child(4n+1), .routine-run-party i:nth-child(4n+1) { background: var(--oc-dawn); }
.plan-hero-party i:nth-child(4n+2), .routine-run-party i:nth-child(4n+2) { background: var(--color-success); border-radius: 50%; width: 7px; height: 7px; }
.plan-hero-party i:nth-child(4n+3), .routine-run-party i:nth-child(4n+3) { background: var(--event-sky); }
@keyframes oc-confetti {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(0) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-110px) rotate(260deg); }
}

.plan-routines-today {
  display: flex;
  gap: var(--space-2);
  margin: var(--space-3) calc(var(--space-4) * -1) 0;
  padding: 2px var(--space-4) 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.plan-routines-today::-webkit-scrollbar { display: none; }
.plan-routines-today > * { flex: none; }
@media (hover: hover) and (pointer: fine) {
  .plan-routines-today {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    margin-inline: 0;
    padding-inline: 0;
    overflow-x: visible;
  }
  .plan-routines-today > * { min-width: 0; }
}
.plan-main > .oc-tasklist:first-of-type, .plan-hero + .oc-tasklist, .plan-routines-today + .oc-tasklist { margin-top: var(--space-3); }
.plan-quiet { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-4) 4px; color: var(--color-text-secondary); }
.plan-done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-3) 0 var(--space-2);
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-fill);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-footnote);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.plan-done-toggle .oc-icon:last-child { transition: transform var(--dur-base) var(--ease-spring); }
.plan-done-toggle .oc-icon.is-flipped { transform: rotate(180deg); }
.plan-day-title { display: flex; align-items: baseline; gap: var(--space-2); margin: var(--space-4) 4px var(--space-2); font-family: var(--font-sans); font-size: var(--text-subhead); font-weight: var(--weight-semibold); }
.plan-day-date { color: var(--color-text-tertiary); font-size: var(--text-footnote); font-weight: var(--weight-medium); }
.plan-later, .plan-count { font-size: var(--text-footnote); color: var(--color-text-tertiary); }
.plan-later { margin: var(--space-2) 4px; }
.plan-empty-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius-lg);
  background: none;
  box-shadow: inset 0 0 0 2px var(--color-fill-strong);
  color: var(--color-text-secondary);
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.plan-routine-list { display: flex; flex-direction: column; gap: 6px; }
.plan-routine-row {
  --pc: var(--event-iris);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
  color: inherit;
  text-decoration: none;
}
.plan-routine-row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.plan-routine-row-name { font-weight: var(--weight-semibold); }
.plan-routine-row-when { font-size: var(--text-footnote); color: var(--color-text-secondary); }

.plan-welcome { display: flex; flex-direction: column; gap: var(--space-4); }
.plan-starters { display: grid; gap: var(--space-3); }
.plan-starter {
  --pc: var(--event-iris);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, color-mix(in srgb, var(--pc) 16%, var(--color-surface)), var(--color-surface) 70%);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--pc) 18%, transparent);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  animation: oc-rise var(--dur-slow) var(--ease-spring) both;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: transform var(--dur-base) var(--ease-spring);
}
.plan-starter:active { transform: scale(0.98); }
.plan-starter-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 18px; background: var(--color-surface); box-shadow: var(--shadow-xs); color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); font-size: 26px; }
.plan-starter-text { display: flex; flex-direction: column; gap: 2px; }
.plan-starter-text span { font-size: var(--text-footnote); color: var(--color-text-secondary); }

/* Desktop: tasks left, projects/notes/routines right (a container, as on Today: sheets stay outside it). */
.plan-layout { container-type: inline-size; }
@container (min-width: 760px) {
  .plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: var(--space-8); align-items: start; }
  .plan-side > .oc-section-header:first-child { margin-top: 0; }
}
@container (min-width: 1000px) {
  .plan-grid { grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
}

/* ======================= Project page ======================= */
/* A container (nothing in it is a sheet): on the desktop the hero is one row, which leaves the height to the board. */
.project-hero-box { container-type: inline-size; }
.project-page.is-standard { max-width: var(--page-max-wide); margin-inline: auto; }
.project-hero {
  --pc: var(--event-iris);
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "ring stats" "week week" "chips chips";
  gap: var(--space-4) var(--space-5);
  align-items: center;
  padding: var(--space-5);
  overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--pc) 30%, transparent), transparent 65%),
    color-mix(in srgb, var(--pc) 8%, var(--color-surface));
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--pc) 20%, transparent);
}
.project-hero-mark { position: absolute; right: -6px; top: -14px; font-size: 92px; line-height: 1; opacity: 0.16; transform: rotate(12deg); pointer-events: none; font-family: var(--font-display); font-weight: var(--weight-bold); color: var(--pc); }
.project-hero-ring { grid-area: ring; position: relative; justify-self: start; }
.project-hero-celebrate { position: absolute; top: -8px; right: -8px; color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); }
.project-hero-ring .oc-ring-value { stroke: var(--pc); transition-duration: var(--dur-slower); }
.project-hero-ring .oc-ring-track { stroke: color-mix(in srgb, var(--pc) 18%, var(--color-fill)); }
.project-hero-pct { font-family: var(--font-display); font-size: var(--text-title2); font-weight: var(--weight-bold); }
.project-hero-pct small { font-size: var(--text-subhead); color: var(--color-text-secondary); }
.project-hero-stats { grid-area: stats; display: flex; gap: var(--space-5); }
.project-stat { display: flex; flex-direction: column; }
.project-stat-num { font-family: var(--font-display); font-size: var(--text-title1); font-weight: var(--weight-semibold); line-height: 1; }
.project-stat-label { font-size: var(--text-footnote); color: var(--color-text-secondary); }
.project-stat.is-late .project-stat-num { color: var(--color-danger-text); }
.project-hero-week { grid-area: week; display: flex; align-items: flex-end; gap: var(--space-4); }
.project-week-bars { display: flex; align-items: flex-end; gap: 6px; height: 54px; }
.project-week-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; width: 18px; height: 100%; }
.project-week-bar i {
  width: 100%;
  height: calc(var(--h) * 38px);
  min-height: 3px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--pc) 45%, var(--color-fill));
  transform-origin: bottom;
  animation: oc-bar-grow var(--dur-slower) var(--ease-spring) both;
  animation-delay: calc(var(--k) * 45ms);
}
.project-week-bar.is-today i { background: var(--pc); }
.project-week-bar b { font-size: 10px; font-weight: var(--weight-semibold); color: var(--color-text-tertiary); }
@keyframes oc-bar-grow { from { transform: scaleY(0); } }
.project-week-label { padding-bottom: 18px; font-size: var(--text-footnote); color: var(--color-text-secondary); }
.project-hero-chips { grid-area: chips; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.project-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-footnote);
  font-weight: var(--weight-semibold);
}
.project-chip.is-event { cursor: pointer; color: color-mix(in srgb, var(--pc) 60%, var(--color-text)); }
.project-chip.is-soon { color: var(--color-warning-text); }
.project-chip.is-late { color: var(--color-danger-text); }
@container (min-width: 900px) {
  .project-hero { grid-template-columns: auto auto auto minmax(0, 1fr); grid-template-areas: "ring stats week chips"; gap: var(--space-8); }
  .project-hero-chips { justify-content: flex-end; padding-right: 88px; }
}
.project-tabs { margin: var(--space-5) 0 var(--space-4); }
.project-capture { margin-bottom: var(--space-4); }
.project-done-head { display: flex; align-items: center; justify-content: space-between; }
.project-notes { margin-top: var(--space-2); }
@media (min-width: 900px) { .project-notes { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }

/* ======================= Task sheet ======================= */
.task-detail { display: flex; flex-direction: column; gap: var(--space-5); padding-bottom: var(--space-6); }
.task-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.task-head .oc-check { margin-top: 4px; }
.task-title-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-title3);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  resize: none;
  field-sizing: content;
  outline: none;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.task-title-input:focus { background: var(--color-fill); }
.task-title-input.is-done { color: var(--color-text-tertiary); text-decoration: line-through; }
.task-section { display: flex; flex-direction: column; gap: var(--space-2); }
.task-section-title { display: flex; align-items: center; gap: 6px; font-family: var(--font-sans); font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.task-steps { margin-left: auto; color: var(--color-success-text); text-transform: none; letter-spacing: 0; }
.task-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
/* Reminder: the set one, and its editor */
.task-rem { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-2) var(--space-1) 0; border-radius: var(--radius-md); background: var(--color-fill); }
.task-rem-open { display: flex; align-items: center; gap: var(--space-3); flex: 1; min-width: 0; min-height: 44px; padding: 6px 12px; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.task-rem-open > .oc-icon { flex: none; color: var(--color-accent-text); }
.rem-editor { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-lg); background: var(--color-fill); }
.rem-line { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0; border: 0; background: none; color: var(--color-text); font: inherit; text-align: start; }
button.rem-line { cursor: pointer; }
.rem-line > .oc-icon { flex: none; color: var(--color-text-secondary); }
.rem-line-label { flex: 1; min-width: 0; font-weight: var(--weight-medium); }
.rem-line-value { padding: 6px 12px; border: 0; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-accent-text); font: inherit; font-weight: var(--weight-semibold); }
button.rem-line-value { cursor: pointer; }
.rem-select { width: auto; max-width: 58%; }
.rem-custom { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface); }
.rem-every { display: flex; flex-direction: row; align-items: center; gap: var(--space-2); }
.rem-every .oc-select { flex: 1; min-width: 0; background-color: var(--color-fill); }
.rem-every .rem-number { flex: none; width: 5rem; padding: 0 12px; background-image: none; color: var(--color-text); }
.rem-days, .rem-monthdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.rem-months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.rem-pick { min-height: 40px; padding: 0; border: 0; border-radius: var(--radius-sm); background: var(--color-fill); color: var(--color-text); font: inherit; font-size: var(--text-subhead); cursor: pointer; }
.rem-pick.is-on { background: var(--color-primary); color: var(--color-on-primary); font-weight: var(--weight-semibold); }
.rem-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.task-clear { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border: 0; background: none; color: var(--color-text-secondary); font: inherit; font-size: var(--text-footnote); cursor: pointer; }
.task-overdue { display: flex; align-items: center; gap: 6px; font-size: var(--text-footnote); color: var(--color-danger-text); font-weight: var(--weight-semibold); }
.task-event { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-md); background: color-mix(in srgb, var(--event-color) 10%, var(--color-surface)); }
.task-event-open { display: flex; gap: var(--space-3); flex: 1; min-width: 0; padding: 4px; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.task-event-bar { width: 4px; border-radius: var(--radius-pill); background: var(--event-color); flex: none; }
.task-event-text { display: flex; flex-direction: column; min-width: 0; }
.task-event-label { font-size: var(--text-caption); color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: var(--weight-semibold); }
.task-event-title { font-weight: var(--weight-semibold); }
.task-event-when { font-size: var(--text-footnote); color: var(--color-text-secondary); }
.task-projects { display: flex; gap: var(--space-2); overflow-x: auto; margin: 0 calc(var(--space-4) * -1); padding: 2px var(--space-4) 4px; scrollbar-width: none; }
.task-projects::-webkit-scrollbar { display: none; }
.task-project {
  --pc: var(--color-text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 40px;
  padding: 0 14px 0 6px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-fill);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-subhead);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
.task-project:active { transform: scale(0.95); }
.task-project-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--pc) 22%, var(--color-surface)); font-size: 15px; font-weight: var(--weight-bold); color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); }
.task-project.is-selected { background: color-mix(in srgb, var(--pc) 16%, var(--color-surface)); box-shadow: inset 0 0 0 2px var(--pc); font-weight: var(--weight-semibold); }
/* A mouse wheel can't scroll the swipe row sideways (and its scrollbar is hidden): wrap the chips instead. */
@media (hover: hover) and (pointer: fine) {
  .task-projects { flex-wrap: wrap; overflow-x: visible; }
}
.task-hint { font-size: var(--text-caption); color: var(--color-text-tertiary); }
.task-count { margin-left: auto; padding: 0 7px; border-radius: var(--radius-pill); background: var(--color-fill); color: var(--color-text-secondary); text-transform: none; letter-spacing: 0; }
/* Linked notes (task sheet) and linked tasks (note page) */
.task-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task-link { --nc: var(--color-text-tertiary); display: flex; align-items: center; gap: var(--space-1); padding: 2px 4px 2px 0; border-radius: var(--radius-md); background: var(--color-fill); box-shadow: inset 3px 0 0 var(--nc); }
.task-link-open { display: flex; align-items: center; gap: var(--space-2); flex: 1; min-width: 0; padding: 10px 12px; border: 0; background: none; color: inherit; font: inherit; font-weight: var(--weight-medium); text-align: start; cursor: pointer; }
.task-link-open .oc-icon { color: color-mix(in srgb, var(--nc) 70%, var(--color-text-secondary)); flex: none; }
.task-link-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-link-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.link-picker { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; padding: 4px; border-radius: var(--radius-md); background: var(--color-surface-sunken); overscroll-behavior: contain; }
.link-choice { display: flex; align-items: center; gap: var(--space-3); padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.link-choice:hover { background: var(--color-fill); }
.link-choice-box { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--color-border); color: transparent; transition: background var(--dur-fast) var(--ease-out); }
.link-choice.is-on .link-choice-box { background: var(--color-primary); box-shadow: none; color: var(--color-on-primary); }
.link-choice-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-choice-text.is-done { color: var(--color-text-tertiary); text-decoration: line-through; }
.note-tasks { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--color-separator); }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--color-separator); font-size: var(--text-footnote); color: var(--color-text-tertiary); }
.task-star.is-on { color: var(--color-accent-strong); }
.task-star.is-on .oc-icon { fill: currentColor; animation: oc-pop var(--dur-slow) var(--ease-spring-bouncy); }

/* ======================= Routine sheet ======================= */
.routine-run { --pc: var(--event-iris); display: flex; flex-direction: column; gap: var(--space-4); padding-bottom: var(--space-6); }
.routine-run-head { position: relative; display: flex; align-items: center; gap: var(--space-3); }
.routine-run-head .routine-run-party { left: 24px; }
.routine-run-text { display: flex; flex-direction: column; }
.routine-run-day { font-size: var(--text-footnote); color: var(--color-text-secondary); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.routine-run-count { font-family: var(--font-display); font-size: var(--text-title3); font-weight: var(--weight-semibold); }
.routine-run.is-complete .routine-run-count { color: var(--color-success-text); }
.routine-run-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.routine-run-item { display: flex; align-items: center; gap: var(--space-3); padding: 12px 14px; border-radius: var(--radius-lg); background: var(--color-fill); transition: background var(--dur-base) var(--ease-out); }
.routine-run-item-text { flex: 1; cursor: pointer; font-weight: var(--weight-medium); }
.routine-run-item-text > span { background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / 0% 1.5px; transition: background-size var(--dur-slow) var(--ease-out), color var(--dur-base) var(--ease-out); }
.routine-run-item.is-done { background: color-mix(in srgb, var(--pc) 10%, var(--color-fill)); }
.routine-run-item.is-done .routine-run-item-text > span { background-size: 100% 1.5px; color: var(--color-text-tertiary); }

/* ======================= Project editor ======================= */
.project-editor { --pc: var(--event-iris); display: flex; flex-direction: column; gap: var(--space-5); padding-bottom: var(--space-8); }
.project-editor-hero { display: flex; justify-content: center; padding-top: var(--space-2); }
.project-editor-hero .oc-project-mark { animation: oc-pop var(--dur-slow) var(--ease-spring-bouncy); transition: background var(--dur-base) var(--ease-out); }
.project-editor-group { display: flex; flex-direction: column; gap: var(--space-2); }
.project-editor-group .oc-field-label { display: inline-flex; align-items: center; gap: 6px; }
.project-emoji { display: flex; flex-wrap: wrap; gap: 6px; }
.project-emoji-item {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--color-fill);
  color: color-mix(in srgb, var(--pc) 70%, var(--color-text));
  font-size: 22px;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-spring-bouncy), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.project-emoji-item:active { transform: scale(0.88); }
.project-emoji-item.is-selected { background: color-mix(in srgb, var(--pc) 20%, var(--color-surface)); box-shadow: inset 0 0 0 2px var(--pc); transform: scale(1.06); }
.project-emoji-own { width: 92px; height: 44px; padding: 0 10px; border: 0; border-radius: 14px; background: var(--color-fill); color: var(--color-text); font: inherit; font-size: 16px; }
.project-deadline { display: flex; align-items: center; gap: var(--space-3); }
.project-deadline .oc-select { max-width: 200px; }
.project-deadline-left { font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--color-accent-text); }
.project-link { padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-fill); }
.project-link-hint { font-size: var(--text-footnote); color: var(--color-text-secondary); }
.project-link-preview { display: block; font-size: var(--text-footnote); color: var(--color-success-text); }
.project-link-preview .oc-icon { margin-right: 4px; vertical-align: -2px; }
.project-link-preview.is-empty { color: var(--color-warning-text); }
.project-editor-danger { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); }

/* ======================= Note page ======================= */
.note-page {
  --nc: var(--color-text-tertiary);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 60vh;
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-slow) var(--ease-out);
}
.note-page.is-tinted { background: color-mix(in srgb, var(--nc) 10%, var(--color-surface)); box-shadow: var(--shadow-sm), inset 0 4px 0 var(--nc); }
.note-title-input {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-title1);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  resize: none;
  field-sizing: content;
  outline: none;
}
.note-title-input::placeholder { color: var(--color-text-disabled); }
.note-title-input, .task-title-input { overflow: hidden; }
/* Without field-sizing (older Safari) the titles get room for two lines and scroll beyond that. */
@supports not (field-sizing: content) {
  .note-title-input, .task-title-input { min-height: 2.7em; overflow: auto; }
}
/* The note's own title field is the heading: the page header only shows its compact bar. */
.oc-page-header.note-page-header { display: none; }
.note-pin.is-on .oc-icon { fill: currentColor; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-separator); }
.note-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.note-color {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-spring-bouncy), box-shadow var(--dur-fast) var(--ease-out);
}
.note-color::after { content: ""; position: absolute; inset: -6px; }
.note-color.is-plain { background: var(--color-surface); box-shadow: inset 0 0 0 2px var(--color-fill-strong); }
.note-color.is-selected { transform: scale(1.15); box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--swatch, var(--color-text-tertiary)); }
.note-project { max-width: 220px; height: 36px; font-size: var(--text-footnote); }
.note-body .oc-note-input { min-height: 40vh; background: transparent; box-shadow: none; padding-inline: 0; }
.note-body .oc-note-view { min-height: 30vh; }
.note-edited { margin-top: auto; font-size: var(--text-caption); color: var(--color-text-tertiary); }
.note-pin.is-on { color: var(--color-accent-text); }

/* ======================= Routine editor ======================= */
.routine-editor { --pc: var(--event-iris); display: flex; flex-direction: column; gap: var(--space-4); padding-bottom: var(--space-10); }
.routine-editor-top { display: flex; align-items: flex-end; gap: var(--space-3); }
.routine-name { flex: 1; }
.routine-when { display: flex; flex-direction: column; gap: var(--space-2); }
.routine-when-hint { display: flex; align-items: center; gap: 6px; font-size: var(--text-footnote); color: var(--color-text-secondary); }
.routine-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: item; }
.routine-item, .routine-add { display: flex; align-items: center; gap: var(--space-2); padding: 4px 4px 4px 14px; border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-xs); animation: oc-rise var(--dur-slow) var(--ease-spring) both; }
.routine-add { background: var(--color-fill); box-shadow: none; animation: none; }
.routine-item-dot { width: 18px; height: 18px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 70%, var(--color-text-tertiary)); }
.routine-item-dot.is-new { display: grid; place-items: center; box-shadow: none; color: var(--color-text-tertiary); }
.routine-item-input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; color: var(--color-text); font: inherit; font-size: 16px; outline: none; }
.routine-up .oc-icon { transform: rotate(180deg); }

/* ======================= Event sheet: tasks ======================= */
/* The sheet's own section styles are scoped to EventDetailSheet; the same look here. */
.oc-event-tasks { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--color-separator); }
.oc-event-tasks .detail-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-footnote);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-tertiary);
}
.oc-event-tasks-count { margin-left: auto; font-size: var(--text-footnote); color: var(--color-success-text); }
.oc-event-tasks .oc-capture { margin-top: var(--space-2); }
.oc-event-tasks .oc-task { background: var(--color-fill); box-shadow: none; }
.oc-event-tasks-project { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--space-2); font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--color-text-secondary); text-decoration: none; }
.oc-event-tasks-project .oc-project-mark { width: 22px; height: 22px; border-radius: 7px; font-size: 12px; }

/* ======================= Reduced motion ======================= */
@media (prefers-reduced-motion: reduce) {
  .oc-check-burst, .plan-hero-party, .routine-run-party { display: none; }
  .oc-task-wrap.is-leaving .oc-task { transform: none; }
  .oc-note-card:hover, .oc-note-card:active { transform: none; }
}

/* ---------------------------------------------------------------- Tags, project filter, carry over */
.oc-project-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: -4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: color-mix(in srgb, var(--pc) 55%, var(--color-text-secondary));
}
.oc-project-tags .oc-icon { flex: none; }
.project-chip.is-tag { color: color-mix(in srgb, var(--pc) 60%, var(--color-text)); }

.plan-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--space-3); }
.plan-filter-chip {
  --pc: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-fill);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-footnote);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
.plan-filter-chip:active { transform: scale(0.94); }
.plan-filter-chip.is-selected {
  background: color-mix(in srgb, var(--pc) 18%, var(--color-surface));
  box-shadow: inset 0 0 0 1.5px var(--pc);
  color: var(--color-text);
}
.plan-filter-dot { width: 8px; height: 8px; border-radius: 3px; background: var(--pc); flex: none; }
.plan-filter-sep { width: 1px; height: 18px; margin-inline: 2px; background: var(--color-border); }

.project-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.project-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-fill);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--text-subhead);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
.project-tag:active { transform: scale(0.94); }
.project-tag.is-selected {
  background: color-mix(in srgb, var(--pc) 18%, var(--color-surface));
  box-shadow: inset 0 0 0 2px var(--pc);
  color: var(--color-text);
  font-weight: var(--weight-semibold);
}
.project-tag-new {
  width: 120px;
  height: 36px;
  padding: 0 12px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--color-text);
  font: inherit;
  font-size: 16px;
}
.project-tag-new:focus { outline: none; border-style: solid; border-color: var(--color-primary); }
.project-carry { margin-top: calc(var(--space-2) * -1); }

.oc-capture-proj {
  --pc: var(--color-text-tertiary);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--color-fill);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-spring-bouncy), background var(--dur-fast) var(--ease-out);
}
.oc-capture-proj:active { transform: scale(0.88); }
.oc-capture-proj[aria-expanded="true"] { box-shadow: inset 0 0 0 2px var(--color-primary); }
.oc-capture-proj.is-set { background: color-mix(in srgb, var(--pc) 22%, var(--color-surface)); color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); font-weight: var(--weight-bold); }
.oc-capture-proj-mark { font-size: 15px; line-height: 1; }
.oc-capture-projects { margin-inline: 0; padding-inline: 2px; animation: oc-chip-in var(--dur-slow) var(--ease-spring-bouncy) both; }
.oc-capture-chip-x {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: -4px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--chip) 20%, transparent);
  color: inherit;
  cursor: pointer;
}

.oc-task-tag.is-carried { color: color-mix(in srgb, var(--task-color, var(--color-primary)) 60%, var(--color-text-secondary)); font-weight: var(--weight-semibold); }
.task-carried { display: flex; align-items: center; gap: 6px; font-size: var(--text-footnote); color: var(--color-text-secondary); }

@media (prefers-reduced-motion: reduce) {
  .oc-capture-projects { animation: none; }
}

/* ======================= Board (professional projects) ======================= */
:root {
  --prio-none: var(--color-text-tertiary);
  --prio-low: var(--event-sky);
  --prio-medium: var(--event-amber);
  --prio-high: var(--event-coral);
  --prio-urgent: var(--color-danger);
  /* Lanes are boxes on the page, cards lie on them. */
  --lane-bg: var(--color-surface-sunken);
  --card-bg: var(--color-surface);
}
:root[data-theme="dark"] {
  --lane-bg: var(--color-surface);
  --card-bg: var(--color-surface-raised);
}
/* A container: narrow (phone, Plan's main column) shows one lane at a time; wide shows the lanes side by side.
   No sheets render inside it (the drag copy goes to <body>), so the containment is harmless. */
.oc-board { --pc: var(--event-iris); container-type: inline-size; display: flex; flex-direction: column; gap: var(--space-3); }
.board-lane-tabs { display: flex; gap: var(--space-2); overflow-x: auto; margin: 0 calc(var(--space-4) * -1); padding: 2px var(--space-4) 4px; scrollbar-width: none; }
.board-lane-tabs::-webkit-scrollbar { display: none; }
.board-lane-tab {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 36px; padding: 0 12px;
  border: 0; border-radius: var(--radius-pill); background: var(--color-fill); color: var(--color-text-secondary);
  font: inherit; font-size: var(--text-subhead); font-weight: var(--weight-medium); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.board-lane-tab .tabular { color: var(--color-text-tertiary); font-size: var(--text-footnote); }
.board-lane-tab.is-active { background: color-mix(in srgb, var(--pc) 16%, var(--color-surface)); color: var(--color-text); box-shadow: inset 0 0 0 2px var(--pc); font-weight: var(--weight-semibold); }
.board-lane-tab.is-drop-target { box-shadow: inset 0 0 0 2px var(--pc), 0 0 0 4px color-mix(in srgb, var(--pc) 25%, transparent); transform: scale(1.05); }
.board-lanes { display: flex; gap: var(--space-4); align-items: stretch; }
.board-lane {
  --lane: var(--color-text-tertiary);
  position: relative; display: none; flex-direction: column; flex: 1; min-width: 0; overflow: hidden;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--lane-bg);
}
/* The coloured top edge: grey Backlog, the project's colour for its columns, green Finished. */
.board-lane::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--lane); }
.board-lane--column { --lane: var(--pc); }
.board-lane--finished { --lane: var(--color-success); }
.board-lane.is-active { display: flex; }
.board-lane-head { display: flex; align-items: center; gap: 6px; padding: 14px 14px 10px; border-bottom: 1px solid var(--color-separator); font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.board-lane-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-lane-count { padding: 0 7px; border-radius: var(--radius-pill); background: var(--color-fill); text-transform: none; letter-spacing: 0; }
.board-lane-points { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--color-text-tertiary); }
.board-lane-body {
  display: flex; flex-direction: column; flex: 1; gap: 8px; min-height: 88px; padding: 10px;
  transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.board-lane-body.is-drop-target { background: color-mix(in srgb, var(--pc) 10%, var(--lane-bg)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 45%, transparent); }
.board-lane-empty { margin: auto; padding: var(--space-3); font-size: var(--text-footnote); color: var(--color-text-tertiary); text-align: center; }
.board-lane--finished .board-lane-head .oc-icon { color: var(--color-success-text); }
.board-more { padding: 8px; border: 0; border-radius: var(--radius-md); background: none; color: var(--color-text-secondary); font: inherit; font-size: var(--text-footnote); font-weight: var(--weight-semibold); cursor: pointer; }
.board-more:hover { background: var(--color-fill); }
.board-history { display: inline-flex; align-items: center; justify-content: center; gap: 5px; margin-top: auto; }

@container (min-width: 620px) {
  .board-lane-tabs { display: none; }
  /* Sideways scrolling with a scrollbar you can see and grab (a mouse wheel can't scroll sideways). */
  .board-lanes { overflow-x: auto; padding-bottom: var(--space-3); scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--pc) 45%, var(--color-fill-strong)) transparent; }
  .board-lanes::-webkit-scrollbar { height: 10px; }
  .board-lanes::-webkit-scrollbar-thumb { border-radius: 10px; background: color-mix(in srgb, var(--pc) 45%, var(--color-fill-strong)); }
  .board-lane, .board-lane.is-active { display: flex; flex: 1 0 210px; min-height: clamp(260px, 50dvh, 620px); }
}

.board-card {
  --prio: var(--prio-none);
  position: relative; display: flex; align-items: flex-start; gap: var(--space-2);
  padding: 10px 6px 10px 12px; border-radius: var(--radius-md);
  background: var(--card-bg); box-shadow: var(--shadow-xs), inset 3px 0 0 var(--prio);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
.board-card > .board-card-check { margin-top: 1px; }
.board-card-body { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: inherit; }
.board-card-body:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 4px; border-radius: var(--radius-xs); }
.board-card-title { display: flex; align-items: baseline; gap: 5px; font-weight: var(--weight-medium); line-height: var(--leading-snug); overflow-wrap: anywhere; }
.board-card.is-done .board-card-title { color: var(--color-text-tertiary); text-decoration: line-through; }
.board-card.is-done { box-shadow: none; background: color-mix(in srgb, var(--card-bg) 60%, transparent); }
.board-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--text-caption); color: var(--color-text-secondary); }
.board-prio { display: inline-flex; align-items: center; gap: 3px; color: color-mix(in srgb, var(--prio) 75%, var(--color-text)); font-weight: var(--weight-semibold); }
.board-prio .oc-icon { fill: currentColor; }
.board-points { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--color-fill-strong); color: var(--color-text); font-weight: var(--weight-semibold); }
.board-card-next {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 0; border-radius: 50%;
  background: none; color: var(--color-text-tertiary); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.board-card-next:hover { background: var(--color-fill); color: var(--color-text); }
.board-card.is-dragging { opacity: 0.35; }
.oc-board.is-dragging, .oc-board.is-dragging * { cursor: grabbing; }
/* The copy that follows the pointer while dragging (lives in <body>). */
.board-ghost { position: fixed; z-index: 1000; margin: 0; pointer-events: none; box-shadow: var(--shadow-lg), inset 3px 0 0 var(--prio); opacity: 0.95; }
.board-drop-line { position: fixed; z-index: 999; height: 3px; border-radius: 3px; background: var(--pc, var(--color-primary)); pointer-events: none; display: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc, var(--color-primary)) 25%, transparent); }

/* Task sheet: priority and points pickers (professional projects) */
.prio-chip {
  --prio: var(--prio-none);
  display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px;
  border: 0; border-radius: var(--radius-pill); background: var(--color-fill); color: var(--color-text);
  font: inherit; font-size: var(--text-subhead); font-weight: var(--weight-medium); cursor: pointer;
}
.prio-chip .oc-icon { color: var(--prio); fill: currentColor; }
.prio-chip.is-selected { background: color-mix(in srgb, var(--prio) 16%, var(--color-surface)); box-shadow: inset 0 0 0 2px var(--prio); font-weight: var(--weight-semibold); }
.task-points { display: flex; flex-wrap: wrap; gap: 6px; }
.points-chip {
  display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--color-fill); color: var(--color-text); font: inherit; font-weight: var(--weight-semibold); cursor: pointer;
  transition: transform var(--dur-base) var(--ease-spring), background var(--dur-fast) var(--ease-out);
}
.points-chip:active { transform: scale(0.92); }
.points-chip.is-selected { background: var(--color-primary); color: var(--color-on-primary); }

/* Project editor: the board's columns */
.board-columns { display: flex; flex-direction: column; gap: 6px; padding: var(--space-3); border-radius: var(--radius-lg); background: var(--color-surface-sunken); }
.board-columns-fixed { display: flex; align-items: center; gap: 6px; padding: 6px 4px; font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--color-text-tertiary); }
.board-column-row { display: flex; align-items: center; gap: 4px; }
.board-column-name { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border: 0; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-border); color: var(--color-text); font: inherit; font-size: max(16px, var(--text-subhead)); }
.board-column-name:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--color-primary); }
.board-column-confirm { flex: 1; font-size: var(--text-footnote); color: var(--color-danger-text); }

/* ======================= Plan: Today or one project's backlog ======================= */
.plan-views { display: flex; gap: var(--space-2); overflow-x: auto; margin: 0 calc(var(--space-4) * -1) var(--space-4); padding: 2px var(--space-4) 4px; scrollbar-width: none; }
.plan-views::-webkit-scrollbar { display: none; }
.plan-view {
  --pc: var(--color-primary);
  display: inline-flex; align-items: center; gap: 7px; flex: none; height: 38px; padding: 0 14px 0 5px;
  border: 0; border-radius: var(--radius-pill); background: var(--color-fill); color: var(--color-text-secondary);
  font: inherit; font-size: var(--text-subhead); font-weight: var(--weight-medium); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-base) var(--ease-spring);
}
.plan-view:active { transform: scale(0.95); }
.plan-view-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--pc) 22%, var(--color-surface)); color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); font-size: 14px; font-weight: var(--weight-bold); }
.plan-view-pro { color: var(--color-text-tertiary); }
.plan-view.is-selected { background: color-mix(in srgb, var(--pc) 16%, var(--color-surface)); box-shadow: inset 0 0 0 2px var(--pc); color: var(--color-text); font-weight: var(--weight-semibold); }
/* A mouse wheel can't scroll the row sideways: wrap instead (as the project picker does). */
@media (hover: hover) and (pointer: fine) {
  .plan-views { flex-wrap: wrap; overflow-x: visible; }
}
.plan-view-head {
  --pc: var(--event-iris);
  display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3);
  border-radius: var(--radius-xl); background: color-mix(in srgb, var(--pc) 12%, var(--color-surface)); box-shadow: var(--shadow-xs);
}
.plan-view-head .oc-ring { flex: none; }
.plan-view-head .oc-ring-value { stroke: var(--pc); }
.plan-view-head .oc-ring-track { stroke: color-mix(in srgb, var(--pc) 18%, var(--color-fill)); }
.plan-view-head-mark { font-size: 20px; font-weight: var(--weight-bold); color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); }
.plan-view-head-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.plan-view-head-title { margin: 0; font-family: var(--font-display); font-size: var(--text-title3); font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-view-head-line { margin: 0; font-size: var(--text-footnote); color: var(--color-text-secondary); }
.plan-view-head-line .is-late { color: var(--color-danger-text); font-weight: var(--weight-semibold); }
.plan-view-open { display: inline-flex; align-items: center; gap: 2px; flex: none; padding: 8px 4px 8px 10px; border-radius: var(--radius-pill); color: var(--color-primary-text); font-size: var(--text-footnote); font-weight: var(--weight-semibold); text-decoration: none; }
.plan-view-open:hover { background: var(--color-fill); }

/* ---- Sprints (M20) ---- */
.board-scope { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); }
.board-scope-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 0; border-radius: var(--radius-pill); background: var(--color-fill); color: var(--color-text-secondary);
  font: inherit; font-size: var(--text-footnote); font-weight: var(--weight-medium); cursor: pointer;
}
.board-scope-chip.is-selected { background: color-mix(in srgb, var(--pc) 16%, var(--color-surface)); box-shadow: inset 0 0 0 2px var(--pc); color: var(--color-text); font-weight: var(--weight-semibold); }

.sprint-editor { display: flex; flex-direction: column; gap: var(--space-4); }
.sprint-dates { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.sprint-dates label { display: flex; flex-direction: column; gap: 6px; }
.sprint-dates input { width: 100%; background-image: none; padding-right: 12px; }
.sprint-dates + .project-link-hint { margin-top: calc(var(--space-2) * -1); }
.sprint-picker .link-choice-text { flex: 1; min-width: 0; }
.sprint-pick-other { padding: 1px 7px; border-radius: var(--radius-pill); background: var(--color-fill); font-size: var(--text-caption); color: var(--color-text-secondary); white-space: nowrap; }

/* A container without sheets in it (the sprint editor is outside). */
.sprint-panel { container-type: inline-size; }
.sprint-grid { display: grid; gap: var(--space-4); align-items: start; }
.sprint-main, .sprint-side { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.sprint-side > .oc-section-header { margin-top: 0; }
@container (min-width: 900px) {
  .sprint-grid { grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); gap: var(--space-6); }
  .sprint-main:only-child { grid-column: 1 / -1; max-width: 900px; }
  .sprint-grid.is-stacked { grid-template-columns: minmax(0, 900px); }
}
.sprint-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-xl); background: var(--color-surface); box-shadow: var(--shadow-xs); }
.sprint-card.is-active { box-shadow: var(--shadow-xs), inset 0 0 0 2px color-mix(in srgb, var(--pc) 40%, transparent); }
.sprint-card-head { display: flex; align-items: center; gap: var(--space-3); }
.sprint-card-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: color-mix(in srgb, var(--pc) 20%, var(--color-surface)); color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); }
.sprint-card-icon.is-planned { background: var(--color-fill); color: var(--color-text-secondary); }
.sprint-card-title { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sprint-card-title h3 { margin: 0; font-family: var(--font-display); font-size: var(--text-title3); font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprint-card-dates { font-size: var(--text-footnote); color: var(--color-text-secondary); }
.sprint-badge { flex: none; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--color-fill); font-size: var(--text-caption); font-weight: var(--weight-semibold); color: var(--color-text-secondary); white-space: nowrap; }
.sprint-badge.is-soon { background: var(--color-warning-soft); color: var(--color-warning-text); }
.sprint-badge.is-over { background: var(--color-danger-soft); color: var(--color-danger-text); }
.sprint-goal { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border-radius: var(--radius-md); background: var(--color-surface-sunken); font-size: var(--text-subhead); }
.sprint-goal .oc-icon { flex: none; margin-top: 2px; color: color-mix(in srgb, var(--pc) 70%, var(--color-text)); }
.sprint-stats { display: flex; gap: var(--space-6); }
.sprint-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sprint-close { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-surface-sunken); }
.sprint-close-title { margin: 0; font-family: var(--font-display); font-size: var(--text-callout); font-weight: var(--weight-semibold); }
.sprint-close-count { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--text-subhead); font-weight: var(--weight-semibold); }
.sprint-close-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sprint-close-list li { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--text-subhead); }
.sprint-close-list li > i { width: 14px; height: 14px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 70%, var(--color-text-tertiary)); }
.sprint-close-list li > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprint-close-list li.is-more { padding-left: 24px; color: var(--color-text-secondary); }
.sprint-move { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; border: 0; }
.sprint-move legend { margin-bottom: 6px; padding: 0; font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--color-text-secondary); }
.sprint-move-option {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 14px;
  border-radius: var(--radius-md); background: var(--color-fill); font-size: var(--text-subhead); font-weight: var(--weight-medium); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.sprint-move-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--pc); cursor: pointer; }
.sprint-move-option.is-selected { background: color-mix(in srgb, var(--pc) 16%, var(--color-surface)); box-shadow: inset 0 0 0 2px var(--pc); font-weight: var(--weight-semibold); }
.sprint-move-option:has(input:focus-visible) { outline: 2px solid var(--color-focus-ring); outline-offset: 2px; }
.sprint-velocity-avg { font-size: var(--text-footnote); color: var(--color-text-secondary); }
.sprint-history { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-xs); }
.sprint-history-item + .sprint-history-item { border-top: 1px solid var(--color-separator); }
.sprint-history-row { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: 12px var(--space-4); border-radius: var(--radius-lg); color: inherit; font: inherit; text-align: start; }
@media (hover: hover) { .sprint-history-row:hover { background: var(--color-fill); } }
.sprint-history-chevron { color: var(--color-text-tertiary); flex: none; transition: transform var(--dur-base) var(--ease-spring); }
.sprint-history-chevron.is-flipped { transform: rotate(180deg); }
.sprint-history-body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-1) var(--space-4) var(--space-4); }
.sprint-history-h { display: flex; align-items: center; gap: 8px; margin: var(--space-1) 0 0; font-family: var(--font-sans); font-size: var(--text-footnote); font-weight: var(--weight-semibold); color: var(--color-text-secondary); }
.sprint-history-h .tabular { padding: 0 7px; border-radius: var(--radius-pill); background: var(--color-fill); }
.sprint-history-tasks { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.sprint-history-task { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 4px 8px; border-radius: var(--radius-sm); color: inherit; font: inherit; font-size: var(--text-subhead); text-align: start; }
button.sprint-history-task:hover { background: var(--color-fill); }
.sprint-history-task .oc-icon { flex: none; color: var(--color-text-tertiary); }
.sprint-history-task.is-done > .oc-icon { color: var(--color-success-text); }
.sprint-history-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprint-history-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sprint-history-name { font-weight: var(--weight-medium); }
.sprint-history-velocity { font-weight: var(--weight-semibold); }

/* Burndown: one y-axis (0 to the sprint's total), 2 px lines that keep their width when the SVG stretches, hairline grid. */
.oc-burndown { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; }
.burndown-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); font-size: var(--text-footnote); color: var(--color-text-secondary); }
.burndown-key { display: inline-flex; align-items: center; gap: 6px; }
.burndown-key i, .burndown-tip-row i { display: inline-block; width: 14px; height: 2px; border-radius: 1px; background: var(--pc); }
.burndown-key.is-ideal i, .burndown-tip-row.is-ideal i { background: repeating-linear-gradient(90deg, var(--color-text-tertiary) 0 4px, transparent 4px 7px); }
.burndown-unit { margin-left: auto; color: var(--color-text-tertiary); }
.burndown-plot { position: relative; height: 180px; margin-left: 28px; }
.burndown-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.burndown-grid { stroke: var(--color-separator); stroke-width: 1; vector-effect: non-scaling-stroke; }
.burndown-ideal { fill: none; stroke: var(--color-text-tertiary); stroke-width: 2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.burndown-line { fill: none; stroke: var(--pc); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.burndown-cross { stroke: var(--color-border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.burndown-hit { fill: transparent; cursor: crosshair; }
.burndown-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 2px var(--color-surface); pointer-events: none; }
.burndown-axis-y { position: absolute; left: -28px; width: 22px; transform: translateY(-50%); font-size: var(--text-caption); color: var(--color-text-tertiary); text-align: right; font-variant-numeric: tabular-nums; pointer-events: none; }
.burndown-axis-x { display: flex; justify-content: space-between; margin-left: 28px; font-size: var(--text-caption); color: var(--color-text-tertiary); }
.burndown-tip {
  position: absolute; top: 0; z-index: 2; display: flex; flex-direction: column; gap: 3px; min-width: 120px; margin-left: 10px; padding: 8px 10px;
  border-radius: var(--radius-md); background: var(--color-surface-raised); box-shadow: var(--shadow-md);
  font-size: var(--text-caption); color: var(--color-text-secondary); pointer-events: none;
}
.burndown-tip.is-left { transform: translateX(calc(-100% - 20px)); }
.burndown-tip-day { font-weight: var(--weight-semibold); color: var(--color-text); }
.burndown-tip-row { display: flex; align-items: center; gap: 6px; }
.burndown-tip-row strong { color: var(--color-text); }
.burndown-table summary { font-size: var(--text-footnote); color: var(--color-text-secondary); cursor: pointer; }
.burndown-table table { width: 100%; margin-top: var(--space-2); border-collapse: collapse; font-size: var(--text-footnote); }
.burndown-table th, .burndown-table td { padding: 4px 6px; text-align: right; }
.burndown-table th[scope="row"], .burndown-table thead th:first-child { text-align: left; font-weight: var(--weight-medium); }
.burndown-table tbody tr + tr { border-top: 1px solid var(--color-separator); }
