/* Habits (js/habitsView.js): the small Habits part of Today's numbers card, the habits sheets (all
   habits, one habit, the editor — a bottom sheet on phones, a dialog on desktop). Same look as the rest of DHUT: light rounded cards on the time-of-day page, the area tints
   and inks from app.css, one stroke style for icons, 44 px touch targets. Nothing loops or animates
   on its own; the one tick transition is switched off by the reduced-motion rules in app.css. */

.hb-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hb-muted { color: var(--text-secondary); }
.hb-small { font-size: 12.5px; line-height: 1.45; margin: 4px 0 8px; }

/* ---------- area colours (icon chips, swatches) ---------- */
.hb-c-mint { background: var(--accent-light); color: var(--accent-strong); }
.hb-c-coral { background: var(--coral-light); color: var(--coral-ink); }
.hb-c-yellow { background: var(--yellow-light); color: var(--yellow-ink); }
.hb-c-sky { background: var(--sky-light); color: var(--sky-ink); }
.hb-c-lavender { background: var(--lavender-light); color: var(--lavender-ink); }
.hb-c-peach { background: var(--peach-light); color: var(--peach-strong); }

/* ---------- the list sheet's top: "Habits", the date, how today is going ---------- */
.hb-list-head { min-width: 0; }
.hb-list-head h3:focus { outline: none; }
.hb-date { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--text-secondary); }
.hb-summary { margin: 0 0 10px; font-family: var(--font-display); font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--text-primary); overflow-wrap: anywhere; }
.hb-sheet .hb-card { box-shadow: 0 0 0 1px var(--line); }
button.hb-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -8px 0 0 -6px; padding: 0 6px; font-size: 14px; font-weight: 700; }

/* ---------- cards ---------- */
.hb-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 0 0 1px var(--line-soft), var(--shadow-1); padding: 12px; margin-bottom: 10px; }
.hb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hb-h { font-family: var(--font-display); font-size: 16px; font-weight: 800; margin: 0 0 6px; color: var(--text-primary); }
.hb-card-head .hb-h { margin: 0; }
.hb-none { margin: 4px 2px 2px; font-size: 14px; }
.hb-state { text-align: left; }
.hb-state-title { margin: 0 0 4px; font-weight: 800; font-size: 15.5px; }
.hb-state .hb-muted { margin: 0 0 8px; font-size: 14px; line-height: 1.45; }
button.hb-btn { min-height: 44px; border-radius: var(--radius-md); }

/* ---------- a habit row: icon · name + schedule · the tick / the number ---------- */
.hb-rows { list-style: none; margin: 0; padding: 0; }
.hb-rows > li { display: block; margin: 0; padding: 0; border: 0; background: none; font-size: inherit; }
.hb-row + .hb-row { border-top: 1px solid var(--line); }
.hb-row-main { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 6px 2px; }
.hb-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px; font-size: 18px; line-height: 1; }
.hb-text { display: flex; flex-direction: column; min-width: 0; }
.hb-name { font-weight: 800; font-size: 15px; line-height: 1.3; color: var(--text-primary); overflow-wrap: anywhere; }
.hb-sub { font-size: 12.5px; line-height: 1.35; color: var(--text-secondary); overflow-wrap: anywhere; }
.hb-bar { display: block; height: 5px; margin-top: 4px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; max-width: 160px; }
.hb-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.hb-row[data-state="done"] .hb-name { color: var(--accent-strong); }

/* The tick: a 44 px circle, filled mint when done (aria-pressed). */
button.hb-tick { width: 44px; height: 44px; min-width: 44px; padding: 0; margin: 0; border-radius: 50%; background: var(--surface); color: transparent;
  box-shadow: inset 0 0 0 2px var(--line-strong); display: inline-flex; align-items: center; justify-content: center; transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
button.hb-tick svg { width: 22px; height: 22px; }
button.hb-tick:hover { background: var(--accent-light); color: color-mix(in srgb, var(--accent) 45%, transparent); }
button.hb-tick[aria-pressed="true"] { background: var(--accent); color: var(--text-on-accent); box-shadow: none; }
button.hb-tick[aria-pressed="true"]:hover { background: var(--accent-strong); }
button.hb-tick:active { transform: scale(0.94); }
button.hb-tick:focus-visible, button.hb-countbtn:focus-visible, button.hb-plus:focus-visible, button.hb-open:focus-visible, button.hb-move:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }

/* A count habit: "3 / 8 glasses" opens the number entry; +1 next to it. */
.hb-count { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
button.hb-countbtn { min-height: 44px; max-width: 128px; margin: 0; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--accent-light); color: var(--accent-strong); font-size: 13.5px; font-weight: 800; line-height: 1.2; text-align: center; white-space: normal; overflow-wrap: anywhere; box-shadow: none; }
button.hb-countbtn:hover { background: color-mix(in srgb, var(--accent-light) 70%, var(--accent-2)); color: var(--accent-strong); }
.hb-row[data-state="done"] button.hb-countbtn { background: var(--accent); color: var(--text-on-accent); }
button.hb-plus { width: 44px; min-width: 44px; height: 44px; margin: 0; padding: 0; border-radius: 50%; background: var(--surface); color: var(--accent-strong); font-size: 14px; font-weight: 800; box-shadow: inset 0 0 0 2px var(--line-strong); }
button.hb-plus:hover { background: var(--accent-light); color: var(--accent-strong); }
.hb-entry { margin: 0 0 10px 46px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--surface-soft); }
.hb-entry-l { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.hb-entry-row { display: flex; align-items: stretch; gap: 6px; flex-wrap: wrap; }
.hb-entry-row input { flex: 1 1 80px; min-width: 0; width: 80px; min-height: 44px; }
.hb-entry-row button { flex: 0 0 auto; min-height: 44px; margin: 0; }
.hb-help { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }

/* ---------- "Your habits": open a habit, or reorder with arrows ---------- */
.hb-list { list-style: none; margin: 6px 0 0; padding: 0; }
.hb-item { display: flex; align-items: center; justify-content: flex-start; gap: 4px; margin: 0; padding: 0; border: 0; background: none; font-size: inherit; }
.hb-item + .hb-item { border-top: 1px solid var(--line); }
button.hb-open { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: 36px minmax(0, 1fr) 12px; align-items: center; gap: 10px; min-height: 56px; margin: 0; padding: 6px 4px; border-radius: var(--radius-md);
  background: transparent; color: var(--text-primary); text-align: left; font-weight: 400; font-size: 14px; box-shadow: none; }
button.hb-open:hover { background: var(--surface-soft); color: var(--text-primary); }
.hb-list.is-reorder button.hb-open { grid-template-columns: 36px minmax(0, 1fr); }
.hb-item.is-paused .hb-icon { opacity: 0.55; }
.hb-badge { display: inline-flex; align-items: center; margin-left: 4px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--surface-muted); color: var(--text-secondary); font-size: 11px; font-weight: 800; line-height: 1.5; vertical-align: 1px; }
.hb-chev { width: 7px; height: 7px; border-top: 2px solid var(--text-secondary); border-right: 2px solid var(--text-secondary); border-radius: 1px; transform: rotate(45deg); justify-self: center; }
.hb-moves { display: flex; gap: 4px; flex: 0 0 auto; }
button.hb-move { width: 44px; height: 44px; min-width: 44px; margin: 0; padding: 0; border-radius: 12px; background: var(--surface-soft); color: var(--text-primary); font-size: 18px; font-weight: 800; box-shadow: inset 0 0 0 1px var(--line); }
button.hb-move:hover { background: var(--accent-light); color: var(--accent-strong); }
button.hb-move[aria-disabled="true"] { opacity: 0.4; cursor: default; }
button.hb-move[aria-disabled="true"]:hover { background: var(--surface-soft); color: var(--text-primary); }
.hb-reorder { font-size: 13.5px; min-width: 44px; }
button.hb-add { width: 100%; margin: 8px 0 0; background: var(--accent-light); color: var(--accent-strong); box-shadow: none; }
button.hb-add:hover { background: color-mix(in srgb, var(--accent-light) 70%, var(--accent-2)); color: var(--accent-strong); }
button.hb-restore { flex: 0 0 auto; min-height: 44px; margin: 0; padding: 0 12px; font-size: 14px; }
.hb-archived > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 44px; margin: -4px 0; }
.hb-archived > summary::-webkit-details-marker { display: none; }
.hb-archived > summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; margin-right: 6px; border-right: 2px solid var(--text-secondary); border-bottom: 2px solid var(--text-secondary); transform: rotate(45deg); }
.hb-archived[open] > summary::after { transform: rotate(-135deg); }
.hb-archived > summary:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; border-radius: 8px; }
.hb-archived .hb-muted.hb-small { margin-top: 8px; }

/* ---------- the empty state: an invitation, never a push ---------- */
.hb-empty { padding: 14px; }
.hb-empty-title { margin: 0 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 16.5px; line-height: 1.35; }
.hb-empty .hb-muted { margin: 0 0 10px; font-size: 14px; line-height: 1.45; }
.hb-ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
button.hb-idea { min-height: 44px; margin: 0; padding: 0 12px; border-radius: var(--radius-pill); background: var(--surface-soft); color: var(--text-primary); font-size: 14px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }
button.hb-idea:hover { background: var(--accent-light); color: var(--accent-strong); }
button.hb-add-main { width: 100%; margin: 0; }

/* ---------- Habits on Today: a small part of the numbers card, under the three goal chips ----------
   A thin divider, one line ("Habits 1 of 3 · ＋ Add · See all") and up to three tiles in the SAME grid
   and style as the goal chips above (.snap-chips in css/today.css); with no habit yet, one "＋ Add a
   habit" line. About 90 px in all, so Log a meal and the meals stay close. */
.snap-habits { margin-top: 8px; padding-top: 6px; border-top: 1px dashed rgba(23, 34, 28, 0.14); }
.th-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 32px; }
.th-title { margin: 0; min-width: 0; font-size: 11.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); overflow-wrap: anywhere; }
.th-count { margin-left: 4px; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text-secondary); }
.th-links { display: flex; align-items: center; flex: 0 0 auto; gap: 2px; margin-right: -6px; }
.th-links .link-btn { min-height: 44px; margin: -6px 0; padding: 0 6px; font-size: 13px; font-weight: 700; }
.th-chips { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 2px; padding: 0; }
/* The links' 44 px boxes reach 6 px below the 32 px head line: the tiles start below them (no tap on a
   link's lower edge ever ticks a habit). */
.th-head + .th-chips { margin-top: 6px; }
.th-chips > li { display: block; min-width: 0; margin: 0; padding: 0; border: 0; background: none; font-size: inherit; }
.th-chip { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; width: 100%; min-width: 0; min-height: 48px; margin: 0;
  padding: 4px 9px 5px; border: 0; border-radius: 14px; background: var(--surface-soft); color: var(--text-primary); text-align: left; font-size: 14px; font-weight: 400; line-height: 1.2; box-shadow: none; }
button.th-chip:hover { background: var(--accent-light); transform: none; }
.th-label { display: flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; font-size: 11.5px; font-weight: 700; color: var(--text-secondary); line-height: 1.2; }
.th-ico { flex: 0 0 auto; font-size: 12px; line-height: 1; }
.th-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-val { display: flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; font-size: 14px; font-weight: 800; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; }
.th-num { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-chip[data-state="open"]:not([data-hb="done"]):not([data-hb="all"]) .th-val { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.th-check { display: inline-flex; flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; align-items: center; justify-content: center; background: var(--accent); color: var(--text-on-accent); }
.th-check svg { width: 11px; height: 11px; }
.th-track { display: block; width: 100%; height: 4px; margin-top: 3px; border-radius: 999px; background: #E3E8E5; overflow: hidden; }
.th-track > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.th-chip[data-state="done"] { background: var(--accent-light); }
.th-chip[data-state="done"] .th-val { color: var(--accent-strong); }
button.th-chip:focus-visible, button.th-invite:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.th-more { display: inline-block; margin-left: 2px; padding: 0 5px; border-radius: 999px; background: var(--accent-light); font-size: 11.5px; line-height: 1.5; }
.th-none { margin: 0 0 4px; font-size: 13px; line-height: 1.4; color: var(--text-secondary); }
button.th-invite { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; margin: 0; padding: 0 2px; border-radius: 12px; background: none; box-shadow: none;
  color: var(--accent-strong); font-size: 13.5px; font-weight: 700; text-align: left; }
button.th-invite:hover { background: var(--accent-light); }
.th-invite-plus { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 9px; background: var(--accent-light); font-size: 15px; }
/* While the habits load: the same space as last time, quietly (no layout jump when they arrive). */
.th-skel { display: block; min-height: 40px; }
span.th-chip.th-skel { min-height: 48px; background: var(--surface-soft); }
.th-skel-head { min-height: 32px; }
.th-skel-line { min-height: 18px; }
.th-none .th-retry { min-height: 44px; margin: -12px 0; padding: 0 4px; font-size: 13px; vertical-align: middle; }
@media (pointer: coarse) { button.th-invite { min-height: 44px; } .th-invite.th-skel { min-height: 44px; } }
@media (max-width: 374px) { .th-chip { padding: 4px 7px 5px; } .th-links .link-btn { padding: 0 4px; } }
/* Desktop: the habits sheets are dialogs in the middle of the screen, not sheets from the bottom. */
@media (min-width: 880px) {
  .sheet.hb-sheet { top: 50%; bottom: auto; width: min(560px, calc(100vw - 48px)); max-height: min(86vh, 820px); border-radius: 24px; padding-bottom: 16px;
    transform: translateY(calc(-50% + 24px)); opacity: 0; transition: transform 200ms ease, opacity 200ms ease, visibility 0s linear 200ms; }
  .sheet.hb-sheet.active { transform: translateY(-50%); opacity: 1; transition: transform 200ms ease, opacity 200ms ease; }
}
/* Narrow phones: a count row's "0 / 10,000 steps" + "+1" would squeeze the name to ~30 px, so the
   count moves to its own line under the name (check rows keep the tick on the right). */
@media (max-width: 374px) {
  .hb-row-main > .hb-count { grid-column: 2 / -1; justify-content: flex-start; }
  button.hb-countbtn { max-width: none; }
}
/* ---------- the habit sheet ---------- */
.hb-sheet .sheet-head h3 { overflow-wrap: anywhere; min-width: 0; }
.hb-d-sub { margin: 0 0 6px; font-size: 13.5px; line-height: 1.45; }
.hb-d-link { margin: 0 0 8px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--sky-light); color: var(--text-primary); font-size: 13px; line-height: 1.45; }
.hb-d-trend { margin: 0 0 8px; }
.hb-d-trend-main { margin: 0; font-family: var(--font-display); font-size: 16.5px; font-weight: 800; line-height: 1.35; color: var(--text-primary); }
.hb-d-trend .hb-small { margin: 2px 0 0; }
/* History: one row per week (Monday first), a small label on the left. Display only. */
.hb-hist { width: 100%; max-width: 380px; border-collapse: separate; border-spacing: 4px; table-layout: fixed; margin: 0 -4px; }
.hb-hist th { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-align: center; padding: 0; }
.hb-hist thead th:first-child, .hb-hist .hb-wk { width: 40px; }
.hb-hist .hb-wk { text-align: left; font-weight: 600; white-space: nowrap; }
.hb-hist.is-weekly thead th:last-child, .hb-hist .hb-wkn { width: 30px; }
.hb-wkn { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); text-align: center; }
.hb-wkn.is-reached { color: var(--accent-strong); }
.hb-cell { height: 26px; padding: 0; border-radius: 7px; background: var(--surface-muted); }
.hb-cell[data-s="done"] { background: var(--accent); }
.hb-cell[data-s="partial"] { background: linear-gradient(0deg, var(--accent-2) 50%, var(--surface-muted) 50%); }
.hb-cell[data-s="notdone"] { background: var(--surface-muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.hb-cell[data-s="open"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent-2); }
.hb-cell[data-s="rest"] { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.hb-cell[data-s="paused"] { background: repeating-linear-gradient(135deg, var(--surface-muted) 0 4px, transparent 4px 8px); }
.hb-cell[data-s="before"], .hb-cell[data-s="future"] { background: transparent; }
.hb-cell[data-today] { outline: 2px solid var(--accent-strong); outline-offset: 1px; }
.hb-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 6px 0 10px; padding: 0; font-size: 12px; color: var(--text-secondary); }
.hb-legend li { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 0; border: 0; background: none; }
.hb-legend li::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--surface-muted); }
.hb-legend li[data-s="done"]::before { background: var(--accent); }
.hb-legend li[data-s="partial"]::before { background: linear-gradient(0deg, var(--accent-2) 50%, var(--surface-muted) 50%); }
.hb-legend li[data-s="notdone"]::before { box-shadow: inset 0 0 0 1px var(--line-strong); }
.hb-legend li[data-s="rest"]::before { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.hb-legend li[data-s="paused"]::before { background: repeating-linear-gradient(135deg, var(--surface-muted) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--line); }
.hb-backfill { margin: 0 0 10px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--surface-soft); }
.hb-small-h { font-size: 14px; margin: 0 0 6px; }
.hb-bf-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.hb-bf-row input[type="date"] { flex: 1 1 140px; min-width: 0; min-height: 44px; }
.hb-bf-row input[type="number"] { flex: 1 1 70px; min-width: 0; width: 70px; min-height: 44px; }
.hb-bf-row button { flex: 0 0 auto; min-height: 44px; margin: 0; }
.hb-d-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 4px 0 6px; }
.hb-d-actions button { min-height: 44px; margin: 0; padding: 6px 8px; font-size: 14.5px; }
.hb-d-actions button:only-child { grid-column: 1 / -1; }

/* ---------- the editor ---------- */
.hb-form { display: block; }
.hb-f { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.hb-l { display: block; margin: 0 0 4px; padding: 0; font-size: 13.5px; font-weight: 800; color: var(--text-primary); }
.hb-opt { font-weight: 600; color: var(--text-secondary); }
.hb-f input[type="text"], .hb-f input[type="number"], .hb-f input[type="date"], .hb-f input[type="time"], .hb-f select { display: block; width: 100%; min-height: 44px; }
.hb-e { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: #A3321A; }
.hb-f [aria-invalid="true"] { border-color: #C2412A; box-shadow: 0 0 0 2px color-mix(in srgb, #C2412A 25%, transparent); }
.hb-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.hb-sub-f { margin-top: 8px; }
/* Icon and colour pickers: real radio buttons (arrow keys work), each a 44 px square. */
.hb-icons, .hb-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-ico, .hb-sw, .hb-day { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.hb-ico input, .hb-sw input, .hb-day input, .hb-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.hb-ico-face { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-soft); font-size: 20px; box-shadow: inset 0 0 0 1px var(--line); }
.hb-ico input:checked + .hb-ico-face { background: var(--accent-light); box-shadow: inset 0 0 0 2px var(--accent); }
.hb-sw-dot { display: inline-block; width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); }
.hb-sw input:checked + .hb-sw-dot { box-shadow: inset 0 0 0 3px var(--accent-strong), inset 0 0 0 5px var(--surface); }
.hb-ico input:focus-visible + .hb-ico-face, .hb-sw input:focus-visible + .hb-sw-dot, .hb-day input:focus-visible + span, .hb-seg input:focus-visible + span { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
/* Segmented choice (Done or not / A number …) */
.hb-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-soft); box-shadow: inset 0 0 0 1px var(--line); }
.hb-seg label { position: relative; display: flex; margin: 0; cursor: pointer; min-width: 0; }
.hb-seg label > span { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 700; color: var(--text-secondary); text-align: center; line-height: 1.2; }
.hb-seg input:checked + span { background: var(--accent); color: var(--text-on-accent); }
/* Days of the week: 7 in a row where they fit 44 px wide, else 4 + 3. */
.hb-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 8px 0 0; padding: 0; border: 0; min-width: 0; }
.hb-day > span[aria-hidden] { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 44px; border-radius: 12px; background: var(--surface-soft); font-size: 13px; font-weight: 800; color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--line); }
.hb-day { width: 100%; }
.hb-day input:checked + span { background: var(--accent); color: var(--text-on-accent); box-shadow: none; }
@media (max-width: 389px) { .hb-days { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hb-box { padding: 10px; border-radius: var(--radius-md); background: var(--surface-soft); }
.hb-check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.hb-check input { width: 22px; height: 22px; flex: 0 0 22px; margin: 0; }
.hb-box .hb-seg { background: var(--surface); }
/* Save stays in view at the bottom of the sheet, whatever the phone's height. */
.hb-f-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px;
  margin: 0 -16px calc(-16px - env(safe-area-inset-bottom, 0px)); padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); box-shadow: 0 -1px 0 var(--line); z-index: 1; }
.hb-f-actions button { min-height: 48px; margin: 0; }
