/* うちのこと — 冷蔵庫のドアに貼るマグネットのように、家族それぞれの色が主役。それ以外は静かに。 */

:root {
  --bg: #F2F5F7;
  --surface: #FFFFFF;
  --ink: #1E2933;
  --muted: #687582;
  --line: #DCE3E9;
  --soft: #E8EDF1;
  --focus: #2F6FDB;
  --danger: #C2362B;
  --sun: #C2362B;
  --sat: #2F6FDB;
  --today: #1E2933;
  --today-ink: #FFFFFF;
  --shadow: 0 1px 0 rgba(30, 41, 51, 0.06), 0 8px 24px -12px rgba(30, 41, 51, 0.18);

  --r-row: 12px;
  --r-sheet: 22px;
  --tabbar-h: 64px;
  --gutter: 16px;
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151B21;
    --surface: #1D252D;
    --ink: #E7EDF2;
    --muted: #93A0AC;
    --line: #2E3944;
    --soft: #26303A;
    --focus: #7FA8F0;
    --danger: #F07A6F;
    --sun: #F07A6F;
    --sat: #7FA8F0;
    --today: #E7EDF2;
    --today-ink: #151B21;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  min-height: 100dvh;
}
.boot, .fatal { color: var(--muted); padding-top: 40vh; text-align: center; }
.fatal { padding-top: 30vh; line-height: 1.8; }
.fatal strong { color: var(--ink); display: block; font-size: 18px; margin-bottom: 6px; }
.fatal .line-id { color: var(--ink); display: inline-block; font-size: 13px; word-break: break-all; padding: 8px 10px; border-radius: 10px; background: var(--soft); user-select: all; }

/* ---------- ヘッダー ---------- */
.head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 12px;
}
.head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  flex: 1;
}
.whoami {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- マグネット（家族の色） ---------- */
.mag {
  --c: var(--muted);
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 1px 1.5px rgba(0, 0, 0, 0.18);
  flex: none;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 4px;
  margin: 0 -2px 12px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  --c: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.chip .mag { width: 14px; height: 14px; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] {
  background: var(--c);
  border-color: var(--c);
  color: #fff;
}
.chip[aria-pressed="true"] .mag, .chip[aria-checked="true"] .mag { background: #fff; box-shadow: none; }
.chip[aria-pressed="false"] { color: var(--muted); }
.chip[aria-pressed="false"] .mag { opacity: 0.45; }

/* ---------- セグメント ---------- */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--soft);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 14px;
}
.seg button {
  border: 0;
  background: transparent;
  min-height: 40px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg .count { font-weight: 500; font-size: 13px; margin-left: 4px; }
.seg .mag { width: 9px; height: 9px; margin-right: 5px; vertical-align: 1px; }

/* ---------- 入力 ---------- */
.add {
  display: flex;
  gap: 8px;
  position: sticky;
  top: calc(env(safe-area-inset-top) + 8px);
  z-index: 5;
  margin-bottom: 18px;
}
.add input {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-row);
  background: var(--surface);
  font-size: 17px;
  box-shadow: var(--shadow);
}
.add input::placeholder { color: var(--muted); }
.add input:focus { outline: none; border-color: var(--focus); }

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--r-row);
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 16px;
  flex: none;
}
.btn:disabled { opacity: 0.4; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 999px; }
.linkbtn { border: 0; background: none; color: var(--muted); font-size: 14px; padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 買い物リスト ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--r-row);
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}
.item .check {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 4px 10px 14px;
  border: 0;
  background: none;
  text-align: left;
  min-width: 0;
}
.box {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: none;
  display: grid;
  place-items: center;
  transition: background-color 0.15s, border-color 0.15s;
}
.box svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 3; fill: none; opacity: 0; }
.item .tw { flex: 1; min-width: 0; }
.item .text { min-width: 0; overflow-wrap: anywhere; font-size: 17px; line-height: 1.45; }
.item .meta { display: flex; text-decoration: none; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.item .meta .mag { width: 9px; height: 9px; }
.item .del {
  border: 0;
  background: none;
  width: 48px;
  height: 56px;
  color: var(--muted);
  flex: none;
  display: grid;
  place-items: center;
}
.item .del svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }

.item.done { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); }
.item.done .text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.item.done .box { background: var(--muted); border-color: var(--muted); }
.item.done .box svg { opacity: 1; }
.item.just .box { animation: pop 0.28s ease-out; }
@keyframes pop { 50% { transform: scale(1.25); } }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 12px;
  line-height: 1.8;
}
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 2px; }

/* ---------- カレンダー ---------- */
.monthnav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.iconbtn {
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink);
}
.iconbtn:active { background: var(--soft); }
.iconbtn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.cal {
  background: var(--surface);
  border-radius: var(--r-sheet);
  padding: 8px 6px 10px;
  box-shadow: var(--shadow);
}
.dow, .grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dow span { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0 6px; }
.dow span:first-child { color: var(--sun); }
.dow span:last-child { color: var(--sat); }

.day {
  border: 0;
  background: none;
  min-height: 74px;
  padding: 4px 2px 3px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}
.day .num {
  align-self: center;
  width: 26px;
  height: 26px;
  line-height: 26px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.day.sun .num { color: var(--sun); }
.day.sat .num { color: var(--sat); }
.day.out { opacity: 0.35; }
.day.today .num { background: var(--today); color: var(--today-ink); font-weight: 800; }
.day[aria-pressed="true"] { background: var(--soft); }
.bar {
  --c: var(--muted);
  display: block;
  background: var(--c);
  color: #fff;
  font-size: 10px;
  line-height: 15px;
  height: 15px;
  border-radius: 4px;
  padding: 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  font-weight: 500;
}
.more { font-size: 10px; color: var(--muted); line-height: 13px; text-align: center; }

.agenda { margin-top: 22px; }
.agenda h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  flex: 1;
}
.agenda .bar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.event {
  --c: var(--muted);
  display: flex;
  width: 100%;
  gap: 12px;
  align-items: stretch;
  text-align: left;
  border: 0;
  background: var(--surface);
  border-radius: var(--r-row);
  padding: 12px 14px 12px 12px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}
.event .stripe { width: 5px; border-radius: 3px; background: var(--c); flex: none; }
.event .time { width: 52px; flex: none; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.4; }
.event .time small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.event .body { flex: 1; min-width: 0; }
.event .title { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; line-height: 1.45; }
.event .who { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 2px; }
.event .who .mag { width: 10px; height: 10px; }
.event .note { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- 下部タブ ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.tab svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] svg { stroke-width: 2.3; }

/* ---------- シート（予定の追加・編集） ---------- */
.sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--surface);
  color: var(--ink);
}
.sheet::backdrop { background: rgba(10, 16, 22, 0.45); }
.sheet[open] { animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } }
.sheet form { padding: 10px var(--gutter) calc(env(safe-area-inset-bottom) + 18px); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { font-size: 20px; font-weight: 800; margin: 0 0 14px; }

.field { display: block; margin-bottom: 16px; }
.field > span, .field legend { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; padding: 0; }
fieldset.field { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.field input[type="text"], .field input[type="date"], .field input[type="time"], .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-row);
  background: var(--bg);
  font-size: 16px;
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--focus); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row .tilde { flex: none; color: var(--muted); }
.who-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 10px;
  font-weight: 500;
}
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background-color 0.15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 0.15s; }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2.5px solid var(--focus); outline-offset: 2px; }

.actions { display: flex; gap: 10px; margin-top: 22px; }
.actions .btn { flex: 1; }
.actions .btn.danger { flex: none; }
.err { color: var(--danger); font-size: 14px; margin: 4px 0 0; min-height: 1em; }

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 10px 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
}
.toast button { border: 0; background: none; color: inherit; font-weight: 800; padding: 6px 10px; text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 精算 ---------- */
.owe {
  background: var(--surface);
  border-radius: var(--r-sheet);
  padding: 6px 16px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.owe-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "who btn" "amount btn";
  align-items: center;
  column-gap: 12px;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--line);
}
.owe-row:last-of-type { border-bottom: 0; }
.owe-who { grid-area: who; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.owe-p { display: inline-flex; align-items: center; gap: 6px; }
.owe-arrow { width: 18px; height: 18px; stroke: var(--muted); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.owe-amount { grid-area: amount; font-size: 38px; font-weight: 800; line-height: 1.15; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.owe-row .btn { grid-area: btn; }
.owe-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.owe-zero { display: flex; align-items: center; gap: 14px; padding: 14px 0 6px; }
.owe-zero strong { display: block; font-size: 18px; }
.owe-zero span { color: var(--muted); font-size: 14px; }
.owe-check { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; flex: none; }
.owe-check svg { width: 24px; height: 24px; stroke: var(--ink); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.addreceipt { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 8px; }
.btn.big { width: 100%; min-height: 58px; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 16px; }
.btn.big svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linejoin: round; }

.srow { display: flex; align-items: center; gap: 10px; padding: 6px 2px; font-size: 14px; }
.srow-main { flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; }
.srow-main strong { margin-left: 4px; }
.srow-date { color: var(--muted); font-size: 13px; }
.srow .mag { width: 10px; height: 10px; }

.receipt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--surface);
  border-radius: var(--r-row);
  padding: 12px 14px;
  margin-bottom: 6px;
  box-shadow: var(--shadow);
}
.r-date { flex: none; width: 58px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.4; }
.r-main { flex: 1; min-width: 0; }
.r-store { display: block; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-shares { display: flex; flex-wrap: wrap; column-gap: 10px; font-size: 12px; color: var(--muted); }
.r-shares > span { display: inline-flex; align-items: center; gap: 4px; }
.r-shares .mag, .r-payer .mag { width: 8px; height: 8px; }
.r-right { flex: none; text-align: right; }
.r-total { display: block; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.r-payer { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }

/* レシート編集 */
.sheet.tall { height: 94dvh; max-height: 94dvh; }
.sheet.tall form { padding-bottom: 0; }
.rnotice { margin: -4px 0 12px; font-size: 14px; color: var(--muted); background: var(--soft); border-radius: 10px; padding: 10px 12px; line-height: 1.6; }
.rnotice.ok { color: var(--ink); }
.rphoto { display: block; width: 100%; border: 0; padding: 0; background: var(--bg); border-radius: 12px; overflow: hidden; margin-bottom: 14px; max-height: 140px; transition: max-height 0.25s; }
.rphoto img { display: block; width: 100%; height: auto; }
.rphoto.big { max-height: 2400px; }
.date-field { flex: 0 0 150px !important; }

.bulk { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.bulk::-webkit-scrollbar { display: none; }
.bulk > span { flex: none; }
.bulk .btn { flex: none; }

.ritems { list-style: none; margin: 0; padding: 0; }
.ritem { background: var(--bg); border-radius: var(--r-row); padding: 8px 8px 10px 10px; margin-bottom: 6px; }
.ri-top { display: flex; align-items: center; gap: 4px; }
.field .ri-top input[type="text"] { width: auto; border: 0; background: transparent; min-height: 40px; font-size: 16px; padding: 0 4px; border-radius: 8px; min-width: 0; }
.field .ri-top input[type="text"]:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--focus); }
.field .ri-top input.ri-name { flex: 1; }
.ri-yen { color: var(--muted); font-size: 14px; }
.field .ri-top input.ri-price { width: 84px; flex: none; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ri-del { border: 0; background: none; width: 36px; height: 40px; color: var(--muted); display: grid; place-items: center; flex: none; }
.ri-del svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }

/* 誰のものか：タップで切り替え */
.oseg { display: flex; gap: 4px; margin-top: 4px; }
.oseg button {
  --c: var(--muted);
  flex: 1;
  min-width: 0;
  min-height: 38px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
}
.oseg button .mag { width: 10px; height: 10px; }
.oseg button[aria-checked="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.oseg button[aria-checked="true"] .mag { background: #fff; box-shadow: none; }
.addrow { margin-top: 2px; }

.rsum {
  position: sticky;
  bottom: 0;
  margin: 0 calc(var(--gutter) * -1);
  padding: 12px var(--gutter);
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 2;
}
.rsum-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.rsum-total strong { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rsum-people { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted); margin-top: 2px; }
.rsum-people > span { display: inline-flex; align-items: center; gap: 5px; }
.rsum-people strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.rsum-warn { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; font-size: 13px; color: var(--danger); }
.rsum-warn .linkbtn { color: var(--danger); font-size: 13px; padding: 4px 0; }
.sheet.tall .actions { position: sticky; bottom: 0; background: var(--surface); margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) calc(env(safe-area-inset-bottom) + 14px); z-index: 2; }
.sheet.tall .rsum { bottom: calc(env(safe-area-inset-bottom) + 66px); }

.scanning { padding: 10px var(--gutter) calc(env(safe-area-inset-bottom) + 40px); text-align: center; color: var(--muted); }
.spinner { width: 36px; height: 36px; margin: 28px auto 12px; border-radius: 50%; border: 3.5px solid var(--line); border-top-color: var(--ink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: spin 2.4s linear infinite !important; } }

.tabbar { grid-template-columns: repeat(3, 1fr); }
