/* ---- Panels -------------------------------------------------------------- */

.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--text-low);
  font-weight: 500;
}

.panel-body { padding: var(--sp-3); }
.panel-body.flush { padding: 0; }

/* ---- Navigation rail ----------------------------------------------------- */

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--text-mid);
  font-size: var(--fs-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-hi); }

.nav-item[aria-current="page"] {
  background: var(--bg-2);
  border-left-color: var(--accent);
  color: var(--text-hi);
}

.nav-badge {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--neg);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.nav-badge.quiet { background: var(--bg-3); color: var(--text-mid); }

/* ---- Top bar ------------------------------------------------------------- */

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: 0 var(--sp-4);
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.topstat { display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.topstat .label { font-size: 10px; text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--text-low); }
.topstat .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-data);
  color: var(--text-hi);
}

.pc-dots { display: inline-flex; gap: 3px; align-items: center; }
.pc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bg-3); border: 1px solid var(--line-strong); }
.pc-dot.on { background: var(--accent); border-color: var(--accent); }

/* ---- News ticker --------------------------------------------------------- */

.ticker {
  grid-area: ticker;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  font-size: var(--fs-small);
  color: var(--text-mid);
}

.ticker-label {
  font-size: 10px;
  letter-spacing: var(--ls-caps);
  color: var(--text-low);
  padding-right: var(--sp-2);
  border-right: 1px solid var(--line);
  flex: none;
}

.ticker-items { display: flex; gap: var(--sp-4); white-space: nowrap; overflow: hidden; }
.ticker-item { display: inline-flex; align-items: center; gap: 6px; }
.ticker-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-low); flex: none; }
.ticker-item.good .dot { background: var(--pos); }
.ticker-item.bad .dot { background: var(--neg); }
.ticker-item.warn .dot { background: var(--warn); }

/* ---- KPI tiles ----------------------------------------------------------- */

.tile {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  cursor: pointer;
  text-align: left;
  min-width: 0;
  transition: border-color 150ms ease-out, background 150ms ease-out;
}

.tile:hover { border-color: var(--line-strong); background: var(--bg-3); }

.tile-label {
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--text-low);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-kpi);
  line-height: 1.1;
  color: var(--text-hi);
}

.tile-value .unit { font-size: 14px; color: var(--text-mid); margin-left: 2px; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }

/* Deltas always carry a glyph as well as a colour, so they survive being
   printed, screenshotted or read by someone who does not see red and green. */
.delta {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.delta.up::before { content: "▲"; }
.delta.down::before { content: "▼"; }
.delta.flat::before { content: "="; }
.delta.alert::after { content: "⚠"; color: var(--warn); }

/* ---- Bars and meters ----------------------------------------------------- */

.meter { position: relative; height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; transition: width 150ms ease-out; }
.meter-fill.pos { background: var(--pos); }
.meter-fill.neg { background: var(--neg); }
.meter-fill.warn { background: var(--warn); }
.meter-mark { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--line-strong); }

.bar-row { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: var(--sp-3); }
.bar-row .name { font-size: var(--fs-small); color: var(--text-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { font-family: var(--font-mono); font-size: var(--fs-small); text-align: right; }

/* ---- Tables -------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--text-low);
  font-weight: 500;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  position: sticky;
  top: 0;
}
.table td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-2); }
.table .num { text-align: right; }

/* ---- Chips and buttons --------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: var(--bg-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mid);
  white-space: nowrap;
}
.chip.pos { border-color: var(--pos); color: var(--pos); background: var(--pos-dim); }
.chip.neg { border-color: var(--neg); color: var(--neg); background: var(--neg-dim); }
.chip.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-dim); }
.chip.accent { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 7px 14px;
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-hi);
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent-dim); border-color: var(--accent); color: var(--text-hi); }
.btn.primary:hover:not(:disabled) { background: #24486f; }
.btn.ghost { background: none; border-color: transparent; color: var(--text-mid); }
.btn.ghost:hover:not(:disabled) { color: var(--text-hi); background: var(--bg-2); }
.btn.danger { border-color: var(--neg); color: var(--neg); }
.btn.sm { padding: 3px 8px; font-size: var(--fs-caption); }

.btn-turn {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  padding: 9px 18px;
}

/* ---- Empty state --------------------------------------------------------- */

.empty {
  padding: var(--sp-5);
  text-align: center;
  color: var(--text-low);
  font-size: var(--fs-small);
}
