/* =============================================================================
   app.css — estilos do painel do nc-admin, no padrão visual do Leeloo.

   - Tokens copiados do leeloo.css (sistema2026/public/css/leeloo.css): tema
     Solar (escuro, padrão) e Lunar (claro), escolhidos por body[data-scheme]
     e lembrados no navegador (localStorage "leeloo-scheme"). Não segue o
     prefers-color-scheme, igual ao Leeloo. O link do Leeloo pode mandar
     ?scheme=lunar|solar para abrir no mesmo tema.
   - Visual "HUD": raio 0, cantos de mira laranja nos cartões, botões com canto
     cortado, títulos estruturais em mono maiúsculo, sem glow nem sombra colorida.
   - Tamanhos já 10% menores que os do leeloo.css: o Leeloo usa html{zoom:90%},
     que aqui não é usado porque desalinha a dica dos gráficos (posicionada pelo
     mouse). Na tela, o tamanho fica o mesmo do Leeloo.
   - Fontes Inter e JetBrains Mono servidas do próprio host (assets/fonts, OFL).
   - Estado sempre com texto ou bolinha, nunca só a cor.
   - @media print no fim: a página "Relatório" sai em fundo branco.
   ============================================================================= */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/inter-variable.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/jetbrainsmono-variable.woff2") format("woff2"); }

/* --- Tokens: Solar (padrão) --------------------------------------------------
   Ficam no body (e não no :root) porque o tema muda no body: os apelidos
   abaixo (--warn, --series-1...) precisam ser resolvidos depois da troca. */
body {
  color-scheme: dark;
  --bg-void: #050505;
  --bg-base: #090909;
  --bg-panel: #0e0e0e;
  --bg-panel-raised: #161616;
  --line: rgba(255, 140, 66, 0.22);
  --line-strong: rgba(255, 140, 66, 0.5);
  --accent: #ff7a1a;
  --accent-2: #ffb066;
  --accent-soft: rgba(255, 122, 26, 0.12);
  --accent-text: #ff7a1a; /* links; no Lunar fica mais escuro para dar contraste */
  --text-primary: #eef2f6;
  --text-secondary: #9aa5b1;
  --text-muted: #5c6673;
  --good: #29d99a;
  --warning: #ffd23d;
  --critical: #ff4d5e;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Apelidos usados pelo JavaScript das telas (gráficos e relatório) */
  --series-1: var(--accent);
  --warn: var(--warning);

  --sidebar-w: 216px;
}

/* --- Tokens: Lunar ------------------------------------------------------------ */
body[data-scheme="lunar"] {
  color-scheme: light;
  --bg-void: #e3e7ec;
  --bg-base: #eef1f5;
  --bg-panel: #f8f9fb;
  --bg-panel-raised: #eef1f4;
  --line: rgba(20, 30, 45, 0.14);
  --line-strong: rgba(20, 30, 45, 0.26);
  --accent: #d9601a;
  --accent-2: #ff8a3d;
  --accent-soft: rgba(217, 96, 26, 0.1);
  --accent-text: #a94a10;
  --text-primary: #141b23;
  --text-secondary: #3d4a58;
  --text-muted: #6b7789;
  --good: #1f9d63;
  --warning: #a8720a;
  --critical: #d63b46;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --- Base ------------------------------------------------------------------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-void);
  color: var(--text-primary);
  font: 400 14.5px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}
::selection { background: var(--accent-soft); color: var(--accent); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; }
/* Título da tela: mono maiúsculo, como os títulos estruturais do Leeloo */
h1 { font: 700 16px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
h2 { font: 700 12px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
/* Selos e etiquetas ao lado do título ficam no estilo normal deles */
h1 .badge, h2 .badge { font: 600 11.5px/16px var(--font-body); text-transform: none; letter-spacing: normal; }
h1 .tag, h2 .tag { text-transform: none; letter-spacing: normal; }
h3 { font-size: 13.5px; font-weight: 600; }
code, .mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--text-muted); }
.small { font-size: 11.5px; }
.text-2 { color: var(--text-secondary); }
/* Números e IDs em mono (padrão do Leeloo para dado técnico) */
.num { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
/* Texto longo numa linha só, cortado com "…" */
.clip-line { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Estrutura: menu lateral ------------------------------------------------------ */
.shell { display: flex; min-height: 100vh; background: var(--bg-void); }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 12px; background: var(--bg-panel); border-right: 1px solid var(--line);
  transition: width 0.2s ease, padding 0.2s ease;
}
.sidebar nav { overflow-y: auto; min-height: 0; }
.brand {
  display: flex; align-items: center; gap: 9px; padding: 5px 5px 14px;
  font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); white-space: nowrap; overflow: hidden;
}
.brand:hover { text-decoration: none; }
.brand-lg { font-size: 16px; padding: 0 0 2px; }
/* Marca do Leeloo: círculo em gradiente cônico com miolo da cor do painel */
.brand-mark {
  width: 25px; height: 25px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(from 220deg, var(--accent), transparent 65%);
}
.brand-mark::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg-panel); }

/* Quem está logado (como o userbox do Leeloo; avatar com a inicial) */
.userbox { display: flex; align-items: center; gap: 9px; padding: 9px 5px 16px; margin-bottom: 5px; border-bottom: 1px solid var(--line); min-width: 0; }
.userbox-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--bg-panel-raised); border: 1px solid var(--line-strong);
  font: 700 13px var(--font-mono); color: var(--accent); text-transform: uppercase;
}
.userbox-info { min-width: 0; }
.userbox-name { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox-meta { display: block; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

nav .nav-group {
  margin: 12px 9px 4px; font: 500 9.5px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); white-space: nowrap;
}
nav a {
  display: flex; align-items: center; gap: 11px; padding: 7px 9px; border-radius: 4px; position: relative;
  color: var(--text-secondary); font-size: 13px; font-weight: 500; white-space: nowrap;
  border-left: 2px solid transparent; transition: background 0.15s ease, color 0.15s ease;
}
nav a:hover { background: var(--bg-panel-raised); color: var(--text-primary); text-decoration: none; }
nav a.active { color: var(--text-primary); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
nav a .ico {
  display: flex; align-items: center; justify-content: center; flex: none; width: 25px; height: 25px;
  border-radius: 7px; background: var(--bg-panel-raised); border: 1px solid var(--line);
}
nav a .ico svg { width: 15px; height: 15px; opacity: 0.85; }
nav a.active .ico { background: var(--accent-soft); border-color: var(--line-strong); color: var(--accent); }
nav a.active .ico svg { opacity: 1; }
/* Contador de alertas (vermelho = há alerta; o número acompanha) */
nav a .count {
  margin-left: auto; font: 700 10.5px/17px var(--font-mono); padding: 0 6px; border-radius: 2px;
  background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--critical);
}
.sidebar-foot {
  margin-top: auto; padding: 12px 9px 2px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 8px;
  font: 9.5px var(--font-mono); color: var(--text-muted); text-transform: uppercase; white-space: nowrap;
}

/* Botão de recolher o menu, pendurado na borda direita */
.navcollapse-btn {
  position: absolute; top: 20px; right: -12px; z-index: 6; width: 23px; height: 23px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; padding: 0;
  background: var(--bg-panel); border: 1px solid var(--line-strong); color: var(--text-secondary);
  font-size: 12px; line-height: 1; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.navcollapse-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Menu recolhido: só os ícones (preferência lembrada no navegador) */
.shell.nav-collapsed { --sidebar-w: 65px; }
.shell.nav-collapsed .sidebar { padding: 14px 8px; }
.shell.nav-collapsed .brand > span:last-child,
.shell.nav-collapsed .userbox-info,
.shell.nav-collapsed .sidebar-foot,
.shell.nav-collapsed nav .nav-group,
.shell.nav-collapsed nav a .lbl { display: none; }
.shell.nav-collapsed .brand, .shell.nav-collapsed .userbox { justify-content: center; }
.shell.nav-collapsed nav a { justify-content: center; padding: 7px 0; }
.shell.nav-collapsed nav a .ico { width: 29px; height: 29px; }
.shell.nav-collapsed nav a .count { position: absolute; top: 1px; right: 2px; margin: 0; padding: 0 4px; line-height: 15px; }

/* --- Estrutura: barra do topo ----------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 12px 25px; background: var(--bg-base); border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
/* Caminho da tela em mono maiúsculo com o prefixo "//" laranja (topbar-title do Leeloo) */
.crumbs {
  display: flex; gap: 6px; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap;
  font: 700 12px var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
}
.crumbs::before { content: "//"; color: var(--accent); }
.crumbs a { color: var(--text-secondary); }
.crumbs a:hover { color: var(--accent); text-decoration: none; }
.crumbs .sep { opacity: 0.6; }
.crumbs .here { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.clock { font: 12px var(--font-mono); color: var(--text-muted); font-variant-numeric: tabular-nums; margin-right: 4px; }
/* Botões só-ícone do topo (voltar, tema) */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 29px; height: 29px; padding: 0;
  border: 1px solid var(--line); background: var(--bg-panel); color: var(--text-secondary); border-radius: 0; cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.iconbtn:hover { color: var(--text-primary); border-color: var(--line-strong); }
.iconbtn svg { width: 14px; height: 14px; }
.theme-toggle .ico-lunar { display: none; }
body[data-scheme="lunar"] .theme-toggle .ico-solar { display: none; }
body[data-scheme="lunar"] .theme-toggle .ico-lunar { display: block; }
.btn.menu-toggle { display: none; }
.view { padding: 23px 25px 36px; max-width: 1440px; width: 100%; margin: 0 auto; outline: none; }

.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--text-secondary); margin-top: 4px; font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mt { margin-top: 16px; }

/* --- Cartões (o .panel do Leeloo, com os cantos de mira) ------------------------- */
.card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 0; position: relative; min-width: 0; }
.card::before, .card::after {
  content: ""; position: absolute; width: 9px; height: 9px; border: 2px solid var(--accent); z-index: 1; pointer-events: none;
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head .hint { margin-left: auto; }
.card-body { padding: 14px 16px 16px; }
.card-body.flush { padding: 0; }

/* Indicador (chart-stat do Leeloo): rótulo mono maiúsculo, valor mono grande */
.stat { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.stat .label { font: 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); }
.stat .value { font: 700 22px/1.25 var(--font-mono); font-variant-numeric: tabular-nums; }
.stat .foot { color: var(--text-muted); font-size: 11px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hero { font: 700 40px/1.1 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.meter { height: 7px; background: var(--bg-void); border: 1px solid var(--line); overflow: hidden; min-width: 60px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter.warn > span { background: var(--warning); }
.meter.crit > span { background: var(--critical); }
.usage-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.usage-cell .meter { flex: 1; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--text-muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* --- Selos de estado (.pill do Leeloo) ------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 6px; border-radius: 2px;
  font-size: 11.5px; font-weight: 600; line-height: 16px; white-space: nowrap;
  background: var(--bg-panel-raised); color: var(--text-muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; display: none; }
.badge.good, .badge.warn, .badge.crit, .badge.serious, .badge.info { --tone: var(--accent); color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.badge.good::before, .badge.warn::before, .badge.crit::before, .badge.serious::before, .badge.info::before { display: block; background: var(--tone); }
.badge.good { --tone: var(--good); }
.badge.warn { --tone: var(--warning); }
/* "negado" (serious) usa o vermelho do Leeloo, que só tem três cores de estado; o texto diferencia */
.badge.crit, .badge.serious { --tone: var(--critical); }
.badge.plain::before { display: none; }
.tag {
  display: inline-block; padding: 0 6px; border: 1px solid var(--line); background: var(--bg-panel-raised);
  font: 11px/18px var(--font-mono); color: var(--text-secondary); margin: 1px 2px 1px 0; overflow-wrap: anywhere;
}
td .tag { white-space: nowrap; overflow-wrap: normal; }

/* --- Botões (canto cortado) e formulários ------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px; border-radius: 0; border: 1px solid var(--line-strong);
  background: var(--bg-panel-raised); color: var(--text-primary); font: 600 12.5px var(--font-body); cursor: pointer; white-space: nowrap;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  transition: filter 0.2s ease;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #1a1204; }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--critical) 50%, transparent); color: var(--critical); }
.btn-ghost { border-color: transparent; background: transparent; clip-path: none; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); filter: none; background: var(--bg-panel-raised); }
.btn-sm { height: 26px; padding: 0 9px; font-size: 11.5px; clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.btn-ghost.btn-sm { clip-path: none; }
.btn-block { width: 100%; }
.icon-only { width: 32px; padding: 0; }
.btn-sm.icon-only { width: 26px; }
.btn .spin, .spin {
  width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block; flex: none;
}
.btn-primary .spin { border-color: rgba(26, 18, 4, 0.35); border-top-color: #1a1204; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Rótulo de campo: o .field-label do Leeloo (blueprint.php) */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; font-weight: 500; color: var(--text-primary); }
.field .help { font-size: 11px; color: var(--text-muted); font-weight: 400; }
input, select, textarea {
  font: 13px var(--font-body); color: var(--text-primary); background: var(--bg-base); border: 1px solid var(--line-strong);
  border-radius: 0; padding: 7px 11px; min-height: 32px; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Campo travado: cinza com riscas (no Solar o fundo travado quase não se distingue) */
input:disabled, input[readonly], select:disabled, textarea:disabled, textarea[readonly] {
  background: color-mix(in srgb, #808080 38%, var(--bg-base)); border-color: var(--line); color: var(--text-muted); cursor: not-allowed;
  background-image: repeating-linear-gradient(135deg, transparent, transparent 6px,
    color-mix(in srgb, var(--text-muted) 14%, transparent) 6px, color-mix(in srgb, var(--text-muted) 14%, transparent) 7px);
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error {
  margin: 0; padding: 9px 13px; font-size: 12.5px; color: var(--critical);
  background: color-mix(in srgb, var(--critical) 12%, transparent); border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
}
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.toolbar .search { min-width: 240px; }

/* --- Tabelas (table.data do Leeloo: zebra, cabeçalho mono-mudo) --------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--bg-panel); position: sticky; top: 0; white-space: nowrap;
}
th.num { font: 600 10.5px var(--font-body); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th .arrow { color: var(--accent); margin-left: 4px; }
tbody tr { transition: background 0.12s ease; }
tbody tr:nth-child(odd) { background: var(--bg-panel-raised); }
tbody tr:hover { background: var(--accent-soft); }
tbody tr.clickable { cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }
td.actions { text-align: right; white-space: nowrap; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-muted); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; color: var(--text-muted); font: 11.5px var(--font-mono); }

/* --- Abas: faixa de botões, a atual em laranja (como a navegação secundária do Leeloo) */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button {
  height: 30px; padding: 0 13px; border: 1px solid var(--line-strong); background: var(--bg-panel-raised);
  color: var(--text-primary); font: 600 12.5px var(--font-body); cursor: pointer; white-space: nowrap;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  transition: filter 0.2s ease;
}
.tabs button:hover { filter: brightness(1.15); }
.tabs button.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #1a1204; }

/* --- Alertas (lista) e avisos (.notice do Leeloo) ----------------------------------- */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-top: 1px solid var(--line); }
.alert-list li:first-child { border-top: none; }
.alert-list .msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.callout {
  --tone: var(--text-secondary); display: flex; gap: 10px; padding: 9px 13px; font-size: 12.5px;
  color: var(--text-secondary); background: var(--bg-panel-raised); border: 1px solid var(--line);
}
.callout.warn, .callout.crit, .callout.good {
  color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent); border-color: color-mix(in srgb, var(--tone) 30%, transparent);
}
.callout.warn { --tone: var(--warning); }
.callout.crit { --tone: var(--critical); }
.callout.good { --tone: var(--good); }
.callout a { color: inherit; text-decoration: underline; }

/* --- Passos do job (linha do tempo) ----------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: none; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--text-muted); justify-self: center; }
.timeline .done .dot { background: var(--good); }
.timeline .failed .dot, .timeline .compensation_failed .dot { background: var(--critical); }
.timeline .running .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.timeline .compensated .dot, .timeline .skipped .dot { background: var(--warning); }
@keyframes pulse { 50% { opacity: 0.35; } }
pre.json {
  margin: 6px 0 0; padding: 10px 12px; background: var(--bg-void); border: 1px solid var(--line); color: var(--text-secondary);
  font: 11.5px/1.45 var(--font-mono); overflow: auto; max-height: 360px; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* --- Gráficos (cores do Chart.php do Leeloo: grade em --line, eixo mono, laranja) */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--line-strong); stroke-width: 1; }
.chart .tick { fill: var(--text-muted); font: 10px var(--font-mono); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.12; }
.chart .end-dot { stroke: var(--bg-panel); stroke-width: 2; }
.chart .label { fill: var(--text-secondary); font-size: 11.5px; }
.chart .value { fill: var(--text-primary); font: 600 11px var(--font-mono); font-variant-numeric: tabular-nums; }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .bar-hit { fill: transparent; }
.chart .bar-row:hover .bar-bg { fill: var(--accent-soft); }
.chart .bar-bg { fill: transparent; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; padding: 6px 10px; border-radius: 0;
  background: var(--bg-panel-raised); border: 1px solid var(--line); font-size: 11.5px; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}
.tooltip .t-title { color: var(--text-muted); margin-bottom: 2px; }
.tooltip .t-value { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-secondary); margin-top: 8px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 9px; height: 9px; display: inline-block; }
.spark { display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; }

/* --- Avisos que somem sozinhos e modais ---------------------------------------------- */
/* O Leeloo não tem toast; aqui ele fica no mesmo estilo dos painéis (resultado dos jobs) */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  --tone: var(--accent); background: var(--bg-panel); border: 1px solid var(--line-strong); border-left: 3px solid var(--tone);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); padding: 11px 13px; display: flex; gap: 10px; align-items: flex-start;
  animation: slide-in 0.18s ease-out;
}
.toast .grow { min-width: 0; overflow-wrap: anywhere; }
.toast .title { font-weight: 600; font-size: 13px; }
.toast.good { --tone: var(--good); }
.toast.crit { --tone: var(--critical); }
@keyframes slide-in { from { transform: translateY(8px); opacity: 0; } }

/* Modal: sempre escuro no Solar e no mesmo estilo dos painéis (regra do <dialog> do Leeloo) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto;
}
.modal { background: var(--bg-panel); color: var(--text-primary); border: 1px solid var(--line); border-radius: 4px; width: 100%; max-width: 560px; }
.modal.wide { max-width: 860px; }
.modal-head { padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 12px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.secret-box { display: flex; gap: 8px; align-items: center; }
.secret-box code { flex: 1; padding: 7px 10px; background: var(--bg-void); border: 1px solid var(--line); overflow-wrap: anywhere; }

/* --- Login (caixa centralizada, como o login.php do Leeloo) ---------------------------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bg-void); }
.login-card {
  width: min(340px, 100%); background: var(--bg-panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 25px 23px; display: flex; flex-direction: column; gap: 12px;
}
.login-card p { margin: 0 0 8px; font-size: 11.5px; }

/* --- Carregando -------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-panel-raised), var(--accent-soft), var(--bg-panel-raised));
  background-size: 200% 100%; animation: shimmer 1.2s infinite; min-height: 16px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-muted); padding: 24px; font-size: 12.5px; }

/* --- Modo embutido (dentro do Leeloo) -------------------------------------------
   O Leeloo já mostra o menu dele e o título; aqui fica só a faixa de botões com
   as telas do painel (a navegação secundária do Leeloo) e quem está logado. */
body.embed .sidebar, body.embed .topbar { display: none !important; }
/* A página do Leeloo tem html{zoom:90%}, e o zoom atravessa para dentro do
   iframe: sem compensar, o painel ficaria 10% menor que o próprio Leeloo.
   1/0.9 desfaz isso só aqui dentro (o painel numa aba não muda). */
html.embed { zoom: 1.1111; }
/* Com o zoom, 100vh daqui de dentro vale 1,1111 da altura do quadro: sem
   dividir, a tela de login passaria do iframe e criaria rolagem. O painel não
   força altura: ele avisa a altura do conteúdo ao Leeloo (mensagem
   "nc-admin:altura", main.js) e o Leeloo ajusta o quadro. */
html.embed .login { min-height: calc(100vh / 1.1111); }
html.embed .shell { min-height: 0; }
.embedbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--bg-base); border-bottom: 1px solid var(--line);
}
.embed-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.embed-nav .btn { gap: 6px; }
.embed-nav .count {
  font: 700 10px/15px var(--font-mono); padding: 0 5px; border-radius: 2px;
  background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--critical);
}
.embed-nav .btn-primary .count { background: rgba(26, 18, 4, 0.18); color: #1a1204; }
.embedbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.embedbar-right .user { font-size: 12px; color: var(--text-muted); }
body.embed .view { padding: 18px 16px 28px; }

/* --- Telas menores ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Mesmo breakpoint do Leeloo (760px); aqui o menu continua abrindo pelo ☰ */
@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 50; left: 0; width: 216px; transform: translateX(-100%); transition: transform 0.2s; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
  .sidebar.open { transform: none; }
  .navcollapse-btn { display: none; }
  /* No celular o menu sempre abre inteiro, mesmo se estiver recolhido no computador */
  .shell.nav-collapsed .sidebar { padding: 14px 12px; }
  .shell.nav-collapsed .brand > span:last-child, .shell.nav-collapsed .userbox-info, .shell.nav-collapsed nav .nav-group { display: block; }
  .shell.nav-collapsed .sidebar-foot { display: flex; }
  .shell.nav-collapsed nav a .lbl { display: inline; }
  .shell.nav-collapsed .brand, .shell.nav-collapsed .userbox { justify-content: flex-start; }
  .shell.nav-collapsed nav a { justify-content: flex-start; padding: 7px 9px; }
  .shell.nav-collapsed nav a .count { position: static; margin-left: auto; padding: 0 6px; line-height: 17px; }
  .btn.menu-toggle { display: inline-flex; }
  .view { padding: 16px; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .clock { display: none; }
  .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .toolbar input, .toolbar select, .toolbar .search { min-width: 0; width: 100%; }
}

/* --- Impressão (página Relatório → PDF): sempre no Lunar, em fundo branco ----------- */
@media print {
  body {
    color-scheme: light;
    --bg-void: #fff; --bg-base: #fff; --bg-panel: #fff; --bg-panel-raised: #f4f5f7;
    --line: rgba(20, 30, 45, 0.18); --line-strong: rgba(20, 30, 45, 0.3);
    --accent: #d9601a; --accent-2: #ff8a3d; --accent-soft: rgba(217, 96, 26, 0.1); --accent-text: #a94a10;
    --text-primary: #141b23; --text-secondary: #3d4a58; --text-muted: #5a6575;
    --good: #1f9d63; --warning: #a8720a; --critical: #d63b46;
    background: #fff;
  }
  .sidebar, .topbar, .embedbar, .no-print, .toasts { display: none !important; }
  .view { padding: 0; max-width: none; }
  .card { break-inside: avoid; }
  th { position: static; }
  /* tabela larga: tudo visível e menor no papel */
  .table-wrap { overflow: visible; }
  table { font-size: 10px; }
  th, td { padding: 4px 6px; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
