:root {
  --bg: #0b0b12; --bg2: #13131d; --card: #1a1a27; --card2: #222233; --line: #2c2c40;
  --text: #f3f3f8; --muted: #9a9ab3; --accent: #8b5cf6; --accent-ink: #fff;
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --pink: #ec4899;
  --r: 14px; --shadow: 0 10px 30px rgba(0,0,0,.35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.wrap { max-width: 680px; margin: 0 auto; padding: 16px; }
.wide { max-width: 1200px; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap-ok { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; } .right { margin-left: auto; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.tight { padding: 12px; }
.hidden { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

button, .btn { appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: 600 .95rem var(--font);
  padding: 10px 14px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; text-decoration: none; }
button:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-ok { background: var(--ok); border-color: transparent; color: #04120a; }
.btn-bad { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 18px; font-size: 1.05rem; min-height: 52px; width: 100%; border-radius: 12px; }
.btn-sm { padding: 6px 10px; min-height: 34px; font-size: .85rem; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--card2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.chip.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.chip.money { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); border-color: transparent; font-size: .8rem; }

label { display: block; font-weight: 600; font-size: .85rem; margin: 0 0 4px; color: var(--muted); }
input, textarea, select { width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 11px 12px; font: 1rem var(--font); }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 12px; }
.check { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check .lbl { font-weight: 600; } .check .hint { color: var(--muted); font-size: .8rem; font-weight: 400; }

/* Toggle switch */
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; transition: .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 22px; height: 22px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(20px); }

.tabs { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); padding: 4px; border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1; border: 0; background: transparent; min-height: 36px; padding: 6px 10px; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--card2); color: var(--text); }
.tabs .count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 6px; font-size: .72rem; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #fff; color: #111; padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); z-index: 1000; max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px 20px 0 0; width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 20px; } }

.art { width: 52px; height: 52px; border-radius: 8px; background: var(--card2) center/cover; flex: none; display: grid; place-items: center; color: var(--muted); font-size: 1.3rem; }
.art.lg { width: 72px; height: 72px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.list-item + .list-item { margin-top: 8px; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
.stat .n { font-size: 1.6rem; font-weight: 800; } .stat .l { color: var(--muted); font-size: .8rem; }
.banner { background: var(--warn); color: #1a1100; padding: 8px 16px; font-weight: 700; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.banner button { min-height: 30px; padding: 4px 10px; background: #1a1100; color: #fff; border: 0; }
