:root{
  color-scheme: light;
  --page:#f9f9f7; --surface:#fcfcfb; --card:#ffffff;
  --tp:#0b0b0b; --ts:#52514e; --muted:#898781;
  --grid:#e1e0d9; --baseline:#c3c2b7; --border:rgba(11,11,11,.10);
  --good:#0ca30c; --warn:#fab219;
  /* categorical slots — fixed order, never cycled (see palette.md) */
  --s1:#0a7cf0; --s2:#eb6834; --s3:#1baf7a; --s4:#eda100;
  --s5:#e87ba4; --s6:#008300; --s7:#4a3aa7; --s8:#e34948;
  --s1-wash:rgba(10,124,240,.10);
  /* brand chrome accent — konbini-flavored, used only in fixed structural
     chrome (header band, section chips, tile stripe), never in a legend or
     data context, so it can't be misread as a categorical (--s1..--s8) value */
  --brand:#067a34; --brand-wash:rgba(6,122,52,.12);
  --brand2:#0a66d1; --brand2-wash:rgba(10,102,209,.10);
  --display-font:"Zen Kaku Gothic New",system-ui,-apple-system,"Hiragino Kaku Gothic ProN","Noto Sans JP",sans-serif;
}
@media (prefers-color-scheme: dark){
  :root:where(:not([data-theme="light"])){
    color-scheme: dark;
    --page:#0d0d0d; --surface:#1a1a19; --card:#1f1f1e;
    --tp:#ffffff; --ts:#c3c2b7; --muted:#898781;
    --grid:#2c2c2a; --baseline:#383835; --border:rgba(255,255,255,.10);
    --good:#0ca30c;
    --s1:#3d9bff; --s2:#d95926; --s3:#199e70; --s4:#c98500;
    --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767;
    --s1-wash:rgba(61,155,255,.14);
    --brand:#2fd06a; --brand-wash:rgba(47,208,106,.16);
    --brand2:#5caeff; --brand2-wash:rgba(92,174,255,.16);
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --page:#0d0d0d; --surface:#1a1a19; --card:#1f1f1e;
  --tp:#ffffff; --ts:#c3c2b7; --muted:#898781;
  --grid:#2c2c2a; --baseline:#383835; --border:rgba(255,255,255,.10);
  --good:#0ca30c;
  --s1:#3d9bff; --s2:#d95926; --s3:#199e70; --s4:#c98500;
  --s5:#d55181; --s6:#008300; --s7:#9085e9; --s8:#e66767;
  --s1-wash:rgba(61,155,255,.14);
  --brand:#2fd06a; --brand-wash:rgba(47,208,106,.16);
  --brand2:#5caeff; --brand2-wash:rgba(92,174,255,.16);
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--page); color:var(--tp);
  font-family:system-ui,-apple-system,"Segoe UI","Hiragino Kaku Gothic ProN","Noto Sans JP",sans-serif;
  -webkit-font-smoothing:antialiased; line-height:1.5;
  padding:max(14px,env(safe-area-inset-top)) 14px calc(40px + env(safe-area-inset-bottom));}
.wrap{max-width:820px; margin:0 auto;}
header{margin-bottom:16px;}
.topbar{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px;}
.brand{display:flex; align-items:center; gap:10px; min-width:0;}
.logo{flex:none; width:38px; height:38px; border-radius:11px; display:grid; place-items:center;
  background:linear-gradient(135deg,var(--brand),var(--brand2)); box-shadow:0 4px 14px var(--brand-wash);
  transform:rotate(-6deg);}
.logo svg{width:22px; height:22px; display:block;}
/* the site name lives in the top bar; the hero headline is the page's real title */
h1.wordmark{font-family:var(--display-font); font-size:16px; font-weight:900; margin:0; letter-spacing:.3px; line-height:1.3;
  word-break:keep-all; overflow-wrap:anywhere;}
.hbtns{display:flex; gap:4px; padding:4px; border-radius:13px; background:var(--card); border:1px solid var(--border); flex:none;}
.ibtn{width:34px; height:34px; border-radius:9px; display:grid; place-items:center; background:transparent;
  color:var(--ts); border:none; cursor:pointer; text-decoration:none; padding:0;}
.ibtn svg{width:18px; height:18px; display:block;}
.ibtn:hover{background:var(--brand-wash); color:var(--brand);}
.ibtn:focus-visible{outline:2px solid var(--brand); outline-offset:1px;}
.ibtn:disabled{cursor:default;}
.card{background:var(--card); border:1px solid var(--border); border-radius:16px; padding:16px; margin-bottom:12px;}
.tiles{display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:12px;}
.tile{background:var(--card); border:1px solid var(--border); border-radius:14px; padding:14px 12px 13px; position:relative; overflow:hidden;}
.tile::before{content:""; position:absolute; top:0; left:0; right:0; height:3px; background:linear-gradient(90deg,var(--brand),var(--brand2));}
.tile .k{font-size:11.5px; color:var(--muted);}
.tile .v{font-family:var(--display-font); font-size:21px; font-weight:900; margin-top:5px; letter-spacing:-.3px;}
.tile .d{font-size:11px; color:var(--ts); margin-top:2px;}
h2{display:inline-block; font-family:var(--display-font); font-size:12.5px; font-weight:900; color:var(--brand);
  background:var(--brand-wash); margin:2px 0 14px; letter-spacing:.3px; padding:5px 12px 6px; border-radius:999px;}
h2.b{color:var(--brand2); background:var(--brand2-wash);}
h3{font-size:11.5px; font-weight:650; color:var(--muted); margin:16px 0 8px; letter-spacing:.2px;}
h3:first-of-type{margin-top:2px;}
.note{font-size:11.5px; color:var(--muted); margin:-4px 0 12px; line-height:1.6;}
.barrow{display:grid; grid-template-columns:128px 1fr auto; align-items:center; gap:10px; margin:9px 0; font-size:13px;}
.barrow .lbl{color:var(--ts); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.track{position:relative; height:16px; background:var(--grid); border-radius:8px; overflow:hidden;}
.fill{position:absolute; left:0; top:0; bottom:0; border-radius:8px; background:var(--s1); min-width:3px;}
.barrow .num{color:var(--tp); font-size:12.5px; min-width:38px; text-align:right;}
.empty{color:var(--muted); font-size:12.5px; padding:8px 0;}
.legend{display:flex; gap:14px; align-items:center; font-size:12px; color:var(--ts); margin:0 0 10px; flex-wrap:wrap;}
.legend .lkey{display:inline-flex; align-items:center; gap:5px; cursor:default;}
.legend .line{display:inline-block; width:14px; height:2px; border-radius:1px;}
.legend .swatch{display:inline-block; width:10px; height:10px; border-radius:2px;}
.chart-wrap{width:100%; overflow-x:auto;}
.toplist{margin-top:6px; display:flex; flex-direction:column; gap:4px;}
.toprow{display:flex; align-items:center; justify-content:space-between; font-size:11.5px; color:var(--ts); gap:8px;}
.toprow .name{display:flex; align-items:center; gap:5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.toprow .swatch{display:inline-block; width:8px; height:8px; border-radius:2px; flex:none;}
svg.chart{width:100%; height:auto; display:block; font-family:inherit;}
svg.chart text{fill:var(--muted); font-size:12.5px;}
svg.chart .gridline{stroke:var(--grid); stroke-width:1;}
svg.chart .baseline{stroke:var(--baseline); stroke-width:1;}
svg.chart .pt{cursor:pointer;}
svg.chart .endlabel{font-weight:800; font-size:22px; fill:var(--ts);}
.tag{display:inline-block; font-size:10.5px; padding:1px 7px; border-radius:999px; border:1px solid var(--border); color:var(--ts);}
.cardlist{display:none;}
.xcard{border:1px solid var(--border); border-radius:12px; background:var(--surface); padding:11px 13px; margin-bottom:9px;}
.xc-top{display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:7px;}
.xc-date{font-size:11.5px; color:var(--muted);}
.xc-body{display:flex; justify-content:space-between; align-items:flex-start; gap:12px;}
.xc-title{font-size:14px; color:var(--tp); font-weight:600; line-height:1.35;}
.xc-payee{font-size:12px; color:var(--ts); margin-top:2px; word-break:break-word; line-height:1.4;}
.xc-amt{font-size:16px; font-weight:650; color:var(--tp); white-space:nowrap;}
.foot{color:var(--muted); font-size:11px; text-align:center; margin-top:18px; line-height:1.6;}
.tipbox{position:fixed; pointer-events:none; z-index:50; background:var(--tp); color:var(--page);
  padding:6px 9px; border-radius:8px; font-size:12px; opacity:0; transition:opacity .08s; white-space:nowrap;
  box-shadow:0 4px 14px rgba(0,0,0,.25);}

/* ---------- public site ---------- */
a{color:var(--brand);}
.hero{position:relative; overflow:hidden; border-radius:20px; padding:26px 20px 22px; margin-bottom:12px;
  background:linear-gradient(135deg,var(--brand-wash),var(--brand2-wash)); border:1px solid var(--border);}
.hero .kicker{display:inline-block; font-size:11.5px; font-weight:700; color:var(--brand); background:var(--card);
  border:1px solid var(--border); padding:3px 10px; border-radius:999px; margin-bottom:12px;}
.hero h2.big{display:block; background:none; padding:0; margin:0 0 10px; color:var(--tp);
  font-size:clamp(24px,6.4vw,34px); line-height:1.3; letter-spacing:0;}
.hero h2.big em{font-style:normal; background:linear-gradient(135deg,var(--brand),var(--brand2));
  -webkit-background-clip:text; background-clip:text; color:transparent;}
.counter{display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; margin-top:18px;}
.counter .n{font-family:var(--display-font); font-weight:900; font-size:clamp(44px,13vw,64px); line-height:1;
  letter-spacing:-1px; font-variant-numeric:tabular-nums;}
.counter .u{font-size:13px; color:var(--ts); font-weight:600;}
.status{display:inline-flex; align-items:center; gap:7px; margin-top:14px; padding:4px 11px 4px 9px; border-radius:999px;
  background:var(--card); border:1px solid var(--border); font-size:12px; color:var(--ts);}
.status .dot{width:7px; height:7px; border-radius:50%; background:var(--muted); flex:none;}
.status[data-kind="live"] .dot{background:var(--good); animation:pulse 2s ease-out infinite;}
.status[data-kind="err"] .dot{background:var(--warn);}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(12,163,12,.55);} 70%,100%{box-shadow:0 0 0 7px rgba(12,163,12,0);}}

.cta{border-radius:16px; padding:18px 16px; margin-bottom:12px; text-align:center;
  background:var(--tp); color:var(--page);}
.cta b{display:block; font-family:var(--display-font); font-size:18px; margin-bottom:4px;}
.cta span{font-size:12.5px; opacity:.8;}
.share{display:flex; gap:8px; justify-content:center; margin-top:12px; flex-wrap:wrap;}
.share a,.share button{display:inline-flex; align-items:center; gap:6px; padding:8px 14px; border-radius:999px;
  border:none; font:inherit; font-size:13px; font-weight:700; cursor:pointer; text-decoration:none;
  background:var(--page); color:var(--tp);}
.share svg{width:15px; height:15px;}

.grid2{display:grid; grid-template-columns:1fr 1fr; gap:0 22px;}
.foot a{color:var(--muted);}

@media (max-width:640px){
  .grid2{grid-template-columns:1fr;}
}
@media (prefers-reduced-motion:reduce){ .status .dot{animation:none !important;} }
@media (max-width:520px){ .barrow{grid-template-columns:100px 1fr auto;} }
@media (max-width:520px){ .tiles{grid-template-columns:1fr 1fr;} }

/* ---------- hero receipt illustration (same motif as og.png) ---------- */
.hero > *:not(.hero-receipt){position:relative; z-index:1;}
.hero-receipt{position:absolute; z-index:0; right:40px; top:30px; width:170px; padding:22px 18px 16px;
  background:#fcfcfb; border:2px solid #e1e0d9; border-bottom:none; border-radius:3px 3px 0 0;
  transform:rotate(9deg); box-shadow:0 14px 30px rgba(11,11,11,.10);}
.hero-receipt::after{content:""; position:absolute; left:-2px; right:-2px; bottom:-12px; height:12px;
  background:linear-gradient(135deg,#fcfcfb 50%,transparent 50%) 0 0/16px 12px,
             linear-gradient(-135deg,#fcfcfb 50%,transparent 50%) 0 0/16px 12px;}
.hero-receipt i{display:block; height:9px; border-radius:5px; background:#e1e0d9; margin-bottom:13px;}
.hero-receipt i.accent{background:#0a66d1; opacity:.5; margin-bottom:6px;}
@media (min-width:641px){ .hero h2.big{max-width:470px;} }
@media (max-width:640px){
  /* sits in the empty space right of the big counter, clear of the headline */
  .hero-receipt{top:auto; right:22px; bottom:26px; width:96px; padding:13px 11px 8px; transform:rotate(8deg);}
  .hero-receipt i{height:6px; margin-bottom:8px;}
  .hero-receipt::after{bottom:-8px; height:8px; background-size:10px 8px;}
  .hero .counter{max-width:calc(100% - 110px);}
  .hero .counter .u{white-space:nowrap; font-size:12px;}
}
[hidden]{display:none !important;}

/* ---------- payment: one receipt icon per receipt ---------- */
.units{display:grid; gap:10px;}
.urow{display:grid; grid-template-columns:104px 1fr auto; align-items:center; gap:10px;}
.urow .name{font-size:13px; color:var(--ts); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.urow .n{font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap;}
.urow .n small{color:var(--muted); font-weight:400; margin-left:4px;}
.icons{display:flex; flex-wrap:wrap; gap:4px;}
.icons svg{width:20px; height:26px; display:block;}
.scale{font-size:11.5px; color:var(--muted); margin-top:8px;}
@media (max-width:520px){ .urow{grid-template-columns:84px 1fr auto;} .icons svg{width:16px; height:21px;} }
