/* Phase 75 (stage 3, 2.7): Today as the home screen and the phone's bottom bar
   (docs/design/NEW_LOOK.md → Stage 3, outputs/ui-review/concepts/C-today-tiles.jpg).
   Sections: the view over the chat column · the greeting with her face · the tile grid (three or
   four columns on wide screens, two on tablets, one on phones) · each tile · the bottom bar ·
   phones · the native apps' title strip. Colours, shapes and motion come from theme.css. */

/* ---------- The view: over the chat column, not a window ---------- */
#chat > dialog.today-view {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--text-1);
  background: var(--page-glow), var(--surface-0);
  overflow: hidden;
}
/* backwards, not both: a transform still filling after the fade-in would make Today the box that
   position: fixed children (the tour ring and card) are placed in, off by the sidebar's width. */
#chat > dialog.today-view[open] { display: block; animation: td-in var(--dur-slow) var(--ease-out) backwards; }
@keyframes td-in { from { opacity: 0; transform: translateY(6px); } }
.td-scroll {
  container: today / inline-size;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(16px, 3.2vw, 34px) clamp(14px, 3vw, 36px) 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-strong) transparent;
}
.td-scroll > * { max-width: 1200px; margin-left: auto; margin-right: auto; }

/* ---------- The greeting: her face, the day, her mood ---------- */
.td-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 28px;
  margin-bottom: 22px;
}
.td-hello { min-width: 0; display: grid; gap: 6px; justify-items: start; }
.td-date { margin: 0; font-size: var(--fs-meta); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
#td-greeting { margin: 0; font-size: clamp(26px, 3.6vw, 40px); line-height: 1.12; font-weight: 650; letter-spacing: -0.02em; color: var(--text-1); overflow-wrap: anywhere; }
#td-greeting:focus { outline: none; }
.td-her { display: grid; gap: 4px; justify-items: start; max-width: 640px; }
.td-mood {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 2px 0 0;
  padding: 5px 13px 5px 11px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  color: var(--text-1);
  font-size: 13.5px;
}
.td-mood .hp-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px -1px var(--success); }
.td-her-name { font-weight: 650; }
.td-mood-text { color: var(--text-2); }
.today-her { display: block; }
#today .td-her-day { margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; color: var(--text-2); }
#today .td-her-day.open { -webkit-line-clamp: unset; }
.td-her-day:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; border-radius: 4px; }
.td-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; }
.td-face-wrap { display: grid; justify-items: center; gap: 10px; }
.td-face-btn {
  position: relative;
  width: clamp(96px, 12vw, 150px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.td-face-btn::before { content: ""; position: absolute; inset: -18%; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, var(--accent-glow), var(--violet-glow) 55%, transparent); opacity: .7; }
.td-face-btn:hover { background: none; }
.td-face-btn:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 6px; }
.td-face { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; box-shadow: 0 0 0 3px var(--surface-0), 0 0 0 5px color-mix(in srgb, var(--accent-solid) 70%, var(--accent-to)), 0 14px 40px -12px var(--accent-glow); }
html.sara-busy .td-face { animation: her-breathe var(--breathe) ease-in-out infinite; }
.td-ai { font-size: 11.5px; padding: 2px 10px; border-color: var(--hairline-strong); background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.td-back { position: absolute; top: 0; right: 0; }
.td-hero:has(.td-back) .td-face-wrap { margin-top: 26px; }

/* Getting started: a wide card above the tiles. */
#today .today-start {
  margin: 0 auto 16px;
  padding: 16px 18px;
  border: 1px solid var(--hairline-strong);
  border-radius: 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--surface-2) 90%, var(--accent-to)), var(--surface-1) 75%);
  box-shadow: var(--glow-edge);
}
#today .today-start-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-1); }
/* Phase 114 (F11): two columns with the whole one-line description (never cut off), the next step highlighted. */
#today .today-start-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-3); }
#today .start-item { min-height: 44px; padding: var(--s-2) var(--s-3); border-radius: var(--r-control); align-items: center; }
#today .start-item .start-hint { display: block; overflow: visible; white-space: normal; text-overflow: clip; }
#today .start-item.next { border-color: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-solid), var(--glow-edge); }
#today .start-item.done .start-hint { display: none; }

/* ---------- The sections and the grid (Phase 111, TD1: docs/design/TODAY.md §3) ----------
   Five named sections in a fixed order, each its own 12-column grid. Tiles are S, M or L; the fill
   rule (web/today.js) gives each tile one span class per width, picked by container queries on
   #today (it sits beside the sidebar and her panel, so the viewport is the wrong measure). Rows
   are even (tiles in a row stretch to the same height), and nothing reorders because of content. */
.td-tiles { display: grid; gap: var(--td-sec-gap); }
.td-sec { display: grid; gap: 10px; min-width: 0; }
.td-sec[hidden] { display: none; }
#today .td-sec-h {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: var(--fs-meta);
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-2);
}
#today .td-sec-h::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.td-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(var(--td-row), auto);
  align-items: stretch;
  gap: var(--td-gap);
}
.td-grid > .td-tile { grid-column: 1 / -1; }
/* Today's content width (the container is .td-scroll; its padding is not counted, so these are the
   design's 600 / 900 / 1200 px view widths less the side padding): 560 – 839 two tracks (in
   twelfths); 840 – 1059 S = 4, M = 6, L = 12; 1060+ S = 3, M = 4, L = 6 (1440 with the sidebar). */
@container today (min-width: 560px) {
  .td-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .td-grid > .td-md-6 { grid-column: span 6; }
  .td-grid > .td-md-12 { grid-column: span 12; }
}
@container today (min-width: 840px) {
  .td-grid > .td-lg-3 { grid-column: span 3; }
  .td-grid > .td-lg-4 { grid-column: span 4; }
  .td-grid > .td-lg-5 { grid-column: span 5; }
  .td-grid > .td-lg-6 { grid-column: span 6; }
  .td-grid > .td-lg-7 { grid-column: span 7; }
  .td-grid > .td-lg-8 { grid-column: span 8; }
  .td-grid > .td-lg-9 { grid-column: span 9; }
  .td-grid > .td-lg-10 { grid-column: span 10; }
  .td-grid > .td-lg-11 { grid-column: span 11; }
  .td-grid > .td-lg-12 { grid-column: span 12; }
}
@container today (min-width: 1060px) {
  .td-grid > .td-span-3 { grid-column: span 3; }
  .td-grid > .td-span-4 { grid-column: span 4; }
  .td-grid > .td-span-5 { grid-column: span 5; }
  .td-grid > .td-span-6 { grid-column: span 6; }
  .td-grid > .td-span-7 { grid-column: span 7; }
  .td-grid > .td-span-8 { grid-column: span 8; }
  .td-grid > .td-span-9 { grid-column: span 9; }
  .td-grid > .td-span-10 { grid-column: span 10; }
  .td-grid > .td-span-11 { grid-column: span 11; }
  .td-grid > .td-span-12 { grid-column: span 12; }
}
/* A slot waiting for the batch: its final size, a quiet shimmer (still under reduced motion). */
#today .td-tile.td-skel > :not(.td-tile-head) { visibility: hidden; }
#today .td-tile.td-skel::after {
  content: "";
  position: absolute;
  inset: 52px 18px 18px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-3), color-mix(in srgb, var(--surface-3) 40%, transparent), var(--surface-3));
  background-size: 200% 100%;
  opacity: .5;
  animation: td-shimmer calc(var(--dur-slow) * 6) linear infinite;
}
@keyframes td-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { #today .td-tile.td-skel::after { animation: none; } }

/* Since you were away: a quiet strip above the sections. */
.td-away {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 14px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}
.td-away[hidden] { display: none; }
.td-away-text { flex: 1; margin: 0; font-size: 13.5px; color: var(--text-1); }
.td-away-x { flex: none; min-width: 44px; min-height: 44px; }
.td-fresh { min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- A tile ---------- */
#today .td-tile {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 16px 18px 16px;
  border: 1px solid var(--hairline-strong);
  border-radius: 18px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--surface-2) 94%, var(--accent-to)), var(--surface-1) 72%);
  box-shadow: var(--glow-edge);
  animation: td-tile-in var(--dur-slow) var(--ease-out) both;
}
@keyframes td-tile-in { from { opacity: 0; transform: translateY(4px); } }
#today .td-tile:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; }
.td-tile-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
#today .td-tile-head h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; font-size: 16px; font-weight: 600; letter-spacing: var(--tracking-tight); color: var(--text-1); }
.td-count { min-width: 0; font-size: var(--fs-meta); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-tile-head > :last-child:not(h3) { margin-left: auto; }
.td-tile-head > .td-count:last-child { margin-left: 0; }
.td-body, #today .today-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
#today .today-list > p, .td-body > p { margin: 0; }
.td-link {
  justify-self: start;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 13.5px;
  font-weight: 600;
}
.td-link:hover { background: none; text-decoration: underline; }
.td-link:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; border-radius: 4px; }

/* Weather */
.td-wx-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.td-wx-icon { font-size: 30px; line-height: 1; align-self: center; }
.td-wx-temp { font-size: 44px; line-height: 1; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--text-1); }
.td-wx-words { font-size: 15px; color: var(--text-1); }
.td-wx-meta { margin: 0; font-size: var(--fs-meta); color: var(--text-2); font-variant-numeric: tabular-nums; }
.td-wx-hours { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.td-wx-hour { display: grid; justify-items: center; gap: 1px; padding: 6px 4px; border-radius: var(--r-control); background: color-mix(in srgb, var(--surface-3) 55%, transparent); font-size: 12px; font-variant-numeric: tabular-nums; }
.td-wx-h { color: var(--text-2); white-space: nowrap; }
.td-wx-ht { color: var(--text-1); font-weight: 600; }

/* Your day: a timeline */
.td-timeline { position: relative; display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.td-timeline::before { content: ""; position: absolute; left: calc(4.4em + 13px); top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--hairline-strong); }
.td-time-row { display: grid; grid-template-columns: 4.4em 12px minmax(0, 1fr); align-items: start; column-gap: 8px; min-width: 0; }
.td-when { padding-top: 2px; font-size: var(--fs-meta); color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-dot { position: relative; z-index: 1; margin-top: 6px; justify-self: center; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent-solid); background: var(--surface-1); }
.td-time-row.reminder .td-dot { background: var(--accent-solid); }
.td-time-row.past { opacity: .55; }
.td-time-row.past .td-dot { border-color: var(--text-3); background: var(--text-3); }
.td-what { display: grid; min-width: 0; }
.td-what-title { font-size: 14.5px; line-height: 1.35; color: var(--text-1); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.td-what-where { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Planner: to-dos with a tick */
.td-tasks { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.td-task { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 6px; min-width: 0; min-height: 40px; padding: 2px 6px 2px 0; border-radius: var(--r-control); }
.td-task > .td-tick { grid-row: span 2; }
.td-task:hover { background: color-mix(in srgb, var(--surface-3) 45%, transparent); }
.td-tick { position: relative; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--r-control); background: none; }
.td-tick::before { content: ""; position: absolute; inset: 8px; border: 1.5px solid var(--text-3); border-radius: 6px; transition: background var(--dur-fast), border-color var(--dur-fast); }
.td-tick:hover { background: none; }
.td-tick:hover::before { border-color: var(--accent-solid); }
.td-tick:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: -2px; }
.td-task.done .td-tick::before { border-color: transparent; background: var(--accent-grad); }
.td-task.done .td-tick::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--on-mine); font-size: 13px; font-weight: 700; }
.td-task-title { min-width: 0; font-size: 14.5px; line-height: 1.3; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-task.done .td-task-title { color: var(--text-3); text-decoration: line-through; }
.td-task-side { min-width: 0; font-size: 12px; line-height: 1.3; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-task.overdue .td-task-side { color: var(--danger); }

/* She remembered: a warm card */
#today .td-warm { background: linear-gradient(165deg, color-mix(in srgb, var(--accent-solid) 20%, var(--surface-2)), color-mix(in srgb, var(--accent-solid) 7%, var(--surface-1)) 75%); border-color: color-mix(in srgb, var(--accent-solid) 30%, var(--hairline-strong)); }
.td-mems { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.td-mem { display: grid; gap: 2px; padding-left: 12px; border-left: 2px solid color-mix(in srgb, var(--accent-solid) 60%, transparent); }
.td-mem-text { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--text-1); overflow-wrap: anywhere; }
.td-mem-from { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Moments: photos like prints */
#today .today-otd { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr)); gap: 10px; }
#today .td-otd-item { margin: 0; padding: 6px 6px 8px; border-radius: 12px; background: color-mix(in srgb, var(--surface-3) 70%, transparent); border: 1px solid var(--hairline); display: grid; gap: 6px; min-width: 0; }
#today .td-otd-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; cursor: zoom-in; }
#today .td-otd-item img:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; }
#today .td-otd-item figcaption { margin: 0; font-size: 12px; line-height: 1.35; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Background work: a terminal-like card inside */
.td-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--success); }
.td-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px -1px var(--success); animation: step-pulse calc(var(--breathe) / 3) ease-in-out infinite; }
.td-job { display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--hairline-strong); border-radius: 12px; background: var(--surface-0); }
.td-job-name { margin: 0; font: 600 13px/1.4 var(--font-mono); color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-job-sub { margin: 0; font-size: 12px; color: var(--text-2); }
.td-job-out { margin: 0; font: 11.5px/1.4 var(--font-mono); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-job-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.td-progress { width: 100%; height: 6px; border: 0; border-radius: 6px; background: var(--hairline-strong); overflow: hidden; -webkit-appearance: none; appearance: none; }
.td-progress::-webkit-progress-bar { background: var(--hairline-strong); border-radius: 6px; }
.td-progress::-webkit-progress-value { background: var(--accent-grad); border-radius: 6px; }
.td-progress::-moz-progress-bar { background: var(--accent-grad); border-radius: 6px; }

/* Home: a few devices; lights, switches, fans and blinds switch here (2.7.1), the rest go through her */
.td-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr)); gap: 8px; }
.td-dev { display: grid; gap: 2px; align-content: start; min-width: 0; padding: 10px 12px; border: 1px solid var(--hairline-strong); border-radius: 14px; background: color-mix(in srgb, var(--surface-3) 60%, transparent); }
.td-dev.on { background: linear-gradient(150deg, color-mix(in srgb, var(--warn) 18%, var(--surface-2)), var(--surface-2)); border-color: color-mix(in srgb, var(--warn) 35%, var(--hairline-strong)); }
.td-dev-name { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-dev-state { margin: 0; font-size: 12.5px; color: var(--text-2); }
.td-dev-ask { justify-self: start; margin-top: 4px; }
.td-dev.has-switch { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
.td-dev.has-switch > .td-dev-name, .td-dev.has-switch > .td-dev-state { grid-column: 1; }
.td-dev.failed .td-dev-state { color: var(--danger); }
/* The switch: a 44 px target with a 46 x 28 track drawn inside it. */
.td-dev-switch { grid-column: 2; grid-row: 1 / span 2; align-self: center; position: relative; width: 52px; height: 44px; min-height: 44px; margin: -6px -6px -6px 0; padding: 0; border: 0; border-radius: var(--r-pill); background: none; cursor: pointer; }
.td-dev-switch:hover { background: none; }
.td-dev-switch::before { content: ""; position: absolute; left: 3px; top: 8px; width: 46px; height: 28px; border-radius: var(--r-pill); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--hairline-strong); transition: background var(--dur-fast) var(--ease-out); }
.td-dev-switch::after { content: ""; position: absolute; left: 6px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: var(--text-2); box-shadow: var(--shadow-1); transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.td-dev-switch[aria-checked="true"]::before { background: var(--accent-grad); box-shadow: none; }
.td-dev-switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--on-accent); }
.td-dev-switch:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 0; }
.td-dev-switch:disabled { opacity: .45; cursor: default; }
.td-foot { margin: 0; }
.td-home-choose summary { cursor: pointer; font-size: 13px; color: var(--accent-text); min-height: 32px; display: flex; align-items: center; }
.td-home-picks { display: grid; gap: 2px; max-height: 220px; overflow-y: auto; margin: 4px 0; }
.td-home-picks label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 32px; }
.td-home-picks input { width: auto; accent-color: var(--accent-solid); }

/* Add to your day: one line per thing to set up */
.td-setup-item { display: grid; gap: 1px; justify-items: start; width: 100%; min-height: 44px; padding: 9px 12px; border: 1px dashed var(--hairline-strong); border-radius: 12px; background: transparent; color: var(--text-1); font-weight: 500; text-align: left; }
.td-setup-item:hover { background: color-mix(in srgb, var(--surface-3) 50%, transparent); border-color: color-mix(in srgb, var(--accent-solid) 45%, var(--hairline-strong)); }
.td-setup-item strong { font-size: 14px; font-weight: 600; }
.td-setup-item .muted { color: var(--text-2); }
.td-hide { min-height: 30px; padding: 2px 10px; }

/* The ⋯ menu on each tile (web/today-layout.js) */
.td-tile-head { position: relative; align-items: center; min-height: 32px; }
.td-tile-head > .td-more { margin-left: auto; flex: none; width: 44px; height: 44px; min-height: 44px; margin: -8px -10px -8px auto; padding: 0; border-radius: var(--r-control); color: var(--text-2); }
.td-tile-head > .td-more:hover { color: var(--text-1); }
.td-tile-head > :not(h3, .td-tile-ic, .td-more) + .td-more { margin-left: 4px; }
.td-tile-head > .td-count:not(:last-child), .td-tile-head > .td-live, .td-tile-head > .td-done-ring { margin-left: auto; }
.td-menu {
  position: absolute;
  top: 40px;
  right: -6px;
  z-index: 5;
  display: grid;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--hairline-strong);
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
}
.td-menu-item { min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-control); background: none; color: var(--text-1); font-weight: 500; text-align: left; }
.td-menu-item:hover:not(:disabled) { background: var(--accent-soft); }
.td-menu-item:disabled { color: var(--text-3); }
.td-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: auto 0 0; padding-top: 2px; }
.td-foot .td-link { min-height: 32px; font-size: 12.5px; }
/* Even rows: the body fills the tile, the freshness foot sits at the bottom. */
#today .td-tile { grid-template-rows: auto minmax(0, 1fr); }
#today .td-tile:has(> .td-link) { grid-template-rows: auto minmax(0, 1fr) auto; }
#today .td-tile > .td-body, #today .td-tile > .today-list { display: flex; flex-direction: column; gap: 8px; }
#today .td-tile > .td-body > *, #today .td-tile > .today-list > * { min-width: 0; }
#today .td-tile > .td-body > .td-link, #today .td-tile > .today-list > .td-link { align-self: flex-start; }
.td-empty { margin: 0; color: var(--text-2); }
.td-see-all { font-size: 12.5px; }

/* Your day: the Now marker, leave-by rows, ticks on timed to-dos */
.td-now { position: relative; display: grid; grid-template-columns: 4.4em minmax(0, 1fr); column-gap: 8px; align-items: center; min-height: 18px; }
.td-now::after { content: ""; grid-column: 2; height: 2px; border-radius: 2px; background: var(--accent-grad); }
.td-now-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); text-align: right; }
.td-time-row { grid-template-columns: 4.4em 12px minmax(0, 1fr) auto; }
.td-time-row.leave .td-what-title { color: var(--text-2); font-size: 13px; }
.td-time-row.leave .td-dot { width: 8px; height: 8px; border-style: dashed; }
.td-time-row.todo .td-tick { margin: -8px -6px -8px 0; }
.td-time-row.done .td-what-title { color: var(--text-3); text-decoration: line-through; }
.td-what-title svg { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }

/* Coming up */
.td-rows { display: grid; gap: 2px; }
.td-coming { display: grid; grid-template-columns: 4.8em minmax(0, 1fr) auto; align-items: baseline; column-gap: 8px; min-height: 30px; }
.td-coming-when { font-size: var(--fs-meta); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-coming .today-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Needs you */
.td-needs-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.td-need { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; min-height: 48px; padding: 4px 4px 4px 8px; border-radius: 12px; background: color-mix(in srgb, var(--surface-3) 40%, transparent); }
.td-need:has(> .td-tick) { grid-template-columns: 28px minmax(0, 1fr) auto auto; }
.td-need-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.td-need-ic svg { width: 15px; height: 15px; }
.td-need.approval .td-need-ic, .td-need.failed .td-need-ic { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.td-need-text { display: grid; min-width: 0; }
.td-need-title { font-size: 14px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-need-why { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-need-acts { display: flex; align-items: center; gap: 4px; }
.td-need-acts > button, .td-need-acts > a { min-height: 44px; }
#today .td-need-acts .td-later { width: 44px; min-width: 44px; padding: 0; border: 0; background: none; box-shadow: none; color: var(--text-3); }
#today .td-need-acts .td-later:hover { color: var(--text-1); background: color-mix(in srgb, var(--surface-3) 60%, transparent); }
.td-later svg { width: 16px; height: 16px; }
.td-all-clear { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.td-all-clear svg { width: 18px; height: 18px; color: var(--success); }
.td-ext { display: inline-flex; align-items: center; min-height: 44px; }

/* Mail 2.0 */
.td-mail-counts { font-variant-numeric: tabular-nums; }
.td-mail-change { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; color: var(--text-2); font-variant-numeric: tabular-nums; }
.td-mail-list, .td-org-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.td-mail-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; min-height: 40px; }
.td-mail-link { display: grid; min-width: 0; color: var(--text-1); text-decoration: none; }
.td-mail-link:hover .td-mail-subj { text-decoration: underline; }
.td-mail-from { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-mail-subj { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-mail-at { font-variant-numeric: tabular-nums; }
.td-org-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; min-height: 44px; font-size: 13.5px; }
.td-org-row.done .td-org-what { color: var(--text-3); text-decoration: line-through; }
.td-org-undo { min-height: 44px; }
.td-bd-h { margin: 4px 0 0; font-size: 12px; font-weight: 650; letter-spacing: .04em; color: var(--text-2); }

/* On the board: her cards as calm rows with an accent edge (the board itself keeps its filled cards). */
#today .td-bd-item { display: grid; justify-items: start; gap: 1px; width: 100%; min-height: 44px; padding: 7px 10px; border: 0; border-left: 3px solid var(--accent-solid); border-radius: 10px; background: color-mix(in srgb, var(--surface-3) 45%, transparent); color: var(--text-1); text-align: left; box-shadow: none; }
#today .td-bd-item:hover { background: color-mix(in srgb, var(--surface-3) 75%, transparent); }
#today .td-bd-item .td-bd-title { max-width: 100%; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Coding projects, Usage today, Rooms */
.td-proj { display: grid; justify-items: start; gap: 1px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 10px; background: none; color: var(--text-1); text-align: left; }
.td-proj:hover { background: color-mix(in srgb, var(--surface-3) 50%, transparent); }
.td-proj-name { font: 600 13px/1.4 var(--font-mono); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-proj-facts.bad { color: var(--danger); }
.td-proj-subj { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-usage-main { display: flex; align-items: center; gap: 14px; }
.td-usage-nums { display: grid; gap: 2px; }
.td-usage-tok { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-1); }
.td-usage-split { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.td-usage-split li { display: grid; grid-template-columns: 6em minmax(0, 1fr); align-items: center; column-gap: 8px; }
.td-usage-p { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-usage-bar { width: 100%; height: 6px; }
.td-usage-bar::-webkit-meter-bar { background: var(--hairline-strong); border: 0; border-radius: 6px; height: 6px; }
.td-usage-bar::-webkit-meter-optimum-value { background: var(--accent-grad); border-radius: 6px; }
.td-usage-bar::-moz-meter-bar { background: var(--accent-grad); border-radius: 6px; }
.td-room { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; align-items: center; padding: 8px 6px 8px 10px; border: 1px solid var(--hairline); border-radius: 12px; background: color-mix(in srgb, var(--surface-3) 40%, transparent); }
.td-room > :not(.td-room-peek) { grid-column: 1; }
.td-room-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.td-room-head svg { width: 15px; height: 15px; flex: none; color: var(--text-2); }
.td-room-name { min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-room-at { margin-left: auto; white-space: nowrap; }
.td-room-topic { margin: 0; color: var(--text-1); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.td-room-who { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-room-peek { grid-column: 2; grid-row: 1 / span 3; align-self: center; min-height: 44px; min-width: 64px; }
.td-scenes { display: flex; flex-wrap: wrap; gap: 6px; }
.td-scene { min-height: 44px; border-radius: var(--r-pill); }
.td-scene.ran { border-color: var(--accent-solid); }
.td-who { white-space: nowrap; }
.td-setup-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.td-setup-row .td-hide { min-height: 44px; }
.td-runs { font-size: 12.5px; }

/* Customise Today: a side sheet over Today (a bottom sheet on phones) */
.td-custom {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: grid;
  align-content: start;
  gap: 12px;
  width: min(420px, 100%);
  padding: 18px 18px calc(18px + var(--safe-b));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-left: 1px solid var(--hairline-strong);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--shadow-2);
}
.td-custom[hidden] { display: none; }
.td-custom-top { display: flex; align-items: center; gap: 10px; }
.td-custom-top h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 650; }
.td-custom-top button { min-height: 44px; }
.td-custom-intro { margin: 0; }
.td-custom-list { display: grid; gap: 10px; }
.td-custom-card { display: grid; gap: 8px; padding: 12px 12px 10px; border: 1px solid var(--hairline-strong); border-radius: 16px; background: color-mix(in srgb, var(--surface-2) 85%, transparent); }
.td-custom-card[hidden] { display: none; }
.td-custom-card h3 { margin: 0; font-size: 14px; font-weight: 650; }
.td-c-sec-head { display: flex; align-items: center; gap: 8px; }
.td-c-sec-head h3 { flex: 1; }
.td-c-tiles { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.td-c-tile { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto; grid-template-areas: "grip name name name" ". size show arrows"; align-items: center; gap: 2px 6px; padding: 6px 4px 4px 6px; border-radius: 12px; background: color-mix(in srgb, var(--surface-3) 40%, transparent); }
.td-c-tile > .td-c-grip { grid-area: grip; }
.td-c-tile > .td-c-label { grid-area: name; min-height: 32px; }
.td-c-tile > .td-c-size { grid-area: size; justify-self: start; }
.td-c-tile > .td-c-show { grid-area: show; }
.td-c-tile > .td-c-arrows { grid-area: arrows; }
.td-c-tile.off .td-c-name { color: var(--text-3); }
.td-c-tile.dragging { opacity: .5; }
.td-c-grip { display: grid; place-items: center; color: var(--text-3); cursor: grab; }
.td-c-grip svg { width: 16px; height: 16px; }
.td-c-label { display: flex; align-items: center; gap: 4px; min-width: 0; }
.td-c-name { min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-c-size { width: auto; min-height: 44px; padding: 0 6px; }
.td-c-show { display: flex; align-items: center; gap: 4px; min-height: 44px; }
.td-c-show input, .td-c-row input { width: auto; accent-color: var(--accent-solid); }
.td-c-arrows { display: flex; }
.td-c-arrows button { width: 44px; min-width: 44px; min-height: 44px; padding: 0; }
.td-c-slider { display: grid; gap: 4px; font-size: 13.5px; }
.td-c-slider input { accent-color: var(--accent-solid); min-height: 44px; }
.td-c-row { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13.5px; }
.td-c-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 44px; font-size: 13.5px; }
.td-c-pick select { width: auto; min-height: 44px; }
.td-rooms-picks { display: grid; gap: 2px; }
.td-rooms-picks[hidden] { display: none; }
.td-custom-foot { margin: 0; }
.td-custom-foot button { min-height: 44px; }
html.td-editing #today .td-tile { outline: 1px dashed color-mix(in srgb, var(--accent-solid) 45%, transparent); outline-offset: 3px; }
/* The page stays visible beside the sheet (live preview). */
@media (min-width: 1100px) { html.td-editing #today .td-scroll { padding-right: 440px; } }

/* Hidden "Usage today" · Undo */
.td-toast {
  position: absolute;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
}
.td-toast[hidden] { display: none; }
.td-toast button { min-height: 44px; }

/* Ask her anything, at the bottom */
.td-ask-row { display: flex; justify-content: center; margin: 22px auto 4px; }
.td-ask-any {
  width: min(560px, 100%);
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--shadow-2);
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
}
.td-ask-any:hover { background: var(--glass-strong); color: var(--text-1); border-color: color-mix(in srgb, var(--accent-solid) 45%, var(--hairline-strong)); }

/* The sidebar's face and name go to Today. */
button.brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; min-height: 40px; padding: 2px 8px 2px 2px; margin-left: -2px; border: 0; border-radius: var(--r-pill); background: none; color: var(--text-1); font: inherit; font-size: 20px; font-weight: 650; letter-spacing: var(--tracking-tight); }
button.brand:hover { background: color-mix(in srgb, var(--surface-3) 70%, transparent); }
button.brand:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- The phone's bottom bar ---------- */
.bottom-bar { display: none; }
@media (max-width: 720px) {
  :root { --bbar-h: calc(60px + var(--safe-b)); }
  #main { grid-template-rows: minmax(0, 1fr) auto; }
  .bottom-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: relative;
    z-index: 8;
    padding: 4px max(6px, env(safe-area-inset-left)) var(--safe-b) max(6px, env(safe-area-inset-right));
    border-top: 1px solid var(--hairline-strong);
    background: var(--glass-strong);
    -webkit-backdrop-filter: var(--glass-filter);
    backdrop-filter: var(--glass-filter);
  }
  html.kb-up .bottom-bar { display: none; }
  /* The drawer (☰ / More) stops above the bar, so the bar still switches places while it is open. */
  html:not(.kb-up) #sidebar { bottom: var(--bbar-h); }
  html:not(.kb-up) #main.show-sidebar #sidebar-scrim { bottom: var(--bbar-h); }
  .bb-btn {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    border: 0;
    border-radius: 14px;
    background: none;
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .01em;
  }
  .bb-btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bb-btn svg { width: 23px; height: 23px; }
  .bb-btn:hover { background: color-mix(in srgb, var(--surface-3) 60%, transparent); color: var(--text-1); }
  .bb-btn:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: -2px; }
  .bb-btn[aria-current="page"] { color: var(--accent-text); }
  .bb-btn[aria-current="page"] svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }
  .bb-btn[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 32%; right: 32%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent-grad); }
  .bb-btn .side-dot { position: absolute; top: 8px; right: calc(50% - 18px); }
  /* The composer sits on the bar (the bar keeps the safe area); while typing the bar steps away. */
  html:not(.kb-up) #composer { margin-bottom: 8px; }
  /* A window leaves the bar visible below it (a tap there closes the window and goes on). */
  html:not(.kb-up) body:has(> #main:not([hidden])) dialog:modal:not(.ring, .lightbox, .cmdbar, [data-required]) {
    max-height: calc(100dvh - var(--bbar-h) - 16px - var(--safe-t));
    margin-bottom: calc(var(--bbar-h) + 8px);
  }
  html:not(.kb-up) body:has(> #main:not([hidden])) .msg.show-actions > .msg-actions { bottom: calc(84px + var(--bbar-h)); }
  html:not(.kb-up) body:has(> #main:not([hidden])) .tour-offer { bottom: calc(var(--bbar-h) + 12px); }
  /* Today on a phone: the bar's Chat replaces the back button; her face beside the greeting. */
  .td-back { display: none; }
  .td-hero { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; margin-bottom: 16px; }
  .td-hero:has(.td-back) .td-face-wrap { margin-top: 0; }
  .td-face-btn { width: 76px; }
  .td-face-wrap { gap: 6px; align-self: start; }
  .td-ai { font-size: 10.5px; padding: 1px 8px; }
  #today .td-tile { padding: 14px 15px; border-radius: 16px; }
  .td-scroll { padding: 16px 12px 22px; }
  .td-ask-row { margin-top: 16px; }
  /* Getting started: one column on a phone, so every description fits in full (Phase 114, F11). */
  #today .today-start-list { grid-template-columns: minmax(0, 1fr); }
  /* Customise as a bottom sheet (TD2 polishes phones). */
  .td-custom { top: auto; left: 0; width: 100%; max-height: 85%; border-left: 0; border-top: 1px solid var(--hairline-strong); border-radius: 20px 20px 0 0; }
  .td-actions { gap: 6px; }
  #today .start-item { padding: var(--s-2) var(--s-3); }
}
@media (max-width: 380px) {
  .td-hero { grid-template-columns: minmax(0, 1fr); }
  .td-face-wrap { grid-row: 1; justify-self: start; grid-auto-flow: column; align-items: center; }
  .td-face-btn { width: 56px; }
  .td-mood { font-size: 12.5px; }
}
@media (pointer: coarse) {
  .td-link, .td-foot .td-link, .td-home-choose summary, .td-home-picks label { min-height: 44px; }
  /* Phase 112 (TD2): every target on a touch screen is at least 44 px. */
  .td-ext, .td-mail-row, .td-mail-link, .td-job-actions > button { min-height: 44px; }
  .td-mail-link { align-content: center; }
  .td-tick { width: 44px; height: 44px; }
  .td-tick::before { inset: 11px; }
  .td-task { min-height: 44px; }
}

/* ---------- Phones and tablets (Phase 112, TD2: docs/design/TODAY.md §7) ----------
   web/today.js sets #today.td-ff-phone (the screen is 600 px or less) or .td-ff-tablet (a touch
   screen whose Today is narrower than the 12-column grid). Phones: the compact header, the Now
   card, one column in priority order with a disclosure heading per group, With her and Work as
   swipe rows. Tablets: the Now card over two tracks, the desktop order, disclosure headings. */

/* The Now card (.td-nowcard: .td-now is the timeline's Now marker): the next things with a countdown, the weather in one line, her mood. */
.td-nowcard {
  display: grid;
  gap: 8px;
  margin: 0 auto 16px;
  padding: 14px 16px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-solid) 30%, var(--hairline-strong));
  border-radius: 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent-solid) 14%, var(--surface-2)), color-mix(in srgb, var(--accent-to) 8%, var(--surface-1)) 75%);
  box-shadow: var(--glow-edge);
}
.td-nowcard[hidden] { display: none; }
.td-now-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
#today .td-now-h { margin: 0; font-size: var(--fs-meta); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.td-now-date { font-size: var(--fs-meta); color: var(--text-2); white-space: nowrap; }
.td-now-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.td-now-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; column-gap: 8px; min-height: 26px; font-size: 14.5px; color: var(--text-1); }
.td-now-row.soon .td-now-text { font-weight: 650; }
.td-now-row.quiet, .td-now-row.mood, .td-now-row.clear { color: var(--text-2); font-size: 13.5px; }
.td-now-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-now-ic { display: grid; place-items: center; width: 22px; height: 22px; color: var(--accent-text); }
.td-now-ic svg { width: 16px; height: 16px; }
.td-now-row.clear .td-now-ic { color: var(--success); }
.td-now-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.td-now-acts:empty { display: none; }
.td-now-acts > button { min-height: 44px; }

/* Disclosure headings (phones and tablets): 44 px, a chevron, a short summary while collapsed. */
#today .td-sec-h:has(> .td-sec-toggle)::after { display: none; }
.td-sec-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r-control);
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
}
.td-sec-toggle:hover { background: none; color: var(--text-1); }
.td-sec-toggle:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; }
.td-sec-toggle::after { content: ""; flex: 1 1 12px; min-width: 12px; height: 1px; background: var(--hairline); }
.td-chev { flex: none; width: 8px; height: 8px; margin: 0 2px 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform var(--dur-fast) var(--ease-out); }
.td-shut .td-chev { transform: rotate(-45deg); margin-bottom: 0; }
.td-sec-name { flex: none; }
.td-sec-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--text-2); }
.td-sec-sum[hidden] { display: none; }
.td-pg[data-sec="needs"] .td-sec-sum { flex: none; padding: 1px 8px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--text-1); }
.td-pg[hidden] { display: none; }
.td-shut { gap: 0; }

/* A phone group with one tile: the heading names it, so the tile's own title and icon are for screen
   readers; its head keeps only the counts and the ⋯ menu, on the right. */
#today .td-pg-single .td-tile-head > h3, #today .td-pg-single .td-tile-head > .td-tile-ic, #today .td-pg-single .td-tile-head > .td-needs {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
#today .td-pg-single .td-tile-head { justify-content: flex-end; min-height: 28px; margin: -6px 0 -4px; }
#today .td-pg-single .td-tile-head > .td-count { margin-left: 0; margin-right: auto; }
/* Needs you on a phone: an approval's two buttons go under its words. */
#today.td-ff-phone .td-need.approval { grid-template-columns: 28px minmax(0, 1fr); row-gap: 4px; padding-bottom: 6px; }
#today.td-ff-phone .td-need.approval > .td-need-acts { grid-column: 2; justify-content: flex-end; }
#today.td-ff-phone .td-need-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Swipe rows (With her, Work): 85% cards that snap, the next one peeking; dots and ‹ › buttons under the row. */
#today.td-ff-phone .td-swipe > .td-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  padding: 2px;
  margin: -2px;
  scrollbar-width: none;
}
#today.td-ff-phone .td-swipe > .td-grid::-webkit-scrollbar { display: none; }
#today.td-ff-phone .td-swipe > .td-grid > .td-tile { flex: 0 0 85%; scroll-snap-align: start; }
#today.td-ff-phone .td-swipe > .td-grid[hidden] { display: none; }
.td-swipe-nav { display: flex; align-items: center; justify-content: center; gap: 6px; }
.td-swipe-nav[hidden] { display: none; }
.td-swipe-nav > button { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; line-height: 1; color: var(--text-2); }
.td-swipe-nav > button:disabled { opacity: .35; }
.td-dots { display: flex; gap: 6px; }
.td-dot-i { width: 7px; height: 7px; border-radius: 50%; background: var(--hairline-strong); transition: background var(--dur-fast); }
.td-dot-i.on { background: var(--accent-solid); }

/* Phone: one column, the compact header (her face, the greeting, Refresh and Customise as icons). */
#today.td-ff-phone .td-grid { grid-template-columns: minmax(0, 1fr); }
#today.td-ff-phone .td-grid > .td-tile { grid-column: 1 / -1; }
#today.td-ff-phone .td-tiles { gap: 14px; }
#today.td-ff-phone .td-sec { gap: 6px; }
#today.td-ff-phone .td-hero {
  grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
  grid-template-areas: "face greet ref cus" "face badge ref cus" "status status status status";
  align-items: center;
  gap: 0 10px;
  margin-bottom: 12px;
}
#today.td-ff-phone .td-hello, #today.td-ff-phone .td-actions, #today.td-ff-phone .td-face-wrap { display: contents; }
#today.td-ff-phone .td-date, #today.td-ff-phone .td-her, #today.td-ff-phone .td-fresh { display: none; }
#today.td-ff-phone #td-greeting { grid-area: greet; align-self: end; font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#today.td-ff-phone .td-face-btn { grid-area: face; width: 44px; }
#today.td-ff-phone .td-face-btn::before { inset: -22%; }
#today.td-ff-phone .td-face { box-shadow: 0 0 0 2px var(--surface-0), 0 0 0 3.5px color-mix(in srgb, var(--accent-solid) 70%, var(--accent-to)); }
#today.td-ff-phone .td-ai { grid-area: badge; justify-self: start; align-self: start; margin-top: 2px; font-size: 10.5px; padding: 0 8px; }
#today.td-ff-phone #td-refresh { grid-area: ref; }
#today.td-ff-phone #td-custom-open { grid-area: cus; }
#today.td-ff-phone .td-hbtn { width: 44px; min-width: 44px; min-height: 44px; padding: 0; justify-content: center; }
#today.td-ff-phone .td-hbtn .ic { margin: 0; }
#today.td-ff-phone .td-btn-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#today.td-ff-phone #td-status { grid-area: status; }
#today.td-ff-phone #td-status:empty { display: none; }
#today.td-ff-phone .td-nowcard { margin-bottom: 14px; }
#today.td-ff-phone .td-wx-hours { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.td-sep { color: var(--text-3); }

/* Tablet: two tracks whatever Today's width (L spans both, S and M take one), the desktop order. */
#today.td-ff-tablet .td-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
#today.td-ff-tablet .td-grid > .td-md-6 { grid-column: span 6; }
#today.td-ff-tablet .td-grid > .td-md-12 { grid-column: span 12; }
#today.td-ff-tablet .td-scroll { padding-bottom: calc(28px + var(--safe-b)); }
/* The tablet keeps the full header (with the date), so the Now card doesn't repeat it. */
#today.td-ff-tablet .td-now-date { display: none; }
.td-grid[hidden] { display: none; }

/* Pull to refresh: a spinner that follows the finger (steps, no inline style) and spins while it loads. */
.td-pull { position: sticky; top: 0; z-index: 4; display: flex; justify-content: center; height: 0; margin: 0 auto; pointer-events: none; }
.td-pull-spin {
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border-radius: 50%;
  border: 3px solid var(--hairline-strong);
  border-top-color: var(--accent-solid);
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(-40px);
  transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.td-pull.on .td-pull-spin { opacity: 1; }
.td-pull[data-step="1"] .td-pull-spin { transform: translateY(-32px) rotate(45deg); }
.td-pull[data-step="2"] .td-pull-spin { transform: translateY(-22px) rotate(90deg); }
.td-pull[data-step="3"] .td-pull-spin { transform: translateY(-12px) rotate(135deg); }
.td-pull[data-step="4"] .td-pull-spin { transform: translateY(0) rotate(180deg); }
.td-pull[data-step="5"] .td-pull-spin { transform: translateY(6px) rotate(225deg); }
.td-pull[data-step="6"] .td-pull-spin { transform: translateY(10px) rotate(270deg); }
.td-pull[data-step="7"] .td-pull-spin { transform: translateY(13px) rotate(315deg); }
.td-pull[data-step="8"] .td-pull-spin { transform: translateY(16px) rotate(360deg); }
.td-pull.ready .td-pull-spin { border-color: var(--accent-solid); border-top-color: var(--accent-to); }
.td-pull.busy .td-pull-spin { opacity: 1; transform: translateY(8px); animation: td-spin calc(var(--dur-slow) * 3) linear infinite; }
@keyframes td-spin { to { transform: translateY(8px) rotate(360deg); } }
/* Reduced motion: no travel, no rubber band, no snapping animation; only the spinner shows. */
@media (prefers-reduced-motion: reduce) {
  .td-pull .td-pull-spin, .td-pull[data-step] .td-pull-spin { transform: translateY(8px); transition: none; }
  .td-pull.busy .td-pull-spin { animation: none; border-top-color: var(--accent-to); }
  .td-chev, .td-dot-i { transition: none; }
  #today.td-ff-phone .td-swipe > .td-grid { scroll-behavior: auto; }
}

/* ---------- The native apps' title strip ---------- */
html.shell .td-scroll { padding-top: calc(var(--titlebar) + clamp(12px, 2.4vw, 26px)); }

/* Phase 128 (PL2b, POLISH2 N27): Next steps, the same card as Getting started with three wide buttons. */
#today .today-next-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-3); }
#today .next-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 2px 10px; min-height: 44px; padding: var(--s-2) var(--s-3); text-align: start; white-space: normal; border-radius: var(--r-control); }
#today .next-card .next-ic { grid-row: span 2; width: 22px; height: 22px; color: var(--accent-text); margin-top: 2px; }
#today .next-card .next-title { font-weight: 600; color: var(--text-1); overflow-wrap: anywhere; }
#today .next-card .next-text { overflow-wrap: anywhere; }
#today .today-next .today-start-head { display: flex; align-items: center; justify-content: flex-start; gap: var(--s-2); }
#today .today-next .today-start-head h3 { flex: 0 1 auto; }
#today .today-next .today-start-head .tip { margin-left: 0; }
#today .today-next #td-next-hide { margin-inline-start: auto; }
@container (max-width: 720px) { #today .today-next-list { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { #today .today-next-list { grid-template-columns: minmax(0, 1fr); } }
