:root {
  --brand: #4f46e5;
  --accent: #22c55e;
  --danger: #ef4444;
}

header nav {
  margin-top: 1rem;
}

nav ul li a.active {
  color: var(--brand);
  font-weight: 700;
}

.card-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: #e5e7eb;
  color: #111827;
  font-size: .75rem;
}
.badge.ok { background: #dcfce7; color: #14532d; }
.badge.err { background: #fee2e2; color: #7f1d1d; }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #111827;
  color: #fff;
  padding: .75rem 1rem;
  border-radius: .5rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9999;
}
.toast.show {
  opacity: 0.95;
  transform: translateY(0);
}

.table-wrap {
  overflow-x: auto;
}

kbd {
  background: #111827;
  color: #fff;
  padding: 0 .35rem;
  border-radius: .25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.input-inline {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

hr.sep {
  opacity: .25;
  margin: 1.25rem 0;
}

/* Charts */
.chart-card {
  height: 420px;
  position: relative;
}

.small {
  font-size: .9rem;
  opacity: .8;
}

/* Layout for hardware cards + details */
.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.node-card {
  cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease;
}
.node-card:hover {
  transform: translateY(-1px);
}
.node-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}
.node-card .muted {
  opacity: .7;
  font-size: .9rem;
}
.node-card .kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-top: .5rem;
}
.node-card .kpi .val {
  font-weight: 700;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.chip {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: .75rem;
}
.chip.alt {
  background: #ecfeff;
  color: #155e75;
}
.chip.warn {
  background: #fff7ed;
  color: #9a3412;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 1100px) {
  .grid-2 {
    grid-template-columns: 340px 1fr;
  }
}

/* Tables */
.table-compact th, .table-compact td {
  white-space: nowrap;
  vertical-align: middle;
}

/* Hardware details-only fixes to prevent chart overlap without affecting other pages */
#node-details .card-grid > * {
  min-width: 0;
}
@media (min-width: 900px) {
  #node-details .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
#node-details .chart-card {
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#node-details .chart-card > header {
  flex: 0 0 auto;
  margin-bottom: .5rem;
}
#node-details .chart-card canvas {
  flex: 1 1 auto;
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: auto;
}