:root {
  --bg: #f6f7fb; --card: #fff; --fg: #1c1b29; --muted: #5d5d70; --line: #e2e3ee;
  --brand: #3730a3; --brand-soft: #e7e6fb; --gold: #f5b301;
  --in: #15803d; --out: #b91c1c; --trial: #b45309; --free: #3730a3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12121a; --card: #1c1c27; --fg: #ececf3; --muted: #a3a3b5; --line: #2e2e3d;
    --brand: #a5a1ff; --brand-soft: #2a2850; --in: #4ade80; --out: #f87171; --trial: #fbbf24; --free: #a5a1ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.bar { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: var(--gold); display: grid; place-items: center; font-size: 16px; }
nav { display: flex; gap: 4px; flex: 1; }
nav a { padding: 6px 12px; border-radius: 20px; color: var(--muted); text-decoration: none; font-weight: 600; }
nav a.on { background: var(--brand-soft); color: var(--brand); }
main { max-width: 1000px; margin: 0 auto; padding: 16px 16px calc(48px + env(safe-area-inset-bottom)); }
h2 { font-size: 17px; margin: 24px 4px 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.green { color: var(--in); } .red { color: var(--out); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { text-decoration: none; border: 1px solid var(--line); background: var(--card); color: var(--fg); padding: 6px 12px; border-radius: 20px; font: inherit; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.paid { color: var(--in); background: color-mix(in srgb, var(--in) 12%, transparent); }
.pill.ended { color: var(--out); background: color-mix(in srgb, var(--out) 12%, transparent); }
.pill.trial { color: var(--trial); background: color-mix(in srgb, var(--trial) 14%, transparent); }
.pill.free { color: var(--free); background: color-mix(in srgb, var(--free) 12%, transparent); }
.search { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: var(--card); color: var(--fg); }
.list { display: grid; gap: 8px; margin-top: 12px; }
.shop { display: block; text-decoration: none; color: inherit; }
.shop .top { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.shop .name { font-weight: 600; overflow-wrap: anywhere; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
button, .btn { font: inherit; font-weight: 600; border-radius: 22px; padding: 10px 18px; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--brand); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.danger { color: var(--out); }
button.link { border: 0; background: none; padding: 8px; color: var(--brand); white-space: nowrap; }
button:disabled { opacity: .5; cursor: default; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin-top: 8px; }
.bars div { flex: 1; border-radius: 3px; background: color-mix(in srgb, var(--muted) 25%, transparent); min-height: 4px; }
.bars div.on { background: var(--in); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--fg); width: min(420px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog h3 { margin: 0 0 4px; }
dialog label { display: grid; gap: 4px; margin: 12px 0; font-size: 14px; color: var(--muted); }
dialog input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; }
.login { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.login .logo { width: 56px; height: 56px; font-size: 30px; border-radius: 16px; margin: 0 auto 12px; }
#gbtn { display: flex; justify-content: center; margin: 20px 0; min-height: 44px; }
.dev input { padding: 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; width: 100%; margin: 8px 0; }
@media (max-width: 520px) {
  .hide-sm { display: none; }
  .bar { gap: 6px; padding: 8px 12px; }
  header .brand .txt { display: none; }
  nav a { padding: 6px 10px; }
}
body { overflow-x: hidden; }
