@import url('fonts.css');

/* ==================================================================
   Cold Start Trainer
   Design tokens carried from the Cold Start program document, retuned
   for a tool: denser, bigger targets, bottom-anchored navigation.
   ================================================================== */

:root {
  /* light — the complete palette lives here */
  --ground:      #FAF9F8;
  --surface:     #FFFFFF;
  --surface-alt: #F2F0EF;
  --surface-sunk:#EDEAE9;
  --ink:         #17161A;
  --ink-muted:   #6B6670;
  --ink-faint:   #928C94;
  --rule:        #E4DFDF;
  --rule-strong: #CFC8C8;
  --accent:      #B3241C;
  --accent-ink:  #FFFFFF;
  --accent-soft: #F6E4E2;
  --steel:       #1F4E79;
  --steel-soft:  #E3EBF3;
  --good:        #1B6E3C;
  --good-soft:   #E1F0E7;
  --shadow:      0 1px 2px rgba(23, 22, 26, .06), 0 4px 12px rgba(23, 22, 26, .04);

  --f-display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-body:    'Source Serif 4', Georgia, 'Times New Roman', serif;
  --f-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --tap: 44px;
  --page: min(100% - 1.75rem, 44rem);
  --tabbar: 4.25rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #141316;
    --surface:     #1C1A1F;
    --surface-alt: #232025;
    --surface-sunk:#111013;
    --ink:         #EEEBE9;
    --ink-muted:   #A29BA4;
    --ink-faint:   #7D767F;
    --rule:        #2F2B33;
    --rule-strong: #423C46;
    --accent:      #E4574C;
    --accent-ink:  #1C1A1F;
    --accent-soft: #3A1F1E;
    --steel:       #7FAED8;
    --steel-soft:  #1D2A36;
    --good:        #5CBE85;
    --good-soft:   #16301F;
    --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px rgba(0, 0, 0, .3);
  }
}

:root[data-theme="dark"] {
  --ground:      #141316;
  --surface:     #1C1A1F;
  --surface-alt: #232025;
  --surface-sunk:#111013;
  --ink:         #EEEBE9;
  --ink-muted:   #A29BA4;
  --ink-faint:   #7D767F;
  --rule:        #2F2B33;
  --rule-strong: #423C46;
  --accent:      #E4574C;
  --accent-ink:  #1C1A1F;
  --accent-soft: #3A1F1E;
  --steel:       #7FAED8;
  --steel-soft:  #1D2A36;
  --good:        #5CBE85;
  --good-soft:   #16301F;
  --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* No pull-to-refresh mid-workout, and no rubber-band over the tab bar. */
  overscroll-behavior-y: contain;
}

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- app frame ---------------- */

#app {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  width: var(--page);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 3.25rem;
}

.topbar h1 {
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.week-chip {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  padding: .3rem .5rem;
  border-radius: 3px;
  white-space: nowrap;
}
.week-chip.is-deload { background: var(--steel); }

main {
  width: var(--page);
  margin-inline: auto;
  padding-block: 1.25rem 2rem;
}

.view { display: none; flex-direction: column; gap: 1.25rem; }
.view.is-active { display: flex; }

/* ---------------- bottom tab bar ---------------- */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar button {
  appearance: none;
  border: 0;
  background: none;
  min-height: var(--tabbar);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .5rem .25rem;
  cursor: pointer;
  color: var(--ink-faint);
  font-family: var(--f-mono);
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-top: 2px solid transparent;
  margin-top: -1px;
}
.tabbar button svg { width: 22px; height: 22px; stroke-width: 1.75; }
.tabbar button[aria-selected="true"] { color: var(--accent); border-top-color: var(--accent); }

/* ---------------- generic surfaces ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: .5rem .75rem;
  flex-wrap: wrap;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.card-head h2 { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; }
.card-head .spacer { margin-left: auto; }

.section-head {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--ink);
}
.section-head h2 {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.note {
  font-family: var(--f-body);
  font-size: .9375rem;
  color: var(--ink-muted);
  line-height: 1.55;
}

.banner {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: .8rem 1rem;
  font-family: var(--f-body);
  font-size: .9375rem;
  line-height: 1.55;
}
.banner strong { font-family: var(--f-display); font-weight: 700; }
.banner.is-steel { background: var(--steel-soft); border-left-color: var(--steel); }

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-muted);
  font-family: var(--f-body);
  font-size: .9375rem;
}

/* ---------------- buttons ---------------- */

.btn {
  appearance: none;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  min-height: var(--tap);
  padding: .5rem 1rem;
  border-radius: 5px;
  font-family: var(--f-display);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  /* .btn is used on <a> too (the Health bridge must be a real link) */
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: transparent; background: none; color: var(--ink-muted); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 auto; }

/* ---------------- session ---------------- */

.session-head {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.session-head h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.025em;
}
.session-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.day-chip {
  font-family: var(--f-mono);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--ground);
  padding: .25rem .5rem;
  border-radius: 3px;
}

.warmup {
  font-family: var(--f-body);
  font-size: .9375rem;
  color: var(--ink-muted);
  background: var(--surface-alt);
  border-radius: 5px;
  padding: .75rem .9rem;
  line-height: 1.5;
}

/* ---------------- blocks ---------------- */

.block { display: flex; flex-direction: column; }

.block-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem 1rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--rule);
}
.block-letter {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1;
}
.block-rest {
  font-family: var(--f-mono);
  font-size: .6875rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.block-superset {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------------- exercise ---------------- */

.exercise { border-bottom: 1px solid var(--rule); padding: .9rem 1rem 1rem; }
.exercise:last-child { border-bottom: 0; }

.ex-head { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .7rem; }
.ex-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.005em;
}
.ex-name.is-pull { color: var(--steel); }

.ex-tags { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }

.tag {
  font-family: var(--f-mono);
  font-size: .6875rem;
  font-weight: 600;
  padding: .18rem .4rem;
  border-radius: 3px;
  border: 1px solid var(--rule-strong);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tag-rpe { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tag-rpe.is-low { color: var(--ink-muted); background: var(--surface-alt); }
.tag-cap { color: var(--steel); background: var(--steel-soft); border-color: transparent; }
.tag-fail { color: var(--accent-ink); background: var(--accent); border-color: transparent; }

.ex-note {
  font-family: var(--f-body);
  font-size: .875rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.last-time {
  font-family: var(--f-mono);
  font-size: .75rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------------- set rows ---------------- */

.sets { display: flex; flex-direction: column; gap: .4rem; }

.setrow {
  display: grid;
  grid-template-columns: 2.1rem 1fr 1fr 1fr var(--tap);
  align-items: center;
  gap: .4rem;
  background: var(--surface-sunk);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: .4rem;
}
.setrow.is-logged { background: var(--good-soft); border-color: transparent; }
.setrow.is-target { background: var(--surface-sunk); }

.set-n {
  font-family: var(--f-mono);
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.field { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.field label {
  font-family: var(--f-mono);
  font-size: .5625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-left: .15rem;
}
.field input {
  width: 100%;
  min-width: 0;
  min-height: 2.35rem;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: .2rem .1rem;
  appearance: none;
}
.field input::placeholder { color: var(--ink-faint); font-weight: 500; }
.field input:disabled { background: transparent; border-color: transparent; color: var(--ink-muted); }

.set-go {
  appearance: none;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  border-radius: 4px;
  min-width: var(--tap);
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 0;
}
.set-go svg { width: 20px; height: 20px; stroke-width: 2.25; }
.setrow.is-logged .set-go { background: var(--good); border-color: var(--good); color: var(--surface); }

/* ---------------- rest timer ---------------- */

.rest-timer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + .6rem);
  z-index: 40;
  display: none;
  align-items: center;
  /* Three actions now share this pill; it has to stay inside a 375px screen. */
  gap: .45rem;
  background: var(--ink);
  color: var(--ground);
  border-radius: 999px;
  padding: .5rem .5rem .5rem .9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
  width: max-content;
  max-width: calc(100vw - 2rem);
}
.rest-timer.is-on { display: flex; }
.rest-timer .t {
  font-family: var(--f-mono);
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.rest-timer .lab {
  font-family: var(--f-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .7;
}
.rest-timer.is-done .t { color: var(--accent); }
/* Paused has to read at a glance mid-set, or you stand there waiting on a
   clock that is not moving. */
.rest-timer.is-paused .t { opacity: .55; }
.rest-timer.is-paused .lab::after { content: ' · paused'; }
.rest-timer button {
  appearance: none;
  border: 0;
  background: rgba(255,255,255,.16);
  color: inherit;
  border-radius: 999px;
  min-width: 2.25rem;
  min-height: 2.25rem;
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: .75rem;
  font-weight: 600;
  padding: 0 .6rem;
}

/* ---------------- stats ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: .6rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .75rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.stat .v {
  font-family: var(--f-mono);
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.stat .v small { font-size: .8125rem; font-weight: 500; color: var(--ink-faint); }
.stat .d { font-family: var(--f-mono); font-size: .75rem; font-variant-numeric: tabular-nums; }
.stat .d.up { color: var(--good); }
.stat .d.down { color: var(--accent); }

/* ---------------- charts ---------------- */

.chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--ink-faint); font-family: var(--f-mono); font-size: 10px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line-muted { fill: none; stroke: var(--ink-muted); stroke-width: 2; stroke-dasharray: 3 3; }
.chart .area { fill: var(--accent); opacity: .08; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .dot-muted { fill: var(--ink-muted); opacity: .55; }
.chart .bar { fill: var(--accent); rx: 2; }
.chart .bar-deload { fill: var(--ink-muted); opacity: .45; }
.chart .endlabel { fill: var(--ink); font-family: var(--f-mono); font-size: 11px; font-weight: 600; }

.chart-legend {
  display: flex;
  gap: .9rem;
  flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: .6875rem;
  color: var(--ink-muted);
  padding: 0 1rem .8rem;
}
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-legend i { width: 12px; height: 2px; border-radius: 1px; background: var(--accent); }
.chart-legend i.muted { background: var(--ink-muted); }

.chart-wrap { padding: .9rem 1rem 0; }

/* ---------------- program reference ---------------- */

.prose { font-family: var(--f-body); font-size: 1rem; line-height: 1.6; color: var(--ink); }
.prose p + p { margin-top: .8rem; }
.prose strong { font-family: var(--f-display); font-weight: 700; }

.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 34rem; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--rule); font-size: .875rem; }
thead th {
  font-family: var(--f-mono);
  font-size: .625rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
tbody th { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
td.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.is-deload td, tr.is-deload th { background: var(--surface-alt); color: var(--ink-muted); }
tr.is-now td, tr.is-now th { background: var(--accent-soft); }

/* ---------------- settings / forms ---------------- */

.formrow {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.formrow:last-child { border-bottom: 0; }
.formrow label { font-size: .9375rem; font-weight: 600; flex: 1; }
.formrow input[type="date"],
.formrow input[type="text"],
.formrow input[type="number"] {
  min-height: var(--tap);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: .9375rem;
  padding: .3rem .5rem;
  max-width: 12rem;
}

.bw-entry { display: flex; gap: .5rem; align-items: flex-end; padding: 1rem; }
.bw-entry .field { flex: 1; }
.bw-entry .field input { font-size: 1.5rem; min-height: 3.25rem; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 4rem);
  z-index: 50;
  background: var(--ink);
  color: var(--ground);
  padding: .6rem 1rem;
  border-radius: 5px;
  font-size: .875rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  max-width: calc(100vw - 2rem);
  text-align: center;
}
.toast.is-on { opacity: 1; }

/* ---------------- narrow phones ---------------- */

@media (max-width: 24rem) {
  .setrow { grid-template-columns: 1.6rem 1fr 1fr 1fr 2.5rem; gap: .3rem; padding: .35rem; }
  .set-go { min-width: 2.5rem; }
  .field input { font-size: .9375rem; }
}

/* ---------------- date navigation ---------------- */

.datenav { margin-bottom: .75rem; }

.datenav-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.datenav-row input[type="date"] {
  flex: 1 1 auto;
  min-height: var(--tap);
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 1rem;
  padding: .4rem .6rem;
  text-align: center;
}

.datenav-step {
  appearance: none;
  flex: none;
  min-width: var(--tap);
  min-height: var(--tap);
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.datenav-step:disabled { opacity: .3; cursor: not-allowed; }

/* Editing a past day has to be unmistakable, or a correction gets typed into
   the wrong session and reads as real data forever. */
.datenav-back {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .5rem;
  padding: .4rem .75rem;
  border-radius: 5px;
  background: var(--steel-soft);
  color: var(--steel);
  font-family: var(--f-display);
  font-size: .8125rem;
  font-weight: 600;
}
.datenav-back .btn-inline { margin-left: auto; }
.datenav.is-backfill ~ .session-head .day-chip { background: var(--steel); }

.btn-inline {
  min-height: var(--tap);
  padding: .25rem .5rem;
  font-size: .8125rem;
  color: var(--steel);
  text-decoration: underline;
}

/* ---------------- session footer ---------------- */

.undo-hint {
  margin: 0 0 .75rem;
  font-size: .8125rem;
  color: var(--ink-faint);
  line-height: 1.45;
}
.undo-hint-mark {
  font-family: var(--f-mono);
  color: var(--good);
  font-weight: 600;
}

.session-footer { display: flex; flex-direction: column; gap: .6rem; }

.session-elapsed {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .6rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}
.session-elapsed .v { margin-left: auto; font-size: 1.125rem; font-weight: 600; }

/* ---------------- session history ---------------- */

.histlist { border-top: 1px solid var(--rule); }

.histrow {
  appearance: none;
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  min-height: var(--tap);
  padding: .7rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.histrow:last-child { border-bottom: 0; }
.histrow.is-current { background: var(--steel-soft); }
.histrow-main { min-width: 0; }
.histrow-title {
  font-family: var(--f-display);
  font-size: .9375rem;
  font-weight: 600;
}
.histrow-meta {
  font-size: .8125rem;
  color: var(--ink-muted);
}
.histrow-go { margin-left: auto; color: var(--ink-faint); font-size: 1.25rem; line-height: 1; }
.tag-done { color: var(--good); background: var(--good-soft); border-color: transparent; }

/* ---------------- field notes ---------------- */

.notebox {
  border-top: 1px dashed var(--rule);
  padding: .5rem 0 0;
  margin-top: .25rem;
}

.note-toggle {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-family: var(--f-display);
  font-size: .8125rem;
  font-weight: 600;
  /* Full-width so the tap target clears 44px without a visible slab. */
  width: 100%;
  min-height: var(--tap);
  padding: .25rem 0;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.notebox.is-filled .note-toggle {
  color: var(--steel);
  font-family: var(--f-body);
  font-weight: 400;
  font-size: .875rem;
}
.notebox.is-filled { border-top-style: solid; border-top-color: var(--steel); }

.note-body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding-bottom: .5rem;
}
/* An author `display` beats the UA rule for [hidden], so restate it or every
   box renders open — which is exactly what the Today screen cannot afford. */
.note-body[hidden] { display: none; }

.note-body textarea {
  width: 100%;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--surface-sunk);
  color: var(--ink);
  font-family: var(--f-body);
  /* 16px exactly: anything smaller makes iOS zoom the page on focus. */
  font-size: 1rem;
  line-height: 1.45;
  padding: .55rem .65rem;
  resize: vertical;
}
.note-body textarea:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 1px;
}

.note-actions { display: flex; align-items: center; gap: .5rem; }
.note-actions .spacer { margin-left: auto; }

.note-kinds { display: flex; gap: .25rem; }
.note-kind {
  appearance: none;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 999px;
  /* Kept at the same --tap floor as every other control; a pill you have to
     aim at is worse than a pill that looks slightly chunky. */
  min-height: var(--tap);
  padding: .3rem .75rem;
  font-family: var(--f-display);
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.note-kind[aria-pressed="true"] {
  background: var(--steel-soft);
  border-color: var(--steel);
  color: var(--steel);
}

.notelist { border-top: 1px solid var(--rule); }
.noteday { padding: .75rem 1rem 0; }
.noteday > .eyebrow { display: block; margin-bottom: .4rem; }

.noteitem {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--rule);
}
.noteitem:last-child { border-bottom: 0; }
.noteitem-where {
  font-family: var(--f-display);
  font-size: .8125rem;
  font-weight: 600;
}
.noteitem-text { font-size: .875rem; color: var(--ink-muted); }

.note-kind-tag {
  flex: none;
  border-radius: 999px;
  padding: .15rem .45rem;
  font-family: var(--f-display);
  font-size: .6875rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--ink-muted);
}
.note-kind-tag.is-program { background: var(--accent-soft); color: var(--accent); }
.note-kind-tag.is-app { background: var(--steel-soft); color: var(--steel); }

.note-del {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-size: 1.25rem;
  line-height: 1;
  margin-left: auto;
  min-width: var(--tap);
  min-height: var(--tap);
  cursor: pointer;
}

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