/* AfiliMax — identidade visual aplicada ao painel. Tokens oficiais da marca. */
:root {
  --black: #0B0D0F;      /* preto profundo: fundos */
  --graphite: #171A1E;   /* grafite: superfícies e cartões */
  --graphite-2: #1E2227; /* grafite elevado: hover, campos */
  --line: #272C33;       /* bordas discretas */
  --neon: #B6F34A;       /* verde neon: ações principais e positivos */
  --neon-dim: rgba(182, 243, 74, 0.12);
  --white: #F3F4F6;      /* títulos e textos principais */
  --gray: #9CA3AF;       /* textos auxiliares */
  --danger: #F26D6D;
  --warn: #F2B544;
  --info: #7CB8F0;
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 var(--font); background: var(--black); color: var(--white); font-feature-settings: 'tnum' 1, 'cv11' 1; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--gray); }
.err { color: var(--danger); min-height: 1em; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-size: 22px; margin: 0; font-weight: 800; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 13px; margin: 18px 0 8px; font-weight: 700; color: var(--white); }
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--graphite-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
ol, ul { padding-left: 18px; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--graphite); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.side-logo { padding: 4px 10px 22px; }
.side-logo img { height: 34px; display: block; }
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tabs button { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 10px 12px; border-radius: 10px; color: var(--gray); cursor: pointer; font: 500 14px var(--font); text-align: left; white-space: nowrap; }
.tabs button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabs button:hover { background: var(--graphite-2); color: var(--white); }
.tabs button.active { background: var(--neon-dim); color: var(--neon); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.side-link { color: var(--gray); font-size: 12px; }
.content { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px 28px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top-sub { font-size: 13px; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--gray); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }
main { padding: 24px 28px 40px; width: 100%; max-width: 1360px; }

/* ---------- componentes ---------- */
.card { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.kpi { background: var(--graphite); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .v { font: 700 26px/1.2 var(--font); letter-spacing: -0.02em; margin-top: 6px; }
.kpi .l { color: var(--gray); font-size: 12px; font-weight: 500; }
.kpi.accent { border-color: rgba(182, 243, 74, 0.35); }
.kpi.accent .v { color: var(--neon); }

.btn { border: 1px solid var(--line); background: var(--graphite-2); color: var(--white); padding: 9px 16px; border-radius: 10px; cursor: pointer; font: 600 13px var(--font); transition: background .15s, border-color .15s, filter .15s; }
.btn:hover { border-color: #3a414a; }
.btn.primary { background: var(--neon); border-color: var(--neon); color: var(--black); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: transparent; border-color: rgba(242, 109, 109, 0.5); color: var(--danger); }
.btn.danger:hover { background: rgba(242, 109, 109, 0.1); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible, .tabs button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input, select, textarea { font: 14px var(--font); padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--black); color: var(--white); }
input::placeholder, textarea::placeholder { color: #6b7280; }
input[type=checkbox] { width: auto; accent-color: var(--neon); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--gray); margin-bottom: 5px; font-weight: 500; }
label.f input, label.f select, label.f textarea { width: 100%; }
label.f input[type=checkbox] { width: auto; margin-right: 4px; vertical-align: -2px; }
label.f label { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; color: var(--gray); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td { background: rgba(255, 255, 255, 0.015); }
.table-wrap { overflow-x: auto; }
td a { color: var(--white); font-weight: 600; } /* verde reservado para ações, não para cada linha */
td a:hover { color: var(--neon); text-decoration: none; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: var(--graphite-2); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--graphite-2); color: var(--gray); border: 1px solid var(--line); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.b-ok { color: var(--neon); background: var(--neon-dim); border-color: rgba(182, 243, 74, 0.25); }
.b-warn { color: var(--warn); background: rgba(242, 181, 68, 0.1); border-color: rgba(242, 181, 68, 0.25); }
.b-err { color: var(--danger); background: rgba(242, 109, 109, 0.1); border-color: rgba(242, 109, 109, 0.25); }
.b-info { color: var(--info); background: rgba(124, 184, 240, 0.1); border-color: rgba(124, 184, 240, 0.25); }

.notice { background: var(--graphite); border: 1px solid var(--line); border-left: 3px solid var(--neon); padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; color: #d1d5db; }
.notice.warn { border-left-color: var(--warn); }
.notice.err-notice { border-left-color: var(--danger); }
.qr { width: 280px; height: 280px; border-radius: 10px; background: #fff; padding: 8px; }
.pairing { font-size: 28px; letter-spacing: 4px; font-weight: 700; font-family: ui-monospace, monospace; color: var(--neon); }
pre.msg { white-space: pre-wrap; background: var(--black); padding: 14px; border-radius: 10px; border: 1px solid var(--line); font: 13px/1.55 var(--font); margin: 0; color: #e5e7eb; }
.logs { max-height: 360px; overflow: auto; font-size: 12px; font-family: ui-monospace, 'Cascadia Code', monospace; color: #cbd0d6; }
.logs div { padding: 5px 0; border-bottom: 1px solid var(--line); }
.progress { height: 8px; background: var(--graphite-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--neon); }

/* gráfico de barras do dashboard */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .bar { width: 100%; max-width: 28px; background: var(--neon); border-radius: 5px 5px 2px 2px; min-height: 2px; opacity: .9; }
.chart .bar.zero { background: var(--line); }
.chart .lbl { font-size: 10px; color: var(--gray); }
.chart .val { font-size: 10px; color: var(--white); font-weight: 600; }
.trend { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.trend:last-child { border-bottom: 0; }
.trend .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { font-weight: 700; color: var(--neon); font-variant-numeric: tabular-nums; }

.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--graphite); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(720px, 100%); max-height: 90vh; overflow: auto; }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(600px 300px at 50% 30%, rgba(182, 243, 74, 0.06), transparent 70%), var(--black); }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 30px; }
.auth-logo { height: 40px; align-self: flex-start; }
.slogan { margin: 0; font: 600 15px var(--font-display); color: var(--white); }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--graphite-2); border: 1px solid var(--line); border-left: 3px solid var(--neon); color: var(--white); padding: 12px 16px; border-radius: 10px; max-width: 440px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.toast.error { border-left-color: var(--danger); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px; flex-direction: row; align-items: center; gap: 8px; overflow-x: auto; }
  .side-logo { padding: 0 6px 0 0; }
  .side-logo img { height: 26px; }
  .tabs { flex-direction: row; }
  .tabs button span { display: none; }
  .side-foot { display: none; }
  .top { padding: 16px; }
  main { padding: 16px; }
}
