/* ==========================================================
   Sistema de Empréstimos — estilos
   Linguagem visual: neutros (zinc), bordas finas, pouca sombra,
   cor só para significado (pago / atrasado / aviso), números tabulares.
   ========================================================== */
/* Geist Sans / Geist Mono (Vercel, SIL OFL 1.1 - ver fonts/LICENSE-Geist-OFL.txt), servidas localmente (CSP 'self') */
@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e4e4e7;
  --border-forte: #d4d4d8;
  --text: #09090b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --primary: #18181b;
  --primary-hover: #27272a;
  --on-primary: #fafafa;       /* texto/ícone sobre fundo --primary */
  --on-primary-2: #d4d4d8;     /* texto secundário sobre --primary */
  --secondary-hover: #e9e9eb;
  --surface-sutil: #fcfcfc;    /* hover de linha, fundo de estado vazio */
  --seg-ativo: #ffffff;        /* opção ativa do segmentado */
  --sidebar: #f4f4f5;          /* fundo da página no layout inset (sidebar + moldura do painel) */
  --sidebar-2: #e9e9ec;        /* hover de item */
  --sidebar-accent: #e4e4e7;   /* item ativo */
  --sidebar-texto: #3f3f46;
  --sidebar-rotulo: color-mix(in srgb, var(--muted) 70%, transparent);
  --painel-borda: #e4e4e7;
  --shadow-painel: 0 1px 2px rgb(0 0 0 / .04), 0 1px 3px -1px rgb(0 0 0 / .03);
  --radius-painel: 14px;
  --topbar-bg: rgba(250, 250, 250, .96);
  --backdrop: rgba(0, 0, 0, .32);
  --selecao: #e4e4e7;
  --anel: #a1a1aa;             /* borda de foco dos campos */
  --anel-suave: rgba(161, 161, 170, .24);
  /* Derivados (color-mix resolve com as cores do tema ativo, não precisam ser repetidos no escuro) */
  --placeholder: color-mix(in srgb, var(--muted) 72%, transparent);
  --input-borda: color-mix(in srgb, var(--border-forte) 84%, transparent);
  --invalido-borda: color-mix(in srgb, var(--danger) 36%, transparent);
  --invalido-foco: color-mix(in srgb, var(--danger) 64%, transparent);
  --invalido-anel: color-mix(in srgb, var(--danger) 16%, transparent);
  --accent: var(--surface-2);  /* hover de outline/ghost, esqueletos */
  --accent-50: color-mix(in srgb, var(--accent) 50%, var(--surface));
  --muted-72: color-mix(in srgb, var(--surface-2) 72%, transparent); /* rodapé do modal */
  --primary-90: color-mix(in srgb, var(--primary) 90%, transparent);
  --popover: #ffffff;
  --shadow-input: 0 1px 2px rgb(0 0 0 / .04);
  --shadow-card: 0 1px 2px rgb(0 0 0 / .04), 0 1px rgb(0 0 0 / .04);
  --shadow-modal: 0 24px 48px -12px rgb(0 0 0 / .18), 0 4px 12px -4px rgb(0 0 0 / .06);
  --shadow-toast: 0 8px 24px -6px rgb(0 0 0 / .12), 0 2px 6px -2px rgb(0 0 0 / .05);
  --btn-realce: inset 0 1px 0 rgb(255 255 255 / .16);
  --check-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fafafa' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --indet-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fafafa' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
  --chevron-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E");
  --radius-lg: 16px;           /* modal */
  --pontilhado: #e4e4e7;       /* padrão de pontos do login */
  --ponto-neutro: #a1a1aa;
  --ponto-fraco: #d4d4d8;
  --travado-2: #ececee;
  --switch-botao: #ffffff;
  --spin-trilho: rgba(255, 255, 255, .35);
  --success: #047857;
  --success-soft: #ecfdf5;
  --on-success: #ffffff;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --warning-borda: #fde68a;
  --warning-texto: #92400e;
  --danger: #dc2626;
  --danger-texto: #b91c1c;
  --danger-texto-forte: #991b1b;
  --danger-soft: #fef2f2;
  --danger-borda: #fecaca;
  --danger-btn: #dc2626;
  --danger-btn-hover: #b91c1c;
  --invalido: #f87171;
  --linha-atrasada: #fffafa;
  --info: #2563eb;
  --viz-azul: #2a78d6;
  --radius: 12px;              /* cards, menus, toasts */
  --radius-sm: 8px;            /* campos, botões */
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 30px -8px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .05);
  --shadow-hover: 0 8px 24px -12px rgba(0, 0, 0, .18);
  --shadow-seg: 0 1px 2px rgba(0, 0, 0, .08);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--anel);
  --font: "Geist", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", "Cascadia Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Tema escuro: escolhido pelo usuário (salvo no banco) e aplicado em <html data-theme="escuro">.
   Mesma linguagem zinc; o "primário" se inverte (claro sobre escuro). Nada automático. */
:root[data-theme="escuro"] {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #1c1c1f;
  --border: #27272a;
  --border-forte: #3f3f46;
  --text: #fafafa;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --primary: #fafafa;
  --primary-hover: #e4e4e7;
  --on-primary: #18181b;
  --on-primary-2: #52525b;
  --secondary-hover: #27272a;
  --surface-sutil: #151518;
  --seg-ativo: #2c2c31;
  --sidebar: #09090b;
  --sidebar-2: #18181b;
  --sidebar-accent: #202023;
  --sidebar-texto: #d4d4d8;
  --painel-borda: #27272a;
  --shadow-painel: 0 1px 2px rgb(0 0 0 / .5);
  --topbar-bg: rgba(9, 9, 11, .92);
  --backdrop: rgba(0, 0, 0, .48);
  --selecao: #3f3f46;
  --anel: #71717a;
  --anel-suave: rgba(113, 113, 122, .32);
  --popover: #141416;
  --shadow-input: 0 1px 2px rgb(0 0 0 / .24);
  --shadow-card: 0 1px 2px rgb(0 0 0 / .4), inset 0 1px 0 rgb(255 255 255 / .04);
  --shadow-modal: 0 24px 56px -12px rgb(0 0 0 / .7), inset 0 1px 0 rgb(255 255 255 / .05);
  --shadow-toast: 0 12px 32px -8px rgb(0 0 0 / .6), inset 0 1px 0 rgb(255 255 255 / .04);
  --btn-realce: inset 0 1px 0 rgb(255 255 255 / .5), inset 0 -1px 0 rgb(0 0 0 / .12);
  --check-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --indet-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
  --chevron-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E");
  --pontilhado: #1f1f23;
  --ponto-neutro: #71717a;
  --ponto-fraco: #52525b;
  --travado-2: #232327;
  --switch-botao: #e4e4e7;
  --spin-trilho: rgba(0, 0, 0, .22);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .1);
  --on-success: #052e16;
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .08);
  --warning-borda: rgba(251, 191, 36, .28);
  --warning-texto: #fcd34d;
  --danger: #ef4444;
  --danger-texto: #f87171;
  --danger-texto-forte: #fca5a5;
  --danger-soft: rgba(239, 68, 68, .1);
  --danger-borda: rgba(248, 113, 113, .32);
  --danger-btn: #dc2626;
  --danger-btn-hover: #b91c1c;
  --invalido: #ef4444;
  --linha-atrasada: rgba(239, 68, 68, .055);
  --info: #60a5fa;
  --viz-azul: #3987e5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, .75), 0 2px 6px rgba(0, 0, 0, .4);
  --shadow-hover: 0 10px 28px -14px rgba(0, 0, 0, .9);
  --shadow-seg: 0 1px 2px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .04);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -.003em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  /* Geist: alternativos desligados (sem ss01); números tabulares ficam por font-variant-numeric */
  font-feature-settings: "liga" 1, "calt" 1;
}
body.modal-aberto { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.5rem; font-weight: 600; line-height: 1.2; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; letter-spacing: -.02em; }
h2 { font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: var(--border-forte); }
a:hover { text-decoration-color: currentColor; }
[hidden] { display: none !important; }
.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;
}
.skip-link {
  position: absolute; left: 8px; top: -40px; z-index: 100;
  background: var(--primary); color: var(--on-primary); padding: 8px 12px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: var(--selecao); }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; margin: 0; }
.texto-perigo { color: var(--danger-texto); font-weight: 600; }
.texto-aviso { color: var(--warning); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar {
  width: 16rem; flex-shrink: 0;
  background: var(--sidebar); color: var(--sidebar-texto);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px;
}
/* Cabeçalho da sidebar (shadcn SidebarHeader): ícone do módulo + nome + empresa */
.sidebar-topo { display: flex; align-items: center; justify-content: space-between; gap: 4px; flex-shrink: 0; }
.sidebar .brand { flex: 1; min-width: 0; height: 48px; padding: 8px; margin: 0; gap: 8px; border-radius: 6px; }
.sidebar .brand-link { text-decoration: none; color: inherit; cursor: pointer; transition: background .12s; }
.sidebar .brand-link:hover { background: var(--sidebar-2); }
.sidebar .brand-link:focus-visible { outline: none; box-shadow: var(--focus); }
/* Rodapé da sidebar */
.sidebar-rodape { margin-top: auto; flex-shrink: 0; padding-top: 8px; border-top: 1px solid var(--painel-borda); }
.sidebar-voltar {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 6px;
  color: var(--sidebar-texto); text-decoration: none; font-size: .875rem; transition: background .12s, color .12s;
}
.sidebar-voltar svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.sidebar-voltar:hover { background: var(--sidebar-2); color: var(--text); }
.sidebar-voltar:hover svg { color: var(--text); }
.gaveta-fechar { display: none; }
.gaveta-fundo { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; margin-bottom: 6px; }
.brand-mark-ico svg { width: 16px; height: 16px; }

/* Topbar (todas as telas logadas) */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 56px; padding: 0 24px 0 36px;
  background: var(--topbar-bg); border-bottom: 1px solid var(--border);
}
.topbar-esq { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-gaveta { display: none; }
.topbar-marca { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.topbar-marca .brand-mark { width: 28px; height: 28px; }
.topbar-empresa { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.topbar-migalha { color: var(--muted); text-decoration: none; font-weight: 500; }
.topbar-migalha:hover { color: var(--text); }
.topbar-sep { color: var(--border-forte); }
.topbar-titulo { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.badge-leitura { border-color: var(--warning-borda); background: var(--warning-soft); color: var(--warning-texto); gap: 5px; }
.badge-leitura::before { display: none; }
.topbar .badge-leitura { margin-left: 4px; }
.badge-admin { gap: 5px; color: var(--text); }
.badge-admin::before { display: none; }

.usuario-menu { position: relative; flex-shrink: 0; }
.usuario-btn {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px;
  background: transparent; border: 1px solid transparent; font: inherit; color: var(--text); cursor: pointer;
  transition: background .12s, border-color .12s;
}
.usuario-btn:hover, .usuario-btn[aria-expanded="true"] { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.usuario-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.usuario-txt strong { font-size: .84rem; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-txt small { font-size: .74rem; color: var(--muted); }
.usuario-seta { color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  background: var(--primary); color: var(--on-primary);
}
.avatar-sm { width: 28px; height: 28px; font-size: .68rem; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; min-width: 232px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 4px; animation: subir .14s cubic-bezier(.2, .8, .2, 1);
}
.menu-cab { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; min-width: 0; }
.menu-cab strong { font-size: .86rem; font-weight: 600; }
.menu-cab small { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu [role="menuitem"], .menu [role="menuitemradio"] {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 6px;
  background: none; border: none; font: inherit; font-weight: 500; color: var(--text-2); text-decoration: none; cursor: pointer; text-align: left;
}
.menu [role="menuitem"] svg, .menu [role="menuitemradio"] svg { color: var(--muted); flex-shrink: 0; }
.menu [role="menuitem"]:hover, .menu [role="menuitem"]:focus-visible,
.menu [role="menuitemradio"]:hover, .menu [role="menuitemradio"]:focus-visible { background: var(--surface-2); color: var(--text); box-shadow: none; }
.menu-rotulo { display: block; padding: 6px 10px 2px; font-size: .74rem; font-weight: 500; color: var(--muted); }
.menu [role="menuitemradio"] span { flex: 1; }
.menu [role="menuitemradio"] svg:last-child { visibility: hidden; color: var(--text); }
.menu [role="menuitemradio"][aria-checked="true"] { color: var(--text); }
.menu [role="menuitemradio"][aria-checked="true"] svg:last-child { visibility: visible; }

.topbar-dir { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tema-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 999px;
  border: 1px solid transparent; transition: background .12s, color .12s, border-color .12s;
}
.tema-btn:hover { border-color: var(--border); background: var(--surface); }
.tema-btn svg { display: block; }
/* Troca de tema sem animar cada componente */
.trocando-tema *, .trocando-tema *::before, .trocando-tema *::after { transition: none !important; }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu [data-sair]:hover { color: var(--danger-texto); background: var(--danger-soft); }
.menu [data-sair]:hover svg { color: var(--danger-texto); }

/* Hub/Minha conta: sem sidebar, conteúdo centralizado */
.area-hub .tela { max-width: 1040px; }
.area-carregando .content { display: grid; place-items: center; min-height: 100vh; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: .72rem; letter-spacing: -.02em;
  display: grid; place-items: center;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-text strong { color: var(--text); font-size: .875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.brand-text small { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Navegação (shadcn Sidebar: grupos com rótulo, itens de 32px, ativo = preenchimento sutil) */
.nav { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.nav-grupo { display: flex; flex-direction: column; gap: 2px; }
.nav-grupo-rotulo {
  display: flex; align-items: center; height: 32px; padding: 0 8px; flex-shrink: 0;
  font-size: .75rem; font-weight: 500; letter-spacing: 0; color: var(--sidebar-rotulo); user-select: none;
}
.nav a {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 6px; flex-shrink: 0;
  color: var(--sidebar-texto); text-decoration: none; font-size: .875rem; font-weight: 400; white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav a > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--sidebar-2); color: var(--text); }
.nav a.ativo { background: var(--sidebar-accent); color: var(--text); font-weight: 500; }
.nav-ico { width: 16px; height: 16px; flex-shrink: 0; display: grid; place-items: center; color: var(--muted); transition: color .12s; }
.nav-ico svg { width: 16px; height: 16px; }
.nav a:hover .nav-ico { color: var(--text-2); }
.nav a.ativo .nav-ico { color: var(--primary); }

.content { flex: 1; min-width: 0; padding: 28px 32px 56px; outline: none; }
.mono { font-family: var(--mono); font-size: .82rem; }

/* Layout "inset" (shadcn Sidebar variant="inset"), só no desktop: a página tem a cor da sidebar
   e a área principal (topbar + conteúdo) vira um painel elevado com cantos arredondados;
   o conteúdo rola dentro do painel. Em <=800px vale o layout de gaveta (abaixo, Responsivo). */
@media (min-width: 801px) {
  .area-modulo, .area-hub { background: var(--sidebar); }
  .area-modulo .layout, .area-hub .layout { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .area-modulo .sidebar { position: relative; height: auto; }
  .area-modulo .principal, .area-hub .principal {
    min-height: 0; margin: 8px 8px 8px 0; overflow: hidden;
    background: var(--surface); border: 1px solid var(--painel-borda);
    border-radius: var(--radius-painel); box-shadow: var(--shadow-painel);
  }
  .area-hub .principal { margin-left: 8px; }
  .area-modulo .topbar, .area-hub .topbar {
    position: relative; flex-shrink: 0; height: 56px; padding: 0 16px 0 32px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .area-modulo .content, .area-hub .content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
}
.tela { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.page-header h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.breadcrumb { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .82rem; margin-bottom: -12px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }

/* ---------- Cards ---------- */
/* Cartão: borda 1px + sombra mínima + realce interno de 1px no topo (no escuro) */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 22px 24px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-header h2 { font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-form-lateral { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 24px; align-items: start; }
.grid-simulacao { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.simulacao { position: sticky; top: 20px; }

/* ---------- KPIs (grade única com divisórias, sem cores decorativas) ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-card);
}
/* Divisórias à direita/embaixo de cada célula; as da borda externa ficam cortadas pelo overflow */
.kpi {
  padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
  box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border);
  margin: 0 -1px -1px 0;
}
.kpi-rotulo { font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi-valor { font-size: 1.45rem; font-weight: 600; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi-extra { font-size: .78rem; color: var(--muted); }
.kpi-perigo .kpi-valor { color: var(--danger-texto); }
.kpi-perigo .kpi-rotulo::before, .kpi-sucesso .kpi-rotulo::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px;
  background: var(--danger);
}
.kpi-sucesso .kpi-rotulo::before { background: var(--success); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.tabela-scroll { max-height: 420px; overflow-y: auto; }
.tabela { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabela th {
  text-align: left; font-size: .78rem; color: var(--muted); font-weight: 500;
  padding: 9px 8px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--surface); position: sticky; top: 0;
}
.tabela td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela tbody tr { transition: background .1s; }
.tabela tbody tr:hover { background: var(--surface-sutil); }
.tabela tbody tr:last-child td { border-bottom: none; }
.tabela .num { text-align: right; white-space: nowrap; }
.tabela-compacta td { padding: 7px 10px; }
.acoes-col { text-align: right; white-space: nowrap; }
.acoes { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.tabela .acoes-linha { flex-wrap: nowrap; }
/* Em listas, ação primária repetida fica discreta; destaque só onde há atraso */
.tabela tbody .btn-primary.btn-sm { background: var(--surface); color: var(--text); border-color: var(--input-borda); box-shadow: var(--shadow-input); --btn-spin: var(--text); }
.tabela tbody .btn-primary.btn-sm:hover:not(:disabled) { background: var(--accent-50); border-color: var(--border-forte); }
.tabela tbody .linha-atrasada .btn-primary.btn-sm { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 1px 2px rgb(0 0 0 / .1), var(--btn-realce); --btn-spin: var(--on-primary); }
.tabela tbody .linha-atrasada .btn-primary.btn-sm:hover:not(:disabled) { background: var(--primary-90); }
.sub { font-size: .8rem; color: var(--muted); }
.link-forte { font-weight: 500; text-decoration: none; color: var(--text); }
.link-forte:hover { text-decoration: underline; }
.linha-atrasada td { background: var(--linha-atrasada); }
.linha-atrasada td:first-child { box-shadow: inset 2px 0 0 var(--danger); }
.linha-inativa td { color: var(--muted); }

/* ---------- Badges (contorno + ponto de status) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 6px;
  font-size: .75rem; font-weight: 500; white-space: nowrap; vertical-align: middle; line-height: 1.6;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ponto-neutro); flex-shrink: 0; }
.badge-pendente::before { background: var(--info); }
.badge-atrasada { border-color: var(--danger-borda); color: var(--danger-texto); background: var(--danger-soft); }
.badge-atrasada::before { background: var(--danger); }
.badge-paga::before, .badge-quitado::before { background: var(--success); }
.badge-cancelada, .badge-neutro { color: var(--muted); }
.badge-cancelada::before, .badge-neutro::before { background: var(--ponto-fraco); }
.badge-ativo::before { background: var(--success); }
h1 .badge { font-size: .75rem; letter-spacing: 0; }

.taxa-badge {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  font-weight: 600; font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.taxa-badge-lg { font-size: .95rem; padding: 3px 10px; }

/* ---------- Progresso ---------- */
.progresso { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.progresso-barra { flex: 1; height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.progresso-barra span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progresso-txt { font-size: .78rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Botões ---------- */
/* Alturas: 36 (padrão) · 32 (.btn-sm) · 40 (.btn-lg). A sombra de cada variante vai em --btn-sombra
   para sobreviver ao :focus-visible (o anel de foco é outline 2px com offset 1px). */
.btn {
  --btn-sombra: none;
  --btn-spin: var(--text);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--btn-sombra);
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
  line-height: 1; -webkit-tap-highlight-color: transparent;
}
.btn svg { flex-shrink: 0; }
.btn:focus-visible { box-shadow: var(--btn-sombra); outline: 2px solid var(--anel); outline-offset: 1px; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .64; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: .8125rem; gap: 5px; }
.btn-lg { height: 40px; padding: 0 20px; }
.btn-primary {
  background: var(--primary); color: var(--on-primary); --btn-spin: var(--on-primary);
  --btn-sombra: 0 1px 2px rgb(0 0 0 / .1), var(--btn-realce);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-90); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-hover); }
/* .btn-ghost é o botão "outline" do sistema (contorno + fundo de superfície); .btn-outline é sinônimo */
.btn-ghost, .btn-outline { background: var(--surface); color: var(--text); border-color: var(--input-borda); --btn-sombra: var(--shadow-input); }
.btn-ghost:hover:not(:disabled), .btn-outline:hover:not(:disabled) { background: var(--accent-50); border-color: var(--border-forte); }
.btn-danger {
  background: var(--danger-btn); color: #fff; --btn-spin: #fff;
  --btn-sombra: 0 1px 2px rgb(0 0 0 / .1), inset 0 1px 0 rgb(255 255 255 / .16);
}
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger-btn) 90%, transparent); }
.btn-ghost-danger { background: var(--surface); color: var(--danger-texto); border-color: var(--input-borda); --btn-sombra: var(--shadow-input); --btn-spin: var(--danger-texto); }
.btn-ghost-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger-borda); }
/* Carregando: texto/ícones ficam transparentes (largura preservada) e um spinner ocupa o centro.
   Use U.carregandoBotao(btn, true|false); a classe .carregando sozinha também funciona. */
.btn.carregando, .btn[aria-busy="true"] { color: transparent !important; cursor: progress; pointer-events: none; }
.btn.carregando:disabled, .btn[aria-busy="true"]:disabled { opacity: 1; }
.btn.carregando::after, .btn[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--btn-spin) 28%, transparent); border-top-color: var(--btn-spin);
  animation: girar .7s linear infinite;
}
.btn-sm.carregando::after, .btn-sm[aria-busy="true"]::after { width: 14px; height: 14px; }
.icon-btn {
  background: none; border: none; font-size: 1.3rem; line-height: 1; cursor: pointer;
  color: var(--muted); padding: 2px 7px; border-radius: var(--radius-sm);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--accent); color: var(--text); }
.icon-btn svg { display: block; }
.link-btn { background: none; border: none; padding: 0; color: var(--text); font: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-forte); cursor: pointer; }
.link-btn:hover { text-decoration-color: currentColor; }

/* ---------- Toolbar / filtros ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.search { flex: 1; min-width: 220px; max-width: 420px; }
.search input { width: 100%; padding-left: 32px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--text-2); font-weight: 500; }
.check input { flex-shrink: 0; }
/* Segmentado no estilo "tabs": trilho cinza, opção ativa em branco */
.segmentado { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmentado button {
  background: transparent; border: none; border-radius: 5px;
  padding: 5px 12px; font: inherit; font-size: .84rem; font-weight: 500; color: var(--muted); cursor: pointer;
}
.segmentado button:hover { color: var(--text); }
.segmentado button[aria-pressed="true"] { background: var(--seg-ativo); color: var(--text); box-shadow: var(--shadow-seg); }

/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: 20px; }
.form-estreito { max-width: 640px; }
.secao { border: none; padding: 0; margin: 0; min-width: 0; }
.secao legend { font-weight: 600; font-size: .95rem; margin-bottom: 12px; padding: 0; letter-spacing: -.01em; }
.secao-juros {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px 18px;
}
.secao-juros legend { float: left; width: 100%; margin-bottom: 4px; }
.secao-juros legend + * { clear: both; }
.secao-ajuda { margin: 0 0 14px; color: var(--muted); font-size: .86rem; }
.form-grid { display: grid; gap: 14px 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 500; font-size: .875rem; line-height: 1.4; }
.ajuda { color: var(--muted); font-size: .75rem; line-height: 1.45; }
.erro-campo { color: var(--danger-texto); font-size: .75rem; font-weight: 500; line-height: 1.45; }
.erro-campo:empty { display: none; }
/* Campos: 36px, raio 8, borda levemente translúcida, sombra mínima.
   Foco: borda = anel + halo de 3px (a sombra sai). Inválido: .invalido no .field (ou no input) / aria-invalid. */
input, select, textarea {
  font: inherit; color: var(--text); background-color: var(--surface);
  border: 1px solid var(--input-borda); border-radius: var(--radius-sm);
  padding: 0 12px; height: 36px; width: 100%; min-width: 0;
  box-shadow: var(--shadow-input); transition: border-color .15s, box-shadow .15s, opacity .15s;
}
textarea { resize: vertical; height: auto; min-height: 72px; padding: 8px 12px; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px;
  background-image: var(--chevron-img); background-repeat: no-repeat; background-position: right 10px center; background-size: 15px 15px;
}
select::-ms-expand { display: none; }
input[inputmode="decimal"], input[inputmode="numeric"], input[type="date"], input[type="number"] { font-variant-numeric: tabular-nums; }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--anel); box-shadow: 0 0 0 3px var(--anel-suave); outline: none; }
input:disabled, select:disabled, textarea:disabled { opacity: .64; cursor: not-allowed; box-shadow: none; }
.field.invalido input:not([type="checkbox"]):not([type="radio"]), .field.invalido select, .field.invalido textarea,
input.invalido, select.invalido, textarea.invalido, [aria-invalid="true"] { border-color: var(--invalido-borda); }
.field.invalido input:not([type="checkbox"]):not([type="radio"]):focus, .field.invalido select:focus, .field.invalido textarea:focus,
input.invalido:focus, select.invalido:focus, textarea.invalido:focus, [aria-invalid="true"]:focus {
  border-color: var(--invalido-foco); box-shadow: 0 0 0 3px var(--invalido-anel);
}

/* Grupo de campo com prefixo/sufixo ("R$", "% a.m."): um único contorno arredondado */
.input-sufixo, .input-prefixo {
  display: flex; align-items: center; height: 36px; min-width: 0;
  background: var(--surface); border: 1px solid var(--input-borda); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-input); transition: border-color .15s, box-shadow .15s; cursor: text;
}
.input-sufixo input, .input-prefixo input {
  flex: 1; height: 100%; border: 0; border-radius: inherit; background: transparent; box-shadow: none;
  font-variant-numeric: tabular-nums;
}
.input-sufixo input:focus, .input-prefixo input:focus { box-shadow: none; }
.input-prefixo input { padding-left: 6px; }
.input-sufixo input { padding-right: 6px; }
.input-sufixo span, .input-prefixo span {
  display: flex; align-items: center; height: 100%; color: var(--muted); font-size: .875rem;
  white-space: nowrap; user-select: none; font-variant-numeric: tabular-nums; pointer-events: none;
}
.input-prefixo span { padding-left: 12px; }
.input-sufixo span { padding-right: 12px; }
.input-sufixo:focus-within, .input-prefixo:focus-within { border-color: var(--anel); box-shadow: 0 0 0 3px var(--anel-suave); }
.invalido .input-sufixo, .invalido .input-prefixo { border-color: var(--invalido-borda); }
.invalido .input-sufixo:focus-within, .invalido .input-prefixo:focus-within { border-color: var(--invalido-foco); box-shadow: 0 0 0 3px var(--invalido-anel); }
.input-sufixo:has(input:disabled), .input-prefixo:has(input:disabled) { opacity: .64; cursor: not-allowed; box-shadow: none; }
.input-sufixo:has(input:disabled) input, .input-prefixo:has(input:disabled) input { opacity: 1; }

/* Checkbox e rádio próprios (16px). O switch (role="switch") tem visual separado. */
input[type="checkbox"]:not([role="switch"]), input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 16px; height: 16px; margin: 0; padding: 0; cursor: pointer;
  border: 1px solid var(--input-borda); border-radius: 4px; background-color: var(--surface);
  box-shadow: var(--shadow-input);
  background-repeat: no-repeat; background-position: center; background-size: 12px 12px;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:not([role="switch"]):checked { background-color: var(--primary); border-color: var(--primary); background-image: var(--check-img); }
input[type="checkbox"]:not([role="switch"]):indeterminate { background-color: var(--primary); border-color: var(--primary); background-image: var(--indet-img); }
input[type="radio"]:checked { border-color: var(--primary); background-image: radial-gradient(circle, var(--primary) 0 3.5px, transparent 4px); }
input[type="checkbox"]:not([role="switch"]):focus, input[type="radio"]:focus { box-shadow: var(--shadow-input); border-color: var(--input-borda); }
input[type="checkbox"]:not([role="switch"]):checked:focus, input[type="checkbox"]:not([role="switch"]):indeterminate:focus { border-color: var(--primary); }
input[type="radio"]:checked:focus { border-color: var(--primary); }
input[type="checkbox"]:not([role="switch"]):focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--anel); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .64; cursor: not-allowed; }
.invalido input[type="checkbox"], .invalido input[type="radio"] { border-color: var(--invalido-foco); }
.form-acoes { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 16px; }
.motivo-box { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }

.cliente-info {
  margin-top: 12px; display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
}
.cliente-info > div { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.cliente-info .muted { font-size: .78rem; font-weight: 500; }

/* ---------- Planos de juros ---------- */
.plano-tag {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px;
  background: transparent; color: var(--text-2); border: 1px solid var(--border);
  font-size: .74rem; font-weight: 500; white-space: nowrap; vertical-align: middle; line-height: 1.6;
}
.plano-tag-custom { color: var(--muted); border-style: dashed; }
.taxa-linha { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.toolbar-texto { margin: 0; font-size: .86rem; }

.planos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.plano-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 14px;
  background: var(--surface); box-shadow: var(--shadow-card); transition: border-color .15s, box-shadow .15s;
}
.plano-card:hover { border-color: var(--border-forte); box-shadow: var(--shadow-hover); }
.plano-card-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plano-card-topo h2 { font-size: .9rem; font-weight: 500; color: var(--text-2); overflow-wrap: anywhere; }
.plano-taxa {
  font-size: 2.5rem; font-weight: 600; line-height: 1.05; color: var(--text);
  font-variant-numeric: tabular-nums; letter-spacing: -.045em; margin-top: 6px;
}
.plano-taxa span { font-size: .9rem; font-weight: 500; margin-left: 4px; letter-spacing: 0; color: var(--muted); }
.plano-tipo { font-weight: 500; font-size: .84rem; color: var(--text-2); }
.plano-desc { margin: 2px 0 0; font-size: .86rem; color: var(--muted); flex: 1; overflow-wrap: anywhere; }
.plano-clientes { font-size: .84rem; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--border); margin-top: 6px; }
.plano-clientes strong { color: var(--text); font-weight: 600; }
.plano-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.plano-inativo { background: var(--bg); border-style: dashed; }
.plano-inativo .plano-taxa { color: var(--muted); }

.aplicar-box { background: var(--warning-soft); border: 1px solid var(--warning-borda); border-radius: var(--radius-sm); padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
.aplicar-box .ajuda { margin: 0 0 0 24px; color: var(--warning-texto); }
.check-forte { color: var(--text); font-weight: 500; align-items: flex-start; }
.check-forte input { margin-top: 3px; flex-shrink: 0; }

/* Escolha do plano no cadastro do cliente (radios como cartões) */
.rotulo { font-weight: 500; font-size: .875rem; }
.plano-opcoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
/* Cartões de rádio: selecionado = borda primary/50 + halo sutil (via :has, com .selecionado como fallback) */
.plano-opcao {
  position: relative; display: flex; flex-direction: column; gap: 1px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--input-borda); border-radius: var(--radius-sm);
  padding: 9px 12px 9px 36px; transition: border-color .15s, box-shadow .15s, background-color .15s; box-shadow: var(--shadow-input);
}
.plano-opcao input { position: absolute; left: 12px; top: 11px; }
.plano-opcao:hover { border-color: var(--border-forte); background: var(--accent-50); }
.plano-opcao:has(input:checked), .plano-opcao.selecionado {
  border-color: color-mix(in srgb, var(--primary) 50%, transparent); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 8%, transparent);
}
.plano-opcao:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--anel-suave); border-color: var(--anel); }
.plano-opcao:has(input:disabled) { opacity: .64; cursor: not-allowed; }
.plano-opcao-nome { font-weight: 500; }
.plano-opcao-resumo { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plano-opcao input:focus-visible { outline: none; }
.plano-opcao-custom { border-style: dashed; box-shadow: none; }
.field.travado input, .field.travado select { background-color: var(--surface-2); color: var(--muted); cursor: not-allowed; box-shadow: none; opacity: 1; }
.field.travado .input-sufixo, .field.travado .input-prefixo { background: var(--surface-2); box-shadow: none; opacity: 1; }
.field.travado .input-sufixo input, .field.travado .input-prefixo input { background: transparent; }
.field.travado .input-sufixo:focus-within, .field.travado .input-prefixo:focus-within { box-shadow: none; border-color: var(--input-borda); }
.field.travado input:focus, .field.travado select:focus { box-shadow: none; border-color: var(--input-borda); }

/* Atalhos de plano no novo empréstimo */
.chips-planos { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-plano {
  font: inherit; font-size: .78rem; font-weight: 500; cursor: pointer; font-variant-numeric: tabular-nums;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px;
  transition: border-color .12s, background .12s;
}
.chip-plano small { font-weight: 500; color: var(--muted); }
.chip-plano:hover { border-color: var(--border-forte); background: var(--surface-2); }
.chip-plano[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-plano[aria-pressed="true"] small { color: var(--on-primary-2); }

/* ---------- Garantias ---------- */
.garantias-lista { display: flex; flex-direction: column; gap: 10px; }
.garantia-linha { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 14px; background: var(--surface); }
.garantia-linha + .garantia-linha { border-style: dashed; }
.garantia-remover { position: absolute; top: 4px; right: 4px; z-index: 1; }
.garantias-rodape { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: .84rem; }
.modal .garantia-linha { border: none; padding: 0; }

/* ---------- Alertas ---------- */
.alerta { padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: .88rem; }
.alerta-erro { background: var(--danger-soft); border-color: var(--danger-borda); color: var(--danger-texto-forte); }
.alerta-aviso { background: var(--warning-soft); border-color: var(--warning-borda); color: var(--warning-texto); }
.alerta-info { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }

/* ---------- Simulação ---------- */
.sim-destaque {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px;
}
.sim-destaque span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.sim-destaque strong { font-size: 2rem; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sim-destaque small { color: var(--muted); }

/* ---------- Listas de resumo / dados ---------- */
.resumo-lista { margin: 0 0 14px; display: flex; flex-direction: column; }
.resumo-lista > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.resumo-lista dt { color: var(--muted); }
.resumo-lista dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.resumo-lista .total { border-bottom: none; font-size: 1rem; }
.resumo-lista .total dt { color: var(--text); font-weight: 600; }
.resumo-lista .total dd { font-weight: 600; }
.dados { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.dados dt { font-size: .8rem; color: var(--muted); font-weight: 500; }
.dados dd { margin: 2px 0 0; word-break: break-word; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 18px; }
.timeline-item { position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: -23px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 3px var(--surface);
}
.timeline-item.inicial::before { background: var(--surface); border: 1px solid var(--border-forte); }
.timeline-data { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline-taxas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.taxa-antiga { text-decoration: line-through; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline-motivo { margin-top: 6px; font-size: .86rem; color: var(--text-2); border-left: 2px solid var(--border); padding: 0 0 0 10px; }

/* ---------- Estados ---------- */
/* Vazio / erro no estilo "Empty" do shadcn: contêiner tracejado, ícone em quadrado 40px, título + descrição */
.estado { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 44px 16px; text-align: center; color: var(--muted); }
.estado strong { color: var(--text); font-size: 1rem; font-weight: 500; letter-spacing: -.015em; line-height: 1.35; }
.estado p { margin: 0; max-width: 24rem; font-size: .875rem; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.estado .btn { margin-top: 10px; }
.estado-vazio, .estado-erro {
  gap: 0; padding: 48px 24px; min-height: 220px;
  border: 1px dashed var(--border-forte); border-radius: var(--radius); background: transparent;
}
.estado-vazio .estado-ico, .estado-erro .estado-ico { margin-bottom: 16px; }
.estado-vazio .estado-titulo, .estado-erro .estado-titulo { font-size: 1.0625rem; }
.estado-vazio .estado-desc, .estado-erro .estado-desc { margin-top: 6px; }
.estado-acoes { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.estado-acoes .btn { margin-top: 0; }
.estado-compacto { padding: 28px 16px; min-height: 0; border: 0; }
.estado-compacto .estado-ico { margin-bottom: 12px; }
.estado-carregando { flex-direction: row; gap: 10px; }
.estado-ico {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: var(--text-2);
  display: grid; place-items: center; font-size: 1.1rem; font-weight: 600; flex-shrink: 0;
}
.estado-ico svg { width: 20px; height: 20px; }
.estado-erro { border-color: var(--danger-borda); }
.estado-erro .estado-ico { color: var(--danger-texto); background: var(--danger-soft); }

/* Esqueletos (U.esqueleto): blocos pulsantes na cor de destaque, reservam a altura final */
.esqueleto { display: flex; flex-direction: column; gap: 10px; }
.sk { display: block; height: 12px; border-radius: 6px; background: var(--accent); animation: sk-pulso 1.6s ease-in-out infinite; }
.sk-linha { height: 12px; }
.sk-bloco { height: 24px; }
.sk-h32 { height: 32px; }
.sk-input { height: 36px; border-radius: var(--radius-sm); }
.sk-botao { width: 120px; height: 36px; border-radius: var(--radius-sm); }
.sk-w30 { width: 30%; } .sk-w40 { width: 40%; } .sk-w50 { width: 50%; } .sk-w60 { width: 60%; }
.sk-w70 { width: 70%; } .sk-w80 { width: 80%; } .sk-w100 { width: 100%; }
.esqueleto-tabela { gap: 0; }
.sk-tr { display: grid; grid-template-columns: repeat(var(--sk-cols, 5), minmax(0, 1fr)); gap: 16px; align-items: center; min-height: 45px; padding: 0 8px; border-bottom: 1px solid var(--border); }
.sk-tr:last-child { border-bottom: 0; }
.sk-th { min-height: 37px; }
.sk-th .sk { height: 10px; opacity: .7; }
.sk-cel { min-width: 0; }
.sk-cols-1 { --sk-cols: 1; } .sk-cols-2 { --sk-cols: 2; } .sk-cols-3 { --sk-cols: 3; } .sk-cols-4 { --sk-cols: 4; }
.sk-cols-5 { --sk-cols: 5; } .sk-cols-6 { --sk-cols: 6; } .sk-cols-7 { --sk-cols: 7; } .sk-cols-8 { --sk-cols: 8; }
.esqueleto-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.sk-card { display: flex; flex-direction: column; gap: 10px; min-height: 150px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.sk-card .sk-h32 { margin-bottom: 6px; }
.esqueleto-form .sk-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sk-campo { display: flex; flex-direction: column; gap: 8px; }
.sk-acoes { display: flex; justify-content: flex-end; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--border); }
.esqueleto-linhas { padding: 4px 0; }
@keyframes sk-pulso { 50% { opacity: .5; } }
@media (max-width: 640px) {
  .esqueleto-tabela .sk-tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .esqueleto-tabela .sk-cel:nth-child(n+3) { display: none; }
  .esqueleto-form .sk-grade { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block; vertical-align: middle;
  border: 2px solid var(--border); border-top-color: var(--text); animation: girar .7s linear infinite;
}
.spinner-sm { width: 12px; height: 12px; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Modal ---------- */
/* Fundo preto translúcido com desfoque; painel 16px de raio. Entrada/saída: opacidade + escala .98 em 200ms.
   Cabeçalho e rodapé fixos; só o corpo rola. */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--backdrop); z-index: 50;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: aparecer .2s ease-in-out;
}
.modal {
  background: var(--popover); color: var(--text); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); border: 1px solid var(--border);
  width: 100%; max-width: 480px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-entrar .2s ease-in-out;
}
.modal-backdrop.fechando { animation: sumir .18s ease-in-out forwards; pointer-events: none; }
.modal-backdrop.fechando .modal { animation: modal-sair .18s ease-in-out forwards; }
.modal-largo { max-width: 680px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 6px; flex-shrink: 0; }
.modal-header h2 { font-size: 1.125rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; padding-top: 1px; }
.modal-x { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; margin: -4px -8px 0 0; flex-shrink: 0; }
.modal-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 24px 22px; display: flex; flex-direction: column; gap: 12px; color: var(--text-2);
}
.modal-body p { margin: 0; }
.modal-body .resumo-lista { margin: 0; }
.modal-footer {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
  padding: 14px 24px; border-top: 1px solid var(--border); background: var(--muted-72);
}
.modal-ocupado .modal-body { cursor: progress; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes sumir { from { opacity: 1; } to { opacity: 0; } }
@keyframes subir { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-entrar { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@keyframes modal-sair { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.98); } }
@media (max-width: 640px) {
  .modal-header { padding: 18px 18px 4px; }
  .modal-body { padding: 10px 18px 18px; }
  .modal-footer { padding: 12px 18px; }
  .modal-footer .btn { flex: 1 1 auto; }
}

/* ---------- Toasts (pilha estilo Sonner; posições calculadas em U.toast via variáveis CSS) ---------- */
.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  width: 356px; max-width: calc(100vw - 32px);
  height: var(--altura, 0px); transition: height .4s cubic-bezier(.22, 1, .36, 1);
  pointer-events: none;
}
.toasts.expandido { height: var(--altura-exp, 0px); pointer-events: auto; }
.toast {
  --i: 0; --y: 0px;
  position: absolute; right: 0; bottom: 0; width: 100%; height: var(--h);
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px 13px 16px; border-radius: var(--radius);
  background: var(--popover); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-toast);
  pointer-events: auto; overflow: hidden;
  z-index: calc(10 - var(--i));
  transform-origin: 50% 100%;
  transform: translateY(calc(var(--i) * -14px)) scale(calc(1 - var(--i) * .05));
  transition: transform .4s cubic-bezier(.22, 1, .36, 1), opacity .4s cubic-bezier(.22, 1, .36, 1), height .4s cubic-bezier(.22, 1, .36, 1);
  animation: toast-entrar .4s cubic-bezier(.22, 1, .36, 1);
}
/* Atrás da frente: mesma altura do toast da frente (só a borda superior aparece) e conteúdo esmaecido */
.toasts:not(.expandido) .toast-atras { height: var(--h-frente); }
.toasts:not(.expandido) .toast-atras > * { opacity: 0; transition: opacity .2s; }
.toasts.expandido .toast { transform: translateY(calc(var(--y) * -1)); }
.toast-oculto { opacity: 0; pointer-events: none; }
.toast-ico { display: grid; place-items: center; width: 16px; height: 20px; flex-shrink: 0; color: var(--success); }
.toast-ico svg { width: 16px; height: 16px; }
.toast-erro .toast-ico { color: var(--danger-texto); }
.toast-info .toast-ico { color: var(--info); }
.toast-aviso .toast-ico { color: var(--warning); }
.toast-corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toast-msg { font-size: .875rem; font-weight: 500; line-height: 20px; overflow-wrap: anywhere; }
.toast-desc { font-size: .8125rem; color: var(--muted); line-height: 1.45; }
.toast-x {
  display: grid; place-items: center; width: 22px; height: 22px; margin: -1px -4px 0 0; padding: 0; flex-shrink: 0;
  background: none; border: none; border-radius: 6px; color: var(--muted); cursor: pointer;
  opacity: .72; transition: opacity .15s, background-color .15s, color .15s;
}
.toast:hover .toast-x, .toast-x:focus-visible { opacity: 1; }
.toast-x:hover { color: var(--text); background: var(--accent); }
.toast.saindo { opacity: 0; transform: translateY(calc(var(--y) * -1 + 12px)) scale(calc(1 - var(--i) * .05)); pointer-events: none; }
@keyframes toast-entrar { from { opacity: 0; transform: translateY(100%); } }
/* legado (outros componentes podem usar) */
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .toasts { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; }
}

/* ---------- Login ---------- */
.area-login {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, var(--pontilhado) 1px, transparent 0);
  background-size: 22px 22px;
}
.area-login .content { display: flex; min-height: 100vh; padding: 32px 16px; }
.tela-login { margin: auto; width: 100%; max-width: 392px; }
.login-caixa { display: flex; flex-direction: column; gap: 18px; }
.login-marca { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1rem; letter-spacing: -.015em; }
.brand-mark-lg { width: 36px; height: 36px; border-radius: 9px; font-size: .8rem; }
.login-card { padding: 26px 26px 24px; gap: 16px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -16px rgba(0, 0, 0, .14); }
.login-cab h1 { font-size: 1.25rem; }
.login-cab .subtitle { font-size: .86rem; }
.btn-bloco { width: 100%; height: 40px; }
.login-rodape { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: .78rem; text-align: center; }

/* Campo de senha com mostrar/ocultar */
.senha-wrap { position: relative; }
.senha-wrap input { padding-right: 40px; }
.senha-olho {
  position: absolute; right: 3px; top: 3px; width: 30px; height: 30px; border-radius: 5px;
  display: grid; place-items: center; background: none; border: none; color: var(--muted); cursor: pointer;
}
.senha-olho:hover { color: var(--text); background: var(--surface-2); }
.regras-senha { list-style: none; margin: -4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: .84rem; color: var(--muted); }
.regras-senha li { display: flex; align-items: center; gap: 8px; }
.regras-senha svg { width: 16px; height: 16px; padding: 2px; border-radius: 50%; border: 1px solid var(--border-forte); color: transparent; flex-shrink: 0; transition: background .12s, color .12s, border-color .12s; }
.regras-senha li.ok { color: var(--text); }
.regras-senha li.ok svg { background: var(--success); border-color: var(--success); color: var(--on-success); }
.tela-estreita { max-width: 640px; }

/* ---------- Hub ---------- */
.tela-hub { gap: 40px; padding-top: 12px; }
.hub-intro h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; }
.hub-intro .subtitle { margin-top: 8px; }
.hub-data { margin: 0 0 8px; color: var(--muted); font-size: .8125rem; font-weight: 500; }
.hub-secao { display: flex; flex-direction: column; gap: 14px; }
.hub-secao-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hub-secao-cab .muted { font-size: .8125rem; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.modulo-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 196px;
  padding: 22px 24px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-card); color: var(--text); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.modulo-card:hover { border-color: var(--border-forte); transform: translateY(-1px); }
.modulo-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
/* Ícone do módulo: quadrado neutro com borda (sem preenchimento forte) */
.modulo-ico {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  transition: border-color .15s;
}
.modulo-card:hover .modulo-ico { border-color: var(--border-forte); }
.modulo-ico-sm { width: 32px; height: 32px; border-radius: 8px; }
.modulo-nome { font-size: 1rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.35; }
.modulo-desc { color: var(--muted); font-size: .875rem; line-height: 1.5; flex: 1; }
.modulo-acessar {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  font-weight: 500; font-size: .8125rem; color: var(--muted); transition: color .15s;
}
.modulo-acessar svg { opacity: 0; transform: translateX(-4px); transition: transform .15s, opacity .15s; }
.modulo-card:hover .modulo-acessar, .modulo-card:focus-visible .modulo-acessar { color: var(--text); }
.modulo-card:hover .modulo-acessar svg, .modulo-card:focus-visible .modulo-acessar svg { opacity: 1; transform: none; }
.hub-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.admin-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card);
  color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s;
}
.admin-card:hover { border-color: var(--border-forte); transform: translateY(-1px); }
.admin-ico { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.admin-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.admin-txt strong { font-weight: 600; font-size: .875rem; letter-spacing: -.005em; }
.admin-txt small { color: var(--muted); font-size: .8125rem; }
.admin-seta { color: var(--muted); opacity: 0; transform: translateX(-4px); transition: transform .15s, opacity .15s, color .15s; }
.admin-card:hover .admin-seta, .admin-card:focus-visible .admin-seta { color: var(--text); opacity: 1; transform: none; }

/* ---------- Administração ---------- */
.usuario-cel { display: flex; align-items: center; gap: 10px; min-width: 0; }
.usuario-cel > span:last-child { min-width: 0; }
.usuario-email { display: block; }
.acesso-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.acesso-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 6px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); font-size: .76rem; font-weight: 500; color: var(--text-2); line-height: 1.6;
}
.acesso-chip small { color: var(--muted); font-size: .72rem; padding-left: 6px; border-left: 1px solid var(--border); }
.acesso-chip.acesso-leitura small { color: var(--warning-texto); }
.acesso-total { background: var(--surface-2); color: var(--text); }
.acesso-chip-2l { flex-direction: column; align-items: flex-start; gap: 0; padding: 3px 8px; white-space: normal; line-height: 1.35; }
.acesso-chip-2l small { border-left: 0; padding-left: 0; }
.form-usuario { gap: 16px; max-width: 880px; }
.form-acoes-solta { border-top: none; padding-top: 0; }
.secao-ajuda-cab { margin: 4px 0 0; }
.check-caixa { height: 36px; padding: 0 12px; border: 1px solid var(--input-borda); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-input); }
.check-caixa:has(input:disabled) { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.acesso-lista { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.acesso-modulo { background: var(--surface); }
.acesso-modulo + .acesso-modulo { border-top: 1px solid var(--border); }
.acesso-linha { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.acesso-linha .modulo-ico { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); box-shadow: none; transition: background .12s, color .12s; }
.acesso-modulo.ligado .modulo-ico { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.acesso-info { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.acesso-info strong { font-weight: 600; }
.acesso-info small { color: var(--muted); font-size: .8rem; }
.acesso-nivel { flex-shrink: 0; display: inline-flex; align-items: center; }
.acesso-resumo { font-size: .8rem; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.acesso-nivel [data-total] { display: none; }
.perfil-admin .acesso-nivel .acesso-resumo { display: none; }
.perfil-admin .acesso-nivel [data-total] { display: inline-flex; }
.segmentado button:disabled { cursor: not-allowed; }
/* Permissões por tela */
.acesso-telas { padding: 0 14px 14px 64px; }
.acesso-atalhos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.acesso-atalhos .btn { gap: 6px; }
.perm-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.perm-tabela { width: 100%; border-collapse: collapse; font-size: .86rem; }
.perm-tabela thead th {
  background: var(--surface-2); color: var(--muted); font-size: .74rem; font-weight: 500; text-transform: uppercase; letter-spacing: .03em;
  text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--border);
}
.perm-tabela tbody th, .perm-tabela td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.perm-tabela tbody tr:last-child th, .perm-tabela tbody tr:last-child td { border-bottom: none; }
.perm-tabela tbody th { font-weight: 400; }
.perm-tabela tbody tr:hover { background: var(--bg); }
.perm-nome { display: block; font-weight: 500; color: var(--text); }
.perm-tabela tbody th small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.perm-tabela .perm-col { width: 76px; text-align: center; }
.perm-caixa { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; }
.perm-caixa:hover { background: var(--surface-2); }
.perm-caixa input { cursor: inherit; }
.perm-caixa:has(input:disabled) { cursor: not-allowed; opacity: .5; }
[data-erro-modulo]:not(:empty) { display: block; margin-top: 6px; color: var(--danger-texto); font-size: .8rem; }
.alerta-info svg { vertical-align: -2px; }
[data-aviso-admin] { margin-bottom: 12px; }

/* Interruptor (checkbox role=switch) */
.switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; inset: 0; z-index: 1; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: inherit; }
.switch-trilho {
  width: 36px; height: 20px; border-radius: 99px; background: var(--border-forte); position: relative;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / .06); transition: background-color .15s, box-shadow .15s;
}
/* Polegar: desliza em 150ms; enquanto pressionado "estica" (scaleX 1.1) a partir da borda em que está */
.switch-trilho::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--switch-botao); box-shadow: 0 1px 2px rgb(0 0 0 / .2);
  transform-origin: left center;
  transition: transform .15s cubic-bezier(.2, .8, .2, 1), background-color .15s;
}
.switch:hover input:not(:disabled) + .switch-trilho { background: color-mix(in srgb, var(--border-forte) 80%, var(--text) 20%); }
.switch input:checked + .switch-trilho,
.switch:hover input:checked:not(:disabled) + .switch-trilho { background: var(--primary); }
.switch input:checked + .switch-trilho::after { transform: translateX(16px); background: var(--on-primary); transform-origin: right center; }
.switch input:active:not(:disabled) + .switch-trilho::after { transform: scaleX(1.1); }
.switch input:checked:active:not(:disabled) + .switch-trilho::after { transform: translateX(16px) scaleX(1.1); }
.switch input:focus-visible + .switch-trilho { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--anel); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-trilho { opacity: .5; }

/* Senha temporária */
.senha-temp {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border: 1px dashed var(--border-forte); border-radius: var(--radius-sm); background: var(--surface-2);
}
.senha-temp code { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; letter-spacing: .06em; color: var(--text); overflow-wrap: anywhere; user-select: all; }

/* Logs */
.tabela-log td { vertical-align: top; }
.log-diff { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: .82rem; color: var(--text-2); }
.log-diff strong { font-weight: 500; color: var(--muted); }
.log-seta { color: var(--muted); }
.log-recurso { font-family: var(--mono); font-size: .78rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; white-space: nowrap; }
.log-acao { font-weight: 500; white-space: nowrap; }
.log-texto { font-size: .82rem; color: var(--text-2); overflow-wrap: anywhere; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid-simulacao, .grid-form-lateral { grid-template-columns: minmax(0, 1fr); }
  .simulacao { position: static; }
}
@media (max-width: 800px) {
  /* Sidebar vira gaveta lateral aberta pelo botão da topbar */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 48; height: auto;
    width: min(280px, 86vw); padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: var(--sidebar); box-shadow: var(--shadow-lg);
    transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); visibility: hidden;
  }
  .gaveta-aberta .sidebar { transform: none; visibility: visible; }
  .gaveta-fechar { display: inline-block; }
  .gaveta-fundo {
    display: block; position: fixed; inset: 0; z-index: 47; background: var(--backdrop);
    animation: aparecer .15s ease-out;
  }
  .gaveta-aberta { overflow: hidden; }
  .nav a, .sidebar-voltar { height: 36px; }
  .topbar { padding: env(safe-area-inset-top, 0px) 12px 0; height: calc(52px + env(safe-area-inset-top, 0px)); }
  .topbar-gaveta { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; margin-left: -4px; }
  .topbar-migalha, .area-modulo .topbar-sep { display: none; }
  .topbar-empresa { max-width: 38vw; }
  .usuario-txt, .usuario-seta { display: none; }
  .usuario-btn { padding: 3px; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .form-grid.cols-2, .dados { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .card { padding: 16px; }
  .page-header { padding-bottom: 16px; }
  .page-header .acoes { justify-content: flex-start; }
}
/* Tabelas viram cartões em telas estreitas (rótulos vindos de data-label, ver U.rotularTabelas) */
@media (max-width: 640px) {
  .table-wrap { margin: 0; padding: 0; overflow-x: visible; }
  .tabela:not(.tabela-compacta) thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .tabela:not(.tabela-compacta),
  .tabela:not(.tabela-compacta) tbody,
  .tabela:not(.tabela-compacta) tr,
  .tabela:not(.tabela-compacta) td { display: block; width: 100%; }
  .tabela:not(.tabela-compacta) tbody tr {
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 12px; margin-bottom: 10px;
    background: var(--surface);
  }
  .tabela:not(.tabela-compacta) tbody tr:last-child { margin-bottom: 0; }
  .tabela:not(.tabela-compacta) td {
    position: relative; padding: 8px 0 8px 42%; min-height: 36px; text-align: right;
    border-bottom: 1px solid var(--border); white-space: normal; background: transparent;
  }
  .tabela:not(.tabela-compacta) tbody tr td:last-child { border-bottom: none; }
  .tabela:not(.tabela-compacta) td::before {
    content: attr(data-label); position: absolute; left: 0; top: 9px; width: 40%;
    text-align: left; font-size: .78rem; font-weight: 500; color: var(--muted);
  }
  .tabela:not(.tabela-compacta) td.acoes-col { padding-left: 0; }
  .tabela:not(.tabela-compacta) td.acoes-col::before { display: none; }
  .tabela:not(.tabela-compacta) td.acoes-col:empty { display: none; }
  .tabela .acoes-linha { flex-wrap: wrap; }
  .tabela:not(.tabela-compacta) .taxa-linha { justify-content: flex-end; }
  .tabela:not(.tabela-compacta) .progresso { justify-content: flex-end; min-width: 0; }
  .tabela:not(.tabela-compacta) .progresso-barra { max-width: 140px; }
  .tabela:not(.tabela-compacta) tr.linha-atrasada { background: var(--linha-atrasada); border-left: 2px solid var(--danger); }
  .tabela:not(.tabela-compacta) .linha-atrasada td { background: transparent; }
  .tabela:not(.tabela-compacta) .linha-atrasada td:first-child { box-shadow: none; }
  .tabela:not(.tabela-compacta) .usuario-cel { justify-content: flex-end; text-align: right; }
  .tabela:not(.tabela-compacta) .acesso-chips { justify-content: flex-end; }
  .tabela:not(.tabela-compacta) .acesso-chip-2l { align-items: flex-end; text-align: right; }
  .tabela:not(.tabela-compacta) .log-diff { align-items: flex-end; }
  .acesso-linha { flex-wrap: wrap; }
  .acesso-info { flex-basis: calc(100% - 100px); }
  .acesso-nivel { width: 100%; padding-left: 50px; }
  .acesso-telas { padding: 0 12px 12px; }
  .perm-tabela tbody th, .perm-tabela td { padding: 6px 10px; }
  .perm-tabela thead th { padding: 7px 10px; }
  .perm-tabela .perm-col { width: 58px; }
  .regras-senha { grid-template-columns: minmax(0, 1fr); }
  .login-card { padding: 22px 18px 20px; }
  .hub-intro h1 { font-size: 1.5rem; }
  .senha-temp { flex-direction: column; align-items: stretch; text-align: center; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .area-hub .topbar-sep, .area-hub .topbar-titulo { display: none; }
  .topbar .badge-leitura { font-size: .7rem; padding: 1px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Dashboard analítico ---------- */
.dash-acoes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-analitico { display: flex; flex-direction: column; gap: 20px; transition: opacity .15s ease-out; }
.dash-recarregando { opacity: .55; pointer-events: none; }

/* KPIs: 5 na mesma linha */
.dash-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dash-kpis .kpi { padding: 15px 18px 16px; }
.dash-kpis .kpi-valor { font-variant-numeric: normal; }
.dash-kpis .kpi-extra { line-height: 1.45; }
.kpi-unidade { font-size: .9rem; font-weight: 500; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.dash-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-delta-pos { color: var(--success); }
.dash-delta-neg { color: var(--danger-texto); }
.dash-delta-neutro { color: var(--text-2); }

/* Painéis */
.dash-linha { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.dash-painel { display: flex; flex-direction: column; min-width: 0; }
.dash-painel-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dash-painel-tit { min-width: 0; }
.dash-manchete { margin: 3px 0 0; color: var(--text-2); font-size: .84rem; line-height: 1.45; }
.dash-manchete strong { color: var(--text); font-weight: 600; }
.dash-manchete-alerta { color: var(--danger-texto); }
.dash-manchete-sub { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.dash-corpo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-corpo > [data-vis], .dash-corpo > [data-tab] { min-width: 0; }
.dash-alternar {
  flex-shrink: 0; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer;
  transition: background .12s, color .12s;
}
.dash-alternar:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.dash-alternar:disabled { opacity: .5; cursor: default; }
.dash-legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 12px; padding: 0; list-style: none; font-size: .78rem; color: var(--text-2); }
.dash-legenda li { display: inline-flex; align-items: center; gap: 6px; }
.dash-legenda svg { flex-shrink: 0; overflow: visible; }
.dash-nota { margin: 10px 0 0; font-size: .76rem; color: var(--muted); }

/* Gráficos SVG */
.graf { position: relative; min-width: 0; }
.graf-svg { display: block; overflow: visible; border-radius: 4px; }
.graf-svg:focus { outline: none; box-shadow: none; }
.graf-svg:focus-visible { outline: 2px solid var(--anel); outline-offset: 4px; }
.graf-eixo { font-size: 11.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.graf-anota { font-size: 11.5px; font-weight: 500; fill: var(--muted); }
.graf-rotulo { font-size: 13px; font-weight: 500; fill: var(--text-2); }
.graf-rotulo-sub { font-size: 12.5px; font-weight: 400; fill: var(--muted); }
.graf-valor { font-size: 12px; font-weight: 500; fill: var(--text); font-variant-numeric: tabular-nums; }
.graf-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 8px 10px; font-size: .78rem; line-height: 1.55;
}
.graf-tip-titulo { color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.graf-tip-linha { display: flex; align-items: center; gap: 8px; }
.graf-tip-linha strong { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.graf-tip-nome { color: var(--muted); }
.graf-tip-chave { width: 12px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.graf-tip-chave-vazia { background: transparent; }
.graf-tip-nota { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); color: var(--text-2); }

/* Tabela equivalente de cada gráfico */
.dash-tabela-wrap { overflow-x: auto; }
.dash-tabela th, .dash-tabela td { white-space: nowrap; }
.dash-tabela tfoot td { font-weight: 600; border-top: 1px solid var(--border-forte); border-bottom: none; }

/* Estados */
.dash-vazio {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 180px; padding: 24px 16px; text-align: center; color: var(--muted); font-size: .84rem;
  background: var(--surface-sutil); border-radius: var(--radius-sm);
}
.dash-vazio strong { color: var(--text); font-weight: 600; font-size: .88rem; }
.esq { display: block; background: var(--surface-2); border-radius: 5px; animation: dash-pulso 1.4s ease-in-out infinite; }
.esq-rotulo { width: 55%; height: 12px; margin: 2px 0 6px; }
.esq-valor { width: 72%; height: 24px; }
.esq-extra { width: 48%; height: 10px; margin-top: 6px; }
.esq-texto { display: inline-block; width: 60%; max-width: 320px; height: 12px; vertical-align: middle; }
.esq-grafico { height: 220px; }
.esq-fluxo { height: 330px; }
.esq-aging, .esq-planos { height: 190px; }
@keyframes dash-pulso { 50% { opacity: .55; } }

@media (max-width: 1100px) {
  .dash-linha { grid-template-columns: minmax(0, 1fr); }
  .dash-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dash-kpis .kpi { grid-column: span 2; }
  .dash-kpis .kpi:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 800px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpis .kpi, .dash-kpis .kpi:nth-child(n+4) { grid-column: span 1; padding: 13px 14px 14px; }
  .dash-kpis .kpi:last-child { grid-column: span 2; }
  .dash-kpis .kpi-valor { font-size: 1.25rem; }
}
@media (max-width: 640px) {
  .dash-acoes { width: 100%; justify-content: space-between; }
  .dash-painel-cab { gap: 10px; }
}
@media (max-width: 359px) {
  .dash-kpis { grid-template-columns: minmax(0, 1fr); }
  .dash-kpis .kpi:last-child { grid-column: span 1; }
}

/* ---------- Detalhe (drill-down) do dashboard ---------- */
.graf-clicavel svg { cursor: pointer; }
.linha-clicavel { cursor: pointer; }
.linha-clicavel:hover td { background: var(--surface-2); }
.modal.modal-detalhe { max-width: 1040px; }
.detalhe-resumo {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.detalhe-resumo > div { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; box-shadow: 1px 0 0 var(--border); }
.detalhe-resumo span { font-size: .78rem; color: var(--muted); }
.detalhe-resumo strong { font-size: 1.05rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.detalhe-tabela { margin: 0; padding: 0; }
.detalhe-tabela tfoot td { border-top: 1px solid var(--border-forte); padding: 10px 8px; font-variant-numeric: tabular-nums; }
.detalhe-nota { margin: 0; font-size: .82rem; }
@media (max-width: 640px) {
  .detalhe-resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detalhe-tabela tfoot { display: none; }
}

/* ---------- Filtros do dashboard (clientes com busca + datas) ---------- */
.dash-filtros {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px;
}
.dash-filtros .field { gap: 5px; }
.dash-filtros .field > label, .dash-filtros .rotulo { font-size: .8rem; font-weight: 500; color: var(--muted); }
.dash-filtros input[type="date"] { width: 168px; font-variant-numeric: tabular-nums; }
.dash-f-cliente { flex: 1 1 260px; max-width: 360px; min-width: 0; }
.dash-f-acoes { margin-left: auto; }

.multi { position: relative; }
.multi-botao {
  width: 100%; height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 10px; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--input-borda); border-radius: var(--radius-sm); box-shadow: var(--shadow-input);
}
.multi-botao span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-botao svg { color: var(--muted); flex-shrink: 0; transition: transform .15s; }
.multi-botao[aria-expanded="true"] { border-color: var(--anel); box-shadow: 0 0 0 3px var(--anel-suave); }
.multi-botao[aria-expanded="true"] svg { transform: rotate(180deg); }
.multi-painel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 35; width: max(100%, 280px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: subir .14s cubic-bezier(.2, .8, .2, 1);
}
.multi-busca { padding: 8px; border-bottom: 1px solid var(--border); }
.multi-busca input { height: 34px; }
.multi-lista { max-height: 280px; overflow-y: auto; padding: 4px; }
.multi-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer;
  font-size: .88rem; color: var(--text-2); user-select: none;
}
.multi-item:hover { background: var(--surface-2); color: var(--text); }
.multi-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-item input { flex-shrink: 0; }
.multi-todos { font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0; margin-bottom: 2px; }
.multi-vazio { padding: 10px 8px; color: var(--muted); font-size: .85rem; }
@media (max-width: 640px) {
  .dash-f-cliente { max-width: none; flex-basis: 100%; }
  .dash-filtros .field:not(.dash-f-cliente) { flex: 1 1 140px; }
  .dash-filtros input[type="date"] { width: 100%; }
  .dash-f-acoes { margin-left: 0; }
}

/* ---------- Tabelas premium (pacote 4) ----------
   Componente Tabela (js/tabela.js): chips de filtros ativos, densidade (sessão),
   cabeçalho fixo na área rolável, ordenação e rodapé de paginação. */
.tb { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 72px; transition: opacity .15s ease-out; }
.tb-ocupada { opacity: .55; pointer-events: none; }

/* Barra: filtros ativos (chips) + alternador de densidade */
.tb-barra { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 28px; }
.tb-filtros { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tb-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; max-width: 100%; padding: 0 3px 0 10px;
  border: 1px dashed var(--border-forte); border-radius: 999px; background: var(--surface);
  font-size: .78rem; color: var(--text-2); line-height: 1;
}
.tb-chip-rot { color: var(--muted); font-weight: 500; white-space: nowrap; }
.tb-chip-val { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.tb-chip-x {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.tb-chip-x:hover { background: var(--surface-2); color: var(--text); }
.tb-limpar {
  background: none; border: 0; padding: 4px 8px; border-radius: var(--radius-sm);
  font: inherit; font-size: .78rem; font-weight: 500; color: var(--muted); cursor: pointer;
}
.tb-limpar:hover { color: var(--text); background: var(--surface-2); }
.tb-densidade {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow);
  color: var(--text-2); font: inherit; font-size: .78rem; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s;
}
.tb-densidade svg { color: var(--muted); }
.tb-densidade:hover { background: var(--surface-2); color: var(--text); }

/* Tabela: cabeçalho fixo (sticky) dentro da área rolável */
.tb-rolagem { max-height: max(360px, calc(100vh - 260px)); overflow: auto; }
.tb .tabela thead th {
  position: sticky; top: 0; z-index: 2; height: 40px; padding-top: 0; padding-bottom: 0;
  font-size: .78rem; font-weight: 500; color: var(--muted); background: var(--surface);
  border-bottom: 0; box-shadow: inset 0 -1px 0 var(--border);
}
.tb .tabela .num { font-variant-numeric: tabular-nums; }
.tb .tabela tbody tr:hover { background: var(--surface-sutil); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.tb-clicavel .tabela tbody tr { cursor: pointer; }

/* Ordenação: botão no cabeçalho + seta; aria-sort no th */
.tb-ordenar {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 -6px; padding: 4px 6px;
  border: 0; border-radius: 6px; background: none; font: inherit; font-weight: 500; color: inherit;
  cursor: pointer; white-space: nowrap; transition: background .12s, color .12s;
}
.tb-ordenar:hover { background: var(--surface-2); color: var(--text); }
.tb-ordenar svg { flex-shrink: 0; opacity: .5; }
.tb-ordenar.ativo { color: var(--text); }
.tb-ordenar.ativo svg { opacity: 1; }
.tb .tabela th.num .tb-ordenar { flex-direction: row-reverse; }

/* Densidade: confortável 48px / compacta 36px (só na grade; no celular as linhas viram cartões) */
@media (min-width: 641px) {
  .tb .tabela tbody td { height: 48px; padding-top: 6px; padding-bottom: 6px; }
  .tb-compacta .tabela tbody td { height: 36px; padding-top: 2px; padding-bottom: 2px; }
  .tb-compacta .tabela .sub { line-height: 1.3; }
  .tb-compacta .tabela .btn-sm { height: 26px; }
}

/* Rodapé: linhas por página + intervalo + páginas */
.tb-rodape {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--muted);
}
.tb-porpagina { display: inline-flex; align-items: center; gap: 8px; }
.tb-porpagina label { font-weight: 500; white-space: nowrap; }
.tb .tb-select { width: auto; height: 30px; padding: 0 28px 0 8px; background-position: right 8px center; font-size: .8rem; font-variant-numeric: tabular-nums; }
.tb-nav { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tb-intervalo { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.tb-paginas, .tb-numeros { display: inline-flex; align-items: center; gap: 2px; }
.tb-pag {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--text-2); font: inherit; font-size: .8rem; font-weight: 500; font-variant-numeric: tabular-nums;
  cursor: pointer; transition: background .12s, color .12s;
}
.tb-pag:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.tb-pag.atual { border-color: var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tb-pag:disabled { opacity: .4; cursor: not-allowed; }
.tb-reticencias { min-width: 22px; text-align: center; color: var(--muted); }
.tb-pag-mob { display: none; padding: 0 8px; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }

@media (max-width: 640px) {
  .tb-rolagem { max-height: none; overflow: visible; }
  .tb-densidade, .tb-barra-so-densidade { display: none; }
  .tb-chip-val { max-width: 150px; }
  .tb-numeros { display: none; }
  .tb-pag-mob { display: inline; }
  .tb-nav { width: 100%; justify-content: space-between; }
  .tb-pag { min-width: 36px; height: 36px; }
}

/* ---------- Busca Ctrl+K e KPIs (pacotes 8 e 3) ---------- */
/* Tecla (shadcn Kbd) */
.kbd {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  font: 500 .6875rem/1 var(--font); letter-spacing: 0; white-space: nowrap; pointer-events: none; user-select: none;
}

/* Gatilho da busca na topbar */
.busca-gatilho {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 10px; min-width: 200px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted);
  font: inherit; font-size: .8125rem; font-weight: 400; cursor: pointer; box-shadow: var(--shadow);
  transition: background .12s, color .12s, border-color .12s;
}
.busca-gatilho:hover { background: var(--surface-2); color: var(--text-2); }
.busca-gatilho:focus-visible { outline: none; box-shadow: var(--focus); }
.busca-gatilho svg { flex-shrink: 0; }
.busca-gatilho-txt { flex: 1; text-align: left; }
@media (max-width: 800px) {
  .busca-gatilho { min-width: 0; width: 34px; padding: 0; justify-content: center; border-color: transparent; background: none; box-shadow: none; border-radius: 999px; }
  .busca-gatilho:hover { border-color: var(--border); background: var(--surface); }
  .busca-gatilho-txt, .busca-gatilho .kbd { display: none; }
}

/* Paleta (shadcn Command) */
.cmdk-fundo {
  position: fixed; inset: 0; z-index: 55; background: var(--backdrop);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(12vh, 16px) 16px 16px; animation: aparecer .12s ease-out;
}
.cmdk {
  width: 100%; max-width: 560px; max-height: min(480px, calc(100vh - 32px)); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: subir .16s cubic-bezier(.2, .8, .2, 1);
}
.cmdk-busca { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px 0 16px; border-bottom: 1px solid var(--border); color: var(--muted); flex-shrink: 0; }
.cmdk-busca svg { flex-shrink: 0; }
.cmdk-input {
  flex: 1; min-width: 0; height: 100%; border: none; outline: none; background: transparent; box-shadow: none; padding: 0;
  color: var(--text); font: inherit; font-size: .9375rem;
}
.cmdk-input:focus, .cmdk-input:focus-visible { outline: none; box-shadow: none; border: none; }
.cmdk-input::placeholder { color: var(--placeholder); }
.cmdk-lista { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px; scroll-padding: 6px; }
.cmdk-dica { margin: 0; padding: 10px 10px 4px; color: var(--muted); font-size: .8125rem; }
.cmdk-grupo + .cmdk-grupo { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.cmdk-grupo-tit { padding: 8px 10px 4px; font-size: .75rem; font-weight: 500; color: var(--muted); }
.cmdk-item {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border-radius: 6px;
  color: var(--text-2); cursor: pointer; user-select: none; font-size: .875rem;
}
.cmdk-item.ativo { background: var(--surface-2); color: var(--text); }
.cmdk-item-ico { display: inline-grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.cmdk-item.ativo .cmdk-item-ico { color: var(--text); }
.cmdk-item-txt { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.cmdk-item-tit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; min-width: 0; }
.cmdk-item-sub { color: var(--muted); font-size: .75rem; white-space: nowrap; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cmdk-item mark { background: none; color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--border-forte); text-underline-offset: 2px; }
.cmdk-item .badge { flex-shrink: 0; }
.cmdk-item-seta { color: var(--muted); font-size: .75rem; visibility: hidden; flex-shrink: 0; }
.cmdk-item.ativo .cmdk-item-seta { visibility: visible; }
.cmdk-estado { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 22px 10px; color: var(--muted); font-size: .8125rem; text-align: center; }
.cmdk-erro { color: var(--danger-texto); }
.cmdk-rodape {
  display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border);
  background: var(--surface-sutil); color: var(--muted); font-size: .75rem; flex-shrink: 0;
}
.cmdk-rodape span { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 640px) {
  .cmdk-fundo { padding-top: 12px; }
  .cmdk { max-height: calc(100vh - 24px); }
  .cmdk-rodape { display: none; }
  .cmdk-item-txt { flex-direction: column; align-items: flex-start; gap: 0; }
}

/* KPIs do dashboard (blocks.so "Stats with Trending" / "Stats with Links") — mantém as divisórias de 1px */
.dash-kpis .kpi { gap: 4px; padding: 16px 18px; }
.dash-kpis .kpi-rotulo { font-size: .8125rem; font-weight: 500; color: var(--muted); line-height: 1.35; }
.dash-kpis .kpi-valor {
  font-size: clamp(1.375rem, 1.05rem + .75vw, 1.875rem); font-weight: 500; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--text); margin-top: 2px;
}
.dash-kpis .kpi-unidade { font-size: .55em; font-weight: 500; letter-spacing: 0; }
.kpi-delta-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi-delta-linha .dash-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; }
.kpi-delta-linha .dash-delta svg { flex-shrink: 0; }
.kpi-comparacao { color: var(--muted); font-weight: 400; }
.dash-kpis .kpi-extra { font-size: .75rem; line-height: 1.5; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi-link {
  align-self: flex-start; margin-top: auto; padding: 8px 0 0; background: none; border: none; border-radius: 4px;
  color: var(--text-2); font: inherit; font-size: .75rem; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: color .12s;
}
.kpi-com-link .kpi-extra { margin-bottom: 2px; }
.kpi-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.kpi-link:focus-visible { outline: none; box-shadow: var(--focus); }
@media (max-width: 800px) {
  .dash-kpis .kpi-valor { font-size: 1.375rem; }
}
/* Destaque breve do painel ao chegar pelo "Ver detalhes" */
.dash-painel-destaque { animation: dash-destaque 1.6s ease-out; }
@keyframes dash-destaque { 0%, 35% { box-shadow: 0 0 0 2px var(--anel); } 100% { box-shadow: var(--shadow); } }
.dash-painel h2[tabindex="-1"]:focus { outline: none; }

/* ---------- Hub com sidebar (Início · Sistemas · Administração · Conta) ---------- */
/* Itens-botão da sidebar (Tema, Sair) com a mesma métrica dos links (32px, ícone 16px) */
.nav-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border-radius: 6px; flex-shrink: 0;
  background: none; border: 0; font: inherit; font-size: .875rem; font-weight: 400; color: var(--sidebar-texto);
  text-align: left; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s;
}
.nav-btn:hover { background: var(--sidebar-2); color: var(--text); }
.nav-btn:hover .nav-ico { color: var(--text-2); }
.nav-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.nav-btn-sair:hover { background: var(--danger-soft); color: var(--danger-texto); }
.nav-btn-sair:hover .nav-ico { color: var(--danger-texto); }
.nav-rotulo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-valor { flex-shrink: 0; font-size: .75rem; color: var(--muted); }
.nav a > span.nav-selo, .nav-selo {
  flex-shrink: 0; min-width: auto; overflow: visible; padding: 0 6px; border-radius: 4px; line-height: 18px;
  font-size: .6875rem; font-weight: 500; color: var(--warning-texto); background: var(--warning-soft); border: 1px solid var(--warning-borda);
}
.nav-vazio { display: block; padding: 4px 8px 6px; font-size: .8125rem; color: var(--muted); }
.sidebar-usuario { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; min-width: 0; }
.sidebar-usuario .avatar { width: 32px; height: 32px; border-radius: 8px; }
.sidebar-usuario-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sidebar-usuario-txt strong { font-size: .8125rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-usuario-txt small { font-size: .75rem; color: var(--muted); }

/* ---------- Hub: conteúdo ---------- */
.tela-hub { max-width: 1200px; gap: 28px; padding-top: 4px; }
.hub-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.hub-cab .hub-intro { min-width: 0; }
.hub-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hub-acoes .btn-ghost { color: var(--text-2); }
.hub-acoes .kbd { margin-left: 4px; }
.hub-colunas { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 28px; align-items: start; }
.hub-principal, .hub-lateral { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.hub-lateral { gap: 16px; }
.hub-secao { gap: 12px; }
.hub-secao-cab { align-items: center; }
.hub-secao-link {
  display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; font-weight: 500;
  color: var(--muted); text-decoration: none; border-radius: 4px; transition: color .12s;
}
.hub-secao-link:hover { color: var(--text); }

/* Resumo de hoje: cards compactos */
.hub-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.hub-stat {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card);
  color: var(--text); text-decoration: none; transition: border-color .15s;
}
a.hub-stat:hover { border-color: var(--border-forte); }
.hub-stat-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hub-stat-rotulo { font-size: .8125rem; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-stat-ico { color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.hub-stat-valor { font-size: 1.3rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-stat-unid { font-size: .8125rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.hub-stat-extra { font-size: .75rem; color: var(--muted); line-height: 1.45; font-variant-numeric: tabular-nums; }
.hub-stat-extra .texto-perigo { font-weight: 500; }
.hub-stat-perigo .hub-stat-valor { color: var(--danger-texto); }
.hub-stat-perigo .hub-stat-ico { color: var(--danger-texto); }
.hub-stat-sk { gap: 10px; min-height: 96px; }

/* Cards de sistema: o nome é o link principal e cobre o card; os atalhos ficam por cima */
.tela-hub .hub-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tela-hub .modulo-card { min-height: 0; padding: 20px 20px 18px; }
.tela-hub .modulo-card:hover { transform: none; }
.tela-hub .modulo-topo { margin-bottom: 10px; }
.tela-hub .modulo-ico { width: 40px; height: 40px; }
.modulo-link { color: var(--text); text-decoration: none; }
.modulo-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.modulo-link:focus-visible { box-shadow: none; }
.modulo-link:focus-visible::after { box-shadow: var(--focus); }
.modulo-card:focus-within .modulo-acessar { color: var(--text); }
.modulo-atalhos { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.modulo-atalhos a {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-sutil); color: var(--text-2);
  font-size: .75rem; font-weight: 500; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
}
.modulo-atalhos a svg { color: var(--muted); flex-shrink: 0; }
.modulo-atalhos a:hover { background: var(--surface-2); border-color: var(--border-forte); color: var(--text); }
.modulo-atalhos a:hover svg { color: var(--text); }
.tela-hub .modulo-acessar { margin-top: 14px; }
.tela-hub .modulo-acessar svg { opacity: 1; transform: none; }
.tela-hub .hub-admin-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* Painéis da coluna lateral */
.hub-painel { padding: 16px; }
.hub-painel-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.hub-painel-cab h2 { font-size: .875rem; }
.hub-venc, .hub-atalhos { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.hub-venc-item {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; min-width: 0;
  color: var(--text); text-decoration: none; transition: background .12s;
}
a.hub-venc-item:hover { background: var(--surface-2); }
.hub-venc-data {
  width: 44px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: .75rem; font-variant-numeric: tabular-nums;
}
.hub-venc-data strong { font-weight: 600; }
.hub-venc-data.atrasada { background: var(--danger-soft); border-color: var(--danger-borda); color: var(--danger-texto); }
.hub-venc-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.hub-venc-txt strong { font-size: .8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-venc-txt small { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-venc-valor { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; font-size: .8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.hub-venc-valor .badge { font-size: .6875rem; padding: 0 6px; }
.hub-atalhos a, .hub-atalhos button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 8px; border-radius: 8px;
  background: none; border: 0; font: inherit; font-size: .8125rem; font-weight: 500; color: var(--text-2);
  text-decoration: none; text-align: left; cursor: pointer; transition: background .12s, color .12s;
}
.hub-atalhos a > span:nth-child(2), .hub-atalhos button > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-atalhos a > svg { color: var(--muted); opacity: 0; transition: opacity .12s; }
.hub-atalhos a:hover, .hub-atalhos button:hover { background: var(--surface-2); color: var(--text); }
.hub-atalhos a:hover > svg { opacity: 1; }
.hub-atalhos button:focus-visible { outline: none; box-shadow: var(--focus); }
.hub-atalho-ico {
  width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}

@media (max-width: 1100px) {
  .hub-colunas { grid-template-columns: minmax(0, 1fr); }
  .hub-lateral { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}
@media (max-width: 800px) {
  .nav-btn { height: 36px; }
  .tela-hub { gap: 24px; }
  .hub-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-stat-valor { font-size: 1.15rem; }
}
@media (max-width: 640px) {
  .hub-cab { align-items: flex-start; }
  .hub-acoes .kbd { display: none; }
}
@media (max-width: 380px) {
  .hub-stats { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Resumo consolidado do cliente / edição de empréstimo ---------- */
.texto-sucesso { color: var(--success); font-weight: 500; }
.kpis-embutido { box-shadow: none; margin-bottom: 16px; }
.resumo-emps { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; }
.resumo-emps li + li { border-top: 1px solid var(--border); }
.resumo-emp-linha {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 9px 4px;
  color: var(--text); text-decoration: none; border-radius: var(--radius-sm); font-variant-numeric: tabular-nums;
}
.resumo-emp-linha:hover { background: var(--surface-sutil); }
.resumo-emp-linha:hover strong { text-decoration: underline; }
.resumo-emp-linha.inativo { color: var(--muted); }
.resumo-emp-sep { color: var(--muted); }
.resumo-subtitulo { font-size: .875rem; font-weight: 600; margin: 18px 0 8px; }
.resumo-rodape { font-size: .8rem; margin: 8px 0 0; }
.editar-previa { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.editar-previa-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .875rem; }
.editar-previa .resumo-lista > div:last-child { border-bottom: none; }
.editar-previa p { margin: 0; }

/* ---------- Pagamento parcial ---------- */
.badge-parcial { border-color: var(--warning-borda); background: var(--warning-soft); color: var(--warning-texto); gap: 4px; }
.badge-parcial::before { display: none; }
.badge-parcial svg { flex-shrink: 0; }
.status-celula { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pg-dica { margin: 6px 0 0; min-height: 1.1em; }
.pg-dica.texto-aviso { color: var(--warning-texto); }
.pg-mora { margin: 10px 0 12px; }

/* ---------- Receber só os juros (capital prorrogado) ---------- */
.pg-modo { display: flex; margin: 0 0 12px; }
.pg-modo button { flex: 1 1 0; }
.pg-prorrogacao { margin-top: 12px; }
.badge-juros {
  border-color: color-mix(in srgb, var(--info) 35%, var(--border));
  background: color-mix(in srgb, var(--info) 8%, var(--surface));
  color: var(--info);
}
.badge-juros::before { background: var(--info); }

/* ---------- Recebimento em lote (várias parcelas juntas) ---------- */
.lote-barra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lote-info { font-size: .8125rem; color: var(--text-2); margin-right: 4px; }
.lote-info strong { color: var(--text); }
.tabela .sel-col { width: 36px; padding-right: 0; text-align: center; }
.tabela .sel-col input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); vertical-align: middle; }
.tabela tbody .linha-selecionada td { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.lote-tabela { margin-bottom: 14px; }
.lote-tabela tfoot th { padding-top: 10px; border-top: 1px solid var(--border); font-weight: 600; color: var(--text); text-align: left; }
.lote-tabela tfoot th.num { text-align: right; }

/* ---------- Prejuízo ---------- */
.badge-prejuizo { border-color: var(--danger-borda); color: var(--danger-texto); background: var(--danger-soft); }
.badge-prejuizo::before { background: var(--danger); }
.lote-info-topo { margin: 0 0 12px; }

/* ---------- Lucro ---------- */
.lucro-barra { height: 4px; margin-top: 6px; margin-left: auto; width: 100%; max-width: 120px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lucro-barra span { display: block; height: 100%; border-radius: inherit; background: var(--success, #16a34a); }

/* ---------- Gestão de Aluguel ---------- */
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-card { display: flex; flex-direction: column; gap: 16px; }
.form-secao { font-size: .875rem; font-weight: 600; color: var(--text); margin: 4px 0 -4px; }
@media (max-width: 760px) { .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }
