/* ====================================================================================================== */
/* Tema do Sistema de Indenizações PAMC: padrão do portal/dashboard (tokens, slate invertido, marca) + vidro fosco */
/* ====================================================================================================== */
:root {
  --bg: #F3F5F9; --surface: #FFFFFF; --surface-2: #F7F9FC; --line: #E3E8EF;
  --ink: #0E1A2B; --ink-2: #475467; --ink-3: #8A96A8;
  --marca-azul: #0B79BE; --marca-vermelho: #D21C33; --marca-vinho: #8E1620; --marca-navy: #0B1A2E;
  --sombra: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --sombra-alta: 0 12px 32px -12px rgba(16, 24, 40, .18);
  /* vidro */
  --vidro: rgba(255, 255, 255, .62); --vidro-forte: rgba(255, 255, 255, .86); --vidro-borda: rgba(255, 255, 255, .8);
  --vidro-sombra: 0 10px 34px -12px rgba(11, 26, 46, .20), inset 0 1px 0 rgba(255, 255, 255, .7);
  --campo: rgba(255, 255, 255, .72);
  --brilho-a: rgba(11, 121, 190, .20); --brilho-b: rgba(210, 28, 51, .13); --brilho-c: rgba(142, 22, 32, .10);
  --slate-50: 248 250 252; --slate-100: 241 245 249; --slate-200: 226 232 240; --slate-300: 203 213 225; --slate-400: 148 163 184;
  --slate-500: 100 116 139; --slate-600: 71 85 105; --slate-700: 51 65 85; --slate-800: 30 41 59; --slate-900: 15 23 42; --slate-950: 2 6 23;
  color-scheme: light;
}
html.dark {
  --bg: #0A111C; --surface: #111A27; --surface-2: #162132; --line: #223047;
  --ink: #E8EDF5; --ink-2: #A9B4C6; --ink-3: #6E7C93; --marca-azul: #3FA2E3;
  --sombra: 0 1px 2px rgba(0, 0, 0, .3); --sombra-alta: 0 16px 40px -16px rgba(0, 0, 0, .6);
  --vidro: rgba(17, 26, 39, .56); --vidro-forte: rgba(14, 22, 34, .88); --vidro-borda: rgba(255, 255, 255, .09);
  --vidro-sombra: 0 14px 40px -14px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .05);
  --campo: rgba(22, 33, 50, .62);
  --brilho-a: rgba(63, 162, 227, .16); --brilho-b: rgba(210, 28, 51, .12); --brilho-c: rgba(142, 22, 32, .14);
  --slate-50: 22 33 50; --slate-100: 26 38 56; --slate-200: 36 51 73; --slate-300: 46 63 88; --slate-400: 111 125 148;
  --slate-500: 140 153 173; --slate-600: 169 180 197; --slate-700: 195 204 217; --slate-800: 219 225 234; --slate-900: 237 241 246; --slate-950: 247 249 252;
  color-scheme: dark;
}

/* ---------- base ---------- */
body { background: var(--bg); color: var(--ink); font-family: "Inter", system-ui, sans-serif; font-feature-settings: "cv11" 1; -webkit-font-smoothing: antialiased; transition: background-color .2s ease; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(60rem 38rem at 8% -8%, var(--brilho-a), transparent 62%), radial-gradient(48rem 34rem at 102% 2%, var(--brilho-b), transparent 58%),
              radial-gradient(52rem 40rem at 55% 112%, var(--brilho-c), transparent 62%); }
td, th, .chip, .num { font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--marca-azul) 30%, transparent); }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink-3) 45%, transparent) transparent; }
.logo-escuro, .icone-escuro { display: none; }
html.dark .logo-claro, html.dark .icone-claro { display: none; }
html.dark .logo-escuro { display: block; } html.dark .icone-escuro { display: inline-block; }

/* ---------- vidro fosco ---------- */
.vidro, .vidro-forte { border: 1px solid var(--vidro-borda); box-shadow: var(--vidro-sombra); }
.vidro { background: var(--vidro); -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5); }
.vidro-forte { background: var(--vidro-forte); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .vidro { background: var(--surface); } .vidro-forte { background: var(--surface); } }
.vidro { transition: border-color .2s ease, box-shadow .2s ease; }

/* ---------- estrutura (barra lateral + conteúdo), como o portal ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
@media (min-width: 1024px) { .app-shell { flex-direction: row; } }
.sidebar { display: flex; flex-direction: column; border-radius: 0; border-width: 0 0 1px 0; }
@media (min-width: 1024px) { .sidebar { width: 272px; flex-shrink: 0; height: 100vh; position: sticky; top: 0; overflow-y: auto; border-width: 0 1px 0 0; transition: width .2s ease; } }
.sidebar-top { display: flex; align-items: center; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sidebar-top img { height: 30px; width: auto; }
.sidebar-top .logo-claro, .sidebar-top .logo-escuro { margin-right: auto; }
.marca-recolhida { display: none; }
.sidebar-body { padding: 18px; display: flex; flex-direction: column; gap: 18px; flex: 1; }
.sidebar-modulo h2 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.sidebar-modulo p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.nav-lista { display: flex; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); border: 1px solid transparent; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.nav-item i { font-size: 20px; }
.nav-item:hover { background: color-mix(in srgb, var(--marca-azul) 10%, transparent); color: var(--ink); border-color: color-mix(in srgb, var(--marca-azul) 22%, transparent); }
.nav-item.ativo { color: #fff; background: linear-gradient(135deg, var(--marca-azul), color-mix(in srgb, var(--marca-azul) 62%, #04121f)); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--marca-azul) 70%, transparent); }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--line); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px; font-size: 18px; color: var(--ink-2); background: var(--campo); border: 1px solid var(--vidro-borda); cursor: pointer; transition: color .15s ease, border-color .15s ease; }
.icon-btn:hover { color: var(--marca-azul); border-color: color-mix(in srgb, var(--marca-azul) 40%, var(--line)); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--campo); border: 1px solid var(--vidro-borda); white-space: nowrap; }
.ponto-vivo { width: 7px; height: 7px; border-radius: 50%; background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
@media (max-width: 1023px) {   /* celular/janela estreita: a barra vira uma faixa no topo */
  .sidebar { position: sticky; top: 0; z-index: 50; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar-top { border-bottom: 0; padding: 10px 14px; flex: 1; } .sidebar-top img { height: 26px; }
  .sidebar-body { flex-direction: row; padding: 0 8px; flex: none; } .sidebar-modulo { display: none; }
  .nav-lista { flex-direction: row; } .nav-item span { display: none; } .nav-item { padding: 8px 10px; }
  .sidebar-footer { display: none; } #btnPainel { display: none; }
}
/* recolher para um trilho de 64px (desktop), salvo em PAINEL_PAMC */
#btnPainel { display: none; }
@media (min-width: 1024px) {
  #btnPainel { display: inline-flex; position: fixed; top: 50%; left: 260px; z-index: 40; transform: translateY(-50%); width: 24px; height: 48px; align-items: center; justify-content: center;
    border-radius: 0 10px 10px 0; background: var(--vidro-forte); color: var(--ink-2); border: 1px solid var(--vidro-borda); border-left: 0; box-shadow: var(--sombra); font-size: 14px; cursor: pointer; transition: left .2s ease, color .2s ease; }
  #btnPainel:hover { color: var(--marca-azul); }
  html.painel-oculto .sidebar { width: 64px; overflow: hidden; }
  html.painel-oculto .sidebar-body .sidebar-modulo, html.painel-oculto .sidebar-footer, html.painel-oculto .sidebar-top .logo-claro, html.painel-oculto .sidebar-top .logo-escuro,
  html.painel-oculto .sidebar-top .btn-tema, html.painel-oculto .nav-item span { display: none !important; }
  html.painel-oculto .sidebar-top { justify-content: center; padding: 16px 0; }
  html.painel-oculto .marca-recolhida { display: block; height: 30px; width: auto; }
  html.painel-oculto .nav-item { justify-content: center; padding: 11px 0; } html.painel-oculto .sidebar-body { padding: 14px 8px; }
  html.painel-oculto #btnPainel { left: 63px; } html.painel-oculto #btnPainel i { transform: rotate(180deg); }
}
.conteudo { flex: 1; min-width: 0; width: 100%; max-width: 1400px; margin: 0 auto; padding: 20px 16px 56px; }
.conteudo.largo { max-width: none; }
@media (min-width: 1024px) { .conteudo { padding: 28px 36px 64px; } }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-header h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.page-header h1::before { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; margin-bottom: 12px; background: linear-gradient(90deg, var(--marca-vermelho), var(--marca-vinho)); }
.page-header p { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ---------- campos e botões ---------- */
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea { background: var(--campo); color: var(--ink); border-color: var(--vidro-borda); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--marca-azul) 60%, var(--line)); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 11px; font-size: 13px; font-weight: 600; border: 1px solid var(--vidro-borda); cursor: pointer; transition: transform .1s ease, filter .15s ease, border-color .15s ease; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: translateY(1px); } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-neutro { background: var(--campo); color: var(--ink); } .btn-neutro:hover { border-color: color-mix(in srgb, var(--marca-azul) 40%, var(--line)); }
button.bg-sky-600, a.bg-sky-600 { background: linear-gradient(135deg, var(--marca-azul), color-mix(in srgb, var(--marca-azul) 65%, #04121f)); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--marca-azul) 75%, transparent); border-radius: 11px; }
button.bg-emerald-600, a.bg-emerald-600 { background: linear-gradient(135deg, #10B981, #059669); box-shadow: 0 6px 16px -8px rgba(16, 185, 129, .7); border-radius: 11px; }
button.bg-sky-600:hover, a.bg-sky-600:hover, button.bg-emerald-600:hover, a.bg-emerald-600:hover { filter: brightness(1.07); }
button.bg-slate-800 { border-radius: 11px; } button.bg-slate-200, button.bg-white { border-radius: 11px; }
html.dark button.bg-slate-800.text-white { background-color: rgb(var(--slate-200)); color: var(--ink); border: 1px solid var(--line); }
html.dark button.bg-slate-800.text-white:hover { background-color: rgb(var(--slate-300)); }

/* ---------- tabela ---------- */
table thead th { font-weight: 700; letter-spacing: .04em; }
table tbody tr { transition: background-color .12s ease; }
.vidro table, .vidro-forte table { background: transparent; }

/* ---------- modo escuro: superfícies e cores do markup existente (mesmo mapa do portal + sky/violet/red) ---------- */
html.dark .bg-white { background-color: var(--surface); }
html.dark .hover\:bg-white:hover, html.dark .hover\:bg-slate-50:hover { background-color: var(--surface-2); }
html.dark .bg-emerald-50, html.dark .bg-emerald-100 { background-color: rgb(16 185 129 / .14); }
html.dark .text-emerald-700, html.dark .text-emerald-800, html.dark .text-emerald-900 { color: #6ee7b7; }
html.dark .border-emerald-200, html.dark .border-emerald-300 { border-color: rgb(16 185 129 / .32); }
html.dark .bg-amber-50, html.dark .bg-amber-100 { background-color: rgb(245 158 11 / .14); }
html.dark .text-amber-700, html.dark .text-amber-800, html.dark .text-amber-900 { color: #fcd34d; }
html.dark .border-amber-200, html.dark .border-amber-300 { border-color: rgb(245 158 11 / .32); }
html.dark .bg-orange-50, html.dark .bg-orange-100 { background-color: rgb(249 115 22 / .14); }
html.dark .text-orange-700, html.dark .text-orange-800 { color: #fdba74; }
html.dark .bg-red-50, html.dark .bg-red-100 { background-color: rgb(239 68 68 / .15); }
html.dark .text-red-700, html.dark .text-red-800 { color: #fca5a5; }
html.dark .border-red-200 { border-color: rgb(239 68 68 / .32); }
html.dark .bg-sky-50, html.dark .bg-sky-100 { background-color: rgb(14 165 233 / .16); }
html.dark .text-sky-700, html.dark .text-sky-800 { color: #7dd3fc; }
html.dark .hover\:bg-sky-50:hover { background-color: rgb(14 165 233 / .10); }
html.dark .bg-violet-100 { background-color: rgb(139 92 246 / .17); }
html.dark .text-violet-800 { color: #c4b5fd; }
html.dark .ring-sky-200 { --tw-ring-color: rgb(63 162 227 / .4); }

/* aviso de divergências (menu e Controle) */
.nav-item { position: relative; }
.selo-alerta { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; font-style: normal; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; color: #fff; background: var(--marca-vermelho); }
@media (max-width: 1023px) { .selo-alerta { position: absolute; top: -4px; right: -6px; margin: 0; font-size: 9px; line-height: 14px; min-width: 16px; padding: 0 4px; } }
@media (min-width: 1024px) { html.painel-oculto .selo-alerta { position: absolute; top: -4px; right: -2px; margin: 0; font-size: 9px; line-height: 14px; min-width: 16px; padding: 0 4px; } }
.chip.chip-alerta { cursor: pointer; color: #fff; background: var(--marca-vermelho); border-color: transparent; }
.chip.chip-alerta.hidden { display: none; }
