/* ============================================================================
   Connection-detail page — view-specific styling (Phase 5).
   Shared tokens and chrome live in theme.css.
   ========================================================================= */

/* ── PLC identity header ─────────────────────────────────────────────────── */
.plc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
}
.plc-title { font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.plc-sub {
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.plc-head-state .chip { font-size: 0.78rem; padding: 0.25rem 0.65rem; }

.notice {
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  color: #b56a00;
  background: var(--warn-bg);
  border-color: #efd6a6;
}

/* ── Grouped counter cards ───────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}
.metric-card .panel-head { margin: 0; }

.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.32rem 0.9rem;
  font-size: 0.85rem;
}
.kv:nth-child(even) { background: #fbfbf9; }
.kv .k { color: var(--ink-soft); }
.kv .v { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.kv .v.warn { color: var(--warn); }
.kv .v.bad  { color: var(--bad); }
.kv .v.ok   { color: var(--ok); }

/* client list inside the Clients card */
.client-line {
  padding: 0.3rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--rule);
}
.client-line .pdu { color: var(--ink-faint); }

/* ── Debug view ──────────────────────────────────────────────────────────── */
.debug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.capture-state {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
}
.capture-state[data-armed="true"]  { color: var(--ok);  background: var(--ok-bg); }
.capture-state[data-armed="false"] { color: var(--ink-soft); background: var(--idle-bg); }

.table-wrap { overflow-x: auto; }

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

.debug-table .raw  { color: var(--accent-deep); }
.debug-table .dec  { font-weight: 600; }
.debug-table tr.stale td { color: var(--ink-faint); }
.debug-table tr.no-traffic td { color: var(--ink-faint); font-style: italic; }

.dir-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}
.dir-read  { color: var(--accent-deep); background: #e7ecfb; }
.dir-write { color: #8a5a00; background: var(--warn-bg); }

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