/* ============================================================
   QUERY MONITOR DOCUMENTATION — DESIGN SYSTEM & STYLES
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Brand & Theme Colors */
  --color-primary:        #1a5fb4;
  --color-primary-light:  #3584e4;
  --color-primary-dark:   #0f2b5b;
  --color-primary-bg:     #eef3fb;
  --color-primary-hover:  #154d94;
  --color-accent:         #29b5e8;
  --color-accent-dark:    #0077c8;

  /* Neutrals & Surfaces */
  --color-bg:             #f5f6f8;
  --color-surface:        #ffffff;
  --color-surface-alt:    #f8fafc;
  --color-border:         #e2e5ea;
  --color-border-strong:  #c8cdd6;

  /* Text Colors */
  --color-text:           #1a1d23;
  --color-text-secondary: #4a5568;
  --color-text-muted:     #718096;
  --color-text-inverse:   #ffffff;

  /* Alert / State Colors */
  --color-success-bg:     #f0faf4;
  --color-success-border: #38a169;
  --color-success-text:   #1e4620;

  --color-warning-bg:     #fffbeb;
  --color-warning-border: #dd6b20;
  --color-warning-text:   #7b341e;

  --color-important-bg:   #fff5f5;
  --color-important-border: #e53e3e;
  --color-important-text: #742a2a;

  --color-info-bg:        #ebf5ff;
  --color-info-border:    #3182ce;
  --color-info-text:      #1a365d;

  --color-note-bg:        #f7f8ff;
  --color-note-border:    #667eea;
  --color-note-text:      #2d3748;

  /* Header & Navigation */
  --color-header-bg:      #ffffff;
  --color-header-border:  #e2e5ea;

  /* Code Block Colors */
  --color-code-bg:        #1e2430;
  --color-code-text:      #e2e8f0;
  --color-code-header-bg: #161a22;
  --color-code-border:    #2d3748;

  /* Spacing */
  --spacing-2xs:   2px;
  --spacing-xs:    4px;
  --spacing-sm:    8px;
  --spacing-md:    16px;
  --spacing-lg:    24px;
  --spacing-xl:    32px;
  --spacing-2xl:   48px;
  --spacing-3xl:   64px;

  /* Typography */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'JetBrains Mono', 'Consolas', 'Courier New', monospace;

  --text-2xs:   0.7rem;
  --text-xs:    0.75rem;
  --text-sm:    0.875rem;
  --text-base:  1rem;
  --text-lg:    1.125rem;
  --text-xl:    1.25rem;
  --text-2xl:   1.5rem;
  --text-3xl:   1.875rem;
  --text-4xl:   2.25rem;

  /* Border Radii */
  --radius-xs:  3px;
  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  8px;
  --radius-xl:  12px;
  --radius-2xl: 16px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);

  /* Layout Dimensions */
  --header-bar-h:   60px;
  --header-tabs-h:  46px;
  --header-height:  108px;   /* 60 bar + 1 + 46 tabs + 1 border */
  --shell-max:      1244px;
  --toc-width:      230px;
  --content-max:    860px;
}

/* ── Reset & Global Base ───────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Column layout so #main-container can absorb slack and hold the footer down. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-primary-light);
  text-decoration: underline;
}

/* Accessible Skip Link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  background: var(--color-primary);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 10000;
  transition: top 0.2s ease;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

/* Keyboard Focus Rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent-dark);
  outline-offset: 2px;
}

/* ╔═══════════════════════════════════════════════════════════╗
   ║  REGION 1: STICKY HORIZONTAL SITE HEADER                   ║
   ╚═══════════════════════════════════════════════════════════╝ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 300;
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-header-border);
  box-shadow: var(--shadow-sm);
}

/* Upper bar: brand · search · publisher meta */
.header-bar {
  height: var(--header-bar-h);
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--spacing-xl);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

/* Brand */
.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-wrapper:hover {
  text-decoration: none;
}

.brand-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #29b5e8 0%, #1a5fb4 65%, #0f2b5b 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(26,95,180,0.3);
}

.brand-logo-icon svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: var(--text-2xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 1px;
}

/* Header Search */
.header-search {
  margin-left: auto;
  flex: 0 1 320px;
  min-width: 0;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-input-wrapper > svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--color-text-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 36px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 var(--spacing-sm) 0 32px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
  outline: none;
}

#search-input::placeholder {
  color: var(--color-text-muted);
}

#search-input:focus {
  background: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,95,180,0.12);
}

/* Search Dropdown */
#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 100%;
  min-width: 300px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 340px;
  overflow-y: auto;
  z-index: 500;
}

#search-results.visible {
  display: block;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.12s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--color-primary-bg);
}

.search-result-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
}

.search-result-section {
  font-size: var(--text-2xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.search-no-results {
  padding: var(--spacing-md);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Lower bar: horizontal navigation tabs */
.site-tabs {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.tabs-inner {
  height: var(--header-tabs-h);
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--spacing-xl);
  display: flex;
  align-items: stretch;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs-inner::-webkit-scrollbar {
  display: none;
}

.nav-tab:first-child {
  margin-left: auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.nav-tab:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
}

.nav-tab.active,
.nav-tab[aria-current="page"] {
  color: var(--color-primary);
  font-weight: 600;
  border-bottom-color: var(--color-primary);
}

.nav-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-tab.active svg,
.nav-tab[aria-current="page"] svg {
  opacity: 1;
}


/* ╔═══════════════════════════════════════════════════════════╗
   ║  REGION 2: CENTER PAGE CONTENT & REGION 3: RIGHT RAIL     ║
   ╚═══════════════════════════════════════════════════════════╝ */
#main-container {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: var(--spacing-xl) var(--spacing-xl);
  min-width: 0;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--content-max)) var(--toc-width);
  gap: var(--spacing-xl);
  width: 100%;
  max-width: 1180px;
  align-items: start;
}

/* Center Content Card */
#page-content {
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.page-body {
  padding: var(--spacing-2xl) var(--spacing-3xl);
}

/* ╔═══════════════════════════════════════════════════════════╗
   ║  REGION 3: FIXED RIGHT RAIL (ON THIS PAGE)                 ║
   ╚═══════════════════════════════════════════════════════════╝ */
#toc-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--spacing-lg));
  max-height: calc(100vh - var(--header-height) - var(--spacing-2xl));
  overflow-y: auto;
  scrollbar-width: thin;
}

.toc-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.toc-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-label svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-item a {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}

.toc-item a:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  text-decoration: none;
}

.toc-item.active a {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  font-weight: 600;
  border-left: 2px solid var(--color-primary);
}

.toc-item.h3 a {
  padding-left: 18px;
  font-size: 0.72rem;
}

/* ── Typography & Prose Components ─────────────────────────── */
.page-body h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: var(--spacing-xs);
}

.page-body .page-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  font-weight: 400;
  margin-bottom: var(--spacing-2xl);
  line-height: 1.55;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--spacing-lg);
}

.page-body h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-top: var(--spacing-2xl);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--color-border);
  scroll-margin-top: calc(var(--header-height) + var(--spacing-lg));
}

.page-body h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-sm);
  scroll-margin-top: calc(var(--header-height) + var(--spacing-lg));
}

.page-body h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-xs);
  scroll-margin-top: calc(var(--header-height) + var(--spacing-lg));
}

.page-body p {
  margin-bottom: var(--spacing-md);
  color: var(--color-text-secondary);
  line-height: 1.75;
}

.page-body ul,
.page-body ol {
  margin: var(--spacing-sm) 0 var(--spacing-md) var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-body li {
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.page-body strong {
  font-weight: 600;
  color: var(--color-text);
}

/* Inline Code */
.page-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: #edf0f5;
  border: 1px solid #d9dfe7;
  border-radius: 3px;
  padding: 1px 6px;
  color: #c0392b;
  font-weight: 500;
}

/* ── Hero Banner ───────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, #0b1f42 0%, #154d94 55%, #29b5e8 100%);
  border-radius: var(--radius-xl);
  padding: var(--spacing-2xl) var(--spacing-3xl);
  margin: -var(--spacing-2xl) -var(--spacing-3xl) var(--spacing-2xl);
  color: #ffffff;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: var(--spacing-md);
  letter-spacing: 0.02em;
}

.hero-badge svg {
  width: 14px;
  height: 14px;
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  margin-bottom: var(--spacing-sm);
  color: #ffffff !important;
  border-bottom: none !important;
  margin-top: 0 !important;
  padding-bottom: 0 !important;
}

.hero-tagline {
  font-size: var(--text-lg);
  color: #64d2ff;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.01em;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 400;
  max-width: 680px;
  line-height: 1.65;
  margin-bottom: var(--spacing-xl);
}

.hero-banner p {
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 0;
}

.hero-actions {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: #ffffff;
  color: var(--color-primary-dark);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.btn-primary:hover {
  background: #f0f4fa;
  color: var(--color-primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

/* ── Code Blocks with Copy-to-Clipboard ────────────────────── */
.code-block {
  margin: var(--spacing-md) 0 var(--spacing-lg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-code-bg);
  border: 1px solid var(--color-code-border);
  box-shadow: var(--shadow-sm);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-code-header-bg);
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-code-border);
}

.code-lang-tag {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--color-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-size: var(--text-2xs);
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.copy-btn.copied {
  background: rgba(56, 161, 105, 0.25);
  border-color: var(--color-success-border);
  color: #68d391;
}

.copy-btn svg {
  width: 13px;
  height: 13px;
}

.code-block pre {
  margin: 0;
  padding: var(--spacing-md) var(--spacing-lg);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-code-text);
}

.code-block pre code {
  font-family: var(--font-mono);
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ── Callout Boxes ─────────────────────────────────────────── */
.callout {
  border-radius: var(--radius-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  margin: var(--spacing-md) 0 var(--spacing-lg);
  display: flex;
  gap: var(--spacing-md);
  border-left: 4px solid;
}

.callout-icon {
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: flex-start;
}

.callout-icon svg {
  width: 18px;
  height: 18px;
}

.callout-body {
  flex: 1;
}

.callout-title {
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: 4px;
}

.callout-body p {
  font-size: var(--text-sm);
  line-height: 1.6;
}

.callout-body p:last-child {
  margin-bottom: 0;
}

/* Callout Variants */
.callout-info {
  background: var(--color-info-bg);
  border-color: var(--color-info-border);
  color: var(--color-info-text);
}
.callout-info .callout-icon { color: var(--color-info-border); }

.callout-warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}
.callout-warning .callout-icon { color: var(--color-warning-border); }

.callout-important {
  background: var(--color-important-bg);
  border-color: var(--color-important-border);
  color: var(--color-important-text);
}
.callout-important .callout-icon { color: var(--color-important-border); }

.callout-note {
  background: var(--color-note-bg);
  border-color: var(--color-note-border);
  color: var(--color-note-text);
}
.callout-note .callout-icon { color: var(--color-note-border); }

.callout-success {
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}
.callout-success .callout-icon { color: var(--color-success-border); }

/* ── Numbered Steps ────────────────────────────────────────── */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: var(--spacing-md) 0 var(--spacing-xl);
  position: relative;
}

.step {
  display: flex;
  gap: var(--spacing-lg);
  position: relative;
}

.step::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.step:last-child::before {
  display: none;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.step-content {
  padding-bottom: var(--spacing-xl);
  flex: 1;
}

.step-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-xs);
  line-height: 1.6;
}

.step-body p,
.step-body li {
  font-size: var(--text-sm);
}

/* ── Data Tables ───────────────────────────────────────────── */
.doc-table-wrap {
  overflow-x: auto;
  margin: var(--spacing-md) 0 var(--spacing-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.doc-table thead {
  background: #f0f4f9;
}

.doc-table th {
  padding: 10px 16px;
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.doc-table td {
  padding: 11px 16px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  line-height: 1.5;
}

.doc-table tr:last-child td {
  border-bottom: none;
}

.doc-table tbody tr:hover {
  background: #fafbfc;
}

.doc-table td code {
  font-size: 0.82em;
}

/* ── Key-Value Spec List ───────────────────────────────────── */
.spec-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--spacing-md);
  margin: var(--spacing-md) 0 var(--spacing-lg);
}

.spec-item {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
}

.spec-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.spec-value {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 600;
}

.spec-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 4px;
  line-height: 1.45;
}

/* ── Illustrative Sample Block ─────────────────────────────── */
/* Wraps example figures. Deliberately muted and dashed so it never reads as a
   live reading of the consumer's own account. */
.sample-block {
  background: var(--color-surface-alt);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  margin: var(--spacing-lg) 0;
}

.sample-label {
  display: block;
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
}

.sample-block > .metric-grid,
.sample-block > .doc-table-wrap {
  margin: 0;
}

.sample-block .metric-card,
.sample-block .doc-table {
  background: var(--color-surface);
}

/* ── KPI & Metric Grid ─────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--spacing-md);
  margin: var(--spacing-md) 0 var(--spacing-lg);
}

.metric-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s, border-color 0.15s;
}

.metric-card:hover {
  border-color: var(--color-primary-light);
}

.metric-name {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}

.metric-value-sample {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary-dark);
  font-family: var(--font-mono);
}

.metric-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

/* ── Section Feature Cards (Used in Home & Guides) ──────────── */
.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--spacing-md);
  margin: var(--spacing-md) 0 var(--spacing-lg);
}

.section-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
  background: var(--color-surface);
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.section-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 14px rgba(26,95,180,0.1);
  transform: translateY(-2px);
  text-decoration: none;
}

.section-card-icon {
  margin-bottom: var(--spacing-sm);
  display: block;
  color: var(--color-primary);
}

.section-card-icon svg {
  width: 24px;
  height: 24px;
}

.section-card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
}

.section-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ── Interactive Troubleshooting Items ─────────────────────── */
.trouble-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-md);
  overflow: hidden;
  background: var(--color-surface);
}

.trouble-header {
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.trouble-header:hover {
  background: #f0f4f9;
}

.trouble-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
}

.trouble-icon svg {
  width: 16px;
  height: 16px;
}

.trouble-question {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}

.trouble-toggle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}

.trouble-item.open .trouble-toggle {
  transform: rotate(90deg);
}

.trouble-body {
  display: none;
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  background: #ffffff;
}

.trouble-item.open .trouble-body {
  display: block;
}

.trouble-section-label {
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin-top: var(--spacing-sm);
  margin-bottom: 2px;
}

/* ── Expandable Query Rows (Used in Performance tab guide) ─── */
.query-card-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  overflow: hidden;
  background: var(--color-surface);
}

.query-card-header {
  padding: 10px 14px;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  cursor: pointer;
  font-size: var(--text-sm);
}

.query-card-header:hover {
  background: #edf2f7;
}

.query-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: var(--text-2xs);
  font-weight: 700;
}

.query-status-badge.success { background: #def7ec; color: #03543f; }
.query-status-badge.fail    { background: #fde8e8; color: #9b1c1c; }

/* ── Quick Links Strip ─────────────────────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--spacing-sm);
  margin: var(--spacing-md) 0 var(--spacing-lg);
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-surface);
  transition: all 0.15s;
  text-decoration: none;
  cursor: pointer;
}

.quick-link:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
  text-decoration: none;
}

.quick-link .ql-arrow {
  font-size: 0.8em;
  opacity: 0.6;
}

/* ── Footer ─────────────────────────────────────── */
/* Full-width band below the content column: copyright left, nav links right. */
#site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.footer-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm) var(--spacing-lg);
  flex-wrap: wrap;
}

.footer-copy {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--spacing-sm) var(--spacing-lg);
  margin-left: auto;
}

.footer-links a {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* ── Responsive Rules ──────────────────────────────────────── */
/* Below 1100px: Collapse Right Rail (TOC) */
@media (max-width: 1100px) {
  .layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  #toc-sidebar {
    display: none;
  }
  .page-body {
    padding: var(--spacing-xl) var(--spacing-xl);
  }
  .hero-banner {
    padding: var(--spacing-xl) var(--spacing-xl);
  }
}

/* Below 768px: Compact header, edge-to-edge scrollable tab strip */
@media (max-width: 768px) {
  :root {
    --header-bar-h:  56px;
    --header-tabs-h: 44px;
    --header-height: 102px;
  }

  .header-bar {
    padding: 0 var(--spacing-md);
    gap: var(--spacing-md);
  }

  .tabs-inner {
    padding: 0 var(--spacing-md);
  }

  .brand-subtitle {
    display: none;
  }

  .header-search {
    flex: 1 1 auto;
  }

  #search-results {
    min-width: 0;
  }

  #main-container {
    padding: var(--spacing-md);
  }

  .page-body {
    padding: var(--spacing-lg) var(--spacing-md);
  }

  .hero-banner {
    padding: var(--spacing-lg) var(--spacing-md);
  }

  .hero-title {
    font-size: var(--text-2xl);
  }

  .hero-tagline {
    font-size: var(--text-base);
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Side-by-side leaves the links orphaning onto a ragged third line here. */
  .footer-inner {
    padding: var(--spacing-lg) var(--spacing-md);
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-links {
    margin-left: 0;
    justify-content: center;
  }
}

/* Below 560px: Logo only, search takes the remaining width */
@media (max-width: 560px) {
  .brand-text {
    display: none;
  }
  .nav-tab {
    padding: 0 11px;
  }
  .nav-tab svg {
    display: none;
  }
}

@media (max-width: 480px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .section-cards {
    grid-template-columns: 1fr;
  }
  .quick-links {
    grid-template-columns: 1fr;
  }
}

/* Scroll highlight animation for TOC target */
@keyframes highlight-fade {
  0%   { background: rgba(26,95,180,0.12); }
  100% { background: transparent; }
}

.toc-highlight {
  animation: highlight-fade 1.4s ease-out;
}
