/* ============================================================================
   Orderly on the web
   ----------------------------------------------------------------------------
   Every colour, radius, size and shadow below is lifted from the app, and the
   comment beside it says where from. The rule is that a row here and a row in
   the app are the same row — so when a number looks arbitrary, it is the app's
   number and the Swift is the place to change it.

   Theme-aware: the tokens mirror Theme.swift's light and dark columns.
   ========================================================================== */

/* ---------- Type ---------------------------------------------------------- */

@font-face { font-family: "DM Sans"; src: url("/fonts/DMSans-Regular.woff2")   format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fonts/DMSans-Medium.woff2")    format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fonts/DMSans-SemiBold.woff2")  format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fonts/DMSans-Bold.woff2")      format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fonts/DMSans-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

/* ---------- Tokens — Theme.swift ------------------------------------------ */

:root {
  color-scheme: light;

  --bg: #fff6ee;
  --surface: #ffffff;
  --ink: #1f1b17;
  --muted: #8a7f72;
  --muted-light: #bcae9d;
  --accent: #e0533d;
  --on-accent: #ffffff;
  --card-shadow: rgba(236, 224, 211, .9);
  --chip-border: #ebdfd1;
  --chip-bg: #fffaf5;
  --cell-today: #f6ebe0;
  --cell-dim: #dfd3c4;
  --dashed-border: #ddd0c1;
  --nav-inactive: #c4b6a6;
  --all-category: #8a8d93;
  --empty-text: #c9bcab;
  --box-border: #f0e5d9;
  --fallback-cat: #999999;
  --canvas: #3b6e8f;

  --urgent: #c23a2b;
  --important: #2f6bc0;
  --delegated: #c08a2f;
  --neutral: #8a8f98;

  /* accent at 14%, the Mac sidebar's selected row */
  --sidebar-sel: rgba(240, 106, 85, .14);

  /* The app's one shadow: hard, no blur, 3pt down. */
  --lift: 0 3px 0 var(--card-shadow);
  --lift-2: 0 2px 0 var(--card-shadow);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #14110f;
  --surface: #201b18;
  --ink: #f6efe8;
  --muted: #b8aa9d;
  --muted-light: #85786c;
  --accent: #f06a55;
  --card-shadow: rgba(11, 9, 8, .9);
  --chip-border: #3b322d;
  --chip-bg: #251f1b;
  --cell-today: #332720;
  --cell-dim: #665b51;
  --dashed-border: #554a41;
  --nav-inactive: #76695e;
  --all-category: #a7abb3;
  --empty-text: #7a6d62;
  --box-border: #3f352f;
  --fallback-cat: #b0b0b0;
  --canvas: #7fb4d4;

  --urgent: #f05b49;
  --important: #6fa1f0;
  --delegated: #e0ad54;
  --neutral: #a8adb7;

  --sidebar-sel: rgba(240, 106, 85, .14);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

html { background: var(--bg); }

button { font-family: inherit; cursor: pointer; }

svg {
  width: 1em; height: 1em;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
svg.fill, svg .fill { fill: currentColor; stroke: none; }

/* ---------- Sign-in gate -------------------------------------------------- */

.gate {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px;
}
.gate[hidden] { display: none; }

.gate__card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--lift);
  padding: 34px 28px;
  text-align: center;
}
.gate__card img { width: 64px; height: 64px; border-radius: 15px; }
.gate__card h1 { font-size: 24px; font-weight: 800; margin: 16px 0 8px; }
.gate__card p { font-size: 14px; font-weight: 500; color: var(--muted); margin: 0 0 22px; line-height: 1.5; }

.applebtn {
  width: 100%; height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--ink); color: var(--bg);
  border: 0; border-radius: 14px;
  font-size: 16px; font-weight: 700;
}
.applebtn svg { width: 19px; height: 19px; }
.gate__err { color: var(--urgent); font-size: 13px; font-weight: 600; margin: 14px 0 0; }

/* ---------- Task row — TaskRowView.swift ---------------------------------- */

.task {
  position: relative;
  background: var(--surface);
  border-radius: 18px;              /* cornerRadius: 18 */
  box-shadow: var(--lift);
  padding: 15px 15px 15px 24px;     /* vertical 15, leading 24 with the stripe */
}
.task--nostripe { padding-left: 15px; }

/* RoundedRectangle(4).frame(width: 7).padding(.leading, 8).padding(.vertical, 12) */
.task__stripe {
  position: absolute;
  left: 8px; top: 12px; bottom: 12px;
  width: 7px; border-radius: 4px;
  box-shadow: 0 3px 0 rgba(11, 9, 8, .8);
}

.task__row {
  display: flex; align-items: flex-start; gap: 13px;   /* HStack(alignment:.top, spacing:13) */
  width: 100%;
  background: none; border: 0; padding: 0;
  text-align: left; color: inherit;
}
.task--live .task__row { cursor: pointer; }

.task__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }

.task__title {
  font-size: 15px; font-weight: 700;                   /* dmSans(15, .bold) */
  color: var(--ink);
  line-height: 1.28;
  overflow-wrap: anywhere;
}
/* Text styling can't animate in SwiftUI, so the app lands the strikethrough and
   the checkbox fill on the same frame by animating neither. Any transition here
   reintroduces exactly the lag TaskRowView.toggleDone was written to remove. */
.task[data-done="true"] .task__title {
  color: var(--muted-light);
  text-decoration: line-through;
}

.task__meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 11.5px; font-weight: 700;                 /* dmSans(11.5, .bold) */
  color: var(--muted);
}
.task__meta .sep { color: var(--dashed-border); }
.task__meta .when { font-weight: 600; }                /* dmSans(11.5, .semibold) */
.task__meta .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.task__meta .course { display: inline-flex; align-items: center; gap: 5px; }
.task__meta .course svg { width: 11px; height: 11px; }

/* TaskCheckboxGlyph.swift — 21pt box, radius 9, 1.6pt border, 10pt tick. */
.check {
  flex: none;
  width: 21px; height: 21px;
  margin-top: 1px;                                     /* .padding(.top, scale) */
  display: grid; place-items: center;
  background: transparent;
  border: 1.6px solid var(--dashed-border);
  border-radius: 9px;
  padding: 0;
  color: transparent;
  transition: none;                                    /* deliberately unanimated */
}
.check svg { width: 12px; height: 12px; stroke-width: 3; }
.task[data-done="true"] .check {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
}
.check:disabled { cursor: default; opacity: .55; }

.task__del {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 9px;
  color: var(--muted-light);
  opacity: 0; transition: opacity .12s ease;
}
.task__del svg { width: 15px; height: 15px; }
.task:hover .task__del, .task__del:focus-visible { opacity: 1; }
.task__del:hover { color: var(--urgent); background: rgba(240, 91, 73, .1); }

/* ---------- Category chips — CategoryChip.swift --------------------------- */

.chips {
  display: flex; gap: 7px;                             /* HStack(spacing: 7) */
  padding: 0 22px 14px;                                /* .padding(.horizontal,22) + .padding(.bottom,14) */
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--muted);
  font-size: 13px; font-weight: 700;                   /* dmSans(13, .bold) */
  white-space: nowrap;
}
.chip__n { font-size: 10.5px; font-weight: 700; opacity: .65; }
.chip[aria-pressed="true"] {
  background: var(--chip-color);
  border-color: var(--chip-color);
  color: var(--on-accent);
}
.chip svg { width: 11px; height: 11px; opacity: .75; }

/* ---------- Section header (phone + Mac share the type) ------------------- */

.head { padding: calc(6px + env(safe-area-inset-top)) 22px 14px; }
.head__title { font-size: 29px; font-weight: 800; color: var(--ink); margin: 0; line-height: 1.1; }
.head__sub { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 4px 0 0; }

/* ---------- Completed section --------------------------------------------- */

.done-head { display: flex; align-items: flex-start; gap: 8px; min-height: 30px; }
.done-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 0;
  color: var(--ink);
  font-size: 14px; font-weight: 700;                   /* dmSans(14, .bold) */
}
.done-toggle svg { width: 12px; height: 12px; stroke-width: 3; }
.done-toggle .n { font-size: 12px; font-weight: 700; color: var(--muted); }

.clear-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(240, 91, 73, .08);
  border: 1px solid rgba(240, 91, 73, .18);
  color: var(--urgent);
  font-size: 12px; font-weight: 700;
}
.clear-btn svg { width: 12px; height: 12px; }

.done-section { display: flex; flex-direction: column; gap: 10px; padding-top: 7px; }
.done-list { display: flex; flex-direction: column; gap: 10px; }
.mac .done-list { gap: 8px; }

/* ---------- Quick add — IOSTaskListView.addTaskRow ------------------------ */

/* HStack(spacing:10).padding(.horizontal,15).padding(.vertical,14) on a
   surface card with the same 18pt radius and lift as a task row. */
.addrow {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 15px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--lift);
}
.addrow input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  color: var(--ink);
  font-family: inherit; font-size: 15px; font-weight: 600;
}
.addrow input::placeholder { color: var(--muted-light); }

/* ---------- Matrix — IOSMatrixView + QuadrantBoxView ---------------------- */

/* IOSMatrixView sizes its cells off the available space — two equal rows
   filling what is left under the chips, with the instruction line below. The
   boxes scroll internally; the screen itself does not. */
.matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;                                           /* gridSpacing */
  padding: 5px 18px 0;                                 /* gridTopPadding + horizontalPadding */
}
.phone__body--fill { overflow: hidden; display: flex; flex-direction: column; }
.phone__body--fill .matrix { flex: 1; min-height: 0; grid-template-rows: 1fr 1fr; }
.phone__body--fill .matrix-note { flex: none; }

.quad {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 0;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--box-border);
  border-radius: 18px;
  box-shadow: var(--lift);
}
/* RoundedRectangle(2).fill(quadrant.color).frame(height:4).padding(.horizontal,14) */
.quad__rail {
  position: absolute; top: 0; left: 14px; right: 14px;
  height: 4px; border-radius: 2px;
}
.quad__head {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 11px;
}
.quad__name { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.quad__n { margin-left: auto; font-size: 15px; font-weight: 800; color: var(--ink); }

.quad__list { display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 0; }
.quad__empty { font-size: 12px; font-weight: 600; color: var(--empty-text); }

.mini {
  position: relative;
  display: block;
  width: 100%;
  padding: 7px 8px 7px 11px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--lift-2);
  font-size: 11px; font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  text-align: left;
  border: 0;
}
/* The clamp lives on an inner span: -webkit-box on the <button> itself does not
   clamp reliably, and the absolutely-positioned rail confuses the line count. */
.mini__text {
  display: -webkit-box;
  -webkit-line-clamp: 2;                               /* .lineLimit(2) */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mini__rail { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 2px; }
.mini[data-done="true"] { color: var(--muted-light); text-decoration: line-through; }

.matrix-note {
  font-size: 12px; font-weight: 600;
  color: var(--muted-light);
  padding: 0 22px;
  min-height: 58px;                                    /* instructionHeight */
  display: flex; align-items: center;
}

/* ---------- Calendar — IOSCalendarView ------------------------------------ */

.cal-bar { display: flex; align-items: center; gap: 10px; padding: 0 22px 14px; }
.cal-nav {
  flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 0;
  color: var(--ink);
  box-shadow: var(--lift-2);
}
.cal-nav svg { width: 15px; height: 15px; stroke-width: 2.6; }
.cal-month {
  flex: 1;
  height: 38px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--surface); border: 0;
  color: var(--ink);
  font-size: 16px; font-weight: 700;
  box-shadow: var(--lift-2);
}
.cal-month svg { width: 10px; height: 10px; color: var(--muted); stroke-width: 3; }

.cal-card {
  margin: 0 18px 16px;
  padding: 12px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--lift);
}
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { margin-bottom: 7px; }
.cal-dow span { text-align: center; font-size: 10px; font-weight: 800; color: var(--muted); }
.cal-grid { gap: 3px; }

.cal-day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 3px 0;
  background: none; border: 0;
}
.cal-day__n {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink);
}
.cal-day[data-dim="true"] .cal-day__n { color: var(--cell-dim); }
.cal-day[data-today="true"] .cal-day__n { font-weight: 800; background: var(--cell-today); }
.cal-day[aria-selected="true"] .cal-day__n { background: var(--accent); color: var(--on-accent); }
.cal-day__dots { display: flex; gap: 2.5px; height: 4px; }
.cal-day__dots i { width: 4px; height: 4px; border-radius: 50%; }

.agenda { padding: 0 22px 24px; display: flex; flex-direction: column; gap: 9px; }
.agenda__head {
  font-size: 11px; font-weight: 800;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted);
}
.agenda__empty { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- Phone shell — IOSRootView ------------------------------------- */

/* Height, not min-height: the tab bar is pinned and the content scrolls under
   it, the way a TabView behaves. With min-height the column grows instead, the
   document scrolls, and the last rows end up beneath the bar. */
.phone { display: flex; flex-direction: column; height: 100dvh; }

/* The floating buttons IOSRootView overlays on the top trailing corner. */
.phone__tools {
  position: fixed; right: 0; z-index: 30;
  top: env(safe-area-inset-top);
  display: flex; gap: 10px;
  padding: 6px 16px 0;
}
.toolcircle {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 0;
  color: var(--ink);
  box-shadow: var(--lift);
}
.toolcircle svg { width: 16px; height: 16px; stroke-width: 2.4; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }

/* min-height:0 is what actually lets a flex child scroll — without it the child
   is floored at its content height and the scroll escapes to the document. */
.phone__body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 21px; }
.phone__list { display: flex; flex-direction: column; gap: 10px; padding: 0 22px; }

.tabbar {
  flex: none;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--chip-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0 5px;
  background: none; border: 0;
  color: var(--nav-inactive);
  font-size: 10px; font-weight: 600;
}
.tab svg { width: 23px; height: 23px; }
.tab[aria-selected="true"] { color: var(--accent); }

/* ---------- Mac shell — MacOSRootView ------------------------------------- */

.mac { display: grid; grid-template-columns: 220px 1fr; min-height: 100dvh; }

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--chip-border);
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
}
.sidebar__label {
  font-size: 11px; font-weight: 700;
  color: var(--muted-light);
  padding: 12px 10px 4px;
}
.side-row {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px 10px;
  background: none; border: 0; border-radius: 7px;
  color: var(--ink);
  font-size: 13px; font-weight: 500;
  text-align: left;
}
.side-row:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.side-row[aria-selected="true"] { background: var(--sidebar-sel); }
.side-row svg { width: 15px; height: 15px; color: var(--muted); }
.side-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.side-row .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.side-row .people { width: 11px; height: 11px; }

.detail { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.detail__bar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--chip-border);
}
.detail__title { font-size: 17px; font-weight: 700; margin: 0; }
.detail__sub { font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 2px 0 0; }
.detail__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.detail__who { font-size: 12px; font-weight: 500; color: var(--muted); }
.toolbtn {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center;
  background: none; border: 0; color: var(--ink);
}
.toolbtn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.toolbtn svg { width: 16px; height: 16px; }

.detail__body { flex: 1; overflow-y: auto; }
/* MacTaskListView: LazyVStack(spacing: 8).padding(20).frame(maxWidth: 640) */
.mac__list { display: flex; flex-direction: column; gap: 8px; padding: 20px; width: min(100%, 680px); margin: 0 auto; }

.quickadd {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--chip-border);
  border-radius: 12px;
}
.quickadd svg { width: 16px; height: 16px; color: var(--muted); }
.quickadd input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 500;
}
.quickadd input::placeholder { color: var(--muted-light); }

.prio {
  padding: 5px 10px; border-radius: 999px;
  background: none;
  border: 1px solid var(--chip-border);
  color: var(--muted);
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}
.prio[aria-pressed="true"] { background: var(--prio-color); border-color: var(--prio-color); color: var(--on-accent); }

.mac__empty { font-size: 12.5px; font-weight: 500; color: var(--muted); padding-top: 20px; }

.mac .matrix { padding: 20px; width: min(100%, 940px); margin: 0 auto; }
.mac .quad { min-height: 210px; }
.mac .matrix-note { width: min(100%, 940px); margin: 0 auto; padding: 0 20px; }
.mac .cal-card, .mac .agenda, .mac .cal-bar { max-width: 660px; }
.mac .cal-bar { padding: 20px 20px 14px; }
.mac .cal-card { margin: 0 20px 16px; }
.mac .agenda { padding: 0 20px 24px; }

/* ---------- Mac calendar — MacCalendarView -------------------------------- */

.mac-cal {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.mac-cal__header {
  flex: none;
  padding: 16px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mac-cal__top, .mac-cal__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mac-cal__title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}
.mac-cal__spacer { flex: 1; }
.scope {
  display: inline-flex;
  padding: 2px;
  border-radius: 7px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
}
.scope button {
  width: 58px;
  height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.scope button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}
.mac-cal__today,
.mac-cal__step,
.mac-cal__date {
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.mac-cal__today { padding: 0 12px; }
.mac-cal__step {
  width: 30px;
  display: grid;
  place-items: center;
}
.mac-cal__step svg { width: 11px; height: 11px; stroke-width: 3; }
.mac-cal__date {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.mac-cal__date svg { width: 9px; height: 9px; color: var(--muted); stroke-width: 3; }
.mac-cal__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mac-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--chip-border);
}
.mac-weekdays span {
  padding: 8px 0;
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .6px;
  color: var(--muted);
}
.mac-month-rows {
  flex: 1;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}
.mac-month-row {
  position: relative;
  flex: 1;
  min-height: 96px;
}
.mac-month-row__cells {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.mac-day-cell {
  position: relative;
  appearance: none;
  display: block;
  min-height: 96px;
  height: 100%;
  padding: 0;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--chip-border);
  border-bottom: 1px solid var(--chip-border);
  border-radius: 0;
  color: inherit;
  text-align: left;
  font-family: inherit;
  cursor: default;
}
.mac-day-cell[aria-selected="true"] {
  background: color-mix(in srgb, var(--cell-today) 60%, transparent);
}
.mac-day-cell__n {
  position: absolute;
  top: 4px;
  left: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
}
.mac-day-cell[data-dim="true"] .mac-day-cell__n { color: var(--cell-dim); }
.mac-day-cell[data-today="true"] .mac-day-cell__n {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}
.mac-chip {
  width: 100%;
  height: 16px;
  padding: 0 5px;
  border: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--quad) 18%, transparent);
  color: var(--quad);
  font-size: 10.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mac-segment-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mac-segment-layer .mac-chip {
  position: absolute;
  width: auto;
  pointer-events: auto;
}
.mac-chip--segment {
  border-radius: 4px;
}
.mac-chip--continue-before {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.mac-chip--continue-after {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.mac-chip[data-done="true"] {
  color: var(--muted-light);
  text-decoration: line-through;
  background: color-mix(in srgb, var(--muted-light) 8%, transparent);
}
.mac-more {
  position: absolute;
  height: 16px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
}
.mac-week {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.mac-week-col {
  appearance: none;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--chip-border);
  border-radius: 0;
  background: var(--surface);
  color: inherit;
  font-family: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
}
.mac-week-col[aria-selected="true"] { background: color-mix(in srgb, var(--cell-today) 60%, transparent); }
.mac-week-col__head {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--chip-border);
}
.mac-week-col__dow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .6px;
  color: var(--muted);
}
.mac-week-col[data-today="true"] .mac-week-col__dow { color: var(--accent); }
.mac-week-col__num {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}
.mac-week-col[data-today="true"] .mac-week-col__num {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}
.mac-week-col__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mac-week-empty {
  color: var(--cell-dim);
  text-align: center;
  padding-top: 12px;
  font-size: 11px;
}
.mac-day-view {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}
.mac-day-view__inner {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 4px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mac-day-view__heading {
  padding-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.mac-day-view__empty {
  display: grid;
  place-items: center;
  padding-top: 60px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Strips, toast, sheet ------------------------------------------ */

.strips { display: flex; flex-direction: column; gap: 8px; padding: 0 22px 12px; }
.mac .strips { padding: 16px 20px 0; max-width: 660px; }

.strip {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--muted);
  line-height: 1.45;
}
.strip svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--canvas); }
.strip b { color: var(--ink); font-weight: 700; }
.strip--warn { border-color: rgba(224, 173, 84, .3); }
.strip--warn svg { color: var(--delegated); }

.empty { text-align: center; padding: 48px 22px; color: var(--muted); font-size: 13.5px; font-weight: 500; line-height: 1.6; }
.empty strong { display: block; font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }

.skeleton {
  height: 68px; margin: 0 22px 10px;
  border-radius: 18px;
  background: var(--surface);
  opacity: .5;
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .22; } }

.toast {
  position: fixed; left: 50%; bottom: 84px; z-index: 60;
  transform: translate(-50%, 12px);
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--chip-border);
  border-radius: 12px;
  box-shadow: var(--lift);
  font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  max-width: calc(100vw - 32px);
}
.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { border-color: rgba(240, 91, 73, .4); color: var(--urgent); }

.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .5);
  display: grid; place-items: end center;
  padding: 0;
}
@media (min-width: 768px) { .scrim { place-items: center; padding: 24px; } }

.sheet {
  width: min(520px, 100%);
  max-height: 88dvh; overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 32px 32px 0 0;
  padding: 26px 24px calc(26px + env(safe-area-inset-bottom));
  animation: rise .24s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 768px) { .sheet { border-radius: 20px; animation: none; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

.sheet__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.sheet__title { font-size: 29px; line-height: 1.1; font-weight: 800; }
.sheet__sub { margin-top: 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
  margin-left: auto;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 0;
  color: var(--ink);
  box-shadow: var(--lift);
}
.iconbtn svg { width: 15px; height: 15px; }
.sheet__content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.sheet__content::-webkit-scrollbar { display: none; }

.field { margin-bottom: 16px; }
.field__label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted-light);
  margin-bottom: 10px;
}
.field__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--chip-border);
  border-radius: 12px;
  color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 600;
}
.field input:disabled { color: var(--muted); }

.seg, .wd { display: flex; flex-wrap: wrap; gap: 7px; }
.seg button, .wd button {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px; font-weight: 700;
}
.wd button { width: 38px; padding: 8px 0; text-align: center; }
.seg button[aria-pressed="true"] { background: var(--seg); border-color: var(--seg); color: var(--on-accent); }
.wd button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.title-card {
  position: relative;
  margin-bottom: 18px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--lift);
}
.title-card::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 14px;
  bottom: 14px;
  width: 7px;
  border-radius: 4px;
  background: var(--stripe, var(--dashed-border));
}
.title-card input {
  width: 100%;
  min-height: 60px;
  padding: 18px 16px 18px 24px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  outline: 0;
}
.form-chip-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}
.form-chip-row::-webkit-scrollbar { display: none; }
.form-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.form-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--chip-color); }
.form-chip[aria-pressed="true"] {
  background: var(--chip-color);
  border-color: var(--chip-color);
  color: var(--on-accent);
}
.form-chip[aria-pressed="true"] i { background: var(--on-accent); }
.priority-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.priority-tile {
  position: relative;
  min-height: 62px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px 12px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--box-border);
  color: var(--muted);
  box-shadow: var(--lift);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-align: left;
}
.priority-tile::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 4px;
  border-radius: 2px;
  background: var(--seg);
  opacity: .35;
}
.priority-tile[aria-pressed="true"] {
  color: var(--ink);
  border: 2px solid var(--seg);
  background: color-mix(in srgb, var(--seg) 8%, var(--surface));
}
.priority-tile[aria-pressed="true"]::before { opacity: 1; }
.schedule-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--lift);
  overflow: hidden;
}
.schedule-card .field {
  margin: 0;
  padding: 13px 15px;
  border-top: 1px solid var(--chip-border);
}
.schedule-card .field:first-child { border-top: 0; }
.schedule-card .field__label {
  margin-bottom: 8px;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
  font-size: 14px;
}
.sheet__actions { flex: none; display: flex; gap: 12px; margin-top: 16px; }
.sheet__actions button {
  flex: 1; height: 64px;
  border: 0; border-radius: 24px;
  font-size: 17px; font-weight: 700;
  background: var(--accent); color: var(--on-accent);
}
.sheet__actions .ghost { background: var(--chip-bg); color: var(--ink); height: 62px; border-radius: 23px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
