/* ═══════════════════════════════════════════════════════════════
   nd-bot Dashboard: v2 Design System
   ═══════════════════════════════════════════════════════════════ */

/* ── Design tokens ── */
:root {
  /* Backgrounds */
  --bg: #07080e;
  --bg-surface: #0b0d16;
  --bg-elevated: #0f1120;
  --bg-card: #131628;
  --bg-input: #0c0e1a;
  --bg-hover: rgba(255, 255, 255, 0.035);

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --border-focus: rgba(99, 102, 241, 0.55);

  /* Text */
  --text: #e8eaf6;
  --text-secondary: #8892b0;
  --text-tertiary: #55607f;
  --text-muted: #3a4460;

  /* Accent: Indigo */
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-muted: #6366f1;
  --accent-dim: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --accent-20: rgba(129, 140, 248, 0.2);

  /* Status */
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.08);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.08);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);

  /* Shape */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* Typography */
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, monospace;

  /* Layout */
  --topnav-h: 52px;
  --sidebar-w: 200px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.65);

  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 40% at 60% -10%, rgba(99, 102, 241, 0.1), transparent 60%),
    radial-gradient(ellipse 50% 30% at 10% 80%, rgba(139, 92, 246, 0.06), transparent 55%);
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.13em 0.38em;
  border-radius: 5px;
  color: var(--accent-hover);
  border: 1px solid var(--border);
  font-weight: 500;
}

/* ════════════════════════════════════════
   TOPNAV
   ════════════════════════════════════════ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topnav-h);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.3),
    var(--shadow-sm);
}

/* Brand */
.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  flex-shrink: 0;
}
.brand-logo {
  display: block;
  height: 26px;
  width: auto;
  max-width: 100px;
  object-fit: contain;
  object-position: left center;
  opacity: 0.92;
  filter: brightness(1.1);
}
.brand-divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  flex-shrink: 0;
}
.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #c7d2fe 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

/* Page nav links */
.topnav-pages {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.navlink {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition:
    background 0.12s,
    color 0.12s;
  white-space: nowrap;
}
.navlink:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.navlink--active,
.navlink.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}

/* Search */
.topnav-search {
  flex: 1;
  min-width: 120px;
  max-width: 340px;
  margin: 0 12px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-tertiary);
  pointer-events: none;
  flex-shrink: 0;
}
.input-search {
  width: 100%;
  padding: 6px 10px 6px 30px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.input-search::placeholder {
  color: var(--text-tertiary);
}
.input-search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Health pills */
.topnav-health {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}
.ws-dot {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.3s;
  padding: 0 2px;
}
.health-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.health-pill--ok {
  color: var(--success);
  background: var(--success-bg);
  border-color: rgba(52, 211, 153, 0.25);
}
.health-pill--warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: rgba(251, 191, 36, 0.25);
}
.health-pill--err {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.25);
}
.health-pill--info {
  color: #c7d2fe;
  background: var(--accent-soft);
  border-color: rgba(129, 140, 248, 0.3);
}
.health-pill--unknown {
  color: var(--text-tertiary);
  background: transparent;
  border-color: var(--border);
}

/* Status */
.topnav-status {
  padding: 0 8px;
  flex-shrink: 0;
  max-width: 220px;
}
.status-text {
  font-size: 12px;
  color: var(--text-secondary);
}
.status-text.ok {
  color: var(--success);
  background: var(--success-bg);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(52, 211, 153, 0.2);
  font-weight: 600;
  display: inline-block;
}
.status-text.error {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}

/* Controls (token + reload) */
.topnav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}
.token-compact {
  display: flex;
  align-items: center;
  gap: 4px;
}
.input-token {
  width: 148px;
  padding: 5px 9px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.input-token::placeholder {
  color: var(--text-muted);
  letter-spacing: 0;
  font-size: 11px;
}
.input-token:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Keyboard hints bar */
.topbar-hints {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 5px 16px 4px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  letter-spacing: 0.01em;
}
.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-tertiary);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  margin: 0 1px;
}

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition:
    background 0.12s,
    border-color 0.12s,
    opacity 0.12s,
    transform 0.08s;
  text-decoration: none;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}
.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}
.btn-lg {
  padding: 8px 18px;
  font-size: 14px;
}
.btn-icon {
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(180deg, #a5b4fc 0%, var(--accent-muted) 100%);
  color: #0c0d1a;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #c4cfff 0%, #7c83f8 100%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-warn {
  background: linear-gradient(180deg, #fcd34d 0%, #d97706 100%);
  color: #1a0e00;
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-weight: 700;
}
.btn-warn:hover:not(:disabled) {
  filter: brightness(1.08);
}

/* ════════════════════════════════════════
   BANNER
   ════════════════════════════════════════ */
.banner {
  margin: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
}
.banner p {
  margin: 2px 0;
}
.banner code {
  font-size: 0.85em;
}
.banner--warn {
  background: var(--warn-bg);
  border-bottom-color: rgba(251, 191, 36, 0.3);
  color: var(--warn);
}
.banner--err {
  background: var(--danger-bg);
  border-bottom-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}
.banner--info {
  background: var(--accent-soft);
  border-bottom-color: rgba(99, 102, 241, 0.3);
  color: var(--accent);
}

/* ════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════ */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - var(--topnav-h));
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-label {
  padding: 14px 14px 7px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.tab-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.tab-nav button {
  text-align: left;
  width: 100%;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s,
    border-color 0.1s;
  position: relative;
}
.tab-nav button:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.tab-nav button.active {
  background: var(--accent-soft);
  color: #dde4ff;
  border-color: rgba(129, 140, 248, 0.22);
  font-weight: 600;
}
.tab-nav button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.tab-restart-dot {
  color: var(--warn);
  font-weight: 700;
  margin-left: 4px;
}

/* ── Content area ── */
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.content-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}
.content-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}
.content-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.dirty-marker {
  font-size: 12px;
  color: var(--warn);
  font-weight: 600;
}

.content-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.env-panel,
.data-tab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.env-panel[hidden],
.data-tab-panel[hidden] {
  display: none !important;
}

.fields-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.fields-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 62rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ════════════════════════════════════════
   FIELD GRID
   ════════════════════════════════════════ */
.field-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* Toggle grid: 3 per row */
.bool-deck-outer {
  margin-bottom: 6px;
}
.bool-deck {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.bool-deck-outer:only-child .bool-deck {
  border-bottom: none;
  padding-bottom: 2px;
  margin-bottom: 0;
}

.scalar-deck-outer {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.scalar-deck {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 900px) {
  .bool-deck {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .bool-deck {
    grid-template-columns: 1fr;
  }
}

/* ── Field card ── */
.field {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px 12px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.field:hover {
  border-color: var(--border-strong);
}
.field--needs-restart {
  border-left: 3px solid var(--warn);
  padding-left: 11px;
}
.field--needs-restart::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.04) 0%, transparent 40%);
  pointer-events: none;
}

/* Field header */
.field-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px 10px;
  margin-bottom: 4px;
}
.field-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  min-width: 8rem;
}
.field-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* Badges */
.pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  background: #1e2535;
  color: var(--text-muted);
}
.pill.sensitive {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.badge-restart {
  font-size: 10px;
  font-weight: 700;
  color: var(--warn);
  background: var(--warn-bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  cursor: help;
  white-space: nowrap;
}
.badge-live {
  font-size: 10px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(52, 211, 153, 0.2);
  cursor: help;
  white-space: nowrap;
}
.badge-changed {
  font-size: 10px;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(248, 113, 113, 0.2);
  cursor: help;
  white-space: nowrap;
}

/* Field help text */
.field-help {
  margin: 0 0 7px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  max-width: 52rem;
}
.field--bool .field-help {
  margin: 2px 0 2px;
  font-size: 11px;
}

/* Keyline (env var name + copy) */
.field-keyline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.field-keyline code {
  color: #93afd4;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.45);
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-all;
}
.field-keyline--bool {
  margin: 4px 0 0;
  min-width: 0;
}
.field--bool .field-keyline--bool code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
}

/* Copy button */
.btn-copy {
  font: inherit;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    color 0.1s,
    border-color 0.1s,
    background 0.1s;
}
.btn-copy:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}
.btn-copy.copied {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.4);
}
.btn-copy--tight {
  font-size: 10px;
  padding: 1px 5px;
  flex-shrink: 0;
}

/* ── Boolean toggle fields ── */
.field--bool {
  padding: 8px 12px 9px;
  border-radius: 9px;
}
.field-bool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}
.field--bool .field-header--bool {
  margin: 0;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 4px 8px;
}
.field--bool .field-header--bool .field-title {
  font-size: 12.5px;
  line-height: 1.25;
}
.field--bool .field-badges {
  flex-shrink: 0;
}
.field--bool .field-bool {
  margin: 0;
  padding: 0;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.field--bool .bool-labels {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Field control (input area) */
.field-control {
}
.field-control input[type="text"],
.field-control input[type="number"],
.field-control textarea {
  width: 100%;
  max-width: 100%;
  padding: 8px 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.field-control textarea {
  min-height: 4.5rem;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}
.field-control input:focus,
.field-control textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* iOS-style switch */
.switch {
  position: relative;
  width: 34px;
  height: 19px;
  flex-shrink: 0;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch:checked {
  background: var(--accent-muted);
  border-color: rgba(129, 140, 248, 0.5);
}
.switch:checked::after {
  transform: translateX(15px);
}
.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Small switch for bool cards */
.field--bool .switch {
  width: 28px;
  height: 16px;
}
.field--bool .switch::after {
  width: 10px;
  height: 10px;
}
.field--bool .switch:checked::after {
  transform: translateX(12px);
}

/* Bool layout helpers */
.field-bool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.bool-labels {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Empty state ── */
.empty-filter {
  padding: 36px 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  max-width: 52rem;
  background: rgba(0, 0, 0, 0.15);
}

/* ── JSON validation ── */
.json-validity {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  word-break: break-word;
}
.json-validity.ok {
  color: var(--success);
}
.json-validity.err {
  color: var(--danger);
}
.input-invalid {
  border-color: var(--danger) !important;
}
.input-valid {
  border-color: rgba(52, 211, 153, 0.45) !important;
}

/* ════════════════════════════════════════
   DATA / DIFF TAB
   ════════════════════════════════════════ */
.data-tab-panel {
  max-width: 60rem;
  width: 100%;
}
.data-tab-panel .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.data-tab-panel .textarea-code {
  flex: 1;
  min-height: 13rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin: 16px 20px 20px;
  box-shadow: var(--shadow-md);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.card-lead {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.data-panel {
  margin-top: 0;
}
.data-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
  margin-bottom: 10px;
}
.inline-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.select {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  min-width: 9rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.textarea-code {
  width: 100%;
  min-height: 12rem;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  color: #dde6ff;
  border-radius: var(--radius-sm);
  resize: vertical;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.textarea-code:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.data-validity {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-left: 4px;
}
.data-validity.ok {
  color: var(--success);
}
.data-validity.err {
  color: var(--danger);
}

/* Log tail */
.log-tail-details {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.log-tail-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.log-tail-summary:hover {
  color: var(--text);
}
.log-tail-lead {
  margin: 8px 0 10px;
  font-size: 12px !important;
}
.log-tail-actions {
  margin-bottom: 8px !important;
}
.log-tail-textarea {
  min-height: 10rem !important;
  flex: unset !important;
  font-size: 11.5px !important;
}

/* ════════════════════════════════════════
   STAT CHANNELS / ND-BOT TABS
   ════════════════════════════════════════ */
.serverstats-doc {
  width: 100%;
  max-width: 58rem;
}
.serverstats-callout {
  margin: 0 0 18px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated));
  border: 1px solid rgba(129, 140, 248, 0.28);
  border-radius: var(--radius);
}
.stat-channels-live {
  margin: 8px 0 14px;
  min-height: 2rem;
  overflow-x: auto;
}
.stat-channels-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.stat-channels-table th,
.stat-channels-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-all;
}
.stat-channels-table th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-card);
}
.stat-channels-table tr:last-child td {
  border-bottom: none;
}
code.table-mono {
  display: inline;
  max-width: 100%;
  font-size: 11px;
  padding: 1px 4px;
  word-break: break-all;
}
.serverstats-row--copy {
  margin-bottom: 14px;
  align-items: center;
}
.serverstats-lede {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  padding: 12px 16px;
  background: var(--warn-bg);
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: var(--radius);
}
.serverstats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 10px;
  margin-bottom: 20px;
}
a.serverstats-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 5px 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    border-color 0.12s,
    color 0.12s,
    background 0.12s;
}
a.serverstats-link:hover {
  border-color: rgba(129, 140, 248, 0.4);
  color: var(--accent-hover);
  background: var(--accent-soft);
}
.serverstats-cmd-preface {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
}
.serverstats-h {
  margin: 22px 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.serverstats-h:first-of-type {
  margin-top: 4px;
}
.serverstats-doc p {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 13px;
}
.serverstats-list {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.serverstats-cmd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 20px;
  margin-top: 8px;
}
.serverstats-cmd-col {
  min-width: 0;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.serverstats-cmd-h {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 9px;
}
.serverstats-cmd-list {
  list-style: none;
}
.serverstats-cmd-list li {
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 2px;
}
.serverstats-foot {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}
@media (max-width: 900px) {
  .serverstats-cmd-grid {
    grid-template-columns: 1fr;
  }
}
.ndbot-commands-doc {
  padding: 0;
}

/* ════════════════════════════════════════
   ACCESSIBILITY
   ════════════════════════════════════════ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.btn:focus-visible,
.tab-nav button:focus-visible,
.btn-copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 900px) {
  .topnav {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }
  .topnav-search {
    max-width: 100%;
    order: 5;
    flex: 1 1 200px;
    margin: 0;
  }
  .topnav-health {
    padding: 0 4px;
    border-left: none;
    order: 4;
    flex-wrap: wrap;
  }
  .topnav-status {
    padding: 0 4px;
  }
  .token-compact {
    flex: 1 1 140px;
  }
  .input-token {
    width: 100%;
  }
}

@media (max-width: 700px) {
  :root {
    --sidebar-w: 100%;
  }
  .layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .sidebar {
    width: 100%;
    max-height: 8rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .tab-nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: 4px 8px;
    gap: 4px;
  }
  .tab-nav button {
    width: auto;
    font-size: 12px;
    padding: 5px 10px;
  }
  .tab-nav button.active::before {
    display: none;
  }
  .content {
    overflow: visible;
  }
  .fields-scroll {
    overflow: visible;
    height: auto;
  }
  .bool-deck {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .topnav-pages {
    display: none;
  }
  .topnav-controls {
    flex-wrap: wrap;
  }
  .bool-deck {
    grid-template-columns: 1fr;
  }
}
