.toolbar,
.actionbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.actionbar {
  position: sticky;
  top: 53px;
  z-index: 9;
  background: var(--panel2);
}

.toolbar .spacer,
.actionbar .spacer { flex: 1; }

.toolbar input { max-width: 240px; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.filters button.on {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 600;
}

#live { color: var(--bad); border-color: var(--bad); }
#live.on { color: var(--ok); border-color: var(--ok); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
}

.mcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s;
}

.mcard.online { border-left-color: var(--ok); }
.mcard.stale { border-left-color: var(--warn); }
.mcard.offline { border-left-color: #4b5468; opacity: 0.62; }
.mcard.alert { border-left-color: var(--bad); }
.mcard.sel { border-color: var(--accent); background: rgba(244, 121, 31, 0.09); }
.mcard.locked::after {
  content: "🔒";
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 14px;
}

.mcard .team {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mcard .team.none { color: var(--muted); font-weight: 400; font-style: italic; }
.mcard .mac { font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted); }

.mcard .metrics {
  display: flex;
  gap: 10px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}

.mcard .metrics b { color: var(--fg); font-weight: 600; }
.mcard .metrics .hot { color: var(--bad); }

.bar {
  height: 3px;
  background: var(--line);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.bar > i { display: block; height: 100%; background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.bad { background: var(--bad); }

.detail {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.detail > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  max-width: 620px;
  width: 100%;
  max-height: 82vh;
  overflow: auto;
}

.detail pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  overflow: auto;
  max-height: 40vh;
}

/* --- alertas (pendrive, celular) ------------------------------------------
   Precisa ser impossível de ignorar numa sala com dezenas de máquinas: fica
   colado no topo, pisca e só sai quando alguém dispensa. */
.alertbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bad);
  color: #fff;
  padding: 8px 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  animation: nb3pulse 1.6s ease-in-out infinite;
}
@keyframes nb3pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}
@media (prefers-reduced-motion: reduce) {
  .alertbar { animation: none; }
}
.alertbar .arow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  flex-wrap: wrap;
}
.alertbar .amac {
  font-family: ui-monospace, monospace;
  font-weight: 700;
}
.alertbar .awhat { font-weight: 700; }
.alertbar .awhen { opacity: 0.85; font-size: 12px; }
.alertbar button {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}
.alertbar button:hover { background: rgba(255, 255, 255, 0.3); }

.mcard.usb {
  border-left-color: var(--bad);
  box-shadow: 0 0 0 1px var(--bad) inset;
}
.mcard.usb::before {
  content: "🔌";
  position: absolute;
  top: 8px;
  right: 30px;
  font-size: 14px;
}

/* o botão que faz o warmup virar prova: destacado, mas não vermelho — vermelho
   é dos irreversíveis de máquina (reboot/poweroff) */
.actionbar button.precontest {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.actionbar button.precontest:hover:not(:disabled) {
  background: rgba(244, 121, 31, 0.15);
}

/* a confirmação de dedo pesado do pre-contest: digitar o número de máquinas
   (mesmo desenho do painel da frota) */
.confirma {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.confirma .cbox {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 20px;
  max-width: 460px;
}

.confirma input { width: 8ch; font-size: 18px; text-align: center; }

/* --- os gráficos do duplo clique ------------------------------------------ */
.gtempo { margin: 10px 0 4px; }
.gtempo svg { width: 100%; display: block; }
.gtick { font-size: 10px; fill: var(--muted); }
.gcab { display: flex; justify-content: space-between; font-size: 12px; }
.gleg span { margin-right: 10px; }
.gval b { margin-left: 8px; font-variant-numeric: tabular-nums; }
.gperiodo { display: flex; gap: 6px; margin: 8px 0; }
.gperiodo button.on { border-color: var(--accent); color: var(--accent); }

/* --- as visões do hotconfig --- */
.views { display: inline-flex; gap: 4px; margin-left: 14px; }
.views button { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 4px 10px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.views button.on { color: var(--fg); border-color: var(--accent); }
.pane { padding: 14px 18px; }
.pane h2 { margin: 6px 0 4px; }
.pane h3 { margin: 16px 0 6px; font-size: 14px; color: var(--muted); }
.twocol { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .twocol { grid-template-columns: 1fr; } }
.rostable td, .altable td { padding: 4px 8px; vertical-align: top; }
.altable tr.aberto td:first-child { border-left: 3px solid var(--bad); }
.logorow { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.logothumb { width: 32px; height: 32px; object-fit: contain; background: #fff; border-radius: 4px; }
.cmdprogress { margin: 0 18px 8px; padding: 6px 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.cmdrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cmdlist { flex-basis: 100%; margin-top: 4px; }
.cmdlist.hidden { display: none; }
.salagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.salacard { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; cursor: pointer; }
.salacard .salanome { font-size: 13px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
svg.mini { width: 100%; height: 56px; display: block; }
.salacard svg.mini { aspect-ratio: 200 / 56; height: auto; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--panel2); }
tr.clicavel td svg.mini { width: 120px; height: 28px; }
