/* ==========================================================================
   レシート家計簿 — デザインシステム
   方針: 帳簿の罫線 / 感熱紙のレシート片 / 朱の判子。
   色は「藍＝操作」「朱＝要確認・済印・赤字」の2つに絞る。
   ========================================================================== */

:root {
  --paper: #f1f4f8;
  --slip: #ffffff;
  --ink: #16202c;
  --ink-2: #465465;
  --ink-3: #596679;
  --rule: #d3dae3;
  --rule-strong: #a9b4c3;
  --indigo: #234a7d;
  --indigo-deep: #17335a;
  --indigo-soft: #e3ebf6;
  --on-indigo: #ffffff;
  --shu: #c0392b;
  --shu-soft: #fbe9e6;
  --moss: #2b6e4f;
  --moss-soft: #e2f1e9;
  --amber: #b7791f;
  --amber-soft: #fbf0d9;
  --focus: #1b6fe0;
  --shadow: 0 1px 0 rgb(22 32 44 / 0.04), 0 6px 18px rgb(22 32 44 / 0.08);
  --c1: #234a7d; --c2: #2a8c82; --c3: #d39b2a; --c4: #8a4f7d;
  --c5: #5e8c3a; --c6: #6b7a8f; --c7: #c9657a; --c8: #5ba3d0;
  --font: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1620;
    --slip: #17212e;
    --ink: #e8edf3;
    --ink-2: #b4becb;
    --ink-3: #98a5b5;
    --rule: #2a3748;
    --rule-strong: #46566b;
    --indigo: #7fa8e6;
    --indigo-deep: #a8c5f0;
    --indigo-soft: #1f3150;
    --on-indigo: #0b1626;
    --shu: #ef7d6f;
    --shu-soft: #3b1f1c;
    --moss: #6fc79b;
    --moss-soft: #16301f;
    --amber: #e1b254;
    --amber-soft: #392c12;
    --focus: #7fb0ff;
    --shadow: 0 6px 18px rgb(0 0 0 / 0.4);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: "palt" 0;
}
body.easy { font-size: 22px; line-height: 1.6; }
h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 700; }
p { margin: 0 0 0.75em; }
a { color: var(--indigo); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: 0.01em; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 44px; padding: 0.55em 1.2em;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  color: var(--on-indigo); background: var(--indigo);
  border: 2px solid var(--indigo); border-radius: 12px;
}
.btn:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-line { color: var(--indigo); background: transparent; }
.btn-line:hover { color: var(--on-indigo); }
.btn-quiet { color: var(--ink-2); background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--indigo-soft); color: var(--ink); border-color: transparent; }
.btn-danger { color: var(--shu); background: transparent; border-color: var(--shu); }
.btn-danger:hover { color: #fff; background: var(--shu); border-color: var(--shu); }
.btn-sm { min-height: 36px; padding: 0.25em 0.8em; font-size: 0.9rem; border-radius: 10px; }
.btn-block { display: flex; width: 100%; }
.btn-xl { min-height: 76px; font-size: 1.15em; border-radius: 18px; padding: 0.5em 1.2em; }

/* ---------- forms ---------- */
.field { display: grid; gap: 4px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 700; font-size: 0.9em; color: var(--ink-2); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 0.5em 0.75em;
  font: inherit; color: var(--ink); background: var(--slip);
  border: 1.5px solid var(--rule-strong); border-radius: 10px;
}
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--indigo); }
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--focus); }
.hint { font-size: 0.85em; color: var(--ink-3); }
.field.is-provisional input, .field.is-provisional select {
  border-color: var(--amber);
  background: repeating-linear-gradient(135deg, var(--amber-soft) 0 6px, var(--slip) 6px 12px);
}
.field.is-provisional .hint { color: var(--amber); font-weight: 700; }
.form-row { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-error { color: var(--shu); font-weight: 700; margin: 8px 0; }
.segmented { display: inline-flex; border: 2px solid var(--indigo); border-radius: 12px; overflow: hidden; }
.segmented label { padding: 0.5em 1.2em; cursor: pointer; font-weight: 700; color: var(--indigo); }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented input:checked + span, .segmented label:has(input:checked) { background: var(--indigo); color: var(--on-indigo); }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }

/* ---------- badges / stamp ---------- */
.badge {
  display: inline-block; padding: 0 0.6em; font-size: 0.8em; font-weight: 700; line-height: 1.7;
  border: 1.5px solid currentColor; border-radius: 6px;
}
.badge-review { color: var(--shu); background: var(--shu-soft); }
.badge-ok { color: var(--moss); background: var(--moss-soft); }
.badge-warn { color: var(--amber); background: var(--amber-soft); }
.badge-mute { color: var(--ink-3); }

.stamp-layer { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 100; }
.stamp {
  display: grid; place-items: center; width: 168px; height: 168px;
  color: var(--shu); border: 8px solid var(--shu); border-radius: 50%;
  font-size: 96px; font-weight: 900; line-height: 1;
  transform: rotate(-12deg); background: rgb(255 255 255 / 0.6);
  animation: stamp-in 0.32s cubic-bezier(.2,.9,.3,1.2) both, stamp-out 0.3s ease-in 0.9s forwards;
}
@keyframes stamp-in { from { transform: rotate(-26deg) scale(2); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: 0.92; } }
@keyframes stamp-out { to { opacity: 0; } }

/* ---------- receipt slip ---------- */
.slip-wrap { filter: drop-shadow(0 4px 8px rgb(22 32 44 / 0.12)); }
.slip {
  --tooth: 18px;
  background: var(--slip); padding: 20px 22px calc(20px + var(--tooth) / 2);
  border-top: 5px solid var(--indigo);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--tooth) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--tooth) 100%;
}

/* ---------- dialog / sheet ---------- */
dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; color: var(--ink); background: var(--paper);
  border: 0; border-radius: 20px; box-shadow: var(--shadow); overflow: auto;
}
dialog.wide { width: min(880px, calc(100vw - 24px)); }
dialog::backdrop { background: rgb(15 22 32 / 0.55); }
.dialog-body { padding: 22px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.dialog-title { font-size: 1.15em; margin-bottom: 14px; }
@media (max-width: 640px) {
  dialog { margin: auto 0 0; width: 100vw; max-width: none; border-radius: 22px 22px 0 0; max-height: 94dvh; }
  .dialog-actions .btn { flex: 1 1 auto; }
}

/* ---------- QRコード（見守り） ---------- */
.qr-box { display: grid; place-items: center; margin: 14px 0; padding: 14px; background: #fff; border-radius: 14px; }
.qr-box svg { width: min(72vw, 300px); height: auto; display: block; }

/* ---------- 変更履歴（監査ログ） ---------- */
.events { list-style: none; margin: 0; padding: 0 0 0 4px; border-left: 2px solid var(--rule-strong); }
.events > li { position: relative; padding: 2px 0 16px 18px; }
.events > li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--indigo); border: 2px solid var(--paper); }
.events .when { font-size: 0.82em; color: var(--ink-3); }
.events .what { font-weight: 700; }
.events .line { font-size: 0.92em; }
.events .from { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
details.history-events { margin-top: 18px; border-top: 1px solid var(--rule-strong); padding-top: 10px; }
details.history-events > summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: 6px 0; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; z-index: 200; pointer-events: none; }
.toast {
  max-width: min(92vw, 520px); padding: 12px 18px; font-weight: 700; color: #fff;
  background: var(--ink); border-radius: 12px; box-shadow: var(--shadow);
}
.toast.error { background: var(--shu); }
body.easy .toast { font-size: 1.05em; padding: 16px 22px; }
@media (prefers-color-scheme: dark) { .toast { color: var(--paper); } .toast.error { color: #1a0b09; } }

/* ---------- busy overlay ---------- */
.busy { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; align-content: center; gap: 22px; background: rgb(15 22 32 / 0.72); color: #fff; text-align: center; }
.busy-slip { position: relative; width: 120px; height: 150px; background: #fff; border-top: 5px solid var(--indigo); overflow: hidden; border-radius: 4px; }
.busy-slip::before { content: ""; position: absolute; inset: 18px 16px; background: repeating-linear-gradient(#c8d0db 0 4px, transparent 4px 14px); }
.busy-slip::after { content: ""; position: absolute; left: 0; right: 0; height: 4px; background: var(--shu); box-shadow: 0 0 12px var(--shu); animation: scan 1.4s ease-in-out infinite alternate; }
@keyframes scan { from { top: 8px; } to { top: calc(100% - 12px); } }
.busy p { font-size: 1.1em; font-weight: 700; }

/* ---------- ledger (帳簿の罫線) ---------- */
.ledger { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.ledger > li { display: grid; gap: 4px 14px; padding: 12px 2px; border-bottom: 1px solid var(--rule); }
.ledger .amt { font-weight: 700; text-align: right; white-space: nowrap; }
.amt.in { color: var(--moss); }
.date-head { margin: 22px 0 0; padding: 6px 2px; font-size: 0.85em; font-weight: 700; color: var(--ink-3); border-bottom: 1px solid var(--rule-strong); }

/* ==========================================================================
   簡単モード
   ========================================================================== */
.easy-page { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }
.easy-top { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px 14px; font-weight: 700; }
.easy-top a { font-size: 0.85em; }

.hero { padding: 6px 2px 4px; }
.hero-label { font-size: 1em; font-weight: 700; color: var(--ink-2); margin: 0; }
.hero-amount { margin: 0; font-size: clamp(3.4rem, 17vw, 5.4rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.01em; color: var(--ink); }
.hero-amount .yen { font-size: 0.5em; margin-right: 0.08em; font-weight: 700; }
.hero[data-state="over"] .hero-amount { color: var(--shu); }
.hero-note { margin: 0; font-size: 0.9em; color: var(--ink-3); }

.meter { margin: 16px 0 6px; }
.meter-track { height: 18px; border-radius: 9px; background: var(--rule); overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--moss); border-radius: 9px; transition: width 0.5s ease; }
[data-state="warn"] .meter-fill { background: var(--amber); }
[data-state="over"] .meter-fill { background: var(--shu); }
.meter-cap { display: flex; justify-content: space-between; font-size: 0.8em; color: var(--ink-3); margin-top: 4px; }

.capture {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 220px; margin: 22px 0 14px; padding: 20px;
  font: inherit; font-size: 1.35em; font-weight: 800; text-align: center; cursor: pointer;
  color: var(--on-indigo); background: var(--indigo); border: 0; border-radius: 28px;
  box-shadow: 0 8px 0 var(--indigo-deep), var(--shadow);
}
.capture:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--indigo-deep); }
.capture svg { width: 84px; height: 84px; }
.capture-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.easy-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.easy-links .btn { min-height: 64px; }

.amount-display { margin: 8px 0 14px; padding: 12px 16px; text-align: right; font-size: 2.8rem; font-weight: 800; background: var(--slip); border: 2px solid var(--rule-strong); border-radius: 14px; min-height: 80px; }
.amount-display.empty { color: var(--ink-3); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { min-height: 72px; font: inherit; font-size: 1.9rem; font-weight: 700; color: var(--ink); background: var(--slip); border: 2px solid var(--rule-strong); border-radius: 14px; cursor: pointer; }
.key:active { background: var(--indigo-soft); }
.key.alt { font-size: 1.1rem; color: var(--ink-2); }
.confirm-question { font-size: 1.5rem; font-weight: 800; line-height: 1.4; margin: 6px 0 4px; }
.confirm-amount { font-size: 3rem; font-weight: 800; margin: 0; }
.confirm-actions { display: grid; gap: 12px; margin-top: 18px; }
.thumb { width: 100%; max-height: 180px; object-fit: cover; border-radius: 8px; margin-top: 12px; border: 1px solid var(--rule); }

.hist-row { align-items: center; grid-template-columns: 76px 1fr auto; }
.hist-row img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rule); background: var(--rule); }
.hist-row .store { font-weight: 700; }
.hist-row .sub { font-size: 0.8em; color: var(--ink-3); }
.hist-row .fix { grid-column: 1 / -1; }
.empty-state { padding: 40px 12px; text-align: center; color: var(--ink-3); }
.queue-row.analyzing img { opacity: 0.55; }
.queue-row.analyzing .store { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .queue-row.analyzing .store { animation: none; } }

/* ==========================================================================
   詳細モード
   ========================================================================== */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--slip); border-bottom: 1px solid var(--rule); padding-top: env(safe-area-inset-top); }
.topbar-in { display: flex; align-items: center; gap: 22px; max-width: 1080px; margin: 0 auto; padding: 0 18px; min-height: 56px; }
.brand { font-weight: 800; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 14px; height: 18px; background: var(--indigo); border-top: 3px solid var(--shu); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { padding: 6px 12px; color: var(--ink-2); text-decoration: none; font-weight: 700; border-radius: 8px; }
.nav a:hover { background: var(--indigo-soft); }
.nav a[aria-current="page"] { color: var(--indigo); box-shadow: inset 0 -3px 0 var(--indigo); border-radius: 0; }

.page { max-width: 1080px; margin: 0 auto; padding: 24px 18px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; }
.section { margin-top: 36px; }
.section > h2, .grid-2 > section > h2 { font-size: 1.05rem; padding-bottom: 6px; margin-bottom: 14px; border-bottom: 2px solid var(--ink); }

.strip { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 3px double var(--ink); border-bottom: 1px solid var(--rule-strong); background: var(--slip); }
.strip > div { padding: 16px 18px; border-left: 1px solid var(--rule); }
.strip > div:first-child { border-left: 0; }
.strip dt { font-size: 0.85em; font-weight: 700; color: var(--ink-3); }
.strip dd { margin: 2px 0 0; font-size: clamp(1.4rem, 4.2vw, 2.1rem); font-weight: 800; }
.strip .in { color: var(--moss); }
.strip .neg { color: var(--shu); }
.notice { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 0; padding: 10px 14px; background: var(--shu-soft); border-left: 5px solid var(--shu); border-radius: 4px; font-weight: 700; }

.grid-2 { display: grid; gap: 28px; grid-template-columns: 1fr 1fr; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--ink-3); font-family: var(--font); font-size: 11px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.bar-exp { fill: var(--indigo); }
.bar-inc { fill: none; stroke: var(--moss); stroke-width: 2; }
.legend { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; font-size: 0.92em; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.donut-wrap { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 20px; align-items: center; }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--slip); }
.tbl th { text-align: left; font-size: 0.82em; color: var(--ink-3); padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tr.needs-review td:first-child { box-shadow: inset 4px 0 0 var(--shu); }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
/* 記録の表: 店名が長くても、ボタンを押し出さない（店名のほうを折り返す） */
#tx-table td.c-store { overflow-wrap: anywhere; }
#tx-table tr.deleted td { color: var(--ink-3); }
#tx-table td.c-actions { width: 1%; white-space: nowrap; }
#tx-table td.c-date, #tx-table td.c-cat, #tx-table td.c-amount, #tx-table td.c-status { white-space: nowrap; }
#tx-table td.c-actions .actions { flex-wrap: nowrap; }
.filters { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; margin-bottom: 14px; }
.filters .field { margin: 0; }
.export-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: flex-end; margin-bottom: 14px; }
.export-bar .hint { margin-right: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

.tabs { display: inline-flex; border-bottom: 2px solid var(--rule); margin-bottom: 18px; }
.tabs button { padding: 8px 18px; font: inherit; font-weight: 700; color: var(--ink-3); background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--indigo); border-bottom-color: var(--indigo); }
.dropzone { display: grid; place-items: center; gap: 6px; min-height: 160px; padding: 20px; text-align: center; border: 2px dashed var(--rule-strong); border-radius: 14px; background: var(--slip); cursor: pointer; }
.dropzone.drag { border-color: var(--indigo); background: var(--indigo-soft); }
.split { display: grid; gap: 24px; grid-template-columns: minmax(220px, 340px) 1fr; align-items: start; }
.preview { border-radius: 8px; border: 1px solid var(--rule); max-height: 520px; object-fit: contain; background: var(--slip); }
.notes { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 6px; }
.notes li { padding: 8px 12px; border-left: 4px solid var(--amber); background: var(--amber-soft); border-radius: 4px; font-size: 0.92em; }
.notes li.bad { border-left-color: var(--shu); background: var(--shu-soft); }
.items-edit { display: grid; gap: 6px; margin-bottom: 8px; }
.items-edit .row, .items-head { display: grid; grid-template-columns: 1fr 64px 120px 40px; gap: 6px; }
.items-head { margin-bottom: 2px; }
.timing { margin: 8px 0 0; font-size: 0.82em; color: var(--ink-3); }
.card-plain { background: var(--slip); border: 1px solid var(--rule); border-radius: 12px; padding: 18px; }
.settings-block { padding: 22px 0; border-top: 1px solid var(--rule-strong); }
.settings-block:first-of-type { border-top: 2px solid var(--ink); }
.settings-block > h2 { font-size: 1.05rem; margin-bottom: 12px; }
.cat-list { list-style: none; margin: 0 0 12px; padding: 0; }
.cat-list li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--rule); }
.cat-list .name { flex: 1; }

body.easy .settings-block, body.easy .field > label { font-size: 1em; }
body.easy input, body.easy select { min-height: 56px; font-size: 1em; }
body.easy .btn { min-height: 56px; }

.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-box { width: min(440px, 100%); }
.auth-box h1 { font-size: 1.7rem; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.auth-box h1::before { content: ""; width: 16px; height: 22px; background: var(--indigo); border-top: 4px solid var(--shu); }

@media (max-width: 760px) {
  .grid-2, .split, .donut-wrap { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 1fr; }
  .strip > div { border-left: 0; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: baseline; }
  .strip > div:first-child { border-top: 0; }
  .nav { display: none; }
  .page { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .tbl thead { display: none; }
  .tbl tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 4px; border-bottom: 1px solid var(--rule); }
  .tbl td { border: 0; padding: 0; }
  .tbl td.r { text-align: right; }
  .tbl .actions { grid-column: 1 / -1; justify-content: flex-start; margin-top: 6px; }
  /* 記録の表は、置き場所を決め打ちにする（店名が長くても、列の幅が変わらない） */
  #tx-table tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "date amount" "store store" "cat status" "actions actions"; }
  #tx-table td.c-date { grid-area: date; }
  #tx-table td.c-amount { grid-area: amount; }
  #tx-table td.c-store { grid-area: store; font-weight: 700; }
  #tx-table td.c-cat { grid-area: cat; }
  #tx-table td.c-status { grid-area: status; text-align: right; }
  #tx-table td.c-actions { grid-area: actions; width: auto; }
  #tx-table td.c-actions .actions { flex-wrap: wrap; justify-content: flex-start; margin-top: 6px; }
}
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--slip); border-top: 1px solid var(--rule-strong); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { padding: 12px 4px; text-align: center; font-size: 0.78rem; font-weight: 700; color: var(--ink-3); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--indigo); box-shadow: inset 0 3px 0 var(--indigo); }
}

@media (prefers-reduced-motion: reduce) {
  .stamp { animation: none; opacity: 0.92; }
  .busy-slip::after { animation: none; top: 50%; }
  .meter-fill { transition: none; }
  * { scroll-behavior: auto !important; }
}

/* ==========================================================================
   このアプリについて（/about）。ログインなしで見られる紹介。画面の例は、見本のデータ
   ========================================================================== */
body.about { font-size: 18px; }
.about-page { max-width: 920px; margin: 0 auto; padding: 28px 16px calc(48px + env(safe-area-inset-bottom)); }
.about-head { padding: 12px 0 26px; border-bottom: 2px solid var(--ink); }
.about-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink-2); }
.about-brand::before { content: ""; width: 14px; height: 20px; background: var(--indigo); border-top: 4px solid var(--shu); }
.about-head h1 { font-size: clamp(1.7rem, 6vw, 2.5rem); margin: 6px 0 14px; }
.about-lead { color: var(--ink-2); margin: 0; }
.about-sec { padding: 30px 0; border-bottom: 1px solid var(--rule-strong); }
.about-sec h2 { display: flex; align-items: center; gap: 12px; font-size: 1.4rem; margin-bottom: 16px; }
.about-no { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--indigo); color: var(--on-indigo); font-size: 1.05rem; flex: none; }
.about-care h2 { color: var(--indigo); }
.about-row { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.about-list, .about-steps { margin: 0 0 0.75em; padding-left: 1.3em; }
.about-list li, .about-steps li { margin-bottom: 0.4em; }
.about-steps { font-weight: 700; }
.about-cta { border-bottom: 0; }
.about-cta .btn { margin: 8px 0 10px; }
.about-back { margin-top: 22px; text-align: center; }

.mock { margin: 0; }
.mock figcaption { font-size: 0.75rem; color: var(--ink-3); text-align: center; margin-top: 6px; }
.mock-screen { background: var(--paper); border: 8px solid var(--ink); border-radius: 26px; padding: 18px 14px; font-size: 15px; line-height: 1.5; box-shadow: var(--shadow); }
.mock-easy { font-size: 17px; }
.mock-screen p { margin: 0 0 6px; }
.mock-q { font-size: 1.15em; font-weight: 800; }
.mock-store { font-weight: 700; color: var(--ink-2); }
.mock-big { font-size: 2.2em; font-weight: 800; line-height: 1.1; }
.mock-sub { font-size: 0.85em; color: var(--ink-3); }
.mock-btn { display: block; margin-top: 10px; padding: 10px; text-align: center; font-weight: 800; border-radius: 12px; background: var(--indigo); color: var(--on-indigo); border: 2px solid var(--indigo); }
.mock-btn-line { background: transparent; color: var(--indigo); }
.mock-label { font-weight: 700; color: var(--ink-2); }
.mock-hero { font-size: 2.6em; font-weight: 800; line-height: 1.05; }
.mock-hero span { font-size: 0.5em; }
.mock-meter { height: 12px; border-radius: 6px; background: var(--rule); overflow: hidden; margin: 10px 0 14px; }
.mock-meter span { display: block; width: 38%; height: 100%; background: var(--moss); }
.mock-capture { display: block; padding: 34px 10px; text-align: center; font-weight: 800; font-size: 1.1em; color: var(--on-indigo); background: var(--indigo); border-radius: 18px; box-shadow: 0 5px 0 var(--indigo-deep); }
.mock-title { font-weight: 800; font-size: 1.05em; }
.mock-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.mock-strip span { display: flex; flex-direction: column; font-size: 0.8em; color: var(--ink-3); background: var(--slip); border: 1px solid var(--rule); border-radius: 8px; padding: 6px 8px; }
.mock-strip b { font-size: 1.15em; color: var(--ink); }
.mock-notice { padding: 6px 8px; border-radius: 8px; background: var(--shu-soft); color: var(--shu); font-size: 0.9em; }
.mock-ledger { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.mock-ledger li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 2px; border-bottom: 1px solid var(--rule); font-size: 0.9em; }
.mock-ledger li > b { grid-column: 2; grid-row: 1; text-align: right; }
.mock-ledger .badge { font-size: 0.75em; }
.mock-ledger li > span:nth-child(2) { justify-self: start; }

@media (max-width: 760px) {
  .about-row { grid-template-columns: 1fr; }
  .mock { max-width: 320px; margin: 0 auto; width: 100%; }
}
