/* ==========================================================================
   Monitor — painel
   ========================================================================== */
:root {
  --bg: #0a0e16;
  --bg-glow: #16233a;
  --panel: #111827;
  --panel-2: #0d131f;
  --panel-3: #0b1220;
  --line: #1f2937;
  --line-soft: rgba(31, 41, 55, .55);
  --text: #e6ebf5;
  --muted: #8b93a7;
  --blue: #60a5fa;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --tag-bg: #1c2638;
  --hover: rgba(96, 165, 250, .06);
  --input: #0b1220;
  --tab-active: #1b2436;
  --shadow: 0 12px 34px rgba(0, 0, 0, .28);
  --radius: 14px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-glow: #e3ebfb;
  --panel: #ffffff;
  --panel-2: #fbfcff;
  --panel-3: #f2f5fa;
  --line: #e2e8f0;
  --line-soft: rgba(226, 232, 240, .9);
  --text: #0f172a;
  --muted: #5b6478;
  --blue: #2563eb;
  --green: #059669;
  --red: #dc2626;
  --amber: #b45309;
  --violet: #7c3aed;
  --tag-bg: #eef2f9;
  --hover: rgba(37, 99, 235, .05);
  --input: #ffffff;
  --tab-active: #ffffff;
  --shadow: 0 10px 28px rgba(15, 23, 42, .07);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 18% -12%, var(--bg-glow) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--tag-bg); padding: 1px 6px; border-radius: 5px;
  font-size: 12px; font-family: Consolas, "Cascadia Mono", monospace;
}
h1 { font-size: 24px; margin: 2px 0 4px; letter-spacing: -.2px; }
h2 {
  font-size: 13px; margin: 0; letter-spacing: .8px; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
h3 { margin: 0 0 4px; font-size: 15px; }

.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico.big { width: 42px; height: 42px; stroke-width: 1.4; }

/* topo ------------------------------------------------------------------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-weight: 700; letter-spacing: .4px; color: var(--text);
  display: flex; gap: 9px; align-items: center; font-size: 15px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 12px var(--green);
}
.top nav { display: flex; gap: 6px; align-items: center; }
.nav-link {
  color: var(--muted); padding: 7px 11px; border-radius: 8px; font-size: 13.5px;
}
.nav-link:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.nav-link.active { color: var(--text); background: var(--hover); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 9px;
  color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: var(--line); background: var(--panel-2); }

html[data-theme="dark"] .ico-sun { display: none; }
html[data-theme="light"] .ico-moon { display: none; }
html:not([data-theme]) .ico-moon { display: none; }

main { max-width: 1220px; margin: 0 auto; padding: 24px 24px 70px; }

/* cabeçalho de página ----------------------------------------------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { margin-bottom: 2px; }
.head-actions { display: flex; align-items: center; gap: 12px; }

.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.live.err { color: var(--red); }
.live.err .live-dot { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }

/* cartões ---------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.card-head.wrap { flex-wrap: wrap; align-items: flex-start; }
.card-head .muted { font-size: 12px; }

/* KPIs ------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }

.stat {
  display: flex; align-items: center; gap: 14px;
  margin: 0; padding: 16px; text-align: left;
  font: inherit; color: var(--text); cursor: pointer;
  appearance: none;
  transition: transform .14s, border-color .14s;
}
.stat:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); }
.stat:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.stat-ico {
  display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; flex: none;
  border: 1px solid transparent;
}
.stat-ico .ico { width: 21px; height: 21px; }
.stat-ico.blue { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 26%, transparent); }
.stat-ico.green { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); border-color: color-mix(in srgb, var(--green) 26%, transparent); }
.stat-ico.red { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border-color: color-mix(in srgb, var(--red) 24%, transparent); }
.stat-ico.amber { background: color-mix(in srgb, var(--amber) 13%, transparent); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 26%, transparent); }
.stat-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); font-weight: 600;
}
.stat-body strong { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat-sub { font-size: 11.5px; color: var(--muted); }

/* alertas ---------------------------------------------------------------- */
.alerts {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.alert {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 10px; font-size: 12.5px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--muted); border-radius: 9px;
  text-decoration: none; max-width: 100%;
}
.alert:hover { text-decoration: none; background: var(--hover); }
.alert strong { font-weight: 600; }
.alert-text { color: var(--muted); }
.alert-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.alert.warn { border-left-color: var(--amber); }
.alert.warn .alert-dot { background: var(--amber); }
.alert.bad { border-left-color: var(--red); }
.alert.bad .alert-dot { background: var(--red); }
.alert.more { border-left-color: var(--line); color: var(--muted); }

/* tabela ----------------------------------------------------------------- */
.table-card { padding-bottom: 8px; }
.tabs, .seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px;
}
.tab, .seg button {
  appearance: none; border: 1px solid transparent; background: transparent;
  color: var(--muted); font: inherit; font-size: 13px;
  padding: 6px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, color .12s;
}
.tab:hover, .seg button:hover { color: var(--text); }
.tab.active, .seg button.active {
  background: var(--tab-active); color: var(--text);
  border-color: var(--line); box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}
.count {
  font-size: 11px; padding: 0 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted);
  min-width: 18px; text-align: center;
}
.tab.active .count { color: var(--text); background: color-mix(in srgb, var(--blue) 22%, transparent); }

.tools { display: flex; gap: 8px; align-items: center; }
.search { position: relative; }
.search .ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.search input {
  width: 250px; padding: 8px 12px 8px 32px;
  background: var(--input); border: 1px solid var(--line);
  border-radius: 9px; color: var(--text); font: inherit; font-size: 13px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: color-mix(in srgb, var(--blue) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent); }

.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
#hosts-table th, #hosts-table td { white-space: nowrap; }
.host-cell { white-space: normal; min-width: 220px; }
.metric-td { width: 150px; }
.metric-inline {
  display: inline-flex; align-items: center; gap: 10px;
  width: 100%; justify-content: flex-start;
}
.metric-pct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; min-width: 46px; }
.metric-inline.ok .metric-pct { color: var(--text); }
.metric-inline.warn .metric-pct { color: var(--amber); }
.metric-inline.bad .metric-pct { color: var(--red); }
.metric-bar {
  flex: 1 1 auto; height: 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  overflow: hidden; min-width: 70px;
}
.metric-bar-fill { display: block; height: 100%; border-radius: inherit; }
.metric-bar-fill.ok { background: var(--green); }
.metric-bar-fill.warn { background: var(--amber); }
.metric-bar-fill.bad { background: var(--red); }
th {
  text-align: left; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .7px; color: var(--muted); font-weight: 600;
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
th.num { text-align: right; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th .arrow { display: inline-block; width: 10px; opacity: .35; }
th .arrow::after { content: "↕"; }
th.asc .arrow, th.desc .arrow { opacity: .9; color: var(--blue); }
th.asc .arrow::after { content: "↑"; }
th.desc .arrow::after { content: "↓"; }

td {
  padding: 11px 10px; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tr.row { cursor: pointer; transition: background .12s; }
tr.row:hover { background: var(--hover); }
tr.row:focus { outline: none; }
tr.row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 6px; }

.host-cell { max-width: 320px; }
.host-name { display: block; font-weight: 600; letter-spacing: .1px; }
.host-meta {
  display: block; font-size: 11.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .2px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.status.on { color: var(--green); }
.status.on .status-dot { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent); animation: pulse 2.6s ease-in-out infinite; }
.status.off { color: var(--red); }
.status.off .status-dot { background: var(--red); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--green) 5%, transparent); }
}

.metric-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.metric-val { font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 600; }
.metric-val.ok { color: var(--text); }
.metric-val.warn { color: var(--amber); }
.metric-val.bad { color: var(--red); }

.bar {
  display: block; width: 64px; height: 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  overflow: hidden;
}
.bar.big { width: 100%; height: 6px; margin: 12px 0 10px; }
.bar-fill { display: block; height: 100%; border-radius: inherit; transition: width .35s ease; }
.bar-fill.ok { background: var(--green); }
.bar-fill.warn { background: var(--amber); }
.bar-fill.bad { background: var(--red); }
.bar-fill.blue { background: var(--blue); }
.bar-fill.neutral { background: color-mix(in srgb, var(--blue) 55%, transparent); }
.muted-bar .bar-fill.neutral { background: color-mix(in srgb, var(--muted) 35%, transparent); }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 46px 20px 38px; text-align: center; color: var(--muted);
}
.empty-state .ico.big { color: var(--muted); opacity: .6; margin-bottom: 4px; }
.empty-state h3 { color: var(--text); }
.empty-state p { margin: 0 0 8px; max-width: 380px; }

/* utilidades -------------------------------------------------------------- */
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.ok { color: var(--green); }
.bad { color: var(--red); }
.warn { color: var(--amber); }
.empty { color: var(--muted); }

/* botões ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; font: inherit; font-size: 13px; font-weight: 500;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  text-decoration: none; transition: border-color .12s, background .12s, transform .12s;
}
.btn:hover { border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: #1d4ed8; color: #fff; font-weight: 600;
}
.btn.primary:hover { background: linear-gradient(180deg, #60a5fa, #3b82f6); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn .ico { width: 15px; height: 15px; }
.btn.spin .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ghost {
  appearance: none; background: transparent; border: 1px solid transparent;
  color: var(--muted); font: inherit; font-size: 13px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.ghost:hover { color: var(--text); background: var(--hover); }

/* página da máquina ------------------------------------------------------- */
.head-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.back { font-size: 12px; color: var(--muted); }
.back:hover { color: var(--text); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head-card h1 { margin: 4px 0 2px; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: lowercase;
}
.pill.on { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 32%, transparent); }
.pill.off { background: color-mix(in srgb, var(--red) 11%, transparent); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 28%, transparent); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { margin: 0; padding: 16px; }
.kpi-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 600; }
.kpi-val { font-size: 21px; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi-val.ok { color: var(--text); }
.kpi-sub { font-size: 11.5px; color: var(--muted); }
.kpi-sub-top { display: block; margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--muted);
  background: var(--panel-3); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 999px;
}
.chip strong { color: var(--text); font-weight: 600; }

.chart-wrap { position: relative; height: 290px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 13px;
}

.grid2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }
.grid2 .card { margin-bottom: 18px; }

.specs {
  display: grid; grid-template-columns: minmax(130px, 190px) 1fr;
  gap: 0; margin: 0;
}
.specs dt {
  color: var(--muted); font-size: 12.5px; padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.specs dd {
  margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}
.specs dt:last-of-type, .specs dd:last-of-type { border-bottom: 0; }
.disk-list { list-style: none; margin: 0; padding: 0; }
.disk-list li { padding: 4px 0; border-bottom: 1px dashed var(--line-soft); }
.disk-list li:last-child { border-bottom: 0; }
.disk-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.disk-bar-row { display: grid; grid-template-columns: 150px 1fr 150px; gap: 10px; align-items: center; }
.disk-bar-label { font-size: 12.5px; }
.disk-bar-val { font-size: 12px; color: var(--muted); text-align: right; }
.bar.thin { height: 14px; border-radius: 6px; }
.disk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.disk-card { background: var(--card, #1f2937); border: 1px solid var(--line-soft, #374151); border-radius: 10px; padding: 12px; }
.disk-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.bar.thick { height: 18px; border-radius: 9px; }
.disk-card-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted, #9ca3af); margin-top: 6px; gap: 8px; flex-wrap: wrap; }
.value-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.value-row .mono { overflow: hidden; text-overflow: ellipsis; }

.copy {
  appearance: none; background: transparent; border: 1px dashed var(--line);
  color: var(--muted); font: inherit; font-size: 10.5px;
  padding: 2px 7px; border-radius: 6px; cursor: pointer; flex: none;
  opacity: 0; transition: opacity .12s, color .12s, border-color .12s;
}
.specs dd:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--blue); border-color: var(--blue); }
.copy.done { color: var(--green); border-color: var(--green); opacity: 1; }

/* eventos / timeline ------------------------------------------------------ */
.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.events li { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.event-msg { color: var(--text); }
.events time { margin-left: auto; white-space: nowrap; }
.tag {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .6px;
  padding: 2px 7px; border-radius: 5px;
  background: var(--tag-bg); color: var(--muted); font-weight: 600;
  flex: none;
}
.tag.enroll { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.tag.change { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
.tag.offline { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: flex; gap: 14px; position: relative; padding-bottom: 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:not(:last-child)::before {
  content: ""; position: absolute; left: 5px; top: 16px; bottom: 0;
  width: 1px; background: var(--line);
}
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%; flex: none; margin-top: 4px;
  background: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}
.tl-dot.change { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 14%, transparent); }
.tl-dot.enroll { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 14%, transparent); }
.tl-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tl-body .small { display: flex; align-items: center; gap: 7px; }

/* json -------------------------------------------------------------------- */
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details summary:hover { color: var(--text); }
details[open] summary { margin-bottom: 12px; }
.json-actions { display: flex; gap: 8px; margin-bottom: 12px; }
pre.json {
  max-height: 440px; overflow: auto;
  font-size: 11.5px; line-height: 1.55;
  background: var(--panel-3); color: var(--text);
  padding: 14px; border-radius: 10px; border: 1px solid var(--line);
}

/* login ------------------------------------------------------------------- */
.login-wrap { display: flex; justify-content: center; padding-top: 7vh; }
.login { width: 360px; padding: 28px; }
.login h1 { margin: 0 0 2px; }
.login .sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.login label { display: block; margin: 14px 0; font-size: 12.5px; color: var(--muted); }
.login input {
  display: block; width: 100%; margin-top: 7px; padding: 10px 12px;
  background: var(--input); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: inherit;
}
.login input:focus { outline: none; border-color: color-mix(in srgb, var(--blue) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent); }
.login button { width: 100%; margin-top: 8px; justify-content: center; }
.error {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red); padding: 9px 11px; border-radius: 9px; font-size: 13px;
}

/* rodapé ------------------------------------------------------------------ */
.foot {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px;
  padding: 18px 24px 40px; font-size: 12px; color: var(--muted);
}
.foot .sep { opacity: .4; }

/* scrollbar --------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------------- */
/* v3: densidade, paginação, filtros e auditoria                             */
/* ------------------------------------------------------------------------- */
.switch {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  user-select: none; font-size: 12px; color: var(--muted); white-space: nowrap;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; width: 34px; height: 20px; flex: none;
  border-radius: 999px; background: var(--panel-3);
  border: 1px solid var(--line);
  transition: background .15s, border-color .15s;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--muted);
  transition: transform .15s, background .15s;
}
.switch input:checked + .track {
  background: color-mix(in srgb, var(--green) 20%, transparent);
  border-color: color-mix(in srgb, var(--green) 45%, transparent);
}
.switch input:checked + .track .knob { transform: translateX(14px); background: var(--green); }
.switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch-text { font-weight: 600; letter-spacing: .2px; }
.switch input:checked ~ .switch-text { color: var(--text); }

.seg.density button { padding: 6px 8px; }
.seg.density .ico { width: 16px; height: 16px; }

.table-wrap {
  max-height: 66vh; overflow: auto;
  overscroll-behavior: contain;
}
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel);
}

.table-card.compact th { padding: 7px 10px; }
.table-card.compact td { padding: 7px 10px; }
.table-card.compact .host-name { font-size: 12.5px; }
.table-card.compact .host-meta { display: none; }
.table-card.compact .metric-cell { flex-direction: row; align-items: center; justify-content: flex-end; gap: 7px; }
.table-card.compact .bar { width: 46px; }

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; padding: 12px 2px 6px;
}
.range { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-size { display: inline-flex; align-items: center; gap: 6px; }
.page-size select {
  background: var(--input); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 4px 7px; font: inherit; font-size: 12px;
}
.page-size select:focus { outline: none; border-color: color-mix(in srgb, var(--blue) 55%, var(--line)); }

.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px;
  padding: 0 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-3);
  color: var(--muted); font: inherit; font-size: 12.5px; text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.pg:hover { color: var(--text); border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); text-decoration: none; }
.pg.active {
  background: color-mix(in srgb, var(--blue) 18%, transparent);
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  color: var(--text); font-weight: 700;
}
.pg.nav { font-size: 16px; line-height: 1; }
.pg:disabled, .pg.disabled { opacity: .35; pointer-events: none; }
.pg-gap { color: var(--muted); padding: 0 2px; }

/* filtros da auditoria ---------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.filter-field.grow { flex: 1 1 240px; }
.filter-field > span {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 600;
}
.filter-field select, .filter-field input {
  width: 100%; min-width: 0; padding: 8px 10px;
  background: var(--input); border: 1px solid var(--line);
  border-radius: 9px; color: var(--text); font: inherit; font-size: 13px;
}
.filter-field input::placeholder { color: var(--muted); }
.filter-field select:focus, .filter-field input:focus {
  outline: none; border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}
.filter-actions { display: flex; gap: 8px; align-items: center; }

.audit-counts { margin-top: 14px; }
.audit-counts .chip { text-decoration: none; }
.audit-counts .chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); }
.chip.active {
  color: var(--text);
  background: color-mix(in srgb, var(--blue) 14%, transparent);
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line));
}
.audit-table td { vertical-align: top; }
.audit-table .col-when { width: 132px; }
.audit-table .col-host { width: 170px; font-weight: 600; }
.audit-table .col-kind { width: 112px; }
.audit-table .when-rel { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.audit-table .when-abs { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.audit-table .msg { overflow-wrap: anywhere; }

/* responsivo -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .col-uptime, .col-seen { display: none; }
}

@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  main { padding: 18px 16px 50px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; max-height: none; }
  .table-wrap thead th { position: static; }
  .search input { width: 190px; }
  .head-card { flex-direction: column; }
  .badges { align-items: flex-start; }
  .head-actions { flex-wrap: wrap; }
  table { min-width: 760px; }
}

@media (max-width: 560px) {
  .top { padding: 10px 16px; }
  .page-head { align-items: flex-start; }
  .head-actions { width: 100%; justify-content: space-between; }
  .stats { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; }
  .card-head.wrap { flex-direction: column; align-items: stretch; }
  .tools, .search, .search input { width: 100%; }
  .tabs { width: 100%; overflow-x: auto; }
  .specs { grid-template-columns: 1fr; }
  .specs dt { border-bottom: 0; padding-bottom: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
  .specs dd { padding-top: 2px; }
  .copy { opacity: 1; }
  .chart-wrap { height: 230px; }
  .table-foot { flex-direction: column; align-items: stretch; }
  .pager { justify-content: center; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; justify-content: center; }
  .audit-table .col-when { width: 96px; }
  .audit-table .col-host { width: 120px; }
  .audit-table .col-kind { width: 92px; }
}

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