/* Tema visual "Aurora PRF": vidro fosco sobre azul-marinho e amarelo (cores da PRF).
   SOMENTE aparência: não altera lógica, cálculos, relatórios (IMR/PDF/impressão) nem a aba do administrador.
   Escopo: só a tela do painel (#tela-dashboard) e a tela "Ao vivo" (#tela-aovivo). Modais, relatórios, login e Painel de Ferramentas ficam como estão.
   Para voltar ao visual antigo: abra o sistema com ?tema=classico (e ?tema=prf para voltar a este). */
@media screen {
  html.tema-prf {
    --f-disp: "Sora", "Manrope", "Segoe UI", system-ui, sans-serif; --f-body: "Manrope", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --bg: #f3f7ff; --fg: #0a1f4d; --muted: #4a5f8f; --surface: rgba(255,255,255,.82); --surface-2: rgba(255,255,255,.92); --line: rgba(10,31,77,.14); --head: rgba(10,31,77,.07);
    --glow: rgba(10,31,77,.18); --yellow: #fdc12b; --blue: #1d5fb4; --blue-soft: rgba(29,95,180,.12); --amber: #b07a00; --amber-soft: rgba(253,193,43,.24);
    --mesh: radial-gradient(60em 42em at 4% -10%, rgba(79,143,240,.38), transparent 62%), radial-gradient(46em 36em at 100% 0%, rgba(253,193,43,.40), transparent 62%), radial-gradient(60em 46em at 50% 125%, rgba(125,170,240,.35), transparent 62%);
  }
  html.tema-prf.dark {
    --bg: #07122b; --fg: #eaf0ff; --muted: #a9b8dc; --surface: rgba(255,255,255,.07); --surface-2: rgba(255,255,255,.10); --line: rgba(255,255,255,.14); --head: rgba(255,255,255,.09);
    --glow: rgba(0,0,0,.45); --blue: #8ab8ff; --blue-soft: rgba(79,143,240,.20); --amber: #fdc12b; --amber-soft: rgba(253,193,43,.20);
    --mesh: radial-gradient(60em 42em at 4% -10%, rgba(43,108,212,.60), transparent 62%), radial-gradient(46em 36em at 100% 0%, rgba(253,193,43,.20), transparent 62%), radial-gradient(60em 46em at 50% 125%, rgba(30,95,180,.38), transparent 62%);
  }
  html.tema-prf body { background: var(--mesh), var(--bg) !important; background-attachment: fixed !important; color: var(--fg); font-family: var(--f-body); }

  /* TV de 60" e telas grandes: tudo cresce junto (as medidas do sistema são em rem) */
  @media (min-width: 1800px) { html.tema-prf { font-size: 20px; } }
  @media (min-width: 2600px) { html.tema-prf { font-size: 28px; } }
  html.tema-prf .chart-container { height: 16.25rem; }
  html.tema-prf .chart-container-small { height: 15rem; }

  /* Celular: o cabeçalho quebra de linha (antes os botões passavam da largura da tela) */
  @media (max-width: 820px) {
    html.tema-prf #tela-dashboard #header-bg { flex-wrap: wrap; row-gap: .6rem; padding-left: .75rem; padding-right: .75rem; }
    html.tema-prf #tela-dashboard #header-bg > div { margin-left: 0 !important; margin-right: 0 !important; flex-wrap: wrap; row-gap: .5rem; }
    html.tema-prf #tela-dashboard #header-bg > div.gap-4 { gap: .5rem; }
    html.tema-prf #tela-dashboard #header-bg button { padding-left: .7rem; padding-right: .7rem; font-size: .8rem; }
    html.tema-prf #tela-dashboard #titulo-painel { font-size: 1.05rem; }
    html.tema-prf #tela-dashboard #card-filtros > .flex, html.tema-prf #tela-dashboard #card-filtros .flex.items-center.gap-2 { flex-wrap: wrap; row-gap: .5rem; }
    html.tema-prf #tela-dashboard .card > .flex.justify-between { flex-wrap: wrap; row-gap: .5rem; column-gap: .75rem; }
    html.tema-prf #tela-dashboard .card > .flex.justify-between .flex.items-center { flex-wrap: wrap; row-gap: .5rem; }
    html.tema-prf #tela-dashboard #filtro-busca { width: 100%; }
  }

  /* ===== Painel principal ===== */
  /* o cabeçalho mantém a cor definida no Painel de Ferramentas; só ganha brilho e sombra */
  html.tema-prf #tela-dashboard #header-bg { background-image: linear-gradient(90deg, rgba(255,255,255,.05), rgba(79,143,240,.18)); box-shadow: 0 .6rem 1.4rem -.8rem var(--glow); }
  html.tema-prf #tela-dashboard #titulo-painel, html.tema-prf #tela-dashboard h2, html.tema-prf #tela-dashboard h3 { font-family: var(--f-disp); }
  html.tema-prf #tela-dashboard h3.uppercase { letter-spacing: .06em; }
  /* o contorno é uma sombra interna (não muda o tamanho do cartão nem do gráfico, então as imagens do PDF não mudam) */
  html.tema-prf #tela-dashboard .card { background: var(--surface) !important; border-radius: 1rem; -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%); box-shadow: 0 1.1rem 2.2rem -1.3rem var(--glow), inset 0 0 0 1px var(--line); }
  html.tema-prf #tela-dashboard .card:hover { box-shadow: 0 1.4rem 2.4rem -1.1rem var(--glow), inset 0 0 0 1px var(--line); }
  html.tema-prf #tela-dashboard .card [id^="kpi-"] { font-family: var(--f-disp); font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
  html.tema-prf #tela-dashboard .card > .rounded-full { background: var(--blue-soft) !important; color: var(--blue) !important; }
  html.tema-prf #tela-dashboard .card > .rounded-full[class*="text-red"] { background: rgba(229,72,77,.16) !important; color: #e5484d !important; }
  html.tema-prf #tela-dashboard .card > .rounded-full[class*="text-yellow"], html.tema-prf #tela-dashboard .card > .rounded-full[class*="text-pink"] { background: var(--amber-soft) !important; color: var(--amber) !important; }
  html.tema-prf.dark #tela-dashboard [class*="dark:text-indigo"] { color: var(--blue) !important; }   /* sem o roxo do visual antigo */
  html.tema-prf #tela-dashboard .border-b { border-color: var(--line) !important; }
  html.tema-prf #tela-dashboard #card-filtros select, html.tema-prf #tela-dashboard #card-filtros input, html.tema-prf #tela-dashboard .card input[type="search"], html.tema-prf #tela-dashboard .card input[type="text"] {
    background: var(--surface-2) !important; border: 1px solid var(--line) !important; border-radius: .5rem; color: var(--fg); }
  html.tema-prf #tela-dashboard select option { color: #0a1f4d; background: #fff; }
  html.tema-prf #tela-dashboard .data-table thead, html.tema-prf #tela-dashboard .data-table thead th { background: var(--head) !important; color: var(--muted) !important; }
  html.tema-prf #tela-dashboard .data-table tbody { background: transparent !important; }
  html.tema-prf #tela-dashboard .data-table tbody tr { border-color: var(--line) !important; }
  html.tema-prf #tela-dashboard .data-table tbody tr:hover { background: var(--head); }
  html.tema-prf #tela-dashboard .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: var(--line) !important; }

  /* ===== Tela "Ao vivo" ===== */
  html.tema-prf #tela-aovivo { background: var(--mesh), var(--bg) !important; font-family: var(--f-body); }
  html.tema-prf #tela-aovivo > div.sticky { background-color: #07122b !important; background-image: none; border-bottom-color: var(--yellow) !important; box-shadow: 0 .6rem 1.4rem -.8rem var(--glow); }
  html.tema-prf #tela-aovivo h2, html.tema-prf #tela-aovivo h3 { font-family: var(--f-disp); }
  html.tema-prf #tela-aovivo [class*="bg-white"] { background: var(--surface) !important; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
    border-radius: 1rem; -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%); box-shadow: 0 1.1rem 2.2rem -1.3rem var(--glow); }
  html.tema-prf #tela-aovivo [class*="bg-white"]:not(.aovivo-card):not([class*="border-l-"]) { border-left: 1px solid var(--line); }
  html.tema-prf #tela-aovivo #aovivo-carga button { border-radius: 999px; box-shadow: none; }
  html.tema-prf #tela-aovivo select, html.tema-prf #tela-aovivo input { border-radius: .5rem !important; box-shadow: none; background: var(--surface-2) !important; color: var(--fg); }
  html.tema-prf #tela-aovivo select option { color: #0a1f4d; background: #fff; }
  html.tema-prf #tela-aovivo .aovivo-card [id^="aovivo-"] { font-family: var(--f-disp); font-weight: 700; font-variant-numeric: tabular-nums; }
  /* versão "calma": 6 cartões com número neutro (vermelho só nos alertas) + 6 indicadores discretos */
  html.tema-prf #tela-aovivo .aovivo-card [id^="aovivo-"] { color: var(--fg) !important; }
  html.tema-prf #tela-aovivo .aovivo-card[data-card="risco"] [id^="aovivo-"], html.tema-prf #tela-aovivo .aovivo-card[data-card="alta"] [id^="aovivo-"] { color: #e5484d !important; }
  html.tema-prf #tela-aovivo .aovivo-card:nth-child(n+7) { background: transparent !important; box-shadow: none; padding: .55rem .9rem; border: 1px solid var(--line) !important; border-radius: .75rem; -webkit-backdrop-filter: none; backdrop-filter: none; }
  html.tema-prf #tela-aovivo .aovivo-card:nth-child(n+7):hover { background: var(--head) !important; transform: none; }
  html.tema-prf #tela-aovivo .aovivo-card:nth-child(n+7) [id^="aovivo-"]:not([id$="-sub"]) { font-size: 1.15rem; line-height: 1.3; font-weight: 600; }
  html.tema-prf #tela-aovivo .aovivo-card[data-card="todos"] { border-left-color: var(--yellow) !important; }
  html.tema-prf #tela-aovivo .aovivo-card.ativo { outline-color: var(--yellow); }
  html.tema-prf #tela-aovivo thead { background: var(--head) !important; }
  html.tema-prf #tela-aovivo thead th { color: var(--muted) !important; }
  html.tema-prf #tela-aovivo tbody tr { border-color: var(--line) !important; }
  /* chamados vencidos: vermelho de verdade (antes o vermelho translúcido sobre o azul escuro parecia roxo) */
  html.tema-prf #tela-aovivo tbody tr.aovivo-vencido { background: rgba(200, 30, 30, .34) !important; box-shadow: inset 4px 0 0 #ef4444; }

  /* botões da barra do Ao vivo: formato "pílula", igual ao botão Tema do painel principal */
  html.tema-prf #tela-aovivo .sticky button[id^="btn-"] { border-radius: 999px; padding: .5rem 1rem; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.28); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .15s, border-color .15s; }
  html.tema-prf #tela-aovivo .sticky button[id^="btn-"]:hover { background: rgba(255,255,255,.18); border-color: var(--yellow); }
  html.tema-prf #tela-aovivo .sticky button[id^="btn-"] i { color: var(--yellow); }
  html.tema-prf #tela-aovivo #btn-fechar-aovivo { background: #d92d20; border-color: rgba(255,255,255,.35); }
  html.tema-prf #tela-aovivo #btn-fechar-aovivo i { color: #fff; }

  /* cabeçalho do painel principal: mesmos botões em pílula do Ao vivo */
  html.tema-prf #tela-dashboard #header-bg button { border-radius: 999px; border: 1px solid rgba(255,255,255,.28); transition: background .15s, border-color .15s; }
  html.tema-prf #tela-dashboard #header-bg #btn-config, html.tema-prf #tela-dashboard #header-bg #btn-theme { background: rgba(255,255,255,.08); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  html.tema-prf #tela-dashboard #header-bg #btn-config:hover, html.tema-prf #tela-dashboard #header-bg #btn-theme:hover { background: rgba(255,255,255,.18); border-color: var(--yellow); }
  html.tema-prf #tela-dashboard #header-bg #btn-config i, html.tema-prf #tela-dashboard #header-bg #btn-theme i { color: var(--yellow); }
  html.tema-prf #tela-dashboard #header-bg #btn-aovivo { background: #16a34a; border-color: rgba(255,255,255,.35); }
  html.tema-prf #tela-dashboard #header-bg #btn-logout { background: #d92d20; border-color: rgba(255,255,255,.35); }
  html.tema-prf #tela-dashboard #header-bg #badge-status { border-radius: 999px; padding-left: .7rem; padding-right: .7rem; }

  /* Ao vivo: filtros e chips de analista na mesma linha em telas largas (os chips rolam se forem muitos) */
  @media (min-width: 1100px) {
    html.tema-prf #tela-aovivo #aovivo-filtros { flex-wrap: nowrap; }
    html.tema-prf #tela-aovivo #aovivo-filtros > * { flex-shrink: 0; }
    html.tema-prf #tela-aovivo #aovivo-busca { width: 13rem; flex: 0 1 13rem; min-width: 8rem; }
    html.tema-prf #tela-aovivo #aovivo-filtros { gap: .6rem; }
    html.tema-prf #tela-aovivo #aovivo-filtro-info { white-space: nowrap; }
    html.tema-prf #tela-aovivo #aovivo-carga { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
    html.tema-prf #tela-aovivo #aovivo-carga button { white-space: nowrap; flex-shrink: 0; }
  }
}
