:root {
  --bg: #0f0f14;
  --panel: #181820;
  --panel2: #20202a;
  --line: #2c2c38;
  --text: #ececf1;
  --muted: #8b8b9a;
  --accent: #e8457c;
  --accent2: #ff7aa2;
  --ok: #3ecf8e;
  --warn: #f5b74a;
  --err: #ff5d5d;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--err); min-height: 1em; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { margin: 0 0 10px; font-weight: 600; }
h2 { font-size: 16px; }
h3 { font-size: 14px; margin: 0; }
.mt { margin-top: 16px; }

input, select { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
label input, label select { margin-top: 4px; }
label small { display: block; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; margin: 0; }
.check input { width: auto; margin: 0; }
.checks { display: flex; flex-direction: column; gap: 6px; justify-content: center; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 12px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.narrow { max-width: 620px; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.span2 { grid-column: span 2; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 340px; }
.login input { margin-bottom: 12px; }
.login .btn { width: 100%; }

.topbar { display: flex; align-items: center; gap: 20px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--accent2); }
.brand .muted { font-weight: 400; margin-left: 6px; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs button { background: none; border: none; color: var(--muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.tabs button.active { background: var(--panel2); color: var(--text); }
main { padding: 24px; max-width: 1100px; margin: 0 auto; }
main section > * + * { margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }

.status-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }

.copyrow { display: flex; gap: 8px; }
.copyrow input { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.items { display: grid; gap: 10px; }
.item { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.item.off { opacity: .5; }
.item .emoji { font-size: 22px; width: 30px; text-align: center; }
.item .info { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 12px; }
.item .price { font-weight: 700; color: var(--accent2); font-variant-numeric: tabular-nums; }
.tag { display: inline-block; background: var(--panel2); border-radius: 4px; padding: 0 6px; margin-right: 4px; font-size: 11px; color: var(--muted); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
#add-action { width: auto; }
.action { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 10px; }
.action .row { gap: 10px; align-items: flex-end; }
.action label { margin: 0; flex: 1; }
.action .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; font-size: 13px; }
.action .remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }

.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; }
.badge { padding: 1px 8px; border-radius: 10px; font-size: 11px; background: var(--panel2); }
.badge.paid { background: rgba(62,207,142,.15); color: var(--ok); }
.badge.confirming { background: rgba(245,183,74,.15); color: var(--warn); }
.badge.pending { color: var(--muted); }
.badge.failed, .badge.expired { color: var(--err); background: rgba(255,93,93,.1); }
a { color: var(--accent2); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--panel2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 8px; transition: transform .25s; z-index: 10; }
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  main { padding: 16px; }
  .topbar { padding: 10px 16px; }
}
