/* =============================================================================
   Financeiro · estilo.css
   Padrão visual: painel de gestão de rede (barra superior fina, menu lateral só de
   ícones que abre ao passar o mouse, controles em cinza claro, abas em segmento,
   tabelas limpas e cartões planos). Descrito em PROJECT_STYLE.md.
   Só variáveis; sem cores soltas. Responsivo: celular (<700), tablet (<900), desktop.
   ============================================================================= */

:root {
  color-scheme: light dark;

  --primary: #0a6cff;
  --primary-hover: #0057d9;
  --on-primary: #ffffff;
  --primary-soft: #e8f1ff;
  --link: #0a5ce0;
  --accent: #00a3ff;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e7eaee;
  --border: #e4e7eb;
  --border-strong: #cdd3da;
  --text: #1a1d21;
  --muted: #667085;

  --success: #0c8a4d;
  --success-soft: #e4f6ec;
  --success-dot: #22c55e;
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --warning: #b45309;
  --warning-soft: #fef3e2;

  --shadow: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 0.18);

  --r-ctl: 6px;
  --r-card: 8px;
  --r-pill: 999px;
  --ctl-h: 36px;
  --topbar-h: 56px;
  --rail-w: 248px; /* menu lateral: sempre expandido (ícone + rótulo) */

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* Tema: automático (sistema), ou escolhido no menu (data-theme no <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary-soft: #14283f;
    --link: #5ca6ff;
    --bg: #121418;
    --surface: #1a1d22;
    --surface-2: #22262c;
    --surface-3: #2c3138;
    --border: #2b3038;
    --border-strong: #3b414b;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --success: #3ddc91;
    --success-soft: #11291e;
    --danger: #ff7b72;
    --danger-soft: #2f1816;
    --warning: #fbbf24;
    --warning-soft: #2b2110;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary-soft: #14283f;
  --link: #5ca6ff;
  --bg: #121418;
  --surface: #1a1d22;
  --surface-2: #22262c;
  --surface-3: #2c3138;
  --border: #2b3038;
  --border-strong: #3b414b;
  --text: #e8eaed;
  --muted: #9aa3ae;
  --success: #3ddc91;
  --success-soft: #11291e;
  --danger: #ff7b72;
  --danger-soft: #2f1816;
  --warning: #fbbf24;
  --warning-soft: #2b2110;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.55);
}

:root[data-theme="light"] { color-scheme: light; }

@media (pointer: coarse) {
  :root { --ctl-h: 44px; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.menu-open { overflow: hidden; }

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--r-ctl);
  transition: top 0.15s;
}
.skip-link:focus { top: 8px; }

.icon { width: 22px; height: 22px; flex: none; }
.icon-sm { width: 16px; height: 16px; flex: none; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-upper { text-transform: uppercase; }

/* ---------- Barra superior ---------- */
.app { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--topbar-h);
  padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.menu-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: 4px;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.menu-toggle:hover { background: var(--surface-2); }

.site-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(260px, 38vw);
  padding: 6px 10px;
  border-radius: var(--r-ctl);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.site-switch:hover { background: var(--surface-2); }
.site-switch span:not(.status-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-switch .icon-sm { color: var(--muted); }

.status-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--success-dot);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.app-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: stretch;
  margin-left: 4px;
  padding: 0 16px;
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.app-tab:hover { color: var(--primary-hover); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: var(--on-primary);
}
.brand-mark .icon { width: 14px; height: 14px; }

.spacer { flex: 1; }

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--link);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}
.avatar:hover { border-color: var(--primary); }

@media (max-width: 899.98px) {
  .app-tab { display: none; }
}
@media (min-width: 900px) {
  .menu-toggle { display: none; }
}

/* ---------- Menu lateral: sempre expandido (ícone + rótulo), empurra o conteúdo ---------- */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--rail-w);
  padding: 8px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar nav { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.sidebar nav::-webkit-scrollbar { display: none; }

.nav-group {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 26px;
  padding: 0 13px 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-list { display: grid; gap: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.sidebar-foot {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgb(10 14 20 / 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.menu-open .overlay { opacity: 1; pointer-events: auto; }

.main { padding: 20px 16px 56px; }
/* O conteúdo ocupa toda a largura útil da página (sem largura máxima); o respiro vem do
   padding de .main: 16px no celular, 32px no desktop. */
.container {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

@media (min-width: 900px) {
  .main {
    margin-left: var(--rail-w);
    padding: 24px 32px 64px;
  }
}

/* Celular e tablet: o menu vira gaveta (abre pelo botão da barra superior) */
@media (max-width: 899.98px) {
  .sidebar {
    top: 0;
    z-index: 70;
    width: min(300px, 88vw);
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
  }
  .menu-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
}

/* ---------- Cabeçalho de página ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
}
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 0.8125rem; color: var(--muted); }
.breadcrumb li + li::before { content: "›"; margin-right: 8px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; }
.page-header h1 { margin-top: 4px; font-size: 1.375rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.lead { margin-top: 4px; max-width: 68ch; color: var(--muted); font-size: 0.875rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (min-width: 900px) {
  .page-header h1 { font-size: 1.5rem; }
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--ctl-h);
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--link); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 0.8125rem; }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.icon-btn { padding: 8px; min-width: var(--ctl-h); }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.card-head { padding: 16px 16px 0; }
.card-head h2 { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.card-head p { margin-top: 2px; color: var(--muted); font-size: 0.8125rem; }
.card-body { padding: 16px; }
.card-foot { padding: 16px; border-top: 1px solid var(--border); }

@media (min-width: 700px) {
  .card-head { padding: 20px 20px 0; }
  .card-body, .card-foot { padding: 20px; }
}

.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

/* ---------- Formulários ---------- */
.form-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
/* Mais colunas em telas largas: o formulário preenche a página sem esticar cada campo */
@media (min-width: 700px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
  .span-2 { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1700px) {
  .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: 0.8125rem; font-weight: 600; }
.req { color: var(--danger); margin-left: 2px; }
.hint { color: var(--muted); font-size: 0.8125rem; }

.input, .select {
  width: 100%;
  min-height: var(--ctl-h);
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
}
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:hover, .select:hover { border-color: var(--muted); }
.input:focus, .select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctl);
  background: var(--surface);
}
.input-group:focus-within { outline: 2px solid var(--primary); border-color: transparent; }
.input-group .input { border: 0; background: transparent; border-radius: 0; min-width: 0; }
.input-group .input:focus { outline: 0; }
.affix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}
.affix:first-child { border-right: 1px solid var(--border-strong); border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.affix:last-child { border-left: 1px solid var(--border-strong); border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }

.check { display: flex; align-items: center; gap: 10px; min-height: var(--ctl-h); font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }

.calc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--ctl-h);
  padding: 6px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
}
.calc output { font-weight: 600; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
@media (min-width: 700px) { .form-actions { padding: 14px 20px; } }
@media (max-width: 480px) { .form-actions .btn { flex: 1 1 auto; } }

.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.check-list { display: grid; gap: 4px 24px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 4px; }

/* Formulário de inclusão dentro de cartão (tabelas filhas do produto) */
.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  padding: 16px;
  margin: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-card);
  background: var(--surface-2);
}
@media (min-width: 700px) {
  .inline-form { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 20px 20px 0; }
}
.inline-form .input, .inline-form .select, .inline-form .input-group { background: var(--surface); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { padding: 12px 16px; text-align: left; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table thead th {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
}
.table tbody tr + tr td { border-top: 1px solid var(--border); }
.table tbody tr:hover td { background: var(--surface-2); }
.table td:first-child, .table th:first-child { padding-left: 20px; }
.table td:last-child, .table th:last-child { padding-right: 20px; }

/* Celular: cada linha vira um cartão (os rótulos vêm do cabeçalho, via data-label) */
@media (max-width: 699.98px) {
  .table-wrap { overflow-x: visible; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .table tbody tr { display: grid; gap: 6px; padding: 14px 16px; border-top: 1px solid var(--border); }
  .table tbody tr + tr td { border-top: 0; }
  .table tbody tr:hover td { background: transparent; }
  .table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 0;
    text-align: right;
    white-space: normal;
  }
  .table td:first-child, .table td:last-child { padding: 0; }
  .table td::before { content: attr(data-label); flex: none; color: var(--muted); font-weight: 500; text-align: left; }
  .table td:first-child { justify-content: flex-start; font-weight: 600; font-size: 1rem; text-align: left; }
  .table td:first-child::before { display: none; }
  .table td[data-label="Ações"] { justify-content: flex-end; padding-top: 4px; }
  .table td[data-label="Ações"]::before { display: none; }
  .table td.num { text-align: right; }
}

.status { padding: 24px 16px; text-align: center; color: var(--muted); }

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 16px;
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--link);
}
.empty h3 { font-size: 1rem; font-weight: 600; }
.empty p { max-width: 46ch; color: var(--muted); font-size: 0.875rem; }
.empty .btn { margin-top: 8px; }

.row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }

/* ---------- Indicadores ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 480px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.kpi { padding: 16px 18px; display: grid; gap: 4px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.kpi-top .icon { width: 20px; height: 20px; }
.kpi-value { font-size: 1.625rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi-hint { color: var(--muted); font-size: 0.8125rem; }

.stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-card) var(--r-card);
}
@media (min-width: 700px) { .stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); padding: 16px 20px; } }
.stats dt { color: var(--muted); font-size: 0.8125rem; }
.stats dd { font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Abas em segmento ---------- */
.tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 2px;
  padding: 3px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--surface-2);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.tabs a[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
@media (pointer: coarse) { .tabs a { min-height: 40px; } }

/* ---------- Resumo de precificação ---------- */
.summary { display: grid; }
.summary .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.summary .row:first-child { border-top: 0; }
.summary dt { color: var(--muted); }
.summary dd { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.summary .sub dt, .summary .sub dd { color: var(--text); font-weight: 600; }
.summary .total { margin-top: 4px; padding: 12px; border: 0; border-radius: var(--r-ctl); background: var(--primary-soft); }
.summary .total dt, .summary .total dd { color: var(--link); font-weight: 600; }

.grid-2 { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Avisos, alertas e selos ---------- */
.notice {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--primary-soft);
  color: var(--text);
  font-size: 0.875rem;
}
.notice .icon { width: 20px; height: 20px; color: var(--link); margin-top: 1px; }

.alert {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  border: 1px solid transparent;
  font-size: 0.875rem;
}
.alert-erro { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-ok { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.alert-aviso { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.alert a { color: inherit; font-weight: 600; }
.container > [data-alertas]:empty, .auth-card > [data-alertas]:empty { display: none; }
.container > [data-alertas] { display: grid; gap: 8px; }
.card-body > .alert { margin-bottom: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-ok { background: var(--success-soft); border-color: transparent; color: var(--success); }
.badge-info { background: var(--primary-soft); border-color: transparent; color: var(--link); }

/* ---------- Passo a passo (início) ---------- */
.steps { display: grid; gap: 8px; padding: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .steps { padding: 20px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
.step {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.step:hover { border-color: var(--primary); background: var(--surface-2); }
.step-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--link);
  font-weight: 600;
  font-size: 0.875rem;
}
.step strong { display: block; line-height: 1.3; font-weight: 600; }
.step span.muted { display: block; font-size: 0.8125rem; line-height: 1.35; }
.step .icon-sm { margin-left: auto; color: var(--muted); }

/* ---------- Autenticação ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.auth-card { width: min(100%, 400px); display: grid; gap: 20px; }
.auth-card .brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 1.125rem; text-decoration: none; }
.auth-card .brand-mark { width: 32px; height: 32px; }
.auth-card .brand-mark .icon { width: 18px; height: 18px; }
.auth-card h1 { font-size: 1.375rem; font-weight: 600; text-align: center; }
.auth-card .lead { text-align: center; margin-inline: auto; }
.auth-links { text-align: center; font-size: 0.875rem; color: var(--muted); }

/* ---------- Perfis: o RLS do banco protege; aqui só se esconde o que não se pode usar ---------- */
body[data-papel="cliente"] .escrita { display: none !important; }
body:not([data-papel="admin"]) .so-admin { display: none !important; }

/* ---------- Telas pequenas ---------- */
@media (max-width: 480px) {
  .main { padding: 16px 12px 48px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .kpi-value { font-size: 1.375rem; }
  .site-switch { max-width: 52vw; }
}

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