:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --ink: #142320;
  --muted: #64746f;
  --line: #e2e8e5;
  --accent: #0f766e;
  --accent-2: #115e59;
  --accent-soft: #e6f4f1;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --bad: #c2410c;
  --bad-soft: #fdeee6;
  --info: #1d4ed8;
  --info-soft: #e8efff;
  --wa: #1fa855;
  --li: #0a66c2;
  --side: #10201d;
  --radius: 14px;
  --field: #ffffff;
  --th: #eef3f1;
  --row-hover: #f8fbfa;
  --bad-line: #f3c6b1;
  --warn-soft: #fffbea;
  --warn-line: #f1e3a8;
  --purple: #7c3aed;
  --purple-soft: #f1e9fe;
  --shadow: 0 1px 2px rgba(16, 32, 29, .05), 0 6px 20px rgba(16, 32, 29, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --card: #161f1d; --ink: #e4ece9; --muted: #93a49f; --line: #26332f;
    --accent: #2bb3a3; --accent-2: #4cc7b8; --accent-soft: #15302c;
    --ok: #4ade80; --ok-soft: #12301f; --bad: #fb923c; --bad-soft: #3a2116; --info: #7ea6ff; --info-soft: #182540;
    --side: #0a110f; --field: #111917; --th: #1b2624; --row-hover: #1a2422;
    --bad-line: #5a3020; --warn-soft: #2e2810; --warn-line: #574a1c; --purple: #b794f6; --purple-soft: #2a1f42;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small, small { font-size: 12.5px; }
.hidden { display: none !important; }
.up { color: var(--ok); }
.down { color: var(--bad); }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.center-msg { padding: 80px 20px; text-align: center; color: var(--muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { background: #178a45; border-color: #178a45; }
.btn.li { background: var(--li); border-color: var(--li); color: #fff; }
.btn.li:hover { background: #084e95; }
.btn.danger { background: var(--card); color: var(--bad); border-color: #f2c8b6; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.tiny { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.full { width: 100%; }
.mini { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; vertical-align: middle; color: #fff; }
.mini.wa { background: var(--wa); }
.mini.li { background: var(--li); }
.ico { width: 19px; height: 19px; fill: currentColor; flex: none; }
.ico-s { width: 16px; height: 16px; flex: none; }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.file-btn { margin: 0; color: var(--ink); font-size: 14px; }
.file-btn input { display: none; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); padding: 28px; border-radius: 18px; box-shadow: var(--shadow); }
.auth-card h2 { margin: 22px 0 6px; font-size: 22px; }
.auth-card p { margin: 0 0 18px; }

/* shell */
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 16px; }
.brand small { color: inherit; opacity: .65; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.shell { display: flex; min-height: 100vh; }
.side {
  width: 236px; flex: none; background: var(--side); color: #dfe9e6; display: flex; flex-direction: column;
  padding: 18px 12px; position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 4px 8px 20px; }
.side nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: transparent; color: #c5d4d0; font: inherit; font-size: 14.5px; cursor: pointer; text-align: left;
}
.nav:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav.active { background: rgba(45, 212, 191, .14); color: #fff; font-weight: 600; }
.nav span { flex: 1; }
.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 10px; }
.side-foot small { display: block; padding: 0 12px 4px; color: #8fa5a0; }
.badge { font-style: normal; background: var(--bad); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 18px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 20px; }
.top-r { margin-left: auto; display: flex; gap: 8px; }
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; padding: 9px 8px; flex-direction: column; justify-content: space-between; }
.menu-btn span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
.dim { display: none; }
#view { padding: 24px 28px 60px; max-width: 1400px; }

/* kpis */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-align: left; font: inherit; color: inherit; }
.kpi small { color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 28px; margin-top: 4px; letter-spacing: -.5px; }
.kpi b span { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi b span.up { color: var(--ok); }
.kpi.ok { border-left: 4px solid var(--ok); }
.kpi.bad { border-left: 4px solid var(--bad); background: var(--bad-soft); }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: var(--accent); }

/* member cards */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.mcard, .fcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.mcard.bad { border-color: var(--bad-line); background: linear-gradient(var(--bad-soft), var(--card)); }
.mcard.ok { border-top: 4px solid var(--ok); }
.mcard.bad { border-top: 4px solid var(--bad); }
.mcard.info { border-top: 4px solid var(--info); }
.mhead { display: flex; align-items: center; gap: 11px; }
.mhead b { display: block; font-size: 16px; }
.grow { flex: 1; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.mstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; background: var(--bg); border-radius: 10px; padding: 10px; }
.mstats div { text-align: center; }
.mstats b { display: block; font-size: 19px; }
.mstats small { color: var(--muted); font-size: 11.5px; }
.stat-chips, .deal-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.deal-pills { margin: 0 0 14px; }
.stat-chip { font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }
.stat-chip b { margin-left: 3px; }
.stat-chip em { font-style: normal; font-weight: 700; margin-left: 4px; color: var(--ok); }
.stat-chip em.down { color: var(--bad); }
.mact { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bars { display: flex; gap: 6px; align-items: flex-end; height: 56px; padding-top: 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.bar-col small { font-size: 10px; color: var(--muted); }
.bar { width: 100%; max-width: 26px; background: #9fd6cc; border-radius: 4px 4px 0 0; min-height: 3px; }
.bar-col:last-child .bar { background: var(--accent); }
.bar.h0 { height: 3px; } .bar.h1 { height: 10%; } .bar.h2 { height: 20%; } .bar.h3 { height: 30%; } .bar.h4 { height: 40%; }
.bar.h5 { height: 50%; } .bar.h6 { height: 60%; } .bar.h7 { height: 70%; } .bar.h8 { height: 80%; } .bar.h9 { height: 90%; } .bar.h10 { height: 100%; }
.fnote { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 10px; padding: 8px 11px; font-size: 13.5px; }

/* lists, tables */
.sec-h { font-size: 17px; margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-h + .mgrid, .sec-h + .empty { margin-bottom: 28px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.list-row { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row b { display: block; }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 200px; margin: 0; }
.toolbar input { flex: 1; min-width: 200px; margin: 0; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 75vh; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { position: sticky; top: 0; background: var(--th); text-align: left; font-weight: 700; padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); z-index: 1; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; min-width: 110px; max-width: 300px; overflow-wrap: break-word; word-break: normal; }
tbody tr:hover td { background: var(--row-hover); }
td.nowrap { white-space: nowrap; max-width: none; }
.deal-sec { margin-bottom: 24px; }
.deal-sec h3 { margin-bottom: 8px; font-size: 16px; }

/* misc boxes */
.loading { padding: 50px; text-align: center; color: var(--muted); }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { background: var(--card); border: 1px dashed #c9d6d2; border-radius: var(--radius); padding: 40px 20px; text-align: center; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 460px; margin: 0 auto 16px; }
.empty.small { padding: 18px; color: var(--muted); }
.note { background: var(--info-soft); color: #1e3a8a; border-radius: 12px; padding: 11px 14px; margin-bottom: 16px; font-size: 13.5px; }
.err-box { background: var(--bad-soft); color: #9a3412; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.err-box.small { font-size: 13px; margin: 0 0 10px; }
.cards2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel h3 { margin-bottom: 14px; }

/* modal + toast */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-bg { position: absolute; inset: 0; background: rgba(10, 20, 18, .45); }
.modal-card { position: relative; background: var(--card); border-radius: 16px; width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-b { padding: 10px 18px; overflow: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 16px; }
.x { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.toast { opacity: 0; visibility: hidden; position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 60; transition: transform .25s; max-width: calc(100% - 32px); font-size: 14px; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.bad { background: var(--bad); }

/* mobile */
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .side { transform: none; }
  body.menu-open .dim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 30; }
  .menu-btn { display: flex; }
  .top { padding: 12px 16px; gap: 10px; }
  .top h1 { font-size: 17px; }
  .top small#subtitle { display: none; }
  .top-r .btn { padding: 7px 10px; font-size: 13px; }
  #view { padding: 16px 16px 50px; }
  .mgrid { grid-template-columns: 1fr; }
  .cards2, .row2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi b { font-size: 23px; }
}

/* v2: teams, segment filter, sites table */
.chip.team-saas { background: var(--info-soft); color: var(--info); font-size: 11px; padding: 2px 8px; vertical-align: 1px; }
.chip.team-gp { background: var(--purple-soft); color: var(--purple); font-size: 11px; padding: 2px 8px; vertical-align: 1px; }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg-b { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-b em { font-style: normal; font-weight: 500; opacity: .7; margin-left: 4px; }
.seg-b.on { background: var(--accent); color: #fff; }
.toolbar input.narrow { flex: 0 0 110px; min-width: 110px; }
code.copy { display: inline-block; padding: 6px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; word-break: break-all; user-select: all; }
.note.small { font-size: 13px; padding: 8px 12px; margin: 8px 0; }

/* v3: Responded Sites — filter bar, pills, metrics, mobile cards */
.filterbar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.fb-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fb-row > select, .fb-row > input { width: auto; margin: 0; flex: 0 1 auto; min-width: 150px; }
.fb-row > .fb-search { flex: 1 1 240px; }
.fb-range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; margin: 0; }
.fb-range input { width: 78px; margin: 0; }
.fb-row .btn { margin-left: auto; }
.metrics-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-bottom: 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--card); font-size: 14px; }
.metrics-bar .mact { margin: 0; }
.kpi.k-ex b { color: var(--info); }
.kpi.k-paid b { color: var(--ok); }
.kpi.k-both b { color: var(--purple); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.dt-exchange { background: var(--info-soft); color: var(--info); }
.dt-paid { background: var(--ok-soft); color: var(--ok); }
.dt-both { background: var(--purple-soft); color: var(--purple); }
.lt-gp, .lt-li, .lt-both { background: transparent; color: var(--ink); border-color: var(--line); }
.lt-both { border-style: dashed; }
.metric { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.dr-badge { display: inline-grid; place-items: center; height: 18px; padding: 0 5px; border-radius: 5px; background: #ff8800; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.ico-m { width: 15px; height: 15px; color: var(--accent); flex: none; }
.cty { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.flag { font-size: 17px; line-height: 1; }
.site-link { font-weight: 600; text-decoration: none; color: var(--ink); }
.site-link span { color: var(--muted); font-size: 12px; }
.site-link:hover { color: var(--accent); text-decoration: underline; }
.site-niche { display: block; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tiny-chip { font-size: 11px; padding: 2px 8px; margin-top: 4px; }
table.sites td { vertical-align: middle; }
table.sites td.price { max-width: 200px; font-size: 13px; }
table.sites tbody tr { transition: background .12s; }
.map-table select { margin: 0; min-width: 160px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
@media (max-width: 760px) {
  .sites-wrap { border: 0; background: transparent; box-shadow: none; overflow: visible; max-height: none; }
  table.sites, table.sites tbody, table.sites tr, table.sites td { display: block; width: 100%; }
  table.sites thead { display: none; }
  table.sites tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  table.sites td { border: 0; padding: 0; max-width: none; white-space: normal; }
  table.sites td::before { content: attr(data-l); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
  table.sites td[data-l="Site"], table.sites td[data-l="Member"], table.sites td[data-l="Price"] { grid-column: 1 / -1; }
  table.sites td[data-l="Site"]::before { display: none; }
  table.sites tbody tr:hover td { background: transparent; }
  .fb-row > select, .fb-row > input, .fb-row > .fb-search { flex: 1 1 100%; min-width: 0; }
  .fb-range { flex: 1 1 100%; }
  .fb-range input { flex: 1; }
  .fb-row .btn { margin-left: 0; width: 100%; }
}

/* ===================== v4 theme: light, violet/blue (marketplace look) ===================== */
:root {
  --bg: #f6f7fb; --card: #ffffff; --ink: #0f172a; --muted: #6b7280; --line: #e9eaf3;
  --accent: #7c3aed; --accent-2: #6d28d9; --accent-soft: #f3eeff; --grad: linear-gradient(135deg, #7c3aed, #9333ea);
  --blue: #2563eb; --blue-soft: #eef4ff; --orange: #f97316; --orange-soft: #fff4ec; --teal: #0d9488; --teal-soft: #e9faf7;
  --ok: #16a34a; --ok-soft: #ecfbf1; --bad: #e11d48; --bad-soft: #fff0f3; --info: #2563eb; --info-soft: #eef4ff;
  --purple: #7c3aed; --purple-soft: #f3eeff; --side: #ffffff; --field: #ffffff; --th: #f8fafc; --row-hover: #faf8ff;
  --bad-line: #fecdd6; --warn-soft: #fffbeb; --warn-line: #fde68a;
  --radius: 18px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(76, 29, 149, .12);
  --font: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0b14; --card: #16131f; --ink: #ece9f5; --muted: #9a94ad; --line: #2a2538;
    --accent: #a78bfa; --accent-2: #c4b5fd; --accent-soft: #241c3a; --grad: linear-gradient(135deg, #7c3aed, #9333ea);
    --blue: #7aa2ff; --blue-soft: #1a2240; --orange: #fb923c; --orange-soft: #31200f; --teal: #2dd4bf; --teal-soft: #0f2a27;
    --ok: #4ade80; --ok-soft: #11281b; --bad: #fb7185; --bad-soft: #33141c; --info: #7aa2ff; --info-soft: #1a2240;
    --purple: #c4b5fd; --purple-soft: #241c3a; --side: #13101b; --field: #110e18; --th: #1b1726; --row-hover: #1d1829;
    --bad-line: #5b2131; --warn-soft: #2b2410; --warn-line: #5a4a17;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
body { font-family: var(--font); font-size: 14.5px; letter-spacing: -.005em; }
h1, h2, h3, .kpi b, .brand b { letter-spacing: -.02em; }
.btn { border-radius: 999px; font-weight: 700; padding: 9px 18px; background: var(--grad); border: 0; box-shadow: 0 8px 18px -10px rgba(124, 58, 237, .7); }
.btn:hover { background: linear-gradient(135deg, #6d28d9, #7e22ce); }
.btn.ghost { background: var(--card); border: 1px solid var(--line); box-shadow: none; color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.wa, .btn.li, .btn.danger { box-shadow: none; }
.btn.danger { border: 1px solid var(--bad-line); }
.btn.blue { background: linear-gradient(135deg, #0e56f5, #0a47df); box-shadow: 0 8px 18px -10px rgba(14, 86, 245, .65); }
input, textarea, select { border-radius: 12px; border-color: var(--line); background: var(--field); }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }

/* sidebar: white, violet active pill */
.side { background: var(--side); color: var(--ink); border-right: 1px solid var(--line); }
.side .brand b { color: var(--ink); }
.logo { background: var(--grad); border-radius: 12px; box-shadow: 0 8px 16px -8px rgba(124, 58, 237, .7); }
.nav { color: var(--muted); border-radius: 12px; font-weight: 600; font-size: 14px; }
.nav .ico { color: inherit; }
.nav:hover { background: var(--accent-soft); color: var(--accent); }
.nav.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(124, 58, 237, .8); }
.nav-group { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); opacity: .7; padding: 14px 12px 4px; }
.side-foot { border-top: 1px solid var(--line); }
.side-foot small { color: var(--muted); }
.side-promo { margin: 10px 4px 12px; padding: 16px; border-radius: 16px; background: linear-gradient(160deg, var(--accent-soft), var(--card)); border: 1px solid var(--line); text-align: center; }
.side-promo b { display: block; font-size: 14px; margin: 6px 0 4px; }
.side-promo small { display: block; color: var(--muted); margin-bottom: 10px; }
.top { background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); }
.main { background:
  radial-gradient(600px 300px at 85% -60px, color-mix(in srgb, #c084fc 18%, transparent), transparent 70%),
  radial-gradient(500px 260px at 10% -40px, color-mix(in srgb, #60a5fa 14%, transparent), transparent 70%), var(--bg); }
.kpi, .panel, .mcard, .fcard, .filterbar, .table-wrap, .empty { border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi { border-color: var(--line); }
.empty { border: 1px dashed var(--line); }
.note { color: var(--ink); background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue) 18%, transparent); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.chip.ok, .pill.dt-paid { background: var(--ok-soft); color: var(--ok); }

/* dashboard */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.dash-col { display: grid; gap: 18px; min-width: 0; }
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px; background: linear-gradient(120deg, var(--accent-soft), color-mix(in srgb, var(--blue-soft) 70%, var(--card))); border: 1px solid var(--line); }
.hero .eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.hero h2 { font-size: 26px; margin: 6px 0 6px; }
.hero h2 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 0 16px; color: var(--muted); max-width: 520px; }
.hero .mact { margin: 0; }
.hero-art { position: absolute; right: 22px; bottom: -8px; width: 170px; opacity: .9; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: transform .12s, border-color .12s; }
.stat:hover { transform: translateY(-2px); border-color: var(--accent); }
.stat b { display: block; font-size: 20px; line-height: 1.1; }
.stat small { color: var(--muted); font-weight: 600; }
.ibox { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.ibox svg { width: 20px; height: 20px; }
.c-violet { background: var(--purple-soft); color: var(--purple); } .c-blue { background: var(--blue-soft); color: var(--blue); }
.c-green { background: var(--ok-soft); color: var(--ok); } .c-orange { background: var(--orange-soft); color: var(--orange); }
.c-red { background: var(--bad-soft); color: var(--bad); } .c-teal { background: var(--teal-soft); color: var(--teal); }
.bal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bal { display: flex; align-items: center; gap: 12px; border-radius: 16px; padding: 16px; border: 1px solid var(--line); }
.bal.due { background: linear-gradient(120deg, var(--bad-soft), var(--card)); }
.bal.rec { background: linear-gradient(120deg, var(--blue-soft), var(--card)); }
.bal b { display: block; font-size: 22px; }
.bal .ibox { border-radius: 50%; }
.bal .grow { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-h h3 { font-size: 16px; }
.card-h small { display: block; color: var(--muted); }
.card-h .grow { flex: 1; }
.card-h a, .link-btn { color: var(--accent); font-weight: 700; font-size: 13px; text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit; }
.stats-card { border-radius: 20px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stats-top { padding: 18px; color: #fff; background: radial-gradient(260px 120px at 100% 0, rgba(255,255,255,.22), transparent 60%), linear-gradient(135deg, #6d28d9, #4f46e5); }
.stats-top small { opacity: .85; font-weight: 600; }
.stats-top b { display: block; font-size: 30px; margin-top: 4px; }
.stats-list { padding: 8px; }
.stats-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; cursor: pointer; border: 0; background: none; width: 100%; font: inherit; color: inherit; text-align: left; }
.stats-row:hover { background: var(--row-hover); }
.stats-row .ibox { width: 30px; height: 30px; border-radius: 9px; }
.stats-row .ibox svg { width: 16px; height: 16px; }
.stats-row > span:not(.ibox) { flex: 1; font-weight: 600; }
.stats-row b { font-variant-numeric: tabular-nums; }
.olist { display: grid; gap: 8px; }
.orow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.orow .no { font-weight: 800; color: var(--muted); font-size: 12px; }
.orow b { display: block; }
.act { display: grid; gap: 2px; }
.act-row { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.act-row:last-child { border-bottom: 0; }
.act-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.act-row small { display: block; color: var(--muted); }
.st { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending { background: var(--orange-soft); color: var(--orange); } .st-processing { background: var(--blue-soft); color: var(--blue); }
.st-hold { background: var(--warn-soft); color: #b45309; } .st-completed { background: var(--ok-soft); color: var(--ok); }
.st-cancelled, .st-failed { background: var(--bad-soft); color: var(--bad); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: var(--card); color: var(--muted); padding: 7px 14px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.tab em { font-style: normal; opacity: .7; margin-left: 4px; }
.tab.on { background: var(--grad); color: #fff; border-color: transparent; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.ring { --p: 0; --c: var(--accent); width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.ring b { width: 34px; height: 34px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 13px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cat { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font: inherit; color: inherit; text-align: left; transition: border-color .12s, transform .12s; }
.cat:hover { transform: translateY(-1px); border-color: var(--accent); }
.cat.on { border-color: var(--accent); background: var(--accent-soft); }
.cat > span:not(.ibox) { flex: 1; } .cat span b { display: block; font-size: 14px; } .cat span small { color: var(--muted); }
.cat > b { font-size: 16px; font-variant-numeric: tabular-nums; }
.bars2 { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.bars2 div { flex: 1; background: var(--accent-soft); border-radius: 6px 6px 2px 2px; position: relative; min-height: 2px; }
.bars2 div.has { background: var(--grad); }
.bars2-x { display: flex; gap: 4px; font-size: 10px; color: var(--muted); } .bars2-x span { flex: 1; text-align: center; }
.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.invoice { background: #fff; color: #0f172a; padding: 32px; border-radius: 16px; border: 1px solid #e9eaf3; }
.invoice table { font-size: 13px; } .invoice th { background: #f8fafc; color: #64748b; }
.invoice .inv-h { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.invoice .inv-tot { margin-left: auto; width: 260px; margin-top: 14px; } .invoice .inv-tot div { display: flex; justify-content: space-between; padding: 4px 0; }
.invoice .inv-tot .big { font-size: 18px; font-weight: 800; border-top: 2px solid #0f172a; padding-top: 8px; }
.modal-card.wide { width: min(860px, calc(100% - 24px)); }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } .rep-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .stat-grid { grid-template-columns: 1fr 1fr; } .bal-grid { grid-template-columns: 1fr; }
  .hero-art { display: none; } .orow { grid-template-columns: 1fr auto; } .orow .no, .orow .money { display: none; }
}
@media print {
  body * { visibility: hidden !important; } #modal, #modal .invoice, #modal .invoice * { visibility: visible !important; }
  #modal .invoice { position: absolute; left: 0; top: 0; width: 100%; border: 0; }
  .modal-bg, .modal-h, .modal-f { display: none !important; }
}
.modal-card.wide { max-width: 860px; }
.side { overflow-y: auto; scrollbar-width: thin; }
.side nav { flex: none; }
.side-foot { margin-top: auto; }
.stats-row > span:not(.ibox), .cat > span:not(.ibox) { flex: 1; min-width: 0; }
.stats-row .ibox, .cat .ibox { flex: none; }
@media (max-height: 820px) { .side-promo { display: none; } }
.stat-grid + .sec-h, .stat-grid + .card { margin-top: 22px; }
