/* DaySquare — Graphite */
:root {
  --bg: #0E1013;
  --surface: #16191E;
  --surface-2: #1F232A;
  --line: #262A31;
  --text: #ECEEF1;
  --muted: #9BA3AF;
  --faint: #6B7280;
  --amber: #FFB43A;
  --amber-on-photo: #FFDDA6;
  --danger: #FF7A7A;
  --done: #6CC24A;
  --radius: 12px;
  --tabbar-h: 64px;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 15px/1.4 var(--sans); -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: 400 16px/1.3 var(--sans); color: var(--text); } /* 16px stops iPhone zoom */
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--amber) !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Sign in ---------- */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.signin-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.signin-card img { border-radius: 15px; margin-bottom: 4px; }
.signin-card h1 { margin: 0 0 12px; font-size: 26px; letter-spacing: -0.02em; }
.signin-card form { display: flex; flex-direction: column; gap: 8px; }
.signin-card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.fine { font-size: 13px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 14px; margin: 4px 0; }
.form-note { color: var(--text); font-size: 14px; margin: 4px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.link-btn { align-self: center; height: 44px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 500; }
.link-btn:hover { color: var(--text); }
.signin-card input { height: 46px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); padding: 0 14px; }

/* ---------- Header with the desk photo ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 16px 20px;
}
/* The photo: blurred and darkened so text always stays readable.
   Drop a desk photo at assets/desk.jpg; without one, a warm dark backdrop shows. */
.hero::before {
  content: ""; position: absolute; inset: -30px; z-index: -2;
  background:
    radial-gradient(120% 90% at 92% 0%, rgba(255, 181, 71, 0.22), transparent 60%),
    url("assets/desk.jpg") center / cover no-repeat,
    #1C1814;
  filter: blur(14px) brightness(0.35) saturate(0.9);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(14,16,19,0.6) 0%, rgba(14,16,19,0.78) 60%, var(--bg) 100%);
}
.hero-bar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
.brand img { border-radius: 7px; }
.screen-title { margin: 8px 0 2px; font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
/* greeting: fades in where the day name sits, holds about two seconds, then fades into the day name */
@keyframes greetIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.screen-title { transition: opacity 0.4s ease; overflow-wrap: anywhere; }
.screen-title.greeting { animation: greetIn 0.45s ease; }
.screen-title.fading { opacity: 0; }
.screen-meta { margin: 2px 0 0; font: 500 15px/1.4 var(--sans); color: #E2E5E9; font-variant-numeric: tabular-nums; letter-spacing: -0.005em; }
.screen-meta .od { color: var(--amber-on-photo); }

.icon-btn {
  width: 44px; height: 44px; border: 0; background: none; color: #E2E5E9;
  display: grid; place-items: center; border-radius: 12px;
}

main { padding: 0 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px); }

/* ---------- Date strip ---------- */
.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 4px 0 12px; }
.day {
  height: 54px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0;
}
.day .dw { font-size: 11px; color: var(--muted); }
.day .dn { font: 600 17px/1 var(--sans); font-variant-numeric: tabular-nums; }
.day[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #0E1013; }
.day[aria-pressed="true"] .dw { color: #0E1013; font-weight: 600; }
.day .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.day[aria-pressed="true"] .dot { background: #0E1013; }

/* ---------- Quick add & search ---------- */
.quick-add { display: flex; gap: 8px; margin-bottom: 14px; }
.quick-add input, .search input, .field input, .field textarea, .field select {
  flex: 1; min-width: 0; height: 46px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); padding: 0 14px;
}
.add-btn {
  width: 46px; height: 46px; flex: none; border-radius: var(--radius); border: 0;
  background: var(--text); color: var(--bg); display: grid; place-items: center;
}
.search { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; padding-left: 14px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.search input { border: 0; background: none; padding: 0 14px 0 0; }

/* ---------- Lists & rows ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row {
  position: relative; border-radius: var(--radius); overflow: hidden;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.row input { -webkit-user-select: text; user-select: text; }
.swipe-under {
  position: absolute; inset: 1px; display: flex; justify-content: flex-end; align-items: stretch;
  background: var(--amber); border-radius: var(--radius);
}
.row.virtual .swipe-under, .row.series .swipe-under, .row:has(.subs) .swipe-under { display: none; }
.sw-b { display: none; }
.row.full .sw-a { display: none; }
.row.full .sw-b { display: inline; }
.swipe-btn {
  width: 104px; border: 0; background: none; color: #0E1013; font-weight: 700; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.row.full .swipe-btn { width: 100%; }
.row-main {
  position: relative; display: flex; align-items: flex-start; gap: 4px; padding: 4px 0 6px 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  touch-action: pan-y; transition: transform 0.2s ease;
}
.row.swiping .row-main { transition: none; }
.row.virtual .row-main { background: transparent; border-style: dashed; }
.check, .more {
  flex: none; width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; color: var(--muted);
}
.check > span { display: block; width: 20px; height: 20px; border: 2px solid var(--faint); border-radius: 6px; }
.row.completing .check > span { background: var(--done); border-color: var(--done); color: #0E1013; display: grid; place-items: center; animation: check-pop 0.32s cubic-bezier(.3,1.6,.5,1); }
.row.completing .check > span svg { width: 14px; height: 14px; }
.row.completing .check > span svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: check-draw 0.22s ease-out 0.06s forwards; }
.row.completing { opacity: 0.45; transition: opacity 0.22s ease 0.16s; }
@keyframes check-pop { 0% { transform: scale(0.85); } 55% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes check-draw { to { stroke-dashoffset: 0; } }
/* "4 of 7 done" rolls up when a task is checked off */
.screen-meta .cnt { display: inline-block; }
.screen-meta .cnt.bump { animation: cnt-bump 0.5s ease-out; }
@keyframes cnt-bump { 0% { transform: translateY(6px); opacity: 0; color: var(--done); } 60% { color: var(--done); } 100% { transform: none; opacity: 1; } }
.series-mark { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); }
.row-body { flex: 1; min-width: 0; padding: 11px 0 4px; cursor: pointer; }
.title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; margin-top: 3px; }
.meta { font-size: 12.5px; color: var(--muted); }
.meta > span + span::before { content: "·"; margin: 0 6px; color: var(--faint); }
.meta .od { color: var(--amber); font-weight: 600; }
.rep { display: inline-flex; align-items: center; gap: 4px; }
.sub-toggle {
  /* small text, full 44pt tap area */
  display: inline-flex; align-items: center; gap: 3px; border: 0; background: none;
  font: 500 12.5px var(--sans); color: #C9CED6; font-variant-numeric: tabular-nums; padding: 14px 12px 14px 8px; margin: -14px -12px -14px -8px;
}
.resched-link {
  display: block; border: 0; background: none; color: #C9CED6; font-style: italic; font-size: 12.5px;
  padding: 10px 12px 10px 0; margin: -6px 0 -8px;
}

/* subtasks */
.subs { margin: -2px 10px 8px 46px; background: var(--surface); }
.row:has(.subs) { background: var(--surface); border: 1px solid var(--line); }
.row:has(.subs) .row-main { border-color: transparent; }
.subs ul { list-style: none; margin: 0; padding: 0; }
.sub { display: flex; align-items: center; gap: 4px; min-height: 40px; }
.sub-check { width: 36px; height: 40px; border: 0; background: none; display: grid; place-items: center; margin-left: -10px; }
.sub-check::before { content: ""; width: 16px; height: 16px; border: 2px solid var(--faint); border-radius: 4px; }
.sub-check[aria-pressed="true"]::before { background: var(--done); border-color: var(--done);
  -webkit-mask: none; box-shadow: inset 0 0 0 3px var(--surface); }
.sub-title { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; text-align: left; border: 0; background: none; color: inherit; padding: 10px 0; font-family: inherit; cursor: text; -webkit-user-select: text; user-select: text; }
.sub-edit { flex: 1; min-width: 0; height: 40px; font-size: 16px; border: 0; border-bottom: 1px solid var(--amber); background: none; color: var(--text); padding: 0; }
.sub-edit:focus-visible { outline: none; }
.sub.done .sub-title { color: var(--faint); text-decoration: line-through; }
.sub-rep { width: 40px; height: 40px; border: 0; background: none; color: var(--faint); display: grid; place-items: center; opacity: 0.55; }
.sub-rep[aria-pressed="true"] { color: var(--amber); opacity: 1; }
.sub-del { width: 40px; height: 40px; border: 0; background: none; color: var(--faint); font-size: 20px; }
.sub-add { display: flex; align-items: center; gap: 4px; min-height: 44px; margin-left: -10px; }
.sub-plus { width: 36px; height: 40px; flex: none; display: grid; place-items: center; color: var(--faint); transition: color 0.15s; }
.sub-add:focus-within .sub-plus { color: var(--amber); }
.sub-add input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; padding: 0; font-size: 16px; }
.sub-add input::placeholder { color: var(--faint); }
.sub-add input:focus-visible { outline: none; }
.sub-add-btn {
  flex: none; width: 32px; height: 32px; margin-right: 4px; border-radius: 50%; border: 0;
  background: var(--amber); color: #0E1013; display: grid; place-items: center;
  opacity: 0; transform: scale(0.6); pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.sub-add.has-text .sub-add-btn { opacity: 1; transform: none; pointer-events: auto; }
.sub.pending .sub-title { color: var(--muted); }
.sub-saving { font-size: 12px; color: var(--muted); padding-right: 12px; }
.sub-err { margin: 6px 0 10px; font-size: 13px; }

/* drag */
.row.dragging {
  position: fixed; z-index: 60; margin: 0; pointer-events: none;
  box-shadow: 0 16px 34px rgba(0,0,0,0.6); transform: scale(1.02);
}
.row.dragging .row-main { border-color: var(--amber); background: var(--surface-2); }
.placeholder { list-style: none; border-radius: var(--radius); border: 1px dashed var(--amber); opacity: 0.6; }
body.is-dragging { overflow: hidden; }

/* one-time hint that rows can be swiped */
@keyframes peek { 0%, 100% { transform: translateX(0); } 35%, 65% { transform: translateX(-80px); } }
.row.peek .row-main { animation: peek 1.4s ease 0.4s 1; }

/* sections in All Tasks */
.section-head { display: flex; gap: 8px; align-items: baseline; margin: 10px 4px 8px; font-size: 14px; font-weight: 600; }
.section-head span, .section-toggle span span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.section-toggle {
  width: 100%; height: 48px; margin: 18px 0 8px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius); border: 1px solid var(--line); background: #121418; font-size: 14px; font-weight: 600;
}
.section-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.empty { color: var(--muted); font-size: 14px; padding: 18px 4px; margin: 0; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr 1fr; padding: 6px 24px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: rgba(14,16,19,0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab { height: 52px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.tab[aria-current="page"] { color: var(--amber); }

/* ---------- Buttons ---------- */
.btn { height: 48px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 600; font-size: 15px; padding: 0 16px; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #0E1013; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; background: var(--surface);
  border-radius: 18px 18px 0 0; border-top: 1px solid var(--line);
  padding: 8px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  animation: rise 0.22s ease;
}
.sheet.tall { height: 88dvh; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.sheet .sub-head { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.actions .btn { width: 100%; text-align: left; }
.actions .inline .btn { width: auto; flex: none; text-align: center; padding: 0 20px; }
.actions .inline input { flex: 1; min-width: 0; }
.btn-row { display: flex; gap: 8px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .field .lbl { font-size: 13px; color: var(--muted); }
.field > input, .field > select { flex: none; } /* full height inside the stacked field */
.field textarea { flex: none; height: 88px; padding: 12px 14px; resize: vertical; }
.field .inline { display: flex; gap: 8px; }
.field select { -webkit-appearance: none; appearance: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #0E1013; font-weight: 600; }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick .chip { padding: 0; border-radius: 10px; }
.preview { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--bg); font-size: 14px; }
.preview strong { color: var(--amber); font-weight: 600; }
.arch-item { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.arch-item .t { flex: 1; min-width: 0; }
.arch-item .t div:first-child { overflow-wrap: anywhere; }
.arch-item .when { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.arch-item .btn { height: 40px; font-size: 14px; }
.stat { font: 600 15px var(--sans); font-variant-numeric: tabular-nums; }
.note { font-size: 13.5px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; z-index: 90;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  margin: 0 auto; max-width: 520px; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500;
}
.toast .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.toast .aff { font-size: 15px; font-weight: 700; }
.toast .sub { font-size: 13px; opacity: 0.72; }
.toast.in { animation: toast-in 0.22s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast button { border: 0; background: none; color: var(--bg); font-weight: 700; padding: 8px; margin: -8px; }

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

/* ---------- Swipe right to complete ---------- */
.swipe-done {
  display: none; width: 104px; color: #0E1013; font-weight: 700; font-size: 13px;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin-right: auto;
}
.row.dir-right .swipe-under { background: var(--done); }
.row.dir-right .swipe-done { display: flex; }
.row.dir-right .swipe-btn { display: none; }

/* ---------- Select mode ---------- */
.hero-actions { display: flex; align-items: center; }
.text-btn { height: 44px; padding: 0 12px; border: 0; background: none; color: #E2E5E9; font-weight: 600; font-size: 15px; border-radius: 12px; }
.text-btn[aria-pressed="true"] { color: var(--amber-on-photo); }
body.selecting .quick-add { display: none; }
.select-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.select-tools:empty { display: none; }
.pick { flex: none; width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; }
.pick > span {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--faint);
  display: grid; place-items: center; color: transparent;
}
.pick > span svg { width: 14px; height: 14px; }
.pick[aria-pressed="true"] > span { background: var(--amber); border-color: var(--amber); color: #0E1013; }
.row.selected .row-main { border-color: var(--amber); background: var(--surface-2); }
body.selecting .row-main { touch-action: auto; }
.bulkbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px 12px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: rgba(14,16,19,0.95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bulkbar button { height: 52px; border: 0; background: none; color: var(--text); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.bulkbar button.danger { color: var(--danger); }
.bulkbar button:disabled { opacity: 0.35; }

/* ---------- Today button, week strip slide ---------- */
.meta-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.pill { height: 32px; padding: 0 14px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.18); background: rgba(14,16,19,0.5); color: var(--amber-on-photo); font-size: 13px; font-weight: 600; }
.strip { touch-action: pan-y; }
@keyframes slideL { from { transform: translateX(24px); opacity: 0.3; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(-24px); opacity: 0.3; } to { transform: none; opacity: 1; } }
.strip.slide-l { animation: slideL 0.2s ease; }
.strip.slide-r { animation: slideR 0.2s ease; }

/* ---------- Done today ---------- */
.done-toggle { margin-top: 16px; }
.done-row .row-main { background: transparent; border-color: var(--line); }
.done-row .title { color: var(--faint); text-decoration: line-through; }
.check.is-done > span { background: var(--done); border-color: var(--done); color: #0E1013; display: grid; place-items: center; }
.check.is-done > span svg { width: 14px; height: 14px; }

/* ---------- Light mode: follows the iPhone's Appearance setting ---------- */
/* Same layout and amber accent on a warm off-white. Amber text and the green
   "done" color use darker shades so they stay readable on light backgrounds. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F4F3F0; --surface: #FFFFFF; --surface-2: #F0EEEA; --line: #E2DFD9;
    --text: #17191D; --muted: #5C626B; --faint: #8B9098;
    --amber: #F5A524; --amber-on-photo: #9A5800;
    --danger: #C4352B; --done: #2B7F37;
  }
  html, body { background: var(--bg); }
  .hero::before {
    background:
      radial-gradient(120% 90% at 92% 0%, rgba(245,165,36,0.30), transparent 60%),
      url("assets/desk.jpg") center / cover no-repeat,
      #E8DFD0;
    filter: blur(14px) brightness(1.1) saturate(0.7);
  }
  .hero::after { background: linear-gradient(180deg, rgba(244,243,240,0.55) 0%, rgba(244,243,240,0.8) 60%, var(--bg) 100%); }
  .screen-meta, .icon-btn, .text-btn { color: var(--text); }
  .screen-meta .od, .meta .od { color: #9A5800; }
  .tab[aria-current="page"], .text-btn[aria-pressed="true"] { color: #9A5800; }
  .sub-toggle, .resched-link { color: var(--muted); }
  .section-toggle { background: var(--surface-2); }
  .tabbar, .bulkbar { background: rgba(244,243,240,0.94); }
  .pill { background: rgba(255,255,255,0.75); border-color: var(--line); color: #9A5800; }
  .add-btn { background: var(--text); color: #FFFFFF; }
  .check.is-done > span, .row.completing .check > span { color: #FFFFFF; }
  .row.dragging { box-shadow: 0 16px 34px rgba(0,0,0,0.18); }
  .sheet-backdrop { background: rgba(23,25,29,0.35); }
  .sheet { box-shadow: 0 -8px 30px rgba(0,0,0,0.08); }
  .toast { background: var(--text); color: #FFFFFF; }
  .toast button { color: #FFD08A; }
  .form-note { background: var(--surface-2); }
  .swipe-btn { color: #17191D; }
  .row.dir-right .swipe-done { color: #FFFFFF; }
}

/* ---------- Events: the Schedule card on Today ---------- */
/* Folded to one line by default (the app is task-first); tap to open. */
.sched { margin: 0 0 12px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 0 6px 0 12px; }
.sched-top { display: flex; align-items: center; }
.sched-head { flex: 1; min-width: 0; height: 48px; border: 0; background: none; padding: 0; display: flex; align-items: center; gap: 10px; text-align: left; color: var(--text); }
.sched-label { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.sched-next { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-count { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.sched-head svg { flex: none; color: var(--muted); margin-right: 6px; }
.sched-add { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
body.selecting .sched { display: none; }

.ev-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 6px 0; }
.ev-chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 0; background: var(--surface-2); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.ev-chip.more { background: none; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.ev-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.ev { width: 100%; min-height: 48px; border: 0; background: none; padding: 5px 6px 5px 0; display: flex; align-items: flex-start; gap: 10px; text-align: left; color: var(--text); }
.ev-row { display: flex; align-items: flex-start; }
.ev-row .ev { flex: 1; min-width: 0; }
.ev-row.past .ev { opacity: 0.5; }
.ev-time { flex: none; width: 62px; padding-top: 2px; font-size: 12.5px; font-weight: 600; color: #C9CED6; font-variant-numeric: tabular-nums; }
.ev-bar { flex: none; width: 4px; align-self: stretch; min-height: 20px; border-radius: 2px; }
.ev-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ev-title { font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.ev-sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.ev-fold { width: 100%; height: 40px; border: 0; background: none; padding: 0; color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.ev-now { display: flex; align-items: center; gap: 8px; margin: 2px 6px 2px 0; }
.ev-now span { width: 62px; font-size: 11px; font-weight: 700; color: var(--amber); letter-spacing: 0.04em; }
.ev-now i { flex: 1; height: 2px; border-radius: 1px; background: var(--amber); opacity: 0.7; }
.ev-more { width: calc(100% + 6px); height: 44px; margin-top: 2px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--amber); font-size: 13.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* event sheet */
.ev-headline { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.ev-bar.tall { min-height: 46px; margin-top: 3px; }
.ev-info { border: 1px solid var(--line); border-radius: var(--radius); }
.ev-info > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; font-size: 14px; }
.ev-info > div + div { border-top: 1px solid var(--line); }
.ev-info > div > span:first-child { flex: none; color: var(--muted); }
.ev-info > div > span:last-child { display: inline-flex; align-items: center; gap: 6px; text-align: right; overflow-wrap: anywhere; white-space: pre-line; }
.sheet .note { margin: 10px 0 0; }
.note.center { text-align: center; margin: 2px 0 0; }
.ev-linked-head { margin: 18px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.ev-linked { display: flex; flex-direction: column; gap: 6px; }
.ev-linked > div { display: flex; justify-content: space-between; gap: 12px; min-height: 44px; align-items: center; padding: 0 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 14px; }
.ev-linked > div > span:last-child { flex: none; font-size: 12.5px; color: var(--muted); }
.ev-linked > div.done > span:first-child { color: var(--faint); text-decoration: line-through; }

/* add/edit event form */
.toggle-row { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: -4px 0 10px; font-size: 15px; }
.toggle-row input { width: 22px; height: 22px; margin: 0; accent-color: var(--amber); }
.ev-times .inline { gap: 10px; }
.ev-times .inline .field { flex: 1; min-width: 0; margin-bottom: 0; }
.ev-times input { width: 100%; }

@media (prefers-color-scheme: light) {
  .ev-time { color: var(--muted); }
  .ev-now span, .ev-more { color: #9A5800; }
}

/* Text boxes stacked directly in a form field keep their full 46px height
   (they were being squashed to ~22px, e.g. the Title box in Edit task). */
.field > input, .field > select { flex: none; }
/* All-day chips stay on one line; long names end in "…" */
.ev-chip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-chip.more { flex: none; }

/* Add a task right on the event sheet: name box + day chips, no extra screens */
.ev-add { margin-top: 16px; }
.ev-task-input { width: 100%; box-sizing: border-box; height: 46px; margin-bottom: 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0 14px; font: inherit; font-size: 16px; }
.ev-task-input:focus { outline: none; border-color: var(--amber); }
.ev-add .ev-addtask:disabled { opacity: 0.4; }
.ev-days { display: flex; gap: 6px; }
.ev-day { position: relative; flex: 1; min-width: 0; height: 40px; padding: 0 8px; border-radius: 20px; border: 1px solid var(--line); background: none; color: var(--muted); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.ev-day[aria-pressed="true"] { border-color: var(--amber); background: rgba(255,180,58,0.14); color: var(--amber); font-weight: 600; }
@media (prefers-color-scheme: light) { .ev-day[aria-pressed="true"] { color: #9A5800; border-color: #C77A00; background: rgba(255,180,58,0.18); } }
/* "Pick date": the real date box sits invisibly on top, so one tap opens the iPhone date wheel */
.ev-day.ev-pickdate input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; margin: 0; padding: 0; }

/* "+ Task" on each event row: its own clear button, separate from the event */
.ev-task { flex: none; height: 44px; padding: 0 4px 0 8px; border: 0; background: none; color: var(--amber); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 3px; }
.ev-task svg { width: 14px; height: 14px; }
.ev-addtask { width: 100%; margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.ev-for { display: flex; align-items: center; gap: 8px; }
@media (prefers-color-scheme: light) { .ev-task { color: #9A5800; } }

/* ---------- Settings → Calendars (iPhone app, Pro) ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pro-badge { height: 24px; padding: 0 10px; border-radius: 12px; background: var(--amber); color: #0E1013; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; letter-spacing: 0.04em; }
.cal-lead { margin: 6px 0 14px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.cal-connect { width: 100%; }
.cal-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cal-list[aria-disabled="true"] { opacity: 0.5; }
.cal-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px; }
.cal-list .cal-row + .cal-row { border-top: 1px solid var(--line); }
.cal-master { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 6px; }
.cal-dot { width: 12px; height: 12px; }
.cal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cal-master .cal-name { flex: 1; }
.cal-name { font-weight: 500; overflow-wrap: anywhere; }
.cal-sub { font-size: 12.5px; color: var(--muted); }
.cal-row input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--amber); }

/* ---------------------------------------------------------------- household sharing */
.bubble { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #0E1013; flex: none; }
.meta .who { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 500; }
.people { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.person { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.person .bubble, .member .bubble { width: 30px; height: 30px; font-size: 14px; }
.person .pname { flex: 1; }
.person .pcheck { color: var(--amber); visibility: hidden; display: inline-flex; }
.person[aria-pressed="true"] { border-color: var(--amber); }
.person[aria-pressed="true"] .pcheck { visibility: visible; }
.members { display: flex; flex-direction: column; margin-bottom: 14px; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member .mtext { flex: 1; min-width: 0; }
.member .when { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.btn.small { height: 36px; font-size: 14px; padding: 0 14px; width: auto; }
.invite { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.invite > .btn { width: 100%; }
.invite-link { display: flex; gap: 8px; }
.invite-link input { flex: 1; min-width: 0; height: 44px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); padding: 0 12px; font-size: 16px; }
.invite-link .btn { height: 44px; width: auto; padding: 0 14px; }
#houseSection { margin-bottom: 6px; }

/* ---------- Sign up and Sign in with Apple ---------- */
.signin-card .tagline { margin: -8px 0 8px; color: var(--muted); font-size: 15px; }
.signin-card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.signin-card .hint { margin: -2px 0 0; }
.signin-card .legal { margin: 2px 0 0; text-align: center; }
.signin-card .legal a { color: var(--text); }
.signin-card .switch { text-align: center; margin-top: 6px; }
.inline-link { border: 0; background: none; padding: 6px 2px; color: var(--text); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.check-email { display: flex; flex-direction: column; gap: 8px; }
.apple-box { display: flex; flex-direction: column; gap: 8px; }
.btn.apple { height: 48px; background: #FFFFFF; color: #000000; border: 0; font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.apple-mark { font-family: -apple-system, "SF Pro Text", system-ui, sans-serif; font-size: 19px; line-height: 1; position: relative; top: -1px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 6px 0 2px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (prefers-color-scheme: light) {
  .btn.apple { background: #000000; color: #FFFFFF; }
}
.meta .from-ev { display: inline-flex; align-items: center; gap: 4px; }
