/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; min-height: 52px; padding: var(--space-3) var(--space-4);
  border: var(--border) solid var(--ink); border-radius: var(--radius-sm);
  background: var(--signal); color: var(--on-signal);
  font-weight: 700; font-size: 17px; line-height: 1; text-decoration: none;
  border-color: var(--signal);
}
@media (hover: hover) and (pointer: fine) { .btn:hover { color: var(--on-signal); filter: brightness(0.97); } }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary, .btn-secondary:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-dark:hover { color: var(--paper); }
.btn-inline { width: auto; min-height: var(--tap); padding: var(--space-3) var(--space-4); font-size: 15px; }
.link-button { background: none; border: 0; padding: 0; text-decoration: underline; font-weight: 700; color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .link-button:hover { color: var(--signal); } }
/* A text button is one line tall; its tap area reaches 44px without moving anything around it. */
.link-button { position: relative; }
.link-button::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: var(--tap); transform: translateY(-50%); }
.back {
  width: var(--tap); height: var(--tap); border-radius: 50%; flex: none;
  border: var(--border) solid var(--line); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}

/* Fields */
.field { display: flex; flex-direction: column; gap: var(--space-1-5); }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: var(--space-1-5); }
.field > label, .label { font-size: 14px; font-weight: 700; }
.field input[type="text"], .field input[type="email"], .field input[type="number"], .field input[type="date"], .field input[type="file"], .field textarea, .field select {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 52px; padding: var(--space-3) var(--space-4);
  border: var(--border) solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 18px;
}
.field input:focus-visible, .field textarea:focus-visible { outline: none; border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.code-boxes input:focus-visible { outline: none; border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.input-big input:focus-visible { outline: none; }
.input-big:focus-within { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
/* A file picker: the whole dashed box is the button; the real input covers it, invisible. */
.file-pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-1-5); padding: var(--space-5) var(--space-4); text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.file-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-pick:focus-within { border-color: var(--signal); }
@media (hover: hover) and (pointer: fine) { .file-pick:hover { border-color: var(--signal); } }
.file-pick-icon { width: 30px; height: 30px; fill: none; stroke: var(--signal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.file-pick-name { font-size: 17px; overflow-wrap: anywhere; }
.file-pick-chosen { border-style: solid; border-color: var(--green); }
.file-pick-chosen .file-pick-icon { stroke: var(--green); }
.field .hint { font-size: 13px; color: var(--muted); }
.field .error { font-size: 14px; color: var(--warn); font-weight: 700; }
.field-big input { font-family: var(--font-display); font-weight: 800; font-size: 34px; line-height: 1; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.fields-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-3); }

.checkbox { display: flex; gap: var(--space-2); align-items: flex-start; font-size: 15px; }
.checkbox input { width: 22px; height: 22px; margin: var(--space-0-5) 0 0; flex: none; accent-color: var(--ink); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: var(--space-1); gap: var(--space-1); border: var(--border) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
/* Inner radius = the control's radius less its padding, so the corners run parallel. */
.segmented label { display: flex; align-items: center; justify-content: center; min-height: var(--tap); border-radius: calc(var(--radius-sm) - 4px); font-weight: 700; cursor: pointer; }
/* Links in a segmented control (History's Weeks and List, the chart's range): the current one filled. */
.segmented > a { display: flex; align-items: center; justify-content: center; min-height: var(--tap); border-radius: calc(var(--radius-sm) - 4px); font-weight: 700; line-height: 1; text-decoration: none; color: var(--ink); }
.segmented > a.on { background: var(--ink); color: var(--paper); }
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label:has(input:checked) { background: var(--ink); color: var(--paper); }

/* The weigh-in input: number, unit, save */
.input-big {
  display: flex; align-items: stretch;
  border: var(--border) solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
.input-big input { flex: 1; min-width: 0; border: 0; background: transparent; padding: var(--space-2) var(--space-3); font-family: var(--font-display); font-weight: 800; font-size: 64px; line-height: 1; color: var(--ink); }
.input-big input::placeholder { color: var(--line); opacity: 1; }
.field .input-big input { border: 0; border-radius: 0; min-height: 0; background: transparent; box-shadow: none; }
.note-line input[type="text"] { width: 100%; min-height: 44px; padding: var(--space-2) var(--space-4); border: var(--border) solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 16px; }
.note-line input[type="text"]:focus-visible { outline: none; border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.input-big .unit { align-self: center; padding-right: var(--space-3); font-weight: 700; font-size: 15px; color: var(--muted); }
.input-big .save { border: 0; border-radius: 0; background: var(--signal); color: var(--on-signal); padding: 0 var(--space-4); font-weight: 700; font-size: 17px; }
.input-big .save:disabled { opacity: 0.4; }
.input-big .saved { align-self: center; padding: 0 var(--space-4); color: var(--green); font-weight: 700; display: inline-flex; align-items: center; gap: var(--space-1-5); }
/* The morning entry: number, chips and note in one card. */
.entry { border: var(--border) solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.entry-saved { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.entry-disabled { opacity: 0.6; }
.entry .input-big, .entry .input-big:focus-within { border: 0; border-radius: 0; box-shadow: none; }
/* The number's own ring is off inside the card, so the card shows where the typing goes. */
.entry:has(.input-big input:focus-visible) { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.entry .input-big .save { border-radius: 0; }
.entry-body { padding: var(--space-3) var(--card-pad) var(--card-pad); border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: var(--space-3); }
.entry-error { padding: 0 var(--card-pad) var(--space-3); font-weight: 700; }
.input-big-centered { justify-content: center; padding: var(--space-4) 0; }
.input-big-centered input { flex: 0 1 auto; width: 5.4ch; text-align: right; font-size: 72px; }
.input-big-centered .unit { padding: 0 0 0 var(--space-1-5); font-size: 18px; }
.input-big-disabled { opacity: 0.6; }
/* The unit follows the digits on their baseline: the input is as wide as what's typed (or its placeholder), never
   narrower than three digits, and an empty label fills the rest of the row so a tap anywhere still focuses it. */
.input-big:not(.input-big-centered) { align-items: baseline; justify-content: flex-start; gap: var(--space-1-5); }
.input-big:not(.input-big-centered) input { flex: 0 1 auto; width: 5ch; min-width: 3ch; padding-right: 0; }
@supports (field-sizing: content) {
  .input-big:not(.input-big-centered) input { width: auto; field-sizing: content; }
}
.input-big:not(.input-big-centered) .unit { align-self: baseline; padding-right: 0; }
.input-big-rest { flex: 1; align-self: stretch; cursor: text; }
.input-big .saved { white-space: nowrap; }

/* Chips, tabs and pills: line-height 1 in a flex box with symmetric padding, so the text sits centred whatever font loads. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 var(--space-3);
  border: var(--border) solid var(--line); border-radius: var(--pill); background: var(--surface);
  font-weight: 700; font-size: 14px; line-height: 1; cursor: pointer; user-select: none;
  position: relative;
}
/* 34px to look at, 42px to tap: the tap area takes half of the 8px gap on each side. */
:is(label, button, a).chip::before { content: ""; position: absolute; inset: calc(-4px - var(--border)) 0; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip:has(input:checked), .chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip:has(input:focus-visible) { outline: 2.5px solid var(--signal); outline-offset: 2px; }
.chip-more { border-style: dashed; border-color: var(--dash); background: transparent; }
.chip-add { display: inline-flex; align-items: center; gap: var(--space-1-5); }
.chip-add input[type="text"] { min-height: 34px; width: 140px; padding: 0 var(--space-3); border: var(--border) dashed var(--dash); border-radius: var(--pill); background: var(--surface); font-size: 16px; }
.chips [hidden] { display: none; }
/* A day's tags, tapped half awake: full 44px chips with a stroke icon, ink when on; "Nothing special" green when on.
   A measured tag carries a small badge with what it does to the next morning. */
.tag-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.tag-chips [hidden] { display: none; }
.tag-chip {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-1-5); min-height: var(--tap); padding: 0 var(--space-3) 0 10px;
  border: var(--border) solid var(--line); border-radius: var(--pill); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 15px; line-height: 1; cursor: pointer; user-select: none; touch-action: manipulation;
  min-width: 0; max-width: 100%; overflow-wrap: anywhere;
}
.tag-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.tag-badge-slot { display: contents; }
.tag-badge-slot:empty { display: none; }
.tag-status:not(:has(.warn)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tag-status { margin: 0; }
.tag-chip:has(input:focus-visible), .tag-chip-more:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.tag-chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tag-chip-plain:has(input:checked) { background: var(--green-deep); border-color: var(--green-deep); color: var(--paper); }
.tag-chip-more { padding: 0 var(--space-3); border-style: dashed; border-color: var(--dash); background: transparent; }
.tag-chips .chip-add input[type="text"] { min-height: var(--tap); width: 150px; padding: 0 var(--space-3); border: var(--border) dashed var(--dash); border-radius: var(--pill); background: var(--surface); font-size: 16px; }
.tag-icon { flex: none; display: block; }
.tag-badge { font-size: 12px; font-variant-numeric: tabular-nums; padding: 3px 6px; border-radius: var(--pill); }
.tag-badge-above { background: var(--warn-tint); color: var(--warn); }
.tag-badge-below { background: var(--green-tint); color: var(--green-deep); }
.tag-chip:has(input:checked) .tag-badge { background: color-mix(in oklab, var(--paper) 16%, transparent); color: var(--paper); }
@media (hover: hover) and (pointer: fine) {
  .tag-chip:not(:has(input:checked)):hover { border-color: var(--dash); }
}
@media (prefers-reduced-motion: no-preference) {
  .tag-chip { transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out, scale 150ms ease-out; }
  .tag-chip:active { scale: 0.97; }
  .tag-chip.popped:has(input:checked) .tag-icon { animation: tag-pop 220ms cubic-bezier(0.32, 0.72, 0, 1); }
}
@keyframes tag-pop { from { transform: scale(0.7) rotate(-8deg); } to { transform: none; } }

/* Yesterday or Today: a small segmented switch of links, the current one raised. */
.day-switch { display: inline-grid; grid-template-columns: 1fr 1fr; flex: none; gap: 3px; padding: 3px; border-radius: var(--pill); background: var(--line-soft); }
/* 36px tall inside the track; the tap area reaches 44px. */
.day-switch > a::after { content: ""; position: absolute; inset: -4px 0; }
.day-switch > a { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 var(--space-3); border-radius: var(--pill); font-weight: 700; font-size: 14px; line-height: 1; color: var(--muted); text-decoration: none; touch-action: manipulation; }
.day-switch > a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(17 20 24 / .12), inset 0 0 0 1px var(--line); }
.day-switch > a:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* A card's way on to the next screen ("See your tags ›"). */
.card-more-link { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 700; font-size: 15px; }

.pill {
  white-space: nowrap; flex: none;
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 var(--space-3);
  border-radius: var(--pill); font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
}
.pill-green { background: var(--green); color: var(--paper); }
.pill-green-soft { background: var(--green-tint); color: var(--green); }
.pill-warn { background: var(--warn); color: var(--paper); }
.pill-warn-soft { background: var(--warn-tint); color: var(--warn); }
.pill-ink { background: var(--ink); color: var(--paper); }
.pill-muted { background: var(--line-soft); color: var(--muted); }

/* Cards and tiles */
.card { border: var(--border) solid var(--line); border-radius: var(--radius); background: var(--surface); padding: var(--card-pad); }
.card-sky { background: var(--sky); border-color: var(--sky); }
.card-warn { background: var(--warn-tint); border-color: var(--warn-line); }
.card-green { background: var(--green-tint); border-color: var(--green); }
.card-dashed { border-style: dashed; background: transparent; }
.card-title { font-weight: 700; font-size: 17px; line-height: 1.2; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; border: var(--border) solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tile { padding: var(--card-pad); display: flex; flex-direction: column; gap: var(--space-0-5); }
.tile + .tile { border-left: 1px solid var(--line-soft); }
.tile .eyebrow { font-size: 13px; }
.tile .value { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; }
.tile .value-sm { font-size: 30px; }
/* A unit beside a tile's number stays with it, small, so "510 kcal" fits a third of a phone. */
.tile .value { white-space: nowrap; }
.tile .value .unit { font-family: var(--font-text); font-size: 15px; font-weight: 700; }
.tile .note { font-size: 13px; }

/* Lists */
.list { border: var(--border) solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--card-pad); min-height: 48px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { color: inherit; }
@media (hover: hover) and (pointer: fine) { .list-row:hover { background: var(--hover); } }
.list-row .value { color: var(--muted); font-size: 15px; text-align: right; }
.list-row .danger { color: var(--warn); }
.list-month { padding: var(--space-2) var(--card-pad); font-size: 13px; font-weight: 700; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line-soft); }

/* Step bar */
.steps { display: flex; flex-direction: column; gap: var(--space-2); }
.steps .bar { display: grid; gap: var(--space-1-5); }
.steps .bar .step { display: flex; align-items: center; height: 24px; }
.steps .bar .step > span { flex: 1; height: 5px; border-radius: var(--pill); background: var(--line-soft); }
.steps .bar .step.done > span { background: var(--signal); }
@media (hover: hover) and (pointer: fine) { .steps .bar a.step:hover > span { filter: brightness(0.9); } }

/* Flash */
.flash { padding: var(--space-3) var(--card-pad); border-radius: var(--radius-sm); font-size: 15px; font-weight: 700; }
.flash-notice { background: var(--green-tint); color: var(--green); }
.flash-alert { background: var(--warn-tint); color: var(--warn); }

/* Tabs: on phones a calm bottom bar, an icon over each label, the current one in orange (darker for text) under an orange top bar;
   from 900px a top bar aligned with the content. */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2;
  background: var(--paper); border-top: 1px solid var(--line-soft);
  padding: 0 0 max(10px, env(safe-area-inset-bottom));
}
.tabs-inner { max-width: var(--screen); margin: 0 auto; }
.tabs-brand { display: none; }
.tabs-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tabs-links a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1);
  min-height: 56px; padding-top: var(--space-1-5); font-weight: 700; font-size: 12px; line-height: 1; text-decoration: none; color: var(--muted);
}
.tabs-links a.active { color: var(--signal-text); }
.tabs-links a.active::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--signal); }
.tabs-links .tabs-desktop { display: none; }
.tabs-me .avatar { display: none; }

/* Progress bar */
.meter { height: 10px; overflow: hidden; border: var(--border) solid var(--line); border-radius: var(--pill); background: var(--surface); }
.meter > span { display: block; height: 100%; background: var(--signal); }

/* Today's first week: the seven days as a small chart, and its legend */
.first-week-chart svg { width: 100%; height: auto; display: block; }
.first-week-legend { display: flex; align-items: center; gap: var(--space-1); margin: 0; line-height: 1; }
.first-week-legend .legend-square { width: 8px; height: 8px; border: 1.5px solid var(--ink); background: var(--surface); } /* as the chart draws it: its dark-mode rules turn the squares the same way */
.first-week-legend .legend-line { width: 16px; height: 3px; border-radius: var(--pill); background: var(--signal); margin-left: var(--space-2); }

/* Code boxes */
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-2); }
.code-boxes input {
  width: 100%; min-height: 60px; text-align: center;
  border: var(--border) solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1;
}
.dev-code { font-size: 14px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }

.bullets { display: flex; flex-direction: column; gap: var(--space-2); font-size: 15px; }
.bullets li { display: flex; gap: var(--space-3); align-items: flex-start; }
.bullets li::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; background: var(--green); }

@media (min-width: 900px) {
  .tabs { position: sticky; top: 0; bottom: auto; background: var(--surface); border-top: 0; border-bottom: 1px solid var(--line); padding: 0; }
  /* The bar's content lines up with the page's content, however wide the window. */
  /* One width on every page, so the logo and Me never move between tabs; narrower pages centre under it. */
  .tabs-inner { max-width: var(--nav-width); height: 62px; padding: 0 var(--gutter); display: flex; align-items: center; gap: var(--space-5); }
  .tabs-brand { display: inline-flex; }
  .tabs-links { display: flex; flex: 1; gap: var(--space-1); align-items: center; }
  .tabs-links a { flex-direction: row; gap: var(--space-2); padding: 0 var(--space-4); min-height: 40px; border-radius: var(--pill); font-size: 15px; color: var(--ink); }
  .tabs-links a.active { color: var(--ink); background: var(--signal-tint); }
  .tabs-links a.active::before { display: none; }
  .tab-icon { display: none; }
  .tabs-links .tabs-desktop { display: flex; }
  .tabs-links .tabs-me { margin-left: auto; padding: 0 var(--space-4) 0 var(--space-1); gap: var(--space-2); }
  .tabs-me .avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--paper);
    font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  }
  .chip, .pill { font-size: 14px; }
}

/* M2: plan, route and status */
.segment { border: 0; background: transparent; min-height: var(--tap); border-radius: calc(var(--radius-sm) - 4px); font-weight: 700; line-height: 1; display: flex; align-items: center; justify-content: center; }
.segment.on { background: var(--ink); color: var(--paper); }
.segmented-3 { grid-template-columns: repeat(3, 1fr); }
button.chip { font: inherit; font-weight: 700; font-size: 14px; color: var(--ink); }
button.chip.on, a.chip.on { color: var(--paper); }
a.chip { text-decoration: none; color: var(--ink); }
.chip-fix { border-color: var(--ink); }
.chip-done { background: var(--green-tint); border-color: var(--green-tint); color: var(--green); cursor: default; }
.card-soft { background: var(--warn-tint); border-color: var(--warn-tint); }
.row-top { display: flex; gap: var(--space-3); align-items: flex-start; }
.row.wrap { flex-wrap: wrap; }
.left { text-align: left; align-self: flex-start; }
.inline { display: inline; }
.error-text { color: var(--warn); font-weight: 700; font-size: 14px; }
.warn-note { color: var(--warn); }
.btn-green { background: var(--green); border-color: var(--green); color: var(--paper); }
.btn-green:hover { color: var(--paper); }
.status-title { font-weight: 700; font-size: 18px; line-height: 1.15; }
.banner .banner-title { font-size: 19px; color: var(--green); }
.banner { display: flex; flex-direction: column; gap: var(--space-3); }
.shape { flex: none; }
.fields-finish { display: grid; grid-template-columns: 1fr 1.6fr; gap: var(--space-3); }
.stop-card .field input { min-height: 44px; font-size: 17px; padding: var(--space-2) var(--space-3); }
.title-input { flex: 1; min-width: 0; border: 0; border-bottom: 1.5px dashed var(--line); background: transparent; padding: var(--space-0-5) 0; font-weight: 700; font-size: 18px; color: var(--ink); }
.title-input:focus-visible { outline: none; border-bottom-color: var(--signal); }
.stop-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.stop-fields .field-date { grid-column: 1 / -1; }
.stop-next { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
/* Under 360px a third of the row can't hold a number and its label: the three tiles stack. */
@media (max-width: 359px) {
  .tiles-3 { grid-template-columns: 1fr; }
  .tiles-3 .tile + .tile { border-left: 0; border-top: 1px solid var(--line-soft); }
}
.tiles-grid .tile:nth-child(3) { border-left: 0; }
.tiles-grid .tile:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
.loop-marks { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
.loop-mark { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-1); text-align: center; }
.loop-mark-number { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1; }
.loop-mark-word { font-size: 14px; font-weight: 700; line-height: 1; }
.loop-mark-done { background: var(--green-tint); border-color: var(--green-tint); color: var(--green-deep); }
.loop-mark-next { border-color: var(--signal); }
.option-card { position: relative; display: grid; grid-template-rows: auto 44px; align-items: center; gap: var(--space-2); cursor: pointer; }
.option-pace { position: absolute; top: var(--card-pad); right: var(--card-pad); display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: 14px; color: var(--muted); }
.option-pace b { color: var(--ink); font-size: 16px; }
.option-value { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: var(--space-2); height: 44px; }
.option-value input { min-height: 0; height: 44px; }
.option-card:has(input:checked) { border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.option-card:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.aim-input { width: 90px; min-height: 40px; padding: var(--space-1-5) var(--space-3); border: var(--border) solid var(--line); border-radius: 8px; background: var(--field); font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.chart { width: 100%; height: auto; display: block; }
.option-card .aim-input.date-input { width: 190px; font-family: var(--font-text); font-weight: 700; font-size: 17px; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-1-5) var(--space-4); font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: var(--space-1-5); }
.legend .legend-band { height: 9px; background: var(--green-tint); outline: 1px dashed var(--green); }
.legend .legend-old { background: repeating-linear-gradient(90deg, var(--dash) 0 4px, transparent 4px 7px); }
.legend .legend-new { background: var(--blue); }
.seg-links { display: inline-flex; border: var(--border) solid var(--line); border-radius: calc(var(--radius-sm) - 4px); overflow: hidden; }
.seg-links a { padding: var(--space-1-5) var(--space-3); font-size: 13px; font-weight: 700; line-height: 1; text-decoration: none; color: var(--ink); }
.seg-links a.on { background: var(--ink); color: var(--paper); }

/* Development-only persona switcher, floating above the tabs */
.dev-switcher { position: fixed; right: 16px; bottom: 96px; z-index: 50; }
.dev-switcher > summary {
  list-style: none; cursor: pointer; width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #7C3AED; color: #FFFFFF; font-weight: 700; font-size: 13px; box-shadow: 0 6px 16px rgb(17 20 24 / .25);
}
.dev-switcher > summary::-webkit-details-marker { display: none; }
.dev-switcher-panel {
  position: absolute; right: 0; bottom: 58px; width: 220px; max-height: 60dvh; overflow-y: auto;
  background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius); padding: var(--space-2);
  box-shadow: 0 10px 30px rgb(17 20 24 / .2); display: flex; flex-direction: column; gap: var(--space-0-5);
}
.dev-switcher-panel form { margin: 0; }
.dev-switcher-person { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.dev-switcher-person:hover, .dev-switcher-person.current { background: var(--signal-tint); }
@media (min-width: 900px) { .dev-switcher { bottom: 24px; } }

/* A chip that is a radio button */
.chip-radio { cursor: pointer; }
.chip-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-radio:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip-radio:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.appearance { width: 228px; flex: none; padding: 3px; }
.language { width: 228px; flex: none; padding: 3px; }
.language .segment { min-height: 44px; border-radius: 9px; font-size: 14px; }
/* In a settings row the switch steps into the row's own padding, so the row stays the height of its neighbours. */
.list-row > .appearance, .list-row > .language { margin-block: -10px; padding: 2px; }
.list-row > .appearance button, .list-row > .language .segment { min-height: 36px; border-radius: 8px; }
.appearance button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer; }
.appearance button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.appearance button:focus-visible, .segmented label:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.btn-danger, .btn-danger:hover { background: #B23A0A; border-color: #B23A0A; color: #FFFFFF; }

/* Actions at the end of a page (Log out, Manage crew, Log a past day): centred, quiet, easy to tap. */
.page-end { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-2) 0 var(--space-1); font-size: 15px; }
.page-end-row { flex-direction: row; justify-content: center; gap: var(--space-5); }
.page-end a, .page-end .link-button { font-weight: 700; min-height: var(--tap); display: inline-flex; align-items: center; }
.page-end form { margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Small explanatory drawings (How Trendot works, the install steps): inline SVG coloured by tokens, so dark mode follows. */
.art-sky { fill: var(--sky); }
.art-surface { fill: var(--surface); }
.art-ink { fill: var(--ink); stroke: var(--ink); }
.art-ink-fill { fill: var(--ink); }
.art-ink-line { stroke: var(--ink); stroke-width: 2; }
.art-line { fill: none; stroke: var(--line); stroke-width: 1.5; }
.art-surface.art-line { fill: var(--surface); }
.art-muted-line { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art-muted-fill { fill: var(--line); }
.art-readout { fill: var(--paper); font: 700 11px var(--font-text); }
.art-signal { fill: var(--signal); }
.art-signal-soft { fill: var(--signal-tint); stroke: var(--signal); stroke-width: 1.5; }
.art-action { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.art-sun { fill: var(--sun); }
.art-dot { fill: var(--muted); opacity: 0.55; }
.art-trend { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; }
.art-hill { fill: var(--paper); }
.art-route { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linecap: round; }
.art-green { fill: var(--green); }
.art-blue { fill: var(--blue); }

/* Add to home screen: two illustrated iPhone steps side by side, or one Install button. */
.install-how { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1-5); }
.install-how li { line-height: 1.5; }
.install-how-inline { padding: 0; list-style: none; display: inline; }
.install-how-inline li { display: inline; }
.install-how-inline li + li::before { content: ", then "; }
.install-how-inline li:last-child::after { content: "."; }
.install-icon { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.3em; margin: 0 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install-icon circle { fill: currentColor; stroke: none; }
/* Nothing about installing inside the installed app itself. */
@media (display-mode: standalone) { .hide-in-app { display: none !important; } }

/* iOS 27 paints the installed app's status bar in a colour it samples from the top of the page and fades it into
   what's below: on Today that's paper fading into the sky header. It takes the colour from a fixed element at the very
   top, so a strip as tall as the status bar, in the colour of the screen's header, gives a clean edge: sky on Today,
   paper elsewhere. Over 10px, as WebKit is said to ignore thinner ones; portrait only, where the status bar is on top. */
:root { --status-bar-edge: max(11px, env(safe-area-inset-top)); }
.status-bar-edge { display: none; }
@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) and (orientation: portrait) {
    .status-bar-edge {
      display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 3;
      height: var(--status-bar-edge); background: var(--paper); pointer-events: none;
    }
    body:has(.header-sky) .status-bar-edge { background: var(--sky); }
    /* On an iPad the tabs are on top: they stop under the strip instead of behind it. */
    @media (min-width: 900px) { .tabs { top: var(--status-bar-edge); } }
  }
}
.install-strip { display: flex; align-items: center; gap: var(--space-3); }
.install-strip .grow { min-width: 0; }
.install-strip .link-button { min-height: var(--tap); display: inline-flex; align-items: center; }



/* Pressed: everything tappable answers the moment a finger lands, as a native control does, not when it lifts.
   The action still waits for the lift, so sliding off cancels. Rows wait 80ms before lighting, so a thumb scrolling
   a list doesn't light every row it crosses. Long-pressing a control selects nothing and opens no link menu;
   the words on cards and in rows that are content stay selectable. */
:is(.btn, .link-button, .back, .chip, .tabs-links a, .day-switch > a, a.list-row, a.history-row, a.tag-day, a.run-card, .glimpse-map, .pass-card-offer) {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.btn:not(:disabled):active { filter: brightness(0.92); }
.btn-secondary:not(:disabled):active, .back:active { background: var(--line-soft); filter: none; }
/* Only rows that are links: a plain row (Appearance, a crew member, a device) has nothing to press. The a also
   lifts these over the mouse-only hovers in screens.css, which loads later. */
:is(a.list-row, a.history-row, a.tag-day:not(.on)):active { background: var(--line-soft); transition: background-color 0s 80ms; }
.link-button:active, .tabs-links a:active { opacity: 0.6; }
@media (prefers-reduced-motion: no-preference) {
  :is(.btn, .back, a.run-card, .pass-card-offer, .tabs-links a .tab-icon) { transition: scale 120ms ease-out, filter 120ms ease-out, background-color 120ms ease-out; }
  :is(.btn:not(:disabled), .back):active { scale: 0.97; }
  :is(a.run-card, .pass-card-offer):active { scale: 0.985; }
  .tabs-links a:active .tab-icon { scale: 0.88; }
}
