:root {
  --green-bg: #d6f0da;
  --green-ink: #1d5b2c;
  --green-line: #a9d8b1;
  --amber: #f2b13b;
  --amber-ink: #3b2500;
  --ink: #1e2a2f;
  --teal: #17656b;
  --muted: #5d6e71;
  --field-line: #c9d3d2;
  --off-bg: #e3e8e7;
  --off-ink: #9aa8aa;
  --off-line: #d3dad9;
  --err-ink: #9b2c22;
  --err-bg: #fbe9e6;
  --err-line: #e8b4ac;
  --screen: #eef1f4;
  --well: #d7e8f6;
  --tray: #d7e8f6;
  --lid: #c3d3e1;
  --lid-ink: #2f3e48;
  --dot: #8faaa7;
  --rail: #c3d3d1;
  --done-solid: #1e7a3c;
  --late: #9a3b12;
  --late-ink: #ffffff;
  --off-text: #4a5558;
  --text-2: #3c4a4e;
  --danger: #b3261e;
  --neutral-line: #1e2a2f;
  --state-local-bg: #fff4d6;  --state-local-ink: #5a4300;
  --state-send-bg: #e3e7e8;   --state-send-ink: #3c4a4e;
  --state-refused-bg: #fce8e6; --state-refused-ink: #8c1d18;
  --font: "Atkinson Hyperlegible", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap; src: url("/atkinson-400.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap; src: url("/atkinson-700.woff2") format("woff2"); }

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--screen);
}
body.complete { }
button, input, a { font: inherit; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* buttons */
.btn {
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  padding: 0 16px;
  white-space: nowrap;
  flex: none;
  text-decoration: none;
  cursor: pointer;
}
.btn.outline, .btn.undo, .btn.back { background: #fff; border: 2px solid var(--teal); color: var(--teal); }
.btn.help { width: 96px; padding: 0 8px; gap: 6px; }
.btn.help .icon { width: 20px; height: 20px; }
.btn.done { background: var(--done-solid); border: 0; color: #fff; font-weight: 700; min-width: 122px; }
.btn.done .icon { width: 18px; height: 18px; stroke-width: 2.6; }
.btn.amber { background: var(--amber); border: 2px solid var(--amber); color: var(--amber-ink); }
.btn.amber .icon { width: 20px; height: 20px; }
.btn.neutral { background: #fff; border: 2px solid var(--neutral-line); color: var(--ink); font-weight: 700; }
.btn.full { width: 100%; }
.btn.small { height: 34px; border-radius: 9px; font-size: 14px; padding: 0 10px; gap: 4px; }
.btn.small.square { width: 40px; height: 40px; padding: 0; }
.btn[disabled], .btn.save[disabled] { background: var(--off-bg); border: 1.5px solid var(--off-line); color: var(--off-text); font-weight: 500; cursor: default; }
.btn[disabled] .icon { width: 18px; height: 18px; }

/* dashboard */
.top { display: flex; align-items: center; gap: 18px; padding: 10px 22px 0; }
.who { position: relative; }
.who-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.who-button::-webkit-details-marker { display: none; }
.who-menu { position: absolute; top: 54px; left: 0; z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 8px; background: #fff; border-radius: 14px; box-shadow: 0 6px 20px rgba(30, 42, 47, 0.2); }
h1[data-large-time] { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: -0.5px; white-space: nowrap; }
time[data-clock] { margin-left: auto; font-size: 22px; color: #4e5d62; }
.all-done { display: inline-flex; align-items: center; gap: 8px; margin: 10px 22px 0; padding: 0 14px; height: 40px; border-radius: 12px; background: var(--green-bg); color: #1f4d2a; font-size: 18px; font-weight: 700; }
.undone-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 22px 0; padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 17px; font-weight: 600; }
.btn.put-back { background: #fff; color: var(--teal); border: 0; font-weight: 700; }

.osmolite { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 24px 0; color: var(--text-2); font-size: 16px; }
.osmolite .icon { width: 17px; height: 17px; }
.banner { margin: 10px 22px 0; padding: 12px 16px; background: #fff; border-radius: 12px; font-weight: 700; }
.layout { display: flex; gap: 12px; padding: 12px 22px 8px; }
.layout > main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: var(--well); padding: 12px; border-radius: 22px; }
.supplies { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-heading { margin: 2px 0 0; font-size: 17px; font-weight: 700; color: #4e5d62; }

.tile { background: #fff; border-radius: 16px; padding: 14px; height: 132px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.compact .tile { height: 104px; padding: 12px; }
.tile:has(.say:not(:empty)) { height: auto; }
.tile.late { border: 2px solid var(--late); padding: 12px; }
.tile.is-done { background: var(--green-bg); border: 2px solid var(--green-line); padding: 12px; color: var(--green-ink); }
.tile-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tile-name > .icon, .row > .icon { width: 24px; height: 24px; color: var(--teal); }
.tile.is-done .tile-name > .icon { color: var(--green-ink); }
.names { min-width: 0; flex: 1; }
.names h3, .row h3 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.under { margin: 0; font-size: 16px; color: var(--text-2); line-height: 1.15; }
.tile.is-done .under { color: var(--green-ink); }
.due { margin: 0; font-size: 16px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.late-pill { height: 28px; border-radius: 8px; padding: 0 10px; background: var(--late); color: var(--late-ink); font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.late-pill .icon { width: 16px; height: 16px; }
.tile .late-pill { padding: 0 7px; font-size: 14px; margin-left: 6px; }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.btn.off { background: var(--off-bg); border: 0; color: var(--off-text); font-weight: 600; cursor: not-allowed; }
.btn.off .icon { width: 18px; height: 18px; }
.done-mark { height: 48px; display: inline-flex; align-items: center; gap: 10px; color: var(--green-ink); font-size: 22px; font-weight: 600; }
.check-circle { width: 36px; height: 36px; border-radius: 18px; background: #fff; border: 1.5px solid var(--green-line); display: inline-flex; align-items: center; justify-content: center; }
.check-circle .icon { stroke-width: 2.6; }
.btn.undo.small { height: 48px; width: auto; padding: 0 14px; font-size: 16px; border-radius: 12px; }
.say { margin: 6px 0 0; font-weight: 700; font-size: 15px; }
.say:empty { display: none; }

.row { background: #fff; border-radius: 16px; min-height: 66px; padding: 7px 12px 7px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; border: 2px solid var(--well); }
.row.late { border-color: var(--late); }
.row h3 { flex: none; }
.row .spacer { flex: 1; }
.row-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.row-actions .say { flex-basis: 100%; text-align: right; margin: 0; }
.reason { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--muted); }
.reason input { width: 110px; height: 40px; border: 2px solid var(--field-line); border-radius: 10px; padding: 0 10px; font-size: 16px; color: var(--ink); }
.done-row .spacer { display: none; }
.done-row h3 { margin-right: auto; }
.done-row form { display: contents; }
.done-row .btn.undo { font-size: 16px; padding: 0 12px; }
.next-time { margin: 0; font-size: 22px; font-weight: 600; }

aside[data-later] { width: 168px; flex: none; padding-top: 4px; }
aside[data-later] h2 { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: #4e5d62; }
.rail { list-style: none; margin: 0; padding: 0 0 0 20px; position: relative; }
.rail::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--rail); }
.rail li { position: relative; margin-bottom: 18px; display: flex; flex-direction: column; }
.rail li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 6px; background: var(--screen); border: 2px solid var(--dot); }
.rail b { font-size: 17px; font-weight: 600; }
.rail span { font-size: 16px; color: var(--text-2); line-height: 1.35; }
.rail .opens { font-size: 14px; font-weight: 700; color: var(--text-2); }

.manage { margin: 0; padding: 0 22px 12px; }
.manage a { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; color: var(--text-2); text-decoration: none; }
.manage .icon { width: 16px; height: 16px; }

/* wrong clock */
.dimmed { filter: grayscale(1); opacity: 0.45; pointer-events: none; user-select: none; }
.clock-notice { position: fixed; inset: 130px 0 auto; display: flex; justify-content: center; padding: 0 22px; }
.notice-card { background: #fff; border: 2px solid var(--err-line); border-radius: 22px; padding: 24px 32px; max-width: 600px; display: flex; flex-direction: column; gap: 8px; }
.notice-card p { margin: 0; font-size: 22px; }
.notice-card .clock-wrong { font-size: 30px; font-weight: 700; color: var(--err-ink); }
.notice-card form { display: flex; justify-content: flex-end; margin-top: 12px; }
.notice-card .btn { min-width: 122px; }

/* pages other than the dashboard */
.page-top { display: flex; align-items: center; gap: 14px; padding: 16px 22px 0; }
.btn.back { padding: 0 14px 0 8px; gap: 4px; }
.btn.back .icon { stroke-width: 2.4; }
.btn.back.icon-only { width: 48px; padding: 0; }
.btn.back.icon-only .icon { width: 24px; height: 24px; }
.page-title { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--teal); }
.page-title .icon { width: 26px; height: 26px; }
.page-title h1 { margin: 0; font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: -0.5px; white-space: nowrap; }
.page-top .patient-label { margin: 0 0 0 auto; padding-right: 4px; font-size: 22px; font-weight: 700; color: var(--teal); }
.page-top .patient-switch { margin-left: auto; position: relative; }
.page-top .patient-switch .patient-label { margin: 0; list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.page-top .patient-switch .patient-label::-webkit-details-marker { display: none; }
.page-top .patient-switch .who-menu { left: auto; right: 0; }
.page-well { margin: 12px 22px 22px; background: var(--well); border-radius: 22px; padding: 12px; display: grid; gap: 10px; align-content: start; min-height: 388px; }
.page-well > .card, .page-well > form > .card, .page-well > form.card { max-width: none; margin: 0; }
.page-well .card { background: #fff; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.page-well .card h2, .card-head h2 { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--muted); }
.page-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }

.steps-card { padding: 28px 36px !important; gap: 22px !important; min-height: 364px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.steps li, .dose-page { display: flex; align-items: center; gap: 16px; margin: 0; font-size: 30px; font-weight: 600; }
.steps li::before, .dose-page::before { content: ""; width: 12px; height: 12px; border-radius: 6px; background: var(--teal); flex: none; }

/* blood sugar */
.sugar { margin: 14px 22px 22px; }
.pad { display: flex; gap: 18px; min-height: 388px; }
.pad-well { flex: 1; background: var(--well); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pad-label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 20px; font-weight: 700; color: var(--amber-ink); }
.number-box { height: 120px; margin: 0; background: #fff; border: 2px solid var(--field-line); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 72px; font-weight: 700; letter-spacing: 2px; }
.meters { display: flex; gap: 10px; }
.meters .btn { flex: 1; }
.discarded { display: flex; align-items: center; gap: 12px; margin: 0; background: #fff; border-radius: 14px; padding: 10px 14px; }
.discarded s { font-size: 26px; font-weight: 600; color: var(--off-ink); }
.discarded span { font-size: 16px; font-weight: 600; color: var(--muted); }
.pad-keys { width: 330px; display: flex; flex-direction: column; gap: 10px; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { height: 66px; border-radius: 14px; background: #fff; border: 1.5px solid var(--field-line); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 600; color: var(--ink); cursor: pointer; }
.key .icon { width: 28px; height: 28px; }
.key.blank { background: transparent; border: 0; cursor: default; }
.btn.next { height: 64px; background: var(--teal); color: #fff; border: 0; font-size: 24px; font-weight: 700; }
.result-card { background: #fff; border-radius: 22px; padding: 24px; }
.result-card[hidden] { display: none; }
.large-number { font-size: 64px; font-weight: 700; margin: 0; }
.help { font-size: 22px; font-weight: 700; }
.units { font-size: 40px; font-weight: 700; }
.result { display: grid; grid-template-columns: auto auto 1fr; align-items: center; column-gap: 32px; row-gap: 12px; }
.result > .help, .result > .discarded, .result > form { grid-column: 1 / -1; }
.result > form { justify-self: end; }
.result-reading, .result-dose { display: flex; flex-direction: column; gap: 2px; }
.result-label { font-size: 16px; color: var(--text-2); }
.result-number { font-size: 30px; font-weight: 700; }
.result-band { font-size: 14px; color: var(--muted); }
.result-units { font-size: 40px; font-weight: 700; }
.state { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.state .icon { width: 16px; height: 16px; }
.state.local { background: var(--state-local-bg); color: var(--state-local-ink); }
.state.sending { background: var(--state-send-bg); color: var(--state-send-ink); }
.state.refused { background: var(--state-refused-bg); color: var(--state-refused-ink); }
.state.by { background: var(--green-bg); color: var(--green-ink); }
.hospital { min-height: 388px; background: var(--err-bg); border: 2px solid var(--err-line); border-radius: 22px; padding: 0 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px; position: relative; }
.hospital .big { margin: 0; font-size: 44px; font-weight: 700; color: var(--err-ink); line-height: 1.15; }
.hospital .small { margin: 0; font-size: 22px; }
.hospital-confirm { position: absolute; right: 16px; bottom: 16px; }

/* blood sugar ranges */
.page-well .card.ranges { gap: 0; }
.range { display: flex; gap: 12px; padding: 3px 0; border-top: 1px solid var(--well); font-size: 14px; line-height: 1.3; }
.card-head + .range { border-top: 0; }
.range b { width: 150px; flex: none; }
.help-words { color: var(--err-ink); font-weight: 600; }
.bands { display: flex; gap: 10px; align-items: center; border: 2px solid var(--teal); border-radius: 12px; padding: 2px 8px; margin: 3px -10px; }
.band-rows { flex: 1; }
.band-rows .range:first-child { border-top: 0; }
.band-actions { display: flex; flex-direction: column; gap: 6px; }
.band-actions .btn { width: 80px; }
.ranges-edit { gap: 10px !important; }
.band-row { display: flex; align-items: center; gap: 10px; }
.band-row input { height: 40px; width: 78px; border: 2px solid var(--field-line); background: #fff; border-radius: 10px; text-align: center; font-size: 18px; font-weight: 600; color: var(--ink); }
.band-row input[name^="units"] { width: 60px; }
.band-row input.bad { border-color: var(--err-ink); background: var(--err-bg); color: var(--err-ink); }
.band-row .dash { font-size: 18px; color: var(--muted); }
.band-row .gap { width: 24px; }
.band-row .spacer { flex: 1; }
.break { margin: 0 auto 0 0; color: var(--err-ink); font-weight: 600; }
.break:empty { display: none; }
.btn.save { background: var(--teal); border: 2px solid var(--teal); color: #fff; min-width: 122px; }

/* framed pages: header, one well, a footer row */
body.framed { height: 100vh; min-height: 420px; display: flex; flex-direction: column; overflow: hidden; }
.edit-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sheet { flex: 1; min-height: 0; overflow-y: auto; margin: 12px 22px 0; background: var(--well); border-radius: 22px; padding: 12px; }
body.framed > .sheet { margin-bottom: 63px; }
.sheet.stack { display: flex; flex-direction: column; gap: 12px; }
.sheet .card { background: #fff; border-radius: 16px; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sheet .card h2, .sheet .card-head h2 { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.sheet .card-head { display: flex; align-items: center; gap: 10px; min-height: 18px; }
.sheet .card-head h2 { margin-right: auto; }
.card-head > span { font-size: 14px; color: var(--muted); }
.sheet .banner { margin: 0 0 12px; }
.page-foot { display: flex; justify-content: space-between; align-items: center; padding: 5px 22px 10px; flex: none; }
.muted { margin: 0; font-size: 14px; color: var(--muted); }
.default-act { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; border: 0; padding: 0; }

.btn.edit { height: 36px; padding: 0 12px; font-size: 16px; font-weight: 700; gap: 6px; }
.btn.edit .icon { width: 16px; height: 16px; }
.btn.danger.remove { width: 120px; font-weight: 700; }
.btn.outline.home { text-decoration: none; min-width: 108px; }
.btn.outline.home .icon { width: 18px; height: 18px; }

/* switch */
.switch { width: 48px; height: 28px; border-radius: 14px; background: #cbd5d4; position: relative; display: inline-block; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; transition: left 0.15s; }
.switch.on, .switch-input:checked + .switch { background: var(--teal); }
.switch.on::after, .switch-input:checked + .switch::after { left: 23px; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-input:focus-visible + .switch { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch-line { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--off-ink); }
.switch-line:has(input:checked) { color: var(--teal); }
.switch-line .icon { width: 18px; height: 18px; }
.switch-line b { font-size: 18px; color: var(--ink); }
.switch-line:has(input:checked) .off-word, .switch-line:not(:has(input:checked)) .on-word { display: none; }
.switch-button { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; color: var(--teal); cursor: pointer; }
.switch-button .icon { width: 18px; height: 18px; }
.switch-button:has(.switch:not(.on)) { color: var(--off-ink); }
.notice-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.add-notice:not(:has(input:checked)) .edit { display: none; }

/* manage list */
.m-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.m-card { background: #fff; border-radius: 16px; padding: 12px 14px; height: 152px; scroll-snap-align: start; display: flex; flex-direction: column; min-width: 0; }
.m-name { display: flex; align-items: center; gap: 8px; color: var(--teal); }
.m-name .icon { width: 20px; height: 20px; }
.m-name h2 { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sum { margin: 6px 0 0; font-size: 14px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-when { margin: 1px 0 0; font-size: 13px; color: var(--muted); line-height: 1.35; }
.m-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.m-foot .btn.edit { height: 44px; padding: 0 14px; font-size: 18px; }
.m-foot .btn.edit .icon { width: 17px; height: 17px; }
.add-card { background: transparent; border: 2px dashed #a9bcba; align-items: center; justify-content: center; flex-direction: row; gap: 8px; color: var(--teal); font-size: 18px; font-weight: 700; text-decoration: none; }
.add-card .icon { width: 20px; height: 20px; }
.removed-card { grid-column: span 2; height: 152px; overflow-y: auto; }
.removed-card.wide { grid-column: span 3; }
.removed-card h2 { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--muted); }
.removed-card ul, .history-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.removed-card li, .history-lines li { font-size: 15px; }
.removed-card li span, .history-lines li span { color: var(--muted); margin-left: 4px; }
.manage-sheet { margin-bottom: 63px; overflow: hidden; display: flex; flex-direction: column; }
.m-scroll { flex: 1; min-height: 0; overflow-y: auto; scroll-snap-type: y proximity; }
.m-grid { padding-bottom: 10px; }

/* edit pages */
.edit-grid { display: grid; gap: 12px; align-items: stretch; min-height: 100%; }
.edit-grid .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.edit-grid .col > .card:last-child { flex: 1; }
.edit-insulin { grid-template-columns: 389fr 311fr; }
.edit-medicine { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
.edit-medicine .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.edit-steps { grid-template-columns: 408fr 292fr; }
.edit-add-medicine { grid-template-columns: 1fr 1fr; }
.edit-supply { grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; }
.edit-supply > .notice-card-small { align-self: start; }
.field { display: flex; align-items: center; gap: 8px; height: 44px; border: 2px solid var(--field-line); border-radius: 12px; padding: 0 12px; background: #fff; min-width: 0; flex: none; }
.step-row .field { flex: 1; }
.dose-card .field input, .step-row .field input { font-size: 16px; }
.field:focus-within { border-color: var(--teal); }
.field input { border: 0; outline: none; flex: 1; min-width: 0; font-size: 18px; color: var(--ink); background: transparent; padding: 0; }
.field input::placeholder { color: #9aa8aa; }
.field .icon { width: 15px; height: 15px; color: #8a9a9c; }
.field.readonly { background: #f3f6f5; }
.note-field { display: flex; min-height: 140px; border: 2px solid var(--field-line); border-radius: 12px; padding: 12px; background: #fff; }
.note-field textarea { border: 0; outline: none; width: 100%; min-height: 116px; resize: vertical; font: inherit; font-size: 18px; color: var(--ink); background: transparent; }
.note-field:focus-within { border-color: var(--teal); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 38px; background: #e8eeed; border-radius: 10px; padding: 0 4px 0 10px; display: inline-flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 700; }
.chip-x { border: 0; background: none; width: 18px; height: 24px; padding: 0; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.chip-x .icon { width: 12px; height: 12px; }
.chip.new { padding: 0 8px; background: #fff; border: 2px solid var(--teal); }
.chip.new input { border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--ink); outline: none; }
.chip-add { width: 38px; height: 38px; border: 2px dashed #9fb0ae; border-radius: 10px; background: #fff; color: var(--teal); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.chip-add .icon { width: 18px; height: 18px; }
.repeat-word { font-size: 14px; }
.sched-big { margin: 0; font-size: 17px; font-weight: 700; }
.unit { font-size: 14px; color: var(--muted); }
.ranges-card .card-head h2 { margin-right: 0; }
.ranges-card .unit { margin-right: auto; }
.band-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.band-list li { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.band-list .bar { width: 6px; height: 20px; border-radius: 3px; background: var(--amber); }
.band-list b { margin-left: auto; }
.step-list { display: flex; flex-direction: column; gap: 8px; }
.step-row { display: flex; align-items: center; gap: 8px; }
.step-row.dragging { opacity: 0.6; }
.grip { width: 20px; display: inline-flex; justify-content: center; color: #8a9a9c; cursor: grab; touch-action: none; }
.grip .icon { width: 18px; height: 18px; stroke-width: 3; }
.step-num { width: 26px; height: 26px; border-radius: 13px; background: #e8eeed; color: var(--teal); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.btn.step-x { width: 36px; height: 36px; padding: 0; border: 2px solid var(--field-line); color: var(--ink); border-radius: 10px; }
.btn.step-x .icon { width: 15px; height: 15px; }
.add-row { height: 40px; border: 2px dashed #a9bcba; border-radius: 12px; background: #fff; color: var(--teal); font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.add-row .icon { width: 16px; height: 16px; }

/* osmolite rate */
.center-sheet { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.sheet .card.rate-card { width: 454px; max-width: 100%; padding: 22px 28px 22px; align-items: center; gap: 12px; }
.rate-card h2 { font-size: 13px !important; }
.rate-row { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.btn.rate-step { width: 64px; height: 64px; padding: 0; }
.btn.rate-step .icon { width: 26px; height: 26px; }
.rate { margin: 0; font-size: 40px; font-weight: 700; }

/* add */
.choose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: 100%; }
.sheet .card.choose-card { align-items: center; justify-content: center; gap: 10px; text-decoration: none; color: var(--ink); }
.choose-icon { width: 76px; height: 76px; border-radius: 38px; background: var(--screen); color: var(--teal); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.choose-icon .icon { width: 34px; height: 34px; }
.choose-card b { font-size: 24px; }
.choose-card span:last-child { font-size: 15px; color: var(--muted); }

/* repeat and notice pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { height: 40px; display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; border-radius: 10px; padding: 0 12px; background: #e8eeed; border: 2px solid #e8eeed; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill .icon { display: none; width: 16px; height: 16px; stroke-width: 2.6; }
.pill:has(input:checked) { background: #fff; border-color: var(--teal); color: var(--teal); }
.pill:has(input:checked) .icon { display: inline; }
.pill:has(input:focus-visible) { outline: 2px solid var(--ink); }
.days-card, .date-card { display: none !important; }
.schedule:has(input[name="repeat"][value="weekly"]:checked) .days-card { display: flex !important; }
.schedule:has(input[name="repeat"][value="monthly"]:checked) .date-card { display: flex !important; }
.day-field { height: 44px; width: 200px; border: 2px solid var(--field-line); border-radius: 10px; padding: 0 12px; display: flex; align-items: center; gap: 6px; font-size: 18px; }
.day-field input { border: 0; width: 100%; font-size: 18px; outline: none; }
.with-subline .sheet { margin-top: 8px; }
.subline { display: flex; align-items: center; gap: 6px; margin: 8px 26px 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.subline .icon { width: 16px; height: 16px; }
.sound-row { display: flex; align-items: center; gap: 16px; }
.sound-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; max-width: 360px; }

/* admin */
.sheet .card.admin-card { padding: 10px 16px; gap: 0; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 180px 150px 122px; align-items: center; min-height: 56px; height: auto; border-top: 1px solid #e3e8e7; }
.admin-row.head { height: 28px; border-top: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.admin-row b { font-size: 16px; overflow-wrap: anywhere; }
.role-choice { display: flex; flex-direction: column; gap: 4px; font-size: 16px; }
.admin-add { display: flex; gap: 12px; align-items: center; margin: 0 0 16px; }
.admin-add input { flex: 1; height: 44px; font-size: 18px; padding: 0 12px; }
.btn.danger.slim { height: 40px; width: 122px; font-size: 16px; font-weight: 700; }

/* sign in */
.sign-page .page-top { min-height: 64px; }
.sign-mark { width: 44px; height: 44px; overflow: hidden; position: relative; flex: none; }
.sign-logo { position: absolute; width: 98px; height: 98px; max-width: none; left: -27px; top: -15px; }
.sign-sheet { display: flex; align-items: center; justify-content: center; }
.sheet .card.sign-card { width: 440px; max-width: 100%; padding: 30px 32px; align-items: center; text-align: center; gap: 16px; }
.sign-lead { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.25; }
.sign-lead.refused { color: var(--err-ink); font-size: 20px; }
.sign-form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.btn.google { height: 56px; width: 100%; background: var(--teal); color: #fff; border: 0; font-size: 20px; font-weight: 700; gap: 12px; }
.g-mark { width: 30px; height: 30px; background: #fff; border-radius: 8px; padding: 4px; flex: none; }
.sign-note { margin: 0; font-size: 14px; color: var(--muted); }
.sign-links { margin: 0; font-size: 14px; }
.sign-links a { color: var(--teal); font-weight: 700; }
.sign-sheet.privacy-sheet { align-items: stretch; justify-content: flex-start; }
.sheet .card.privacy-card { width: min(640px, 100%); margin: 0 auto; padding: 28px 32px 32px; align-items: stretch; text-align: left; gap: 10px; }
.sheet .card.privacy-card h2 { margin: 14px 0 0; font-size: 20px; font-weight: 700; color: var(--ink); }
.sheet .card.privacy-card h2:first-child { margin-top: 0; font-size: 24px; }
.privacy-card p, .privacy-card li { margin: 0; font-size: 16px; line-height: 1.45; }
.privacy-card ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.privacy-card a { color: var(--teal); font-weight: 700; }
.privacy-date { color: var(--muted); font-size: 14px; }

/* manage sign out and dialogs */
.sign-out { position: fixed; right: 22px; bottom: 10px; }
.sign-out .btn { min-width: 122px; font-weight: 700; }
.dialog { width: 520px; max-width: calc(100vw - 32px); border: 0; border-radius: 22px; padding: 28px; color: var(--ink); }
.dialog[open] { position: fixed; inset: 0; margin: auto; height: fit-content; display: flex; flex-direction: column; gap: 14px; z-index: 10; box-shadow: 0 0 0 100vmax rgba(30, 42, 47, 0.55); }
.dialog::backdrop { background: rgba(30, 42, 47, 0.55); }
.dialog p { margin: 0; font-size: 20px; line-height: 1.3; }
.dialog .dialog-lead { font-size: 26px; font-weight: 700; line-height: 1.25; }
.dialog-actions { display: flex; gap: 12px; margin-top: 10px; }
.dialog-actions > * { flex: 1; }
.dialog-actions form { display: flex; }
.dialog-actions .btn { width: 100%; height: 56px; text-decoration: none; }
.btn.stay { background: var(--teal); color: #fff; border: 0; font-size: 20px; }
.btn.danger { background: #fff; color: var(--danger); border: 2px solid var(--danger); }

@media (orientation: portrait) and (min-width: 701px) {
  .layout { flex-direction: column; }
  aside[data-later] { width: auto; }
  .rail { display: flex; flex-wrap: wrap; gap: 0 24px; }
}

@media (max-width: 700px) {
  .layout { display: block; }
  .btn { height: 48px; }
  .manage { padding: 0 16px 12px; }
  .m-grid { grid-template-columns: 1fr 1fr; }
  .edit-grid, .edit-medicine .pair, .choose-grid { grid-template-columns: 1fr; }
  .removed-card, .removed-card.wide { grid-column: 1 / -1; }
  .sound-row { flex-direction: column; align-items: flex-start; }
  .grid, .supplies { grid-template-columns: 1fr; }
  aside[data-later] { width: auto; margin-top: 16px; }
  .top { flex-wrap: wrap; }
  .pad { flex-direction: column; }
  .pad-keys { width: auto; }
}

/* Pill box: the day as a row of lids. The open set's lid joins the tray that holds its tiles. */
.lids { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: flex; gap: 8px; align-items: flex-end; }
.lid { flex: 1; min-width: 0; height: 54px; margin-bottom: 8px; padding: 0 12px; border-radius: 14px; background: var(--lid); display: flex; flex-direction: column; justify-content: center; }
.lid b { font-size: 18px; font-weight: 700; white-space: nowrap; }
.lid > span { display: flex; align-items: center; gap: 4px; font-size: 16px; color: var(--lid-ink); white-space: nowrap; overflow: hidden; }
.lid .short { display: none; }
.lid.open { flex: 1.8; height: 66px; margin-bottom: 0; padding: 0 14px; border-radius: 16px 16px 0 0; background: var(--tray); flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.lid.open b { font-size: 26px; }
.lid.open > span { flex: none; }
.lid.open > span { font-weight: 700; color: #1e4b2a; }
.lid.open.next > span { color: var(--lid-ink); }
.lid.done { background: var(--green-bg); }
.lid.done > span { color: #1e4b2a; }
.lid.done .icon { width: 18px; height: 18px; stroke-width: 3; }

.top:has(.lids) { padding: 14px 16px 0; gap: 8px; align-items: flex-end; }
.top:has(.lids) .who { width: 92px; flex: none; align-self: center; }
.top:has(.lids) .who-button { height: 48px; padding: 0 10px; font-size: 20px; gap: 4px; }
.top:has(.lids) .who-button .icon { width: 18px; height: 18px; }
.top:has(.lids) h1[data-large-time] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body:has(.lids) .all-done { display: none; }

.layout.tray { margin: 0 16px 0 116px; padding: 12px; background: var(--tray); border-radius: 18px; }
body:has(.lids > .lid.open:first-child) .layout.tray { border-top-left-radius: 0; }
.layout.tray aside[data-later] { display: none; }
.layout.tray .grid { background: transparent; padding: 0; border-radius: 0; }
.layout.tray .tile { height: auto; min-height: 160px; border-radius: 12px; }
.layout.tray.compact .tile, .compact .layout.tray .tile { height: auto; min-height: 104px; }
.layout.tray .banner, .layout.tray .undone-bar { margin: 0; }
.layout.tray .osmolite { padding: 0; }
.done-head { display: none; }
body:has(.lids) .manage { position: fixed; left: 12px; bottom: 12px; padding: 0; }
body:has(.lids) .manage a { height: 44px; padding: 0 4px; gap: 5px; font-size: 18px; font-weight: 700; }
body:has(.lids) .manage .icon { width: 18px; height: 18px; }
body:has(.lids) .layout.tray { margin-bottom: 16px; }

/* pages that open inside the tray: Dose, Steps, Blood sugar */
.pillbox { padding: 14px 16px 16px; min-height: 100vh; display: flex; flex-direction: column; }
.lid-row { display: flex; align-items: flex-end; gap: 8px; }
.lid-who { width: 92px; flex: none; align-self: center; margin: 0; font-size: 24px; font-weight: 700; color: var(--teal); }
.tray { flex: 1; margin-left: 100px; padding: 12px; background: var(--tray); border-radius: 18px; display: flex; flex-direction: column; gap: 12px; }
.pillbox:has(.lids > .lid.open:first-child) .tray { border-top-left-radius: 0; }
.tray .page-top { padding: 0; }
.tray .page-top .patient-label { display: none; }
.tray .page-title h1 { font-size: 24px; }
.tray .page-well { margin: 0; padding: 0; background: transparent; min-height: 0; flex: 1; }
.tray .page-well form { display: flex; flex-direction: column; }
.tray .steps-card { min-height: 0; padding: 18px 24px !important; gap: 14px !important; border-radius: 12px; }
.tray .steps { gap: 14px; }
.tray .steps li { font-size: 24px; }
.tray .steps-card .btn.save { align-self: flex-end; }
.tray .dose-page { font-size: 36px; line-height: 1.2; }
.tray .sugar { margin: 0; flex: 1; }
.tray .pad { min-height: 0; }
.tray .pad-well { border-radius: 12px; background: #fff; }
.tray .number-box { height: 80px; font-size: 56px; }
.tray .key { height: 52px; font-size: 26px; }
.tray .btn.next { height: 56px; }
.tray .result-card { border-radius: 12px; }
.tray .result-number, .tray .result-units { font-size: 52px; line-height: 1.05; }
.tray .result-label { font-size: 18px; }
.tray .result-band { font-size: 16px; color: var(--text-2); }
.tray .result > form .btn.neutral { height: 64px; font-size: 24px; border-width: 3px; padding: 0 28px; }
.tray .hospital { min-height: 0; flex: 1; padding: 24px 32px; }

/* Manage: eight items fit as two rows of four */
.m-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.m-card { border-radius: 12px; }

/* Phone: the calmer look. Neutral grey, black icons, color only where someone must act. */
@media (max-width: 700px) {
  :root { --tray: #e1e6ea; --well: #e1e6ea; --lid: #d3d9de; --screen: #f2f4f5; }
  .top:has(.lids) { flex-wrap: wrap; padding: 14px 12px 0; }
  .top:has(.lids) .who { width: 100%; }
  .lids { width: 100%; flex: none; gap: 6px; }
  .lid { height: 50px; margin-bottom: 6px; padding: 0 6px; align-items: center; }
  .lid > span, .lid .long { display: none; }
  .lid .short { display: inline; }
  .lid b { font-size: 16px; }
  .lid.open { flex: 1.4; height: 60px; justify-content: center; }
  .lid.open b { font-size: 22px; }
  .lid.done { background: var(--lid); }
  .layout.tray { margin: 0 12px; padding: 10px; border-radius: 16px; }
  body:has(.lids) .manage { position: static; padding: 6px 12px 12px; }
  .layout.tray .tile { height: auto; min-height: 128px; gap: 12px; }
  .tile-name > .icon, .row > .icon, .lid-who { color: var(--ink); }
  .tile.late { border-color: transparent; }
  .layout.tray .grid .tile.is-done { order: 2; min-height: 0; flex-direction: row; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; background: #fff; border: 0; color: var(--ink); }
  .tile.is-done .tile-name { flex: none; }
  .tile.is-done .tile-name > .icon, .tile.is-done .under, .tile.is-done .due { display: none; }
  .tile.is-done form { flex: 1; min-width: 0; }
  .tile.is-done .done-mark { height: auto; font-size: 18px; color: var(--text-2); gap: 6px; }
  .tile.is-done .check-circle { width: 24px; height: 24px; border: 0; background: none; color: var(--done-solid); }
  .tile.is-done .state.by { background: none; color: var(--text-2); padding: 0; font-size: 18px; font-weight: 400; }
  .tile.is-done .state.by .icon { display: none; }
  .done-head { display: block; order: 1; margin: 6px 0 0 4px; font-size: 20px; font-weight: 700; }
  .pillbox { padding: 14px 12px; }
  .lid-row { flex-wrap: wrap; }
  .lid-who { width: 100%; margin-bottom: 10px; }
  .tray { margin-left: 0; padding: 10px; border-radius: 16px; }
  .tray .result { grid-template-columns: 1fr; }
  .m-grid { grid-template-columns: 1fr 1fr; }
}

/* a finished tile names who did it, so its separate check circle is not needed */
.layout.tray .done-mark:has(.state.by) .check-circle { display: none; }
.layout.tray .tile.is-done .actions { gap: 6px; }
.layout.tray .tile.is-done .state.by { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.layout.tray .tile.is-done .done-mark { min-width: 0; flex: 1; }
.tray .steps li::before, .tray .dose-page::before { display: none; }
.tray .steps label { display: flex; align-items: center; gap: 14px; cursor: pointer; min-height: 44px; }
.tray .steps input[type="checkbox"] { width: 30px; height: 30px; margin: 0; flex: none; accent-color: var(--teal); }
@media (min-width: 701px) {
  .m-card { padding: 12px 10px; }
  .m-foot { gap: 4px; }
  .m-foot .btn.edit { padding: 0 10px; gap: 4px; }
  .m-scroll { overflow-x: hidden; }
}
@media (max-width: 700px) {
  .layout.tray .grid .tile { height: auto; }
  .layout.tray .grid .tile.is-done .state.by { white-space: normal; height: auto; line-height: 1.2; }
  .layout.tray .grid .tile.is-done .done-mark { overflow: visible; }
}

/* Manage: one list with a sort choice and Add above it (approved Nov 17, 2026) */
.m-bar { display: flex; align-items: center; gap: 12px; margin: 12px 22px 0; min-height: 48px; flex: none; }
.m-count { font-size: 18px; margin-right: auto; }
.m-sort { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--text-2); }
.m-sort[hidden] { display: none; }
.m-seg { display: flex; gap: 4px; padding: 3px; background: var(--off-bg); border-radius: 10px; }
.m-seg label { position: relative; flex: 1; min-width: 88px; height: 40px; padding: 0 12px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 16px; font-weight: 700; color: var(--muted); cursor: pointer; }
.m-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-seg label:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 0 0 2px var(--teal); }
.m-seg label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.m-add { height: 48px; padding: 0 18px; gap: 6px; background: var(--done-solid); border: 2px solid var(--done-solid); color: #fff; font-weight: 700; text-decoration: none; }
.btn.m-add .icon { width: 18px; height: 18px; }
.manage-sheet .m-scroll { display: flex; flex-direction: column; gap: 6px; }
.m-list { list-style: none; margin: 0; padding: 0 12px; background: #fff; border-radius: 12px; }
.m-row { display: grid; grid-template-columns: minmax(0, 1fr) 230px 104px 92px; align-items: center; gap: 8px; min-height: 52px; border-top: 1px solid #e3e8e7; }
.m-row:first-child { border-top: 0; }
.m-row .m-name h2 { font-size: 18px; }
.m-row .m-when { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.3; }
.m-row .switch-button b { font-size: 16px; color: var(--ink); }
.m-row .switch-button:has(.switch:not(.on)) b { color: var(--off-text); }
.m-row .btn.edit { justify-self: end; height: 44px; padding: 0 12px; gap: 5px; font-size: 17px; }
.m-row .btn.edit .icon { width: 16px; height: 16px; }
.m-none { font-size: 14px; color: var(--muted); }
.m-lid { margin: 6px 0 0; height: 32px; border-radius: 8px; background: var(--lid); color: var(--lid-ink); font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.m-lid span { font-weight: 400; }
.m-removed { display: flex; flex-direction: column; gap: 6px; }
.removed-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
.removed-row b { font-size: 17px; }
.removed-row span { font-size: 14px; color: var(--muted); }
.btn.m-back { height: 44px; padding: 0 12px; gap: 5px; font-size: 16px; }
.btn.m-back .icon { width: 16px; height: 16px; }
.m-older summary { min-height: 44px; display: flex; align-items: center; padding: 0 12px; color: var(--teal); font-weight: 700; cursor: pointer; }

/* Admin: names with full emails, a two-way role choice, Saved stays here */
.admin-add { margin: 12px 22px 0; }
.admin-add input { height: 48px; border: 2px solid var(--field-line); border-radius: 12px; font: inherit; font-size: 17px; }
.admin-add .admin-name { flex: none; width: 190px; }
.admin-row { grid-template-columns: minmax(0, 1fr) 190px 112px 110px; gap: 8px; min-height: 52px; }
.admin-who { display: flex; flex-direction: column; min-width: 0; }
.admin-who b { font-size: 18px; }
.admin-who span { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.admin-row .role-choice { flex-direction: row; }
.admin-end { display: flex; justify-content: flex-end; }
.admin-row .btn.danger.slim { width: auto; padding: 0 12px; }
.saved-chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 10px; background: var(--green-bg); color: var(--green-ink); font-size: 17px; font-weight: 700; }
.saved-chip .icon { width: 18px; height: 18px; }
.admin-row .switch-line b { white-space: nowrap; }

@media (max-width: 700px) {
  .m-bar { flex-wrap: wrap; margin: 10px 12px 0; }
  .m-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name edit" "when switch"; padding: 6px 0; row-gap: 2px; }
  .m-row .m-name { grid-area: name; }
  .m-row .m-when { grid-area: when; }
  .m-row .m-switch, .m-row .m-none { grid-area: switch; justify-self: end; }
  .m-row .btn.edit { grid-area: edit; }
  .removed-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name back" "detail back"; }
  .removed-row b { grid-area: name; }
  .removed-row span { grid-area: detail; }
  .removed-row form { grid-area: back; }
  .admin-add { flex-wrap: wrap; margin: 10px 12px 0; }
  .admin-add .admin-name { width: 100%; }
  .admin-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who who" "role role" "alert end"; row-gap: 8px; padding: 10px 0; }
  .admin-who { grid-area: who; }
  .admin-row .role-choice { grid-area: role; }
  .admin-row .switch-line { grid-area: alert; }
  .admin-end { grid-area: end; }
  .admin-row.head { display: none; }
}

/* Board clock in the left column, just above Manage (approved Nov 17, 2026) */
.clock { display: none; }
.top:has(.lids) .clock { display: flex; flex-direction: column; position: fixed; left: 16px; bottom: 66px; width: 92px; color: var(--ink); }
.top:has(.lids) .clock time { display: flex; flex-direction: column; margin: 0; font-size: 18px; color: var(--ink); }
.top:has(.lids) .clock time b { font-size: 30px; line-height: 1; font-weight: 700; }
.top:has(.lids) .clock time span { margin-top: 4px; font-size: 18px; font-weight: 700; }
.clock-day { margin-top: 10px; font-size: 15px; line-height: 1.35; color: var(--text-2); }
.clock-date { font-size: 15px; line-height: 1.35; color: var(--text-2); }

/* A finished set's lid opens that set: who did each and when, with Undo */
.lid { position: relative; }
.lid-link { position: absolute; inset: 0; border-radius: inherit; }
.lid-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.set-done { background: #fff; border-radius: 12px; padding: 2px 14px 4px; }
.set-done h2 { margin: 0; min-height: 44px; display: flex; align-items: center; font-size: 17px; font-weight: 700; color: #1e4b2a; }
.set-done ul { list-style: none; margin: 0; padding: 0; }
.set-done li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 4px; border-top: 1px solid #e3e8e7; }
.set-done li b { font-size: 19px; }
.set-done li > span:not(.set-mark) { font-size: 16px; color: var(--text-2); flex: 1; min-width: 0; }
.set-done .set-mark { width: 28px; height: 28px; border-radius: 14px; background: var(--done-solid); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.set-done .set-mark .icon { width: 16px; height: 16px; stroke-width: 3; }
.set-done li.not-done .set-mark { background: var(--off-bg); }
.set-done .btn.undo { height: 44px; min-width: 96px; font-size: 17px; font-weight: 700; }

/* A waiting tile needs about 340px for its help button beside "Opens 11:45 AM".
   Two across when each column has that room, one above the other when it would crowd. */
.layout.tray .grid:has(.tile.waiting .btn.off:not(.full)) { grid-template-columns: repeat(auto-fit, minmax(max(min(100%, 340px), calc(50% - 6px)), 1fr)); }
@media (max-width: 700px) {
  .top:has(.lids) .clock { display: none; }
}
.set-done h2.upcoming { color: var(--lid-ink); }
.set-done li.not-done .set-mark { background: var(--off-bg); color: var(--teal); }
.set-done li.not-done .set-mark .icon { width: 18px; height: 18px; stroke-width: 2.2; }

/* Offline notice: the "saved on this device" tint, as in the approved samples */
.banner[data-offline-banner] { background: var(--state-local-bg); color: var(--state-local-ink); border: 1px solid #e8d49a; }
/* A finished bag or valve: one row with the next date and Undo */
.row.supply.is-done { background: var(--green-bg); border: 2px solid var(--green-line); color: var(--green-ink); }
.row.supply.is-done .icon { color: var(--green-ink); }
.supply-done { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; font-size: 17px; font-weight: 700; }
.supply-done .icon { width: 18px; height: 18px; }
/* Blood sugar results that need attention */
.result-card.alert-low { background: #fbe9e6; border: 3px solid var(--danger); }
.result-card.alert-low .result-number, .result-card.alert-low .help:first-of-type { color: #8c1d18; }
.result-card.alert-high { background: #fff1d6; border: 3px solid #c77700; }
.result-card.alert-high .result-number, .result-card.alert-high .help:first-of-type { color: #7a4100; }
.result-card .alert-tag { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.result-card.alert-low .alert-tag { background: var(--danger); }
.result-card.alert-high .alert-tag { background: #a85f00; }
/* Asking again for a reading */
.pad-ask { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fff1d6; color: #7a4100; font-size: 17px; font-weight: 700; }

/* Missed notices for one time, said once, with the late color */
.banner.missed { display: flex; align-items: center; gap: 10px; background: #fdf0ea; color: #6b2a0c; border: 1px solid #efc4ae; }
.banner.missed .icon { width: 20px; height: 20px; flex: none; color: var(--late); }
/* Skip on a late tile that can still be given */
.skip-box { margin-top: 8px; }
.skip-box summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 16px; font-weight: 700; color: var(--teal); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.skip-box[open] summary { color: var(--text-2); }
.skip-form { display: flex; gap: 10px; align-items: flex-end; }
.skip-form label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 700; color: var(--text-2); }
.skip-form input { height: 44px; border: 2px solid var(--field-line); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 17px; }
