/* Panels, tables, status vocabulary, progress, skeletons. */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--hairline);
}
.panel-head h2 { font-size: var(--t-14); }
.panel-body { padding: var(--s-5); }
.panel-body-flush { padding: 0; }
.panel-foot {
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--hairline);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ---- Status vocabulary ------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--s-2);
  border-radius: var(--r-full);
  background: var(--neutral-soft);
  color: var(--ink-2);
  font-size: var(--t-11);
  font-weight: var(--w-medium);
  white-space: nowrap;
}
.badge-ok   { background: var(--ok-soft);   color: var(--ok-ink); }
.badge-warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge-bad  { background: var(--bad-soft);  color: var(--bad-ink); }
.badge-info { background: var(--accent-soft); color: var(--accent-ink); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); flex: none; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-bad { background: var(--bad); }
.dot-live { background: var(--ok); animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--ok) 55%, transparent); }
  60% { box-shadow: 0 0 0 6px transparent; }
}

/* ---- Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--t-13); }
.table thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-base);
  padding: var(--s-2) var(--s-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-3);
  font-size: var(--t-11);
  font-weight: var(--w-semibold);
  text-align: left;
  white-space: nowrap;
}
.table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--d-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr[aria-selected="true"] { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .shrink { width: 1%; white-space: nowrap; }
.row-link { cursor: pointer; }
.table tbody tr.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- Progress --------------------------------------------------------- */
.bar {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}
/* Fill scales instead of resizing: this updates on every SSE tick during a
   live campaign, so it stays on the compositor. JS sets --p (0..1). */
.bar-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
  transition: transform var(--d-slow) var(--ease);
}
.bar-fill.is-ok { background: var(--ok); }
.bar-fill.is-warn { background: var(--warn); }
.bar-fill.is-bad { background: var(--bad); }
.bar-lg { height: 10px; }
/* Segments must sum to the track width, so they size rather than scale.
   No transition: the animated bar above carries the motion, this one is a
   static breakdown and a tweening 3-way split reads as noise. */
.bar-split { display: flex; height: 10px; border-radius: var(--r-full); overflow: hidden; background: var(--surface-3); }

.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.ring .track { stroke: var(--surface-3); }
.ring .value { transition: stroke-dashoffset var(--d-slow) var(--ease); }

/* ---- Skeletons -------------------------------------------------------- */
.skel {
  border-radius: var(--r-sm);
  background: linear-gradient(
    90deg,
    var(--surface-3) 0%,
    color-mix(in oklch, var(--surface-3) 55%, var(--surface)) 50%,
    var(--surface-3) 100%
  );
  background-size: 420px 100%;
  animation: shimmer 1.35s linear infinite;
  height: 12px;
}
.skel-row { height: 44px; border-radius: var(--r-md); }
.skel-stack { display: flex; flex-direction: column; gap: var(--s-3); }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; background: var(--surface-3); } }

/* ---- Empty / error states --------------------------------------------- */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-12) var(--s-6);
  text-align: center;
}
.empty-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--r-xl);
  background: var(--surface-3);
  color: var(--ink-3);
  margin-bottom: var(--s-1);
}
.empty h3 { font-size: var(--t-15); }
.empty p { color: var(--ink-3); max-width: 46ch; font-size: var(--t-13); }
.empty .row { margin-top: var(--s-2); }

.callout {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  font-size: var(--t-13);
}
.callout svg { flex: none; margin-top: 1px; color: var(--ink-3); }
.callout-bad { background: var(--bad-soft); border-color: color-mix(in oklch, var(--bad) 30%, transparent); }
.callout-bad, .callout-bad svg { color: var(--bad-ink); }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 30%, transparent); }
.callout-warn, .callout-warn svg { color: var(--warn-ink); }
.callout-ok { background: var(--ok-soft); border-color: color-mix(in oklch, var(--ok) 30%, transparent); }
.callout-ok, .callout-ok svg { color: var(--ok-ink); }
.callout strong { font-weight: var(--w-semibold); }

/* ---- Code / DNS record blocks ----------------------------------------- */
.code {
  position: relative;
  padding: var(--s-3) var(--s-10) var(--s-3) var(--s-4);
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: var(--t-12);
  line-height: 1.65;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.code .copy { position: absolute; top: 6px; right: 6px; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: var(--s-2) var(--s-4); font-size: var(--t-13); }
.kv dt { color: var(--ink-3); }
.kv dd { color: var(--ink); word-break: break-word; }

/* ---- Micro bar chart --------------------------------------------------- */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 40px; }
.spark span {
  flex: 1 1 0;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent-soft-hover);
  transition: background var(--d-fast) var(--ease);
}
.spark span[data-hot="1"] { background: var(--accent); }
.spark:hover span { background: var(--accent-soft-hover); }
