/* PannoSites — tokens e componentes */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/manrope-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url("/static/fonts/manrope-latin-800-normal.woff2") format("woff2"); }
:root {
  --bg: #F5F6FA; --surface: #FFFFFF; --surface-2: #EDEFF5; --border: #DCDFEA;
  --text: #0E1020; --muted: #565B70; --accent: #4338CA; --accent-ink: #FFFFFF; --accent-soft: #E6E7FB;
  --ok: #166534; --ok-soft: #DCFCE7; --warn: #A15C00; --warn-soft: #FDF0DC; --danger: #B42318; --danger-soft: #FDE8E6;
  --chart: #4338CA; --focus: #4338CA;
  --r: 10px; --r-sm: 7px; --shadow: 0 8px 24px rgba(20, 20, 20, .10);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B0C10; --surface: #14161D; --surface-2: #1C1F29; --border: #282C3A;
    --text: #E7E8F0; --muted: #9A9EB3; --accent: #818CF8; --accent-ink: #0B0D1A; --accent-soft: #1F2240;
    --ok: #4ADE80; --ok-soft: #0F2A1A; --warn: #F2B35B; --warn-soft: #3A2C14; --danger: #F97066; --danger-soft: #3D1A17;
    --chart: #818CF8; --focus: #A5B4FC; --shadow: 0 8px 24px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0C10; --surface: #14161D; --surface-2: #1C1F29; --border: #282C3A;
    --text: #E7E8F0; --muted: #9A9EB3; --accent: #818CF8; --accent-ink: #0B0D1A; --accent-soft: #1F2240;
    --ok: #4ADE80; --ok-soft: #0F2A1A; --warn: #F2B35B; --warn-soft: #3A2C14; --danger: #F97066; --danger-soft: #3D1A17;
    --chart: #818CF8; --focus: #A5B4FC; --shadow: 0 8px 24px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; margin: 0 0 var(--s3); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 var(--s3); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, table td.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border);
  padding: var(--s4) var(--s3); display: flex; flex-direction: column; gap: var(--s1); }
.brand { display: flex; align-items: center; gap: var(--s2); text-decoration: none; padding: var(--s1) var(--s2) var(--s4);
  font: 800 20px/1 var(--font-display); letter-spacing: -.02em; }
.brand .gem { color: var(--accent); font-size: 16px; }
.brand b { color: var(--accent); font-weight: 800; }
.nav a, .nav button { display: flex; align-items: center; gap: var(--s3); padding: 9px var(--s3); border-radius: var(--r-sm);
  color: var(--muted); text-decoration: none; font-weight: 500; width: 100%; border: 0; background: none; font: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav a[aria-current="page"] svg { color: var(--accent); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: var(--s4) var(--s3) var(--s1); }
.side-foot { margin-top: auto; padding-top: var(--s4); }
.collapsed .side .txt, .collapsed .side .nav-label, .collapsed .brand span.word { display: none; }
.collapsed .nav a, .collapsed .nav button { justify-content: center; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s6); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.top .spacer { flex: 1; }
.content { padding: var(--s6); max-width: 1240px; width: 100%; margin: 0 auto; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
.page-head p { margin: 0; }
.bottom-nav { display: none; }
.banner { padding: var(--s2) var(--s6); background: var(--warn-soft); color: var(--text); display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; font-size: 14px; }

/* ---------- componentes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s5); min-width: 0; }
.card + .card { margin-top: var(--s4); }
.grid { display: grid; gap: var(--s4); }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font: 800 26px/1.2 var(--font-display); font-variant-numeric: tabular-nums; margin-top: var(--s1); }
.kpi .hint { font-size: 12px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap; }
.pill.coin svg { color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.escalando { background: var(--ok-soft); color: var(--ok); }
.badge.estavel { background: var(--surface-2); color: var(--muted); }
.badge.caindo { background: var(--danger-soft); color: var(--danger); }
.badge.baixo, .badge.sem_dados { background: var(--surface-2); color: var(--muted); }
.badge.global { background: var(--accent-soft); color: var(--text); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); font-size: 12px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 14px/1.2 var(--font); cursor: pointer;
  text-decoration: none; white-space: nowrap; min-height: 40px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 10px; min-height: 32px; font-size: 13px; }
.btn.icon { padding: 8px; min-width: 40px; }
.btn[disabled], .btn.htmx-request { opacity: .6; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

label.field { display: block; margin-bottom: var(--s4); min-width: 0; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search],
select, textarea { width: 100%; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: 15px/1.4 var(--font); min-height: 42px; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.field .err { color: var(--danger); font-size: 13px; margin-top: 4px; display: block; }
.field .help { color: var(--muted); font-size: 12px; margin-top: 4px; display: block; }
.invalid input, .invalid select, .invalid textarea { border-color: var(--danger); }
.check { display: flex; gap: var(--s2); align-items: center; font-size: 14px; }

.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)) auto; gap: var(--s2); align-items: center; margin-bottom: var(--s4); }
.filters .check { white-space: nowrap; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.table-wrap table th:first-child, .table-wrap table td:first-child { padding-left: var(--s4); }

/* ofertas */
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s4); }
.offer { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; min-width: 0; }
.offer .thumb { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); display: grid; place-items: center;
  color: var(--muted); font: 700 13px var(--font-display); overflow: hidden; position: relative; }
.offer .thumb img { width: 100%; height: 100%; object-fit: cover; }
.offer .thumb .fav { position: absolute; top: 8px; right: 8px; }
.offer .body { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); flex: 1; }
.offer h3 { margin: 0; font-size: 15px; }
.offer h3 a { text-decoration: none; }
.offer h3 a:hover { text-decoration: underline; }
.offer .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.offer .stats { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: auto; padding-top: var(--s2); border-top: 1px solid var(--border); }
.offer .stats strong { font: 800 18px var(--font-display); font-variant-numeric: tabular-nums; }
.spark { display: block; max-width: 100%; }
.fav-btn { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }

/* estados */
.empty { text-align: center; padding: var(--s8) var(--s4); color: var(--muted); }
.empty svg.i { width: 36px; height: 36px; color: var(--accent); margin-bottom: var(--s2); }
.empty h3 { color: var(--text); }
.alert { padding: var(--s3) var(--s4); border-radius: var(--r-sm); margin-bottom: var(--s4); font-size: 14px; border: 1px solid transparent; }
.alert.erro { background: var(--danger-soft); color: var(--text); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--text); }
.alert.aviso { background: var(--warn-soft); color: var(--text); }
.loading { display: none; align-items: center; gap: var(--s2); color: var(--muted); font-size: 14px; }
.htmx-request .loading, .htmx-request.loading { display: inline-flex; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 50; background: var(--text); color: var(--bg); padding: var(--s3) var(--s4);
  border-radius: var(--r-sm); box-shadow: var(--shadow); font-size: 14px; max-width: min(420px, calc(100vw - 32px)); animation: rise .25s ease-out; }
.toast.erro { background: var(--danger); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.steps li a { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r-sm); border: 1px solid var(--border); text-decoration: none; }
.steps li a:hover { background: var(--surface-2); }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; }
.steps .done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps .done span.t { text-decoration: line-through; color: var(--muted); }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }

.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--border); margin-bottom: var(--s5); overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--accent); }

.output { white-space: pre-wrap; background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s4); font-size: 14px; position: relative; overflow-wrap: anywhere; }
.output + .output { margin-top: var(--s3); }
.output .copy-btn { position: absolute; top: 8px; right: 8px; }
.prose { overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3 { margin-top: var(--s5); }
.prose ul, .prose ol { padding-left: 20px; }
mark.hit { background: var(--danger-soft); color: var(--danger); border-bottom: 2px solid var(--danger); padding: 0 2px; border-radius: 3px; }
.code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; background: var(--surface-2); padding: var(--s3); border-radius: var(--r-sm);
  overflow-wrap: anywhere; word-break: break-all; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--s2) var(--s4); font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
details summary { cursor: pointer; font-weight: 600; }
.chart-box { position: relative; height: 260px; }
.row-ok td { }
.row-bad td { color: var(--danger); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s6) var(--s4); }
.auth .box { width: 100%; max-width: 400px; }
.auth .brand { justify-content: center; font-size: 26px; padding-bottom: var(--s2); }
.auth .tagline { text-align: center; color: var(--muted); margin-bottom: var(--s6); }
.auth .card { padding: var(--s6); }
.auth .links { text-align: center; margin-top: var(--s4); font-size: 14px; color: var(--muted); }
.legal { max-width: 760px; margin: 0 auto; padding: var(--s8) var(--s4); }

/* ---------- responsivo */
@media (max-width: 1100px) { .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filters .q { grid-column: 1 / -1; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top { padding: var(--s2) var(--s4); }
  .top .brand { display: flex; padding: 0; font-size: 18px; }
  .content { padding: var(--s4) var(--s4) 96px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; min-width: 0; }
  .bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .toast { bottom: 84px; left: var(--s4); right: var(--s4); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: var(--s2); }
  .hide-sm { display: none !important; }
}
@media (min-width: 861px) { .top .brand { display: none; } .only-sm { display: none !important; } }
@media (max-width: 520px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi .value { font-size: 22px; } .offers { grid-template-columns: minmax(0, 1fr); } }
.sim-grid { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .sim-grid { grid-template-columns: minmax(0, 1fr); } }
.steps > li { min-width: 0; }
.steps li a .t { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid > .card + .card { margin-top: 0; }
.offer .thumb.noimg { aspect-ratio: auto; height: 64px; }
@media (max-width: 860px) { .grid.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.output.md { white-space: normal; }
.output.md h3 { margin: 12px 0 6px; font-size: 15px; }
.output.md h3:first-child { margin-top: 0; padding-right: 90px; }
.output.md p, .output.md ul, .output.md ol { margin: 0 0 8px; }
td.num, th.num { white-space: nowrap; }
.grid + .card, .grid + section.card { margin-top: var(--s4); }

/* ---------- feed de ofertas (cards com capa, anunciante e métricas) */
.ocard { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; min-width: 0; transition: border-color .15s, transform .15s; }
.ocard:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-2px); }
.ocard .cover { position: relative; display: block; aspect-ratio: 16 / 9; background:
  radial-gradient(120% 90% at 20% 0%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 60%), var(--surface-2); overflow: hidden; }
.ocard .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.ocard .cover-fallback { position: absolute; inset: 0; display: grid; place-items: center; font: 800 44px var(--font-display);
  color: color-mix(in srgb, var(--accent) 70%, var(--text)); opacity: .55; }
.ocard .fav { position: absolute; top: 10px; right: 10px; z-index: 3; }
.ocard .who { display: flex; align-items: center; gap: 8px; margin: -22px 14px 0; position: relative; z-index: 2; min-width: 0; }
.ocard .avatar { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); background: var(--accent-soft);
  display: grid; place-items: center; overflow: hidden; flex: none; position: relative; font: 800 16px var(--font-display); color: var(--accent); }
.ocard .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ocard .who-name { margin-top: 20px; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ocard-body { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.ocard h3 { margin: 0; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.ocard h3 a { text-decoration: none; }
.ocard h3 a:hover { color: var(--accent); }
.ocard .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.ocard .badge svg.i { width: 12px; height: 12px; }
.ocard .clamp { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ocard .metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: auto; }
.ocard .metrics > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 6px; text-align: center; min-width: 0; }
.ocard .metrics b { display: block; font: 800 17px/1.1 var(--font-display); }
.ocard .metrics span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ocard .metrics .hl { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ocard .metrics .hl b { color: var(--accent); }
.ocard .card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s4); }
@media (max-width: 520px) { .feed { grid-template-columns: minmax(0, 1fr); } }

/* ---------- PannoSites */
.brand .gem { font-size: 18px; }
.stack { display: grid; gap: var(--s4); min-width: 0; align-content: start; }
.stack > .card + .card { margin-top: 0; }
.lead-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.mine-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.msg-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
.sticky { position: sticky; top: 76px; }
.narrow { max-width: 720px; }
.kpis { margin-bottom: var(--s4); }
.funnel { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s2); }
.fstep { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border-radius: var(--r-sm); background: var(--surface-2);
  text-decoration: none; border-top: 3px solid var(--stc, var(--border)); min-width: 0; }
.fstep:hover { background: var(--accent-soft); }
.fstep .n { font: 800 22px/1.1 var(--font-display); }
.fstep .l { font-size: 13px; color: var(--muted); }
/* status do funil */
.st-novo { --stc: #64748B; } .st-contatado { --stc: #2563EB; } .st-respondeu { --stc: #7C3AED; }
.st-negociando { --stc: #B45309; } .st-fechado { --stc: #15803D; } .st-perdido { --stc: #B91C1C; }
:root[data-theme="dark"] .st-novo { --stc: #94A3B8; } :root[data-theme="dark"] .st-contatado { --stc: #60A5FA; }
:root[data-theme="dark"] .st-respondeu { --stc: #A78BFA; } :root[data-theme="dark"] .st-negociando { --stc: #FBBF24; }
:root[data-theme="dark"] .st-fechado { --stc: #4ADE80; } :root[data-theme="dark"] .st-perdido { --stc: #F87171; }
.badge.st-novo, .badge.st-contatado, .badge.st-respondeu, .badge.st-negociando, .badge.st-fechado, .badge.st-perdido {
  color: var(--stc); background: color-mix(in srgb, var(--stc) 13%, transparent); border: 1px solid color-mix(in srgb, var(--stc) 35%, transparent); }
:root:not([data-theme="dark"]) .badge.st-novo, :root:not([data-theme="dark"]) .badge.st-contatado, :root:not([data-theme="dark"]) .badge.st-respondeu,
:root:not([data-theme="dark"]) .badge.st-negociando, :root:not([data-theme="dark"]) .badge.st-fechado, :root:not([data-theme="dark"]) .badge.st-perdido { color: color-mix(in srgb, var(--stc) 80%, #000); }
/* presença */
.badge.pr-sem_site { color: var(--ok); background: var(--ok-soft); }
.badge.pr-social { color: var(--accent); background: var(--accent-soft); }
.badge.pr-fraco, .badge.pr-fora { color: var(--warn); background: var(--warn-soft); }
.badge.pr-ok { color: var(--muted); background: var(--surface-2); }
.score { display: inline-grid; place-items: center; min-width: 36px; height: 26px; padding: 0 6px; border-radius: 999px; font-weight: 800;
  font-size: 13px; font-variant-numeric: tabular-nums; }
.score.sc-quente { background: var(--accent); color: var(--accent-ink); }
.score.sc-morno { background: var(--accent-soft); color: var(--text); }
.score.sc-frio { background: var(--surface-2); color: var(--muted); }
.tag svg.i { width: 14px; height: 14px; vertical-align: -2px; }
.tag.wa { color: #15803D; }
:root[data-theme="dark"] .tag.wa { color: #4ADE80; }
.tag.danger { color: var(--danger); background: var(--danger-soft); }
table.leads td.name { min-width: 200px; }
table.leads td.name a { text-decoration: none; }
table.leads td.name a:hover strong { text-decoration: underline; }
.w1 { width: 1%; }
.nowrap { white-space: nowrap; }
.ellipsis { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted-row td { opacity: .55; }
.late { color: var(--danger); font-weight: 600; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush table th:first-child, .card.flush table td:first-child { padding-left: var(--s4); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-bottom: var(--s3); padding: var(--s3) var(--s4); }
.toolbar .spacer { flex: 1; }
.toolbar select { min-height: 36px; width: auto; }
.field.inline { display: flex; align-items: center; gap: var(--s2); margin: 0; }
.field.inline > span { margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-items: center; margin-bottom: var(--s3); }
.filters .checks { grid-column: 1 / -1; margin: 0; }
.filters .actions { align-self: end; }
.pager { display: flex; align-items: center; justify-content: center; gap: var(--s3); margin-top: var(--s4); }
.rowlist { list-style: none; margin: 0; padding: 0; }
.rowlist li { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--border); }
.rowlist li:last-child { border-bottom: 0; }
.rowlist a { flex: 1; min-width: 0; text-decoration: none; display: flex; flex-direction: column; }
.rowlist a:hover .ttl { text-decoration: underline; }
.rowlist .ttl { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowlist .sub { font-size: 13px; color: var(--muted); }
.empty.slim { padding: var(--s4) 0; text-align: left; display: flex; gap: var(--s3); align-items: flex-start; }
.empty.slim p { margin: 0; color: var(--muted); }
.conn { padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px;
  border-left: 3px solid var(--muted); min-width: 0; }
.conn.on { border-left-color: var(--ok); }
.conn span { font-size: 13px; color: var(--muted); }
fieldset.field { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
fieldset.field legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s2); }
.seg label { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; background: var(--surface); min-width: 0; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg label.dis { opacity: .55; cursor: not-allowed; }
.seg label span { display: flex; flex-direction: column; min-width: 0; }
.seg label small { color: var(--muted); font-size: 12.5px; }
.seg input { margin-top: 4px; accent-color: var(--accent); }
.status-seg { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: var(--s4); }
.status-seg label { padding: 8px 10px; align-items: center; border-left: 3px solid var(--stc); }
.status-seg label:has(input:checked) { background: color-mix(in srgb, var(--stc) 16%, transparent); border-color: var(--stc); }
.status-seg input { margin: 0; accent-color: var(--stc); }
.wa-btn { background: #15803D; color: #fff; border-color: #15803D; }
.wa-btn:hover { background: #166534; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; flex-direction: column; padding: var(--s2) 0 var(--s2) var(--s4); border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.timeline li.ev-mensagem::before { background: #15803D; } .timeline li.ev-visita::before { background: var(--accent); }
.timeline li.ev-status::before { background: var(--warn); } .timeline li.ev-site::before { background: var(--chart); }
.timeline .when { font-size: 12px; color: var(--muted); }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.bubble { background: var(--surface-2); border-radius: 4px var(--r) var(--r) var(--r); padding: var(--s3) var(--s4); margin: var(--s2) 0 0; font-size: 14px; }
.tpl + .tpl { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--border); }
.vars { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s2); }
.vars .tag { cursor: pointer; border: 1px solid var(--border); font-family: ui-monospace, monospace; font-size: 12px; }
.vars .tag:hover { border-color: var(--accent); }
.code-link { font-family: ui-monospace, monospace; font-size: 13px; overflow-wrap: anywhere; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatches input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.serv-row { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: var(--s2); }
.serv-row .field { margin-bottom: var(--s2); }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: var(--s3) 0 0; border-top: 1px solid var(--border); }
.preview-pane { position: sticky; top: 76px; }
.pv-frame { margin-top: var(--s3); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); display: flex; justify-content: center; overflow: hidden; }
.pv-frame iframe { width: 100%; height: 70vh; border: 0; background: #fff; transition: width .2s; }
.sitegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s4); }
.scard { padding: 0; overflow: hidden; }
.scard + .scard { margin-top: 0; }
.sthumb { height: 110px; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); color: #fff; display: flex;
  align-items: flex-end; justify-content: space-between; padding: var(--s3) var(--s4); }
.sthumb span { font: 800 34px/1 var(--font-display); }
.sthumb small { opacity: .85; }
.sbody { padding: var(--s4); }
.sbody h3 { margin-bottom: 2px; }
.sbody h3 a { text-decoration: none; }
@media (max-width: 1100px) { .editor, .lead-grid { grid-template-columns: minmax(0, 1fr); } .preview-pane { position: static; } .funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .mine-grid, .msg-grid { grid-template-columns: minmax(0, 1fr); } .sticky { position: static; } .status-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .spacer { display: none; } .grid.g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); } .serv-row { grid-template-columns: minmax(0, 1fr); } .pv-frame iframe { height: 60vh; } }
