/* Compressor rail: one column per unit. Columns come from rail.js (--cols): a single row wired
   to the 3D when every unit fits, balanced rows otherwise (2 columns on phones). */
.rail { padding: 0 var(--gutter) calc(20px + env(safe-area-inset-bottom)); }
.rail__head { padding: 14px 0 10px; }
.rail__title { margin: 0; font: 600 18px/1.2 var(--font-cond); }
.rail__cols { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 12px var(--gap, 12px); }
.col {
  position: relative; display: grid; align-content: start; gap: 8px; width: 100%; min-height: 48px; padding: 12px 10px 14px;
  border: 0; border-top: 2px solid var(--tone); border-radius: 0 0 var(--radius) var(--radius);
  background: var(--card-tint); cursor: pointer; text-align: left; touch-action: manipulation;
}
.col:active { background: var(--surface-2); }
.col__terminal { position: absolute; left: 50%; top: -6px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--tone); display: none; }
.col__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px; }
.col__name { font: 700 22px/1 var(--font-cond); }
.col__big { font: 600 30px/1 var(--font-cond); letter-spacing: -0.01em; }
.col__big small { display: block; margin-top: 3px; font: 400 12px/1.2 var(--font); color: var(--ink-3); letter-spacing: 0; }
.col__meter { height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.col__meter span { display: block; height: 100%; width: var(--load, 0%); background: var(--tone); border-radius: 2px; transition: width 0.6s ease; }
.col__stats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; }
.col__stats div { display: flex; flex-direction: column-reverse; min-width: 0; }
.col__stats dt { font-size: 12px; color: var(--ink-3); }
.col__stats dd { margin: 0; font: 600 16px/1.2 var(--font-cond); font-variant-numeric: tabular-nums; white-space: nowrap; }
.col__stats dd small { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.col:hover .col__name, .col.is-hover .col__name, .col.is-selected .col__name { color: var(--select); }
.col:focus-visible { outline-offset: 4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.badge.state-alarm::before, .state-alarm .badge::before, .badge.state-estop::before, .state-estop .badge::before { border-radius: 1px; transform: rotate(45deg); }

@media (min-width: 720px) {
  .rail__cols { row-gap: 24px; }
  .col { padding: 12px 0 0; background: none; border-radius: 0; }
  .col__name { font-size: 24px; }
  .col__big { font-size: 34px; }
  .col__stats { gap: 4px 18px; }
  /* Single row: the rail head gives way to the band where the wires run. */
  .rail.is-single-row { padding-top: 56px; }
  .rail.is-single-row .rail__head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rail.is-single-row .col__terminal { display: block; }
}
@media (min-width: 960px) { .rail { padding-left: 32px; padding-right: 32px; padding-bottom: 22px; } }
@media (prefers-reduced-motion: reduce) { .col__meter span { transition: none; } }

/* Offline unit: muted column, dashed top rule, values shown as dashes. */
.col.is-offline { border-top-style: dashed; color: var(--ink-2); }
.col.is-offline .col__big, .col.is-offline .col__stats dd { color: var(--ink-3); }
.badge.state-offline::before, .col.is-offline .badge::before { background: none; box-shadow: inset 0 0 0 1.5px var(--st-offline); }
.col__stats .is-empty dd small { display: none; }
.col__seen { font-size: 12px; color: var(--ink-3); }
.col__seen.is-stale { color: var(--st-unloaded); }

/* Controller alarm on the unit card: severity chip and the exact LCD text. */
.col__alarm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.col__alarm[hidden] { display: none; }
.col__alarm .alarm-chip { min-width: 0; padding: 3px 7px; font-size: 12px; }
.col__alarm-text { font: 600 14px/1.2 var(--font-cond); color: var(--ink); overflow-wrap: anywhere; }
