:root {
  --bg: #090b0e;
  --panel: #10141a;
  --panel-2: #151a21;
  --line: #222a33;
  --line-2: #2c3540;
  --text: #e8edf2;
  --muted: #8a96a3;
  --faint: #5b6672;
  --accent: #b8ff3c;
  --accent-ink: #0d1400;
  --good: #3ddc84;
  --warn: #ffb020;
  --bad: #ff5468;
  --tiktok: #25f4ee;
  --instagram: #ff4f8b;
  --youtube: #ff3b30;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; align-content: start; }
.spacer { flex: 1; }

/* ── layout ─────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 18px 12px; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; background: #0b0e12;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; letter-spacing: 0.02em; font-size: 16px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--muted); font-weight: 600;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--faint); }
.side-goal { padding: 12px 10px; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.side-goal .v { font-size: 18px; font-weight: 800; }

main { padding: 26px clamp(16px, 3vw, 36px) 80px; min-width: 0; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head > .grow { flex: 1 1 280px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ── surfaces ───────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.card h2 .row { display: inline-flex; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-4 .tile { padding: 12px; }
.grid-4 .tile .v { font-size: 19px; overflow-wrap: anywhere; }

.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 600; }
.tile .v { font-size: 22px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--faint); font-size: 12px; margin-top: 2px; }
.tile.alert { border-color: rgba(255, 84, 104, 0.45); }
.tile.money .v { color: var(--accent); }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; padding: 22px 24px; position: relative; overflow: hidden; }
.hero::after {
  content: ''; position: absolute; inset: auto -10% -60% 40%; height: 220px;
  background: radial-gradient(closest-side, rgba(184, 255, 60, 0.12), transparent); pointer-events: none;
}
.hero .label { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.hero .big { font-size: clamp(44px, 7vw, 76px); font-weight: 900; letter-spacing: -0.03em; line-height: 1; margin: 8px 0 14px; font-variant-numeric: tabular-nums; }
.hero .big small { font-size: 0.32em; color: var(--muted); font-weight: 700; letter-spacing: 0; margin-left: 8px; }
.progress { height: 12px; border-radius: 99px; background: #1a2028; overflow: hidden; position: relative; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #7bdc1f, var(--accent)); border-radius: inherit; transition: width 0.6s ease; }
.progress.thin { height: 6px; }
.progress .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: 0.55; }
.hero-side { display: grid; gap: 10px; text-align: right; min-width: 170px; }
.hero-side .k { color: var(--muted); font-size: 12px; }
.hero-side .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* main earnings / views panel */
.ep { padding: 22px 24px; }
.ep-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.ep-label { color: var(--muted); margin-top: 16px; font-weight: 600; }
.ep-total { font-size: clamp(34px, 5vw, 50px); font-weight: 900; letter-spacing: -0.025em; line-height: 1.15; }
.ep-delta { padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 800; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.ep-delta.up { background: rgba(184, 255, 60, 0.13); color: var(--accent); }
.ep-delta.down { background: rgba(255, 84, 104, 0.13); color: var(--bad); }
.ep-range-wrap { position: relative; }
.ep-range button { min-width: 44px; }
.seg button.on { box-shadow: inset 0 -2px 0 var(--accent); }
.ep-custom { position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; width: min(340px, calc(100vw - 48px)); background: var(--panel-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.ep-plot { position: relative; height: clamp(220px, 34vw, 340px); touch-action: pan-y; cursor: crosshair; }
.ep-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.ep-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ep-base { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ep-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ep-line-prev { fill: none; stroke: var(--accent); stroke-opacity: 0.28; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ep-dot-prev { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #5d7a2c; pointer-events: none; }
.ep-legend { display: inline-flex; gap: 14px; white-space: nowrap; }
.ep-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ep-legend i { width: 14px; height: 3px; border-radius: 2px; background: var(--accent); }
.ep-legend i.prev { opacity: 0.28; }
.ep-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--panel); border: 3px solid var(--accent); box-shadow: 0 0 0 5px rgba(184, 255, 60, 0.2); pointer-events: none; }
.ep-tip { position: absolute; transform: translate(-50%, 16px); padding: 9px 14px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); text-align: center; white-space: nowrap; pointer-events: none; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); z-index: 5; }
.ep-tip b { display: block; margin-top: 2px; color: var(--accent); }

/* chart */
.chart { width: 100%; height: 220px; display: block; }
.chart .bar { fill: #2a3540; }
.chart .bar.hit { fill: var(--accent); }
.chart .bar.today { fill: #7bdc1f; }
.chart .goal { stroke: var(--accent); stroke-dasharray: 4 4; stroke-width: 1; opacity: 0.6; }
.chart text { fill: var(--faint); font-size: 12px; font-family: var(--sans); }
.chart .tip { fill: var(--text); font-weight: 700; }
.chart .goal-label { fill: var(--accent); font-weight: 700; stroke: var(--panel); stroke-width: 4px; paint-order: stroke; }
.chart-wrap { overflow-x: auto; }

.split-bars { display: grid; gap: 12px; }
.split-bars .line { display: grid; grid-template-columns: 90px 1fr 76px; gap: 10px; align-items: center; }

/* ── platform & status chips ────────────────────────── */
.pf { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.pf::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pf.tiktok { color: var(--tiktok); }
.pf.instagram { color: var(--instagram); }
.pf.youtube { color: var(--youtube); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700;
  border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em;
}
.chip.good { color: var(--good); border-color: rgba(61, 220, 132, 0.35); }
.chip.warn { color: var(--warn); border-color: rgba(255, 176, 32, 0.35); }
.chip.bad { color: var(--bad); border-color: rgba(255, 84, 104, 0.4); }
.chip.live { color: var(--accent); border-color: rgba(184, 255, 60, 0.35); }
.chip.info { color: #6cb6ff; border-color: rgba(108, 182, 255, 0.35); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.spin { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── tables & lists ─────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
.cell-title { max-width: 340px; }
.cell-title .t { font-weight: 600; }
.cell-title .c { color: var(--muted); font-size: 12px; }
.err { color: var(--bad); font-size: 12px; max-width: 420px; }
.note { color: var(--warn); font-size: 12px; max-width: 420px; }

.list { display: grid; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { overflow-wrap: anywhere; }
.rank { width: 22px; color: var(--faint); font-weight: 800; font-variant-numeric: tabular-nums; }
.gain { color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }

.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); object-fit: cover; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--muted); border: 1px solid var(--line-2); }

.empty { padding: 30px 10px; text-align: center; color: var(--muted); }
.empty b { color: var(--text); display: block; margin-bottom: 4px; font-size: 15px; }

/* ── forms ──────────────────────────────────────────── */
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
label.field > span { color: var(--muted); }
label.field .hint { font-weight: 400; color: var(--faint); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=datetime-local], input[type=date], input[type=search], select, textarea {
  width: 100%; background: #0c1015; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 11px; outline: none;
}
textarea { resize: vertical; min-height: 92px; }
input:focus, select:focus, textarea:focus { border-color: #4b5a68; box-shadow: 0 0 0 3px rgba(184, 255, 60, 0.12); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 7px 12px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--panel-2); color: var(--text); }
.seg button + button { border-left: 1px solid var(--line-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #46525e; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.btn.block { width: 100%; }

.drop {
  border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 34px 18px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s; background: #0c1015;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(184, 255, 60, 0.04); }
.drop .big { font-size: 16px; font-weight: 800; }
.file-card { display: flex; gap: 14px; align-items: center; }
.file-card video { width: 92px; height: 164px; object-fit: cover; border-radius: var(--radius-sm); background: #000; flex: none; }

.acct-group { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.acct-group-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--panel-2); }
.acct-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.acct-opt:hover { background: rgba(255, 255, 255, 0.02); }
.acct-opt.disabled { opacity: 0.45; cursor: not-allowed; }

.cmd {
  display: flex; align-items: center; gap: 8px; background: #0b0f13; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 6px 6px 6px 10px; font-family: var(--mono); font-size: 12px; min-width: 0;
}
.cmd code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

pre.code { background: #0b0f13; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; overflow-x: auto; font: 12px/1.5 var(--mono); color: #c9d4de; margin: 0; }

/* ── dialog / toast ─────────────────────────────────── */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
dialog form { display: grid; gap: 14px; padding: 20px; }
dialog h3 { margin: 0; font-size: 17px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); animation: pop 0.18s ease-out; }
.toast.bad { border-left-color: var(--bad); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

.banner { border: 1px solid rgba(255, 176, 32, 0.35); background: rgba(255, 176, 32, 0.06); border-radius: var(--radius-sm); padding: 10px 14px; color: #ffd27a; }
.banner.bad { border-color: rgba(255, 84, 104, 0.4); background: rgba(255, 84, 104, 0.07); color: #ff9aa6; }
.banner.good { border-color: rgba(61, 220, 132, 0.35); background: rgba(61, 220, 132, 0.06); color: #8ff0b8; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }

.checklist { display: grid; gap: 10px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check-item .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; flex: none; background: #1d242c; color: var(--faint); }
.check-item .ic.ok { background: rgba(61, 220, 132, 0.15); color: var(--good); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 28px; }
.login h1 { margin: 0 0 6px; font-size: 22px; }

/* ── responsive ─────────────────────────────────────── */
@media (max-width: 1080px) {
  .split, .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    border-right: 0; border-top: 1px solid var(--line); z-index: 20; overflow-x: auto; gap: 2px;
  }
  .brand, .side-foot, .side-goal { display: none; }
  .nav { display: contents; }
  .nav a { position: relative; flex: 1 1 0; min-width: 48px; flex-direction: column; gap: 2px; font-size: 9.5px; padding: 6px 2px; justify-content: center; text-align: center; }
  .nav a span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav a.active { box-shadow: inset 0 2px 0 var(--accent); }
  .nav .badge { position: absolute; top: 1px; left: 50%; margin: 0 0 0 4px; height: 16px; min-width: 16px; font-size: 10px; padding: 0 4px; }
  .sub-item { flex-wrap: wrap; }
  .sub-item > .stack:last-child { grid-auto-flow: column; justify-content: start; align-items: center; width: 100%; }
  .card > .row > h2.grow { flex-basis: 100%; }
  main { padding-bottom: 110px; }
  .ep { padding: 16px; }
  .ep-range-wrap { width: 100%; }
  .ep-range { display: flex; }
  .ep-range button { flex: 1; min-width: 0; padding: 7px 6px; }
  .ep-custom { left: 0; right: auto; }
  .hero { grid-template-columns: 1fr; }
  .hero-side { text-align: left; grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .split-bars .line { grid-template-columns: 76px 1fr 56px; }
}
