/* Byrdhouse — one small design system.
   Palette: morning at the birdhouse. Display face appears in exactly two
   places (wordmark, page title); everything else is the family's native
   system type. */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin.5d2835174326.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}

:root {
  --nest: #f6f4ef;
  --spruce: #22423a;
  --spruce-deep: #1a332d;
  --fern: #53695c;
  --egg: #cfe3db;
  --goldfinch: #e8a93c;
  --bark: #26231e;
  --ink: #22423a;        /* icons, links, outline buttons */
  --focus: #8a5f10;      /* focus rings: amber dark enough for light bg */
  --card: #ffffff;
  --line: #e3ded4;
  --display: "Fraunces", "New York", Georgia, serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --nest: #15201c;
    --bark: #ece7dd;
    --card: #1e2e29;
    --line: #2c423b;
    --egg: #24382f;
    --fern: #93b0a2;
    --ink: #a8c3b7;
    --focus: #e8a93c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--nest);
  color: var(--bark);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }

/* ---- App header ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  max-width: 60rem;
  margin: 0 auto;
}
.topbar .mark { flex: none; display: flex; }
.topbar .wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  color: inherit;
  text-decoration: none;
}
.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.92rem;
}
.topbar nav a { text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }

/* ---- Layout ---- */
main.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.5rem 1rem 3rem;
}

h1.page-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  margin: 1rem 0 0.25rem;
}
p.page-sub { margin: 0 0 1.5rem; color: var(--fern); }

/* ---- Module tiles ---- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.9rem;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1.1rem 1rem 1rem;
  min-height: 7.5rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgb(34 66 58 / 0.12);
}
.tile-icon { font-size: 1.6rem; line-height: 1; }
.tile-name { font-weight: 600; }
.tile-desc { font-size: 0.85rem; color: var(--fern); }

.empty-nest {
  border: 1.5px dashed var(--line);
  border-radius: 1.1rem;
  padding: 2.2rem 1.4rem;
  text-align: center;
  color: var(--fern);
}

/* ---- Sibling subdomains (staff only) ---- */
.elsewhere {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.9rem;
  margin-top: 2.25rem;
  font-size: 0.85rem;
}
.elsewhere-label { color: var(--fern); }
.elsewhere a { color: var(--ink); }

/* ---- Auth pages (login, code, passkeys) ---- */
body.auth {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 1rem;
}
.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: 2rem 1.6rem 1.8rem;
}
.auth-hero { text-align: center; margin-bottom: 1.4rem; }
.auth-hero .welcome {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.9rem;
  margin: 0.4rem 0 0;
}
.auth-hero .roost { margin-top: 0.35rem; }

/* birds settle on the wire, once */
.roost .bird { animation: settle 0.7s ease-out backwards; }
.roost .bird:nth-child(2) { animation-delay: 0.12s; }
.roost .bird:nth-child(3) { animation-delay: 0.24s; }
.roost .bird:nth-child(4) { animation-delay: 0.36s; }
@keyframes settle {
  from { transform: translateY(-0.5rem); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .roost .bird { animation: none; }
  .tile { transition: none; }
}

/* allauth renders plain elements inside the card — style them by tag */
.auth-card h1, .auth-card h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 0.8rem;
}
.auth-card p { font-size: 0.95rem; }
.auth-card label { display: block; font-size: 0.9rem; margin: 0.7rem 0 0.25rem; }
.auth-card input[type="email"],
.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="number"] {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--nest);
  color: inherit;
}
.auth-card input:focus-visible,
.auth-card button:focus-visible,
.tile:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.auth-card button, .auth-card .btn {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--body);
  color: #fff;
  background: var(--spruce);
  border: none;
  border-radius: 0.8rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.auth-card button:hover, .auth-card .btn:hover { background: var(--spruce-deep); }
@media (prefers-color-scheme: dark) {
  .auth-card button, .auth-card .btn { background: #33594d; }
  .auth-card button:hover, .auth-card .btn:hover { background: #3d6a5c; }
}
.auth-card form[action*="code"] button,
.auth-card .btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.auth-card ul { padding-left: 1.1rem; font-size: 0.92rem; }
.auth-card .errorlist { color: #a83f2e; list-style: none; padding: 0; font-size: 0.9rem; }

.auth-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--fern);
}

/* tiny metadata everywhere */
.meta { font-family: var(--mono); font-size: 0.75rem; color: var(--fern); }

/* --- Automations module ---------------------------------------------------
   Dense readouts (hundreds of entities) inside the same soft-card language as
   the dashboard: the tables carry the data, the cards carry the calm. */
.crumb { margin: 0 0 0.4rem; font-size: 0.9rem; }
.tile-stat {
  margin-top: auto;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
}
.tile-stat small { display: block; font-size: 0.72rem; font-weight: 400; opacity: 0.75; }

.notice {
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--line);
  background: var(--card);
}
.notice-warn { border-left: 4px solid var(--goldfinch); }
.notice .mono { display: block; margin-top: 0.25rem; opacity: 0.8; }

.device {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.device-name { margin: 0; font-size: 1.15rem; display: flex; align-items: baseline; gap: 0.6rem; }
.device-area {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  background: var(--egg);
  color: var(--ink);
}
.device-meta { margin: 0.15rem 0 0.6rem; font-size: 0.82rem; opacity: 0.7; }

.entities { width: 100%; border-collapse: collapse; }
.entities td { padding: 0.45rem 0.3rem; border-top: 1px solid var(--line); vertical-align: top; }
.entities tr:first-child td { border-top: 0; }
.ent-name { font-weight: 500; }
.ent-id { font-size: 0.72rem; opacity: 0.6; }
.ent-state { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ent-state small { opacity: 0.7; }
.ent-actions { text-align: right; white-space: nowrap; }
.ent-actions form { display: inline-flex; gap: 0.3rem; align-items: center; }
.ent-actions button, .advanced button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 0.6rem;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.ent-actions button:hover, .advanced button:hover { background: var(--egg); }
.ent-actions input[type="number"] { width: 4.2rem; font: inherit; font-size: 0.8rem; padding: 0.2rem 0.35rem; }

.attr-row td { border-top: 0; padding-top: 0; }
.attr-row summary { font-size: 0.78rem; opacity: 0.65; cursor: pointer; }
.attrs {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: 0.15rem 0.9rem;
  margin: 0.5rem 0 0.2rem;
  font-size: 0.78rem;
}
.attrs dt { opacity: 0.7; }
.attrs dd { margin: 0; overflow-wrap: anywhere; }

.advanced { margin-top: 1.5rem; }
.advanced summary { cursor: pointer; opacity: 0.75; }
.advanced form { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: end; margin-top: 0.7rem; }
.advanced label { display: flex; flex-direction: column; font-size: 0.78rem; gap: 0.2rem; }
.advanced input { font: inherit; font-size: 0.85rem; padding: 0.3rem 0.45rem; border-radius: 0.5rem; border: 1px solid var(--line); }

@media (max-width: 34rem) {
  .entities td { display: block; }
  .ent-state, .ent-actions { text-align: left; }
}

/* --- Orders ---------------------------------------------------------------- */
.section-head { font-size: 1.05rem; margin: 1.6rem 0 0.6rem; opacity: 0.8; }
.quiet { opacity: 0.6; font-size: 0.9rem; }
.order {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.7rem;
}
.order-done { opacity: 0.72; }
.order-head { display: flex; gap: 0.8rem; align-items: baseline; justify-content: space-between; }
.order-title { font-weight: 600; }
.order-total { white-space: nowrap; font-variant-numeric: tabular-nums; opacity: 0.8; }
.order-meta { margin: 0.15rem 0 0; font-size: 0.82rem; opacity: 0.7; }
.ship { margin: 0.45rem 0 0; font-size: 0.85rem; display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }
.ship-status {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.5rem;
  border-radius: 1rem;
  background: var(--egg);
  color: var(--ink);
}
.ship-carrier, .ship-eta { opacity: 0.7; }
.ship-late .ship-status { background: var(--goldfinch); color: #22423a; }
.ship-late .ship-eta { color: var(--goldfinch); opacity: 1; }

/* --- Search ---------------------------------------------------------------- */
.searchbar { display: flex; gap: 0.5rem; margin: 0 0 1.2rem; }
.searchbar input {
  flex: 1;
  font: inherit;
  padding: 0.5rem 0.8rem;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
}
.searchbar button {
  font: inherit;
  padding: 0.5rem 1rem;
  border-radius: 0.8rem;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.searchbar button:hover { background: var(--egg); }
.hit {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
}
.hit-main { display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline; }
.hit-name { font-weight: 600; }
.hit-state { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hit-meta { margin: 0.2rem 0 0; font-size: 0.78rem; opacity: 0.7; display: flex; gap: 0.45rem; flex-wrap: wrap; }

/* ---- Property picker ----
   One property at a time (never mixed), so this reads as a place you *are*
   rather than a filter you applied. */
.picker {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 1.5rem;
}
.picker-item {
  padding: .35rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--fern);
  text-decoration: none;
  font-size: .9rem;
  line-height: 1.6;
}
.picker-item:hover { border-color: var(--ink); color: var(--bark); text-decoration: none; }
.picker-item.is-current {
  background: var(--spruce);
  border-color: var(--spruce);
  color: #fff;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .picker-item.is-current { background: var(--egg); border-color: var(--egg); color: var(--bark); }
}
/* The admin-only bucket is deliberately quieter than the family's places. */
.picker-system { font-style: italic; }
.picker-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- Roadmap ---------------------------------------------------------------
   A board, but stacked: on a phone the stages read top to bottom in the order
   you actually work them. Closed stages stay visible and stay quiet. */
.rm-add { display: flex; gap: .5rem; margin: 0 0 1.4rem; }
.rm-add input[type="text"] {
  flex: 1;
  font: inherit;
  padding: .5rem .8rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--card);
  color: var(--bark);
}
.rm-add button, .rm-form button {
  font: inherit;
  padding: .5rem 1rem;
  border-radius: .7rem;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.rm-add button:hover, .rm-form button:hover { background: var(--egg); }

.rm-stage { display: flex; flex-direction: column; gap: .5rem; }
.rm-closed { opacity: .6; }
.rm-item {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .9rem;
  padding: .65rem .9rem;
}
.rm-title { flex: 1; text-decoration: none; color: var(--bark); }
.rm-title:hover { text-decoration: underline; }
.rm-id { font-family: var(--mono); font-size: .78rem; opacity: .55; }
.rm-meta { font-size: .78rem; opacity: .6; white-space: nowrap; }
.rm-moves { display: inline-flex; gap: .25rem; }
.rm-moves form { display: inline; }
.rm-moves button {
  font: inherit;
  font-size: .7rem;
  line-height: 1;
  padding: .3rem .45rem;
  border-radius: .5rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.rm-moves button:hover { background: var(--egg); }

.rm-spec { font-size: .8rem; opacity: .7; }
.rm-body { max-width: 42rem; }

/* The transcript is the point of the page: decisions stand out, the
   automatic stage changes recede. */
.rm-note {
  border-left: 3px solid var(--line);
  padding: .1rem 0 .1rem .8rem;
  margin: 0 0 .9rem;
}
.rm-note-decision { border-left-color: var(--goldfinch); }
.rm-note-status { opacity: .6; }
.rm-note-head { margin: 0; font-size: .76rem; display: flex; gap: .6rem; opacity: .75; }
.rm-note-who { font-weight: 600; opacity: .9; }
.rm-note-kind { font-family: var(--mono); }
.rm-note-body { margin: .15rem 0 0; max-width: 42rem; }

.rm-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; max-width: 42rem; }
.rm-form textarea, .rm-form select, .rm-form input[type="text"] {
  font: inherit;
  padding: .5rem .8rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--card);
  color: var(--bark);
}
.rm-form textarea { flex-basis: 100%; resize: vertical; }
.rm-form input[type="text"] { flex: 1; min-width: 12rem; }
.rm-check { font-size: .85rem; display: inline-flex; gap: .35rem; align-items: center; }

/* --- Calendar --------------------------------------------------------------
   A month grid that has to survive a phone: below 40rem it stops pretending to
   be a grid and becomes a list of days. */
.cal-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 .8rem;
}
.cal-nav strong { font-family: var(--display); font-size: 1.2rem; }

.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-grid th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .6;
  padding: .3rem 0;
  text-align: left;
}
.cal-grid td {
  vertical-align: top;
  border: 1px solid var(--line);
  background: var(--card);
  padding: .3rem;
  height: 6rem;
  overflow: hidden;
}
.cal-out { opacity: .4; }
.cal-today { outline: 2px solid var(--goldfinch); outline-offset: -2px; }
.cal-daynum { display: block; font-size: .75rem; opacity: .6; margin-bottom: .15rem; }

.cal-chip {
  display: block;
  font-size: .72rem;
  line-height: 1.25;
  padding: .12rem .3rem;
  margin-bottom: .15rem;
  border-radius: .35rem;
  background: var(--egg);
  overflow-wrap: anywhere;
}
.cal-chip-own { background: transparent; border-left: 3px solid var(--fern); border-radius: 0 .35rem .35rem 0; }
.cal-chip-expiry { border-left: 3px solid var(--goldfinch); background: transparent; border-radius: 0 .35rem .35rem 0; }
.cal-chip small { opacity: .7; }
.cal-time { font-family: var(--mono); font-size: .68rem; opacity: .75; }
/* The other house is a footnote, not a heading. */
.cal-prop { font-style: italic; opacity: .6; }

.cal-attention { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .88rem; }
.cal-overdue { color: #a4331f; font-weight: 600; }
@media (prefers-color-scheme: dark) { .cal-overdue { color: #f0a08c; } }
.cal-overdue-row { border-left: 4px solid #a4331f; }

.cal-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.cal-agenda-day { margin-bottom: .7rem; }
.cal-agenda-date { margin: 0; font-size: .8rem; font-weight: 600; opacity: .7; }
.cal-agenda-item { margin: .1rem 0; display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.cal-agenda-item small { opacity: .65; font-size: .78rem; }

.cal-feed {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .7rem;
  padding: .6rem .8rem;
  font-size: .8rem;
  overflow-wrap: anywhere;
}
.cal-howto { font-size: .9rem; line-height: 1.7; }

.cal-form { max-width: 34rem; }
.cal-form p { margin: 0 0 .8rem; }
.cal-form label { display: block; font-size: .85rem; opacity: .8; margin-bottom: .15rem; }
.cal-form input, .cal-form select, .cal-form textarea {
  font: inherit;
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--card);
  color: var(--bark);
}
.cal-form input[type="checkbox"] { width: auto; }
.cal-form .helptext { font-size: .78rem; opacity: .6; display: block; margin-top: .15rem; }
.cal-form ul.errorlist { margin: .2rem 0; padding-left: 1.1rem; font-size: .82rem; color: #a4331f; }
.cal-form button {
  font: inherit;
  padding: .5rem 1.2rem;
  border-radius: .7rem;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.cal-form button:hover { background: var(--egg); }
.cal-danger { margin-top: 1.5rem; }
.cal-danger button { border-color: #a4331f; color: #a4331f; }
.cal-danger button:hover { background: #a4331f; color: #fff; }

@media (max-width: 40rem) {
  .cal-grid, .cal-grid tbody, .cal-grid tr, .cal-grid td { display: block; width: auto; }
  .cal-grid thead { display: none; }
  .cal-grid td { height: auto; min-height: 0; border-width: 0 0 1px; padding: .45rem .2rem; }
  /* Empty days would be a wall of blank rows on a phone. */
  .cal-grid td:not(:has(.cal-chip)) { display: none; }
  .cal-daynum { display: inline-block; min-width: 2.2rem; font-weight: 600; opacity: .8; }
}

/* --- Workouts --------------------------------------------------------------
   Server-rendered and script-free (BHS-96). The person switcher reuses the
   property picker; the sub-tabs are a quieter underline row beneath it. */
.wo-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1rem; }
.wo-head .picker { margin: 0; }
.wo-tabs {
  display: flex;
  gap: 1.2rem;
  border-bottom: 1px solid var(--line);
  margin: .8rem 0 1.2rem;
  overflow-x: auto;
}
.wo-tab {
  padding: .45rem 0;
  text-decoration: none;
  color: var(--fern);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.wo-tab:hover { color: var(--bark); }
.wo-tab.is-current { color: var(--bark); font-weight: 600; border-bottom-color: var(--goldfinch); }
.wo-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wo-messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.wo-flag {
  font-size: .72rem;
  font-weight: 600;
  padding: .1rem .5rem;
  border-radius: 999px;
  background: var(--goldfinch);
  color: #22423a;
  white-space: nowrap;
}
.wo-needs { border-left: 4px solid var(--goldfinch); }
.wo-items { list-style: none; padding: 0; margin: 0 0 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.wo-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .7rem;
  padding: .5rem .8rem;
}
.wo-item-name { flex: 1; font-weight: 600; }
.wo-item-target { font-variant-numeric: tabular-nums; opacity: .8; white-space: nowrap; }
.wo-setup input[type="text"] {
  font: inherit;
  width: 100%;
  padding: .35rem .55rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--card);
  color: var(--bark);
}
.rm-moves button[disabled] { opacity: .35; cursor: default; }
.wo-form ul { list-style: none; padding: 0; margin: .2rem 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.wo-form ul label { display: inline-flex; gap: .3rem; align-items: center; opacity: 1; font-size: .95rem; }
.wo-form input[type="radio"] { width: auto; }

/* --- Workouts: Today and the live workout (BHS-97) -------------------------
   The List layout and set-entry design A. Big targets, and logged values
   change only inside the bottom sheet — never by brushing a row. */
.wo-rest-pick { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.wo-rest-pick legend { font-weight: 600; margin-bottom: .3rem; }
.wo-rest-choice { display: inline-flex; align-items: center; gap: .25rem; padding: .35rem .7rem; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); }
.wo-rest-choice:has(input:checked) { border-color: var(--ink); background: var(--egg); }
.wo-today-card { margin-bottom: 1.4rem; }
.wo-item-last { font-size: .85rem; color: var(--fern); white-space: nowrap; }
.wo-item-last.is-stale { color: var(--bark); background: var(--goldfinch); border-radius: 999px; padding: 0 .5rem; }
.wo-start, .wo-finish button, .wo-sheet-log {
  display: block; width: 100%; font: inherit; font-weight: 600;
  padding: .85rem 1rem; border-radius: .9rem; border: 0;
  background: var(--spruce); color: #fff; cursor: pointer;
}
.wo-start-empty { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); margin-top: .6rem; }
.wo-session { padding-bottom: 7rem; }
.wo-card { background: var(--card); border: 1px solid var(--line); border-radius: .9rem; margin-bottom: .7rem; }
.wo-card.is-now { border-color: var(--ink); }
.wo-card > details > summary { list-style: none; cursor: pointer; padding: .7rem .9rem; display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.wo-card > details > summary::-webkit-details-marker { display: none; }
.wo-card-name { font-weight: 600; flex: 1; }
.wo-card-setup, .wo-card-last { flex-basis: 100%; font-size: .85rem; color: var(--fern); }
.wo-card > details[open] .wo-card-last { display: none; }
.wo-pill { font-size: .72rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--line); }
.wo-card.is-now .wo-pill { background: var(--spruce); color: #fff; border-color: var(--spruce); }
.wo-card.is-done .wo-pill { background: var(--egg); }
.wo-last { margin: 0 .9rem .6rem; padding: .5rem .7rem; border-radius: .7rem; background: var(--nest); }
.wo-last-head { margin: 0 0 .3rem; font-size: .85rem; font-weight: 600; }
.wo-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; }
.wo-chip { font-variant-numeric: tabular-nums; font-size: .85rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.wo-chip.is-short { background: var(--goldfinch); color: #22423a; border-color: var(--goldfinch); }
.wo-hint { margin: .4rem 0 0; font-size: .9rem; }
.wo-sets { list-style: none; margin: 0; padding: 0 .9rem; display: flex; flex-direction: column; gap: .4rem; }
.wo-set { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.wo-set-nums { flex: 1; text-align: left; font: inherit; background: none; border: 0; padding: .5rem 0; color: var(--bark); cursor: pointer; }
.wo-log { font: inherit; font-weight: 600; min-width: 4.5rem; padding: .55rem .9rem; border-radius: .7rem; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
.wo-set.is-logged { color: var(--spruce); }
.wo-set.is-logged .wo-set-nums { color: inherit; }
.wo-set.is-logged { background: var(--egg); border-radius: .5rem; padding-left: .4rem; padding-right: .4rem; }
.wo-tick { font-weight: 700; color: var(--spruce); padding: 0 .4rem; }
.wo-set.is-pending { opacity: .6; }
.wo-set.is-unsaved { border-left: 4px solid #a4331f; padding-left: .4rem; }
.wo-retry { flex-basis: 100%; font: inherit; font-size: .9rem; text-align: left; color: #a4331f; background: none; border: 0; padding: .2rem 0; cursor: pointer; }
.wo-add-set { font: inherit; margin: .5rem .9rem .9rem; background: none; border: 0; color: var(--ink); cursor: pointer; padding: .4rem 0; }
.wo-finish { margin-top: 1.2rem; }
.wo-sheet { position: fixed; inset: 0; background: rgb(0 0 0 / .35); display: flex; align-items: flex-end; z-index: 20; }
.wo-sheet[hidden] { display: none; }
.wo-sheet-panel { width: 100%; max-width: 36rem; margin: 0 auto; background: var(--card); border-radius: 1.1rem 1.1rem 0 0; padding: 1rem 1rem 1.6rem; display: flex; flex-direction: column; gap: .7rem; }
.wo-sheet-title { margin: 0; font-weight: 600; text-align: center; }
.wo-stepper { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.wo-stepper[hidden], .wo-quick[hidden] { display: none; }
.wo-big { width: 64px; height: 64px; font-size: 2rem; line-height: 1; border-radius: 1rem; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
.wo-stepper-value { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.wo-quick { display: flex; gap: .4rem; justify-content: center; margin: 0; }
.wo-quick button { font: inherit; padding: .45rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--nest); color: var(--bark); cursor: pointer; }
.wo-sheet-remove, .wo-sheet-close { font: inherit; background: none; border: 0; padding: .5rem; cursor: pointer; }
.wo-sheet-remove { color: #a4331f; }
.wo-sheet-close { color: var(--fern); }
.wo-rest { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem .8rem; padding: .6rem 1rem; background: var(--spruce-deep); color: #fff; }
.wo-rest-clock { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.5rem; text-align: center; }
.wo-rest.is-go { background: var(--goldfinch); color: #22423a; }
.wo-rest button { font: inherit; padding: .45rem .75rem; border-radius: .6rem; border: 1px solid rgb(255 255 255 / .5); background: transparent; color: inherit; cursor: pointer; }
.wo-rest-lengths button { font-size: .8rem; padding: .3rem .5rem; }
.wo-rest-lengths button.is-current { background: rgb(255 255 255 / .2); }
.wo-rest-error { flex-basis: 100%; text-align: center; font-size: .85rem; cursor: pointer; }

/* --- Workouts: in-session changes (BHS-98) ---------------------------------
   Reorder (drag handle + always-there up/down forms), skip, add, the setup
   sheet, the prepared-session note, Recent sessions and a past session's date. */
.wo-line { flex-wrap: wrap; }
.wo-line-foot { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.wo-line.is-skipped .wo-item-name, .wo-card.is-skipped .wo-card-name { text-decoration: line-through; opacity: .6; }
.wo-card.is-skipped { opacity: .75; }
.wo-skip-label { font-size: .8rem; font-weight: 600; color: var(--fern); }
.wo-drag {
  font: inherit; font-size: 1.2rem; line-height: 1; padding: .35rem .5rem;
  border: 0; background: none; color: var(--fern); cursor: grab;
  touch-action: none; /* the drag is ours, not a page scroll (iPhone) */
}
.wo-drag[hidden] { display: none; }
[data-card].is-dragging { box-shadow: 0 6px 18px rgb(0 0 0 / .18); position: relative; z-index: 5; }
.wo-card { display: flex; align-items: flex-start; }
.wo-card > details { flex: 1; min-width: 0; }
.wo-card-tools { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .5rem 0 .5rem .4rem; }
.wo-moves { flex-wrap: nowrap; }
.wo-card-setup, .wo-item-setup { font: inherit; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
button.wo-card-setup, .wo-item-setup { color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; }
.wo-item-setup { font-size: .85rem; }
.wo-skip, .wo-reset, .wo-add-open {
  font: inherit; font-size: .85rem; padding: .3rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--bark); cursor: pointer;
}
.wo-card-actions { margin: 0 .9rem .5rem; }
.wo-pill:empty { display: none; }
.wo-card.is-skipped .wo-pill { background: var(--nest); }
.wo-prepared-note { font-size: .9rem; color: var(--fern); margin: .2rem 0 .6rem; }
.wo-change-error { display: block; font: inherit; font-size: .9rem; color: #a4331f; background: none; border: 0; padding: .3rem 0; cursor: pointer; }
.wo-change-error[hidden] { display: none; }
.wo-add { margin: .2rem 0 .8rem; }
.wo-add[hidden], .wo-add-panel[hidden] { display: none; }
.wo-add-panel { margin-top: .5rem; }
.wo-add-search { font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--card); color: var(--bark); }
.wo-add-results { list-style: none; margin: .3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.wo-add-results button { font: inherit; width: 100%; text-align: left; padding: .55rem .7rem; border-radius: .6rem; border: 1px solid var(--line); background: var(--card); color: var(--bark); cursor: pointer; }
.wo-add-results button.is-new { border-color: var(--ink); font-weight: 600; }
.wo-setup-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.wo-setup-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: .4rem; }
.wo-setup-row input { font: inherit; min-width: 0; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--card); color: var(--bark); }
.wo-setup-row button, .wo-setup-add { font: inherit; background: none; border: 0; color: var(--ink); cursor: pointer; padding: .4rem; }
.wo-usual { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.wo-usual input { width: 1.3rem; height: 1.3rem; }
.wo-setup-error { margin: 0; color: #a4331f; font-size: .9rem; }
.wo-setup-error[hidden] { display: none; }
.wo-start-empty-row { margin-top: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.wo-date-pick, .wo-date-edit label { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .9rem; }
.wo-date-pick input, .wo-date-edit input { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--card); color: var(--bark); }
.wo-date-edit { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.wo-date-edit button { font: inherit; padding: .35rem .8rem; border-radius: .6rem; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; }
.wo-date-edit button[hidden] { display: none; }
.wo-recent { margin-top: 2rem; }
.wo-recent-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }

/* --- Workouts: Progress (BHS-100) --------------------------------------------
   Read-only and script-free. The graph is server-rendered inline SVG
   (workouts/progress.py); its colours come from the palette here, so it
   follows dark mode with the rest of the page. */
.wo-progress-list .wo-item-name { text-decoration: none; color: var(--bark); }
.wo-progress-list .wo-item-name:hover { text-decoration: underline; }
.wo-metrics { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0 .6rem; }
.wo-metric {
  padding: .3rem .8rem; border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--fern); text-decoration: none; font-size: .9rem;
}
.wo-metric.is-current { border-color: var(--ink); background: var(--egg); color: var(--bark); font-weight: 600; }
.wo-metric:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wo-graph-wrap { margin: 0 0 1rem; background: var(--card); border: 1px solid var(--line); border-radius: .9rem; padding: .6rem .6rem .4rem; }
.wo-graph-wrap figcaption { margin: .2rem .3rem 0; }
.wo-graph { display: block; width: 100%; height: auto; }
.wo-graph-grid { stroke: var(--line); stroke-width: 1; }
.wo-graph-axis { fill: var(--fern); font-family: var(--body); font-size: 14px; font-variant-numeric: tabular-nums; }
.wo-graph-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.wo-graph-gap { stroke: var(--fern); stroke-width: 2; }
.wo-graph-point { fill: var(--goldfinch); stroke: var(--ink); stroke-width: 1.5; }
.wo-headline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0 0 1rem; }
.wo-headline > div { background: var(--card); border: 1px solid var(--line); border-radius: .7rem; padding: .5rem .7rem; }
.wo-headline dt { font-size: .78rem; color: var(--fern); }
.wo-headline dd { margin: 0; font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.wo-progress-session { background: var(--card); border: 1px solid var(--line); border-radius: .7rem; padding: .5rem .8rem; margin-bottom: .5rem; }
.wo-progress-when { margin: 0; font-weight: 600; display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.wo-progress-block { margin-top: .35rem; }
.wo-progress-block .wo-card-setup { margin: 0 0 .2rem; }

/* --- Workouts: the schedule and today's plan (BHS-99) -----------------------
   Script-free. Six workout colours from the palette (wk-c0..wk-c5): a
   workout's colour is its position among its owner's workouts by id, mod 6.
   The rule form shows only the fields its repeat choice uses (:has; with no
   :has support every field simply stays visible). */
.wk-c0 { background: var(--spruce); color: #fff; }
.wk-c1 { background: var(--goldfinch); color: #22423a; }
.wk-c2 { background: var(--egg); color: var(--bark); }
.wk-c3 { background: var(--fern); color: var(--nest); }
.wk-c4 { background: var(--spruce-deep); color: var(--goldfinch); }
.wk-c5 { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.wk-grid .cal-chip { font-weight: 600; }
.wk-dow { display: none; }
.wk-subnav { display: flex; gap: 1rem; margin: 0 0 .4rem; font-size: .92rem; }
.wk-subnav a { color: var(--fern); text-decoration: none; }
.wk-subnav a.is-current { color: var(--bark); font-weight: 600; }
.wk-subnav a:hover { text-decoration: underline; }
.wk-rule { background: var(--card); border: 1px solid var(--line); border-radius: .9rem; padding: .7rem .9rem; margin-bottom: .8rem; }
.wk-rule-head { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.wk-rule-head a { color: var(--bark); }
.wk-swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 50%; flex: none; }
.wk-rule-form { margin-top: .6rem; }
.wk-rule-form fieldset { border: 0; padding: 0; margin: 0 0 .7rem; }
.wk-rule-form legend { font-size: .85rem; opacity: .8; margin-bottom: .25rem; }
.wk-days { display: flex; flex-wrap: wrap; gap: .3rem; }
.wk-days legend { flex-basis: 100%; }
.cal-form .wk-day { position: relative; display: inline-flex; margin: 0; opacity: 1; font-size: .95rem; }
.cal-form .wk-day input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer; }
.wk-day span[aria-hidden] {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--card); color: var(--bark); font-weight: 600;
}
.wk-day input:checked + span[aria-hidden] { background: var(--spruce); border-color: var(--spruce); color: #fff; }
.wk-day input:focus-visible + span[aria-hidden] { outline: 2px solid var(--focus); outline-offset: 2px; }
.wk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wk-kind { display: flex; flex-wrap: wrap; gap: .4rem; }
.wk-kind legend { flex-basis: 100%; }
.cal-form .wk-kind-choice {
  display: inline-flex; align-items: center; gap: .3rem; margin: 0; opacity: 1; font-size: .95rem;
  padding: .35rem .7rem; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card);
}
.cal-form .wk-kind-choice:has(input:checked) { border-color: var(--ink); background: var(--egg); }
.cal-form .wk-kind-choice input { width: auto; }
.wk-every { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.cal-form .wk-every input { max-width: 11rem; }
.wk-rule-form:has(input[value="every_n_days"]:checked) .wk-days { display: none; }
.wk-rule-form:has(input[name="kind"]:checked):not(:has(input[value="every_n_days"]:checked)) .wk-every { display: none; }
.wk-remove { margin-top: .3rem; }
.wk-remove button { font: inherit; font-size: .85rem; background: none; border: 0; padding: .3rem 0; color: #a4331f; cursor: pointer; }
@media (prefers-color-scheme: dark) { .wk-remove button { color: #f0a08c; } }
.wk-legend { list-style: none; padding: 0; margin: .8rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.wk-legend .cal-chip { display: inline-block; margin: 0; padding: .2rem .6rem; font-size: .85rem; }
.wo-plan-head { font-family: var(--display); font-size: 1.25rem; font-weight: 600; margin: .4rem 0 .2rem; }
.wo-swap { margin: .4rem 0 1rem; }
.wo-swap > summary { cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; padding: .4rem 0; }
.wo-swap[open] > summary { margin-bottom: .6rem; }
@media (max-width: 40rem) {
  .wk-dow { display: inline; }
}
