/* Find Connections — visual de sistema de dados, com modo claro e escuro.
   As cores ficam nas variáveis abaixo; o tema é escolhido em <html data-theme>. */
:root,
[data-theme="light"] {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #e9edf3;
  --line: #dde2e9;
  --line-strong: #c9d0da;
  --ink: #18212d;
  --ink-2: #3b4757;
  --muted: #6b7686;
  --placeholder: #98a2b0;
  --primary: #1d5fc4;
  --primary-hover: #184fa4;
  --primary-soft: #e8f0fc;
  --link: #1d5fc4;
  --bar: #1d5fc4;
  --bar-track: #e3e9f2;
  --head-bg: #13243f;
  --head-ink: #b9c5d8;
  --head-line: rgba(255, 255, 255, .12);
  --gold: #a87a18;
  --silver: #6b7686;
  --bronze: #9a5b2e;
  --danger: #c0392b;
  --warn-bg: #fff7e6;
  --warn-line: #f0d9a8;
  --warn-ink: #7a5a12;
  --shadow: 0 10px 28px rgba(19, 36, 63, .14);
  --overlay: rgba(19, 36, 63, .45);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e1520;
  --surface: #151e2b;
  --surface-2: #1a2535;
  --surface-3: #223047;
  --line: #243145;
  --line-strong: #304058;
  --ink: #e3e9f1;
  --ink-2: #b8c3d2;
  --muted: #7f8ca0;
  --placeholder: #5c6a80;
  --primary: #3b7ae8;
  --primary-hover: #2f68cc;
  --primary-soft: rgba(59, 122, 232, .15);
  --link: #7ea6f2;
  --bar: #3b7ae8;
  --bar-track: #223047;
  --head-bg: #0a1018;
  --head-ink: #8e9bb0;
  --head-line: rgba(255, 255, 255, .08);
  --gold: #d9b45f;
  --silver: #b4bfcc;
  --bronze: #c48558;
  --danger: #f08a80;
  --warn-bg: rgba(209, 165, 74, .08);
  --warn-line: rgba(209, 165, 74, .3);
  --warn-ink: #dcc48e;
  --shadow: 0 12px 28px rgba(0, 0, 0, .4);
  --overlay: rgba(6, 10, 16, .75);
  color-scheme: dark;
}
/* Cantos: cartões mais arredondados, controles um pouco menos. */
:root { --radius: 8px; --radius-lg: 14px; --radius-pill: 999px; --card-shadow: 0 1px 2px rgba(19, 36, 63, .05), 0 4px 14px rgba(19, 36, 63, .05); font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif; }
[data-theme="dark"] { --card-shadow: 0 1px 2px rgba(0, 0, 0, .3); }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; font-size: 14px; }
.brand-large { font-size: 17px; }
.brand-logo { display: block; flex: none; border-radius: 8px; }
.brand { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.brand-large { font-size: 22px; gap: 12px; }
.brand em { font-style: normal; color: #7ea6f2; }

/* Botões */
.button { height: 36px; border: 1px solid transparent; border-radius: var(--radius); padding: 0 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: background-color .12s ease, border-color .12s ease; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); }
.button-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.button-secondary:hover:not(:disabled) { border-color: var(--muted); }
.button-large { width: 100%; height: 42px; font-size: 15px; }
.link-button, .text-button { border: 0; background: transparent; color: var(--link); font-weight: 600; padding: 0; font-size: 12px; }
.link-button:hover, .text-button:hover { text-decoration: underline; }

/* Campos */
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 8px 12px; outline: none; transition: border-color .12s ease; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #0f1722; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input:disabled { opacity: .65; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.75); }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; }
.form-error { min-height: 16px; margin: 0; color: var(--danger); font-size: 12px; }

/* Login */
.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-brand-panel { background: var(--head-bg); color: #fff; padding: clamp(32px, 6vw, 80px); display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; }
.login-copy { max-width: 600px; }
.login-copy h1 { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.25; font-weight: 600; margin: 0 0 16px; }
.login-copy p { color: var(--head-ink); line-height: 1.6; font-size: 15px; margin: 0; }
.data-note { color: var(--head-ink); font-size: 12px; opacity: .8; }
.login-form-panel { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; display: grid; gap: 14px; box-shadow: var(--card-shadow); }
.login-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.signup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.signup-avatar { border: 0; padding: 0; margin: 0; display: flex; gap: 10px; }
.signup-avatar legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 5px; }
.avatar-option.small { flex-direction: row; display: flex; align-items: center; gap: 10px; padding: 8px 12px; justify-items: start; }
.avatar-option.small .avatar { width: 34px; height: 34px; }
.login-help .link-button { font-size: 12px; }
.login-card h2 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-card p { margin: 0; }
.login-card label, .account-fields label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.login-help { font-size: 12px; color: var(--muted); text-align: center; }

/* Manutenção */
.maintenance-view { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.maintenance-card { width: min(540px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; text-align: center; }
.maintenance-icon { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-ink); font-size: 20px; font-weight: 700; }
.maintenance-card h1 { font-size: 20px; font-weight: 600; }
.maintenance-card p { color: var(--muted); line-height: 1.6; }

/* Cabeçalho (sempre azul-marinho, nos dois temas) */
.app-header { height: 56px; display: flex; align-items: center; gap: 28px; padding: 0 20px; background: var(--head-bg); color: var(--head-ink); position: sticky; top: 0; z-index: 30; }
.app-header .brand { color: #fff; }
.top-nav { display: flex; align-items: stretch; height: 100%; }
.nav-tab { white-space: nowrap; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--head-ink); font-weight: 600; padding: 0 13px; display: inline-flex; align-items: center; gap: 6px; }
.nav-tab:hover { color: #fff; }
.nav-tab.active { color: #fff; border-bottom-color: #fff; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 17px; padding: 0 6px; border-radius: 3px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 11px; font-weight: 500; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }
/* Consultas do mês no topo: sempre à vista, leva para Planos. */
.header-usage { display: grid; grid-template-columns: auto auto; grid-template-rows: auto 5px; column-gap: 10px; row-gap: 4px; align-items: center; height: 40px; padding: 4px 14px; border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius-pill); background: rgba(255, 255, 255, .07); color: #fff; }
.header-usage:hover { background: rgba(255, 255, 255, .12); }
.hu-label { font-size: 12px; color: var(--head-ink); font-weight: 600; }
.header-usage strong { white-space: nowrap; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.hu-bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.hu-bar i { display: block; height: 100%; width: 0; background: #6fa3ff; border-radius: 3px; transition: width .3s ease; }
.header-usage.is-high .hu-bar i { background: #f0b44c; }
.header-usage.is-full .hu-bar i { background: #f07a6e; }
.theme-toggle { white-space: nowrap; height: 32px; border: 1px solid var(--head-line); border-radius: var(--radius); background: transparent; color: var(--head-ink); padding: 0 10px; font-size: 12px; font-weight: 600; }
.theme-toggle:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.user-menu { border: 0; background: transparent; display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: var(--radius); color: #fff; }
.user-menu:hover { background: rgba(255, 255, 255, .06); }
.caret { color: var(--head-ink); font-size: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; }
.avatar svg, .avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar-xl { width: 96px; height: 96px; }
.user-menu-copy { display: grid; text-align: left; line-height: 1.25; max-width: 240px; }
.user-menu-copy strong { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-copy small { font-size: 11px; color: var(--head-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-pill { font-weight: 600; }
.plan-pill.ouro { color: #d9b45f; }
.plan-pill.prata { color: #c4ccd8; }
.plan-pill.bronze { color: #d49a6a; }
.dropdown { position: absolute; right: 0; top: 50px; width: 200px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 4px; z-index: 40; box-shadow: var(--shadow); }
.dropdown button { width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 3px; color: var(--ink); }
.dropdown button:hover { background: var(--surface-2); }

/* Estrutura das páginas */
.subhead { background: var(--surface); border-bottom: 1px solid var(--line); padding: 18px clamp(16px, 2.5vw, 40px); }
.subhead:has(.report-tabs) { padding-bottom: 0; }
.crumb { font-size: 12px; color: var(--muted); }
.crumb-link { border: 0; background: none; padding: 0; color: var(--link); font: inherit; }
.crumb-link:hover { text-decoration: underline; }
.titlebar { display: flex; align-items: flex-end; gap: 14px; margin-top: 4px; flex-wrap: wrap; }
.titlebar h1 { font-size: 24px; font-weight: 600; margin: 0; max-width: 900px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titlebar .meta { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.titlebar .meta strong { color: var(--ink-2); font-weight: 600; }
.heading-actions { margin-left: auto; display: flex; gap: 8px; }
/* Ocupa a largura toda da janela (sem teto fixo), com respiro proporcional nas bordas. */
.page { padding: 22px clamp(16px, 2.5vw, 40px) 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); min-width: 0; box-shadow: var(--card-shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: baseline; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head .muted { font-size: 12px; }
.card-head .link-button { margin-left: auto; }
.card h3 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.card-head h3 { margin: 0; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.card-title h3 { margin: 0; }

/* Nova análise */
/* Consultas do mês em destaque no topo da Nova análise. */
.usage-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center; padding: 12px 22px; margin-bottom: 14px; background: linear-gradient(100deg, var(--primary-soft), var(--surface) 70%); }
.uh-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.uh-numbers { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.uh-numbers strong { font-size: 32px; line-height: 1.05; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .uh-numbers strong { color: var(--link); }
.uh-numbers span { font-size: 16px; color: var(--muted); }
.uh-bar-wrap { display: grid; gap: 8px; }
.uh-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }
.uh-foot .link-button { font-size: 13px; }
.usage-hero.is-high .progress span { background: #d99a2b; }
.usage-hero.is-full .progress span { background: var(--danger); }
.usage-hero.is-full .uh-numbers strong { color: var(--danger); }
.filters-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 24vw, 420px); gap: 18px; align-items: start; }
.form-card { overflow: visible; }
.form-row { display: grid; grid-template-columns: clamp(180px, 14vw, 230px) minmax(0, 1fr); gap: 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); align-items: start; position: relative; }
.form-row > label { font-weight: 600; padding-top: 6px; }
.form-row > label small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.field { display: grid; gap: 6px; min-width: 0; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 34px; }
.input-clear { position: absolute; right: 6px; top: 7px; width: 24px; height: 24px; border-radius: 3px; border: 0; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; }
.input-clear:hover { color: var(--ink); background: var(--surface-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; background: var(--primary-soft); color: var(--ink); border-radius: var(--radius-pill); padding: 4px 5px 4px 12px; font-size: 13px; }
/* Modo "todos menos": seletor discreto acima do campo e chips em vermelho. */
.mode-toggle { display: inline-flex; justify-self: start; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 2px; background: var(--surface-2); }
.mode-btn { border: 0; background: transparent; color: var(--muted); padding: 3px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; }
.mode-btn:hover { color: var(--ink); }
.mode-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.mode-btn[data-mode="exclude"].active { background: var(--danger); color: #fff; }
.is-exclude input:not([type="date"]) { border-color: color-mix(in srgb, var(--danger) 55%, var(--line-strong)); }
.chip.chip-exclude { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); text-decoration: none; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: transparent; color: var(--muted); width: 20px; height: 20px; border-radius: 50%; padding: 0; font-size: 14px; line-height: 1; }
.chip button:hover { color: var(--ink); background: var(--line); }
.suggestions { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); max-height: 280px; overflow: auto; padding: 4px; box-shadow: var(--shadow); }
.suggestions-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px 8px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.suggestions-head button { border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 3px; font-size: 16px; line-height: 1; }
.suggestions-head button:hover { color: var(--ink); background: var(--surface-3); }
.suggestions .suggestion { display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: 3px; background: transparent; color: var(--ink); font-size: 13px; }
.suggestions .suggestion:hover, .suggestions .suggestion.active { background: var(--primary-soft); }
.date-grid { display: flex; align-items: center; gap: 8px; }
.date-grid input { width: 180px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.preset { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: var(--radius-pill); padding: 6px 14px; font-size: 13px; }
.preset:hover { border-color: var(--muted); color: var(--ink); }
.preset.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); font-weight: 600; }
[data-theme="dark"] .preset.active { color: var(--link); }
.form-foot { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: center; padding: 16px 22px; background: var(--surface-2); border-top: 1px solid var(--line); margin-top: -1px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.form-foot .form-error { text-align: right; }
.form-foot .button { height: 42px; padding: 0 22px; font-size: 15px; }
#searchButton { min-width: 160px; }
.foot-note { margin: 0; color: var(--muted); font-size: 13px; }
.progress-xl { height: 12px; border-radius: 6px; }
.progress-xl span { border-radius: 6px; }
.usage-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.usage-line strong { color: var(--ink); font-weight: 600; }
.progress { height: 4px; background: var(--bar-track); border-radius: 2px; overflow: hidden; }
.progress-lg { height: 6px; }
.progress span { display: block; height: 100%; width: 0; background: var(--bar); transition: width .3s ease; }
.side-col { display: grid; gap: 18px; }
.recent-list { display: grid; }
.recent-empty { margin: 0; padding: 12px 14px; font-size: 12px; line-height: 1.5; }
.recent-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 11px 18px; color: var(--ink); }
.recent-item:last-child { border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.recent-item:hover { background: var(--surface-2); }
.recent-item span { display: grid; gap: 2px; min-width: 0; flex: 1; }
.recent-item strong { font-weight: 600; color: var(--link); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item small { color: var(--muted); font-size: 11px; }
.recent-item em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tip { margin: 0; padding: 14px 18px; color: var(--ink-2); line-height: 1.6; font-size: 13px; }
.tip b { color: var(--ink); }

/* Estado vazio */
.empty-state { min-height: 50vh; display: grid; place-items: center; align-content: center; text-align: center; max-width: 520px; margin: auto; }
.empty-state h1 { font-size: 20px; font-weight: 600; margin: 0 0 6px; }
.empty-state p { color: var(--muted); line-height: 1.6; margin: 0 0 16px; }

/* Relatórios */
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.active-filters:empty { display: none; }
.filter-tag { font-size: 12px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-2); }
.filter-tag b { color: var(--muted); font-weight: 400; }
.report-tabs { display: flex; gap: 2px; margin-top: 12px; }
.report-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 600; padding: 8px 14px 9px; }
.report-tab:hover { color: var(--ink); }
.report-tab.active { color: var(--ink); border-bottom-color: var(--primary); }
.notice { padding: 8px 12px; border-radius: var(--radius); margin: 0 0 14px; font-size: 12px; line-height: 1.5; }
.notice.warning { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 18px; box-shadow: var(--card-shadow); }
.kpi { padding: 16px 20px; border-left: 1px solid var(--line); display: grid; gap: 1px; min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi strong { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.time-chart { display: flex; align-items: stretch; gap: 10px; height: 300px; padding: 14px 16px 10px; }
.tc-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tc-track { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.tc-track em { font-style: normal; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tc-bar { width: 100%; max-width: 56px; background: var(--bar); border-radius: 5px 5px 0 0; }
.tc-col small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.chart-empty { margin: auto; }
.insight-list { list-style: none; margin: 0; padding: 4px 0; }
.insight-list li { padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--ink-2); line-height: 1.55; font-size: 13px; }
.insight-list li:last-child { border-bottom: 0; }
.insight-list b { color: var(--ink); font-weight: 600; }
.panel-note { margin: 0; padding: 11px 18px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.rank-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.rank-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.rank-table td { padding: 11px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.rank-table tr:last-child td { border-bottom: 0; }
.rank-table tbody tr:hover td { background: var(--surface-2); }
.rank-table .k { width: 44px; color: var(--muted); }
.rank-table .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-table .bar { width: 22%; }
.rank-table .n { width: 120px; text-align: right; }
#billingPlans .name { width: auto; }
.mini { height: 8px; background: var(--bar-track); border-radius: 4px; }
.mini i { display: block; height: 100%; background: var(--bar); border-radius: 4px; }

/* Registros */
.table-shell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: auto; max-height: calc(100vh - 210px); box-shadow: var(--card-shadow); }
.data-table { width: 100%; border-collapse: collapse; min-width: 1080px; font-size: 13px; }
.data-table th { position: sticky; top: 0; background: var(--surface-2); z-index: 3; text-align: left; color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; user-select: none; cursor: pointer; font-size: 11px; font-weight: 600; }
.data-table th:hover { color: var(--ink); }
.data-table th span { color: var(--muted); margin-left: 3px; }
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.4; max-width: 280px; color: var(--ink-2); }
.data-table tbody tr:nth-child(even) td { background: var(--surface-2); }
.data-table tbody tr:hover td { background: var(--primary-soft); color: var(--ink); }
.results-sentinel { padding: 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* Planos */
.current-plan { display: grid; grid-template-columns: 1fr minmax(300px, 560px); gap: 32px; align-items: center; padding: 22px 26px; margin-bottom: 18px; }
.current-plan h2 { margin: 0 0 2px; font-size: 24px; font-weight: 600; }
.current-plan p { margin: 0; }
.current-usage { display: grid; gap: 8px; }
.current-usage .usage-line { font-size: 14px; }
.current-usage .usage-line strong { font-size: 18px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; display: grid; align-content: start; gap: 14px; box-shadow: var(--card-shadow); }
.plan-card.current { border-color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }
.plan-card h3 { margin: 0; font-size: 18px; font-weight: 600; }
.plan-price { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan-price small { color: var(--muted); font-size: 12px; font-weight: 400; }
.plan-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 14px; color: var(--ink-2); }
.plan-features li { padding-left: 16px; position: relative; }
.plan-features li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.plan-tag { position: absolute; top: 20px; right: 20px; font-size: 11px; font-weight: 600; color: var(--gold); }
.plan-tag.current-tag { color: var(--link); }
.plan-card.featured.current .plan-tag:not(.current-tag) { display: none; }

/* Minha conta */
.account-grid { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 18px; }
.avatar-choice { display: flex; gap: 12px; }
.avatar-option { flex: 1; display: grid; justify-items: center; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface-2); position: relative; }
.avatar-option strong { font-weight: 600; }
.avatar-option input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.account-fields { display: grid; gap: 12px; align-content: start; }
.account-fields h3 { margin-bottom: 0; }
.account-fields .button { justify-self: start; }

/* Admin */
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-grid .card { display: grid; gap: 10px; align-content: start; }
.admin-grid .card h3 { margin: 0; }
.status-line { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.status-line span { color: var(--muted); }
.status-line strong { font-weight: 600; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 6px 0; }
.switch-row span { display: grid; gap: 2px; }
.switch-row small { color: var(--muted); font-weight: 400; }
.switch-row input { width: auto; accent-color: var(--primary); }
.pending-box { background: var(--primary-soft); border-radius: var(--radius); padding: 10px 12px; font-size: 12px; line-height: 1.5; }
.compact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compact-form button { grid-column: 1 / -1; }
.users-card { grid-column: 1 / -1; }
.users-list { display: grid; }
/* Chaves liga/desliga da base. */
.switches-card { margin-bottom: 18px; }
.switch-line { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 20px; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-line:last-child { border-bottom: 0; }
.switch-line.is-disabled { opacity: .5; cursor: not-allowed; }
.sw-copy { display: grid; gap: 3px; }
.sw-copy strong { font-size: 15px; font-weight: 600; }
.sw-copy small { color: var(--muted); font-size: 13px; line-height: 1.45; max-width: 760px; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 48px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background-color .18s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .18s ease; }
.switch:checked { background: #1f8a4c; }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { box-shadow: 0 0 0 3px var(--primary-soft); }
.switch:disabled { cursor: not-allowed; }
.is-locked { opacity: .6; }
.button-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.button-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.bases-table { min-width: 1000px; }
.bases-table tr.is-active td { background: var(--primary-soft); }
/* Ações em grupo na tabela de usuários. */
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--primary-soft); border-bottom: 1px solid var(--line); }
.bulk-bar strong { margin-right: 6px; }
.bulk-bar .link-button { margin-left: auto; font-size: 13px; }
.u-check { display: inline-flex; align-items: center; gap: 10px; }
.u-who input[type="checkbox"], .u-check input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.demo-tag { color: #b06f0a; background: rgba(209, 150, 40, .16); }
[data-theme="dark"] .demo-tag { color: #e8b25a; }

/* Avisos: envio (admin). */
.notices-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; margin-bottom: 18px; align-items: start; }
.notice-compose { display: grid; gap: 10px; }
.notice-compose p { margin: 0; }
.notice-form { display: grid; gap: 12px; }
.notice-form label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.notice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.notice-form .button { justify-self: start; }
.notice-plans { display: flex; gap: 18px; }
.notice-plans label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.notice-plans input, .nu-item input { width: 16px; height: 16px; accent-color: var(--primary); }
.notice-users { max-height: 220px; overflow: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px; display: grid; gap: 2px; }
.nu-item { display: grid !important; grid-template-columns: 18px 1fr; column-gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; font-weight: 500 !important; cursor: pointer; }
.nu-item:hover { background: var(--surface-2); }
.nu-item .c-sub { grid-column: 2; color: var(--muted); font-size: 11px; font-weight: 400; }
.notices-list { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow: auto; }
.notice-item { padding: 12px 18px; border-bottom: 1px solid var(--line); border-left: 3px solid var(--primary); }
.notice-item.important { border-left-color: #d99a2b; }
.notice-item p { margin: 4px 0; color: var(--ink-2); font-size: 13px; white-space: pre-line; }
.notice-item .c-sub { color: var(--muted); font-size: 12px; }
.ni-head { display: flex; align-items: baseline; gap: 10px; }
.ni-head .muted { font-size: 12px; }
.ni-head .link-button { margin-left: auto; }
.danger-link { color: var(--danger) !important; }
.empty-li { padding: 18px; }

/* Avisos: painel do usuário na Nova análise. */
.unread-badge { margin-left: auto; font-size: 11px; font-weight: 700; color: #fff; background: var(--danger); padding: 2px 8px; border-radius: var(--radius-pill); }
.user-notices { list-style: none; margin: 0; padding: 0; }
.un-item { padding: 12px 18px; border-bottom: 1px solid var(--line); border-left: 3px solid var(--primary); }
.un-item:last-child { border-bottom: 0; }
.un-item.important { border-left-color: #d99a2b; background: rgba(217, 154, 43, .07); }
.un-item.is-read { border-left-color: var(--line-strong); opacity: .72; background: transparent; }
.un-item strong { display: block; font-size: 14px; }
.un-item p { margin: 4px 0 6px; font-size: 13px; color: var(--ink-2); line-height: 1.5; white-space: pre-line; }
.un-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.un-foot .c-sub { color: var(--muted); font-size: 12px; }
.un-empty { padding: 14px 18px; font-size: 13px; line-height: 1.5; }
.sync-card { gap: 12px; }
.sync-card p { margin: 0; }
.sync-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sync-error { margin-top: 8px; }
.sync-card.has-update { box-shadow: inset 0 0 0 2px var(--primary); }
.import-progress { margin-top: 18px; display: grid; gap: 10px; }
.import-progress p { margin: 0; }
.import-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.import-head span { font-variant-numeric: tabular-nums; color: var(--muted); }
.import-progress .progress { height: 8px; border-radius: 4px; }
.create-user-card { margin-bottom: 18px; }
.button-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.tone-ok { color: #1f8a4c; }
.tone-warn { color: #c47f12; }
.tone-off { color: var(--muted); }
[data-theme="dark"] .tone-ok { color: #5fcf8e; }
[data-theme="dark"] .tone-warn { color: #e8b25a; }

/* Gestão de usuários: uma linha por pessoa, rolagem lateral com a coluna do nome fixa. */
.users-toolbar { flex-wrap: wrap; align-items: center; row-gap: 10px; }
.users-toolbar .seg { margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 2px; background: var(--surface-2); }
.seg-btn { border: 0; background: transparent; color: var(--ink-2); padding: 5px 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.users-search { width: 300px; max-width: 100%; height: 34px; border-radius: var(--radius-pill); padding-left: 14px; }
.table-scroll { overflow-x: auto; }
.users-table { width: 100%; min-width: 1280px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.users-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.users-table th:first-child, .users-table td:first-child { padding-left: 18px; }
.users-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; color: var(--ink); background: var(--surface); }
.users-table tbody tr:hover td { background: var(--surface-2); }
.users-table tr.is-off td { color: var(--muted); }
.users-table tr.is-off .avatar { filter: grayscale(1); opacity: .6; }
.users-table .num { text-align: right; }
.users-table .c-main { display: block; font-weight: 500; }
.users-table .c-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.users-table .mini { display: block; width: 90px; margin-top: 5px; }
.users-table .sticky-col { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--line); }
.users-table th.sticky-col { z-index: 2; }
.u-who { display: flex; align-items: center; gap: 10px; }
.u-who .avatar { width: 34px; height: 34px; }
.u-names { display: grid; min-width: 0; max-width: 190px; }
.u-names strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.u-names .c-sub { overflow: hidden; text-overflow: ellipsis; }
.role-tag { margin-left: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); background: var(--primary-soft); padding: 1px 6px; border-radius: var(--radius-pill); vertical-align: 1px; }
[data-theme="dark"] .role-tag { color: var(--link); }
.plan-chip { display: inline-block; font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid currentColor; }
.plan-chip.bronze { color: var(--bronze); }
.plan-chip.prata { color: var(--silver); }
.plan-chip.ouro { color: var(--gold); }
.status-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; padding: 3px 10px; border-radius: var(--radius-pill); }
.status-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-chip.ok { color: #1f8a4c; background: rgba(31, 138, 76, .1); }
.status-chip.info { color: var(--primary); background: var(--primary-soft); }
.status-chip.warn { color: #b06f0a; background: rgba(209, 150, 40, .14); }
.status-chip.off { color: var(--muted); background: var(--surface-3); }
[data-theme="dark"] .status-chip.ok { color: #5fcf8e; background: rgba(95, 207, 142, .12); }
[data-theme="dark"] .status-chip.info { color: var(--link); }
[data-theme="dark"] .status-chip.warn { color: #e8b25a; }
.u-actions { display: flex; gap: 8px; align-items: center; }
.plan-select { width: 92px; height: 30px; padding: 4px 8px; font-size: 13px; }
.empty-row { text-align: center; padding: 28px !important; }
.panel-note.foot { border-top: 1px solid var(--line); border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.rank-table th.n { text-align: right; }

/* Tela de carregamento da análise: grande, no topo, uma etapa por vez. */
.analysis-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding: clamp(40px, 9vh, 110px) 16px 24px; overflow: auto; background: radial-gradient(1200px 600px at 50% 0%, rgba(29, 95, 196, .35), transparent 70%), rgba(10, 18, 32, .82); backdrop-filter: blur(4px); }
.analysis-card { width: min(760px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 34px 38px 30px; display: grid; gap: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: rise .35s ease both; }
.an-head { display: flex; gap: 24px; align-items: center; }
.an-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
[data-theme="dark"] .an-kicker { color: var(--link); }
.analysis-card h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; font-weight: 700; }
.an-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; min-height: 22px; }
/* Anel triplo girando (o "bichinho" principal). */
.an-orb { position: relative; width: 84px; height: 84px; flex: none; }
.an-orb span { position: absolute; inset: 0; border-radius: 50%; border: 5px solid transparent; border-top-color: var(--primary); animation: spin 1.1s linear infinite; }
.an-orb span:nth-child(2) { inset: 12px; border-top-color: #6fa3ff; animation-duration: 1.6s; animation-direction: reverse; }
.an-orb span:nth-child(3) { inset: 24px; border-top-color: var(--primary); opacity: .6; animation-duration: .8s; }
.analysis-overlay.is-done .an-orb span { animation: none; border-color: var(--primary); }
.analysis-overlay.is-done .an-orb span:nth-child(n+2) { opacity: 0; }
.analysis-overlay.is-done .an-orb::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 36px; font-weight: 700; color: var(--primary); }
.an-progress { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.an-progress strong { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.an-progress .progress span { background: linear-gradient(90deg, var(--primary), #6fa3ff); transition: width .2s linear; }
.analysis-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.analysis-steps li { display: flex; gap: 14px; align-items: center; padding: 10px 14px; border-radius: 10px; font-size: 15px; color: var(--muted); transition: background-color .2s ease, color .2s ease; }
.step-icon { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 3px solid var(--line-strong); display: grid; place-items: center; }
.analysis-steps li.running { color: var(--ink); background: var(--primary-soft); font-weight: 600; }
.analysis-steps li.running .step-icon { border-color: var(--primary); border-right-color: transparent; animation: spin .7s linear infinite; }
.analysis-steps li.done { color: var(--ink-2); }
.analysis-steps li.done .step-icon { border-color: var(--primary); background: var(--primary); }
.analysis-steps li.done .step-icon::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
.step-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Avisos */
.toast-region { position: fixed; top: 60px; right: 16px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-left-width: 3px; border-left-color: var(--muted); border-radius: var(--radius); padding: 10px 12px; font-size: 12px; line-height: 1.45; box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1180px) {
  .app-header { gap: 14px; padding: 0 12px; }
  .nav-tab { padding: 0 9px; }
  .user-menu-copy { display: none; }
  .hu-label { display: none; }
  .notices-grid { grid-template-columns: 1fr; }
  .filters-layout, .summary-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .admin-grid, .plan-grid { grid-template-columns: 1fr; }
  .users-card { grid-column: auto; }
}
@media (max-width: 860px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: auto; gap: 28px; padding: 28px; }
  .login-form-panel { padding: 24px 16px; }
  .top-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 52px; background: var(--head-bg); z-index: 50; justify-content: space-around; overflow-x: auto; }
  .top-nav .nav-tab { border-bottom: 0; border-top: 2px solid transparent; }
  .top-nav .nav-tab.active { border-top-color: #fff; }
  .theme-toggle { display: none; }
  .subhead { padding: 12px 14px; }
  .page { padding: 14px 12px 76px; }
  .form-row { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
  .form-foot { grid-template-columns: 1fr; }
  .usage-hero { grid-template-columns: 1fr; gap: 12px; padding: 16px 18px; }
  .uh-numbers strong { font-size: 32px; }
  .signup-grid { grid-template-columns: 1fr; }
  .analysis-card { padding: 24px 20px; }
  .an-orb { width: 60px; height: 60px; }
  .an-head { gap: 16px; }
  .form-foot .form-error { text-align: left; }
  .account-grid, .current-plan { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(odd) { border-left: 0; }
  .kpi:nth-child(4) { border-left: 1px solid var(--line); }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .report-tabs { overflow-x: auto; }
  .heading-actions { margin-left: 0; }
  .rank-table .bar { display: none; }
}
