/* ---- Admin dashboard: setup checklist, status pills, nested domain tabs -- */

.admin-callout {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--ta-warn-soft);
  border: 1px solid var(--ta-warn);
  border-radius: var(--ta-r);
  font-size: 0.92rem;
}

.admin-callout strong {
  color: var(--ta-warn);
}

/* Small status pill — used for env-derived "configured?" checks and the DNS
   table's per-record status, replacing ad hoc inline-styled spans. */
.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
}

.admin-pill::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.admin-pill-ok {
  color: var(--ta-ok);
  background: rgba(31, 157, 85, 0.12);
}

.admin-pill-err {
  color: var(--ta-err);
  background: rgba(214, 69, 69, 0.12);
}

.admin-pill-warn {
  color: var(--ta-warn);
  background: var(--ta-warn-soft);
}

/* Numbered setup procedure — each step is a card, not a bare <ol>. */
.admin-steps {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  counter-reset: admin-step;
  display: grid;
  gap: 1rem;
}

.admin-steps>li {
  counter-increment: admin-step;
  position: relative;
  padding: 1.1rem 1.25rem 1.25rem 3.4rem;
  background: var(--ta-surface);
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r-lg);
}

.admin-steps>li::before {
  content: counter(admin-step);
  position: absolute;
  left: 1.1rem;
  top: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--ta-accent-soft);
  color: var(--ta-accent);
  font-family: var(--ta-mono);
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-steps h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.admin-steps p {
  margin: 0 0 0.7rem;
  color: var(--ta-muted);
  font-size: 0.92rem;
}

.admin-steps p:last-child {
  margin-bottom: 0;
}

.admin-code {
  display: block;
  margin: 0 0 0.7rem;
  padding: 0.8rem 1rem;
  background: var(--ta-surface-2);
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r-sm);
  font-family: var(--ta-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ta-text);
  overflow-x: auto;
  white-space: pre;
}

.admin-code:last-child {
  margin-bottom: 0;
}

/* Nested per-domain tabs inside the DNS checklist tab: a smaller pill style
   so they read as a sub-level under the page's main tab bar rather than a
   second identical one. */
.tabs-sub {
  margin-bottom: 1rem;
}

.tabs-sub>.tabs-list {
  border-bottom: none;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tabs-sub>.tabs-list .tab-trigger {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--ta-border);
  border-radius: 999px;
  margin-bottom: 0;
  background: var(--ta-surface);
}

.tabs-sub>.tabs-list .tab-trigger:hover {
  background: var(--ta-surface-2);
}

.tabs-sub>.tabs-list .tab-trigger[aria-selected="true"] {
  background: var(--ta-accent-soft);
  border-color: var(--ta-accent);
  color: var(--ta-accent);
}

/* ---- Observability tab: Cloudflare-Web-Analytics-style stat cards, the
   status-code bar, the live badge, and the numeric-table styling ---- */

.obs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}

.obs-card {
  padding: 0.9rem 1rem;
  background: var(--ta-surface);
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r-lg);
}

.obs-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.obs-card-err .obs-card-value {
  color: var(--ta-err);
}

.obs-card-warn .obs-card-value {
  color: var(--ta-warn);
}

.obs-card-label {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ta-muted);
}

.obs-card-sub {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--ta-faint);
}

/* Proportional status-code mix — four segments, green/grey/amber/red. */
.obs-statusbar {
  display: flex;
  height: 0.6rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--ta-surface-2);
  border: 1px solid var(--ta-border);
  margin: 0.6rem 0 0.5rem;
}

.obs-statusbar>div {
  height: 100%;
  min-width: 0;
}

.obs-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0 0 1.5rem;
  font-size: 0.82rem;
  color: var(--ta-muted);
}

.obs-status-legend b {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.obs-num {
  font-variant-numeric: tabular-nums;
}

.obs-path {
  max-width: 26rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The intake-log row disclosure: the full request journey as a scrollable
   monospace block (inbound payload, each forward hop, the reply/error). */
.intake-detail {
  margin: 0.5rem 0 0.25rem;
  padding: 0.6rem 0.75rem;
  max-height: 22rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--ta-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.78rem;
  line-height: 1.5;
  background: var(--ta-bg-soft, rgba(127, 127, 127, 0.06));
  border: 1px solid var(--ta-border, rgba(127, 127, 127, 0.18));
  border-radius: var(--ta-radius, 8px);
}

.obs-path details summary {
  cursor: pointer;
  white-space: nowrap;
}

/* "Live" pulse next to the tab's heading. */
.obs-live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ta-ok);
}

.obs-live::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  animation: obs-pulse 1.6s ease-in-out infinite;
}

@keyframes obs-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

/* The view-wide "All traffic / User traffic" scope toggle above the stat
   cards — a segmented control. The choice is kept client-side (panel.dataset
   + the `scope` query param) and re-applied server-side on every fragment
   render, so the whole tab (cards, aggregates, request log) honours it. */
.obs-scope {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin: 0.75rem 0 0.25rem;
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r-md, var(--ta-r));
  background: color-mix(in oklab, var(--ta-surface-2) 45%, transparent);
}

.obs-scope-btn {
  padding: 0.35rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--ta-r-sm);
  background: transparent;
  color: var(--ta-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition: color 120ms ease-out, background 120ms ease-out, border-color 120ms ease-out;
}

.obs-scope-btn:hover {
  color: var(--ta-text);
}

.obs-scope-btn.on {
  background: var(--ta-accent);
  border-color: var(--ta-accent);
  color: #fff;
}

.obs-scope-note {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.82rem;
  color: var(--ta-faint);
}

/* Neutral status pill (3xx), complementing the ok/warn/err tones. */
.admin-pill-neutral {
  color: var(--ta-muted);
  background: var(--ta-surface-2);
}

/* Align the obs table headers/numbers with the tighter admin density. */
.obs-table th,
.obs-table td {
  padding: 0.5rem 0.75rem;
}

.obs-table td code {
  white-space: nowrap;
}

/* The filter bar over the single request-log table: a wrapping row of
   selects + search fields + clear, reusing forms.css's base control
   styling but tightened to the tab's density. */
.obs-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  margin: 0 0 0.75rem;
  border: 1px solid var(--ta-border);
  border-radius: var(--ta-r-lg);
  background: color-mix(in oklab, var(--ta-surface-2) 55%, transparent);
}

.obs-filters select,
.obs-filters input[type="search"] {
  width: auto;
  min-width: 8.5rem;
  flex: 0 1 auto;
  height: 2.25rem;
  font-size: 0.85rem;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.obs-filters input[type="search"] {
  flex: 1 1 11rem;
  max-width: 16rem;
}

.obs-filter-clear {
  flex: none;
  height: 2.25rem;
  padding: 0 0.8rem;
  border: 1px solid var(--ta-border-strong);
  border-radius: var(--ta-r-sm);
  background: var(--ta-surface);
  color: var(--ta-muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 120ms ease-out, border-color 120ms ease-out;
}

.obs-filter-clear:hover {
  color: var(--ta-text);
  border-color: var(--ta-accent);
}

.obs-filter-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ta-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.obs-empty {
  padding: 1rem 0.25rem;
  font-size: 0.9rem;
  color: var(--ta-faint);
}