/* ─────────────────────────────────────────────────────────────
   fyscone.css — design system do Fyscone.
   Paleta da marca: #0D1321 · #142044 · #2563EB · #00C2A8 · #F2F4F7
   ───────────────────────────────────────────────────────────── */
:root {
  --navy-950: #0D1321;
  --navy-900: #142044;
  --navy-800: #1C2B57;
  --blue: #2563EB;
  --blue-600: #1D4ED8;
  --blue-50: #EFF4FF;
  --teal: #00C2A8;
  --teal-700: #00897A;
  --teal-50: #E6FAF7;
  --violet: #7C3AED;
  --amber: #F59E0B;
  --amber-50: #FFF7E6;
  --red: #E5484D;
  --red-50: #FEF0F0;
  --green: #12B76A;
  --green-50: #ECFDF3;

  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text: #101828;
  --text-2: #475467;
  --muted: #98A2B3;

  --grad: linear-gradient(135deg, var(--teal) 0%, var(--blue) 100%);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(13, 19, 33, .18);
  --sidebar-w: 248px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Marca ─────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; }
.brand img { width: 30px; height: 30px; }
.brand-word { font-size: 21px; line-height: 1; }
.brand-word .one { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand.on-dark .brand-word { color: #fff; }

/* ── Layout ────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--navy-950); color: #fff; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; padding: 22px 14px 14px; z-index: 40;
}
.sidebar-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 0 22px 8px; }
.btn-recolher {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: none; color: rgba(255, 255, 255, .55);
  display: grid; place-items: center; cursor: pointer;
}
.btn-recolher:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn-recolher svg { width: 18px; height: 18px; transition: transform .2s; }
/* Menu recolhido: só ícones (desktop) */
@media (min-width: 901px) {
  .sidebar { transition: width .2s ease; }
  .main { transition: margin-left .2s ease; }
  .app.recolhido { --sidebar-w: 76px; }
  .app.recolhido .sidebar { padding-left: 12px; padding-right: 12px; }
  .app.recolhido .sidebar-topo { flex-direction: column; padding-left: 0; gap: 14px; }
  .app.recolhido .brand-word,
  .app.recolhido .nav-item span:not(.nav-badge),
  .app.recolhido .sidebar-user > div:not(.avatar):not(.menu-usuario) { display: none; }
  .app.recolhido .btn-recolher svg { transform: rotate(180deg); }
  .app.recolhido .nav-item { justify-content: center; padding: 11px 0; }
  .app.recolhido .nav-badge { position: absolute; top: 4px; right: 6px; padding: 0 5px; font-size: 10px; }
  .app.recolhido .sidebar-user { flex-direction: column; padding-left: 0; padding-right: 0; }
  .app.recolhido .sidebar-user #btnMenuUsuario { display: none; }
  .app.recolhido .menu-usuario { left: 0; right: auto; width: 180px; }
}
@media (max-width: 900px) { .btn-recolher { display: none; } }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .72); font-size: 14px; font-weight: 500; border: 0; background: none; cursor: pointer;
  text-align: left; width: 100%; text-decoration: none !important; position: relative;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.ativo { background: linear-gradient(90deg, rgba(0, 194, 168, .22), rgba(37, 99, 235, .14)); color: #fff; }
.nav-item.ativo::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--teal); }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .08); position: relative;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar-user .nome { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .papel { font-size: 12px; color: rgba(255, 255, 255, .55); }
.sidebar-user .avatar { cursor: pointer; }
.sidebar-user button { margin-left: auto; background: none; border: 0; color: rgba(255, 255, 255, .6); cursor: pointer; padding: 6px; border-radius: 6px; }
.sidebar-user button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.menu-usuario {
  position: absolute; bottom: 56px; left: 4px; right: 4px; background: var(--surface); color: var(--text); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 5;
}
.menu-usuario button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); }
.menu-usuario button:hover { background: var(--bg); }
.menu-usuario svg { width: 16px; height: 16px; color: var(--text-2); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 22px 32px 6px; flex-wrap: wrap;
}
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.topbar .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.topbar .acoes { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mobile-header { display: none; }
.conteudo { padding: 18px 32px 40px; flex: 1; }

.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red);
  color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg);
}

/* ── Componentes ───────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card-head h2, .card-title { font-size: 14px; font-weight: 600; }
.card-head .link { margin-left: auto; font-size: 12px; font-weight: 600; }
.card-body { padding: 14px 20px 18px; }
.card-foot { padding: 0 20px 14px; text-align: right; font-size: 12px; font-weight: 600; }

.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-inicio-graficos { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.mt { margin-top: 16px; }

.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi-valor { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi-valor.alerta { color: var(--red); }
.kpi-icone { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.kpi-icone svg { width: 20px; height: 20px; }
.ic-blue { background: var(--blue-50); color: var(--blue); }
.ic-teal { background: var(--teal-50); color: var(--teal-700); }
.ic-red { background: var(--red-50); color: var(--red); }
.ic-amber { background: var(--amber-50); color: #B45309; }
.kpi-var { font-size: 12px; color: var(--text-2); }
.kpi-var b { font-weight: 600; }
.kpi-var .up { color: var(--teal-700); }
.kpi-var .down { color: var(--red); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; line-height: 1.2;
  text-decoration: none !important;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-grad { background: var(--grad); color: #fff; }
.btn-grad:hover { filter: brightness(1.05); }
.btn-sec { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-sec:hover { background: var(--bg); }
.btn-ghost { background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--surface); color: var(--red); border-color: #F7C1C3; }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.campo { display: flex; flex-direction: column; gap: 5px; }
.campo label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; min-height: 40px;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.input-icone { position: relative; }
.input-icone svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.input-icone .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.ajuda { font-size: 12px; color: var(--muted); }
.ajuda svg { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }

.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filtros .campo { min-width: 140px; }
.filtros .campo.grow { flex: 1; min-width: 220px; }
.periodo {
  display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; height: 40px; font-size: 13px; font-weight: 500;
}
.periodo input { border: 0; outline: 0; background: none; font-size: 13px; width: 118px; }
.periodo svg { width: 16px; height: 16px; color: var(--text-2); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.ativo { color: var(--blue); border-bottom-color: var(--blue); }

/* Tabela */
.tabela-wrap { overflow-x: auto; }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 10px 14px; background: #F9FAFB; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tabela td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tbody tr.clicavel { cursor: pointer; }
.tabela tbody tr.clicavel:hover td { background: #F9FAFB; }
.tabela .r { text-align: right; }
.tabela .nowrap { white-space: nowrap; }
.tabela .nome-cel.estreita { max-width: 150px; }
/* Grade com muitas colunas (Análises): espaçamento menor pra caber mais sem rolar. */
.tabela.densa th, .tabela.densa td { padding: 10px 9px; font-size: 12.5px; }
.tabela.densa th:first-child, .tabela.densa td:first-child { padding-left: 16px; }
.tabela .chk { width: 36px; }
.tabela .nome-cel { font-weight: 600; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabela .sub-cel { font-size: 12px; color: var(--muted); }
.vazio { padding: 40px 20px; text-align: center; color: var(--text-2); }
.vazio svg { width: 40px; height: 40px; color: var(--muted); margin-bottom: 10px; }
.vazio h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.paginacao { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 16px; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; background: var(--bg); color: var(--text-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.b-blue { background: var(--blue-50); color: var(--blue-600); }
.b-teal { background: var(--teal-50); color: var(--teal-700); }
.b-amber { background: var(--amber-50); color: #B45309; }
.b-red { background: var(--red-50); color: #C2272D; }
.b-green { background: var(--green-50); color: #067647; }
.b-gray { background: #F2F4F7; color: var(--text-2); }

/* Lista (top fornecedores, alertas, menu mobile) */
.lista { list-style: none; }
.lista li { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 13px; }
.lista li + li { border-top: 1px solid var(--border); }
.lista .pos { width: 18px; color: var(--muted); font-weight: 600; }
.lista .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alerta-item { display: flex; gap: 12px; padding: 10px 0; }
.alerta-item + .alerta-item { border-top: 1px solid var(--border); }
.alerta-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.alerta-ic svg { width: 17px; height: 17px; }
.alerta-txt { flex: 1; min-width: 0; }
.alerta-txt b { display: block; font-size: 13px; }
.alerta-txt span { display: block; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.alerta-quando { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Gráficos */
.chart-box { position: relative; height: 230px; }
.chart-box.alto { height: 300px; }
.donut-wrap { display: grid; grid-template-columns: minmax(110px, 170px) minmax(0, 1fr); gap: 16px; align-items: center; }
.donut { position: relative; height: 180px; }
/* Card estreito (ex.: coluna de 3): rosca menor pra legenda caber inteira. */
.card-body { container-type: inline-size; }
@container (max-width: 400px) {
  .donut-wrap { grid-template-columns: 124px minmax(0, 1fr); }
  .donut { height: 124px; }
  .donut-centro b { font-size: 20px; }
}
.donut-centro { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-centro b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.donut-centro span { font-size: 12px; color: var(--text-2); }
.legenda { list-style: none; display: flex; flex-direction: column; gap: 9px; font-size: 13px; }
.legenda li { display: flex; align-items: center; gap: 9px; }
.legenda .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legenda .rot { flex: 1; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legenda .val { font-weight: 600; }
.legenda .pct { color: var(--muted); font-size: 12px; min-width: 36px; text-align: right; }
.legenda-linha { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-left: auto; }
.legenda-linha span { display: inline-flex; align-items: center; gap: 6px; }
.legenda-linha i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.barras { display: flex; flex-direction: column; gap: 12px; }
.barra-linha { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; }
.barra-linha .rot { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-linha .val { font-weight: 600; text-align: right; }
.barra-trilho { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: #F2F4F7; overflow: hidden; }
.barra-trilho i { display: block; height: 100%; border-radius: 4px; background: var(--blue); }

/* Upload */
.dropzone {
  display: block; border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 30px 20px; text-align: center; cursor: pointer;
  background: #FBFCFD; transition: border-color .15s, background .15s;
}
.dropzone.sobre { border-color: var(--blue); background: var(--blue-50); }
.dropzone svg { display: block; margin: 0 auto 8px; width: 36px; height: 36px; color: var(--blue); }
.dropzone b { display: block; font-size: 14px; }
.dropzone span { font-size: 12px; color: var(--text-2); }

/* Modal */
.modal-fundo {
  position: fixed; inset: 0; background: rgba(13, 19, 33, .55); display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto; animation: fade .15s ease;
}
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal.largo { max-width: 960px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-head .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; word-break: break-all; }
.modal-head .fechar { margin-left: auto; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
.dl div span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.dl div b { font-size: 13px; font-weight: 600; word-break: break-word; }
.secao-titulo { font-size: 13px; font-weight: 700; margin: 20px 0 10px; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: min(400px, calc(100vw - 32px)); }
.toast {
  background: var(--navy-950); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 13px; display: flex; gap: 10px; align-items: flex-start; animation: fade .2s ease;
}
.toast svg { width: 18px; height: 18px; margin-top: 1px; }
.toast.ok svg { color: var(--teal); }
.toast.erro svg { color: #FF8A8E; }

.carregando { display: grid; place-items: center; padding: 50px; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: gira .7s linear infinite; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; border-top-color: currentColor; }
@keyframes gira { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #EEF0F3 25%, #F6F7F9 50%, #EEF0F3 75%); background-size: 200% 100%; animation: brilho 1.2s infinite; border-radius: 6px; }
@keyframes brilho { to { background-position: -200% 0; } }

.aviso { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; background: var(--blue-50); color: #1E3A8A; }
.aviso.warn { background: var(--amber-50); color: #92400E; }
.aviso.erro { background: var(--red-50); color: #991B1B; }
.aviso svg { width: 18px; height: 18px; margin-top: 1px; }

.acoes-lote { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .info { font-size: 13px; color: var(--text-2); margin-right: auto; }

/* Navegação inferior (mobile) */
.bottom-nav { display: none; }
.fundo-sidebar { display: none; }

/* ── Responsivo ─────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-inicio-graficos { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .app.menu-aberto .sidebar { transform: none; }
  .app.menu-aberto .fundo-sidebar { display: block; position: fixed; inset: 0; background: rgba(13, 19, 33, .5); z-index: 35; }
  .main { margin-left: 0; padding-bottom: 76px; }
  .mobile-header {
    display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
  }
  .mobile-header .brand-word { font-size: 18px; }
  .mobile-header .brand img { width: 24px; height: 24px; }
  .mobile-header .icon-btn { border: 0; background: none; }
  .topbar { padding: 18px 16px 4px; }
  .topbar h1 { font-size: 19px; }
  .topbar .acoes .icon-btn.sino { display: none; }
  .conteudo { padding: 12px 16px 28px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface);
    border-top: 1px solid var(--border); z-index: 30; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--text-2);
    background: none; border: 0; text-decoration: none !important; padding: 4px 0; cursor: pointer;
  }
  .bottom-nav svg { width: 21px; height: 21px; }
  .bottom-nav .ativo { color: var(--blue); font-weight: 600; }
  .bottom-nav .mais-central span.circ {
    width: 46px; height: 46px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center;
    margin-top: -22px; box-shadow: 0 6px 16px rgba(37, 99, 235, .4);
  }
  .g-2, .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toasts { bottom: 86px; right: 16px; }
  .esconde-mobile { display: none !important; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr; }
  .g-3 { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; }
  .donut { height: 170px; max-width: 220px; margin: 0 auto; width: 100%; }
  .kpi { min-height: 0; }
  .filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filtros .campo { min-width: 0; }
  .filtros .campo.grow { grid-column: 1 / -1; }
  .periodo { width: 100%; }
  .periodo input { width: 100%; flex: 1; min-width: 0; }
  .modal-fundo { padding: 0; align-items: stretch; }
  .modal, .modal.largo { border-radius: 0; min-height: 100%; }
}
@media (min-width: 901px) {
  .so-mobile { display: none !important; }
}

/* ── Tela de acesso (login/cadastro) ───────────────────────── */
.acesso { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.acesso-marca {
  background: radial-gradient(circle at 20% 15%, rgba(0, 194, 168, .25), transparent 45%),
              radial-gradient(circle at 85% 90%, rgba(37, 99, 235, .35), transparent 50%), var(--navy-950);
  color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.acesso-marca .brand img { width: 44px; height: 44px; }
.acesso-marca .brand-word { font-size: 30px; }
.acesso-marca h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; max-width: 480px; }
.acesso-marca h2 .one { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.acesso-marca p { color: rgba(255, 255, 255, .7); max-width: 460px; margin-top: 14px; font-size: 15px; }
.acesso-recursos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; max-width: 520px; }
.acesso-recursos div { font-size: 12px; color: rgba(255, 255, 255, .75); display: flex; flex-direction: column; gap: 8px; }
.acesso-recursos svg { width: 26px; height: 26px; color: var(--teal); }
.acesso-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.acesso-caixa { width: 100%; max-width: 400px; }
.acesso-caixa h1 { font-size: 24px; letter-spacing: -.01em; }
.acesso-caixa .sub { color: var(--text-2); margin: 6px 0 24px; }
.acesso-caixa form { display: flex; flex-direction: column; gap: 14px; }
.acesso-caixa .btn { width: 100%; padding: 12px; font-size: 14px; }
.acesso-troca { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-2); }
.acesso-troca button { background: none; border: 0; color: var(--blue); font-weight: 600; cursor: pointer; }
.senha-wrap { position: relative; }
.senha-wrap .input { padding-right: 44px; }
.senha-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px; color: var(--muted); cursor: pointer; }
.senha-wrap svg { width: 18px; height: 18px; }
.plano-escolhido { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--blue-50); border: 1px solid #D6E2FF; border-radius: 10px; padding: 12px 14px; margin: -8px 0 20px; }
.plano-escolhido span { display: block; font-size: 12px; color: var(--text-2); }
.plano-escolhido b { display: block; font-size: 15px; color: var(--blue-600); }
.plano-escolhido small { font-size: 12px; color: var(--text-2); }
.plano-escolhido a { font-size: 13px; font-weight: 600; }
.passo-titulo { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 4px; }
@media (max-width: 900px) {
  .acesso { grid-template-columns: 1fr; }
  .acesso-marca { padding: 28px 24px; gap: 18px; }
  .acesso-marca h2 { font-size: 24px; }
  .acesso-marca p, .acesso-recursos { display: none; }
  .acesso-form { padding: 28px 16px 40px; align-items: flex-start; }
}

/* ── Assinatura ── */
.faixa-assinatura { display: flex; align-items: center; gap: 10px; margin: 16px 32px 0; padding: 10px 14px; border-radius: 10px; background: var(--blue-50); color: #1E3A8A; font-size: 13px; }
.faixa-assinatura svg { width: 17px; height: 17px; flex-shrink: 0; }
.faixa-assinatura span { flex: 1; min-width: 0; }
.faixa-assinatura a { font-weight: 700; white-space: nowrap; }
.faixa-assinatura.erro { background: var(--red-50); color: #991B1B; }
.faixa-assinatura.erro a { color: #991B1B; }
/* Bloqueado: o menu mostra só Configurações (o resto é barrado na API também). */
.app.bloqueado .nav-item:not([data-rota="configuracoes"]),
.app.bloqueado .bottom-nav > *:not(#btnMaisMobile),
.app.bloqueado .sino, .app.bloqueado #sinoMobile { display: none !important; }
.app.bloqueado .bottom-nav { grid-template-columns: 1fr; }
.assin-ciclos { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.assin-planos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.assin-plano { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.assin-plano.atual { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.assin-plano .btn { margin-top: 8px; }
.assin-preco { font-size: 20px; font-weight: 800; color: var(--blue); letter-spacing: -.02em; }
.assin-preco small { font-size: 12px; font-weight: 600; color: var(--text-2); }
@media (max-width: 1180px) { .assin-planos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .faixa-assinatura { margin: 12px 16px 0; } }
@media (max-width: 560px) { .assin-planos { grid-template-columns: 1fr; } }

/* ── Modo escuro ───────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --navy-950: #070B14;
  --bg: #0B1120;
  --surface: #121B2E;
  --border: #24314D;
  --border-strong: #33456A;
  --text: #E7EBF3;
  --text-2: #A6B1C4;
  --muted: #6F7D96;
  --blue: #3B82F6;
  --blue-600: #2F6FE0;
  --blue-50: rgba(59, 130, 246, .16);
  --teal-700: #2DD4BF;
  --teal-50: rgba(0, 194, 168, .14);
  --red-50: rgba(229, 72, 77, .16);
  --amber-50: rgba(245, 158, 11, .15);
  --green-50: rgba(18, 183, 106, .15);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}
[data-theme="dark"] .sidebar { border-right: 1px solid #1A2440; }
[data-theme="dark"] .tabela th { background: #0F1729; }
[data-theme="dark"] .tabela tbody tr.clicavel:hover td { background: rgba(255, 255, 255, .035); }
[data-theme="dark"] .b-gray { background: rgba(255, 255, 255, .07); }
[data-theme="dark"] .b-blue { color: #93C5FD; }
[data-theme="dark"] .b-teal { color: #5EEAD4; }
[data-theme="dark"] .b-amber, [data-theme="dark"] .ic-amber { color: #FCD34D; }
[data-theme="dark"] .b-red { color: #FCA5A5; }
[data-theme="dark"] .b-green { color: #6EE7B7; }
[data-theme="dark"] .ic-blue { color: #93C5FD; }
[data-theme="dark"] .barra-trilho { background: rgba(255, 255, 255, .08); }
[data-theme="dark"] .dropzone { background: rgba(255, 255, 255, .02); }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #172238 25%, #1D2A44 50%, #172238 75%); background-size: 200% 100%; }
[data-theme="dark"] .aviso, [data-theme="dark"] .faixa-assinatura { color: #BFDBFE; }
[data-theme="dark"] .aviso.warn { color: #FDE68A; }
[data-theme="dark"] .aviso.erro, [data-theme="dark"] .faixa-assinatura.erro, [data-theme="dark"] .faixa-assinatura.erro a { color: #FECACA; }
[data-theme="dark"] .btn-sec:hover, [data-theme="dark"] .btn-ghost:hover, [data-theme="dark"] .menu-usuario button:hover { background: rgba(255, 255, 255, .06); }
[data-theme="dark"] .btn-danger { border-color: rgba(229, 72, 77, .45); color: #FCA5A5; }
[data-theme="dark"] .modal-fundo { background: rgba(0, 0, 0, .65); }
[data-theme="dark"] a { color: #7AA7FF; }
[data-theme="dark"] .nav-item, [data-theme="dark"] .btn, [data-theme="dark"] .bottom-nav a, [data-theme="dark"] .brand { color: inherit; }
[data-theme="dark"] .btn-primary, [data-theme="dark"] .btn-grad { color: #fff; }
[data-theme="dark"] .btn-sec { color: var(--text); }
[data-theme="dark"] .nav-item { color: rgba(255, 255, 255, .72); }
[data-theme="dark"] .nav-item.ativo, [data-theme="dark"] .nav-item:hover { color: #fff; }
[data-theme="dark"] .bottom-nav a, [data-theme="dark"] .bottom-nav button { color: var(--text-2); }
[data-theme="dark"] .bottom-nav .ativo { color: #7AA7FF; }
[data-theme="dark"] .card-foot a, [data-theme="dark"] .card-head .link { color: #7AA7FF; }
[data-theme="dark"] .icon-btn { color: var(--text-2); }
[data-theme="dark"] .icon-btn:hover { color: var(--text); }

/* Pagamentos */
.links-pagamento { display: inline-flex; gap: 12px; white-space: nowrap; }
.links-pagamento a { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; }
.links-pagamento svg { width: 14px; height: 14px; }
.resumo-pagamentos { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.resumo-pagamentos b { color: var(--text); }
.links-pagamento button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--blue); display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; font-family: inherit; }
.links-pagamento button:hover { text-decoration: underline; }
[data-theme="dark"] .links-pagamento button { color: #7AA7FF; }

/* Assinatura: formas de pagamento lado a lado */
.assin-opcoes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; max-width: 860px; }
.assin-opcao { border: 1.5px solid var(--border-strong); background: var(--surface); border-radius: 12px; padding: 10px 14px; text-align: left; cursor: pointer; font-family: inherit; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.assin-opcao b { font-size: 14px; }
.assin-opcao span { font-size: 12px; color: var(--text-2); }
.assin-opcao:hover { border-color: var(--blue); }
.assin-opcao.ativa { border-color: var(--blue); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.assin-opcao.ativa b { color: var(--blue); }
@media (max-width: 900px) { .assin-opcoes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .assin-opcoes { grid-template-columns: 1fr; } }
.link-inline { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
[data-theme="dark"] .link-inline { color: #7AA7FF; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; cursor: pointer; }
.check-inline input { width: 16px; height: 16px; accent-color: var(--blue); }
