/* ============================================================================
   Fleet dashboard — view-specific styling (Phase 4).
   Shared tokens and chrome live in theme.css.
   ========================================================================= */

/* ── Aggregate strip ─────────────────────────────────────────────────────── */
.agg-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
@media (max-width: 1100px) {
  .agg-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .agg-grid { grid-template-columns: repeat(2, 1fr); }
}

.agg-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
}
.agg-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
}
.agg-value {
  margin-top: 0.25rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.agg-sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-faint);
}
/* highlight the problem cards when non-zero */
.agg-card.alert { border-color: #eec3c3; background: var(--bad-bg); }
.agg-card.alert .agg-value { color: var(--bad); }
.agg-card.caution { border-color: #efd6a6; background: var(--warn-bg); }
.agg-card.caution .agg-value { color: #b56a00; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.toolbar .spacer { flex: 1; }
.tb-search { max-width: 280px; }
.tb-state  { max-width: 150px; }
.tb-check {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap;
  user-select: none;
}
.tb-count { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); }

/* ── KPI table ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.kpi-table th,
.kpi-table td {
  padding: 0.45rem 0.8rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
.kpi-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  background: #fbfbf9;
  position: sticky;
  top: 0;
}
.kpi-table th.num,
.kpi-table td.num { text-align: right; font-family: var(--mono); }

.kpi-table th.sortable { cursor: pointer; user-select: none; }
.kpi-table th.sortable:hover { color: var(--ink); }
.kpi-table th.sorted-asc::after  { content: ' \2191'; color: var(--accent); }
.kpi-table th.sorted-desc::after { content: ' \2193'; color: var(--accent); }

.kpi-table tbody tr { cursor: pointer; transition: background 0.08s; }
.kpi-table tbody tr:hover { background: #f3f6fd; }
.kpi-table tbody tr:last-child td { border-bottom: none; }

.kpi-table .plc-name { font-weight: 600; }
.kpi-table .plc-host { color: var(--ink-soft); font-family: var(--mono); font-size: 0.8rem; }

.empty-row {
  text-align: center !important;
  color: var(--ink-faint);
  padding: 1.6rem !important;
  font-style: italic;
}

/* faint divider between value and unit in ratio cells */
.ratio-sub { color: var(--ink-faint); font-size: 0.76rem; }
