:root {
  --bg: #f4f4f5; --card: #ffffff; --ink: #0b0b0c; --muted: #6b6d75; --line: #e4e4e7;
  --soft: #f0f0f2; --accent: #0b0b0c; --accent-ink: #fff;
  --green: #16a34a; --green-bg: #dcfce7; --red: #dc2626; --red-bg: #fee2e2; --amber: #b45309; --amber-bg: #fef3c7;
  --blue: #2563eb; --blue-bg: #dbeafe; --wa: #25d366;
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #161618; --ink: #f4f4f5; --muted: #9a9ca5; --line: #2a2a2e; --soft: #212124;
    --accent: #f4f4f5; --accent-ink: #0b0b0c;
    --green: #4ade80; --green-bg: #12301d; --red: #f87171; --red-bg: #3a1414; --amber: #fbbf24; --amber-bg: #3a2a0a;
    --blue: #60a5fa; --blue-bg: #13233f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.top h1 { flex: 1; margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { border: 0; background: none; font-size: 34px; line-height: 1; padding: 0 6px 4px 0; cursor: pointer; }
.top-actions { display: flex; gap: 6px; }
.icon-btn { border: 0; background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 600; cursor: pointer; }

main { padding: 4px 16px calc(var(--safe-b) + 96px); max-width: 720px; margin: 0 auto; }
.loading, .empty { color: var(--muted); text-align: center; padding: 40px 10px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-around;
  padding: 6px 4px calc(var(--safe-b) + 6px); background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 0; }
.tabs a .ico { font-size: 21px; line-height: 1.1; }
.tabs a.on { color: var(--ink); }

.fab { position: fixed; right: 18px; bottom: calc(var(--safe-b) + 76px); z-index: 25; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 30px; line-height: 1; box-shadow: 0 6px 20px rgba(0,0,0,.25); cursor: pointer; }

.card { background: var(--card); border-radius: 16px; padding: 14px 16px; margin: 0 0 12px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 a, .card h2 button { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--blue); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; font-weight: 600; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 4px 8px; display: flex; justify-content: space-between; }

.hero-stat { display: flex; align-items: center; gap: 14px; }
.hero-stat .big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: pulse 2s infinite; flex: none; }
.pulse.red { background: var(--red); box-shadow: 0 0 0 0 var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 0%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.mini { background: var(--card); border-radius: 16px; padding: 12px 14px; text-decoration: none; display: block; }
.mini b { display: block; font-size: 26px; font-weight: 800; }
.mini span { color: var(--muted); font-size: 13px; }

.list { background: var(--card); border-radius: 16px; overflow: hidden; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; border-bottom: 1px solid var(--line); min-height: 52px; }
.row:last-child { border-bottom: 0; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { color: var(--muted); font-size: 20px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.up { background: var(--green); } .dot.down { background: var(--red); } .dot.none { background: transparent; border: 2px solid var(--line); }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.live, .pill.paying, .pill.up, .pill.sent { background: var(--green-bg); color: var(--green); }
.pill.suspended, .pill.ghosting, .pill.down, .pill.lost { background: var(--red-bg); color: var(--red); }
.pill.awaiting, .pill.waiting, .pill.hold, .pill.draft { background: var(--amber-bg); color: var(--amber); }
.pill.building, .pill.pitch, .pill.own { background: var(--blue-bg); color: var(--blue); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }

.search { width: 100%; border: 0; background: var(--card); border-radius: 12px; padding: 11px 14px; margin-bottom: 10px; font-size: 16px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 0; background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; cursor: pointer; background: var(--soft); text-decoration: none; font-size: 15px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.wa { background: var(--wa); color: #fff; }
.btn.danger { background: var(--red-bg); color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.actions .btn { flex-direction: column; gap: 2px; padding: 10px 4px; font-size: 12px; background: var(--card); }
.actions .btn .ico { font-size: 20px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
input.i, select.i, textarea.i { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 16px; }
textarea.i { min-height: 90px; resize: vertical; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.toggle input { width: 46px; height: 28px; appearance: none; -webkit-appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; flex: none; transition: background .2s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle input:checked { background: var(--green); }
.toggle input:checked::after { transform: translateX(18px); }
.seg { display: flex; background: var(--soft); border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 4px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.err { color: var(--red); font-size: 14px; margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.note { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.note:last-child { border-bottom: 0; }
.note .body { flex: 1; min-width: 0; white-space: pre-wrap; word-wrap: break-word; }
.note .meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.note.done .body { text-decoration: line-through; color: var(--muted); }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); background: none; flex: none; cursor: pointer; margin-top: 1px; display: grid; place-items: center; font-size: 14px; color: #fff; }
.check.on { background: var(--green); border-color: var(--green); }
.kind-ico { width: 24px; text-align: center; flex: none; }
.more { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 4px; }

.bars { display: flex; gap: 2px; height: 22px; align-items: flex-end; margin-top: 6px; }
.bars i { flex: 1; border-radius: 2px; background: var(--line); height: 100%; }
.bars i.g { background: var(--green); } .bars i.r { background: var(--red); } .bars i.a { background: var(--amber); }
.site { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.site:last-child { border-bottom: 0; }
.site .head { display: flex; align-items: center; gap: 10px; }
.site .head .main { flex: 1; min-width: 0; }
.site .stats { display: flex; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
.site .err-line { color: var(--red); font-size: 13px; margin-top: 4px; }

.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 720px; border-radius: 20px 20px 0 0; padding: 18px 16px calc(var(--safe-b) + 18px); max-height: 92vh; overflow-y: auto; animation: up .22s ease-out; }
.sheet h3 { margin: 0 0 14px; font-size: 20px; display: flex; justify-content: space-between; align-items: center; }
.sheet h3 button { border: 0; background: var(--soft); border-radius: 999px; width: 30px; height: 30px; cursor: pointer; font-size: 16px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 140px); z-index: 60; background: var(--accent); color: var(--accent-ink);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; text-align: center; }

.auth { max-width: 380px; margin: 8vh auto 0; }
.brand { font-size: 40px; font-weight: 900; letter-spacing: -.04em; margin-bottom: 4px; }
.brand small { display: block; font-size: 12px; letter-spacing: .5em; font-weight: 600; color: var(--muted); }

.scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.scores div b { display: block; font-size: 24px; font-weight: 800; }
.scores div span { font-size: 11px; color: var(--muted); }
.good { color: var(--green); } .ok { color: var(--amber); } .bad { color: var(--red); }
.checklist { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.checklist li { padding: 4px 0; display: flex; gap: 8px; }
.wa-preview { background: #dcf8c6; color: #111; border-radius: 12px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; word-wrap: break-word; }
@media (prefers-color-scheme: dark) { .wa-preview { background: #005c4b; color: #e9edef; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; word-break: break-word; }
