/* ==========================================================================
   Superhuman — design system
   One token layer, one type scale, one accent. Phone is the primary surface:
   every interactive control clears 40px, body copy never drops below 13px,
   and nothing relies on hover to be discoverable.
   ========================================================================== */

:root {
  /* Surfaces & ink */
  --bg: #f6f6f9;
  --bg-blur: rgba(246, 246, 249, 0.82);
  --surface: #ffffff;
  --surface-2: #f1f1f6;
  --surface-3: #e9e9f0;
  --line: #e8e8ef;
  --line-strong: #d7d7e1;
  --text: #16161d;
  --text-2: #5b5b6b;
  --text-3: #8a8a99;

  /* One accent, three roles */
  --accent: #5a4bd8;
  --accent-strong: #4a3bc2;
  --accent-soft: #eeecfd;
  --accent-ink: #4a3bc2;

  /* Semantics — used small, never as a background for whole panels */
  --ok: #1f8a5c;
  --ok-soft: #e6f4ec;
  --ok-ink: #146b46;
  --warn: #b0730c;
  --warn-soft: #fdf2dd;
  --danger: #c03a35;
  --danger-soft: #fdeceb;
  --star: #d29b1c;
  --star-soft: #fdf3dc;

  /* Type scale */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 19px;
  --fs-xl: 24px;
  --fs-2xl: 28px;

  /* Space scale */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 40px;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 24px;
  --r-full: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(20, 20, 45, 0.05);
  --shadow-md: 0 2px 6px rgba(20, 20, 45, 0.06), 0 8px 24px rgba(20, 20, 45, 0.05);
  --shadow-lg: 0 8px 20px rgba(20, 20, 45, 0.1), 0 24px 60px rgba(20, 20, 45, 0.14);
  --ring: 0 0 0 3px rgba(90, 75, 216, 0.24);

  /* Layout */
  --shell: 760px;
  --gutter: 20px;
  --topbar-h: 56px;
  --tap: 40px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 120ms var(--ease);
  --base: 200ms var(--ease);

  /* Legacy aliases kept so older rules and inline markup stay correct */
  --card: var(--surface);
  --muted: var(--text-3);
  --accent2: var(--accent-strong);
  --soft: var(--accent-soft);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e0e13;
    --bg-blur: rgba(14, 14, 19, 0.82);
    --surface: #17171f;
    --surface-2: #1e1e28;
    --surface-3: #262632;
    --line: #747487;
    --line-strong: #88889b;
    --text: #f1f1f6;
    --text-2: #a4a4b4;
    --text-3: #aaaabb;

    --accent: #8d7dff;
    --accent-strong: #a89bff;
    --accent-soft: #221f3a;
    --accent-ink: #b5a9ff;

    --ok: #4cbd8a;
    --ok-soft: #12271f;
    --ok-ink: #6fd6a5;
    --warn: #dda13f;
    --warn-soft: #2a2114;
    --danger: #e8756c;
    --danger-soft: #2e1817;
    --star: #e0ae3c;
    --star-soft: #2b2314;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.5), 0 24px 60px rgba(0, 0, 0, 0.55);
    --ring: 0 0 0 3px rgba(141, 125, 255, 0.35);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

body { overscroll-behavior-y: none; overflow-x: clip; }
form, section, article, .page, dialog > * { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); margin-top: var(--s6); }
h3 { font-size: var(--fs-md); }

p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-ink); text-underline-offset: 3px; }

button { font: inherit; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.hidden { display: none !important; }

.muted,
.task-meta {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-3);
}

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Focus: exactly one ring, everywhere. */
:where(button, a, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */
input:where(:not([type="checkbox"]):not([type="range"])),
select,
textarea {
  box-sizing: border-box;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 10px 12px;
  transition: border-color var(--fast), box-shadow var(--fast);
}

input:where(:not([type="checkbox"]):not([type="range"])):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* iOS Safari zooms a focused text field below 16px. Keep entry fields at 16px;
   selects and chips are free to be metadata-sized. */
input:where(:not([type="checkbox"]):not([type="range"])),
textarea,
.search-overlay input {
  font-size: var(--fs-md) !important;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.primary-btn {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.primary-btn:hover { background: var(--accent-strong); }
.secondary-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}
.secondary-btn:hover { background: var(--surface-2); }
.primary-btn:active,
.secondary-btn:active { transform: scale(0.98); }

.link-btn {
  flex: none;
  border: 0;
  background: none;
  padding: 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
  white-space: nowrap;
  transition: color var(--fast);
}
.link-btn:hover { color: var(--text); }

.close-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin-right: -8px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-3);
  font-size: 22px;
  line-height: 1;
  transition: background var(--fast), color var(--fast);
}
.close-btn:hover { background: var(--surface-2); color: var(--text); }

/* --------------------------------------------------------------------------
   App bar
   -------------------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), calc((100% - var(--shell)) / 2)) 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: var(--bg-blur);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}

.brand-btn,
.today-link,
.icon-btn {
  border: 0;
  background: none;
  padding: 0;
}

.brand-btn {
  justify-self: start;
  display: flex;
  align-items: center;
  min-width: var(--tap);
  min-height: var(--tap);
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.03em;
  box-shadow: var(--shadow-sm);
}

.logo {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.today-link {
  min-height: var(--tap);
  padding: 0 var(--s3);
  font-size: var(--fs-base);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  display: grid;
  place-items: center;
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: var(--r-sm);
  color: var(--text-2);
  transition: background var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.icon-btn svg,
.search-overlay svg,
.task-search-field svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-overlay {
  position: fixed;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  left: 0;
  width: 100%;
  z-index: 39;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) max(var(--gutter), calc((100% - var(--shell)) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  color: var(--text-3);
}
.search-overlay input {
  flex: 1;
  min-width: 0;
  height: var(--tap);
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
}

/* --------------------------------------------------------------------------
   Shell & navigation
   -------------------------------------------------------------------------- */
.app-shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: calc(var(--topbar-h) + env(safe-area-inset-top) + var(--s2))
    var(--gutter) calc(96px + env(safe-area-inset-bottom));
}

.page { display: none; }
.page.active { display: block; }

.workspace-nav {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s1);
  margin: 0 calc(var(--gutter) * -1) var(--s5);
  padding: var(--s2) var(--gutter);
  background: var(--bg-blur);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.workspace-nav button,
.nav-more summary {
  display: grid;
  place-items: center;
  min-height: 34px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 550;
  list-style: none;
  transition: background var(--fast), color var(--fast);
}
.workspace-nav button:hover,
.nav-more summary:hover { background: var(--surface-2); color: var(--text); }

.workspace-nav button.active,
.nav-more[open] summary {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 650;
}

.nav-more { position: relative; margin: 0; min-width: 0; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more > div {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s2));
  z-index: 35;
  display: grid;
  gap: 2px;
  min-width: 140px;
  padding: var(--s1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}
.nav-more > div button {
  justify-items: start;
  min-height: 38px;
  padding: 0 var(--s3);
  text-align: left;
}

/* --------------------------------------------------------------------------
   Section headers
   -------------------------------------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin: 0 0 var(--s4);
}
.section-head h1 {
  font-size: var(--fs-xl);
  letter-spacing: -0.025em;
}
.section-head h2 { margin: 0; }
.section-head .muted { flex: none; }

.section-subhead,
.schedule-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin: var(--s6) 0 var(--s3);
}
.section-subhead h2,
.schedule-head h2 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

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

/* --------------------------------------------------------------------------
   Today — the day's shape, then the day's work
   -------------------------------------------------------------------------- */
/* Today's status is a caption, not a panel: a hairline of progress and one line of
   numbers. It sits under the title instead of pushing the work down the screen. */
.today-summary {
  margin: calc(var(--s2) * -1) 0 var(--s4);
}
.today-summary:empty { display: none; }

.today-progress {
  height: 3px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--r-full);
}
.today-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--base);
}

.today-metrics {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s2);
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.today-metrics b {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.today-metrics .dot { color: var(--line-strong); }

.metric-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--fs-sm);
}
.metric-link:hover,
.metric-link:hover b { color: var(--accent-ink); }

.tier {
  display: inline-block;
  margin-top: var(--s1);
  padding: 2px var(--s2);
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  font-weight: 650;
}
.tier-must_do { background: var(--danger-soft); color: var(--danger); }

/* Search + add row */
.task-search-row {
  display: flex;
  gap: var(--s2);
  margin: 0 0 var(--s4);
}
#otherResults { margin-top: var(--s6); }
.task-search-field {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex: 1;
  min-width: 0;
  padding: 0 var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text-3);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.task-search-field:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.task-search-field svg { flex: none; }
.task-search-field input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
}

.add-task-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: none;
  height: 42px;
  padding: 0 var(--s4) 0 var(--s3);
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background var(--fast), transform var(--fast);
}
.add-task-button span { font-size: 17px; line-height: 1; }
.add-task-button:hover { background: var(--accent-strong); }
.add-task-button:active { transform: scale(0.96); }

/* Legacy inline search field */
.task-search {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  margin: 0 0 var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text-3);
}
.task-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

/* --------------------------------------------------------------------------
   Task row — the most-read object in the product
   -------------------------------------------------------------------------- */
.task-swipe {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  touch-action: pan-y;
}
/* overflow:hidden keeps the swipe layer inside the rounded row, but it also clips the
   row's own menu. You are never swiping while a menu is open, so let the row open up —
   and lift it, or the escaped menu just lands behind the next row. */
.task-swipe:has(.task-menu[open]) {
  overflow: visible;
  z-index: 5;
}

.task-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 2px var(--s3);
  padding: 10px var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.task-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.task-swipe .task-card { transition: transform 160ms var(--ease); }

/* Priority reads as one quiet edge, not a border plus a ring plus a colour. The card
   squares off its left side so the marker is a straight edge: an inset shadow would bend
   around the 14px radius and read as a thick bracket. */
.task-swipe.important,
.task-swipe.important .task-card,
.task-swipe.important .swipe-actions {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.task-swipe.important .task-card {
  border-left: 3px solid var(--warn);
  padding-left: calc(var(--s4) - 3px);
}

.task-check {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--ok);
  cursor: pointer;
  flex: none;
}

.task-main { min-width: 0; }

.task-title {
  display: block;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.task-preview {
  margin: 2px 0 0;
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-meta {
  margin-top: var(--s1);
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.task-check { grid-column: 1; grid-row: 1; }
.task-main { grid-column: 2; grid-row: 1; }

.task-footer {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  min-width: 0;
}

/* The controls keep their 40px touch target but stop charging the row for it: the extra
   height bleeds into the padding instead of pushing every card taller. The title column
   keeps its full width, which matters more than saving one more row. */
.task-tools {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin: -6px 0 -6px auto;
}
.task-tools .due,
.task-tools .done-label { order: 1; }
.task-tools .task-menu { order: 2; }
.task-tools .task-star { order: 3; }

.task-star {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  transition: color var(--fast), background var(--fast);
}
.task-star:hover { background: var(--surface-2); color: var(--star); }
.task-star.is-starred { color: var(--star); background: transparent; }
.task-star.is-starred:hover { background: var(--star-soft); }

.due,
.done-label {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  transition: background var(--fast), color var(--fast);
}
.due:hover { background: var(--surface-2); color: var(--text); }
.due.suggested { color: var(--text-3); font-weight: 500; }
.done-label { color: var(--ok-ink); }

.date-edit { cursor: pointer; }

.task-menu { position: relative; margin: 0; }
.task-menu summary {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  margin: 0;
  border-radius: var(--r-sm);
  list-style: none;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  transition: background var(--fast), color var(--fast);
}
.task-menu summary:hover { background: var(--surface-2); color: var(--text); }
.task-menu summary::-webkit-details-marker { display: none; }
.task-menu > button {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s1));
  z-index: 30;
  white-space: nowrap;
  min-height: 38px;
  padding: 0 var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

/* Completed rows stay legible but stop competing for attention. */
.task-card.completed,
.completed { background: var(--surface); }
.task-card.completed { opacity: 0.68; }
.task-card.completed .task-title { color: var(--text-2); font-weight: 500; }
.completed .task-title { color: var(--text-2); }

.completed-section {
  margin-top: var(--s7);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
}
.completed-section summary {
  margin-bottom: var(--s3);
  color: var(--ok-ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}

/* Project / Goal chip. Unassigned is a ghost until you reach for it. */
.project-tag {
  display: inline-block;
  max-width: 100%;
  width: fit-content;
  margin: 0;
  padding: 4px var(--s2);
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 550;
  line-height: 1.4;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: background var(--fast), color var(--fast);
  -webkit-appearance: none;
  appearance: none;
}
.project-tag:hover { background: var(--surface-2); color: var(--text-2); }
.project-tag.assigned,
.project-tag.readonly {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.project-tag.color-lavender { background: #eeeafc; color: #5c46b0; }
.project-tag.color-indigo { background: #e5e9fb; color: #37499e; }
.project-tag.color-sky { background: #e2f0fd; color: #24638f; }
.project-tag.color-teal { background: #ddf2f1; color: #1d6b68; }
.project-tag.color-mint { background: #e1f5ea; color: #256b4c; }
.project-tag.color-sun { background: #fbf1d5; color: #7e6215; }
.project-tag.color-peach { background: #fdebe0; color: #98522e; }
.project-tag.color-rose { background: #fde8ec; color: #9c3a53; }
.project-tag.color-plum { background: #f6e6f4; color: #7d3a75; }
.project-tag.color-slate { background: #e8eaef; color: #4a5263; }
.project-tag:disabled { opacity: 0.5; cursor: default; }
.task-footer > .project-tag { max-width: 55%; }

@media (prefers-color-scheme: dark) {
  .project-tag.color-lavender { background: #221d38; color: #b4a3f0; }
  .project-tag.color-indigo { background: #1a1f38; color: #9aabf0; }
  .project-tag.color-sky { background: #142433; color: #7fbdec; }
  .project-tag.color-teal { background: #10262a; color: #6cc6c2; }
  .project-tag.color-mint { background: #122a22; color: #6fcca8; }
  .project-tag.color-sun { background: #2b2412; color: #dcc06a; }
  .project-tag.color-peach { background: #2d1d15; color: #e0a07c; }
  .project-tag.color-rose { background: #2e181d; color: #e592a4; }
  .project-tag.color-plum { background: #2a1a29; color: #d193c9; }
  .project-tag.color-slate { background: #1f232b; color: #a3adc0; }
}


/* Swipe affordances */
.swipe-actions {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  border-radius: var(--r-lg);
}
.swipe-actions.left { justify-content: flex-start; background: var(--ok-soft); }
.swipe-actions.right { justify-content: flex-end; background: var(--accent-soft); }
.swipe-actions span {
  display: grid;
  place-items: center;
  width: 92px;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--ok-ink);
}
.swipe-actions.right span { color: var(--accent-ink); }

/* Inline title editing */
.title-edit {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 0;
  cursor: text;
  color: inherit;
  font: inherit;
  overflow-wrap: anywhere;
}
.inline-task-edit input { width: 100%; min-width: 0; }
.inline-task-edit button {
  min-height: 34px;
  margin: var(--s2) var(--s2) 0 0;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.inline-task-edit button:disabled { opacity: 0.5; }
.inline-task-edit p { margin: var(--s2) 0 0; font-size: var(--fs-sm); color: var(--danger); }
.task-card:has(.inline-task-edit) { grid-template-columns: auto minmax(0, 1fr); }
.task-card:has(.inline-task-edit) .task-main { grid-column: 2; }
.task-card:has(.inline-task-edit) .task-tools { display: none; }
.task-card:has(.inline-task-edit) .task-check { visibility: hidden; }

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */
.empty.compact {
  padding: var(--s3) var(--s4);
  border-style: solid;
  border-color: var(--line);
  text-align: left;
}
.empty {
  padding: var(--s7) var(--s5);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.7;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Filters & segments
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: 0 0 var(--s4);
}
.filter {
  min-height: 34px;
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 550;
  white-space: nowrap;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.filter:hover { border-color: var(--line-strong); color: var(--text); }
.filter.active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 650;
}

.segment-wrap { display: none; }
.segment {
  min-height: 34px;
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.segment.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* --------------------------------------------------------------------------
   Today's schedule
   -------------------------------------------------------------------------- */
.schedule { margin-bottom: var(--s5); }

.event-card {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s2) var(--s3) var(--s2) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.event-card { align-items: center; }
.event-card.important { border-left: 3px solid var(--accent); padding-left: calc(var(--s4) - 2px); }
.event-tools { flex: none; display: flex; flex-direction: row; align-items: center; margin: calc(var(--s2) * -1) calc(var(--s2) * -1) calc(var(--s2) * -1) 0; }
.event-tools .task-star { width: 36px; height: 36px; min-width: 0; min-height: 0; }
.event-tools .event-menu summary { min-width: 36px; min-height: 36px; }
.event-status-label { display: block; color: var(--ok-ink); font-size: var(--fs-sm); margin-top: var(--s1); }
.event-menu { position: relative; }
.event-menu[open] { z-index: 31; }
.event-menu summary { display: grid; place-items: center; list-style: none; min-width: var(--tap); min-height: var(--tap); cursor: pointer; color: var(--text-2); }
.event-menu summary::-webkit-details-marker { display: none; }
.icon-more { fill: currentColor; display: block; }
.event-tools .event-menu { display: flex; margin: 0; }
.event-tools .event-menu summary { padding: 0; line-height: 0; }
.event-menu summary:hover, .event-menu[open] summary { color: var(--text); }
.event-menu-panel { position: absolute; right: 0; top: 100%; display: grid; min-width: 160px; padding: var(--s1); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-lg); }
.event-menu-panel button { min-height: var(--tap); padding: var(--s2) var(--s3); border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; font-size: var(--fs-sm); }
.event-menu-panel button:hover { background: var(--surface-2); }
.follow-up-next { min-height: var(--tap); margin: var(--s1) 0 var(--s3); overflow-wrap: anywhere; text-align: left; }

.event-when {
  flex: none;
  min-width: 84px;
  padding-top: 1px;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

button.event-main,
.event-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
}
button.event-main { cursor: pointer; }

.event-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.event-task-badge { display: inline-block; margin-top: var(--s1); color: var(--accent-ink); background: var(--accent-soft); border-radius: var(--r-xs); padding: var(--s1) var(--s2); font-size: var(--fs-sm); }
.follow-up-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.follow-up-item p { margin: 4px 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.event-meta {
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  overflow-wrap: anywhere;
}

.mark-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  font-size: var(--fs-sm);
  line-height: 1;
  transition: background var(--fast);
}
.mark-btn:hover { background: var(--surface-2); }

.gap-card {
  padding: var(--s1) var(--s4) var(--s1) calc(84px + var(--s4) + var(--s3));
  font-size: var(--fs-xs);
  color: var(--text-3);
}

.calendar-sync {
  margin: 0 0 var(--s4);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-3);
}
.calendar-sync:empty { display: none; }
.calendar-sync button { margin-left: var(--s2); text-decoration: underline; }

/* --------------------------------------------------------------------------
   Strategy: projects & goals
   -------------------------------------------------------------------------- */
.strategy-card {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.strategy-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
}
.strategy-title {
  min-width: 0;
  font-size: var(--fs-md);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.strategy-pill {
  flex: none;
  padding: 3px var(--s2);
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  font-weight: 650;
}
.strategy-desc {
  margin-top: var(--s1);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-3);
}
.signals {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s3);
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.signals b { color: var(--text-2); font-weight: 650; }
.progress {
  height: 4px;
  margin-top: var(--s3);
  overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--r-full);
}
.progress > div { height: 100%; border-radius: inherit; background: var(--accent); }
.next-step {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.strategy-head { margin-top: var(--s7); }

.milestone {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
.milestone b { color: var(--accent-ink); }
.milestone span { color: var(--text-3); }

.project-card {
  position: relative;
  min-width: 0;
  overflow-wrap: anywhere;
  width: 100%;
  text-align: left;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  color: inherit;
  cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.project-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.project-card h2 {
  margin: var(--s2) 0 var(--s1);
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
}
.project-card p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--text-2);
}
.card-arrow {
  position: absolute;
  right: var(--s5);
  top: var(--s5);
  color: var(--text-3);
  font-size: var(--fs-lg);
}

.project-hero { padding: var(--s5) 0; overflow-wrap: anywhere; }
.project-hero p { color: var(--text-2); line-height: 1.75; }

.idea-card {
  padding: var(--s4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.idea-card p { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; }

/* --------------------------------------------------------------------------
   Files
   -------------------------------------------------------------------------- */
.file-card {
  display: flex;
  align-items: center;
  gap: var(--s4);
  width: 100%;
  margin-bottom: var(--s2);
  padding: var(--s3) var(--s4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: inherit;
  cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.file-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.file-card > span:nth-child(2) { flex: 1; min-width: 0; }
.file-card strong {
  font-size: var(--fs-base);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.file-card small {
  display: block;
  margin-top: var(--s1);
  color: var(--text-3);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.file-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-lg);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--line);
}

textarea.file-editor {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: var(--fs-sm) !important;
  line-height: 1.8;
}

.markdown {
  padding: var(--s4) 0;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.markdown p { white-space: pre-wrap; margin: var(--s1) 0; }
.markdown h1 { font-size: var(--fs-xl); margin: var(--s5) 0 var(--s2); }
.markdown h2 { font-size: var(--fs-lg); margin: var(--s5) 0 var(--s2); }
.markdown h3 { font-size: var(--fs-md); margin: var(--s4) 0 var(--s2); }
.md-bullet { padding-left: var(--s3); }

.version-number {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.3;
}
#buildLabel { margin-top: var(--s2); }
.version-update {
  margin-top: var(--s4);
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.version-update .primary-btn { margin-top: var(--s3); }
.release-note {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.release-note + .release-note { margin-top: var(--s3); }
.release-note summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-size: var(--fs-sm);
  font-weight: 650;
}
.release-items {
  margin: 0;
  padding-left: var(--s5);
}
.release-items li {
  margin: var(--s2) 0;
  padding-left: var(--s1);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.release-items li:first-child { margin-top: 0; }
.release-items li:last-child { margin-bottom: 0; }

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--fs-sm);
  line-height: 1.7;
}

/* --------------------------------------------------------------------------
   Month calendar — a quiet grid, colour only where something happened
   -------------------------------------------------------------------------- */
.month-actions { display: flex; gap: var(--s1); }
.month-actions .secondary-btn { min-width: 40px; padding: 0 var(--s3); }

.month-weekdays,
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }

.month-weekdays {
  margin-top: var(--s4);
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-align: center;
}

.month-grid { gap: 2px; margin-top: var(--s1); }

.month-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 74px;
  overflow: hidden;
  padding: var(--s1);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface);
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.month-day:hover { border-color: var(--line-strong); }
.month-day.blank { background: transparent; cursor: default; }
.month-day b {
  display: block;
  margin-bottom: 2px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.month-day span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-3);
}
.month-day em { font-style: normal; font-size: 10px; color: var(--text-3); }

.month-day.has-completion { background: var(--ok-soft); }
.month-day .day-completed {
  align-self: flex-start;
  padding: 0 4px;
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--ok-ink);
  font-size: 10px;
  font-weight: 700;
}
.month-day .day-time { color: var(--accent-ink); font-weight: 600; }
.month-day .day-created { color: var(--text-3); }

.month-day.important { box-shadow: inset 0 2px 0 var(--accent); }
.month-day.today { background: var(--accent-soft); }
.month-day.today b { color: var(--accent-ink); font-weight: 800; }
.month-day.selected { border-color: var(--accent); box-shadow: var(--ring); }

.calendar-progress {
  margin: var(--s4) 0;
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.calendar-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3);
}
.calendar-metrics span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.calendar-metrics strong {
  font-size: var(--fs-md);
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.calendar-metrics span:first-child strong { color: var(--ok-ink); }
.calendar-progress p {
  margin: var(--s4) 0 0;
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-3);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  margin: var(--s4) 0 0;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.calendar-legend span:first-child { color: var(--ok-ink); }

/* --------------------------------------------------------------------------
   Time tracking
   -------------------------------------------------------------------------- */
.time-date-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin: var(--s4) 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}
.time-date-label input { min-height: var(--tap); }

.time-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow-wrap: anywhere;
  gap: var(--s1);
  margin: var(--s4) 0;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.time-summary strong {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.time-summary span { font-size: var(--fs-sm); color: var(--text-2); }
.time-summary small { font-size: var(--fs-sm); color: var(--text-3); }

.time-entry-card {
  display: flex;
  min-width: 0;
  overflow-wrap: anywhere;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.time-entry-card > div { min-width: 0; flex: 1; }
.time-entry-card > button { flex: none; }
.time-entry-card b { font-size: var(--fs-base); font-weight: 600; }
.time-entry-card p { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-3); }

.time-range { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.task-time-entries { margin: var(--s4) 0; }
.task-time-entries:empty { display: none; }

/* --------------------------------------------------------------------------
   Dialogs & sheets
   -------------------------------------------------------------------------- */
dialog {
  --dialog-pad: var(--s5);
  width: min(560px, calc(100vw - 32px));
  max-height: min(90dvh, 820px);
  padding: var(--dialog-pad);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
dialog::backdrop {
  background: rgba(16, 16, 28, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
dialog h2 { font-size: var(--fs-lg); }
dialog p { font-size: var(--fs-sm); }

dialog label {
  display: block;
  margin: var(--s4) 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}
dialog input:where(:not([type="checkbox"])),
dialog select,
dialog textarea {
  width: 100%;
  margin-top: var(--s2);
  min-height: 42px;
}
dialog textarea { min-height: 110px; }

/* A dialog title and its close button are orientation, not content: they never scroll
   away, and neither does the action that commits the work. */
.sheet-head {
  position: sticky;
  top: calc(var(--dialog-pad, var(--s5)) * -1);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin: calc(var(--dialog-pad, var(--s5)) * -1) calc(var(--dialog-pad, var(--s5)) * -1) var(--s4);
  padding: var(--s3) var(--dialog-pad, var(--s5));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
  margin-top: var(--s5);
}
.sheet-actions button { width: 100%; }
.sheet-actions:has(> button:only-child) { grid-template-columns: 1fr; }

dialog .sheet-actions {
  position: sticky;
  bottom: calc(var(--dialog-pad) * -1);
  z-index: 4;
  margin: var(--s5) calc(var(--dialog-pad) * -1) calc(var(--dialog-pad) * -1);
  padding: var(--s3) var(--dialog-pad) calc(var(--s3) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}


.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(16, 16, 28, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.sheet {
  width: min(560px, 100%);
  max-height: 88dvh;
  overflow: auto;
  padding: var(--s2) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  box-shadow: var(--shadow-lg);
}
.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 0 auto var(--s3);
  border-radius: var(--r-full);
  background: var(--line-strong);
}
.sheet h2 { margin: 0; }
.sheet textarea { font-size: var(--fs-md); }

/* Capture */
.capture-fab {
  position: fixed;
  right: max(var(--gutter), calc((100vw - var(--shell)) / 2 + var(--gutter)));
  bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--text);
  color: var(--bg);
  font-size: 22px;
  box-shadow: var(--shadow-lg);
  transition: transform var(--fast), opacity var(--fast);
}
.capture-fab:hover { opacity: 0.88; }
.capture-fab:active { transform: scale(0.94); }

.recording {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--surface-2);
  border-radius: var(--r-lg);
}
.wave { font-size: 22px; color: var(--accent); letter-spacing: 2px; }
.recording strong { font-size: var(--fs-sm); font-weight: 650; }
.recording span { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }

.capture-result {
  margin-top: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.capture-result b { display: block; margin-bottom: 2px; font-size: var(--fs-base); }

/* Quick add */
.quick-add {
  display: grid;
  gap: var(--s3);
  margin: var(--s4) 0 0;
}
.quick-add input[name="title"] { min-height: 46px; }
.quick-add-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  min-width: 0;
}
.quick-add-options label {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-width: 0;
  margin: 0;
  color: var(--text-3);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.quick-add-options select,
.quick-add-options input[type="date"] {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
}
.quick-add-options .quick-due { margin-left: auto; }
.quick-add-options .task-star { order: 3; width: 34px; height: 34px; font-size: 16px; }
.quick-add-options select.project-tag {
  order: -1;
  max-width: 50%;
  margin-right: auto;
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text-3);
}
.quick-add-options select.project-tag.assigned {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.quick-add-options input[type="date"] { order: 4; flex-basis: 100%; max-width: 100%; }

.quick-status {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.quick-status:empty { display: none; }
.quick-status button { margin-left: var(--s2); }

#addTaskDialog { width: min(460px, calc(100vw - 32px)); }
#addTaskDialog .quick-add-options { order: 1; }
#addTaskDialog button[type="submit"] { order: 2; min-height: 46px; font-size: var(--fs-base); }
#addTaskDialog .quick-status { order: 3; }

/* Task detail */
#taskDetailForm > label:first-of-type { margin-top: 0; }
#taskDetailForm label:where(:not(.check-row)),
#timeEntryForm label,
#eventRecordForm > label,
#eventRecordForm .time-range label,
#timeEntryForm .time-range label {
  display: grid;
  gap: var(--s2);
  margin: var(--s4) 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}
#taskDetailForm input:where(:not([type="checkbox"]):not([type="range"])),
#taskDetailForm textarea,
#timeEntryForm input,
#timeEntryForm select,
#timeEntryForm textarea,
#eventRecordForm textarea {
  width: 100%;
  margin: 0;
  font-weight: 400;
}
#taskDetailForm textarea { min-height: 120px; }
#timeEntryForm textarea,
#eventRecordForm textarea { min-height: 96px; }
#eventRecordForm .time-range input { width: 100%; min-width: 0; }
#eventRecordForm .event-log-toggle {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 500;
}

.detail-block {
  margin: var(--s5) 0;
  padding: var(--s4);
  background: var(--surface-2);
  border-radius: var(--r-lg);
}
.detail-label {
  margin-bottom: var(--s3);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0.02em;
}
.duration-control,
.quick-durations,
.task-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
}
.duration-control input { flex: 1; min-width: 90px; margin: 0; accent-color: var(--accent); }
.duration-control output {
  min-width: 66px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.duration-step,
.quick-durations button,
.task-actions button {
  min-height: var(--tap);
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--fast);
}
.duration-step { width: 34px; padding: 0; }
.duration-step:hover,
.quick-durations button:hover,
.task-actions button:hover { background: var(--line-strong); }
.task-actions button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); outline: 2px solid var(--accent); outline-offset: -2px; }
dialog .check-row { display: flex; align-items: center; gap: var(--s2); }
#taskSaveSummary { color: var(--accent-ink); font-weight: 600; }
.quick-durations { margin-top: var(--s3); }
.quick-durations .secondary-btn { margin-left: auto; min-height: 34px; }
.task-actions .complete-action { background: var(--ok-soft); color: var(--ok-ink); }

.delay-controls { margin-top: var(--s3); }
.delay-controls input { width: 100%; margin-top: var(--s3); }

/* One task, one story: time invested and every postponement on a single rail. */
.detail-total {
  float: right;
  font-weight: 500;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.detail-total:empty { display: none; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s3);
  padding: var(--s3) 0;
}
.timeline-row + .timeline-row { border-top: 1px solid var(--line); }

.timeline-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-3);
  font-size: 12px;
  line-height: 1;
}
.is-time .timeline-mark { background: var(--ok-soft); color: var(--ok-ink); }
.is-delay .timeline-mark { background: var(--warn-soft); color: var(--warn); }

.timeline-body { min-width: 0; }
.timeline-body b {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--text);
}
.timeline-body span {
  display: block;
  margin-top: 1px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.timeline-note {
  margin: var(--s1) 0 0;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.timeline-row .link-btn { align-self: center; }

/* Logging a stretch of time: duration sets the length, start time sets where it sits. */
.log-field {
  display: grid;
  gap: var(--s2);
  margin: var(--s3) 0 0 !important;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}
.log-field input { width: 100%; min-height: 40px; }
.log-range {
  margin: var(--s2) 0 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}
.log-submit { width: 100%; margin-top: var(--s4); }

/* Colour picker */
.field-label {
  margin-bottom: var(--s2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}
.swatch {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--r-full);
  box-shadow: inset 0 0 0 1px rgba(20, 20, 45, 0.06);
  transition: transform var(--fast), border-color var(--fast);
}
.swatch:hover { transform: scale(1.08); }
.swatch.selected {
  border-color: var(--text);
  box-shadow: inset 0 0 0 2px var(--surface);
}
.swatch.color-lavender { background: #a08ae8; }
.swatch.color-indigo { background: #7287dd; }
.swatch.color-sky { background: #5aa7dd; }
.swatch.color-teal { background: #46a8a3; }
.swatch.color-mint { background: #4cb183; }
.swatch.color-sun { background: #dbb13f; }
.swatch.color-peach { background: #e08c5f; }
.swatch.color-rose { background: #dd7188; }
.swatch.color-plum { background: #b96bad; }
.swatch.color-slate { background: #7a8496; }

.hero-color {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s4);
}
.hero-color .field-label { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* A logged entry is a door back into its task, wherever that task now lives. */
.entry-open {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
}
.entry-open:hover { color: var(--accent-ink); }
.entry-open span { color: var(--text-3); }


.event-detail-heading { display: flex; align-items: center; gap: var(--s3); }
.event-detail-heading h3 { flex: 1; min-width: 0; margin: var(--s3) 0; overflow-wrap: anywhere; }
.event-source-description {
  max-height: 140px;
  overflow: auto;
  padding: var(--s3);
  background: var(--surface-2);
  border-radius: var(--r-md);
  white-space: pre-wrap;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.event-source-description:empty { display: none; }
#eventDialog .sheet-actions { grid-template-columns: 1fr; }

details { margin-top: var(--s5); }
summary { cursor: pointer; }

/* --------------------------------------------------------------------------
   Settings drawer
   -------------------------------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(16, 16, 28, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 51;
  display: flex;
  flex-direction: column;
  width: min(400px, 92vw);
  height: 100dvh;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition: transform 260ms var(--ease);
}
.settings-drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: none;
  padding: max(var(--s2), env(safe-area-inset-top)) var(--s4) var(--s2);
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-back {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  margin-left: -8px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font-size: 24px;
  line-height: 1;
}
.drawer-back:hover { background: var(--surface-2); color: var(--text); }

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: var(--s4) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom));
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-panel > h3 {
  margin: var(--s6) 0 var(--s2);
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--text-2);
}

.account-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  background: var(--surface-2);
  border-radius: var(--r-lg);
}
.account-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--r-full);
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-size: var(--fs-md);
  font-weight: 800;
  font-style: italic;
}
.account-id { min-width: 0; }
.profile-name {
  margin: 0 0 2px;
  font-size: var(--fs-sm);
  font-weight: 650;
  word-break: break-all;
}
.account-id .muted { margin: 0; font-size: var(--fs-xs); }

.settings-group-label {
  margin: var(--s5) 0 var(--s2);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.settings-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.settings-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  min-height: 56px;
  padding: var(--s2) var(--s3);
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  transition: background var(--fast);
}
.settings-row + .settings-row { border-top: 1px solid var(--line); }
.settings-row:hover { background: var(--surface-2); }
.row-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-sm);
}
.row-main { min-width: 0; }
.row-main b {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.row-main small {
  display: block;
  margin-top: 1px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.4;
}
.row-arrow { color: var(--text-3); font-size: var(--fs-md); }

.settings-danger {
  width: 100%;
  min-height: var(--tap);
  margin-top: var(--s6);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--danger);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: background var(--fast), border-color var(--fast);
}
.settings-danger:hover { background: var(--danger-soft); border-color: transparent; }

.token-create {
  display: flex;
  gap: var(--s2);
  margin: var(--s3) 0;
}
.token-create input { flex: 1; min-width: 0; }
.token-create button { flex: none; }
#tokenValue {
  min-height: 80px;
  font-family: ui-monospace, monospace;
  font-size: var(--fs-sm) !important;
}

.install-ok { margin: 0; color: var(--ok-ink); font-size: var(--fs-sm); line-height: 1.6; }
.install-steps {
  margin: 0 0 var(--s2);
  padding-left: var(--s5);
  font-size: var(--fs-sm);
  line-height: 1.8;
}
#installState .primary-btn { width: 100%; }
#installState .muted { margin: var(--s2) 0 0; }

.diagnostic-grid {
  display: grid;
  gap: var(--s1);
  margin: var(--s3) 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.diagnostic-grid b { color: var(--text); font-weight: 650; }

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
}

.calendar-list {
  display: grid;
  gap: 2px;
  margin: var(--s2) 0;
  max-height: 220px;
  overflow-y: auto;
}
.calendar-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s1);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.calendar-row:hover { background: var(--surface-2); }
.calendar-row span { overflow-wrap: anywhere; }
.calendar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s3);
}

/* --------------------------------------------------------------------------
   Status: login, sync, toast, skeleton
   -------------------------------------------------------------------------- */
.login-panel {
  max-width: 340px;
  margin: 18vh auto 0;
  text-align: center;
}
.login-panel h1 { font-size: var(--fs-2xl); letter-spacing: -0.03em; }
.login-panel p { margin-top: var(--s3); font-size: var(--fs-sm); color: var(--text-3); }
.login-panel button { width: 100%; margin: var(--s5) 0 var(--s3); min-height: 46px; }

#appMessage {
  margin: 0 0 var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-sm);
}
#workspaceMessage { color: var(--danger); font-size: var(--fs-sm); line-height: 1.6; }

.sync-state {
  margin: 0 0 var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Pull to refresh
   -------------------------------------------------------------------------- */
.pull-refresh {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  margin: 0;
  will-change: height, opacity;
  transition: height 240ms cubic-bezier(0.2, 0, 0, 1),
              opacity 200ms cubic-bezier(0.2, 0, 0, 1),
              margin 240ms cubic-bezier(0.2, 0, 0, 1);
}

.pull-refresh.pulling {
  transition: none !important;
  opacity: 1;
}

.pull-refresh.refreshing,
.pull-refresh.success,
.pull-refresh.error {
  height: 44px;
  opacity: 1;
  margin-bottom: var(--s3);
  transition: height 200ms cubic-bezier(0.2, 0, 0, 1),
              opacity 200ms cubic-bezier(0.2, 0, 0, 1),
              margin 200ms cubic-bezier(0.2, 0, 0, 1);
}

.pull-refresh.settling {
  height: 0 !important;
  opacity: 0 !important;
  margin-bottom: 0 !important;
  transition: height 260ms cubic-bezier(0.2, 0, 0, 1),
              opacity 220ms cubic-bezier(0.2, 0, 0, 1),
              margin 260ms cubic-bezier(0.2, 0, 0, 1) !important;
}

.pull-refresh-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  user-select: none;
  -webkit-user-select: none;
  transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast);
}

.pull-refresh.ready .pull-refresh-pill {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
  transform: scale(1.03);
}

.pull-refresh.refreshing .pull-refresh-pill {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.pull-refresh.success .pull-refresh-pill {
  border-color: var(--ok);
  color: var(--ok-ink);
  background: var(--ok-soft);
}

.pull-refresh.error .pull-refresh-pill {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.pull-refresh-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.pull-refresh-icon-wrap svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pull-refresh-icon {
  transform-origin: center;
  will-change: transform;
}

.pull-refresh.refreshing .pull-refresh-icon {
  animation: pull-spin 0.75s linear infinite;
}

@keyframes pull-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#refreshBtn {
  display: block;
  margin: var(--s7) auto 0;
  padding: var(--s2) var(--s4);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(420px, calc(100vw - 32px));
  padding: var(--s3) var(--s5);
  background: #1d1d26;
  color: #fff;
  border-radius: var(--r-lg);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
}
.toast button {
  margin-left: var(--s3);
  padding: 0;
  border: 0;
  background: none;
  color: #b9aeff;
  font-weight: 600;
  text-decoration: underline;
}

.skeleton {
  height: 64px;
  margin: var(--s4) 0;
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--surface-2), var(--surface), var(--surface-2));
  background-size: 200% 100%;
  animation: loading 1.6s infinite;
}
@keyframes loading { to { background-position: -200% 0; } }

/* --------------------------------------------------------------------------
   Phone. The primary surface: tighter gutters, never smaller targets.
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  :root {
    --gutter: 16px;
    --fs-xl: 22px;
    --fs-2xl: 26px;
  }
  .app-shell { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .today-link { font-size: var(--fs-md); padding: 0 var(--s2); }
  .workspace-nav { gap: 2px; margin-bottom: var(--s4); }
  .workspace-nav button,
  .nav-more summary { font-size: var(--fs-sm); padding: 0 var(--s1); }
  .task-card { padding: 10px var(--s3); gap: 2px var(--s2); }
  .task-swipe.important .task-card { padding-left: calc(var(--s3) - 3px); }
  .today-metrics { gap: var(--s5); }
  .month-day { min-height: 62px; padding: 3px; }
  .month-day span:not([class]) { display: none; }
  .month-grid { gap: 2px; }
  .time-range { grid-template-columns: 1fr; }
  dialog { --dialog-pad: var(--s4); border-radius: var(--r-xl); }
  .drawer-body { padding-left: var(--s4); padding-right: var(--s4); }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
  .event-when { min-width: 72px; font-size: var(--fs-xs); }
  .gap-card { padding-left: calc(72px + var(--s4) + var(--s3)); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Miracle Projects: compact controls, cards, and a dedicated issue page. */
#miracleProjectsContent{max-width:760px}.mp-compact-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:4px 0 10px}.mp-heading-actions{display:flex;gap:4px;flex:none}.mp-icon,.mp-add{height:40px;width:40px;display:grid;place-items:center;border:0;border-radius:var(--r-md);font-size:23px;cursor:pointer}.mp-icon{background:transparent;color:var(--text-2)}.mp-add{background:var(--accent-soft);color:var(--accent-ink)}.mp-view-switch{display:flex;gap:2px;padding:3px;border-radius:var(--r-full);background:var(--surface-3)}.mp-view-switch button{padding:7px 12px;border:0;border-radius:var(--r-full);background:transparent;font:inherit;font-size:var(--fs-sm);font-weight:500;color:var(--text-2);cursor:pointer;min-height:34px}.mp-view-switch button[aria-pressed=true]{background:var(--surface);color:var(--accent-ink);box-shadow:0 1px 3px #0000000b}.mp-compact-filters{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:18px}.mp-chip-select{max-width:100%;min-width:0;min-height:32px;border:1px solid var(--line);border-radius:var(--r-full);background:var(--surface);color:var(--text-2);padding:4px 26px 4px 12px;font:inherit;font-size:var(--fs-sm);width:auto;cursor:pointer}
.mp-milestone-list,.mp-issue-list{display:grid;gap:12px}.mp-milestone,.mp-issue-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:18px;color:var(--text);box-shadow:0 2px 8px #00000003}.mp-milestone{display:block;width:100%;text-align:left;font:inherit;cursor:pointer}.mp-milestone:hover{border-color:var(--line-strong)}.mp-title{font-size:var(--fs-md);font-weight:600;display:flex;justify-content:space-between;gap:12px;line-height:1.5}.mp-title>span{color:var(--text-3);flex:none}.mp-tags{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:10px}.mp-tag{display:inline-flex;align-items:center;border-radius:var(--r-full);padding:3px 9px;background:var(--surface-2);color:var(--text-2);font-size:12px;line-height:1.5;overflow-wrap:anywhere;max-width:100%}.mp-tag-owner{background:var(--accent-soft);color:var(--accent-ink)}.mp-tag-critical{background:var(--danger-soft);color:var(--danger);font-weight:600}.mp-tag-priority{background:var(--warn-soft);color:var(--warn)}.mp-tag-done{background:var(--ok-soft);color:var(--ok-ink)}.mp-track{height:4px;background:var(--surface-3);border-radius:4px;margin:18px 0 8px;overflow:hidden}.mp-track span{height:100%;display:block;background:var(--accent)}.mp-progress-label{display:flex;justify-content:space-between;font-size:var(--fs-sm);color:var(--text-2)}.mp-meta,.mp-empty{font-size:var(--fs-sm);color:var(--text-2)}.mp-week-card{margin-top:12px}.mp-foot{margin-top:20px;color:var(--text-3);font-size:12px}.mp-empty{padding:18px 0}
body:has([data-page="miracle"].active .mp-detail-view) .workspace-nav,body:has([data-page="miracle"].active .mp-detail-view) .topbar,body:has([data-page="miracle"].active .mp-detail-view) #captureBtn{display:none}body:has([data-page="miracle"].active .mp-detail-view) .app-shell{padding-top:env(safe-area-inset-top)}.mp-detail-header{display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:var(--bg);padding:12px 0;z-index:5}.mp-back{border:0;background:transparent;color:var(--accent-ink);font:inherit;font-size:14px;padding:8px 0;cursor:pointer}.mp-detail-title{padding:8px 0 22px}.mp-detail-title h1{font-size:var(--fs-lg);line-height:1.5;margin:6px 0 0}.mp-repo-label{font-size:12px;color:var(--text-2)}.mp-detail-title .mp-chip-select{font-size:12px;min-height:26px}.mp-card-head{display:flex;gap:10px;align-items:flex-start;justify-content:space-between}.mp-card-head h2{font-size:var(--fs-md);line-height:1.5;margin:0;font-weight:600;min-width:0;overflow-wrap:anywhere}.mp-external{color:var(--text-3);width:32px;height:32px;display:grid;place-items:center;flex:none;border-radius:var(--r-sm);text-decoration:none}.mp-external:hover{color:var(--accent-ink);background:var(--accent-soft)}.mp-external svg{width:18px;height:18px}.mp-markdown{font-size:14px;line-height:1.65;color:var(--text-2);margin-top:16px;padding-top:14px;border-top:1px solid var(--line);max-height:240px;overflow:hidden;overflow-wrap:anywhere}.mp-markdown.mp-preview-clipped{mask-image:linear-gradient(to bottom,#000 85%,transparent)}.mp-markdown>:first-child{margin-top:0}.mp-markdown h1,.mp-markdown h2,.mp-markdown h3,.mp-markdown h4{font-size:14px;margin:14px 0 6px;color:var(--text);font-weight:600}.mp-markdown p{margin:8px 0}.mp-markdown ul,.mp-markdown ol{padding-left:20px;margin:8px 0}.mp-markdown pre{max-width:100%;overflow:auto;background:var(--surface-2);padding:10px;border-radius:var(--r-sm);font-size:12px}.mp-markdown code{font-size:12px;background:var(--surface-2);border-radius:3px;padding:1px 3px}.mp-markdown table{display:block;max-width:100%;overflow-x:auto;border-collapse:collapse;font-size:13px}.mp-markdown th,.mp-markdown td{padding:6px;border:1px solid var(--line)}.mp-markdown blockquote{border-left:3px solid var(--line-strong);padding-left:12px;margin:10px 0}.mp-markdown input{width:13px;height:13px;margin:0 5px 0 0;display:inline-block;vertical-align:middle}.mp-preview-note{font-size:12px;color:var(--text-3);margin:6px 0 0}
.mp-connection{background:var(--surface-2);border-radius:var(--r-md);padding:16px;margin-bottom:12px;font-weight:500}.mp-settings-add{grid-template-columns:minmax(0,1fr) auto;margin:24px 0 8px;border-top:1px solid var(--line)}#mpTokenForm{margin:16px 0}#mpTokenForm label,#mpAddForm label{display:flex;flex-direction:column;gap:8px;font-size:var(--fs-sm);color:var(--text-2)}#mpTokenForm input,#mpAddForm input{width:100%;font-size:16px}#mpTokenForm button,#mpAddForm button{margin-top:12px}#mpProjectDialog{width:min(460px,calc(100% - 32px))}#mpTokenMessage:empty,#mpAddMessage:empty{display:none}

.today-all-tasks{margin-left:auto;white-space:nowrap}
