
:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1d2330; --muted: #667085; --line: #e3e6ec;
  --accent: #b54708; --ok: #067647; --warn: #b54708; --ng: #b42318;
  --ok-bg: #ecfdf3; --warn-bg: #fffaeb; --ng-bg: #fef3f2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --card: #1b2029; --text: #e6e9ef; --muted: #98a2b3; --line: #2c333f;
    --accent: #f79009; --ok: #47cd89; --warn: #fdb022; --ng: #f97066;
    --ok-bg: #0b2a1c; --warn-bg: #2e2208; --ng-bg: #2f1412;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; }
header { background: var(--card); border-bottom: 1px solid var(--line); }
.bar { max-width: 640px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.brand { font-weight: 700; margin-right: auto; color: var(--text); text-decoration: none; }
nav a { color: var(--muted); text-decoration: none; padding: 4px 2px; }
nav a.on { color: var(--text); border-bottom: 2px solid var(--accent); }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; margin: 8px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.balance { text-align: center; padding: 24px 16px; }
.balance .value { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance .unit { font-size: 18px; color: var(--muted); margin-left: 4px; }
.balance .sub { color: var(--muted); font-size: 14px; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.big-actions a { display: block; text-align: center; padding: 14px; border-radius: 12px; font-weight: 700;
  text-decoration: none; background: var(--accent); color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-ng { background: var(--ng-bg); color: var(--ng); }
.b-muted { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
ul.hist { list-style: none; padding: 0; margin: 0; }
ul.hist li { border-bottom: 1px solid var(--line); }
ul.hist li:last-child { border-bottom: 0; }
ul.hist a { display: flex; gap: 12px; align-items: center; padding: 10px 0; color: var(--text); text-decoration: none; }
ul.hist .desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.hist .when { color: var(--muted); font-size: 13px; }
ul.hist .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.amt.in { color: var(--ok); }
.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--line); }
.flash.ok { background: var(--ok-bg); } .flash.ng { background: var(--ng-bg); } .flash.warn { background: var(--warn-bg); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
a { color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; margin-top: 2px; }
.err { color: var(--ng); font-size: 13px; margin-top: 2px; }
input[type=text], input[type=password], input[type=number], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; }
textarea { min-height: 96px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
button { font: inherit; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
button.wide { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }
.mt { margin-top: 16px; }
.center { text-align: center; }
.qr { background: #fff; padding: 12px; border-radius: 12px; max-width: 320px; margin: 0 auto 12px; }
.qr svg { display: block; width: 100%; height: auto; }
.done { font-size: 22px; font-weight: 700; color: var(--ok); text-align: center; margin: 12px 0; }
.amount-big { font-size: 28px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
ol.words { columns: 2; padding-left: 28px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; }
ol.words li { margin: 2px 0; }
.login { max-width: 380px; margin: 8vh auto; }
.scan-view video { display: block; width: 100%; max-height: 60vh; border-radius: 12px; background: #000; object-fit: cover; }
#scan-msg { margin-top: 10px; }
