/* Padrão de tela LBHM (core 0.21: shell, tokens de movimento e componentes) com a identidade da QI. */
:root {
  /* Identidade da QI (tokens --qi-* do site qi.edu.br) */
  --qi-red: oklch(58% .22 27); --qi-red-dark: oklch(48% .22 27); --qi-red-soft: oklch(96% .02 27);
  --qi-ink: oklch(14% .02 260); --qi-cream: oklch(97.5% .005 90); --qi-yellow: oklch(86% .17 90);
  /* Papéis do tema LBHM preenchidos com a QI */
  --brand-50: var(--qi-red-soft); --brand-100: oklch(92% .04 27); --brand-500: var(--qi-red);
  --brand-600: var(--qi-red-dark); --brand-700: oklch(40% .19 27);
  --texto: #334155; --texto-forte: var(--qi-ink); --suave: #5f6e83; --borda: #e2e8f0; --borda-campo: #8391a5;
  --superficie-suave: #f8fafc; --fundo: #f1f5f9;
  --ok: oklch(52% .14 150); --ok-fundo: #e3f4ea; --alerta: oklch(52% .13 70); --alerta-fundo: #fff4e5;
  --erro: #b91c1c; --perigo: #dc2626; --perigo-fundo: #fef2f2;
  /* Movimento e profundidade (tokens do core) */
  --ease-nexus: cubic-bezier(.23, 1, .32, 1); --ease-nexus-inout: cubic-bezier(.77, 0, .175, 1); --ease-nexus-drawer: cubic-bezier(.32, .72, 0, 1);
  --duracao-toque: 120ms; --duracao-menu: 180ms; --duracao-modal: 240ms;
  --sombra-card: 0 1px 2px rgb(15 23 42 / .06), 0 1px 3px rgb(15 23 42 / .05);
  --sombra-menu: 0 8px 24px -6px rgb(15 23 42 / .18), 0 2px 6px -2px rgb(15 23 42 / .08);
  --sombra-modal: 0 24px 60px -12px rgb(15 23 42 / .32), 0 8px 20px -8px rgb(15 23 42 / .16);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 "Montserrat", ui-sans-serif, system-ui, sans-serif; color: var(--texto); background: var(--fundo); }
h1, h2, h3 { margin: 0; color: var(--texto-forte); }
h1 { font-size: 1.125rem; font-weight: 600; }
h2 { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.lbhm-titulo { letter-spacing: -.015em; }
small { color: var(--suave); font-weight: 400; font-size: .8rem; }
a { color: var(--brand-600); }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.suave { color: var(--suave); }
.erro { color: var(--erro); }
.lbhm-pular { position: absolute; left: 8px; top: -60px; z-index: 60; padding: 10px 14px; border-radius: .5rem; background: var(--brand-600); color: #fff; font-weight: 600; text-decoration: none; }
.lbhm-pular:focus { top: 8px; }

/* Shell: sidebar recolhível + topbar */
.shell { display: flex; min-height: 100vh; }
#sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 16rem; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--borda);
  transform: translateX(-100%); transition: transform var(--duracao-modal) var(--ease-nexus-drawer), width var(--duracao-menu) var(--ease-nexus-inout); }
#sidebar.aberta { transform: none; box-shadow: var(--sombra-modal); }
#sidebar-backdrop { position: fixed; inset: 0; z-index: 30; background: rgb(15 23 42 / .5); }
#sidebar-backdrop[hidden] { display: none; }
.sb-head { height: 4rem; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--borda); overflow: hidden; }
.sb-head img.sb-full { height: 34px; width: auto; }
.sb-nome { padding-left: 10px; border-left: 1px solid var(--borda); font-weight: 600; color: var(--texto-forte); white-space: nowrap; }
.sb-mini { display: none; width: 32px; height: 32px; border-radius: 8px; }
.sb-nav { flex: 1; display: grid; align-content: start; gap: 2px; padding: 12px; overflow-y: auto; }
.sb-nav a { min-height: 2.75rem; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: .5rem; color: #475569; font-size: .875rem; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background-color var(--duracao-toque) var(--ease-nexus), color var(--duracao-toque) var(--ease-nexus); }
.sb-nav a:hover { background: var(--brand-50); color: var(--brand-700); }
.sb-nav a[aria-current=page] { background: var(--brand-600); color: #fff; }
.sb-nav svg { width: 20px; height: 20px; flex: none; }
.sb-nav .lbhm-contador { margin-left: auto; }
.sb-nav a[aria-current=page] .lbhm-contador { background: #fff; color: var(--brand-700); }
.sb-rodape { padding: 12px; border-top: 1px solid var(--borda); display: grid; gap: 4px; }
.sb-recolher { display: none; min-height: 2.75rem; align-items: center; gap: 12px; padding: 8px 12px; border: 0; border-radius: .5rem; background: none; color: var(--suave); font: inherit; font-size: .875rem; cursor: pointer; }
.sb-recolher:hover { background: var(--superficie-suave); color: var(--texto); }
.sb-recolher svg { width: 20px; height: 20px; flex: none; transition: transform var(--duracao-menu) var(--ease-nexus-inout); }
.sb-versao { margin: 0; padding: 0 12px; font-size: .75rem; color: var(--suave); white-space: nowrap; }
.area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 4rem; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 4px; background: var(--brand-600); color: #fff; }
.topbar h1 { flex: 1; min-width: 0; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-btn { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border: 0; border-radius: .5rem; background: none; color: #fff; cursor: pointer; }
.topbar-btn:hover { background: rgb(255 255 255 / .12); }
.topbar-btn svg { width: 24px; height: 24px; }
.topbar-dir { display: flex; align-items: center; gap: 12px; }
.topbar-dir form { margin: 0; }
.topbar-usuario { display: none; font-size: .875rem; opacity: .9; }
.topbar-sair { min-height: 2.75rem; padding: 0 14px; border: 0; border-radius: .5rem; background: rgb(255 255 255 / .1); color: #fff; font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: background-color var(--duracao-toque) var(--ease-nexus); }
.topbar-sair:hover { background: rgb(255 255 255 / .2); }
#conteudo { flex: 1; outline: none; }
@media (min-width: 768px) {
  #sidebar { position: sticky; top: 0; height: 100vh; transform: none; flex: none; }
  #sidebar.aberta { box-shadow: none; }
  #sidebar-backdrop, #sidebar-toggle { display: none; }
  .sb-recolher { display: flex; }
  .topbar { padding: 0 24px; }
  .topbar-usuario { display: inline; }
  html.sb-collapsed #sidebar { width: 4rem; }
  html.sb-collapsed .sb-label, html.sb-collapsed .sb-full { display: none; }
  html.sb-collapsed .sb-mini { display: block; }
  html.sb-collapsed .sb-head { padding: 0 16px; justify-content: center; }
  html.sb-collapsed .sb-nav, html.sb-collapsed .sb-rodape { padding: 12px 10px; }
  html.sb-collapsed .sb-nav a, html.sb-collapsed .sb-recolher { justify-content: center; padding: 8px; }
  html.sb-collapsed .sb-recolher svg { transform: rotate(180deg); }
}

/* Componentes */
.card { min-width: 0; background: #fff; border: 1px solid var(--borda); border-radius: .75rem; padding: 16px; box-shadow: var(--sombra-card); }
@media (min-width: 640px) { .card { padding: 20px; } }
.lbhm-press:active { filter: contrast(1.35) brightness(.88); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 2.75rem; padding: 0 1rem; border: 1px solid #cbd5e1; border-radius: .5rem; background: #fff; color: var(--texto);
  font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; transition: background-color var(--duracao-toque) var(--ease-nexus), border-color var(--duracao-toque) var(--ease-nexus); }
.btn:hover { background: var(--superficie-suave); }
.btn:active:not([disabled]) { filter: contrast(1.35) brightness(.88); }
.btn.primario { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn.primario:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn.perigo { background: var(--perigo); border-color: var(--perigo); color: #fff; }
.btn.perigo:hover { background: var(--erro); border-color: var(--erro); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.lbhm-contador { min-width: 1.25rem; height: 1.25rem; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 99px; background: var(--perigo); color: #fff; font-size: .7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.lbhm-contador[hidden] { display: none; }
label { display: grid; gap: 4px; font-size: .875rem; font-weight: 500; color: var(--texto); }
input, select { min-height: 2.75rem; padding: .5rem .75rem; border: 1px solid var(--borda-campo); border-radius: .5rem; background: #fff; font: inherit; font-size: .875rem; color: var(--texto-forte);
  transition: box-shadow var(--duracao-toque) var(--ease-nexus), border-color var(--duracao-toque) var(--ease-nexus); }
input:focus, select:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 2px var(--brand-600); }
input::placeholder { color: #94a3b8; }
code { background: var(--fundo); padding: 1px 6px; border-radius: 4px; font-size: .85em; }
.selo { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--fundo); color: var(--suave); white-space: nowrap; }
.selo.ok { background: var(--ok-fundo); color: var(--ok); }
.selo.fora { background: var(--perigo-fundo); color: var(--erro); }
.aviso-rede { margin: 16px 16px 0; padding: 12px 14px; border: 1px solid #fcd9a8; border-radius: .5rem; background: var(--alerta-fundo); color: var(--alerta); font-size: .875rem; }

/* Tabela */
.tabela { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .875rem; }
th { padding: .625rem 1rem; text-align: left; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; color: var(--suave); background: var(--superficie-suave); border-bottom: 1px solid var(--borda); }
td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--borda); font-variant-numeric: tabular-nums; }
tbody tr { transition: background-color var(--duracao-toque) var(--ease-nexus); }
tbody tr:hover { background: var(--superficie-suave); }

/* Kebab (seções Anexos = leitura / Ações = escrita) */
.kebab { position: relative; }
.btn-kebab { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border: 0; border-radius: .5rem; background: transparent; color: #64748b; font-size: 1.25rem; line-height: 1; cursor: pointer;
  transition: background-color var(--duracao-toque) var(--ease-nexus); }
.btn-kebab:hover, .btn-kebab[aria-expanded=true] { background: var(--fundo); color: var(--texto-forte); }
@media (min-width: 640px) { .btn-kebab { width: 2rem; height: 2rem; } }
.menu { position: fixed; z-index: 50; width: 14rem; text-align: left; padding: 4px 0; background: #fff; border: 1px solid var(--borda); border-radius: .75rem; box-shadow: var(--sombra-menu); display: grid;
  transform-origin: top right; animation: menu-entra var(--duracao-menu) var(--ease-nexus); }
.menu[hidden] { display: none; }
@keyframes menu-entra { from { opacity: 0; transform: scale(.96); } }
.menu-secao { margin: 0; padding: .375rem .75rem .125rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; color: var(--suave); }
.menu-divisor { height: 1px; margin: 4px 0; background: var(--borda); }
.menu button, .menu a { display: flex; align-items: center; min-height: 2.75rem; padding: .5rem .75rem; border: 0; background: none; font: inherit; font-size: .875rem; text-align: left; text-decoration: none; cursor: pointer; color: var(--texto); }
@media (min-width: 640px) { .menu button, .menu a { min-height: 2.25rem; } }
.menu button:hover:not([disabled]), .menu button:focus-visible, .menu a:hover, .menu a:focus-visible { background: var(--fundo); outline: none; }
.menu button.perigo { color: var(--erro); }
.menu button.perigo:hover:not([disabled]), .menu button.perigo:focus-visible { background: var(--perigo-fundo); }
.menu button[disabled] { opacity: .45; cursor: not-allowed; }

/* Diálogo de confirmação */
dialog { width: min(28rem, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 1rem; box-shadow: var(--sombra-modal); color: var(--texto); }
dialog[open] { animation: modal-entra var(--duracao-modal) var(--ease-nexus); }
@keyframes modal-entra { from { opacity: 0; transform: scale(.96); } }
dialog::backdrop { background: rgb(15 23 42 / .5); }
dialog form { display: grid; gap: 12px; padding: 1.25rem; }
dialog h2 { font-size: 1rem; }
dialog p { margin: 0; font-size: .875rem; }
.consequencia { padding: 12px; border-radius: .5rem; background: var(--perigo-fundo); color: var(--erro); font-weight: 600; }
.acoes { display: flex; flex-direction: column-reverse; gap: 8px; margin: 8px -1.25rem -1.25rem; padding: 1rem 1.25rem; border-top: 1px solid var(--borda); background: var(--superficie-suave); border-radius: 0 0 1rem 1rem; }
@media (min-width: 640px) { .acoes { flex-direction: row; justify-content: flex-end; } }
.lista-servicos { color: var(--suave); max-height: 120px; overflow: auto; word-break: break-word; }

/* Login */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--fundo); }
.login-card { width: 100%; max-width: 24rem; display: grid; gap: 12px; padding: 32px 24px; border-top: 4px solid var(--brand-500); }
.login-card form { display: grid; gap: 14px; margin-top: 4px; }
.login-card .logo { width: 140px; height: auto; margin: 0 auto 4px; display: block; }
.login-card h1 { text-align: center; font-size: 1.25rem; }
.login-card .sub { margin: 0; text-align: center; color: var(--suave); font-size: .875rem; }
.login-card .erro { margin: 0; padding: 10px 12px; border-radius: .5rem; background: var(--perigo-fundo); font-size: .875rem; }
.login-card .btn { width: 100%; }

/* Seções */
.aba { display: grid; gap: 16px; padding: 16px; }
@media (min-width: 640px) { .aba { padding: 24px; } }
.aba[hidden] { display: none; }
.grade { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .grade { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.barra { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.periodos { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--borda); border-radius: .625rem; background: #fff; }
.periodos .btn { min-height: 2.5rem; border: 0; border-radius: .5rem; }
.btn.periodo.ativo { background: var(--brand-600); color: #fff; }
.vm { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.vm-topo { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.numeros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.numeros div { min-width: 0; background: var(--superficie-suave); border: 1px solid var(--borda); border-radius: .5rem; padding: 8px 10px; }
.rotulo { display: block; overflow: hidden; text-overflow: ellipsis; font-size: .75rem; color: var(--suave); }
.numeros strong { font-size: clamp(1.1rem, 5vw, 1.5rem); font-weight: 600; color: var(--texto-forte); font-variant-numeric: tabular-nums; }
.numeros strong.alto { color: var(--erro); }
.detalhe { margin: 0; font-size: .8rem; color: var(--suave); word-break: break-word; }
.grafico { min-width: 0; position: relative; height: 200px; }
.reinicio { border-radius: .5rem; padding: 12px; background: var(--superficie-suave); border: 1px solid var(--borda); font-size: .875rem; }
.reinicio ol { margin: 8px 0 0; padding-left: 20px; }
.reinicio li { color: var(--suave); }
.reinicio li.feito { color: var(--ok); }
.reinicio li.atual { color: var(--texto-forte); font-weight: 600; }
.reinicio.final-ok { background: var(--ok-fundo); }
.reinicio.final-erro { background: var(--perigo-fundo); }

/* Visão geral */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { display: grid; gap: 2px; }
.kpi .rotulo { font-size: .875rem; }
.kpi strong { font-size: 1.5rem; font-weight: 600; color: var(--texto-forte); font-variant-numeric: tabular-nums; }
.kpi .sub { margin: 0; font-size: .75rem; color: var(--suave); }
.kpi.ruim { border-color: var(--qi-red); }
.kpi.ruim strong { color: var(--erro); }
.tile { display: grid; gap: 10px; color: inherit; text-decoration: none; transition: box-shadow var(--duracao-menu) var(--ease-nexus), border-color var(--duracao-menu) var(--ease-nexus); }
.tile:hover { border-color: var(--brand-100); box-shadow: var(--sombra-menu); }
.barra-uso { display: grid; grid-template-columns: 56px 1fr 48px; align-items: center; gap: 8px; font-size: .85rem; }
.barra-uso .rotulo { grid-column: 1; }
.barra-uso .trilho { grid-column: 2; grid-row: 1; height: 8px; border-radius: 99px; background: var(--fundo); overflow: hidden; }
.barra-uso .cheio { height: 100%; background: var(--ok); border-radius: 99px; }
.barra-uso .cheio.alto { background: var(--qi-red); }
.barra-uso .valor { grid-column: 3; grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.barra-uso .valor.alto { color: var(--erro); }
.rede-agora, .servicos-tile, .em-andamento { margin: 0; font-size: .85rem; }
.servicos-tile.bom { color: var(--ok); font-weight: 600; }
.servicos-tile.ruim, .em-andamento { color: var(--erro); font-weight: 600; }
.atencao { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.atencao a { display: flex; align-items: center; min-height: 44px; color: var(--erro); text-decoration: none; word-break: break-word; }
.atencao a:hover { text-decoration: underline; }
.atencao li.bom { color: var(--ok); padding: 8px 0; }

/* Servidores */
.vm { scroll-margin-top: 16px; }
.vm h3 { margin: 4px 0 0; font-size: .85rem; color: var(--suave); font-weight: 600; }
.vm-topo-dir { display: flex; align-items: center; gap: 4px; }
.resumo-servicos { margin: 0; font-size: .9rem; }
.resumo-servicos a { color: var(--ok); font-weight: 600; text-decoration: none; }
.resumo-servicos a.ruim { color: var(--erro); }

/* Serviços */
.filtros { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 768px) { .filtros { grid-template-columns: 2fr 1fr 1fr auto; } }
#andamento-servicos { display: grid; gap: 8px; margin-top: 12px; }
#andamento-servicos:empty { display: none; }
.contagem { margin: 12px 0 0; font-size: .85rem; color: var(--suave); }
.tabela-servicos table { margin-top: 4px; }
.tabela-servicos input[type=checkbox] { width: 20px; height: 20px; min-height: 0; margin: 0; }
.col-marca { width: 44px; }
.col-acoes { width: 52px; text-align: right; padding: 0 4px; }
.nome-servico { word-break: break-all; }
.nome-servico span { color: var(--suave); }
tr.ruim td { color: var(--erro); }
tr.ruim td .nome-servico span { color: var(--erro); }
.tabela-servicos td .selo { display: inline-block; }
@media (max-width: 767px) {
  .tabela-servicos thead { display: none; }
  .tabela-servicos tr { display: grid; grid-template-columns: 32px minmax(0, 1fr) 44px; gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid var(--borda); }
  .tabela-servicos td { border: 0; padding: 0; font-size: .85rem; }
  .tabela-servicos td.col-marca { grid-row: 1 / span 6; padding-top: 2px; }
  .tabela-servicos td.col-acoes { grid-column: 3; grid-row: 1 / span 2; width: auto; }
  .tabela-servicos td[data-rotulo] { grid-column: 2; }
  .tabela-servicos td.col-nome { grid-row: 1; font-size: .95rem; }
  .tabela-servicos td[data-rotulo]:not(.col-nome)::before { content: attr(data-rotulo) ": "; color: var(--suave); }
  .tabela-servicos td[colspan] { grid-column: 1 / -1; }
}

/* Domínios */
.tabela-dominios table { margin-top: 4px; }
.tabela-dominios td { vertical-align: top; }
.col-dominio { min-width: 200px; }
.col-dominio a { display: block; color: var(--texto); font-weight: 600; text-decoration: none; word-break: break-all; }
.col-dominio a:hover { color: var(--brand-600); text-decoration: underline; }
.nota { display: block; margin-top: 4px; font-size: .75rem; color: var(--suave); }
.regra { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 3px 0; }
.regra + .regra { border-top: 1px dashed var(--borda); }
.regra .destino { word-break: break-all; }
.regra .caminho { font-size: .8rem; word-break: break-all; }
.tipo { padding: 1px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--fundo); white-space: nowrap; }
.tipo-proxy { background: #e3eefb; color: oklch(45% .13 255); }
.tipo-redirect { background: var(--alerta-fundo); color: var(--alerta); }
.tipo-resposta, .tipo-bloqueio { background: var(--perigo-fundo); color: var(--erro); }
.suave { color: var(--suave); }
@media (max-width: 767px) {
  .tabela-dominios thead { display: none; }
  .tabela-dominios tr { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--borda); }
  .tabela-dominios td { border: 0; padding: 0; }
  .tabela-dominios td[data-rotulo] { font-size: .8rem; color: var(--suave); }
  .col-dominio { min-width: 0; }
}
