:root {
  --bg: #0a0c10;
  --panel: #111419;
  --panel-2: #171b22;
  --border: #232833;
  --hair: #1c212a;
  --text: #e8ebf1;
  --muted: #8b93a3;
  --accent: #7cbcff;
  --accent-dim: rgba(124, 188, 255, 0.14);
  --success: #3ecf8e;
  --failed: #ff6b6b;
  --warning: #ffb454;
  --info: #6fb1ff;
  --idle: #a0a7b4;
  --offline: #4a5160;
  --radius: 10px;
  --topbar: 56px;
  --control: 32px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --disp: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --panel-2: #f3f4f7;
    --border: #e2e5eb;
    --hair: #eceef2;
    --text: #12151c;
    --muted: #5a6372;
    --accent-dim: rgba(37, 99, 235, 0.1);
    --offline: #b3bac6;
    --shadow: 0 12px 32px rgba(22, 25, 31, 0.12);
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  overflow: hidden;
}

.sprites {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  display: block;
}
.icon.muted { color: var(--muted); }
.icon.chevron { width: 14px; height: 14px; color: var(--muted); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 40;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
}
.skip:focus { left: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  z-index: 8;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--accent-dim);
  color: var(--accent);
}
.brand-text { display: flex; flex-direction: column; }
.brand h1 { font-family: var(--disp); font-size: 14px; font-weight: 600; margin: 0; letter-spacing: -0.02em; }
.brand-sub { margin: 0; font-size: 11px; color: var(--muted); }

.search {
  position: relative;
  flex: 1;
  max-width: 440px;
  min-width: 0;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: var(--control);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 36px 0 32px;
  font: inherit;
  font-size: 13px;
}
.search input::placeholder { color: var(--muted); }
.search input:hover,
.search input:focus { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font: 11px/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 5px;
  pointer-events: none;
}

.topbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: var(--control);
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
  font: 600 12px/1 var(--sans);
  text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--panel-2); }
.nav-link.is-current { color: var(--text); }

.live-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: var(--control);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 11px 0 10px;
  font: 600 12px/1 var(--sans);
  cursor: pointer;
}
.live-btn:hover { border-color: var(--accent); }
.live-pip {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--offline);
}
.live-btn:not(.is-paused):not(.is-down) .live-pip {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s ease-in-out infinite;
}
.live-btn.is-paused .live-pip { background: var(--warning); }
.live-btn.is-down .live-pip { background: var(--failed); }

/* ------------------------------------------------------------------ layout */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 10px;
}
.panel-head h2 {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}
.count-pill {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control);
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: 600 13px/1 var(--sans);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn-sm { height: 28px; padding: 0 8px; font-size: 12px; }
a.btn { text-decoration: none; }
.btn-primary {
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}
.btn-primary:hover { border-color: var(--accent); color: var(--accent); }
.btn-lg {
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
}
.btn-danger:hover { border-color: var(--failed); color: var(--failed); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control);
  height: var(--control);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--border); }

/* ------------------------------------------------------------------ agents */

.agents-panel {
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.agent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.agent-row {
  display: grid;
  grid-template-columns: 8px auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 1px;
  align-items: center;
  width: 100%;
  margin: 0 0 2px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.agent-row:hover { background: var(--panel-2); }
.agent-row.is-selected {
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.agent-name {
  grid-column: 2 / -1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  font-size: 13px;
}
.agent-state {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  font-size: 11px;
  color: var(--muted);
}
.agent-seen {
  grid-column: 3;
  grid-row: 2;
  justify-self: start;
  font-size: 11px;
  color: var(--muted);
}
.agent-seen::before { content: "· "; }

.dot {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--offline);
}
.dot.working { background: var(--success); box-shadow: 0 0 8px rgba(62, 207, 142, 0.55); animation: pulse 2s ease-in-out infinite; }
.dot.waiting { background: var(--warning); }
.dot.idle { background: var(--idle); }
.dot.offline { background: transparent; border: 1.5px solid var(--offline); }

.hint { color: var(--muted); font-size: 11px; margin: 10px 4px 0; line-height: 1.4; }
.agents-panel .hint {
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
}
.agents-toggle { display: none; margin-left: auto; }

/* ------------------------------------------------------------------ toolbar */

.feed-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  overflow: hidden;
}

.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 55%, var(--bg));
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

/* The status filter reads as one control, so its options can be compared. */
.segment {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: color-mix(in srgb, var(--panel-2) 70%, var(--bg));
}
.seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font: 600 12px/1 var(--sans);
  cursor: pointer;
}
.seg:hover { color: var(--text); }
.seg.is-on { background: var(--accent-dim); color: var(--text); }
.seg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.seg-dot.success { background: var(--success); }
.seg-dot.failed { background: var(--failed); }
.seg-dot.warning { background: var(--warning); }
.seg-dot.info { background: var(--info); }

/* A picker shows its value, so the active filters are readable at a glance. */
.picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
}
.picker:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.picker:focus-within { border-color: var(--accent); }
.picker-label { font-size: 12px; color: var(--muted); }
.picker select {
  appearance: none;
  max-width: 168px;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 12px/1 var(--sans);
  cursor: pointer;
  outline: none;
}
.picker-caret {
  position: absolute;
  right: 8px;
  width: 12px;
  height: 12px;
  color: var(--muted);
  pointer-events: none;
}
/* A picker holding a non-default value carries the accent. */
.picker.is-set {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-dim);
}
.picker.is-set select { color: var(--accent); }

.toolbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding-bottom: 0;
}

.feed-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.menu { position: relative; }
.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: 260px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.menu-pop[hidden] { display: none; }
.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--panel-2); }
.menu-item .icon { margin-top: 2px; color: var(--muted); }
.menu-item strong { display: block; font-size: 13px; font-weight: 650; font-style: normal; }
.menu-item em {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  font-style: normal;
  color: var(--muted);
}

.pending-bar {
  flex: none;
  display: flex;
  justify-content: center;
  padding: 8px 14px 0;
}
.pending-bar[hidden] { display: none; }
.pending-btn {
  background: var(--accent);
  color: #0c0e12;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font: 650 12px/1.3 var(--sans);
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ feed */

.feed-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 8px 24px;
}

.feed { list-style: none; margin: 0; padding: 0; }

.feed-day {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  padding: 12px 10px 6px;
}
.feed-day-label {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.feed-item {
  margin: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.feed-item:hover { background: color-mix(in srgb, var(--panel) 60%, transparent); }
.feed-item:last-child { border-bottom: none; }

.feed-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 14px;
  column-gap: 12px;
  align-items: start;
  width: 100%;
  margin: 0;
  padding: 11px 10px;
  border: 0;
  /* The spine carries status, so a failed row is findable while scrolling. */
  border-left: 2px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.feed-row:hover { background: var(--panel); }
.feed-row:hover .row-chevron { opacity: 1; }
.feed-item.failed .feed-row { border-left-color: var(--failed); }
.feed-item.warning .feed-row { border-left-color: var(--warning); }
.feed-item.info .feed-row { border-left-color: var(--info); }
.feed-row.is-new { animation: row-in 0.9s ease-out; }
.row-chevron {
  color: var(--muted);
  opacity: 0;
  margin-top: 4px;
  transition: opacity 0.12s ease;
}

.f-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 2px;
}
.f-body { min-width: 0; }
.f-text {
  display: block;
  font-size: 14px;
  letter-spacing: -0.01em;
  line-height: 1.45;
}
.f-text.failed { color: var(--failed); }
.f-text.warning { color: var(--warning); }
.f-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.f-agent { font-weight: 600; font-size: 12px; color: color-mix(in srgb, var(--text) 72%, var(--muted)); }

.badge {
  flex: none;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.failed { color: var(--failed); border-color: color-mix(in srgb, var(--failed) 55%, var(--border)); }
.badge.warning { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 55%, var(--border)); }
.badge.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 55%, var(--border)); }

.id-chip {
  flex: none;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 64px 16px;
  text-align: center;
  color: var(--muted);
}
.empty-state.compact { padding: 28px 8px; }
.empty-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--panel-2);
  color: var(--offline);
}
.empty-icon { width: 24px; height: 24px; }
.empty-title {
  margin: 0;
  font-family: var(--disp);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}
.empty-copy { max-width: 46ch; line-height: 1.6; }
.empty-cta { display: none; gap: 10px; margin-top: 14px; }
.empty-cmd { display: none; }
.empty-state.is-first-run .empty-cta { display: flex; }
.empty-state.is-first-run .empty-cmd { display: block; }
.empty-cta .btn { height: 34px; padding: 0 14px; }
.empty-cmd {
  margin-top: 14px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  font: 12px/1.4 var(--mono);
  color: var(--muted);
}
.empty-state.compact .empty-mark { width: 40px; height: 40px; border-radius: 12px; }
.empty-state.compact .empty-title { font-size: 14px; }
.empty-copy { margin: 0; font-size: 13px; }
.empty-state[hidden] { display: none; }

/* ------------------------------------------------------------------ drawer */

/* Still a <dialog>: Esc, focus handling and the backdrop come for free. The
   feed stays legible beside it instead of behind a centred card. */
.detail-card {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(416px, 100%);
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  overflow: auto;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.45);
  animation: drawer-in 0.18s ease-out;
}
.detail-card::backdrop { background: rgba(6, 8, 11, 0.45); }
.detail-close {
  position: sticky;
  top: 0;
  float: right;
  margin: 10px 10px 0 0;
}
.d-action {
  font-family: var(--disp);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin: 0 44px 16px 0;
  padding: 20px 16px 0;
}
.d-grid {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 0 14px;
  margin: 0;
  padding: 0 16px;
}
.d-grid dt {
  padding: 10px 0;
  border-top: 1px solid var(--hair);
  color: var(--muted);
  font-size: 12px;
}
.d-grid dd {
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.d-meta-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 8px;
  padding: 0 16px;
}
.d-meta-title {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted); margin: 0;
}
.d-metadata {
  margin: 0 16px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.d-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 18px 16px 22px; }
.d-actions .btn[hidden] { display: none; }

/* ------------------------------------------------------------------ tabbar */

.tabbar { display: none; }
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 60px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 11px/1 var(--sans);
  cursor: pointer;
}
.tab .icon { width: 19px; height: 19px; }
.tab.is-current { color: var(--accent); }

/* ------------------------------------------------------------------ motion */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes row-in {
  from { background: var(--accent-dim); }
  to { background: transparent; }
}
@keyframes drawer-in {
  from { transform: translateX(16px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .dot.working,
  .live-btn:not(.is-paused):not(.is-down) .live-pip { animation: none; }
  .feed-row.is-new { animation: none; }
  .detail-card { animation: none; }
  .row-chevron { transition: none; }
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 10px; }
  .search { max-width: none; order: 3; flex: 1 1 100%; }
  .search-kbd { display: none; }
  .brand-sub { display: none; }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .agents-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .agents-panel:not(.is-open) { padding-bottom: 10px; }
  .agents-toggle { display: inline-flex; }
  .agents-panel.is-open .agents-toggle { transform: rotate(180deg); }
  .agents-panel:not(.is-open) .agent-list,
  .agents-panel:not(.is-open) .hint,
  .agents-panel:not(.is-open) #agent-empty { display: none; }

  .toolbar { flex-wrap: wrap; align-items: start; padding: 10px 12px; }
  .toolbar-end { width: 100%; justify-content: space-between; }
  .filters { width: 100%; }
  /* The segment scrolls rather than wrapping into two rows of chips. */
  .segment { max-width: 100%; overflow-x: auto; }
  .seg { flex: none; }
  .picker select { max-width: 120px; }

  .detail-card { width: 100%; border-left: 0; }
  .empty-cta { flex-direction: column; align-self: stretch; }
  .empty-cta .btn { width: 100%; }
  .empty-cmd { max-width: 100%; overflow-x: auto; }
}

/* Below the tab bar breakpoint the sections are switched, not stacked. */
@media (max-width: 620px) {
  body:not(.page-admin):not(.page-marketing) { padding-bottom: 60px; }
  .tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--border);
    background: var(--panel);
  }
  .agents-toggle { display: none; }
  .agents-panel:not(.is-open) { display: none; }

  /* One scrolling row of filters, and Export moves to the tab bar. */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; }
  .filters { flex-wrap: nowrap; width: auto; }
  .segment, .picker, .seg, .toolbar-end, .feed-count { flex: none; }
  .toolbar-end { width: auto; }
  #export-btn { display: none; }
  .agents-panel.is-open {
    border-bottom: 0;
    max-height: none;
  }
  .agents-panel.is-open ~ .feed-panel { display: none; }
  .topbar .nav-link { display: none; }
  .menu-pop { position: fixed; right: 12px; left: 12px; bottom: 72px; top: auto; width: auto; }
}

/* ------------------------------------------------------------------ admin */

body.page-admin {
  overflow: auto;
  height: auto;
  min-height: 100%;
}

a.brand {
  color: inherit;
  text-decoration: none;
}

.admin-shell {
  width: min(880px, calc(100% - 32px));
  margin: 24px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px 16px;
}

.admin-lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  max-width: 62ch;
}
.admin-lead code,
.hint code {
  font-family: var(--mono);
  font-size: 12px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.admin-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.admin-form .optional { font-weight: 400; }
.admin-form input {
  height: var(--control);
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font: 400 13px/1 var(--sans);
}
.admin-form input:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.admin-error {
  margin: 0;
  color: var(--failed);
  font-size: 13px;
}
.admin-warn {
  margin: 0 0 10px;
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
}

.issued-card { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.issued-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.issued-row input {
  flex: 1;
  min-width: 0;
  height: var(--control);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font: 13px/1 var(--mono);
}

.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 8px 10px 8px 0;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr.is-revoked td { color: var(--muted); }
.admin-table .mono { font-family: var(--mono); font-size: 12px; }
.admin-table .muted { color: var(--muted); font-size: 12px; }
.admin-table .cell-name { font-weight: 600; }
.admin-table .cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding-right: 0;
}

@media (max-width: 820px) {
  .admin-form-row { grid-template-columns: 1fr; }
  .admin-form-row .btn { width: 100%; }
}
