/* Porchday — clean light.
   60% neutral (soft grey ground, white cards), 30% slate blue (ink, progress, selection, the strip),
   10% orange: only the main button and the "today" marks. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --surface-3: #e3e8ef;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #5d6675;
  --line: #e5e8ed;
  --line-2: #d3d9e1;
  --sec: #2c4a72;
  --sec-2: #dbe5f2;
  --sec-ink: #1d3557;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fdeee4;
  --accent-ink: #9a3412;
  --danger: #b42318;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgb(17 24 39 / .05);
  --shadow: 0 1px 2px rgb(17 24 39 / .04), 0 8px 24px -8px rgb(17 24 39 / .10);
  --shadow-lg: 0 24px 64px -16px rgb(17 24 39 / .28);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --top: 64px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
code { font: 13px var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--sec); outline-offset: 2px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 14px; border-radius: var(--r-sm); background: var(--ink); color: #fff; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; height: var(--top); background: rgb(245 246 248 / .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top__inner { max-width: 1240px; height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand__mark { width: 26px; height: 26px; }
.top__actions { display: flex; align-items: center; gap: 8px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background-color .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-hover); }
.btn--dark { background: var(--sec); color: #fff; }
.btn--dark:hover { background: var(--sec-ink); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--quiet { background: none; color: var(--ink-2); }
.btn--quiet:hover { background: var(--surface-2); }
.btn--danger { color: var(--danger); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link { background: none; border: 0; padding: 0; color: var(--sec); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklab, var(--sec) 35%, transparent); }
.link:hover { text-decoration-color: currentColor; }

/* ---------- layout ---------- */
.shell { max-width: 1240px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
.list-col { min-width: 0; }
.detail-col { position: sticky; top: calc(var(--top) + 24px); min-width: 0; max-height: calc(100vh - var(--top) - 48px); overflow-y: auto; overscroll-behavior: contain; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); scrollbar-width: thin; }

/* ---------- list ---------- */
.list-head { padding: 4px 4px 16px; }
.list-head h1 { font-size: 28px; letter-spacing: -0.03em; }
.list-head__sum { margin-top: 2px; color: var(--muted); }
.list-head__sum b { color: var(--ink); font-weight: 500; }
.list-tools { display: grid; gap: 10px; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); }
.search:focus-within { border-color: var(--sec); box-shadow: 0 0 0 3px var(--sec-2); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 16px; }
.seg { display: flex; padding: 3px; border-radius: 999px; background: var(--surface-3); }
.seg button { flex: 1; height: 34px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.seg button span { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 2px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

.group { margin-bottom: 18px; }
.group__h { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.group__h .count { font-variant-numeric: tabular-nums; }
.cards { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.item { width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-align: left; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.item:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.item[aria-current="true"] { border-color: var(--sec); box-shadow: 0 0 0 1px var(--sec), var(--shadow); }
.item__main { min-width: 0; display: grid; gap: 2px; }
.item__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__sub { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.item__sub span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__when { display: grid; justify-items: end; gap: 1px; text-align: right; }
.item__day { font-weight: 600; font-size: 17px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.item__date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px #dcfce7; flex: none; }

.tile { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; color: var(--sec); }
.tile img { width: 26px; height: 26px; object-fit: contain; }
.tile img.wide { width: 32px; height: auto; }
.tile svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tile--amazon { font: 600 13px/1 var(--font); color: var(--ink); background: #ffe8c2; box-shadow: none; }
.tile--lg { width: 48px; height: 48px; border-radius: 12px; }
.tile--lg img { width: 32px; height: 32px; }
.tile--lg img.wide { width: 38px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill--today { background: var(--accent-soft); color: var(--accent-ink); }
.pill--late { background: #fef3f2; color: var(--danger); }
.pill--done { background: #ecfdf3; color: #067647; }
.pill--live { background: #ecfdf3; color: #067647; }

.empty { display: grid; justify-items: center; gap: 10px; padding: 40px 24px; border-radius: var(--r-lg); border: 1px dashed var(--line-2); background: var(--surface); text-align: center; }
.empty svg { width: 72px; height: 72px; }
.empty h2 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 32ch; }
.empty .btn { margin-top: 6px; }
.none { padding: 28px 16px; color: var(--muted); text-align: center; }

/* ---------- detail ---------- */
.d { padding: 24px 28px 28px; display: grid; gap: 22px; }
.d__bar { display: none; }
.d__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.d__title { font-size: 22px; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.d__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 14px; margin-top: 2px; }
.code { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; border: 0; background: var(--surface-2); font: 13px var(--mono); color: var(--ink-2); }
.code:hover { background: var(--surface-3); }
.code svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.d__menu { display: flex; gap: 4px; }

.eta { display: grid; gap: 4px; padding: 22px 24px; border-radius: var(--r-lg); background: linear-gradient(180deg, var(--sec-2), color-mix(in oklab, var(--sec-2) 40%, #fff)); }
.eta--late { background: linear-gradient(180deg, #fde8e4, #fff6f4); }
.eta--done { background: linear-gradient(180deg, #dcf5e6, #f2fbf5); }
.eta__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.eta__label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.eta__date { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.05; font-weight: 600; letter-spacing: -0.04em; color: var(--sec-ink); }
.eta--late .eta__date { color: #7a271a; }
.eta--done .eta__date { color: #05603a; }
.eta__sub { color: var(--ink-2); }
.eta__sub b { font-weight: 500; color: var(--ink); }
.eta__foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.eta__foot span { display: inline-flex; align-items: center; gap: 6px; }

/* the two-week strip */
.strip { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.strip__day { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 0 9px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.strip__dow { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.strip__num { font-size: 15px; font-weight: 500; }
.strip__day.is-off .strip__num { color: #a3abb7; text-decoration: line-through; text-decoration-thickness: 1px; }
.strip__day.is-range { background: var(--sec-2); }
.strip__day.is-pick { background: var(--sec); }
.strip__day.is-pick .strip__num, .strip__day.is-pick .strip__dow { color: #fff; }
.strip__day.is-today::after { content: ""; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.strip__key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.strip__key span { display: inline-flex; align-items: center; gap: 6px; }
.strip__key i { width: 10px; height: 10px; border-radius: 3px; background: var(--sec-2); }
.strip__key i.k-pick { background: var(--sec); }
.strip__key i.k-today { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.strip__key i.k-off { background: none; box-shadow: inset 0 0 0 1px var(--line-2); }

.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); }
.steps li::before { content: ""; height: 5px; border-radius: 999px; background: var(--surface-3); }
.steps li.is-done { color: var(--ink); font-weight: 500; }
.steps li.is-done::before { background: var(--sec); }

.block__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.block__h h3 { font-size: 15px; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; padding: 0 0 16px; }
.timeline li::before { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 12px; height: 12px; margin: 5px 4px 0; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-2); }
.timeline li:first-child .dot { background: var(--sec); box-shadow: 0 0 0 4px var(--sec-2); }
.timeline .what { font-weight: 500; }
.timeline .where { color: var(--muted); font-size: 14px; }
.timeline .when { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.timeline .src { display: block; font-size: 12px; }
.timeline .rm { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; text-decoration: underline; }

.addup { display: grid; grid-template-columns: 1.3fr 1fr 1.4fr auto; gap: 8px; margin-top: 14px; }
.why { border-top: 1px solid var(--line); padding-top: 16px; }
.why summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font-weight: 600; }
.why summary::-webkit-details-marker { display: none; }
.why summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
.why[open] summary::after { transform: rotate(-135deg); }
.why__list { margin: 12px 0 0; padding: 0; list-style: none; }
.why__list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.why__list li:first-child { border-top: 0; }
.why__list .l { font-weight: 500; }
.why__list .r { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.why__list .s { color: var(--muted); font-size: 13.5px; }
.why__note { margin-top: 10px; font-size: 13px; color: var(--muted); }

.d__actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 18px; }
.d__notes { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); }
.placeholder { display: grid; place-items: center; align-content: center; gap: 10px; min-height: 420px; padding: 40px; text-align: center; color: var(--muted); }
.placeholder svg { width: 56px; height: 56px; color: var(--line-2); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field--wide { grid-column: 1 / -1; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.check { display: inline-flex; align-items: center; gap: 8px; height: 44px; margin-top: 27px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--sec); }
.in { width: 100%; height: 44px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-size: 16px; }
.in:focus { outline: none; border-color: var(--sec); box-shadow: 0 0 0 3px var(--sec-2); }
.in[aria-invalid="true"] { border-color: var(--danger); }
.in--mono { font-family: var(--mono); letter-spacing: .02em; }
select.in { padding-right: 8px; }
.hint { font-size: 13px; color: var(--muted); }
.hint.is-found { color: #067647; }
.err { font-size: 13px; color: var(--danger); }
.inline { display: flex; gap: 8px; }
.inline .in { flex: 1; }
.inline--wrap { flex-wrap: wrap; }
.preview { padding: 14px 16px; border-radius: var(--r-md); background: var(--sec-2); color: var(--sec-ink); }
.preview b { font-weight: 600; }
.preview:empty { display: none; }

.more { border-radius: var(--r-md); border: 1px solid var(--line); }
.more summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-weight: 500; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary span { color: var(--muted); font-weight: 400; font-size: 14px; }
.more summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s; margin: 0 4px 0 2px; }
.more[open] summary::before { transform: rotate(45deg); }
.more__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 4px 14px 16px; }

/* ---------- dialogs ---------- */
.sheet { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.sheet::backdrop { background: rgb(17 24 39 / .4); backdrop-filter: blur(2px); }
.sheet form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px 24px; }
.sheet__head h2 { font-size: 20px; }
.sheet__body { display: grid; gap: 16px; padding: 6px 24px 20px; overflow-y: auto; }
.sheet__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 18px; border-top: 1px solid var(--line); }
.sheet[open] { animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 16px); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- smaller screens: the list, with the details as a full screen panel ---------- */
@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 16px; max-width: 640px; }
  .top__inner { max-width: 640px; padding: 0 16px; }
  .detail-col { position: fixed; inset: 0; top: 0; z-index: 30; max-height: none; border-radius: 0; box-shadow: none; transform: translateX(100%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  body.is-detail .detail-col { transform: none; visibility: visible; transition: transform .25s ease; }
  body.is-detail { overflow: hidden; }
  .d { padding: 0 20px 32px; gap: 20px; }
  .d__bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; margin: 0 -20px; padding: 10px 12px; background: rgb(255 255 255 / .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .d__bar span { font-weight: 500; }
  .placeholder { display: none; }
}
@media (max-width: 560px) {
  .top__inner { padding: 0 16px; }
  #addBtn span { display: none; }
  #addBtn { width: 40px; padding: 0; }
  .list-head h1 { font-size: 24px; }
  .strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .steps li { font-size: 0; gap: 0; }
  .eta { padding: 18px; }
  .eta__date { font-size: 28px; }
  .d__title { font-size: 19px; }
  .d__menu .icon-btn { width: 36px; }
  .addup { grid-template-columns: 1fr 1fr; }
  .addup .btn { grid-column: 1 / -1; }
  .more__grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .check { margin-top: 0; justify-self: start; }
  .timeline li { grid-template-columns: 20px minmax(0, 1fr); }
  .timeline .when { grid-column: 2; text-align: left; }
  .sheet { width: 100vw; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .sheet form { max-height: 92vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
