/* Home OS. Palette borrowed from the house: Monument charcoal, a cool white, brushed brass, honey pine. */
@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --ink: #26282b;
  --ink-soft: #3a3d41;
  --paper: #f1f2f0;
  --card: #ffffff;
  --line: #dcdfda;
  --muted: #666b70;
  --brass: #a47e3b;
  --brass-deep: #7d5f28;
  --pine: #f3e6d2;
  --pine-deep: #6b4a1e;
  --ok: #356f4d;
  --bad: #a93c34;
  --display: "Bricolage", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.45 var(--body); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; border-radius: 4px; }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.screen { max-width: 640px; margin: 0 auto; padding: calc(var(--safe-t) + 18px) 16px 0; }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: var(--ink); display: flex;
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #b9bcbf; text-decoration: none; font-size: 11.5px; font-weight: 600; position: relative;
}
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: #fff; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 26%; right: 26%; height: 3px; background: var(--brass); border-radius: 0 0 3px 3px;
}
.nav .nav-extra { display: none; }

/* ---------- Type ---------- */
.day-title { font: 700 40px/0.95 var(--display); letter-spacing: -0.02em; }
.day-sub { font: 400 17px/1.2 var(--display); color: var(--muted); margin-top: 6px; }
.screen-title { font: 700 30px/1 var(--display); letter-spacing: -0.015em; }
.section-title { font: 650 19px/1.2 var(--display); letter-spacing: -0.005em; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--c, var(--ink)); color: #fff;
  font: 700 16px var(--display); display: grid; place-items: center; text-decoration: none; flex: none;
}

/* ---------- Week ribbon: the house rule ---------- */
.ribbon { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 2px solid var(--ink); margin: 0 -4px 22px; }
.ribbon button {
  background: none; border: 0; padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative; min-width: 0; border-radius: 8px 8px 0 0;
}
.ribbon button::after { /* tick on the baseline */
  content: ""; position: absolute; bottom: 0; left: 50%; width: 2px; height: 7px; background: var(--ink); transform: translateX(-1px);
}
.ribbon .dow { font-size: 12px; font-weight: 600; color: var(--muted); }
.ribbon .num { font: 650 22px/1.1 var(--display); }
.ribbon .marks { display: flex; gap: 2px; height: 5px; margin: 3px 0 2px; }
.ribbon .marks i { width: 7px; height: 5px; border-radius: 2px; background: var(--c, var(--muted)); }
.ribbon .wx { font-size: 11.5px; color: var(--muted); height: 15px; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.ribbon .wx.wet { color: #2b6c8e; font-weight: 600; }
.ribbon .wx svg { width: 10px; height: 10px; }
.ribbon button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.ribbon button[aria-pressed="true"] .dow, .ribbon button[aria-pressed="true"] .wx { color: #cfd2d4; }
.ribbon button[aria-pressed="true"]::after { background: var(--brass); width: 100%; left: 0; transform: none; height: 4px; bottom: -3px; }
.ribbon button.is-today:not([aria-pressed="true"]) .num { color: var(--brass-deep); }

/* ---------- Blocks ---------- */
.block { margin-bottom: 26px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.link { background: none; border: 0; padding: 4px 0; color: var(--brass-deep); font-weight: 650; font-size: 14.5px; text-decoration: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.empty { color: var(--muted); padding: 14px 0; }
.notice { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brass); border-radius: 8px; padding: 12px 14px; font-size: 14.5px; margin-bottom: 14px; }
.notice.bad { border-left-color: var(--bad); }
.notice.offline { border-left-color: var(--muted); background: #e7e9e5; }
.tablet-only { display: none !important; }

/* Events */
.events { list-style: none; margin: 0; padding: 0; }
.event { display: grid; grid-template-columns: 58px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.event:first-child { border-top: 0; }
.event .when { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14.5px; padding-top: 1px; }
.event .when small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.event .what { border-left: 4px solid var(--c, var(--muted)); padding-left: 10px; min-width: 0; }
.event .what.both { border-image: linear-gradient(to bottom, var(--c) 50%, var(--c2) 50%) 1; }
.event .title { font-weight: 600; overflow-wrap: anywhere; }
.event .where { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }

/* Dinner band */
.dinner { background: var(--pine); border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; }
.dinner .label { font-size: 13px; font-weight: 600; color: var(--pine-deep); }
.dinner .meal { font: 650 21px/1.15 var(--display); overflow-wrap: anywhere; }
.dinner .cook { font-size: 13.5px; color: var(--pine-deep); }

/* ---------- Forms ---------- */
.btn {
  border: 1.5px solid var(--ink); background: var(--ink); color: #fff; border-radius: 10px; padding: 11px 16px;
  font-weight: 650; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); }
.btn.quiet { border-color: var(--line); background: #fff; color: var(--ink); }
.btn.danger { border-color: var(--bad); background: transparent; color: var(--bad); }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: 14.5px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 5px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13.5px; margin-top: 5px; display: block; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid #c4c8c3; background: #fff; border-radius: 10px; padding: 11px 12px; min-height: 46px; font-size: 16px;
}
textarea.input { min-height: 130px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: var(--ink); outline: 3px solid color-mix(in srgb, var(--brass) 45%, transparent); outline-offset: 0; }

.add-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.add-bar .input { flex: 1; min-width: 0; }

/* ---------- Shopping ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 14.5px; font-weight: 550;
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px;
}
.chip svg { width: 14px; height: 14px; }
.chip.due { border-color: var(--brass); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.aisle { font-size: 13.5px; font-weight: 650; color: var(--muted); margin: 16px 0 4px; }
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.item .tick {
  flex: none; width: 46px; height: 50px; background: none; border: 0; display: grid; place-items: center; padding: 0;
}
.item .tick span { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #8d9297; display: grid; place-items: center; background: #fff; }
.item .tick svg { width: 16px; height: 16px; color: #fff; opacity: 0; }
.item.done .tick span { background: var(--ok); border-color: var(--ok); }
.item.done .tick svg { opacity: 1; }
.item .body { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 10px 4px; min-height: 50px; display: flex; flex-direction: column; justify-content: center; }
.item .name { font-weight: 550; font-size: 16.5px; overflow-wrap: anywhere; }
.item.done .name { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.item .note { font-size: 13.5px; color: var(--muted); }
.item .who { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c, transparent); margin-right: 6px; }

/* ---------- Meals ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.week-nav .label { font: 650 18px var(--display); }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.nights { list-style: none; margin: 0 0 14px; padding: 0; border-top: 2px solid var(--ink); }
.night { display: grid; grid-template-columns: 54px 1fr; align-items: center; border-bottom: 1px solid var(--line); }
.night .d { padding: 10px 0; }
.night .d b { display: block; font: 650 20px/1 var(--display); }
.night .d span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.night.is-today .d b { color: var(--brass-deep); }
.night button { background: none; border: 0; text-align: left; padding: 12px 0 12px 8px; min-height: 58px; width: 100%; }
.night .meal { font-weight: 600; font-size: 16.5px; overflow-wrap: anywhere; }
.night .cook { font-size: 13.5px; color: var(--muted); }
.night .plan { color: var(--muted); }
.recipe { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.recipe button.name { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; font-size: 16.5px; min-height: 40px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.recipe .meta { font-size: 13.5px; color: var(--muted); font-weight: 400; display: block; }
.pick-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 38vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-list button { width: 100%; background: #fff; border: 0; border-bottom: 1px solid var(--line); text-align: left; padding: 12px 14px; min-height: 48px; font-weight: 550; }
.pick-list li:last-child button { border-bottom: 0; }

/* ---------- Devices ---------- */
.device { padding: 14px 16px; margin-bottom: 12px; }
.device-head { display: flex; align-items: center; gap: 12px; }
.device-head .names { flex: 1; min-width: 0; }
.device-head .n { font: 650 18px/1.2 var(--display); overflow-wrap: anywhere; }
.device-head .s { font-size: 13.5px; color: var(--muted); }
.device-head .s.off { color: var(--bad); }
.star { background: none; border: 0; width: 40px; height: 40px; display: grid; place-items: center; color: #9a9fa4; padding: 0; }
.star svg { width: 22px; height: 22px; }
.star[aria-pressed="true"] { color: var(--brass); }
.star[aria-pressed="true"] svg { fill: currentColor; }
.switch { position: relative; width: 58px; height: 34px; flex: none; border: 0; border-radius: 999px; background: #b4b8bc; padding: 0; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(24px); }
.switch:disabled { opacity: 0.45; }
.controls { margin-top: 10px; border-top: 1px solid var(--line); }
.control { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.control:last-child { border-bottom: 0; padding-bottom: 0; }
.control label, .control .lbl { font-weight: 550; font-size: 15px; }
.control input[type="range"] { flex: 1; max-width: 55%; accent-color: var(--ink); height: 34px; }
.control .val { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; min-width: 48px; text-align: right; }
.control select { max-width: 55%; }
.readings { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick .q { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quick .q span { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; min-width: 0; }
.steps { margin: 10px 0 0; padding-left: 20px; }
.steps li { margin-bottom: 8px; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em; background: #e8eae6; padding: 1px 5px; border-radius: 4px; }

/* ---------- Settings ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; overflow-wrap: anywhere; }
.swatch { width: 44px; height: 44px; border: 0; padding: 0; background: none; border-radius: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; }

/* ---------- Sheet (dialog) ---------- */
dialog.sheet {
  border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 18px 18px 0 0; background: var(--paper);
  max-height: 92dvh; color: var(--ink);
}
dialog.sheet::backdrop { background: rgb(20 22 24 / 0.5); }
.sheet-in { padding: 20px 18px calc(22px + var(--safe-b)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.sheet-head h2 { font: 700 23px/1.1 var(--display); }
.close { background: none; border: 0; width: 44px; height: 44px; display: grid; place-items: center; margin: -8px -10px -8px 0; }
.close svg { width: 22px; height: 22px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px); z-index: 60;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 550; font-size: 14.5px;
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }

/* ---------- Sign in ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--ink); color: #fff; }
.login-box { width: 100%; max-width: 360px; }
.login h1 { font: 700 54px/0.9 var(--display); letter-spacing: -0.03em; }
.login .rule {
  height: 11px; margin: 16px 0 26px; border-bottom: 2px solid #fff;
  background: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / 7 - 2px), #fff calc(100% / 7 - 2px), #fff calc(100% / 7));
}
.login .field > span { color: #e3e5e6; }
.login .input { border-color: transparent; }
.login .btn { background: var(--brass); border-color: var(--brass); color: #1c1d1f; width: 100%; }
.login .who { display: grid; gap: 10px; }
.login .who button { background: var(--c); border: 0; color: #fff; border-radius: 12px; padding: 16px; font: 650 20px var(--display); text-align: left; }
.login .err { color: #ffb4ab; min-height: 22px; margin-top: 10px; font-size: 14.5px; }

/* ---------- Week board (tablet and wall display) ---------- */
.board { display: none; }
.clock { font: 300 40px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  .shell { padding: 0 0 0 96px; }
  .nav { inset: 0 auto 0 0; width: 96px; height: auto; flex-direction: column; justify-content: flex-start; padding: 22px 0; gap: 4px; }
  .nav a { flex: none; height: 70px; font-size: 12.5px; }
  .nav a[aria-current="page"]::before { top: 18%; bottom: 18%; left: 0; right: auto; width: 4px; height: auto; border-radius: 0 3px 3px 0; }
  .nav .nav-extra { display: flex; margin-top: auto; }
  .screen { max-width: 760px; padding: 34px 32px 40px; }
  .screen.wide { max-width: none; }
  #toast { bottom: 24px; }
  dialog.sheet { margin: auto; border-radius: 18px; }

  .phone-only { display: none !important; }
  .tablet-only { display: flex !important; }
  .board { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
  .board-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 2px solid var(--ink); }
  .col { border-right: 1px solid var(--line); padding: 0 7px 10px; min-height: 62vh; display: flex; flex-direction: column; position: relative; }
  .col:last-child { border-right: 0; }
  .col::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 8px; background: var(--ink); }
  .col.is-today { background: #fff; }
  .col.is-today::before { left: 0; width: 100%; height: 5px; background: var(--brass); top: -2px; }
  .col-head { padding: 16px 0 10px; }
  .col-head .dow { font-size: 13.5px; font-weight: 650; color: var(--muted); }
  .col-head .num { font: 700 34px/1 var(--display); letter-spacing: -0.02em; }
  .col-head .wx { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; gap: 4px; align-items: center; min-height: 18px; }
  .col-head .wx.wet { color: #2b6c8e; font-weight: 600; }
  .col-head .wx svg { width: 12px; height: 12px; }
  .col-events { flex: 1; display: flex; flex-direction: column; gap: 7px; }
  .pill { border-left: 4px solid var(--c, var(--muted)); background: color-mix(in srgb, var(--c, #888) 9%, #fff); border-radius: 0 7px 7px 0; padding: 6px 7px; font-size: 13.5px; line-height: 1.25; overflow-wrap: break-word; hyphens: auto; }
  .pill.both { border-image: linear-gradient(to bottom, var(--c) 50%, var(--c2) 50%) 1; }
  .pill time { display: block; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
  .col-dinner { margin-top: 10px; background: var(--pine); border-radius: 8px; padding: 8px; font-size: 13.5px; font-weight: 600; line-height: 1.25; overflow-wrap: break-word; hyphens: auto; border: 0; text-align: left; width: 100%; }
  .col-dinner.none { background: transparent; border: 1.5px dashed #c4c8c3; color: var(--muted); font-weight: 500; }
  .col-dinner small { display: block; font-size: 12px; font-weight: 600; color: var(--pine-deep); }
  .board-side .block { margin-bottom: 30px; }
  .quick { grid-template-columns: 1fr; }
}

/* Wall display: no navigation, larger type, runs unattended. */
body.wall .nav { display: none; }
body.wall .shell { padding-left: 0; }
body.wall .screen { padding: 28px 32px; }
body.wall .pill { font-size: 16px; }
body.wall .item .name { font-size: 18px; }
.wall-exit { display: none; }
body.wall .wall-exit { display: inline-flex; }
body.wall .wall-enter, body.wall .avatar { display: none; }

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