/* Painel Alcance. Layout: topo com marca, fontes e usuário; abas; lista de clientes à esquerda e detalhe à direita (no celular, a lista vira uma fileira rolável). */
:root {
  --bg: #F2F5F2;
  --surface: #FFFFFF;
  --ink: #12201B;
  --muted: #5A6A63;
  --line: #DCE3DE;
  --accent: #0F6B54;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEFE8;
  --prior: #B7C3BD;
  --up: #17703F;
  --up-bg: #DDF1E4;
  --down: #A63B25;
  --down-bg: #F8E1DA;
  --font-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1512; --surface: #16201B; --ink: #E7EEEA; --muted: #93A39B; --line: #27342E;
    --accent: #3FBF98; --accent-ink: #0B1A15; --accent-soft: #1A3A31; --prior: #4A5B53;
    --up: #5CD08E; --up-bg: #173525; --down: #F08A72; --down-bg: #3C211B;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding-block: 20px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.direita { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.src { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); }
.src i { width: 8px; height: 8px; border-radius: 50%; background: var(--prior); display: inline-block; }
.src.on { color: var(--ink); border-color: var(--accent); }
.src.on i { background: var(--accent); }
.usuario { font-size: 0.85rem; color: var(--muted); }
.btn { font: inherit; font-weight: 600; font-size: 0.85rem; border-radius: 8px; padding: 7px 12px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:focus-visible, .tab:focus-visible, .cli:focus-visible, select:focus-visible, input:focus-visible, tr.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 18px; }
nav.tabs { display: flex; gap: 4px; }
.tab { font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px 10px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
label.semana { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
select, input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.pill { display: inline-block; font-size: 0.76rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.up { color: var(--up); background: var(--up-bg); }
.pill.down { color: var(--down); background: var(--down-bg); }
.pill.flat { color: var(--muted); background: var(--accent-soft); }
.callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.callout { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.callout .k, .kpi .k { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.callout .v { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; margin: 4px 0 2px; }
.tablebox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th { text-align: right; font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
td { text-align: right; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .n { display: block; font-weight: 600; }
td .p { display: block; margin-top: 2px; }
td.name { font-weight: 600; }
td.name small { display: block; font-weight: 400; color: var(--muted); }
tr.row { cursor: pointer; }
tr.row:hover td { background: var(--accent-soft); }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.rail { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cli { text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.cli[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.cli b { display: block; font-weight: 600; }
.cli small { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.panel h2 { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 22px; }
.kpi { border-top: 2px solid var(--accent); padding-top: 8px; min-width: 0; }
.kpi .v { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; letter-spacing: -0.02em; line-height: 1.15; margin: 2px 0 4px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.cols > div { min-width: 0; }
h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; margin: 0 0 12px; }
.bloco { margin-top: 24px; }
.cmp { display: grid; gap: 14px; }
.cmp .lab { display: flex; justify-content: space-between; gap: 8px; font-size: 0.88rem; margin-bottom: 4px; }
.cmp .lab span:last-child { color: var(--muted); }
.bar { height: 8px; border-radius: 0 4px 4px 0; margin-top: 3px; min-width: 2px; }
.bar.now { background: var(--accent); }
.bar.prev { background: var(--prior); }
.legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend i.now { background: var(--accent); }
.legend i.prev { background: var(--prior); }
svg text { fill: var(--muted); font-family: var(--font-body); font-size: 11px; }
svg .val { fill: var(--ink); font-weight: 600; }
svg .grid { stroke: var(--line); }
svg .mark { fill: var(--accent); }
svg .mark.fraca { fill: var(--prior); }
.mix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.mix .it .row { display: flex; justify-content: space-between; font-size: 0.88rem; }
.mix .it .track { height: 6px; background: var(--accent-soft); border-radius: 3px; margin-top: 4px; }
.mix .it .fill { height: 100%; background: var(--accent); border-radius: 3px; }
.ia { background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; font-size: 0.92rem; }
.ia b { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.posts { display: grid; gap: 10px; }
.post { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post .t { font-weight: 600; font-size: 0.9rem; }
.post .l { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.post .m { text-align: right; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.post a { color: var(--accent); }
.note { font-size: 0.8rem; color: var(--muted); margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; max-width: 70ch; }
.vazio { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 28px; color: var(--muted); }
.erro { color: var(--down); font-size: 0.88rem; min-height: 1.2em; }
/* login e convite */
.porta { min-height: 100vh; display: grid; place-items: center; padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.cartao { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.cartao h1 { font-size: 1.5rem; }
.cartao label { display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.cartao input { width: 100%; }
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .cli { flex: 0 0 auto; min-width: 170px; }
  .mix { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) { .bar { transition: width 0.3s ease; } }
