*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 var(--fs-md)/24px var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-xl); line-height: 32px; font-weight: 500; }
h2 { font-size: var(--fs-lg); line-height: 24px; font-weight: 500; }
h3 { font-size: var(--fs-md); line-height: 24px; font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); line-height: 20px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- app shell: sidebar on PC and iPad, tab bar on phone ---------- */
.content { padding: var(--s4) var(--s4) calc(56px + var(--s5) + env(safe-area-inset-bottom)); }
.page { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s4); }
.page-head { display: flex; flex-direction: column; gap: var(--s1); }
.mhead { display: flex; align-items: center; gap: var(--s3); padding-bottom: var(--s2); }
.mhead img, .brand img { width: 32px; height: 32px; border-radius: var(--r-sm); }
.mhead span, .brand span { font-size: var(--fs-md); font-weight: 500; }
.sidebar { display: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: var(--fs-cap); line-height: 16px; }
.tab[aria-current="page"] { color: var(--accent); }
@media (min-width: 900px) {
  .mhead, .tabbar { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: var(--s4); position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar); padding: var(--s4); background: var(--surface); border-right: 1px solid var(--border); }
  .content { margin-left: var(--sidebar); padding: var(--s5); }
  .page { max-width: 960px; }
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3) var(--s2); }
.nav { display: flex; flex-direction: column; gap: var(--s1); flex: 1; }
.nav a { display: flex; align-items: center; gap: var(--s3); height: var(--ctl); padding: 0 var(--s3); border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; }
.nav a:hover { background: var(--bg); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side-foot { display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s4); border-top: 1px solid var(--border); }
.side-foot .who { padding: 0 var(--s3); }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.card-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-xs { display: flex; flex-direction: column; gap: var(--s1); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: 500; min-height: 24px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
details.card[open] > summary { margin-bottom: var(--s4); }
details.card[open] > summary::after { transform: rotate(-135deg); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: var(--ctl); padding: 0 var(--s4); border: 1px solid transparent; border-radius: var(--r-sm); font: 500 var(--fs-md)/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { height: var(--ctl-sm); padding: 0 var(--s3); font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--fs-sm); line-height: 20px; font-weight: 500; }
.hint { font-size: var(--fs-cap); line-height: 16px; color: var(--muted); }
.input, .select { width: 100%; height: var(--ctl); padding: 0 var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: 400 var(--fs-md)/1 var(--font); }
.input::placeholder { color: var(--muted); }
.input.pin { text-align: center; letter-spacing: .4em; font-size: var(--fs-lg); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23637184' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select-sm { height: var(--ctl-sm); width: auto; min-width: 140px; font-size: var(--fs-sm); }
.msg { padding: var(--s3); border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 20px; }
.msg:empty { display: none; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.good { background: var(--ok-soft); color: var(--ok); }

/* ---------- tags, rows, tiles ---------- */
.tag { display: inline-block; padding: 2px var(--s2); border-radius: 999px; font-size: var(--fs-cap); line-height: 16px; font-weight: 500; background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row:last-child { padding-bottom: 0; }
.row-ctl { display: flex; flex-wrap: wrap; gap: var(--s2); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s3); }
.tile { display: flex; flex-direction: column; gap: var(--s1); }
.tile .tag { align-self: flex-start; margin-top: var(--s2); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.inline-form .input { width: 160px; }
.inline-form[hidden] { display: none; }

/* ---------- sign-in and setup ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: var(--s5); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: var(--s2); text-align: center; }
.auth-brand img { width: 72px; height: 72px; border-radius: 18px; }
#ts { display: flex; justify-content: center; min-height: 65px; }

/* access rows: on phones the name sits above, the dropdowns share one line */
@media (max-width: 600px) {
  .access-row { flex-direction: column; align-items: stretch; gap: var(--s2); }
  .access-row .row-ctl { display: grid; grid-template-columns: 1fr 1fr; }
  .access-row .row-ctl > :only-child { grid-column: 1 / -1; }
  .access-row .select-sm { width: 100%; min-width: 0; }
}

/* ---------- module building blocks (shared by every tool) ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.toolbar .select { width: auto; min-width: 160px; }
.big { font-size: 40px; line-height: 48px; font-weight: 500; }
.big small { font-size: var(--fs-md); font-weight: 400; color: var(--muted); margin-left: var(--s1); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stat { display: flex; flex-direction: column; gap: var(--s1); }
.stat .v { font-size: var(--fs-lg); font-weight: 500; line-height: 24px; }
.tone-ok { color: var(--ok); } .tone-bad { color: var(--bad); } .tone-warn { color: var(--warn); } .tone-muted { color: var(--muted); }
.segmented { display: inline-flex; align-items: stretch; height: var(--ctl-sm); border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; }
.segmented button { height: 100%; padding: 0 var(--s4); border: 0; background: var(--surface); color: var(--text); font: 500 var(--fs-sm)/1 var(--font); cursor: pointer; border-left: 1px solid var(--border); }
.segmented button:first-child { border-left: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); }
.chart .goal { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .band { fill: var(--ok-soft); }
.chart .line2 { fill: none; stroke: var(--warn); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot2 { fill: var(--warn); }
.history .list-row { cursor: pointer; }
.history .list-row:hover { background: var(--bg); }
.history .grow { flex: 1; }
.history .list-row > * { min-width: 0; }
.empty { padding: var(--s5) 0; text-align: center; color: var(--muted); }
dialog { width: min(420px, calc(100vw - 32px)); padding: var(--s5); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(24, 33, 43, .45); }
dialog form { display: flex; flex-direction: column; gap: var(--s4); }
dialog .dlg-actions { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) { .stats { gap: var(--s2); } .stats.four { grid-template-columns: repeat(2, 1fr); } .big { font-size: 32px; line-height: 40px; } }
.sdot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: none; }
.sdot.in { background: var(--ok); } .sdot.high { background: var(--bad); } .sdot.low { background: var(--warn); }
.legend { display: flex; gap: var(--s4); font-size: var(--fs-sm); }
.legend span { display: inline-flex; align-items: center; gap: var(--s2); }
.chart .rb-sys { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .55; }
.chart .rb-dia { stroke: var(--warn); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .55; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.textarea { width: 100%; padding: var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: 400 var(--fs-md)/24px var(--font); resize: vertical; }
.ring { position: relative; width: 240px; height: 240px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-bg { fill: none; stroke: var(--accent-soft); stroke-width: 12; }
.ring .ring-fg { fill: none; stroke: var(--ring, var(--accent)); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 628.3; stroke-dashoffset: 628.3; transition: stroke-dashoffset .6s; }
.ring.complete .ring-fg { stroke: var(--ok); }
.ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1); }
.ring-inner .big { font-variant-numeric: tabular-nums; font-size: 32px; line-height: 40px; }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); text-align: center; }
.meta .v { font-weight: 500; font-size: var(--fs-md); }
.meta button.v { background: none; border: 0; color: var(--accent); font: 500 var(--fs-md)/24px var(--font); cursor: pointer; padding: 0; }
.presets { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; }
.presets button { height: var(--ctl); min-width: 64px; padding: 0 var(--s4); border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: 500 var(--fs-md)/1 var(--font); cursor: pointer; }
.presets button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.center { text-align: center; }
@media (max-width: 600px) { .meta { gap: var(--s2); } .meta .v { font-size: var(--fs-sm); } }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.chips button { height: var(--ctl-sm); padding: 0 var(--s4); border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: 500 var(--fs-sm)/1 var(--font); cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.item { display: flex; flex-direction: column; gap: var(--s2); cursor: pointer; }
.item .top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.item .top a { color: var(--accent); font-size: var(--fs-sm); text-decoration: none; flex: none; }
.sides { display: flex; flex-wrap: wrap; gap: var(--s2); }
.sides button { height: var(--ctl-sm); padding: 0 var(--s3); border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: 400 var(--fs-sm)/1 var(--font); cursor: pointer; }
.sides button.add { color: var(--accent); border-style: dashed; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); column-gap: var(--s3); row-gap: 0; align-items: stretch; }
.item .tag { align-self: flex-start; }

/* ---------- calories ---------- */
.grow { flex: 1; min-width: 0; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.date-pick { width: auto; min-width: 160px; height: var(--ctl-sm); font-size: var(--fs-sm); }
.daystrip { position: relative; display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; }
.daystrip::-webkit-scrollbar { display: none; }
.daystrip button { flex: none; width: 52px; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s1) 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: 400 var(--fs-cap)/16px var(--font); cursor: pointer; }
.daystrip button b { font-size: var(--fs-md); line-height: 24px; font-weight: 500; }
.daystrip .mo, .daystrip .tot { display: block; color: var(--muted); min-height: 16px; }
.daystrip button.today { border-color: var(--border-strong); }
.daystrip button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.daystrip button[aria-pressed="true"] .mo, .daystrip button[aria-pressed="true"] .tot { color: var(--accent); }
.ring.warn .ring-fg { stroke: var(--warn); }
.ring.over .ring-fg { stroke: var(--bad); }
.stackbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--border); }
.stackbar i { display: block; height: 100%; width: 0; }
.stackbar .p { background: var(--accent); } .stackbar .c { background: var(--ok); } .stackbar .f { background: var(--warn); } .stackbar .o { background: var(--border-strong); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.macro { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.macro .v { font-size: var(--fs-md); font-weight: 500; line-height: 24px; }
.pbar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--accent); }
.macro.c .pbar i { background: var(--ok); } .macro.f .pbar i { background: var(--warn); } .pbar i.over { background: var(--bad); }
.search-wrap { position: relative; }
.search-wrap .input { padding-right: 44px; }
.search-wrap .clear { position: absolute; right: 0; top: 0; width: var(--ctl); height: var(--ctl); border: 0; background: none; color: var(--muted); font: 400 var(--fs-xl)/1 var(--font); cursor: pointer; }
.suggest { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-sm); max-height: 320px; overflow-y: auto; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--ctl); padding: var(--s2) var(--s3); border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--text); font: 400 var(--fs-md)/24px var(--font); text-align: left; cursor: pointer; }
.srow:first-child { border-top: 0; }
.srow:hover { background: var(--bg); }
.qty-card { padding: var(--s4); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); }
.stepper { display: flex; gap: var(--s2); justify-content: center; }
.stepper .input { width: 96px; text-align: center; }
.stepper .btn { width: var(--ctl); padding: 0; }
.qv { min-width: 32px; text-align: center; font-weight: 500; }
dialog.wide { width: min(560px, calc(100vw - 32px)); }
.scroll { max-height: 50vh; overflow-y: auto; padding-right: var(--s2); }
.chart .bar { fill: var(--accent-soft); }
.chart .bar.sel { fill: var(--accent); }
.chart .axis.sel { fill: var(--accent); font-weight: 600; }
@media (max-width: 600px) { .macros, .three-col { gap: var(--s2); } .stats.ins { grid-template-columns: 1fr; } }
.tile-link { text-decoration: none; color: inherit; }
.tile-link:hover { border-color: var(--accent); }
.v-big { font-size: var(--fs-xl); line-height: 32px; font-weight: 500; font-variant-numeric: tabular-nums; }
.macro-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s5); }
.donut { width: 160px; height: 160px; flex: none; }
.donut .d-bg { fill: none; stroke: var(--accent-soft); stroke-width: 14; }
.donut text { fill: var(--text); font-family: var(--font); }
.donut .d-sub { fill: var(--muted); }
.macro-row .list { flex: 1; min-width: 200px; }
.chart .bar { fill: var(--accent); }
.legend .sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
dialog { max-height: calc(100vh - 32px); overflow-y: auto; }
#dlg-docs, #dlg-det, #dlg-por { width: min(560px, calc(100vw - 32px)); }
#docs-list .list-row { flex-direction: column; align-items: stretch; gap: var(--s2); }
#docs-list .list-row .actions { justify-content: flex-start; }
.chart .proj { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; fill: none; }

/* ---------- shared health-page parts: the same on Weight and Blood pressure ---------- */
.metric { display: flex; flex-direction: column; gap: var(--s1); }
.metric .row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); }
.kv { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--ctl); }
.kv .k { font-size: var(--fs-sm); color: var(--muted); }
.kv .v { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); font-size: var(--fs-md); font-weight: 500; }
.card-sep { border-top: 1px solid var(--border); padding-top: var(--s3); }
.check { display: flex; align-items: center; gap: var(--s3); min-height: var(--ctl); font-size: var(--fs-md); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.big.muted-big { color: var(--muted); }
.chart .bar.met { fill: var(--ok); } .chart .bar.miss { fill: var(--warn); }
.chart .tick { stroke: var(--text); stroke-width: 1.5; opacity: .6; }
.muted-big { color: var(--muted); }
.btn-notify { position: relative; }
.btn-notify svg { flex: none; }
.btn-notify.on::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); box-sizing: content-box; }
@media (max-width: 600px) { .btn-notify .lbl { display: none; } .btn-notify { width: var(--ctl); padding: 0; } .multi-notify .btn-notify { width: auto; padding: 0 var(--s3); } .multi-notify .btn-notify .lbl-s { display: inline; font-size: var(--fs-sm); } }
.btn-notify .lbl-s { display: none; }
.kv .k { white-space: nowrap; flex: none; }
:root { --g0: color-mix(in srgb, var(--ok) 22%, var(--surface)); --g1: color-mix(in srgb, var(--ok) 34%, var(--surface)); --g2: color-mix(in srgb, var(--ok) 46%, var(--surface)); --g3: color-mix(in srgb, var(--ok) 58%, var(--surface)); --g4: color-mix(in srgb, var(--ok) 70%, var(--surface)); --g5: color-mix(in srgb, var(--ok) 85%, var(--surface)); --g6: color-mix(in srgb, var(--ok) 100%, var(--surface)); }
.presets button { background: var(--g0); }
.presets button[data-h="12"] { background: var(--g0); color: var(--text); border-color: transparent; }
.presets button[data-h="13"] { background: var(--g1); color: var(--text); border-color: transparent; }
.presets button[data-h="14"] { background: var(--g2); color: var(--text); border-color: transparent; }
.presets button[data-h="15"] { background: var(--g3); color: var(--text); border-color: transparent; }
.presets button[data-h="16"] { background: var(--g4); color: #FFFFFF; border-color: transparent; }
.presets button[data-h="17"] { background: var(--g5); color: #FFFFFF; border-color: transparent; }
.presets button[data-h="18"] { background: var(--g6); color: #FFFFFF; border-color: transparent; }
.presets button[aria-pressed="true"] { outline: 3px solid var(--text); outline-offset: 2px; }
.presets button { height: 48px; min-width: 56px; }
.endline { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--ok-soft); color: var(--ok); font-size: var(--fs-lg); line-height: 28px; font-weight: 500; text-align: center; }
.endline:empty { display: none; }
.meta.two { grid-template-columns: repeat(2, 1fr); }
.legend.scale { flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }

/* ---------- keyboard-free number entry ---------- */
.spinner { display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.spin-row { display: flex; align-items: center; justify-content: center; gap: 6px; }
.spin-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.spin-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; padding: 0; }
.spin-btn:active { background: var(--accent-soft); color: var(--accent); }
.spin-btn:disabled { opacity: .4; cursor: default; }
.spin-digit { width: 44px; text-align: center; font-size: 32px; line-height: 40px; font-weight: 500; font-variant-numeric: tabular-nums; }
.spin-digit.lead0 { color: var(--border-strong); }
.spin-dot { font-size: 32px; line-height: 40px; font-weight: 500; align-self: center; margin: 0 -2px; }
.spin-unit { align-self: center; color: var(--muted); font-size: var(--fs-md); margin-left: var(--s1); }
.spinner.is-off { opacity: .45; }
.spin-grid { display: grid; grid-template-columns: 1fr; gap: var(--s4); }
@media (min-width: 600px) { .spin-grid.two { grid-template-columns: 1fr 1fr; } }
.field .chips button { height: var(--ctl); }
.nav-title { padding: var(--s4) var(--s3) var(--s1); font-size: var(--fs-cap); line-height: 16px; font-weight: 500; color: var(--muted); }
.tile-head { display: flex; align-items: center; gap: var(--s3); }
.tile-icon { color: var(--accent); display: inline-flex; }

/* ---------- button hierarchy: 1 main (filled), 2 secondary (outlined), 3 quiet (ghost and link rows), 4 icon ---------- */
.btn-ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-ghost svg { width: 18px; height: 18px; flex: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--ctl-sm); height: var(--ctl-sm); padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.prop-line { display: flex; align-items: center; gap: var(--s1); }
.card-vacant { border-style: dashed; background: transparent; }
.card-vacant .vacant-note { text-align: center; padding: var(--s3) 0; }
.link-rows { display: flex; flex-direction: column; border-top: 1px solid var(--border); margin: 0 calc(var(--s4) * -1) calc(var(--s4) * -1); }
.link-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%; min-height: var(--ctl); padding: 0 var(--s4); border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); font: 500 var(--fs-sm)/1 var(--font); text-align: left; cursor: pointer; }
.link-row:first-child { border-top: 0; }
.link-row:hover { background: var(--bg); }
.link-row .lr-left, .link-row .lr-right { display: inline-flex; align-items: center; gap: var(--s2); }
.link-row .lr-left svg { width: 18px; height: 18px; color: var(--muted); }
.link-row .lr-right { color: var(--muted); font-weight: 400; }
.link-row .lr-right svg { width: 16px; height: 16px; }
.tenant-name { font-size: var(--fs-md); font-weight: 500; }
.card-vacant { border: 2px dashed var(--border-strong); }

/* ---------- table and year views ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: var(--fs-cap); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 500; border-top: 1px solid var(--border-strong); background: var(--bg); }
.table .sub { display: block; color: var(--muted); font-size: var(--fs-cap); }
.table tr.vacant td { color: var(--muted); }
.matrix th, .matrix td { padding: var(--s2) var(--s1); text-align: center; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: var(--s3); min-width: 170px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix td.m { font-size: var(--fs-cap); font-variant-numeric: tabular-nums; min-width: 44px; }
.matrix td.m span { display: block; border-radius: 6px; padding: 6px 0; font-weight: 500; }
.m-paid span { background: var(--ok-soft); color: var(--ok); }
.m-partial span { background: var(--warn-soft); color: var(--warn); }
.m-overdue span { background: var(--bad-soft); color: var(--bad); }
.m-due_soon span { background: var(--warn-soft); color: var(--warn); }
.m-upcoming span { background: var(--bg); color: var(--muted); }
.m-na { color: var(--border-strong); }
.matrix tfoot td:first-child { background: var(--bg); }
@media (max-width: 700px) {
  #tbl thead { display: none; }
  #tbl, #tbl tbody, #tbl tr, #tbl td, #tbl tfoot { display: block; width: 100%; }
  #tbl tr { padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
  #tbl td { border: 0; padding: var(--s1) 0; display: flex; justify-content: space-between; gap: var(--s3); text-align: right; }
  #tbl td::before { content: attr(data-label); color: var(--muted); text-align: left; }
  #tbl tfoot td { background: transparent; }
}
.tag { white-space: nowrap; }
.table td { white-space: nowrap; }
#tbl td:nth-child(2) { white-space: normal; min-width: 150px; }
#tbl th { white-space: nowrap; }
@media (max-width: 700px) { #tbl td { white-space: normal; } }

/* ---------- calories: quick logging ---------- */
.left-hero { display: flex; flex-direction: column; align-items: center; gap: var(--s1); padding: var(--s2) 0; text-align: center; }
.left-hero .big { font-variant-numeric: tabular-nums; }
.left-hero .big.over { color: var(--bad); }
.left-hero .big.muted-big { color: var(--text); }
.nutri { display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.nutri span { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 64px; font-size: var(--fs-sm); color: var(--muted); }
.nutri b { color: var(--text); font-weight: 500; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.food-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.food-chips button { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--ctl); padding: 0 var(--s4); border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: 500 var(--fs-sm)/1.2 var(--font); cursor: pointer; text-align: left; }
.food-chips button:hover { background: var(--accent-soft); border-color: var(--accent); }
.food-chips button i { font-style: normal; color: var(--muted); font-weight: 400; }
.eat-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); }
.eat-row:first-child { border-top: 0; padding-top: 0; }
.eat-row:last-child { padding-bottom: 0; }
.eat-row .nm { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.eat-row .nm b { font-weight: 500; overflow-wrap: anywhere; }
.eat-row .qty { display: inline-flex; align-items: center; gap: var(--s1); }
.eat-row .qty button, .eat-row .del { width: var(--ctl-sm); height: var(--ctl-sm); border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: 500 var(--fs-lg)/1 var(--font); cursor: pointer; }
.eat-row .qty span { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.eat-row .kc { min-width: 64px; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.eat-row .del { border-color: transparent; color: var(--muted); }
.eat-row .meta { display: flex; align-items: center; gap: var(--s2); }
.toast { position: fixed; left: 50%; bottom: calc(var(--s6) + 64px); transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--text); color: var(--surface); font: 500 var(--fs-sm)/1.3 var(--font); box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }
.toast button { border: 0; background: none; color: var(--surface); text-decoration: underline; font: inherit; cursor: pointer; min-height: 32px; padding: 0 var(--s2); }
.chart .bar { fill: var(--accent); opacity: .85; } .chart .bar.over { fill: var(--bad); } .chart .bar.today { opacity: 1; }
@media (max-width: 600px) { .eat-row { grid-template-columns: 1fr auto; } .eat-row .kc { grid-column: 2; grid-row: 1; } .eat-row .meta { grid-column: 1 / -1; justify-content: space-between; } }

/* ---------- calories: browse group -> category -> food ---------- */
.browse { display: flex; flex-direction: column; gap: var(--s3); }
.crumbs { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-height: var(--ctl-sm); }
.crumbs button { display: inline-flex; align-items: center; gap: var(--s1); height: var(--ctl-sm); padding: 0 var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font: 500 var(--fs-sm)/1 var(--font); cursor: pointer; }
.crumbs span { color: var(--muted); font-size: var(--fs-sm); }
.crumbs b { font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.tile-btn { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 68px; padding: var(--s3) var(--s4); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: 500 var(--fs-md)/1.25 var(--font); text-align: left; cursor: pointer; }
.tile-btn small { color: var(--muted); font-weight: 400; font-size: var(--fs-sm); }
.tile-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.item-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 56px; padding: var(--s2) var(--s4); border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--text); font: 400 var(--fs-md)/1.3 var(--font); text-align: left; cursor: pointer; }
.item-row:first-child { border-top: 0; }
.item-row:hover { background: var(--accent-soft); }
.item-row .nm { display: flex; flex-direction: column; min-width: 0; }
.item-row .nm b { font-weight: 500; overflow-wrap: anywhere; }
.item-row .nm small { color: var(--muted); font-size: var(--fs-sm); }
.item-row .kc { display: inline-flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.item-row .plus { display: inline-flex; align-items: center; justify-content: center; width: var(--ctl-sm); height: var(--ctl-sm); border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 500 var(--fs-lg)/1 var(--font); }
@media (max-width: 600px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.srow .nm { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.srow .nm b { font-weight: 500; overflow-wrap: anywhere; }
.srow .nm small { color: var(--muted); font-size: var(--fs-sm); font-weight: 400; }
.srow.cat { background: var(--accent-soft); } .srow.add .nm b { color: var(--accent); }
.suggest { max-height: 60vh; }

/* ---------- calories page: colour and polish (this page only) ---------- */
.cal .card { border-radius: 16px; box-shadow: 0 1px 2px rgba(24,33,43,.04), 0 6px 20px rgba(24,33,43,.05); border-color: transparent; }
.cal h2 { font-size: var(--fs-lg); font-weight: 600; }
.cal-hero { background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 62%); }
.hero-grid { display: grid; grid-template-columns: 210px 1fr; gap: var(--s5); align-items: center; }
.cal .ring { width: 210px; height: 210px; }
.cal .ring .ring-bg { stroke: rgba(47,111,219,.14); stroke-width: 14; }
.cal .ring .ring-fg { stroke-width: 14; stroke: var(--accent); }
.cal .ring.warn .ring-fg { stroke: var(--n-carbs); } .cal .ring.over .ring-fg { stroke: var(--bad); }
.cal .ring-inner .big { font-size: 40px; line-height: 44px; font-weight: 600; letter-spacing: -.5px; }
.cal .ring.over .ring-inner .big { color: var(--bad); }
.ntiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.ntile { --tc: var(--accent); --ts: var(--accent-soft); display: flex; flex-direction: column; gap: 6px; padding: var(--s3) var(--s4); border-radius: 14px; background: var(--ts); }
.ntile.p { --tc: var(--n-protein); --ts: var(--n-protein-soft); } .ntile.c { --tc: var(--n-carbs); --ts: var(--n-carbs-soft); }
.ntile.f { --tc: var(--n-fat); --ts: var(--n-fat-soft); } .ntile.fi { --tc: var(--n-fibre); --ts: var(--n-fibre-soft); }
.ntile .lb { font-size: var(--fs-cap); font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--tc); }
.ntile .vl { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.ntile .vl small { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); }
.ntile .tr { height: 6px; border-radius: 999px; background: rgba(255,255,255,.7); overflow: hidden; }
.ntile .tr i { display: block; height: 100%; border-radius: 999px; background: var(--tc); width: 0; transition: width .5s; }
:root[data-theme="dark"] .ntile .tr { background: rgba(255,255,255,.12); }
/* nutrient badges, the same everywhere on this page */
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.badge { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; line-height: 1.5; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--ts); color: var(--tc); white-space: nowrap; }
.badge i { font-style: normal; font-weight: 500; opacity: .85; }
.badge.p { --tc: var(--n-protein); --ts: var(--n-protein-soft); } .badge.c { --tc: var(--n-carbs); --ts: var(--n-carbs-soft); }
.badge.f { --tc: var(--n-fat); --ts: var(--n-fat-soft); } .badge.fi { --tc: var(--n-fibre); --ts: var(--n-fibre-soft); }
.kbadge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 600 var(--fs-sm)/1.3 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* chips */
.cal .food-chips button { border-color: transparent; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); padding: 0 var(--s3) 0 var(--s4); }
.cal .food-chips button:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .food-chips button .kbadge { padding: 1px 8px; font-size: 12px; }
/* group colours: tiles, crumbs and lists share the colour of their group */
.gc0 { --tc: var(--accent); --ts: var(--accent-soft); } .gc1 { --tc: var(--n-carbs); --ts: var(--n-carbs-soft); }
.gc2 { --tc: var(--n-protein); --ts: var(--n-protein-soft); } .gc3 { --tc: var(--n-fibre); --ts: var(--n-fibre-soft); } .gc4 { --tc: var(--n-fat); --ts: var(--n-fat-soft); }
.cal .tile-btn { position: relative; flex-direction: row; align-items: center; gap: var(--s3); min-height: 72px; border: 0; border-radius: 16px; background: var(--ts); color: var(--text); box-shadow: inset 0 0 0 1px transparent; transition: transform .08s, box-shadow .15s; }
.cal .tile-btn:hover { background: var(--ts); box-shadow: inset 0 0 0 2px var(--tc); transform: translateY(-1px); }
.cal .tile-btn .ic { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface); font-size: 24px; flex: none; }
.cal .tile-btn .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-weight: 600; }
.cal .tile-btn small { color: var(--tc); font-weight: 600; }
.cal .tile-btn.cat .ic { color: var(--tc); font-weight: 700; font-size: 18px; }
.cal .crumbs button { border: 0; background: var(--ts, var(--bg)); color: var(--tc, var(--text)); font-weight: 600; }
.cal .crumbs b { font-size: var(--fs-md); }
.cal .item-list { border: 0; border-radius: 16px; background: var(--bg); gap: 6px; padding: 6px; overflow: visible; }
.cal .item-row { border: 0; border-radius: 12px; background: var(--surface); box-shadow: inset 4px 0 0 var(--tc, var(--accent)); padding: var(--s3) var(--s4); min-height: 64px; align-items: center; }
.cal .item-row:hover { background: var(--ts, var(--accent-soft)); }
.cal .item-row .nm b { font-size: var(--fs-md); }
.cal .item-row .kc { gap: var(--s2); }
.cal .item-row .plus { background: var(--tc, var(--accent)); color: #fff; width: 32px; height: 32px; }
/* search results */
.cal .suggest { border: 0; border-radius: 16px; background: var(--bg); gap: 6px; padding: 6px; }
.cal .srow { border: 0; border-radius: 12px; background: var(--surface); min-height: 60px; }
.cal .srow:hover { background: var(--accent-soft); }
.cal .srow.cat { background: var(--ts, var(--accent-soft)); }
/* eaten list */
.cal .eat-row { padding: var(--s3) 0; }
.cal .eat-row .nm b { font-size: var(--fs-md); }
.cal .eat-row .kc { font-weight: 600; }
.cal .eat-row .qty button { border-radius: 999px; }
.cal #count { background: var(--bg); border-radius: 999px; padding: 2px 10px; font-weight: 600; }
/* chart */
.cal .chart .bar { fill: url(#barg); opacity: 1; } .cal .chart .bar.over { fill: url(#barbad); } .cal .chart .bar.today { filter: drop-shadow(0 2px 4px rgba(47,111,219,.35)); }
.cal .chart .goal { stroke: var(--n-fibre); stroke-width: 2; }
.cal .chart .gl { fill: var(--n-fibre); font-size: 10px; font-weight: 600; }
@media (max-width: 700px) { .hero-grid { grid-template-columns: 1fr; justify-items: center; } .ntiles { width: 100%; } .cal .ring { width: 220px; height: 220px; } }

/* goal - eaten = left, macro split, timeline diary, metric chips */
.eqn { display: flex; align-items: center; justify-content: center; gap: var(--s4); padding: var(--s3) var(--s4); border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.eqn span { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.eqn small { color: var(--muted); font-size: var(--fs-cap); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.eqn b { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.eqn i { font-style: normal; color: var(--muted); font-size: var(--fs-lg); }
.eqn .left b { color: var(--accent); } .eqn .left.over b { color: var(--bad); }
.split { display: flex; flex-direction: column; gap: 6px; }
.splitbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--border); }
.splitbar i { display: block; height: 100%; }
.splitbar .p { background: var(--n-protein); } .splitbar .c { background: var(--n-carbs); } .splitbar .f { background: var(--n-fat); }
.splitkey { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--fs-cap); color: var(--muted); }
.splitkey span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--tc); }
.splitkey .p { --tc: var(--n-protein); } .splitkey .c { --tc: var(--n-carbs); } .splitkey .f { --tc: var(--n-fat); }
.splitkey b { color: var(--text); font-weight: 600; }
.cal .eat-row { grid-template-columns: 64px 1fr auto auto; }
.cal .eat-row .tm { align-self: start; padding: 3px 0; border-radius: 8px; background: var(--bg); color: var(--muted); font: 600 12px/1.4 var(--font); text-align: center; font-variant-numeric: tabular-nums; }
.cal .eat-row .nm .sv { color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 600px) { .cal .eat-row { grid-template-columns: 56px 1fr auto; } .cal .eat-row .kbadge { grid-column: 3; grid-row: 1; } .cal .eat-row .meta { grid-column: 2 / -1; } }
.chips.mtabs button.mp[aria-pressed="true"] { background: var(--n-protein-soft); color: var(--n-protein); border-color: var(--n-protein); }
.chips.mtabs button.mc[aria-pressed="true"] { background: var(--n-carbs-soft); color: var(--n-carbs); border-color: var(--n-carbs); }
.chips.mtabs button.mf[aria-pressed="true"] { background: var(--n-fat-soft); color: var(--n-fat); border-color: var(--n-fat); }
.chips.mtabs button.mfi[aria-pressed="true"] { background: var(--n-fibre-soft); color: var(--n-fibre); border-color: var(--n-fibre); }

/* Tenants cards: six shared rows (subgrid), so everything in the same row lines up across cards */
.cards > .card { display: grid; grid-row: span 6; grid-template-rows: subgrid; row-gap: 0; margin-bottom: var(--s3); align-content: start; }
.cards > .card > * { min-width: 0; padding-top: var(--s3); }
.cards > .card > .s1 { grid-row: 1; padding-top: 0; } .cards > .card > .s2 { grid-row: 2; } .cards > .card > .s3 { grid-row: 3; }
.cards > .card > .s4 { grid-row: 4; } .cards > .card > .s5 { grid-row: 5; } .cards > .card > .s6 { grid-row: 6; }
.cards .card-title { display: flex; align-items: center; gap: var(--s2); min-height: var(--ctl-sm); }
.cards .card-title h3 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.chips-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-height: calc(var(--s3) + 24px); }
.cards .actions { align-self: end; flex-wrap: nowrap; } .cards .actions .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }
.cards .btn-block { align-self: end; }
.cards .link-rows { align-self: end; }

.input.pin-inline { width: 160px; height: var(--ctl-sm); font-size: var(--fs-md); }

/* clipboard */
.input.area { height: auto; min-height: calc(var(--ctl) * 2); padding: var(--s3); line-height: 1.4; resize: vertical; font-family: var(--font); }
.clip-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; align-self: start; }
#filter-row { align-items: center; }
#cat-actions { flex-wrap: nowrap; }

/* cards */
.lockbox { align-items: center; text-align: center; max-width: 480px; margin: 0 auto; width: 100%; }
.lock-ic { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.lock-ic svg { width: 28px; height: 28px; }
.digits, .digits-in { display: flex; gap: var(--s3); }
.dgrp, .dgrp-in { display: flex; gap: 3px; flex: 1 1 0; min-width: 0; }   /* the script sets each group's flex-grow to its digit count, so every box is the same width */
.dg { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; height: var(--ctl); border-radius: var(--r-sm); background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); font: 600 var(--fs-md)/1 var(--font); font-variant-numeric: tabular-nums; }
.dgrp-in .input.dg-in { flex: 1 1 0; min-width: 0; padding: 0; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.input.cvv-in { width: 120px; text-align: center; letter-spacing: .3em; }
.cards .digits { align-self: start; }

.clip-tmp { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* health records */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.rec-prev { display: flex; align-items: center; justify-content: center; height: 160px; padding-top: 0; margin-top: var(--s3); border-radius: var(--r-md); background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.cards > .card > .rec-prev { padding-top: 0; }
.rec-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rec-ph { display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.rec-ic { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); }
.rec-ic svg { width: 26px; height: 26px; }
.rec-file { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards .actions .btn { text-decoration: none; }
