[hidden] { display: none !important; }
:root {
  --bg: #f4f6f6; --card: #ffffff; --text: #17201f; --muted: #5d6b69; --line: #dde3e2;
  --brand: #1f5f5b; --brand-ink: #ffffff; --link: #145a8c;
  --red-bg: #fde8e7; --red: #a3221b; --amber-bg: #fff3d6; --amber: #7a5200; --dark-bg: #2b2f2f; --dark: #ffffff;
  --tag: #eef1f1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111615; --card: #1a2120; --text: #e6ecea; --muted: #9aa8a5; --line: #2c3634;
    --brand: #164845; --link: #8cc3f0;
    --red-bg: #3d1716; --red: #ffb3ad; --amber-bg: #3a2c0b; --amber: #ffd27a; --dark-bg: #000; --tag: #26302e;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  background: var(--brand); color: var(--brand-ink); padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { color: inherit; text-decoration: none; font-weight: 700; }
.brand span { font-weight: 400; opacity: .8; }
.out button { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.5); border-radius: 6px; padding: 4px 10px; font-size: 14px; }
h1 { font-size: 22px; margin: 4px 0 6px; }
h2.section { font-size: 17px; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.narrow { max-width: 420px; margin: 24px auto; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.pad { padding: 12px 0; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-weight: 600; }
input { font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); width: 100%; }
button { font: inherit; cursor: pointer; }
.primary { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: 12px; font-weight: 600; }
.alert { border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; font-weight: 600; }
.alert.red { background: var(--red-bg); color: var(--red); }
.alert.amber { background: var(--amber-bg); color: var(--amber); }
.alert.dark { background: var(--dark-bg); color: var(--dark); }
.search { position: sticky; top: 48px; z-index: 4; background: var(--bg); padding: 4px 0 8px; }
.search input { font-size: 17px; padding: 13px 14px; }
.hint { margin: 0 0 8px; }
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: grid; gap: 2px; padding: 11px 14px; color: inherit; text-decoration: none; }
.list a:active { background: var(--tag); }
.list .kind { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.list .title { font-weight: 600; }
.sub { color: var(--muted); font-size: 14px; margin: 0; }
.dim { opacity: .65; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }
.tag { font-style: normal; font-size: 12px; background: var(--tag); border-radius: 999px; padding: 1px 8px; color: var(--muted); white-space: nowrap; }
.tag.red { background: var(--red-bg); color: var(--red); font-weight: 600; }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.dark { background: var(--dark-bg); color: var(--dark); }
.addr { margin: 8px 0; }
.contacts { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.contacts li { display: grid; }
.contacts a { font-size: 17px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 16px; margin: 10px 0; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
details { border-top: 1px solid var(--line); padding: 8px 0 0; margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; }
ul.plain { padding-left: 18px; margin: 6px 0; }
.owner { margin: 8px 0; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.toggle { display: flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 400; color: var(--muted); }
.toggle input { width: auto; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.entry { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.history:not(.all) .entry.collapsed { display: none; }
.entry.collapsed { background: transparent; }
.entry .meta { font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.entry .who { color: var(--muted); margin-left: auto; }
.entry .preview { margin: 4px 0 0; overflow-wrap: anywhere; }
.entry.open .preview { display: none; }
.tag.k { background: var(--brand); color: var(--brand-ink); }
.k-lab_ai .tag.k { background: var(--amber-bg); color: var(--amber); }
.more, .load { margin-top: 6px; background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; color: var(--link); font-size: 14px; }
.load { width: 100%; padding: 10px; }
.next { list-style: none; }
.files { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.files a { overflow-wrap: anywhere; }
.note { overflow-x: auto; overflow-wrap: anywhere; margin-top: 6px; }
.note img { max-width: 100%; height: auto; }
.note table { border-collapse: collapse; font-size: 13px; }
.note td, .note th { border: 1px solid var(--line); padding: 2px 6px; }
.note pre { white-space: pre-wrap; font-size: 13px; }
.note pre.fit { white-space: pre; overflow-x: auto; line-height: 1.25; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tabs { display: flex; gap: 4px; margin: 20px 0 8px; }
.tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; border: 1px solid var(--line); }
.tabs a[aria-current] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
ul.labs { list-style: none; margin: 8px 0; padding: 0; border-top: 1px solid var(--line); }
ul.labs li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.labs .t { font-weight: 600; }
ul.labs .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
ul.labs .v b { margin-left: 4px; }
ul.labs .r { color: var(--muted); font-size: 13px; }
ul.labs .bar { position: relative; align-self: center; justify-self: end; width: 84px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--tag) 25%, rgba(31,95,91,.18) 25%, rgba(31,95,91,.18) 75%, var(--tag) 75%); }
ul.labs .bar i { position: absolute; top: -2px; width: 4px; height: 12px; margin-left: -2px; border-radius: 2px; background: var(--text); }
ul.labs li.hi .v { color: var(--red); }
ul.labs li.hi .bar i { background: var(--red); }
ul.labs li.lo .v { color: var(--link); }
ul.labs li.lo .bar i { background: var(--link); }
.note .plain, .note.imported { white-space: pre-line; }
.noimg { color: var(--muted); font-style: italic; }
.list a.inv, ul.lines li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px; }
ul.lines li { padding: 10px 14px; }
.amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
ul.lines li.part { padding-left: 28px; color: var(--muted); }
ul.lines li.part .title { font-weight: 400; }
dd.due { color: var(--red); }
ul.lines .sub { grid-column: 1 / -1; }
.list .sub a { display: inline; padding: 0; }
/* ---- charging ---- */
.charge-btn { display: block; text-align: center; text-decoration: none; margin: 12px 0 4px; font-size: 17px; }
.trial { background: var(--amber-bg); color: var(--amber); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.charge-head h1 { margin-bottom: 0; }
.charge-head p { margin: 2px 0; }
.tag.plan { background: rgba(31,95,91,.14); color: var(--brand); font-weight: 600; }
@media (prefers-color-scheme: dark) { .tag.plan { color: #8fd3cc; } }
.charge-search { top: 48px; }
.small-h { font-size: 15px; color: var(--muted); margin: 14px 0 6px; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick { position: relative; display: grid; gap: 4px; text-align: left; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 9px; min-height: 64px; font-size: 15px;
  transition: transform .08s, background .3s; }
.pick:active { transform: scale(.97); }
.pick.added { background: rgba(31,95,91,.18); }
.pick .pn { font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick .pp { font-variant-numeric: tabular-nums; }
.pick .hint { font-size: 12px; color: var(--muted); }
.pick .dot { font-size: 11px; color: var(--amber); font-weight: 600; }
#presults { margin-bottom: 8px; }
.basket { position: sticky; bottom: 0; margin: 16px -16px -48px; background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.basket-bar { width: 100%; display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--brand);
  color: var(--brand-ink); border: 0; padding: 14px 16px; font-size: 16px; font-weight: 600; }
.basket-bar .b-review { font-weight: 400; opacity: .9; }
.basket-body { padding: 8px 16px 16px; max-height: 60vh; overflow-y: auto; }
.b-lines { list-style: none; margin: 0; padding: 0; }
.b-lines li { border-bottom: 1px solid var(--line); padding: 10px 0; }
.b-top { display: flex; justify-content: space-between; gap: 12px; }
.b-name { font-weight: 600; }
.b-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.qty { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 20px; line-height: 1; }
.qty-in { width: 64px; text-align: center; padding: 8px 4px; }
.rm { margin-left: auto; background: transparent; border: 0; color: var(--red); font-size: 14px; }
.why { margin: 4px 0 0; font-size: 13px; color: var(--brand); }
.why.warn { color: var(--amber); }
@media (prefers-color-scheme: dark) { .why { color: #8fd3cc; } }
.b-sum { display: flex; justify-content: space-between; font-size: 17px; margin: 12px 0 4px; }
.primary.wide { width: 100%; display: block; text-align: center; text-decoration: none; margin-top: 8px; font-size: 17px; }
.done { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-top: 12px; }
.done h2 { margin-top: 0; font-size: 18px; color: var(--amber); }
.pick .pack { font-size: 12px; color: var(--muted); line-height: 1.2; }
ul.parts { list-style: none; margin: 6px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); font-size: 13px; }
ul.parts li { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
.live-note { background: rgba(31,95,91,.12); color: var(--brand); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-weight: 600; margin: 0 0 8px; }
@media (prefers-color-scheme: dark) { .live-note { color: #8fd3cc; } }
.secondary { background: transparent; color: var(--link); border: 1px solid var(--line); border-radius: 8px; padding: 11px; font-weight: 600; }
.secondary.wide { width: 100%; display: block; text-align: center; text-decoration: none; margin-top: 8px; font-size: 16px; }
.batch-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 400; }
.batch-row select { flex: 1; font: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); }
.doses { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--line); }
.dose { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 400; margin: 4px 0; }
.dose .qty-in { width: 72px; flex: none; }
.warn { color: var(--amber); }
