/* =====================================================================
   Alliancar Clube de Protecao Veicular - design system
   Linguagem visual: superficies planas, bordas suaves, raio consistente,
   tokens semanticos (inspirado no vocabulario do svelteforge-admin),
   mantendo a identidade Alliancar (azul + verde do logo).
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------------ */
:root {
  color-scheme: light;

  /* Marca */
  --brand: #0d7fd1;
  --brand-dark: #0368ab;
  --brand-deep: #084a86;
  --brand-light: #e7f3fd;
  --brand-soft: #eaf4fe;
  --brand-ring: rgba(13, 127, 209, .20);
  --brand-grad: linear-gradient(135deg, #10a45c 0%, #1594e8 58%, #0a4fac 100%);

  /* Superficies */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --field-bg: #ffffff;
  --row-hover: #f8fbff;

  /* Texto */
  --ink: #0b1220;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --on-brand: #ffffff;

  /* Linhas */
  --line: #e7ecf3;
  --line-2: #d5dde8;
  --input: #d8e1ec;

  /* Estados */
  --ok: #0f9d63;
  --ok-fg: #04624a;
  --ok-bg: #e6f8ef;
  --ok-line: #b3e8cf;

  --warn: #b45309;
  --warn-fg: #8a4a08;
  --warn-bg: #fff6e6;
  --warn-line: #f8dcae;

  --bad: #c02b2b;
  --bad-fg: #97201f;
  --bad-bg: #fdecec;
  --bad-line: #f6c8c7;

  --info: #1d4ed8;
  --info-fg: #1c3fa6;
  --info-bg: #ecf2ff;
  --info-line: #c8d8fb;

  /* Forma */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(11, 18, 32, .05);
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, .05), 0 3px 10px -6px rgba(11, 18, 32, .16);
  --shadow: 0 1px 2px rgba(11, 18, 32, .05), 0 14px 30px -20px rgba(11, 18, 32, .30);
  --shadow-lg: 0 2px 6px rgba(11, 18, 32, .06), 0 30px 60px -30px rgba(11, 18, 32, .40);

  --sidebar-w: 266px;
  --topbar-h: 64px;
  --sel-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  color-scheme: dark;

  --brand: #3aa7f4;
  --brand-dark: #2b8fda;
  --brand-deep: #8ccdff;
  --brand-light: #12263a;
  --brand-soft: rgba(58, 167, 244, .14);
  --brand-ring: rgba(58, 167, 244, .30);
  --brand-grad: linear-gradient(135deg, #0f8f52 0%, #1a7fd0 58%, #0b3f8c 100%);

  --bg: #080d15;
  --surface: #101827;
  --surface-2: #141d2c;
  --surface-3: #1a2434;
  --field-bg: #0c1420;
  --row-hover: rgba(255, 255, 255, .035);

  --ink: #e9eef8;
  --ink-2: #c3cedf;
  --muted: #8b99ae;
  --muted-2: #6b7a90;

  --line: #1e2836;
  --line-2: #2a3648;
  --input: #2b3849;

  --ok: #2fbf85;
  --ok-fg: #6ee7b7;
  --ok-bg: rgba(16, 185, 129, .13);
  --ok-line: rgba(16, 185, 129, .32);

  --warn: #f0b64b;
  --warn-fg: #fbbf24;
  --warn-bg: rgba(245, 158, 11, .13);
  --warn-line: rgba(245, 158, 11, .32);

  --bad: #f87171;
  --bad-fg: #fca5a5;
  --bad-bg: rgba(239, 68, 68, .13);
  --bad-line: rgba(239, 68, 68, .32);

  --info: #7aa8ff;
  --info-fg: #a8c0ff;
  --info-bg: rgba(59, 130, 246, .14);
  --info-line: rgba(59, 130, 246, .32);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -8px rgba(0, 0, 0, .7);
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 16px 34px -22px rgba(0, 0, 0, .8);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5), 0 34px 70px -34px rgba(0, 0, 0, .9);
  --sel-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b99ae' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

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

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

body {
  margin: 0;
  font-family: Inter, 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.012em; color: var(--ink); }
p { margin: 0 0 10px; }
a { color: var(--brand); text-decoration: none; transition: color .16s ease, opacity .16s ease; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
code, kbd, samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}
::selection { background: var(--brand-ring); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.ico { flex: 0 0 auto; vertical-align: middle; }

/* Scrollbar discreta */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

/* ---------------------------------------------------------------------
   3. Shell (sidebar + main)
   ------------------------------------------------------------------ */
.shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 14px 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  z-index: 40;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9, 15, 26, .5);
  backdrop-filter: blur(2px);
  z-index: 39;
  opacity: 0;
  transition: opacity .2s ease;
}

/* Marca */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 16px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 36px;
  height: 36px;
  display: block;
  flex: 0 0 36px;
  object-fit: contain;
}
.brand-mark.lg { width: 44px; height: 44px; flex: 0 0 44px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong {
  display: block;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text span,
.brand-text small {
  display: block;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}

/* Navegacao */
.nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 10px; }
.nav-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13.25px;
  font-weight: 600;
  position: relative;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav-item .ico { color: var(--muted); transition: color .16s ease; }
.nav-item:hover { background: var(--surface-3); color: var(--ink); transform: translateX(1px); }
.nav-item:hover .ico { color: var(--brand); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 700;
}
.nav-item.active .ico { color: var(--brand); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-item .count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .count { background: var(--brand); color: var(--on-brand); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
   4. Topbar
   ------------------------------------------------------------------ */
.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.page-title {
  font-size: 15.5px;
  font-weight: 750;
  letter-spacing: -.015em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb span { color: var(--muted-2); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botoes de icone */
.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  padding: 0;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); }
.icon-btn:active { transform: scale(.96); }

.menu-btn { display: none; }

/* Alternador de tema */
.theme-toggle .theme-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-moon { display: inline-flex; }

/* Avatar */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--brand), var(--brand-deep));
  color: var(--on-brand);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  overflow: hidden;
  text-transform: uppercase;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line);
  object-fit: cover;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 15px; }
html[data-theme="dark"] .avatar { background: linear-gradient(150deg, #2f8fd6, #12457f); }

.userbox {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 5px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  list-style: none;
  transition: background .16s ease, border-color .16s ease;
}
.userbox::-webkit-details-marker { display: none; }
.userbox:hover { background: var(--surface-2); border-color: var(--line); }
.userbox .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.userbox .who strong {
  font-size: 12.75px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.userbox .who span {
  font-size: 11px;
  color: var(--muted);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.userbox .caret { color: var(--muted); transition: transform .2s ease; }
.usermenu[open] .caret { transform: rotate(180deg); }

.usermenu { position: relative; }
.usermenu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 224px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: ac-pop .16s ease both;
  z-index: 60;
}
.usermenu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background .14s ease, color .14s ease;
}
.usermenu-item .ico { color: var(--muted); }
.usermenu-item:hover { background: var(--surface-3); color: var(--ink); }
.usermenu-item:hover .ico { color: var(--brand); }
.usermenu-item.danger { color: var(--bad-fg); }
.usermenu-item.danger .ico { color: var(--bad-fg); }
.usermenu-item.danger:hover { background: var(--bad-bg); }
.usermenu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* ---------------------------------------------------------------------
   5. Conteudo / cabecalho de pagina
   ------------------------------------------------------------------ */
.content {
  padding: 22px 24px 64px;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
}
.content > * + * { margin-top: 18px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 21px; letter-spacing: -.02em; }
.page-head .sub,
.lead { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* ---------------------------------------------------------------------
   6. Cards
   ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card.hoverable { transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease; }
.card.hoverable:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--line-2); }

.banner-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: block;
}
.banner-card > a { display: block; }
.banner-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  object-position: center;
}
.banner-card .banner-body { padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner-card .banner-body .grow { min-width: 0; }
.banner-card .banner-body h3 { font-size: 15px; margin: 0 0 2px; letter-spacing: -.015em; }
.banner-card .banner-body p { margin: 0; font-size: 12.5px; color: var(--muted); }

.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, transparent), transparent);
}
.card-header h2 {
  font-size: 14.5px;
  font-weight: 750;
  letter-spacing: -.01em;
}
.card-header .sub {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
}
.card-header .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card > form,
.card > .form-grid { padding: 18px; }

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 750;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, transparent), transparent);
}
.card-title .ico { color: var(--brand); }

.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
   7. Estatisticas
   ------------------------------------------------------------------ */
.stat-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
}
/* dashboards com 6 indicadores: 3 + 3 em vez de 5 + 1 orfao */
@media (min-width: 880px) {
  .stat-grid.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  .stat-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
a.stat, a.stat:hover { color: inherit; text-decoration: none; }
a.stat:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stat .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.stat .label .ico { color: var(--brand); }
.stat .value {
  font-size: 25px;
  font-weight: 780;
  letter-spacing: -.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat .hint { font-size: 11.75px; color: var(--muted); }
.stat .hint .up { color: var(--ok); font-weight: 700; }
.stat .hint .down { color: var(--bad); font-weight: 700; }
.stat.accent {
  background: var(--brand-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 14px 30px -18px rgba(10, 79, 172, .75);
}
.stat.accent .label { color: rgba(255, 255, 255, .82); }
.stat.accent .label .ico { color: #fff; }
.stat.accent .value { color: #fff; }
.stat.accent .hint { color: rgba(255, 255, 255, .85); }
.stat.accent::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -46px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.stat.accent .stat-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.stat-value { font-size: 22px; font-weight: 780; letter-spacing: -.02em; }
.stat-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-note { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------------
   8. Grids
   ------------------------------------------------------------------ */
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------------------------------------------------------------------
   9. Tabelas
   ------------------------------------------------------------------ */
.table-wrap {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 10px 14px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr { transition: background .14s ease; }
table.table tbody tr:hover td { background: var(--row-hover); }
table.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.table .strong { color: var(--ink); font-weight: 700; }
table.table .muted { color: var(--muted); }
table.table .actions-cell {
  text-align: right;
  white-space: nowrap;
  display: table-cell;
}
table.table .actions-cell > .btn,
table.table .actions-cell > form,
table.table .actions-cell > button { vertical-align: middle; }
table.table .actions-cell > * + * { margin-left: 4px; }
table.table tfoot td {
  background: var(--surface-2);
  font-weight: 700;
  border-top: 1px solid var(--line);
  padding: 11px 14px;
}
.table-compact tbody td { padding: 8px 12px; }

.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main .name { font-weight: 700; color: var(--ink); line-height: 1.3; }
.cell-main .meta { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------------------
   10. Badges / chips
   ------------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.7;
  letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--ink-2);
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
  flex: 0 0 5px;
}
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.badge.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-fg); }
.badge.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }
.badge.brand { background: var(--brand-soft); border-color: var(--brand-ring); color: var(--brand-deep); }
.badge.muted { background: var(--surface-3); border-color: var(--line); color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

/* ---------------------------------------------------------------------
   11. Formularios
   ------------------------------------------------------------------ */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }

.field > label,
.field > .label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.25px;
  font-weight: 700;
  letter-spacing: .005em;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.field .hint {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.45;
}
.field .error {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.75px;
  font-weight: 600;
  color: var(--bad-fg);
  margin-top: 5px;
}
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea { border-color: var(--bad-line); }

.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
  appearance: none;
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.select {
  padding-right: 32px;
  background-image: var(--sel-arrow);
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-ring);
  background: var(--surface);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-3);
  color: var(--muted);
  cursor: not-allowed;
}
.input[readonly] { background: var(--surface-2); }
.input:user-invalid,
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--bad-line);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--bad) 14%, transparent);
}
input[type="file"].input { padding: 7px 10px; font-size: 12.75px; cursor: pointer; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 100px var(--field-bg) inset;
}
.input.sm { min-height: 32px; padding: 5px 10px; font-size: 12.5px; }
.input.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .01em; }

/* Campo com icone a esquerda */
.input-group { position: relative; display: flex; align-items: center; width: 100%; }
.input-group > .ico {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}
.input-group .input { padding-left: 35px; }
.input-group .input.sm { padding-left: 31px; }
.input-group .suffix {
  position: absolute;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Botao de mostrar/ocultar senha */
.pass-toggle {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.pass-toggle:hover { background: var(--surface-3); color: var(--ink); }

/* Busca */
.search-field { position: relative; display: flex; align-items: center; min-width: 0; }
.search-field > .ico { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search-field .input { padding-left: 34px; }

/* Grid de formulario */
.form-grid { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.card-body > .form-actions:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.form-note { font-size: 11.75px; color: var(--muted); margin-left: auto; }

/* Checkbox / radio */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.75px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.check input[type="checkbox"],
.check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  margin: 0;
}

/* Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12.75px;
  font-weight: 650;
  color: var(--ink-2);
  cursor: pointer;
}
.switch input {
  appearance: none;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  border-radius: var(--radius-pill);
  background: var(--line-2);
  border: 0;
  position: relative;
  cursor: pointer;
  transition: background .18s ease;
  margin: 0;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(9, 15, 26, .35);
  transition: transform .18s cubic-bezier(.3, .8, .3, 1);
}
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }

/* Controle segmentado */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: var(--radius-pill);
}
.segmented a, .segmented button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.segmented a:hover, .segmented button:hover { color: var(--ink); }
.segmented .active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* ---------------------------------------------------------------------
   12. Botoes
   ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease,
              box-shadow .15s ease, transform .1s ease;
  box-shadow: var(--shadow-xs);
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3.5px var(--brand-ring); border-color: var(--brand); }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 1px 2px rgba(9, 15, 26, .10), 0 8px 18px -12px rgba(13, 127, 209, .85);
}
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.btn.primary:focus-visible { box-shadow: 0 0 0 3.5px var(--brand-ring); }

.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: color-mix(in srgb, var(--ok) 86%, #000); border-color: transparent; color: #fff; }

.btn.danger { background: var(--surface); border-color: var(--bad-line); color: var(--bad-fg); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad-fg); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }

.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); box-shadow: none; }

.btn.link {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--brand);
  padding: 4px 2px;
}
.btn.link:hover { background: transparent; color: var(--brand-dark); text-decoration: underline; box-shadow: none; }

.btn.sm { padding: 5px 10px; font-size: 12.25px; border-radius: var(--radius-xs); gap: 5px; }
.btn.lg { padding: 11px 20px; font-size: 14px; border-radius: var(--radius); }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: rgba(255, 255, 255, .45);
  border-top-color: #fff;
  animation: ac-spin .62s linear infinite;
}
.btn:not(.primary):not(.ok).is-loading::after { border-color: var(--line-2); border-top-color: var(--brand); }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-icon:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line-2); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; margin: 0; }

/* ---------------------------------------------------------------------
   13. Avisos (flash) + toasts
   ------------------------------------------------------------------ */
.flash {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.25px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: ac-rise .3s cubic-bezier(.22, .8, .28, 1) both;
}
.flash > .ico { margin-top: 1px; }
.flash > div { flex: 1 1 auto; min-width: 0; }
.flash.is-hiding { opacity: 0; transform: translateY(-4px); transition: opacity .32s ease, transform .32s ease; }
.flash.success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.flash.error { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-fg); }
.flash.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }
.flash.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.flash:has(.flash-close) { padding-right: 42px; }
.flash-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: currentColor;
  opacity: .6;
  cursor: pointer;
  transition: opacity .14s ease, background .14s ease;
}
.flash-close:hover { opacity: 1; background: rgba(127, 127, 127, .16); }
.flash::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: currentColor;
  opacity: .28;
  transform-origin: left center;
  animation: ac-drain 7s linear forwards;
}

.toast-stack {
  position: fixed;
  z-index: 90;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(376px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: ac-toast-in .26s cubic-bezier(.22, .8, .28, 1) both;
}
.toast.out { animation: ac-toast-out .22s ease forwards; }
.toast > .ico { margin-top: 1px; }
.toast > div { flex: 1 1 auto; min-width: 0; }
.toast .toast-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}
.toast .toast-close:hover { background: var(--surface-3); color: var(--ink); }
.toast::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--brand);
  transform-origin: left center;
  animation: ac-drain 3.8s linear forwards;
}
.toast.success::after { background: var(--ok); }
.toast.error::after { background: var(--bad); }
.toast.info::after { background: var(--info); }
.toast.success > .ico { color: var(--ok); }
.toast.error > .ico { color: var(--bad); }
.toast.info > .ico { color: var(--info); }

/* ---------------------------------------------------------------------
   14. Diversos de layout
   ------------------------------------------------------------------ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.toolbar .grow { flex: 1 1 220px; min-width: 0; max-width: 420px; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.toolbar > div > h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.toolbar > div > .muted { margin: 4px 0 0; }
.toolbar .toolbar-actions form { display: flex; gap: 8px; align-items: center; margin: 0; }
.table tbody tr.is-me { background: var(--brand-soft); }
.table tbody tr.is-me td { font-weight: 650; }
.col-span-all { grid-column: 1 / -1; }

.empty {
  text-align: center;
  padding: 46px 22px;
  color: var(--muted);
  font-size: 13.5px;
}
.empty::before {
  content: "";
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: var(--surface-3);
  border: 1px dashed var(--line-2);
}
.empty strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }

.pager {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.pager-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pager-link:hover { background: var(--surface-3); border-color: var(--line-2); color: var(--ink); }
.pager-link.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 8px 18px -12px rgba(13, 127, 209, .9);
}
.pager-link.disabled { opacity: .45; pointer-events: none; }

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
  background: var(--surface);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 4px;
  margin-right: 14px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.kv {
  display: grid;
  grid-template-columns: minmax(120px, 150px) 1fr;
  gap: 0;
  font-size: 13px;
  margin: 0;
}
.kv > dt,
.kv > .k {
  color: var(--muted);
  font-weight: 600;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.kv > dd,
.kv > .v {
  margin: 0;
  text-align: right;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.kv > dt:last-of-type,
.kv > dd:last-of-type { border-bottom: 0; }
/* forma curta: <div class="kv"><span>rotulo</span><strong>valor</strong></div> */
.kv > span:not(.k):not(.v) {
  color: var(--muted);
  font-weight: 600;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.kv > strong:not(.v) {
  text-align: right;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.kv.total > span,
.kv.total > strong {
  border-bottom: 0;
  padding-top: 13px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 780;
}
.kv.total > dt,
.kv.total > dd,
.kv.total > .k,
.kv.total > .v {
  border-bottom: 0;
  padding-top: 13px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 780;
}
.card > .kv,
.card-body > .kv { padding: 4px 18px; }
.card > .kv + .kv { padding-top: 0; }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 190px;
  padding: 6px 0 0;
}
.bars .bar {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  min-width: 0;
}
.bars .bar i {
  display: block;
  width: 100%;
  max-width: 46px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #7dd3fc, var(--brand));
  transition: filter .16s ease, transform .16s ease;
  transform-origin: bottom center;
}
.bars .bar:hover i { filter: saturate(140%) brightness(1.04); }
.bars .bar span,
.bars .bar b {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.list li:last-child { border-bottom: 0; }
.list li .grow { min-width: 0; }
.list li .grow strong { display: block; color: var(--ink); font-weight: 700; }
.list li .grow span { font-size: 11.75px; color: var(--muted); }
.list.pad { padding: 4px 18px; }

/* Loader / esqueleto */
.skeleton {
  border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--line) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: ac-shimmer 1.4s ease infinite;
  height: 12px;
}

.progress { height: 7px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #38bdf8);
}

/* ---------------------------------------------------------------------
   15. Autenticacao
   Estrutura: painel de marca (esquerda) + cartao do formulario (direita).
   ------------------------------------------------------------------ */
.auth-body { background: var(--bg); }

/* Pagina: marca no topo, cartao centrado, rodape discreto. */
.auth-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px clamp(16px, 4vw, 32px) 18px;
  background: var(--bg);
  overflow-x: hidden;
}
.auth-page::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: min(58vh, 520px);
  background: radial-gradient(46rem 17rem at 50% -8rem, var(--brand-soft), transparent 74%);
  pointer-events: none;
}

.auth-main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: clamp(20px, 6vh, 54px) 0;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.auth-brand:hover { color: var(--ink); }
.auth-brand img {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}
.auth-brand strong {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1.1;
}

.auth-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  padding-top: 12px;
  font-size: 11.5px;
  color: var(--muted-2);
}
.auth-foot a { color: var(--muted); font-weight: 600; }
.auth-foot a:hover { color: var(--brand); }
.auth-foot-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
}

/* --- Cartao do formulario ---------------------------------------------- */
.auth-card {
  width: 100%;
  max-width: 404px;
  padding: 30px clamp(20px, 3.4vw, 32px) 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(11, 18, 32, .04), 0 34px 60px -46px rgba(11, 18, 32, .55);
  animation: ac-rise .32s cubic-bezier(.22, .8, .28, 1) both;
}

/* Alternador de tema: fixo no canto superior direito. */
.auth-theme {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 6;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.auth-theme:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); }
.auth-theme:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-ring); }
.auth-theme span { display: inline-flex; }
.auth-theme .theme-moon { display: none; }
html[data-theme="dark"] .auth-theme .theme-moon { display: inline-flex; }
html[data-theme="dark"] .auth-theme .theme-sun { display: none; }

.auth-eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.auth-title {
  margin: 0;
  font-size: clamp(20px, 1.6vw, 23px);
  font-weight: 750;
  line-height: 1.24;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.auth-sub {
  margin: 7px 0 22px;
  max-width: 34ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-form .field { margin-bottom: 14px; }
.auth-form .flash { margin-bottom: 16px; }

.field-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.field-line > label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.25px;
  font-weight: 700;
  letter-spacing: .005em;
  color: var(--ink-2);
}
.field-link { font-size: 11.75px; font-weight: 650; white-space: nowrap; }

.auth-remember {
  display: flex;
  width: 100%;
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(9, 15, 26, .10), 0 14px 28px -16px rgba(13, 127, 209, .85);
}
.auth-submit svg { transition: transform .16s ease; }
.auth-submit:hover svg { transform: translateX(2px); }

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 12.25px;
  color: var(--muted);
}
.auth-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-weight: 650;
  transition: color .14s ease;
}
.auth-footer a:hover { color: var(--brand); }
.auth-footer a svg { flex: 0 0 auto; color: var(--muted-2); }

.auth-help {
  width: 100%;
  max-width: 404px;
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.auth-help a { font-weight: 650; }

.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.auth-note svg { flex: 0 0 auto; margin-top: 1px; }

.auth-opts { display: grid; gap: 10px; margin: 18px 0 0; }
.auth-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.auth-opt:hover { border-color: var(--brand); }
.auth-opt.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.auth-opt-ic {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--brand);
  background: var(--surface-2);
}
.auth-opt-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.auth-opt-txt strong { font-size: 13.5px; font-weight: 650; }
.auth-opt-txt small { font-size: 11.5px; color: var(--muted); }
.auth-opt-check { margin-left: auto; flex: 0 0 auto; color: var(--brand); opacity: 0; transition: opacity .15s ease; }
.auth-opt.is-active .auth-opt-check { opacity: 1; }
html[data-theme="dark"] .auth-opt-ic { background: rgba(255, 255, 255, .07); }
html[data-theme="dark"] .auth-opt.is-active { background: rgba(21, 148, 232, .14); }

/* Em telas baixas (teclado aberto no celular) o conteudo sobe. */
@media (max-height: 620px) {
  .auth-main { justify-content: flex-start; padding-top: 18px; }
}

@media (max-width: 480px) {
  .auth-page { padding: 16px 12px 14px; }
  .auth-card { padding: 24px 18px 22px; border-radius: 16px; }
  .auth-title { font-size: 20px; }
  .auth-brand img { flex-basis: 34px; width: 34px; height: 34px; }
  .auth-brand strong { font-size: 15.5px; }
  .auth-theme { top: 12px; right: 12px; }
}

/* ---------------------------------------------------------------------
   16. Dialogo
   ------------------------------------------------------------------ */
dialog.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  max-width: 460px;
  width: calc(100vw - 32px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  animation: ac-pop .18s ease both;
}
dialog.modal::backdrop {
  background: rgba(9, 15, 26, .48);
  backdrop-filter: blur(3px);
}
dialog.modal form { padding: 22px; }
dialog.modal h3 { font-size: 16.5px; margin-bottom: 6px; letter-spacing: -.02em; }
dialog.modal p.muted { font-size: 13px; }
dialog.modal .form-actions { border-top: 0; padding-top: 0; }

/* ---------------------------------------------------------------------
   17. Site publico
   ------------------------------------------------------------------ */
.public { background: var(--surface); }
.public .container { max-width: 1120px; margin: 0 auto; padding: 0 22px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 35;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header > .container {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.site-header .brand { border: 0; padding: 0; margin: 0; }
.site-header .brand-text strong { font-size: 14.5px; }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.site-nav > a { color: var(--ink-2); }
.site-nav > a:hover { color: var(--brand); }
.site-nav .usermenu { font-size: 13px; }
.site-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}
.site-user-name { font-size: 12.5px; font-weight: 700; color: var(--ink); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-user form { display: inline-flex; margin: 0; }

.hero {
  background:
    radial-gradient(760px 380px at 8% -20%, var(--brand-soft), transparent 62%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  border-bottom: 1px solid var(--line);
  padding: 54px 0 46px;
}
.hero > .container { display: grid; gap: 26px; }
.hero h1 { font-size: 38px; line-height: 1.12; letter-spacing: -.03em; max-width: 20ch; }
.hero p { font-size: 15.5px; color: var(--muted); max-width: 58ch; margin-top: 12px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-media { border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.hero-media img { display: block; width: 100%; height: auto; }

.steps { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 8px; }
.steps .step-num {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 780;
  font-size: 13px;
  margin-bottom: 10px;
}

.section-head { text-align: center; margin: 42px 0 18px; }
.section-head h2 { font-size: 24px; letter-spacing: -.025em; }
.section-head p { color: var(--muted); font-size: 13.5px; margin-top: 6px; }

.public .card-body h3 { font-size: 15.5px; letter-spacing: -.015em; }
.public .card-body p { margin: 0 0 10px; }
.public .card-body p:last-child { margin-bottom: 0; }
.steps .step-num { margin-bottom: 10px; }
.plan-price { font-size: 22px; letter-spacing: -.02em; margin: 12px 0 4px; }
.plan-price span { font-size: 13px; font-weight: 600; }

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: 20px 0;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 46px;
}
.site-footer > .container { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); font-weight: 600; }
.site-footer a:hover { color: var(--brand); }
.site-footer .links { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   18. Wizard / etapas
   ------------------------------------------------------------------ */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.wizard-steps .step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface-3);
  white-space: nowrap;
}
.wizard-steps .step .num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--line-2);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 750;
}
.wizard-steps .step.done { background: var(--ok-bg); color: var(--ok-fg); }
.wizard-steps .step.done .num { background: var(--ok); color: #fff; }
.wizard-steps .step.current { background: var(--brand); color: var(--on-brand); box-shadow: 0 8px 16px -12px rgba(13, 127, 209, .9); }
.wizard-steps .step.current .num { background: rgba(255, 255, 255, .25); color: #fff; }

/* ---------------------------------------------------------------------
   19. Utilitarios
   ------------------------------------------------------------------ */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.input.w-70 { width: 70px; }
.input.w-80 { width: 80px; }
.input.w-90 { width: 90px; }
.input.w-110 { width: 110px; }
.input.w-130 { width: 130px; }
.input.w-150 { width: 150px; }
.input.w-170 { width: 170px; }
.input.w-200 { width: 200px; }
th.w-70 { width: 70px; }
th.w-1pct { width: 1%; }
.card-foot { padding: 16px 18px; border-top: 1px solid var(--line); }
.form-actions.pad { padding: 0 18px 18px; }
.narrow { max-width: 820px; }
.narrow-sm { max-width: 560px; }
.thumb { height: 72px; border-radius: var(--radius-xs); border: 1px solid var(--line); object-fit: cover; }
.termos-title { font-size: 30px; letter-spacing: -.025em; }
.termos-body { line-height: 1.7; }
.termos-body h3 { margin-top: 22px; }
.termos-body h3:first-child { margin-top: 0; }
.flash-top { padding-top: 20px; }
.flash-top .flash + .flash { margin-top: 10px; }
.cell-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cell-stack { display: grid; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.check.uf { min-width: 64px; }
.section-sub { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mb-sm { margin-bottom: 8px; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.card-foot-form { padding: 16px 18px; border-top: 1px solid var(--line); }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline.sm { gap: 8px; align-items: center; }
.row-block { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.banner-thumb { aspect-ratio: 16 / 7; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-2); }
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bars.h-140 { height: 140px; }
.form-sep { border-top: 1px solid var(--line); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.strong { font-weight: 700; color: var(--ink); }
.grow { flex: 1 1 auto; min-width: 0; }
.req { color: var(--bad); font-weight: 700; }
.example-thumb { max-height: 78px; border-radius: var(--radius-xs); border: 1px solid var(--line); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }
.m-0 { margin: 0; }
.ml-8 { margin-left: 8px; }
.bullets { margin: 6px 0 0 18px; }
.auth-narrow { max-width: 880px; }
.link-title { display: flex; align-items: center; gap: 8px; font-size: 15px; letter-spacing: -.015em; margin: 0; }
.page-hello { margin: 0; font-size: 20px; letter-spacing: -.02em; }

/* Paginas internas / wizard publico */
.page-section { padding: 32px 0 60px; }
.page-head.lg h1 { font-size: 26px; }
.grid-2.top { align-items: start; }
.stack.lg { gap: 18px; }
.wizard-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1000px) {
  .wizard-layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .wizard-layout > .wizard-main { max-width: 760px; }
}
.sticky-aside { position: sticky; top: 88px; }
.step-card { display: none; }
.step-card.is-current { display: block; border-color: var(--brand-ring); box-shadow: 0 0 0 3px var(--brand-ring), var(--shadow-sm); }
.step-card .card-title { background: var(--surface-2); }

/* Navegacao do wizard: Voltar (esquerda) e Continuar (direita) na mesma linha */
.step-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-nav .btn.primary { margin-left: auto; }

/* Busca de veiculo: overlay de progresso enquanto o provedor e a FIPE respondem */
body.consulta-ativa { overflow: hidden; }
.consulta-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 19, 32, .58);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: ac-fade .18s ease both;
}
.consulta-overlay[hidden] { display: none; }
.consulta-card {
  width: 100%;
  max-width: 384px;
  padding: 26px 24px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 64px -26px rgba(9, 20, 34, .6);
  animation: ac-pop .22s cubic-bezier(.22, .8, .28, 1) both;
}
.consulta-estrada {
  position: relative;
  height: 66px;
  margin: 0 auto 16px;
  max-width: 264px;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--line);
}
.consulta-estrada::before {
  content: '';
  position: absolute;
  left: -46px;
  right: -46px;
  bottom: 15px;
  height: 3px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--brand) 0 22px, transparent 22px 46px);
  opacity: .5;
  animation: ac-estrada 1.15s linear infinite;
}
.consulta-carro {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  color: var(--brand);
  transform: translate(-50%, -50%);
  animation: ac-carro 1.15s ease-in-out infinite;
}
.consulta-carro::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: var(--brand);
  opacity: .18;
  animation: ac-halo 1.7s ease-out infinite;
}
.consulta-carro svg { position: relative; }
.consulta-titulo { margin: 0 0 5px; font-size: 16px; letter-spacing: -.015em; }
.consulta-msg { margin: 0; min-height: 19px; font-size: 13px; color: var(--muted); }
.consulta-barra { position: relative; height: 5px; margin: 15px 0 14px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.consulta-barra > span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #fff));
  animation: ac-barra 1.25s cubic-bezier(.5, .1, .4, .9) infinite;
}
.consulta-esqueleto { display: grid; gap: 8px; padding: 0 6px; }
.consulta-esqueleto > span {
  height: 9px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 40%, var(--surface-3) 80%);
  background-size: 220% 100%;
  animation: ac-shimmer 1.4s linear infinite;
}
.consulta-esqueleto > span:nth-child(2) { width: 78%; }
.consulta-esqueleto > span:nth-child(3) { width: 55%; }
.consulta-dica { margin: 15px 0 0; font-size: 11.5px; color: var(--muted); opacity: .85; }
.kv > .k.sum-total,
.kv > .v.sum-total { border-bottom: 0; padding-top: 13px; color: var(--ink); font-size: 15px; font-weight: 780; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------
   20. Animacoes
   ------------------------------------------------------------------ */
@keyframes ac-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes ac-pop {
  from { opacity: 0; transform: scale(.97) translateY(-3px); }
  to { opacity: 1; transform: none; }
}
@keyframes ac-spin { to { transform: rotate(360deg); } }
@keyframes ac-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ac-estrada {
  from { transform: translateX(0); }
  to { transform: translateX(-46px); }
}
@keyframes ac-carro {
  0%, 100% { transform: translate(-50%, -52%); }
  50% { transform: translate(-50%, -45%); }
}
@keyframes ac-halo {
  0% { transform: scale(.62); opacity: .24; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes ac-barra {
  from { left: -42%; }
  to { left: 100%; }
}
@keyframes ac-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}
@keyframes ac-drain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
@keyframes ac-toast-in {
  from { opacity: 0; transform: translateX(16px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes ac-toast-out {
  to { opacity: 0; transform: translateX(16px) scale(.98); }
}

.content > * { animation: ac-rise .32s cubic-bezier(.22, .8, .28, 1) both; }
.content > *:nth-child(2) { animation-delay: .035s; }
.content > *:nth-child(3) { animation-delay: .07s; }
.content > *:nth-child(4) { animation-delay: .1s; }
.content > *:nth-child(5) { animation-delay: .13s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .consulta-carro { transform: translate(-50%, -50%); }
  .consulta-barra > span { left: 0; width: 100%; opacity: .6; }
}

/* ---------------------------------------------------------------------
   21. Responsivo
   ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 56px; }
  .userbox .who { display: none; }
}

@media (max-width: 980px) {
  .shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    height: 100vh;
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.32, .72, .28, 1);
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--line);
    z-index: 41;
  }
  html.js .shell.nav-open .sidebar { transform: none; }
  html.js .shell.nav-open .sidebar-backdrop { display: block; opacity: 1; }
  html:not(.js) .sidebar {
    position: static;
    transform: none;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  html:not(.js) .sidebar .nav { flex-direction: row; flex-wrap: wrap; }
  .menu-btn { display: inline-flex; }
  .hero h1 { font-size: 30px; }
  .hero { padding: 38px 0 32px; }
  .stat .value { font-size: 22px; }
}

@media (max-width: 640px) {
  .content { padding: 14px 12px 52px; }
  .topbar { min-height: 58px; gap: 8px; }
  .breadcrumb { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv > dt, .kv > .k { padding-bottom: 0; border-bottom: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
  .kv > dd, .kv > .v { text-align: left; padding-top: 2px; }
  .toolbar { padding: 11px 13px; }
  .toolbar .grow { max-width: none; }
  .card-header, .card-body { padding: 14px; }
  .card-title { padding: 12px 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14px; }
  .site-nav { gap: 12px; font-size: 12.5px; width: 100%; justify-content: flex-start; }
  .site-header > .container { gap: 10px; }
  .public .container { padding: 0 16px; }
  .auth-card { padding: 24px 20px 22px; border-radius: 16px; }
  .toast-stack { right: 10px; left: 10px; bottom: 10px; width: auto; }
  .stat { padding: 13px 14px; }
  .page-title { font-size: 14.5px; }
  .userbox { padding: 3px; }
  .usermenu-panel { min-width: 200px; }
}

/* ---------------------------------------------------------------------
   22. Impressao
   ------------------------------------------------------------------ */
@media print {
  .sidebar, .topbar, .site-header, .site-footer, .pager, .toolbar,
  .toast-stack, .flash-close, .menu-btn, .theme-toggle { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #d5dde8; break-inside: avoid; }
  .shell { display: block; }
}

/* ---------------------------------------------------------------------
   23. Consultas (API Nemesis)
   ------------------------------------------------------------------ */
.nm-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.nm-mods { display: grid; gap: 14px; margin-bottom: 18px; }
.nm-group .section-sub { margin: 0 0 8px; }
.nm-group-items { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.nm-mod {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
  min-width: 0;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.nm-mod .ico { color: var(--muted); flex: 0 0 auto; transition: color .16s ease; }
.nm-mod span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-mod:hover { background: var(--row-hover); border-color: var(--line-2); color: var(--ink); }
.nm-mod.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
  box-shadow: 0 0 0 3px rgba(13, 127, 209, .10);
}
.nm-mod.is-active .ico { color: var(--brand); }

.nm-form { border-top: 1px solid var(--line); padding-top: 16px; }
.nm-search { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.nm-search .field { margin-bottom: 0; }
.nm-search .grow { flex: 1 1 240px; }
.nm-check { padding-bottom: 10px; white-space: nowrap; }
.nm-submit { min-height: 38px; }
.nm-help { margin: 10px 0 0; font-size: 11.75px; color: var(--muted); line-height: 1.55; }

.nm-meta {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  flex-wrap: wrap;
  font-size: 11.75px;
  color: var(--muted);
  padding-bottom: 12px;
}
.nm-meta strong { color: var(--ink-2); }
.nm-meta-link { margin-left: auto; font-weight: 650; color: var(--brand); }

.nm-out {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 14px 16px;
  max-height: 620px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.nm-out .nm-l { display: block; white-space: pre-wrap; }
.nm-out .nm-sep { height: 1px; margin: 9px 0; background: var(--line); color: transparent; overflow: hidden; }
.nm-out .nm-head { font-family: inherit; font-weight: 750; color: var(--ink); margin-top: 4px; }
.nm-out .nm-item { font-family: inherit; font-weight: 700; color: var(--brand-deep); }
.nm-rich { font-family: inherit; font-size: 13px; }
.nm-rich p { margin: 0 0 8px; }
.nm-rich b, .nm-rich strong { color: var(--ink); font-weight: 700; }
.nm-rich h1, .nm-rich h2, .nm-rich h3, .nm-rich h4 { font-size: 13.5px; margin: 12px 0 6px; color: var(--ink); }
.nm-rich ul, .nm-rich ol { margin: 6px 0 10px; padding-left: 20px; }
.nm-rich hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.nm-rich table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.nm-rich th, .nm-rich td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }

.nm-skel { display: flex; flex-direction: column; gap: 10px; }
.nm-skel .skeleton.w60 { width: 60%; }
.nm-skel .skeleton.w80 { width: 80%; }
.nm-spin {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ac-spin .7s linear infinite;
  vertical-align: -2px;
}

/* Atalhos de consulta dentro das telas de detalhe */
.nm-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.nm-links-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.nm-links-label .ico { color: var(--brand); }
.nm-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  max-width: 100%;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.nm-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-link .ico { color: var(--muted); flex: 0 0 auto; transition: color .16s ease; }
.nm-link:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
  transform: translateY(-1px);
}
.nm-link:hover .ico { color: var(--brand); }

/* Relatorio organizado da consulta (NemesisRelatorio) */
.nm-rep { display: grid; gap: 12px; }

.nm-sec {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.nm-sec.is-flat { background: transparent; border: 0; }
.nm-sec.is-flat > .nm-sec-b { padding: 0; }
.nm-sec-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.nm-sec-h .ico { color: var(--brand); flex: 0 0 auto; }
.nm-sec-h h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nm-sec-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  flex: 0 0 auto;
}
.nm-sec-n { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.nm-sec-b { padding: 13px; display: grid; gap: 12px; }

.nm-kv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 10px 16px;
  margin: 0;
}
.nm-kv-i { min-width: 0; display: grid; gap: 1px; align-content: start; }
.nm-kv-i.wide { grid-column: 1 / -1; }
.nm-kv dt {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.nm-kv dt .ico { color: var(--muted-2); flex: 0 0 auto; }
.nm-kv dt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-kv dd { margin: 0; font-size: 13.25px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.nm-kv dd p { margin: 0 0 6px; }
.nm-kv dd p:last-child { margin-bottom: 0; }
.nm-kv dd code.mono,
.nm-list code.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
}
.nm-sec.is-flat .nm-kv dd code.mono { background: var(--surface); }
.nm-data { font-size: 12px; color: var(--muted); }
.nm-vazio { color: var(--muted-2); font-size: 12.5px; }
.nm-ext {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.nm-ext .ico { flex: 0 0 auto; }
.nm-foto img {
  display: block;
  max-width: 176px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.nm-rec {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 11px 13px;
  display: grid;
  gap: 9px;
}
.nm-rec-h {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
  min-width: 0;
}
.nm-rec-h .ico { color: var(--brand); flex: 0 0 auto; }
.nm-rec-h strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-rec-n {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.nm-grp-h {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 -2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.nm-grp-h .ico { color: var(--brand); flex: 0 0 auto; }

.nm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.nm-list li {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.nm-list li .ico { color: var(--brand); flex: 0 0 auto; position: relative; top: 2px; }
.nm-list li code.mono { flex: 0 0 auto; }

.nm-flags { display: flex; flex-wrap: wrap; gap: 6px; }

.nm-note {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12.75px;
  line-height: 1.55;
  color: var(--ink-2);
}
.nm-note .ico { flex: 0 0 auto; margin-top: 1px; color: var(--muted); }
.nm-note strong { display: block; margin-bottom: 2px; font-size: 12.75px; color: var(--ink); }
.nm-note p { margin: 0 0 5px; }
.nm-note p:last-child { margin-bottom: 0; }
.nm-note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.nm-note.warn .ico, .nm-note.warn strong { color: var(--warn-fg); }
.nm-note.bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-fg); }
.nm-note.bad .ico, .nm-note.bad strong { color: var(--bad-fg); }

@media (max-width: 560px) {
  .nm-kv { grid-template-columns: minmax(0, 1fr); }
  .nm-sec-b { padding: 11px; }
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .01em; }
/* ---------------------------------------------------------------------
   22. Inteligencia do dashboard: KPIs, alertas e fluxo do dia
   ------------------------------------------------------------------ */
.kpi-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px 12px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--brand);
}
.kpi.ok::before { background: var(--ok); }
.kpi.warn::before { background: var(--warn); }
.kpi.bad::before { background: var(--bad); }
.kpi.info::before { background: var(--info); }
.kpi .k-label {
  font-size: 10.75px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi .k-label .ico { color: var(--brand); }
.kpi.ok .k-label .ico { color: var(--ok); }
.kpi.warn .k-label .ico { color: var(--warn); }
.kpi.bad .k-label .ico { color: var(--bad); }
.kpi.info .k-label .ico { color: var(--info); }
.kpi .k-value {
  font-size: clamp(19px, 1.5vw, 22px);
  font-weight: 780;
  letter-spacing: -.03em;
  line-height: 1.12;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.kpi .k-foot {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.delta.up { background: var(--ok-bg); color: var(--ok-fg); }
.delta.down { background: var(--bad-bg); color: var(--bad-fg); }
.delta.down .ico { transform: scaleY(-1); }

.ops { list-style: none; margin: 0; padding: 0; }
.ops li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.ops li:last-child { border-bottom: 0; padding-bottom: 2px; }
.ops .ops-ico {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--muted);
}
.ops .lv-bad .ops-ico { background: var(--bad-bg); color: var(--bad-fg); }
.ops .lv-warn .ops-ico { background: var(--warn-bg); color: var(--warn-fg); }
.ops .lv-info .ops-ico { background: var(--info-bg); color: var(--info-fg); }
.ops .lv-good .ops-ico { background: var(--ok-bg); color: var(--ok-fg); }
.ops .ops-body { flex: 1; min-width: 0; }
.ops .ops-body strong { display: block; font-size: 12.75px; font-weight: 700; color: var(--ink); }
.ops .ops-body span { font-size: 11.75px; color: var(--muted); }
.ops .ops-act { flex: none; align-self: center; }

.flow-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); }
a.flow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: inherit;
  text-decoration: none;
  transition: border-color .18s ease, background .18s ease;
}
a.flow-item:hover { border-color: var(--brand); background: var(--brand-soft); }
a.flow-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.flow-item .flow-ico { color: var(--brand); flex: none; }
.flow-item b {
  display: block;
  font-size: 17px;
  font-weight: 780;
  letter-spacing: -.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.flow-item span { font-size: 11.5px; color: var(--muted); }
/* ---------------------------------------------------------------------
   Controle de pagamentos (admin e afiliado)
   --------------------------------------------------------------------- */
.pay-list { display: grid; gap: 10px; }
.pay-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.pay-item.is-late { border-color: var(--bad-fg); }
.pay-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  flex-wrap: wrap;
}
.pay-head .pay-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.pay-head .pay-sub { font-size: 11.75px; color: var(--muted); }
.pay-head .pay-value {
  margin-left: auto;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.pay-body { padding: 12px 14px; display: grid; gap: 10px; }
.pay-body:empty { display: none; }
.pay-box > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--brand);
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  user-select: none;
}
.pay-box > summary::-webkit-details-marker { display: none; }
.pay-box > summary::before { content: "+"; font-weight: 780; line-height: 1; }
.pay-box[open] > summary::before { content: "\2212"; }
.pay-box > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pay-box[open] > summary { margin-bottom: 10px; }
.pay-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.pay-form .pay-form-wide { grid-column: 1 / -1; }
.pay-form .form-actions, .pay-form .pay-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pay-events { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.pay-events li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 11.75px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 8px;
}
.pay-events li b { color: var(--ink); font-weight: 650; }
.pay-events li time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-note { font-size: 11.75px; color: var(--muted); }