/* Tokens de cor (--bordo, --gold, --bg, --panel, --surface-2...) vêm de theme.css, carregado antes.
   Regras de interface (herdadas da Turbbu, com a identidade SAW):
   - Quem separa bloco é a COR da superfície, não a borda. Borda só separa linhas irmãs.
   - Campo e botão de formulário têm a mesma altura (--control-h, 44px).
   - Rótulo maior que o valor do campo; no celular o campo fica em 16px (evita zoom do iPhone).
   - Um destaque cheio por tela; o número é o herói, o rótulo é pequeno e cinza.
   - Maiúscula é estilo (text-transform), nunca texto. */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Manrope', 'Segoe UI', ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; }
h1, h2, h3 { letter-spacing: -0.015em; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* Barra de rolagem fina, só o polegar (o trilho do Windows vira a coisa mais clara da tela). */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--scrollbar); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-hover); }
::-webkit-scrollbar-button { display: none; }
@supports (scrollbar-width: thin) and (not (selector(::-webkit-scrollbar))) {
  * { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
}

/* ── Login ─────────────────────────────────────────────────────────────── */

.a-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  /* Fundo bordô firme, só um leve degradê de tom (sem brilho radial: o Impeccable acusa como "halo"). */
  background: linear-gradient(170deg, var(--bordo) 0%, var(--bordo-dark) 100%);
}
.a-login-card {
  background: var(--panel);
  padding: 40px 36px 32px;
  border-radius: 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  /* Elevação neutra e curta: o cartão se destaca pelo contraste com o bordô, não pela sombra. */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 12px 28px -14px rgba(0, 0, 0, 0.4);
}
.a-login-card h1 { font-size: 1.5rem; margin: 0 0 6px; font-weight: 700; color: var(--heading); }
.a-login-card p.sub { color: var(--muted); margin: 0 0 28px; font-size: 0.9rem; }
.a-login-card form { text-align: left; }
/* Coluna de formulário estreita: o botão ocupa a largura toda (a coluna já é o teto). */
.a-login-card .a-btn { width: 100%; margin-top: 8px; }

/* Abas com moldura: a moldura diz "isto é um grupo e um deles está ligado". */
.a-auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: var(--surface-2);
  border-radius: 999px;
}
.a-auth-tab {
  flex: 1; text-align: center; height: 36px; padding: 0 12px;
  background: none; border: none; border-radius: 999px;
  color: var(--muted); font-size: 0.875rem; font-weight: 500;
  font-family: inherit; cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.a-auth-tab:hover { color: var(--text); }
.a-auth-tab.active { background: var(--selected); color: var(--heading); font-weight: 600; box-shadow: 0 1px 3px rgba(42, 20, 18, 0.12); }
html[data-theme="dark"] .a-auth-tab.active { background: #3d3330; color: var(--gold-light); box-shadow: none; }

/* Verificação em duas etapas (dentro do card de login) */
.a-mfa { text-align: left; }
.a-mfa h2 { font-size: 1.15rem; font-weight: 600; color: var(--text); margin: 0 0 8px; text-align: center; }
.a-mfa-passo { margin: 0 0 6px; text-align: center; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.a-mfa-texto { color: var(--muted); font-size: 0.85rem; line-height: 1.5; margin: 0 0 14px; }
.a-mfa-qr { display: flex; justify-content: center; margin: 4px 0 16px; }
.a-mfa-qr img { width: 184px; height: 184px; padding: 10px; background: #fff; border-radius: var(--radius-lg); box-shadow: 0 0 0 1px var(--border); }
.a-mfa-segredo { display: block; margin: -6px 0 20px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-md); font-size: 0.8rem; letter-spacing: 0.06em; word-break: break-all; text-align: center; color: var(--text); user-select: all; }
.a-mfa input[inputmode="numeric"] { text-align: center; font-size: 1.15rem; letter-spacing: 0.4em; font-variant-numeric: tabular-nums; }
.a-mfa-ajuda { margin: 16px 0 0; text-align: center; font-size: 0.8rem; }
.a-mfa-sair { display: block; margin: 12px auto 0; background: none; border: none; color: var(--muted); font-family: inherit; font-size: 0.85rem; cursor: pointer; padding: 6px; }
.a-mfa-sair:hover { color: var(--heading); }

/* ── Campos ────────────────────────────────────────────────────────────── */

.a-field { margin-bottom: 18px; }
.a-field small { display: block; margin-top: 6px; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
/* O rótulo é maior que o campo: ele diz onde se está, o valor vem depois. */
.a-field label, .a-form-grid label {
  display: block;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 500;
}
input, textarea, select {
  min-height: var(--control-h);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:hover, textarea:hover, select:hover { border-color: var(--border); }
input:focus, textarea:focus, select:focus {
  background: var(--panel);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16);
}
input:disabled, textarea:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { min-height: 0; padding: 0; width: 16px; height: 16px; accent-color: var(--bordo); }
html[data-theme="dark"] input[type="checkbox"], html[data-theme="dark"] input[type="radio"] { accent-color: var(--gold); }
input[type="date"], input[type="month"], input[type="time"] { padding-right: 10px; }
::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
html[data-theme="dark"] ::-webkit-calendar-picker-indicator { filter: invert(0.92); opacity: 1; }

/* Arquivo: botão próprio em vez do cinza do sistema operacional. */
input[type="file"] { padding: 6px 6px; display: flex; align-items: center; font-size: 0.8125rem; color: var(--muted); width: 100%; max-width: 100%; min-width: 0; }
/* O display:flex acima anularia o atributo hidden (input de foto dentro do avatar). */
input[type="file"][hidden], [hidden] { display: none !important; }
input[type="file"]::file-selector-button {
  height: 32px; padding: 0 14px; margin-right: 12px;
  border: none; border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text);
  font-family: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 2px rgba(42, 20, 18, 0.1);
}
html[data-theme="dark"] input[type="file"]::file-selector-button { background: var(--bg); box-shadow: none; }
input[type="file"]::file-selector-button:hover { color: var(--heading); }

.a-field input, .a-field textarea, .a-field select,
.a-form-grid input, .a-form-grid textarea, .a-form-grid select,
.a-login-card input { width: 100%; }

.a-checklist {
  max-height: 200px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  background: var(--surface-2);
}
.a-checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  margin: 0;
  font-weight: 400;
  font-size: 0.875rem;
  cursor: pointer;
}
.a-checklist label + label { border-top: 1px solid var(--border); }

.a-error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; margin: 0 0 8px; }
.a-error:empty { margin: 0; min-height: 0; }
.a-hint { color: var(--muted); font-size: 0.8rem; margin: 12px 0 0; line-height: 1.45; }

/* ── Botões ────────────────────────────────────────────────────────────── */

.a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0 20px;
  background: var(--bordo);
  color: var(--on-brand);
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease, color .15s ease;
}
.a-btn:hover { background: var(--bordo-light); }
.a-btn:active { filter: brightness(.95); }
.a-btn:disabled { opacity: .5; cursor: not-allowed; }
html[data-theme="dark"] .a-btn { background: var(--gold); color: var(--bordo-dark); }
html[data-theme="dark"] .a-btn:hover { background: var(--gold-light); }
/* Ação principal da tela: o único degradê. */
.a-btn-destaque { background-image: var(--brand-gradient); }
.a-btn-destaque:hover { filter: brightness(1.12); }
html[data-theme="dark"] .a-btn-destaque { background-image: none; }

.a-btn-gold { background: var(--gold); color: var(--bordo-dark); }
.a-btn-gold:hover { background: var(--gold-light); }
.a-btn-ghost { background: var(--surface-2); color: var(--text); }
.a-btn-ghost:hover { background: var(--hover); color: var(--heading); }
html[data-theme="dark"] .a-btn-ghost { background: var(--surface-2); color: var(--text); }
html[data-theme="dark"] .a-btn-ghost:hover { background: #3a312e; color: var(--gold-light); }
.a-btn-danger { background: var(--danger-bg); color: var(--danger); }
.a-btn-danger:hover { background: var(--danger); color: #fff; }
html[data-theme="dark"] .a-btn-danger { background: var(--danger-bg); color: var(--danger); }
html[data-theme="dark"] .a-btn-danger:hover { background: var(--danger); color: #fff; }
.a-btn-sm { min-height: 36px; padding: 0 14px; font-size: 0.8125rem; border-radius: var(--radius-sm); }

/* ── Shell (sidebar + conteúdo) ────────────────────────────────────────── */

.a-shell { display: flex; min-height: 100vh; }
.a-sidebar {
  width: 248px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background:
    /* sem brilho radial no topo (Impeccable: "halo"); só o degradê de tom */
    linear-gradient(180deg, var(--bordo), var(--bordo-dark));
  color: #f5e9d8;
  padding: 28px 16px 20px;
  display: flex;
  flex-direction: column;
}
.a-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; margin: 0 12px 4px; }
.a-logo span { color: var(--gold-light); }
.a-sidebar .a-user { font-size: 0.8rem; color: rgba(245, 233, 216, 0.6); margin: 0 12px 32px; word-break: break-word; }
.a-nav a, .a-nav button {
  width: 100%;
  min-height: 42px;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: rgba(245, 233, 216, 0.82);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.a-nav a:hover, .a-nav button:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.a-nav a.active, .a-nav button.active { background: rgba(255, 255, 255, 0.11); color: #fff; font-weight: 600; }
.a-nav a.active svg, .a-nav button.active svg { color: var(--gold-light); opacity: 1; }
html[data-theme="dark"] .a-nav svg { opacity: 1; color: var(--gold-light); }
.a-sidebar .a-logout {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: #f5e9d8;
  border-radius: var(--radius-md);
  padding: 0 12px;
  min-height: var(--control-h);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s ease;
}
.a-sidebar .a-logout:hover { background: rgba(255, 255, 255, 0.12); }
.a-sidebar .a-theme-toggle { background: rgba(255, 255, 255, 0.06); color: #f5e9d8; }
.a-sidebar .a-theme-toggle:hover { background: rgba(255, 255, 255, 0.12); color: var(--gold-light); }

.a-main { flex: 1; min-width: 0; padding: 36px 44px 56px; max-width: 1240px; }
.a-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px 16px; }
/* Título de tela: semibold, não bold (bold é peça de marketing). */
.a-topbar h1 { font-size: 1.5rem; margin: 0; font-weight: 600; color: var(--text); }
.a-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Controle solto sobre o fundo da página (fora de card) ganha a superfície do card. */
.a-topbar .sx-trigger, .a-topbar input, .a-topbar select { background: var(--panel); box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .a-topbar .sx-trigger, html[data-theme="dark"] .a-topbar input { box-shadow: none; }

/* ── Painéis e tabelas ─────────────────────────────────────────────────── */

/* Bloco de conteúdo: fundo próprio, sem borda. Separação pela cor. */
.a-panel {
  background: var(--panel);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .a-panel { box-shadow: none; }
.a-panel h2 { font-size: 1.05rem; margin: 0 0 18px; font-weight: 600; color: var(--text); }
.a-panel h3 { font-size: 0.95rem; margin: 0; font-weight: 600; color: var(--text); }

.a-table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.a-table { width: 100%; border-collapse: collapse; background: transparent; }
.a-table th, .a-table td {
  text-align: left; padding: 12px; font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.a-table th:first-child, .a-table td:first-child { padding-left: 16px; }
.a-table th:last-child, .a-table td:last-child { padding-right: 16px; }
.a-table th {
  color: var(--muted); font-weight: 600; font-size: 0.72rem;
  letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: none;
}
.a-table th:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.a-table th:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.a-table tr:last-child td { border-bottom: none; }
.a-table tbody tr { transition: background .12s ease; }
.a-table tbody tr:hover td { background: var(--surface-subtle); }

.a-empty { color: var(--muted); text-align: center; padding: 40px 16px; font-size: 0.875rem; }

/* Abas de página: pílula com moldura, ativo preenchido. */
.a-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  width: fit-content;
  max-width: 100%;
}
html[data-theme="dark"] .a-tabs { box-shadow: none; }
.a-tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: none; height: 38px; padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem; font-weight: 500; color: var(--muted); cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.a-tabs button:hover { color: var(--text); background: var(--surface-subtle); }
.a-tabs button.active { color: var(--on-brand); background: var(--bordo); font-weight: 600; }
html[data-theme="dark"] .a-tabs button.active { color: var(--bordo-dark); background: var(--gold); }
.a-tabs button svg { width: 15px; height: 15px; opacity: 0.8; flex-shrink: 0; }
html[data-theme="dark"] .a-tabs button { color: #c4b4a6; }
html[data-theme="dark"] .a-tabs button svg { opacity: 1; color: var(--gold-light); }
html[data-theme="dark"] .a-tabs button.active svg { color: var(--bordo-dark); }

/* ── Stats do dashboard ────────────────────────────────────────────────── */

.a-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.a-stat-card {
  background: var(--panel);
  border-radius: var(--radius-xl);
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 118px;
}
html[data-theme="dark"] .a-stat-card { box-shadow: none; }
.a-stat-label { color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.35; }
.a-stat-value { color: var(--text); font-size: 1.85rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.a-stat-value-status { font-size: 1rem; font-weight: 600; letter-spacing: 0; display: flex; align-items: center; gap: 8px; }

/* Um destaque cheio por tela: o cartão mais importante (faturamento). */
.a-stat-card[data-destaque] { background-image: var(--brand-gradient); background-color: var(--bordo); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 14px 30px -18px rgba(0, 0, 0, 0.35); }
.a-stat-card[data-destaque] .a-stat-label { color: rgba(251, 243, 230, 0.68); }
.a-stat-card[data-destaque] .a-stat-value { color: #fff; }
.a-stat-card[data-destaque] .a-stat-icon { background: rgba(255, 255, 255, 0.12); color: var(--gold-light); }

/* Título-conclusão do dashboard (eyebrow + headline com tendência) */

.a-eyebrow { color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 6px; }
#dash-headline { max-width: 700px; line-height: 1.3; font-weight: 600; }
#dash-headline .trend-up { color: var(--success); }
#dash-headline .trend-down { color: var(--danger); }

.a-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; flex-shrink: 0; }
.a-status-dot.status-ok { background: var(--success); }
.a-status-dot.status-atencao { background: var(--gold); }
.a-status-dot.status-alerta { background: var(--danger); }

.a-footer { color: var(--muted); font-size: 0.78rem; padding-top: 4px; margin-top: 4px; line-height: 1.6; }

/* ── Formulários em grade (lançamento/insumo/ficha) ────────────────────── */

.a-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px 16px; align-items: end; }
.a-form-grid .a-field { margin-bottom: 0; }
/* Ficha técnica (19/10/2026): cada campo ocupa 3 faixas da grade (rótulo / campo / ajuda), assim o texto
   abaixo da foto ou o "CMV atual" não empurram o rótulo pra cima e os campos da linha ficam alinhados. */
#form-ficha { row-gap: 0; }
#form-ficha > * { margin-bottom: 18px; }
#form-ficha > :last-child { margin-bottom: 0; }
#form-ficha > .a-field { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; }
#form-ficha > .a-field > label { align-self: end; }
#form-ficha > .a-field > :not(label) { align-self: start; }
.a-form-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }

.a-table th.a-num, .a-table td.a-num { text-align: right; font-variant-numeric: tabular-nums; }
select#lanc-tipo:disabled + .sx-trigger, .sx:has(#lanc-tipo) .sx-trigger:disabled { opacity: .8; }

/* ── DRE ───────────────────────────────────────────────────────────────── */

td.valor-receita { color: var(--success); }
td.valor-despesa { color: var(--danger); }
.a-table td.valor-receita, .a-table td.valor-despesa { font-variant-numeric: tabular-nums; }
tr.dre-subtotal td { font-weight: 600; background: var(--gold-bg); color: var(--heading); border-bottom-color: transparent; }
tr.dre-final td { font-weight: 700; background: var(--bordo); color: #fff; font-size: 0.95rem; padding-top: 16px; padding-bottom: 16px; border-bottom: none; }
tr.dre-final td:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
tr.dre-final td:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; color: var(--gold-light); }
.a-table tbody tr.dre-final:hover td { background: var(--bordo); }
html[data-theme="dark"] tr.dre-final td, html[data-theme="dark"] .a-table tbody tr.dre-final:hover td { background: var(--gold); color: var(--bordo-dark); }
html[data-theme="dark"] tr.dre-final td:last-child { color: var(--bordo-dark); }
.dre-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.dre-header h2 { margin: 0 !important; }
.dash-total { font-size: 1rem; color: var(--muted); margin: 0 0 18px; }
.dash-total strong { display: block; margin-top: 4px; font-size: 1.85rem; font-weight: 700; color: var(--text); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }

/* ── Menu de 3 pontinhos ───────────────────────────────────────────────── */

.a-menu { position: relative; display: inline-block; }
.a-menu-btn {
  background: var(--surface-2);
  border: none;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
}
.a-menu-btn:hover { background: var(--hover); color: var(--heading); }
html[data-theme="dark"] .a-menu-btn { color: #d6c6b8; }
.a-menu-dropdown {
  position: fixed;
  background: var(--popover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border);
  min-width: 180px;
  padding: 6px;
  z-index: 50;
}
.a-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--text);
}
.a-menu-dropdown button:hover { background: var(--hover); }
.a-menu-dropdown button.a-menu-danger { color: var(--danger); }
.a-menu-dropdown button.a-menu-danger:hover { background: var(--danger-bg); }

/* ── Fichas técnicas ───────────────────────────────────────────────────── */

.a-itens-wrap { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.a-itens-wrap > div { width: 100%; }
.a-item-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; align-items: center; }
.a-item-row select, .a-item-row input, .a-item-row .sx { width: 100%; }
.a-result-box {
  grid-column: 1 / -1;
  background: var(--gold-bg);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  color: var(--text);
}
.a-result-box p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.a-result-box p strong { color: var(--heading); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Página "Mentorados": filtros + grade de cards ─────────────────────── */

.a-filtros-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.a-filtros-row input, .a-filtros-row select, .a-filtros-row .sx { min-width: 200px; flex: 1; }
.a-filtros-row input { background: var(--panel); box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .a-filtros-row input { box-shadow: none; }
.a-filtros-row .sx-trigger { background: var(--panel); box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .a-filtros-row .sx-trigger { box-shadow: none; }

.a-mentorados-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }

.a-mentorado-card {
  background: var(--panel); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: box-shadow .2s ease;
}
.a-mentorado-card:hover { box-shadow: 0 2px 4px rgba(42, 20, 18, 0.05), 0 18px 40px -20px rgba(42, 20, 18, 0.3); }
html[data-theme="dark"] .a-mentorado-card { box-shadow: none; }
.a-mentorado-capa { position: relative; height: 104px; background: var(--surface-2); }
.a-mentorado-logo { width: 100%; height: 100%; object-fit: cover; display: block; }
.a-mentorado-logo-vazio {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--brand-gradient);
  color: var(--gold-light); font-size: 2rem; font-weight: 700;
}
.a-mentorado-menu { position: absolute; top: 10px; right: 10px; }
.a-mentorado-menu .a-menu-btn { background: rgba(0, 0, 0, 0.35); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.a-mentorado-menu .a-menu-btn:hover { background: rgba(0, 0, 0, 0.55); }
.a-mentorado-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.a-mentorado-body h3 { margin: 0 0 2px; font-size: 1rem; font-weight: 600; color: var(--text); }
.a-mentorado-consultor { margin: 0 0 10px; font-size: 0.8125rem; color: var(--muted); }
.a-mentorado-badges { margin-bottom: 10px; }
.a-mentorado-meta { margin: 0 0 14px; font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; line-height: 1.5; }
.a-mentorado-body > .a-btn, .a-mentorado-body > button { margin-top: auto; }

.a-logo-placeholder {
  width: 88px; height: 88px; border-radius: var(--radius-lg); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; text-align: center;
  margin-top: 0;
}

/* Avatar clicável na tabela de Membros (upload de foto) */

.a-avatar-upload {
  display: block; width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  cursor: pointer; flex-shrink: 0; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--border);
}
.a-avatar-upload img { width: 100%; height: 100%; object-fit: cover; display: block; }
.a-avatar-vazio {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--bordo-bg); color: var(--heading); font-weight: 700; font-size: 0.85rem;
}
.a-avatar-upload:hover { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--gold); }

/* ── Modal ─────────────────────────────────────────────────────────────── */

.a-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  z-index: 100;
}
.a-modal-box {
  background: var(--popover);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.a-modal-box h2, .a-modal-box h3 { margin-top: 0; font-weight: 600; }
.a-modal-box p { margin: 0 0 22px; color: var(--text); line-height: 1.5; }
.a-modal-box .a-actions { justify-content: flex-end; }

#crop-modal .a-modal-box { max-width: 460px; }
.a-crop-wrap { max-height: 360px; margin-bottom: 20px; background: #1b1615; border-radius: var(--radius-md); overflow: hidden; }
.a-crop-wrap img { display: block; max-width: 100%; }

/* Aviso de confirmação de e-mail (topo do painel) */
.a-email-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap; padding: 10px 20px; text-align: center;
  background: var(--gold); color: var(--bordo-dark); font-weight: 600; font-size: 0.875rem;
}
.a-email-banner .a-btn { flex-shrink: 0; background: rgba(42, 11, 14, 0.12); color: var(--bordo-dark); }
.a-email-banner .a-btn:hover { background: rgba(42, 11, 14, 0.2); }

/* ── Seletor próprio (substitui o <select> nativo, ver select.js) ──────── */

.sx { position: relative; display: block; min-width: 0; }
.sx > select { position: absolute !important; inset: 0; opacity: 0 !important; pointer-events: none !important; width: 100% !important; height: 100% !important; min-height: 0 !important; }
.sx-trigger {
  width: 100%;
  min-height: var(--control-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit; font-size: 0.8125rem; text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.sx-trigger:hover { border-color: var(--border); }
.sx-trigger:focus-visible, .sx.sx-open .sx-trigger { outline: none; background: var(--panel); border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.16); }
.sx-trigger:disabled { opacity: .55; cursor: not-allowed; }
.sx-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-value.sx-placeholder { color: var(--muted); }
.sx-chevron { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); transition: transform .18s ease; }
.sx.sx-open .sx-chevron { transform: rotate(180deg); }
html[data-theme="dark"] .sx-chevron { color: #cdbdaf; }
.sx-list {
  position: fixed;
  z-index: 200;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  background: var(--popover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--border);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.sx-group { padding: 10px 10px 4px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sx-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem; color: var(--text);
  cursor: pointer;
  user-select: none;
}
.sx-option-label { flex: 1; min-width: 0; }
.sx-option.sx-active { background: var(--hover); }
.sx-option[aria-selected="true"] { font-weight: 600; color: var(--heading); }
.sx-option[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.sx-check { width: 15px; height: 15px; flex-shrink: 0; color: var(--gold); visibility: hidden; }
.sx-option[aria-selected="true"] .sx-check { visibility: visible; }
.sx-empty { padding: 12px 10px; font-size: 0.8125rem; color: var(--muted); }

/* Seleção múltipla com busca (mentorados do Novo membro): etiquetas + campo + lista que abre logo abaixo */
.a-multi-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.a-multi-chips:not(:empty) { margin-bottom: 8px; }
.a-multi-chip {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 100%;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8rem; color: var(--heading);
}
.a-multi-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-multi-chip button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.a-multi-chip button:hover { background: var(--hover); color: var(--heading); }
.a-multi-campo { position: relative; }
.a-multi-campo input { padding-right: 38px; }
.a-multi-campo .sx-chevron { position: absolute; right: 12px; top: 50%; margin-top: -8px; pointer-events: none; }
.a-multi.a-multi-aberto .sx-chevron { transform: rotate(180deg); }
.a-multi-lista {
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--border);
}
.a-multi-lista .sx-option[aria-selected="true"] .sx-check { visibility: visible; }

/* ── Menu sanduíche (mobile) ───────────────────────────────────────────── */

.a-mobile-topbar { display: none; }
.a-sidebar-backdrop { display: none; }
.a-sidebar-close { display: none; }

@media (max-width: 720px) {
  .a-mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(180deg, var(--bordo), var(--bordo-dark));
    color: #f5e9d8;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .a-mobile-topbar .a-logo { margin: 0; }

  .a-hamburger-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: var(--radius-md);
    width: var(--control-h);
    height: var(--control-h);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f5e9d8;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
  }
  .a-hamburger-btn:hover { background: rgba(255, 255, 255, 0.14); }
  .a-hamburger-btn svg { width: 20px; height: 20px; }

  .a-sidebar-backdrop.a-sidebar-open {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 50;
  }

  .a-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 272px;
    max-width: 84vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 60;
  }
  .a-sidebar.a-sidebar-open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35);
  }

  .a-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: var(--radius-md);
    color: #f5e9d8;
    cursor: pointer;
    padding: 0;
  }
  .a-sidebar-close svg { width: 16px; height: 16px; }

  .a-main { padding: 20px 16px 40px; }
  .a-panel { padding: 18px 16px; border-radius: var(--radius-lg); }
  .a-topbar h1 { font-size: 1.3rem; }
  /* Abas: todas visíveis, quebrando em linhas, em vez de uma faixa com rolagem escondida. */
  .a-tabs { width: 100%; flex-wrap: wrap; overflow-x: visible; }
  .a-tabs button { flex: 1 1 auto; justify-content: center; }
  /* Menu lateral: o nome não pode correr por baixo do botão de fechar. */
  .a-sidebar .a-logo { width: fit-content; max-width: calc(100% - 64px); }
  .a-sidebar .a-user { padding-right: 52px; }

  /* Tabelas de dados viram cartões (rótulo à esquerda, valor à direita; ações embaixo).
     Os rótulos vêm do cabeçalho da coluna, copiados por tabelas.js. */
  .a-table-wrap { margin: 0; padding: 0; overflow-x: visible; }
  .a-table.a-table-cards, .a-table-cards tbody, .a-table-cards tr, .a-table-cards td { display: block; width: 100%; }
  .a-table-cards thead { display: none; }
  /* Cartão: superfície do card quando está solto na página; um degrau acima quando já está dentro de painel. */
  .a-table-cards tr { background: var(--panel); box-shadow: var(--shadow-sm); border-radius: var(--radius-lg); padding: 6px 14px; margin-bottom: 10px; }
  .a-panel .a-table-cards tr { background: var(--surface-2); box-shadow: none; }
  html[data-theme="dark"] .a-table-cards tr { box-shadow: none; }
  /* Botão neutro dentro do cartão precisa de contraste com o fundo do cartão. */
  .a-panel .a-table-cards .a-btn-ghost { background: var(--panel); }
  .a-table-cards tbody tr:hover td { background: transparent; }
  .a-table.a-table-cards td, .a-table.a-table-cards td:first-child, .a-table.a-table-cards td:last-child {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 9px 0; border-bottom: 1px solid var(--border); white-space: normal; text-align: right; min-width: 0;
  }
  .a-table-cards tr td:last-child { border-bottom: none; }
  .a-table-cards td::before {
    content: attr(data-label); flex-shrink: 0; max-width: 45%; text-align: left;
    color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  }
  .a-table-cards td[data-label=""]::before { display: none; }
  /* Coluna de ações (sem título): botões lado a lado, alinhados à esquerda, ocupando a linha. */
  .a-table-cards td[data-label=""] { justify-content: flex-start !important; flex-wrap: wrap; gap: 8px !important; padding-top: 12px !important; }
  .a-table-cards td[data-label=""] .a-btn { flex: 1 1 auto; }
  .a-table-cards td[colspan] { justify-content: center; text-align: center; }
  .a-table-cards td small { display: block; }

  /* DRE: nome e valor lado a lado; % da receita e variação numa linha menor embaixo. */
  #tabela-dre thead { display: none; }
  #tabela-dre, #tabela-dre tbody { display: block; width: 100%; }
  #tabela-dre tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  #tabela-dre td, #tabela-dre td:first-child, #tabela-dre td:last-child { padding: 0; border: none; white-space: normal; background: none; }
  #tabela-dre td:nth-child(1) { grid-column: 1; }
  #tabela-dre td:nth-child(2) { grid-column: 2; text-align: right; font-weight: 600; }
  #tabela-dre td:nth-child(3), #tabela-dre td:nth-child(4) { grid-column: 1 / -1; text-align: left; font-size: 0.75rem; color: var(--muted); padding-top: 2px; }
  #tabela-dre td:nth-child(3)::before { content: '% da receita: '; }
  #tabela-dre td:nth-child(4)::before { content: 'vs. mês anterior: '; }
  #tabela-dre td:nth-child(3), #tabela-dre td:nth-child(4) { display: inline; }
  #tabela-dre tr.dre-subtotal { background: var(--gold-bg); border-radius: var(--radius-md); border-bottom: none; margin: 2px 0; }
  #tabela-dre tr.dre-final { background: var(--bordo); border-radius: var(--radius-md); margin-top: 6px; }
  #tabela-dre tr.dre-final td { color: #fff; }
  #tabela-dre tr.dre-final td:nth-child(3), #tabela-dre tr.dre-final td:nth-child(4) { color: rgba(255,255,255,.75); }
  html[data-theme="dark"] #tabela-dre tr.dre-final { background: var(--gold); }
  html[data-theme="dark"] #tabela-dre tr.dre-final td { color: var(--bordo-dark); }
  /* No celular o campo fica em 16px: abaixo disso o iPhone dá zoom ao focar. */
  input, textarea, select, .sx-trigger, .sx-option { font-size: 16px; }
  /* Botão ocupa a linha no celular (o dedo agradece). */
  .a-form-actions .a-btn { flex: 1; }
  .a-item-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Fichas técnicas em cards com foto, agrupadas por categoria (13/10/2026) */
.a-fichas-grupo + .a-fichas-grupo { margin-top: 28px; }
.a-fichas-grupo h3 {
  margin: 0 0 14px; font-size: 1rem; font-weight: 700; color: var(--heading);
  display: flex; align-items: center; gap: 8px;
}
.a-fichas-grupo h3 span {
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border-radius: 999px; padding: 2px 9px;
}
.a-fichas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.a-ficha-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .2s ease;
}
.a-ficha-card:hover { box-shadow: var(--shadow-sm); }
.a-ficha-foto { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--surface-2); }
.a-ficha-foto-vazia {
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-gradient); color: var(--gold-light); font-size: 2.2rem; font-weight: 700;
}
.a-ficha-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.a-ficha-body h4 { margin: 0 0 10px; font-size: 0.98rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.a-ficha-valores { margin: 0 0 14px; display: grid; gap: 6px; }
.a-ficha-valores div { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.a-ficha-valores dt { font-size: 0.78rem; color: var(--muted); }
.a-ficha-valores dd { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.a-ficha-valores .a-badge { font-size: 0.7rem; }
.a-ficha-acoes { margin-top: auto; display: flex; gap: 8px; }
.a-ficha-acoes .a-btn { flex: 1; }

.a-ficha-foto-edit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.a-ficha-foto-edit img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.a-ficha-foto-acoes { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.a-ficha-foto-acoes input[type="file"] { max-width: 100%; }

@media (max-width: 720px) {
  .a-fichas-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
}

/* Calls do mentorado (22/10/2026) */
.a-status-dot.status-neutro { background: var(--muted); }
.a-label-like { display: block; font-weight: 600; font-size: 0.8125rem; margin-bottom: 8px; }
.a-hint-inline { color: var(--muted); font-size: 0.8rem; }
.enc-linha { display: grid; grid-template-columns: 1fr 150px 160px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.enc-item { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; font-weight: 400; }
.enc-item input { margin-top: 3px; flex-shrink: 0; }
.call-cancelada td { color: var(--muted); }
@media (max-width: 720px) {
  .enc-linha { grid-template-columns: 1fr; }
}
.call-cel { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .call-cel { flex: 1 1 auto; text-align: left; }
}
/* Calls capturadas do Meet (22/10/2026) */
.captura-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-top: 10px; background: var(--surface-2); }
.captura-acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.captura-acoes select { min-width: 220px; flex: 1 1 220px; }

/* Produtividade: a tabela tem texto longo (carteira, graus, atas); deixa quebrar linha para caber no painel. */
#tabela-produtividade th, #tabela-produtividade td { white-space: normal; vertical-align: top; }
#tabela-produtividade th { white-space: nowrap; }

/* ── Visualizador de documentos (24/10/2026) ───────────────────────────── */
.viz-caixa { max-width: 1100px; width: 100%; height: 100%; max-height: 92vh; display: flex; flex-direction: column; padding: 16px 20px; overflow: hidden; }
.viz-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex: 0 0 auto; }
.viz-titulo { margin: 0; font-size: 1rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-topo .a-actions { flex: 0 0 auto; }
.viz-corpo { flex: 1 1 auto; min-height: 0; background: var(--surface-2); border-radius: var(--radius-md); overflow: auto; display: flex; align-items: center; justify-content: center; }
.viz-corpo iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viz-corpo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viz-corpo .viz-texto { margin: 0; padding: 16px; width: 100%; align-self: flex-start; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 0.875rem; line-height: 1.55; }
.viz-corpo .viz-aviso { margin: 0; padding: 24px; text-align: center; }
@media (max-width: 640px) { .viz-caixa { padding: 12px; max-height: 96vh; } .viz-topo { flex-wrap: wrap; } }

/* ═══════════════════════════════════════════════════════════════════════
   Dashboard novo (26/10/2026): grade de widgets, indicadores com variação, ranking, avisos, medidor.
   Só variáveis do theme.css, então claro e escuro funcionam sozinhos.
   ═══════════════════════════════════════════════════════════════════════ */

.a-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.4; max-width: 720px; }
.a-sub .trend-up { color: var(--success); font-weight: 600; }
.a-sub .trend-down { color: var(--danger); font-weight: 600; }

/* Grade de 12 colunas. A ordem é do usuário (style.order vem do JS); "dense" fecha os buracos. */
.dash-grade { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; grid-auto-flow: dense; align-items: stretch; }
.dash-grade > .a-panel { margin-bottom: 0; }
.dash-grade .a-stats-grid { margin-bottom: 0; }
.dash-w-4 { grid-column: span 4; } .dash-w-6 { grid-column: span 6; } .dash-w-8 { grid-column: span 8; } .dash-w-12 { grid-column: span 12; }
.dash-off { display: none !important; }
@media (max-width: 1100px) { .dash-w-8 { grid-column: span 12; } .dash-w-4 { grid-column: span 6; } }
@media (max-width: 760px) { .dash-w-4, .dash-w-6 { grid-column: span 12; } }

.a-panel-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.a-panel-topo h2 { margin: 0; }
.a-panel-topo .a-hint { margin: 4px 0 0; }
.a-panel-valor { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Gráficos: a altura é do contêiner (o Chart.js não mexe nela). */
.a-chart { position: relative; height: 270px; }
.a-chart-sm { height: 220px; }
.a-chart-gauge { height: 150px; margin-top: 4px; }
.a-chart-rosca { height: 180px; width: 180px; flex-shrink: 0; }
.a-empty-sm { padding: 22px 8px; }

/* Indicadores */
.a-kpi { background: var(--panel); border-radius: var(--radius-xl); padding: 20px 22px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; min-height: 138px; }
html[data-theme="dark"] .a-kpi { box-shadow: none; }
.a-kpi-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.a-kpi-rotulo { color: var(--muted); font-size: 0.78rem; font-weight: 600; line-height: 1.3; }
.a-kpi-icone { width: 34px; height: 34px; border-radius: 50%; background: var(--bordo-bg); color: var(--heading); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.a-kpi-icone svg { width: 17px; height: 17px; }
.a-kpi-valor { color: var(--text); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.a-kpi-base { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.a-kpi-sub { color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.a-kpi-destaque { background-image: var(--brand-gradient); background-color: var(--bordo); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 14px 30px -18px rgba(0, 0, 0, 0.35); }
.a-kpi-destaque .a-kpi-rotulo, .a-kpi-destaque .a-kpi-sub { color: rgba(251, 243, 230, 0.72); }
.a-kpi-destaque .a-kpi-valor { color: #fff; }
.a-kpi-destaque .a-kpi-icone { background: rgba(255, 255, 255, 0.14); color: var(--gold-light); }

/* Chip de variação (↑ 12%) */
.a-delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.a-delta-up { background: var(--success-bg); color: var(--success); }
.a-delta-down { background: var(--danger-bg); color: var(--danger); }
.a-delta-flat { background: var(--surface-2); color: var(--muted); }
.a-delta-novo { background: var(--info-bg); color: var(--info); }
.a-kpi-destaque .a-delta-up { background: rgba(92, 193, 124, 0.2); color: #8fe0a9; }
.a-kpi-destaque .a-delta-down { background: rgba(224, 102, 94, 0.22); color: #ffb3ad; }
.a-kpi-destaque .a-delta-flat, .a-kpi-destaque .a-delta-novo { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* Ranking */
.a-rank { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 11px 10px; margin: 0; border: 0; background: transparent; border-radius: var(--radius-md); text-align: left; cursor: pointer; font: inherit; color: inherit; transition: background .15s ease; }
.a-rank:hover { background: var(--hover); }
.a-rank:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.a-rank-pos { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.a-rank:nth-child(1) .a-rank-pos { background: var(--gold-bg); color: var(--bronze); }
html[data-theme="dark"] .a-rank:nth-child(1) .a-rank-pos { color: var(--gold-light); }
.a-rank-meio { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.a-rank-nome { font-weight: 600; font-size: 0.9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-rank-barra { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: block; }
.a-rank-barra > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-light), var(--gold)); }
.a-rank-dir { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-variant-numeric: tabular-nums; }
.a-rank-dir strong { font-size: 0.92rem; color: var(--text); }
.a-rank-dir span { color: var(--muted); font-size: 0.74rem; display: inline-flex; align-items: center; gap: 6px; }

/* Meta de calls */
.a-meta-texto { text-align: center; margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.a-meta-texto strong { color: var(--text); }
.a-pos { color: var(--success); font-weight: 600; }

/* Atenção agora */
.a-aviso { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; margin: 0 0 8px; border: 0; border-radius: var(--radius-md); background: var(--surface-2); text-align: left; cursor: pointer; font: inherit; color: var(--text); transition: background .15s ease; }
.a-aviso:last-child { margin-bottom: 0; }
.a-aviso:hover { background: var(--hover); }
.a-aviso:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.a-aviso-ponto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.a-aviso-danger .a-aviso-ponto { background: var(--danger); } .a-aviso-warning .a-aviso-ponto { background: var(--gold); } .a-aviso-info .a-aviso-ponto { background: var(--info); }
.a-aviso-texto { flex: 1; font-size: 0.875rem; line-height: 1.35; font-weight: 500; }
.a-aviso-seta { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.a-aviso-seta svg { width: 16px; height: 16px; }

/* Engajamento */
.a-eng { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.a-legenda { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 10px; }
.a-legenda li { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text); }
.a-legenda li strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.a-leg-cor { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Personalizar (widgets) */
.a-widget-linha { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.a-widget-linha + .a-widget-linha { border-top: 1px solid var(--border); }
.a-widget-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.a-widget-info strong { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.a-widget-info span { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.a-widget-mover { display: flex; gap: 6px; }
.a-widget-mover .a-btn-sm { min-height: 32px; width: 32px; padding: 0; justify-content: center; }
.a-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; display: inline-block; }
.a-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.a-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); transition: background .15s ease; box-shadow: inset 0 0 0 1px var(--border); }
.a-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform .15s ease; }
.a-switch input:checked + span { background: var(--gold); box-shadow: none; }
.a-switch input:checked + span::after { transform: translateX(18px); }
.a-switch input:disabled { cursor: not-allowed; }
.a-switch input:disabled + span { opacity: .55; }
.a-switch input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
