/* An agent chat's space (269): the agent bar at the bottom of an agent chat and the pages it opens.
 * Only app.css's tokens, never a value of its own for a color; the numbers are read first, big and
 * tabular, the way Align's Today and Progress draw them. docs/design/cloud-space-pages.md says what
 * each piece is. */

/* ---------- the agent bar ---------- */
/* the bar's lift above the safe area, which spaces.js sets on #app while a bar shows */
.app { --agent-bar-h: 0px; }
/* The slot is the last child of the chat column (268's #space-slot), laid over the column's bottom
 * so the chat scrolls under the glass. Only the bar itself takes touches. */
#shell .col:has(> .space-slot) { position: relative; }
.space-slot {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 22;
  display: flex; justify-content: center;
  padding: 0 16px max(10px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.space-slot:empty { display: none; }
.ab { pointer-events: auto; width: min(100%, calc(var(--n) * 84px + 12px)); }
.ab-track {
  position: relative;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  height: 62px; padding: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--raised) 68%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.8);
  backdrop-filter: blur(22px) saturate(1.8);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38), 0 1px 0 color-mix(in srgb, var(--text) 7%, transparent) inset;
}
/* the selected page's pill, one shape that slides between items */
.ab-pill {
  position: absolute; top: 5px; bottom: 5px; left: 5px;
  width: calc((100% - 10px) / var(--n));
  transform: translateX(calc(var(--sel, 0) * 100%));
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 13%, transparent);
  transition: transform 280ms cubic-bezier(0.23, 1, 0.32, 1);
}
.ab-item {
  position: relative; z-index: 1;
  display: grid; place-items: center; min-width: 44px; min-height: 44px;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-2);
  transition: color 160ms ease-out;
}
.ab-item svg.i { width: 26px; height: 26px; stroke-width: 1.45; transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1); }
.ab-item[aria-current="page"] { color: var(--text); }
@media (hover: hover) and (pointer: fine) { .ab-item:not([aria-current="page"]):hover { color: var(--text); } }
.ab-item:active svg.i { transform: scale(0.88); }
.ab-item:focus-visible { outline-offset: -3px; border-radius: 999px; }
@media (prefers-color-scheme: light) {
  .ab-track {
    background: color-mix(in srgb, var(--raised) 76%, transparent);
    border-color: color-mix(in srgb, var(--text) 8%, transparent);
    box-shadow: 0 8px 26px rgba(20, 20, 20, 0.13), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  }
  .ab-pill { background: color-mix(in srgb, var(--text) 8%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .ab-pill, .ab-item svg.i { transition: none; }
}

/* ---------- a page's view ---------- */
.sp-view { min-height: 100%; padding-bottom: calc(var(--agent-bar-h, 0px) + max(10px, env(safe-area-inset-bottom)) + 28px); }
/* the app's native bar (bridge mode) sits under the page to the screen's edge (262b) */
[data-edges] .sp-view { padding-bottom: calc(var(--agent-bar-h, 0px) + env(safe-area-inset-bottom) + 28px); }
.sp-top {
  display: flex; align-items: center; gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 16px 4px;
  max-width: calc(var(--col) + 40px); margin: 0 auto;
}
.sp-back { display: none; }
.sp-who {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 0;
  padding: 4px 12px 4px 6px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-2); font-size: 14.5px; font-weight: 600;
  transition: background 140ms ease-out;
}
.sp-who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .sp-who:hover { background: var(--hover); } }
.sp-inner { max-width: calc(var(--col) + 40px); margin: 0 auto; padding: 4px 20px 0; }
.sp-h1 {
  margin: 4px 0 18px; font-size: 34px; line-height: 1.1; font-weight: 750; letter-spacing: -0.025em;
  text-wrap: balance;
}
.sp-h1:empty { display: none; }
.sp-els { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sp-el { grid-column: 1 / -1; min-width: 0; }
.sp-el.sp-t-stat:not(.sp-wide) { grid-column: auto; }

.sp-card {
  background: var(--card); border-radius: 22px; padding: 16px 18px;
  min-width: 0;
}
.sp-sk { animation: skpulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .sp-sk { animation: none; } }
.sp-label { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.sp-h2 { margin: 14px 2px 0; font-size: 20px; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.sp-empty { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.sp-els > .sp-empty { padding: 4px 2px; }
.sp-err { margin: 6px 0 0; color: var(--err); font-size: 14px; }
.sp-sub { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* numbers: the value big and bold, the unit after it, quieter */
.sp-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-num .sp-v { font-weight: 700; letter-spacing: -0.02em; }
.sp-num .sp-u { color: var(--muted); font-weight: 550; font-size: 0.42em; letter-spacing: 0; }
.sp-num.big { font-size: 40px; line-height: 1.05; }
.sp-num.big .sp-v { letter-spacing: -0.035em; }
.sp-delta { margin: 6px 0 0; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.sp-delta.up::first-letter, .sp-delta.down::first-letter { font-weight: 700; }

.sp-track { height: 9px; border-radius: 99px; background: var(--track); overflow: hidden; margin-top: 8px; }
.sp-track.thin { height: 6px; }
.sp-fill { display: block; height: 100%; width: calc(var(--p, 0) * 100%); border-radius: inherit; background: var(--text); }
.sp-track.reached .sp-fill { background: var(--add); }

/* rings: Activity-style, the legend's numbers first */
.sp-rings { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; gap: 20px; }
.sp-ring-svg { width: 132px; height: 132px; display: block; }
.sp-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp-leg { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; align-items: start; }
.sp-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.sp-leg-txt { display: flex; flex-direction: column; min-width: 0; }
.sp-leg-label { font-size: 13px; color: var(--muted); line-height: 1.3; }
.sp-leg-nums { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.35; }
.sp-leg-nums b { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }

.sp-bars, .sp-goals { display: grid; gap: 14px; }
.sp-goals { list-style: none; margin: 0; padding: 0; }
.sp-bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sp-bar-label { min-width: 0; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-bar-nums { flex: none; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-bar-nums b { font-size: 15px; color: var(--text); font-weight: 700; }
.sp-goal .sp-row-time { display: block; margin-top: 6px; }
.sp-goal.done .sp-bar-label { color: var(--text-2); }
.sp-done { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--cl-high-tx); }
.sp-done svg.i { width: 13px; height: 13px; stroke-width: 2.2; }

/* charts: inline SVG, the latest value in the head */
.sp-chart-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; }
.sp-chart-head .sp-delta, .sp-chart-head .sp-sub { margin: 0; }
.sp-chart { display: block; width: 100%; height: 132px; overflow: visible; }
.sp-chart .sp-grid { stroke: var(--divider); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sp-chart .sp-goal { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.sp-chart .sp-line { fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.sp-chart .sp-line-end { fill: var(--accent); stroke: var(--card); stroke-width: 2.5; }
.sp-chart .sp-col { fill: var(--text); opacity: 0.32; }
.sp-chart .sp-col.last { opacity: 1; }
.sp-chart .sp-col.over { fill: var(--warn); opacity: 0.6; }
.sp-chart .sp-col.over.last { opacity: 1; }
.sp-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-axis-all { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); text-align: center; }
.sp-axis-all span { overflow: hidden; text-overflow: clip; white-space: nowrap; }

/* streak: weeks across, weekdays down */
.sp-cal {
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(7, auto); grid-template-columns: repeat(var(--weeks), minmax(0, 1fr));
  gap: 4px; max-width: calc(var(--weeks) * 24px);
}
.sp-day { aspect-ratio: 1; border-radius: 4px; background: var(--track); }
.sp-day.on { background: var(--accent); }
.sp-day.pad { visibility: hidden; }

/* notes (337908): one note after another, full text, never truncated */
.sp-note-ls { list-style: none; margin: 0; padding: 0; }
.sp-note { padding: 12px 0; border-top: 1px solid var(--divider); }
.sp-note:first-child { border-top: 0; padding-top: 2px; }
.sp-note-text { margin: 0; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

/* planning tasks (337908): the checklist rows, with a muted due day under the label */
.sp-tasks .sp-check { align-items: flex-start; }
.sp-task-due { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* calendar (337908): the month as a grid, and what is coming up under it */
.sp-cal-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.sp-cal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.sp-calendar {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px; margin-bottom: 14px;
}
.sp-cal-wd { font-size: 12px; color: var(--muted); text-align: center; padding: 2px 0; font-variant-numeric: tabular-nums; }
.sp-cal-cell {
  position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--track); min-width: 0;
}
.sp-cal-cell.pad { visibility: hidden; }
.sp-cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.sp-cal-num { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sp-cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 3px; }
.sp-upcoming .sp-rows { margin-top: 2px; }
.sp-cal-when { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }

/* calendar views (339): the Day/Week/Month/Planner switch and a day/week nav line, drawn in the page's tokens;
   a Planner row's kind marks a task as a task, never as an event. The switch reuses the training segments' look
   but flows its own options, so it never assumes a fixed count. */
.sp-cal-views { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--track); margin: 0 0 16px; width: fit-content; max-width: 100%; }
.sp-cal-views .sp-seg-opt { flex: 1 1 auto; }
.sp-cal-nav { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; }
.sp-cal-nav-title { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-cal-nav .round-btn { width: 32px; height: 32px; font-size: 15px; line-height: 1; }
.sp-row-group { border-top: 1px solid var(--divider); margin-top: 4px; padding-top: 12px; }
.sp-row-group:first-child { border-top: 0; padding-top: 0; }
.sp-cal-kind { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* records as rows */
.sp-rows, .sp-checks { list-style: none; margin: 0; padding: 0; }
.sp-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--divider); }
.sp-row:first-child { border-top: 0; padding-top: 2px; }
.sp-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sp-row-title { font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-row-sub { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-row-time { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-row .sp-thumb { width: 48px; height: 48px; flex: none; border-radius: 10px; }
.sp-table td.pic { padding-top: 5px; padding-bottom: 5px; width: 32px; }
.sp-table td.pic .sp-thumb { width: 32px; height: 32px; border-radius: 7px; }

.sp-table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.sp-table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.sp-table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 12px 8px 0; white-space: nowrap; }
.sp-table td { padding: 9px 12px 9px 0; border-top: 1px solid var(--divider); white-space: nowrap; }
.sp-table .num { text-align: right; }
.sp-table td.when { color: var(--muted); }

/* a checklist: a tap writes the record */
.sp-check {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 0;
  border: 0; background: transparent; color: var(--text); text-align: left; font-size: 15.5px;
}
.sp-checks li + li .sp-check { border-top: 1px solid var(--divider); }
.sp-box {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 8px; border: 2px solid var(--line-2); color: transparent;
  transition: background 140ms ease-out, border-color 140ms ease-out, transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}
.sp-box svg.i { width: 15px; height: 15px; stroke-width: 2.4; }
.sp-check.on .sp-box { background: var(--add); border-color: var(--add); color: var(--on-accent); }
.sp-check.on .sp-check-label { color: var(--muted); }
.sp-check:active .sp-box { transform: scale(0.9); }

/* a log form */
.sp-log { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sp-fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sp-fld label { font-size: 13px; font-weight: 600; color: var(--muted); }
.sp-fld.bool { flex-direction: row; align-items: center; gap: 10px; min-height: 44px; }
.sp-fld.bool label { font-size: 15px; color: var(--text); font-weight: 500; }
.sp-in {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--text);
  font-size: 16px; font-variant-numeric: tabular-nums;
}
.sp-in:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(63, 119, 193, 0.22); }
.sp-hum { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.sp-hum-in {
  width: 100%; min-height: 150px; padding: 12px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.5; resize: vertical;
}
.sp-hum-in:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(63, 119, 193, 0.22); }
.sp-hum .sp-send { margin-top: 0; }
.sp-hum-under { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.sp-tog { width: 22px; height: 22px; accent-color: var(--add); }
.sp-log-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.sp-log-acts .btn.small { height: 40px; padding: 0 16px; font-size: 14.5px; border-radius: 12px; }
.sp-scan svg.i { width: 17px; height: 17px; }
.sp-log-note { grid-column: 1 / -1; margin: 0; font-size: 14px; color: var(--text-2); }
.sp-log-note.err { color: var(--err); }

/* a send to the space's chat (a meal scan, an action, an accepted idea): its status, inline */
.sp-send { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-top: 10px; font-size: 14px; line-height: 1.4; color: var(--text-2); }
.sp-send[hidden] { display: none; }
.sp-log .sp-send { grid-column: 1 / -1; margin-top: 0; }
.sp-send.err { color: var(--err); }
.sp-send .sp-send-again { height: 44px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.sp-send-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; animation: sp-send-pulse 1.1s ease-in-out infinite; }
@keyframes sp-send-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .sp-send-dot { animation: none; } }
.sp-idea .sp-send { margin-left: 40px; }

/* photos */
.sp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; margin: 0 -6px; }
.sp-thumb {
  display: block; aspect-ratio: 1; width: 100%; padding: 0; overflow: hidden;
  border: 0; border-radius: 10px; background: var(--track);
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}
.sp-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sp-thumb:active { transform: scale(0.97); }

/* a countdown */
.sp-timer-face { display: flex; align-items: baseline; }
.sp-timer-num { font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.sp-timer-acts { display: flex; gap: 8px; margin-top: 14px; }
.sp-timer-acts .btn.small { height: 40px; min-width: 88px; font-size: 14.5px; border-radius: 12px; }
.sp-timer-acts:empty, .sp-t-timer .sp-sub:empty { display: none; }
.sp-t-timer .sp-sub { margin-top: 6px; font-size: 14.5px; color: var(--text-2); }

/* the rest a logged set started (324), docked over the page's bottom while its card is scrolled away:
 * one row like the agent bar's, in the Align app's order: the time left, the draining bar, +30 s, Skip. Its fill is
 * opaque (324b): the cards scroll under it, and through glass their text read behind "0:00" ("0:00 ank") */
.sp-dock {
  position: sticky; z-index: 21;
  bottom: calc(var(--agent-bar-h, 0px) + max(10px, env(safe-area-inset-bottom)) + 2px);
  max-width: calc(var(--col) + 40px); margin: 14px auto 0; padding: 0 16px;
  transition: opacity 200ms cubic-bezier(0.23, 1, 0.32, 1), transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
@starting-style { .sp-dock { opacity: 0; transform: translateY(8px); } }
[data-edges] .sp-dock { bottom: calc(var(--agent-bar-h, 0px) + env(safe-area-inset-bottom) + 10px); }
.sp-dock-row {
  display: flex; align-items: center; gap: 12px;
  max-width: 520px; height: 64px; margin: 0 auto; padding: 0 8px 0 20px; border-radius: 999px;
  background: var(--raised-2);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38), 0 1px 0 color-mix(in srgb, var(--text) 7%, transparent) inset;
}
.sp-dock-read { flex: none; display: flex; flex-direction: column; line-height: 1.1; min-width: 56px; }
.sp-dock-word { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sp-dock-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sp-dock-track { flex: 1; min-width: 24px; margin-top: 0; }
.sp-dock-track .sp-fill { background: var(--text-2); }
.sp-dock-acts { flex: none; display: flex; align-items: center; gap: 4px; }
.sp-dock-btn {
  min-height: 44px; min-width: 56px; padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background 140ms ease-out;
}
.sp-dock-btn.add { background: color-mix(in srgb, var(--text) 10%, transparent); }
@media (hover: hover) and (pointer: fine) { .sp-dock-btn:hover { background: color-mix(in srgb, var(--text) 14%, transparent); } }
.sp-dock-btn:active { transform: scale(0.97); }
@media (prefers-color-scheme: light) {
  .sp-dock-row {
    background: var(--raised);
    border-color: color-mix(in srgb, var(--text) 8%, transparent);
    box-shadow: 0 8px 26px rgba(20, 20, 20, 0.13), 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  }
  .sp-dock-btn.add { background: color-mix(in srgb, var(--text) 7%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .sp-dock { transition: opacity 200ms ease-out; } @starting-style { .sp-dock { transform: none; } } }
@media (max-width: 370px) { .sp-dock-row { gap: 8px; padding-left: 16px; } .sp-dock-btn { padding: 0 10px; min-width: 48px; } }
/* the runner's Undo toast stands above the dock while both show, so neither covers the other. It is fixed to the
 * screen and the dock is sticky in the page's scroller, which in the app ends above the native bar's inset, so no one
 * offset from the bottom suits both (324b: in the app the toast sat on the dock). Where anchors work, the toast's
 * bottom is the dock's own top, 12px clear. Where they don't (older WebKit in the app, older browsers), an offset:
 * the dock's 64px row over its own bottom, plus 12px. In the app ([data-edges]) that bottom is counted from the
 * scroller's, itself the safe area above the screen's (measured on iOS 26.5: inset 83px, dock at 93px in the
 * scroller, 176px from the screen's bottom), so the safe area counts twice there. */
.sp-dock-row { anchor-name: --sp-dock; }
@supports (anchor-name: --a) {
  body:has(#space-view .sp-dock:not([hidden])) .sp-wk-toast { position-anchor: --sp-dock; bottom: calc(anchor(top) + 12px); }
}
@supports not (anchor-name: --a) {
  body:has(#space-view .sp-dock:not([hidden])) .sp-wk-toast { bottom: calc(var(--agent-bar-h, 0px) + max(12px, env(safe-area-inset-bottom)) + 88px); }
  [data-edges] body:has(#space-view .sp-dock:not([hidden])) .sp-wk-toast { bottom: calc(var(--agent-bar-h, 0px) + 2 * env(safe-area-inset-bottom) + 86px); }
}

/* an action: sends its prompt to the chat */
.sp-action {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--text);
  font-size: 15.5px; font-weight: 600;
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1), background 140ms ease-out;
}
.sp-action svg.i { width: 18px; height: 18px; color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .sp-action:hover { background: var(--hover-2); } }
.sp-action:active { transform: scale(0.98); }
.sp-action:disabled { color: var(--muted); }

/* the built-in pages: Feed's posts and Ideas' cards */
.sp-feed { display: grid; gap: 12px; }
.sp-by { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sp-by-name { font-size: 14px; font-weight: 650; }
.sp-by-time { font-size: 13px; color: var(--muted); }
.sp-post-title { margin: 0 0 4px; font-size: 17.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; text-wrap: balance; }
.sp-note.a-body p, .sp-note.a-body li { font-size: 16px; line-height: 1.6; }
.sp-note.a-body p { margin: 0 0 8px; }
.sp-note.a-body > :first-child { margin-top: 0; }
.sp-note.a-body > :last-child { margin-bottom: 0; }
.sp-post-img { margin-top: 10px; }
.sp-post-img .sp-thumb { aspect-ratio: 4 / 3; border-radius: 14px; }
.sp-idea-head { display: flex; align-items: flex-start; gap: 10px; }
.sp-idea-ic {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); margin-top: -2px;
}
.sp-idea-ic svg.i { width: 17px; height: 17px; }
.sp-idea .sp-note { margin-left: 40px; color: var(--text-2); }
.sp-idea-acts { display: flex; gap: 8px; margin: 12px 0 0 40px; }
.sp-idea-acts .btn.small { height: 38px; padding: 0 16px; font-size: 14.5px; border-radius: 12px; }
.sp-idea.accepted, .sp-idea.dismissed { opacity: 0.72; }
.sp-tag { display: inline-block; margin: 10px 0 0 40px; font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* the workout runner (323): one card per exercise, as the Align app's logbook draws it. The open card's current set
 * sits on a band with its values in wells; logged sets carry the accent's check, a PR its --warn tag. */
.sp-wk { display: grid; gap: 12px; }
.sp-wk-ex.open { padding-bottom: 16px; }
.sp-wk-head {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0;
  border: 0; background: transparent; color: var(--text); text-align: left;
}
.sp-wk-head .sp-wk-name { flex: 1; min-width: 0; }
.sp-wk-name { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; text-wrap: balance; }
.sp-wk-ex.open .sp-wk-name { font-size: 26px; letter-spacing: -0.025em; }
.sp-wk-tag {
  flex: none; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-tx);
  font-size: 12.5px; font-weight: 650;
}
.sp-wk-of { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-wk-fold-sub { flex: none; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-wk-ex.folded { padding-top: 10px; padding-bottom: 10px; }
.sp-wk-ex.folded.done .sp-wk-name { color: var(--text-2); }
@media (hover: hover) and (pointer: fine) { .sp-wk-ex.folded:hover { background: var(--hover-2); } }
.sp-wk-metarow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 4px; }
.sp-wk-meta { margin: 0; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-wk-none .sp-wk-meta { margin-top: 6px; }
.sp-wk-count { flex: none; font-size: 15px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sp-wk-segs { display: flex; gap: 4px; margin: 14px 0 6px; }
.sp-wk-segs span { flex: 1; height: 3px; border-radius: 2px; background: var(--track); }
.sp-wk-segs span.on { background: var(--text); }

.sp-wk-sets { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 8px; font-variant-numeric: tabular-nums; }
.sp-wk-sets th { padding: 6px 4px 4px; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sp-wk-sets td { height: 48px; padding: 0 4px; font-size: 16px; }
.sp-wk-sets .n { width: 36px; padding-left: 10px; font-weight: 600; }
.sp-wk-sets td.prev { color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.sp-wk-sets.no-prev .prev { color: transparent; }
.sp-wk-sets .w { width: 74px; }
.sp-wk-sets .r { width: 58px; }
.sp-wk-sets .s { width: 76px; padding-right: 10px; text-align: right; white-space: nowrap; }
.sp-wk-sets tr.done { cursor: pointer; }
.sp-wk-sets tr.done td { color: var(--text-2); }
.sp-wk-sets tr.done td.prev { color: var(--muted); }
.sp-wk-sets tr.done:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; border-radius: 12px; }
@media (hover: hover) and (pointer: fine) { .sp-wk-sets tr.done:hover td { background: var(--hover-2); } .sp-wk-sets tr.done:hover td:first-child { border-radius: 12px 0 0 12px; } .sp-wk-sets tr.done:hover td:last-child { border-radius: 0 12px 12px 0; } }
.sp-wk-sets tr.up td { color: var(--muted); }
/* the current set's band: the row, its steppers and an edit's buttons read as one shape */
.sp-wk-cur td, .sp-wk-steprow td, .sp-wk-editrow td { background: color-mix(in srgb, var(--text) 6%, transparent); }
.sp-wk-cur td { height: 58px; }
.sp-wk-cur td:first-child { border-top-left-radius: 16px; }
.sp-wk-cur td:last-child { border-top-right-radius: 16px; }
.sp-wk-steprow td, .sp-wk-editrow td { border-radius: 0 0 16px 16px; }
.sp-wk-steprow:has(+ .sp-wk-editrow) td { border-radius: 0; }
.sp-wk-steprow td { height: auto; padding: 0 10px 10px; }
.sp-wk-editrow td { height: auto; padding: 0 10px 12px; }
.sp-wk-in {
  width: 100%; height: 42px; padding: 0 8px; border: 0; border-radius: 12px;
  background: var(--bg); color: var(--text); font-size: 20px; font-weight: 650; text-align: center;
  font-variant-numeric: tabular-nums; caret-color: var(--accent);
}
.sp-wk-in:focus { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.sp-wk-ok {
  display: inline-grid; place-items: center; width: 28px; height: 28px; vertical-align: middle;
  border-radius: 50%; border: 2px solid var(--line-2); color: transparent;
}
.sp-wk-ok svg.i { width: 15px; height: 15px; stroke-width: 2.4; }
.sp-wk-ok.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.sp-wk-head .sp-wk-ok { flex: none; width: 24px; height: 24px; }
.sp-wk-pr {
  display: inline-block; margin-right: 6px; padding: 2px 7px; border-radius: 999px; vertical-align: middle;
  background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn);
  font-size: 12px; font-weight: 750; letter-spacing: 0.02em;
}
.sp-wk-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-wk-step-group { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sp-wk-step-name { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.sp-wk-step {
  flex: none; width: 52px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 12px; background: var(--bg); color: var(--text);
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), background 120ms ease-out;
}
.sp-wk-step svg.i { width: 18px; height: 18px; stroke-width: 2; }
.sp-wk-step:active { transform: scale(0.94); background: var(--hover-2); }
.sp-wk-log { width: 100%; height: 52px; margin-top: 12px; border-radius: 16px; font-size: 16.5px; font-variant-numeric: tabular-nums; }
.sp-wk-log:disabled { opacity: 0.5; }
.sp-wk-err { margin: 8px 0 0; }
.sp-wk-edit { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-wk-edit .btn.small { height: 40px; padding: 0 16px; font-size: 14.5px; border-radius: 12px; }
.sp-wk-edit .sp-wk-remove { color: var(--err); }
.sp-wk-edit .sp-err { flex-basis: 100%; margin: 0; }
.sp-wk-more {
  display: block; min-height: 44px; margin-top: 6px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--accent-tx); font-size: 15px; font-weight: 600;
}
.sp-wk-add svg.i { color: var(--text-2); }
.sp-wk-names { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sp-wk-name-opt {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text); font-size: 15px;
}
/* The set's target feel (align parity, slice 2): a segmented RPE 6 to 10 on the band, and the set's own tag on a
   logged row. The feel chips and the library's equipment hints use the same tokens; nothing here is a color value. */
.sp-wk-rperow td { height: auto; padding: 0 10px 12px; border-radius: 0 0 16px 16px; }
.sp-wk-rperow:has(+ .sp-wk-editrow) td { border-radius: 0; }
.sp-wk-rpe-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sp-wk-rpe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.sp-wk-rpe-opt {
  height: 40px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--text-2); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1), background 120ms ease-out;
}
.sp-wk-rpe-opt:active { transform: scale(0.94); }
.sp-wk-rpe-opt.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.sp-wk-rpe-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-tx);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.01em; vertical-align: middle;
}
.sp-wk-name-equip { display: block; font-size: 12px; font-weight: 450; color: var(--muted); }
.sp-wk-feel { margin-top: 16px; }
.sp-wk-feel-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sp-wk-feel-opt {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--text-2); font-size: 15px; font-weight: 600;
}
.sp-wk-feel-opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-tx); }

.sp-wk-name-opt.new { border-style: dashed; color: var(--accent-tx); }
.sp-wk-pick-acts { display: flex; justify-content: flex-end; margin-top: 12px; }
.sp-wk-pick-acts .btn.small { height: 40px; padding: 0 16px; font-size: 14.5px; border-radius: 12px; }
/* Undo, for 4 seconds after a log: fixed above the agent bar and the safe area, centred on the workout's column (its
 * --wk-mid, which drawWorkout measures as it shows) */
.sp-wk-toast {
  position: fixed; z-index: 30; left: var(--wk-mid, 50%); bottom: calc(var(--agent-bar-h, 0px) + max(12px, env(safe-area-inset-bottom)) + 12px);
  display: flex; align-items: center; gap: 14px; padding: 6px 6px 6px 18px; transform: translateX(-50%);
  border-radius: 999px; background: var(--raised-2); color: var(--text); box-shadow: var(--shadow);
  border: 1px solid var(--line); font-size: 15px; font-weight: 600; white-space: nowrap;
  animation: sp-wk-toast-in 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.sp-wk-undo { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--hover-2); color: var(--accent-tx); font-size: 15px; font-weight: 700; }
@keyframes sp-wk-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) {
  .sp-wk-toast { animation-name: sp-wk-fade; }
  .sp-wk-step { transition: none; }
}
@keyframes sp-wk-fade { from { opacity: 0; } }

/* the session (334): Today's workout card, the clock at the Workout page's top, Finish and the summary sheet */
.sp-wkc { padding: 20px 20px 18px; }
.sp-wkc-title { font-size: 22px; letter-spacing: -0.02em; }
.sp-wkc-lines { display: grid; gap: 2px; margin-top: 4px; }
.sp-wkc-l2 { margin: 0; font-size: 15px; color: var(--text-2); line-height: 1.4; }
.sp-wkc-clock, .sp-wk-sess-clock { margin: 2px 0 0; font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sp-wk-sess-clock.idle { color: var(--muted); }
.sp-wkc-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.sp-wkc-acts .btn, .sp-wk-session .btn { height: 48px; padding: 0 22px; border-radius: 999px; font-size: 16px; }
.sp-wkc-go svg.i, .sp-wk-start svg.i { width: 15px; height: 15px; }
.sp-wkc-acts .sp-err { flex-basis: 100%; margin: 0; }
.sp-wk-session { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sp-wk-sess-text { min-width: 0; }
.sp-wk-sess-text .sp-wk-meta { margin-top: 2px; }
.sp-wk-session[data-state="ready"] .sp-wk-sess-clock { font-size: 28px; }
.sp-wk-sess-done { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sp-wk-session .btn { flex: none; }
.sp-wk-finish { width: 100%; height: 52px; border-radius: 16px; font-size: 16.5px; }
.sp-wk-sheetwrap { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; justify-items: center; }
.sp-wk-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.42); animation: sp-wk-fade 200ms ease-out; }
.sp-wk-sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; overscroll-behavior: contain;
  padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0;
  background: var(--raised); color: var(--text); box-shadow: var(--shadow);
  animation: sp-wk-sheet-in 240ms cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes sp-wk-sheet-in { from { opacity: 0; transform: translateY(24px); } }
@media (min-width: 761px) {
  .sp-wk-sheetwrap { align-items: center; }
  .sp-wk-sheet { border-radius: 26px; padding-bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) { .sp-wk-sheet { animation-name: sp-wk-fade; } }
.sp-wk-sheet-sub { margin: 0; font-size: 13.5px; color: var(--muted); }
.sp-wk-sheet-title { margin: 2px 0 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.sp-wk-sheet-dur { margin: 10px 0 0; font-size: 48px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sp-wk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0 4px; border-block: 1px solid var(--line); }
.sp-wk-stat { display: grid; gap: 2px; padding: 12px 10px; min-width: 0; }
.sp-wk-stat + .sp-wk-stat { border-left: 1px solid var(--line); }
.sp-wk-stat:first-child { padding-left: 0; }
.sp-wk-stat-l { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sp-wk-stat-v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-wk-stat-u { font-size: 13px; color: var(--text-2); }
.sp-wk-sheet-h { margin: 18px 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.sp-wk-rows { list-style: none; margin: 0; padding: 0; }
.sp-wk-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sp-wk-row:first-child { border-top: 0; }
.sp-wk-row-main { display: grid; min-width: 0; }
.sp-wk-row-name { font-size: 15.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-wk-row > .sp-wk-row-name { flex: 1; }
.sp-wk-row-sub { font-size: 14px; color: var(--text-2); }
.sp-wk-row-val { flex: none; font-size: 15.5px; font-weight: 600; }
.sp-wk-sheet-empty { margin-top: 14px; }
.sp-wk-sheet-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.sp-wk-sheet-acts .btn { height: 48px; min-width: 120px; border-radius: 999px; font-size: 16px; }
@media (max-width: 760px) { .sp-wk-sheet-acts .btn { flex: 1; } }
@media (min-width: 761px) {
  /* the steppers stay under the values they change */
  .sp-wk-steps { width: 380px; margin-left: auto; }
}
@media (max-width: 760px) {
  .sp-wk-ex.open .sp-wk-name { font-size: 24px; }
  .sp-wk-sets .n { width: 28px; padding-left: 8px; }
  .sp-wk-sets .w { width: 66px; }
  .sp-wk-sets .r { width: 52px; }
  .sp-wk-sets .s { width: 66px; padding-right: 8px; }
  .sp-wk-step { width: 46px; }
}

/* a wide card gives the rings room: a bigger ring, the legend in two columns */
@media (min-width: 761px) {
  .sp-rings { grid-template-columns: 160px minmax(0, 1fr); gap: 28px; }
  .sp-ring-svg { width: 160px; height: 160px; }
  .sp-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
}
@media (max-width: 760px) {
  .sp-back { display: grid; }
  .sp-top { padding-left: 12px; padding-right: 12px; }
  .sp-inner { padding: 2px 16px 0; }
  .sp-h1 { font-size: 32px; }
  .sp-card { padding: 15px 16px; border-radius: 20px; }
  .sp-table-wrap { margin: 0 -16px; padding: 0 16px; }
  .sp-rings { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; }
  .sp-ring-svg { width: 120px; height: 120px; }
  .sp-num.big { font-size: 36px; }
}
@media (max-width: 370px) {
  .sp-rings { grid-template-columns: minmax(0, 1fr); justify-items: start; }
}

/* ---------- training progress (331) ---------- */
/* The range switch: the segments on the card's track, the chosen one raised. */
.sp-seg {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px;
  padding: 3px; border-radius: 12px; background: var(--track); margin: 0 0 16px;
}
.sp-seg-opt {
  min-height: 36px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600;
  transition: background 160ms ease-out, color 160ms ease-out;
}
.sp-seg-opt[aria-checked="true"] { background: color-mix(in srgb, var(--text) 16%, var(--track)); color: var(--text); }
@media (prefers-color-scheme: light) {
  .sp-seg-opt[aria-checked="true"] { background: var(--raised); box-shadow: 0 1px 3px rgba(20, 20, 20, 0.14); }
}
@media (hover: hover) and (pointer: fine) { .sp-seg-opt:not([aria-checked="true"]):hover { color: var(--text); } }
.sp-seg-opt:active { transform: scale(0.97); }
.sp-seg-opt:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
/* workouts, sets, volume: three numbers in a row, each with its change */
.sp-tr-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sp-tr-stat { display: flex; flex-direction: column; min-width: 0; }
.sp-tr-v { font-size: 32px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-tr-l { margin-top: 3px; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-tr-ch { margin-top: 6px; font-size: 13.5px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-tr-ch.up { color: var(--cl-high-tx); }
.sp-tr-ch.down { color: var(--text-2); }
.sp-tr-vs { margin-top: 10px; }
.sp-tr-h { margin: 18px 0 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
/* 12 weeks of days trained, oldest first: a dot a week, fuller with more days, the count under it */
.sp-tr-weeks { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; justify-items: center; }
.sp-tr-wk { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.sp-tr-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--track); }
.sp-tr-dot.on { background: color-mix(in srgb, var(--accent) calc(var(--f, 1) * 100%), var(--track)); }
.sp-tr-dot.now { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--line-2); }
.sp-tr-n { min-height: 15px; font-size: 12px; line-height: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* records: a row a lift, the whole row opens its exercise */
.sp-rec-list { list-style: none; margin: 0 -8px; padding: 0; }
.sp-rec-list li + li .sp-rec-row { border-top: 1px solid var(--divider); }
.sp-rec-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 9px 8px;
  border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left; font: inherit;
  transition: background 140ms ease-out;
}
@media (hover: hover) and (pointer: fine) { .sp-rec-row:hover { background: var(--hover); } }
.sp-rec-row:active { background: var(--hover); }
.sp-rec-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sp-rec-val { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.sp-rec-val .sp-num { font-size: 20px; }
.sp-rec-cap { font-size: 12px; color: var(--muted); }
.sp-rec-go { flex: none; color: var(--muted); font-size: 20px; line-height: 1; margin-left: -4px; }
/* an exercise's sheet: a card over the page on a desktop, a sheet from the bottom on a phone */
.sp-xd { width: min(100%, 560px); max-height: min(86dvh, 760px); overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px 20px; }
.sp-xd:focus { outline: none; }
.sp-xd-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sp-xd-title { flex: 1; min-width: 0; margin: 0; font-size: 24px; font-weight: 750; letter-spacing: -0.02em; text-wrap: balance; }
.sp-xd-close {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -6px -10px -6px 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
}
.sp-xd-close svg.i { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }
@media (hover: hover) and (pointer: fine) { .sp-xd-close:hover { background: var(--hover); color: var(--text); } }
.sp-xd-close:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sp-xd-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--divider); border-radius: 14px; }
.sp-xd-cell { display: flex; flex-direction: column; gap: 3px; padding: 12px; min-width: 0; }
.sp-xd-cell + .sp-xd-cell { border-left: 1px solid var(--divider); }
.sp-xd-l, .sp-xd-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp-xd-cell .sp-num, .sp-xd-v, .sp-xd-none { font-size: 22px; line-height: 1.15; }
.sp-xd-v { font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-xd-none { font-weight: 600; color: var(--muted); }
.sp-xd-chart .sp-chart { height: 120px; }
.sp-xd-hist { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 6px; }
.sp-xd-hist .sp-tr-h { margin-bottom: 4px; }
.sp-xd-sessions .sp-row-sub { white-space: normal; }
.sp-xd-set { white-space: nowrap; }
.sp-xd-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sp-xd-more { margin-top: 10px; }
@media (max-width: 760px) {
  .dialog:has(> .sp-xd) { align-items: flex-end; padding: 0; }
  .sp-xd { width: 100%; max-height: 88dvh; border-radius: 22px 22px 0 0; padding-bottom: calc(var(--agent-bar-h, 0px) + max(20px, env(safe-area-inset-bottom))); }
  .sp-tr-v { font-size: 28px; }
  .sp-tr-dot { width: 15px; height: 15px; }
  .sp-xd-cell { padding: 10px; }
  .sp-xd-cell .sp-num, .sp-xd-v, .sp-xd-none { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .sp-seg-opt, .sp-rec-row { transition: none; } }

/* Align's day's hero (align parity, slice 1): the body figure and the daily score at the top of
 * Align's Today, in the page's own tokens; docs/design/cloud-today.md says what each piece is. */

/* ---- the figure ---- */
.sp-fig-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: center; }
@media (min-width: 761px) { .sp-fig-row { grid-template-columns: auto minmax(0, 1fr); } }
.sp-fig { width: 100%; max-width: 300px; height: auto; display: block; }
.sp-fig-head { fill: var(--card); stroke: var(--text); stroke-width: 1.4; }
.sp-fig-neck { stroke: var(--text); stroke-width: 1.4; }
.sp-fig-arm { stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; fill: none; transition: stroke 160ms ease-out; }
.sp-fig-zone { fill: var(--accent); stroke: var(--text); stroke-width: 1.3; stroke-linejoin: round; }
.sp-fig-shorts { stroke: var(--text-2); stroke-width: 1.2; fill: none; }
.sp-fig.work .sp-fig-arm { stroke: color-mix(in srgb, var(--accent) 55%, var(--text)); }
.sp-fig.low .sp-fig-head, .sp-fig.low .sp-fig-neck, .sp-fig.low .sp-fig-arm { stroke: var(--muted); }
.sp-fig.low .sp-fig-zone { fill: var(--track); stroke: var(--muted); }
.sp-fig-cap { min-width: 0; }
.sp-fig-reading { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.35; color: var(--text); text-wrap: balance; }
.sp-fig-sleep { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.sp-fig-chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sp-fig-chip { display: inline-flex; align-items: baseline; gap: 3px; padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--text); font-size: 12.5px; font-weight: 600; }
.sp-fig-chip strong { font-weight: 650; color: var(--text-2); }

/* ---- the score ---- */
.sp-sc-kicker { margin: 0; font-size: 11px; font-weight: 650; color: var(--muted); }
.sp-sc-head { display: flex; flex-direction: column; gap: 6px; }
.sp-sc-big { display: flex; align-items: baseline; gap: 6px; }
.sp-sc-num { font-size: 58px; line-height: 1; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.sp-sc-num.none { color: var(--muted); }
.sp-sc-max { font-size: 16px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-sc-status { margin: 2px 0 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.sp-sc-status-word { font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text); }
.sp-sc-status-note { color: var(--muted); font-weight: 600; }

.sp-sc-groups { display: grid; gap: 11px; margin-top: 18px; }
.sp-sc-group { min-width: 0; }
.sp-sc-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sp-sc-group-label { font-size: 12px; font-weight: 650; letter-spacing: 0.3px; text-transform: uppercase; color: var(--text-2); }
.sp-sc-group.limiter .sp-sc-group-label { color: var(--accent); }
.sp-sc-group-nums { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); }
.sp-sc-group.limiter .sp-sc-group-nums { color: var(--accent); }
.sp-sc-group-max { color: var(--muted); font-weight: 550; }
.sp-sc-group-none { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sp-sc-groups .sp-track { height: 9px; margin-top: 6px; }
.sp-track.limiter .sp-fill { background: var(--accent); }
.sp-track.none .sp-fill { background: var(--track); }

.sp-sc-coach { display: flex; gap: 11px; margin-top: 18px; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--text) 9%, transparent); }
.sp-sc-coach-mark { width: 16px; height: 16px; margin-top: 2px; border-radius: 4px; background: var(--accent); flex-shrink: 0; }
.sp-sc-coach-body { flex: 1; min-width: 0; }
.sp-sc-coach-text { margin: 4px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--text); }

.sp-btn { min-height: 44px; padding: 0 14px; margin-top: 14px; border: 1px solid color-mix(in srgb, var(--text) 16%, transparent); border-radius: 12px; background: transparent; color: var(--text); font-size: 14px; font-weight: 650; cursor: pointer; transition: background 140ms ease-out; }
@media (hover: hover) and (pointer: fine) { .sp-btn:hover { background: var(--hover); } }
.sp-btn:active { transform: scale(0.98); }
.sp-btn:focus-visible { outline-offset: 2px; }

.sp-math { margin-top: 12px; border: 1px solid color-mix(in srgb, var(--text) 12%, transparent); border-radius: 14px; overflow: hidden; }
.sp-math-t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sp-math-t th, .sp-math-t td { padding: 8px 10px; text-align: left; }
.sp-math-t td:first-child { width: 44%; }
.sp-math-t thead th { font-size: 10px; font-weight: 650; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid color-mix(in srgb, var(--text) 12%, transparent); }
.sp-math-t tbody td, .sp-math-t tfoot th, .sp-math-t tfoot td { border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.sp-math-t tfoot th { font-weight: 750; color: var(--text); }
.sp-math-t td.num { text-align: right; color: var(--text-2); font-weight: 600; }
.sp-math-t th.num { text-align: right; }
.sp-math-t tr.limiter td.num { color: var(--accent); font-weight: 700; }
.sp-math-t td.num.none { color: var(--muted); }
.sp-math-t td.num.total { color: var(--text); font-weight: 750; }
.sp-math-name { display: block; font-weight: 650; color: var(--text); }
.sp-math-detail { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); }
.sp-math-note { margin: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.sp-math-t tr.limiter td:first-child .sp-math-name { color: var(--accent); }

.sp-sc-contrib { margin-top: 16px; }
.sp-sc-cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; border: 1px solid color-mix(in srgb, var(--text) 12%, transparent); border-radius: 14px; overflow: hidden; }
.sp-sc-cell { min-width: 0; padding: 10px 9px 11px; border-right: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.sp-sc-cell.last { border-right: 0; }
.sp-sc-cell-label { display: block; font-size: 10px; font-weight: 650; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.sp-sc-cell-value { display: block; margin-top: 2px; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-sc-cell.limiter { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sp-sc-cell.limiter .sp-sc-cell-label, .sp-sc-cell.limiter .sp-sc-cell-value { color: var(--accent); }
.sp-spark { height: 18px; margin-top: 8px; display: flex; align-items: flex-end; gap: 2.5px; }
.sp-spark-col { flex: 1; height: 18px; display: flex; align-items: flex-end; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--text) 8%, transparent); }
.sp-spark-fill { width: 100%; background: var(--text); opacity: 0.45; }
.sp-spark-fill.last { opacity: 1; }
.sp-sc-cell.limiter .sp-spark-fill { background: var(--accent); opacity: 0.55; }
.sp-spark-none { align-self: center; color: var(--muted); font-weight: 650; font-size: 12px; }

/* ---------- the brand elements (Brand Architect, 2026-10-08) ---------- */
/* The shortlist: domain rows with the status pills in the page's own add/err/muted tokens and the
 * prices in tabular figures; the Buy action is a quiet pill, and a taken row carries its date. */
.sp-domains .sp-row { align-items: center; }
.sp-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; margin-left: 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 650; vertical-align: 1px; }
.sp-pill.ok { background: color-mix(in srgb, var(--add) 16%, transparent); color: var(--add); }
.sp-pill.bad { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.sp-pill.mid { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--muted); }
.sp-buy { flex: none; margin-left: 10px; padding: 8px 16px; border-radius: 999px; background: var(--hover);
  color: var(--text); font-size: 13.5px; font-weight: 650; text-decoration: none;
  transition: background 140ms ease-out; }
@media (hover: hover) and (pointer: fine) { .sp-buy:hover { background: var(--track); } }
.sp-buy:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* BUY-WITH-TETHER: the owner's buy through his own Tether is the same quiet pill, a button under the
 * anchor's styles (the browser's own border and type reset; the pill's tokens do the rest). Only the
 * owner-in-app ever sees it; a customer, a browser and an older app keep the registrar's Buy. */
.sp-buy-tether { font: inherit; border: 0; cursor: pointer; }

/* The palette: a swatch a card of its own, its hex on the color in the ink that reads, and its role
 * with the ratio and the AA/AAA pass honest and open. Only the brand's colors are ever inline. */
.sp-pal { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; }
.sp-sw { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sp-sw-color { aspect-ratio: 4 / 3; border-radius: 12px; display: grid; place-items: center; padding: 8px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); }
.sp-sw-color.ink-white { color: #fff; }
.sp-sw-color.ink-black { color: #000; }
.sp-sw-hex { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.sp-sw-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sp-sw-role { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-sw-fact { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-sw-ref { font-size: 12.5px; color: var(--muted); }
.sp-sw-pass { align-self: flex-start; margin: 2px 0 0; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--add) 16%, transparent); color: var(--add);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* The type specimen: the name in the heading font at display size, a sample line in the body font,
 * and the family names. The fonts come from Google Fonts, loaded only when this draws. */
.sp-spec { display: flex; flex-direction: column; gap: 4px; padding: 8px 2px 2px; }
.sp-spec-word { font-size: 54px; line-height: 1.05; font-weight: 750; letter-spacing: -0.035em; text-wrap: balance; }
.sp-spec-sample { margin: 16px 0 0; font-size: 18px; line-height: 1.6; color: var(--text-2); }
.sp-spec-names { margin: 20px 0 0; font-size: 13px; color: var(--muted); }

/* The brand board: the whole brand on one cover, a guideline sheet in the brand's own colors - the
 * monogram on the primary, the wordmark in the heading font, the tagline, the type scale, the palette
 * with a chip for each color and the chosen domain with its price. Nothing here is page UI: every color
 * is the record's own and inline. The cover is full width on a desktop and stacks at phone width. */
.sp-board { display: flex; flex-direction: column; gap: 28px; padding: 40px 36px 30px;
  border-radius: 22px; min-height: 260px; }
.sp-board-head { display: flex; flex-direction: column; gap: 26px; }
.sp-board-mono { width: 84px; height: 84px; border-radius: 20px; display: grid; place-items: center;
  font-size: 54px; font-weight: 800; letter-spacing: -0.03em; line-height: 1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent); }
/* The logo mark (BRAND-LOGO): a real logo image where the monogram sat, shown as the cover's mark -
 * contained within a square lockup, never cropped or recolored. The ring is the cover's own ink so
 * the mark keeps its sheet; a logo whose bytes are gone falls back to the monogram (spaces.js). */
.sp-board-logo { width: 132px; aspect-ratio: 1; border-radius: 18px; display: grid; place-items: center;
  overflow: hidden; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent); }
.sp-board-logo-img { width: 100%; height: 100%; object-fit: contain; box-sizing: border-box; padding: 7px; }
.sp-board-titles { min-width: 0; }
.sp-board-word { margin: 0; font-size: clamp(44px, 7vw, 84px); line-height: 0.98; font-weight: 800;
  letter-spacing: -0.035em; text-wrap: balance; }
.sp-board-tag { margin: 14px 0 0; max-width: 46ch; font-size: 17px; line-height: 1.55; }

/* The type scale: display, heading and body with their sizes, each in the brand's own font. */
.sp-board-scale { display: flex; gap: 28px; margin-top: 4px; }
.sp-board-scale-step { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sp-board-scale-sample { font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; }
.sp-board-scale-meta { display: flex; gap: 8px; font-size: 12px; line-height: 1.3; }
.sp-board-scale-role { font-weight: 650; }
.sp-board-scale-size { opacity: 0.75; font-variant-numeric: tabular-nums; }

/* The palette: a chip for every color, its role and hex in the page's mono token - the chip that
 * matches the cover's own background is outlined in the ink so it never disappears. */
.sp-board-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 14px; }
.sp-board-chip { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sp-board-chip-color { aspect-ratio: 4 / 3; border-radius: 12px; }
.sp-board-chip-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sp-board-chip-role { font-size: 12.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-board-chip-hex { font-family: var(--mono); font-size: 11.5px; opacity: 0.78; font-variant-numeric: tabular-nums; }

/* The cover's foot: the chosen domain and its price, in the cover's ink. */
.sp-board-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-top: 2px; padding-top: 20px; }
.sp-board-domain { font-size: clamp(20px, 3vw, 28px); font-weight: 750; letter-spacing: -0.02em; }
.sp-board-price { font-size: 15px; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .sp-board { gap: 22px; padding: 28px 22px 22px; }
  .sp-board-scale { flex-direction: column; gap: 18px; }
  .sp-board-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-board-foot { flex-direction: column; align-items: flex-start; gap: 8px; }
}

