
/* ============================================================
   Sentinel Table Explorer — styles
   Flat dark theme. No gradients, no translucency/blur effects.
   Solid fills, 1px borders, plain shadows only.
   ============================================================ */

:root {
  --bg:            #0d1017;
  --bg-sunken:     #090b10;
  --surface:       #151a23;
  --surface-2:     #1b222e;
  --surface-3:     #222b39;
  --border:        #2b3442;
  --border-strong: #3d4a5d;
  --text:          #e9edf4;
  --text-muted:    #aeb8c7;
  --text-dim:      #8d97a6;
  --accent:        #7fb6ff;
  --accent-ink:    #08101d;
  --accent-line:   #4d7fc4;
  --ok:            #8ae2a6;
  --warn:          #ffd083;
  --danger:        #ff9b9b;
  --focus:         #ffd083;
  --code-bg:       #0a0d13;

  --radius: 8px;
  --radius-sm: 5px;
  --gap: 16px;
  --maxw: 1240px;

  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Consolas",
          "Liberation Mono", "DejaVu Sans Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

/* ---------- Focus visibility ---------- */

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Keep a visible ring for programmatic focus on the dialog shell. */
.dialog:focus-visible { outline-offset: -3px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  font-weight: 700;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 18px 72px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
  padding: 26px 0 22px;
  margin-bottom: 26px;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0 0 16px;
  color: var(--text-muted);
  max-width: 72ch;
}

/* ---------- Badges ---------- */

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
}
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.badge--ok     { color: var(--ok);     border-color: #2f6b45; }
.badge--info   { color: var(--accent); border-color: var(--accent-line); }
.badge--warn   { color: var(--warn);   border-color: #7a6228; }

/* ---------- Key mappings (prominent answers) ---------- */

.section-head {
  font-size: 1.05rem;
  margin: 30px 0 4px;
  letter-spacing: 0.01em;
}
.section-sub {
  margin: 0 0 14px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.keymap-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  margin: 0 0 8px;
}

.keymap {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.keymap h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
  color: var(--text);
}
.keymap p {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.keymap p:last-child { margin-bottom: 0; }

.answer {
  display: block;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--code-bg);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

/* ---------- Controls ---------- */

.controls {
  margin: 26px 0 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.field {
  flex: 1 1 320px;
  min-width: 0;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

input[type="search"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  -webkit-appearance: none;
  appearance: none;
}
input[type="search"]::placeholder { color: #76808f; }
input[type="search"]:focus-visible {
  border-color: var(--accent);
}

.hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 7px 0 0;
}
.hint kbd {
  font-family: var(--mono);
  font-size: 0.76rem;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-weight: 650;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  cursor: pointer;
  min-height: 44px;           /* touch target */
  transition: background-color 120ms linear, border-color 120ms linear;
}
.btn:hover { background: var(--surface-3); border-color: #55657d; }
.btn:active { background: #2b3647; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover { background: #9ac6ff; border-color: #9ac6ff; }

.btn--sm { padding: 7px 11px; min-height: 36px; font-size: 0.85rem; }

/* ---------- Category chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}
.chips legend {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
  padding: 0;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.chip {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 13px;
  min-height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background-color 120ms linear, color 120ms linear,
              border-color 120ms linear;
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.chip .count {
  font-family: var(--mono);
  font-size: 0.76rem;
  opacity: 0.85;
}

/* ---------- Status / quick answer ---------- */

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 0 12px;
}
.result-count {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.result-count strong { color: var(--text); }

.quick-answer {
  background: var(--surface);
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 18px;
}
.quick-answer[hidden] { display: none; }
.quick-answer h2 {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  margin: 0 0 8px;
}
.quick-answer p { margin: 0 0 10px; color: var(--text); font-size: 0.93rem; }
.quick-answer .answer { margin-bottom: 10px; }

/* ---------- Card grid ---------- */

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 130ms linear, background-color 130ms linear,
              box-shadow 130ms linear, transform 130ms linear;
}
.card:hover,
.card:focus-visible {
  border-color: var(--accent-line);
  background: var(--surface-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transform: translateY(-2px);
}

.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.card__name {
  margin: 0;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}
.card__cat {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.card__source {
  margin: 7px 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.card__summary {
  margin: 9px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Peek panel: interesting fields revealed on hover / focus. */
.card__peek {
  margin-top: 11px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 160ms ease-out, opacity 160ms linear,
              margin-top 160ms ease-out;
}
.card:hover .card__peek,
.card:focus-visible .card__peek,
.card:focus-within .card__peek,
.card.is-open .card__peek {
  max-height: 260px;
  opacity: 1;
}

.peek-label {
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 6px;
}
.chiplist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fieldchip {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 6px;
  overflow-wrap: anywhere;
}
.fieldchip--star {
  color: var(--warn);
  border-color: #7a6228;
}

.card__cta {
  margin-top: 12px;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--accent);
}

/* Touch / no-hover devices: never hide the interesting fields. */
@media (hover: none) {
  .card__peek {
    max-height: none;
    opacity: 1;
    overflow: visible;
  }
  .card:hover { transform: none; }
}

/* ---------- Empty state ---------- */

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 34px 22px;
  text-align: center;
}
.empty[hidden] { display: none; }
.empty h2 { margin: 0 0 8px; font-size: 1.05rem; }
.empty p { margin: 0 auto 16px; color: var(--text-muted); max-width: 60ch; }
.empty ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

/* ---------- Disclosure / prose blocks ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 26px 0 0;
}
.panel > summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before {
  content: "+";
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 0.9rem;
  line-height: 1;
}
.panel[open] > summary::before { content: "\2212"; }
.panel__body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.panel__body p,
.panel__body li { color: var(--text-muted); font-size: 0.92rem; }
.panel__body p:first-child { margin-top: 0; }
.panel__body h3 {
  font-size: 0.92rem;
  margin: 18px 0 6px;
  color: var(--text);
}

code, .mono { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.site-footer {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}
.site-footer p { margin: 0 0 8px; }

/* ---------- Modal dialog ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: #05070b;
  opacity: 0.86;
  z-index: 40;
}
.overlay[hidden] { display: none; }

.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.dialog-layer[hidden] { display: none; }

.dialog {
  position: relative;
  width: 100%;
  max-width: 820px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  margin: auto;
}

.dialog__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  z-index: 1;
}
.dialog__titles { flex: 1 1 auto; min-width: 0; }
.dialog__title {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}
.dialog__meta {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.dialog__close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  padding: 0;
}
.dialog__body { padding: 16px 18px 20px; }

.block { margin: 0 0 20px; }
.block:last-child { margin-bottom: 0; }
.block > h3 {
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.block p { margin: 0 0 10px; color: var(--text-muted); }
.block p:last-child { margin-bottom: 0; }
.block ul { margin: 0; padding-left: 20px; }
.block li { margin-bottom: 7px; color: var(--text-muted); }
.block li:last-child { margin-bottom: 0; }

.fieldtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.fieldtable caption {
  text-align: left;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding-bottom: 6px;
}
.fieldtable th,
.fieldtable td {
  text-align: left;
  vertical-align: top;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
}
.fieldtable thead th {
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom-color: var(--border-strong);
}
.fieldtable tbody th {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow-wrap: anywhere;
}
.fieldtable tbody th.is-star { color: var(--warn); }
.fieldtable td { color: var(--text-muted); }

.caveat-list li { color: var(--warn); }
.caveat-list li span { color: var(--text-muted); }

.kql-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
pre.kql {
  margin: 0;
  padding: 13px 14px;
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.83rem;
  line-height: 1.6;
  color: #d8e2f0;
  white-space: pre;
  tab-size: 2;
}
.copy-status {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ok);
  min-height: 1.2em;
  margin: 8px 0 0;
}

.verify {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--text-dim);
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  h1 { font-size: 1.35rem; }
  .grid { grid-template-columns: 1fr; }
  .dialog__head { padding: 14px; }
  .dialog__body { padding: 14px 14px 18px; }
  .fieldtable { font-size: 0.84rem; }
  .fieldtable tbody th { white-space: normal; }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover,
  .card:focus-visible { transform: none; }
  .card__peek { transition: none; }
}

/* ---------- Forced colors / high contrast ---------- */

@media (forced-colors: active) {
  .card, .keymap, .panel, .dialog, .controls { border: 1px solid CanvasText; }
  .chip[aria-pressed="true"] { forced-color-adjust: none; }
  .card__peek { max-height: none; opacity: 1; }
}

/* Visually hidden but available to assistive tech. */
.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

body.is-locked { overflow: hidden; }

/* ============================================================
   Features 1-5: tabs, investigation guides, relationship map,
   concept explorer, join recipes, example questions.
   Same constraints as above: flat dark theme, solid fills,
   1px borders, no gradients, no translucency, no blur.
   ============================================================ */

/* ---------- Primary section navigation (tabs) ---------- */

.nav {
  margin: 0 0 6px;
  border-bottom: 1px solid var(--border);
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.tab {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  top: 1px;
  transition: background-color 120ms linear, color 120ms linear;
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--border-strong);
  border-bottom: 1px solid var(--surface);
  color: var(--text);
}
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: var(--accent);
}
.tab .tab__count {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0 6px;
}
.tab[aria-selected="true"] .tab__count {
  color: var(--accent);
  border-color: var(--accent-line);
}

.panel-pane { padding-top: 20px; }
.panel-pane[hidden] { display: none; }
.panel-pane:focus-visible { outline-offset: 4px; }

.pane-head {
  margin: 0 0 6px;
  font-size: 1.15rem;
}
.pane-intro {
  margin: 0 0 18px;
  color: var(--text-muted);
  max-width: 82ch;
  font-size: 0.93rem;
}
.pane-intro code { font-size: 0.85em; }

/* ---------- Shared: selector chip rows inside panes ---------- */

.selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}
.selector legend {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
  padding: 0;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

/* ---------- Example questions (feature 3) ---------- */

.exq { margin: 14px 0 0; }
.exq__label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin: 0 0 8px;
}
.exq__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.exq-btn {
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  min-height: 40px;
  cursor: pointer;
  transition: background-color 120ms linear, border-color 120ms linear;
}
.exq-btn:hover { background: var(--surface-3); border-left-color: var(--accent); }
.exq-btn::before {
  content: "\201C";
  color: var(--text-dim);
  font-family: var(--mono);
}
.exq-btn::after {
  content: "\201D";
  color: var(--text-dim);
  font-family: var(--mono;);
}

.quick-answer:focus-visible { outline-offset: 3px; }
.quick-answer__src {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
}

/* ---------- Investigation guides (feature 1) ---------- */

.guide {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
}
.guide__title { margin: 0 0 10px; font-size: 1.05rem; }
.guide__meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin: 0 0 18px;
}
.guide__meta div {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.guide__meta dt,
.guide__metakey {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 4px;
}
.guide__meta p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.step {
  position: relative;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  padding: 14px 16px;
  margin: 0 0 12px;
}
.step:last-child { margin-bottom: 0; }
.step__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.step__num {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.step__title {
  margin: 0;
  font-size: 0.97rem;
  flex: 1 1 200px;
}
.step__tables {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.tablink {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 650;
  color: var(--accent);
  background: var(--code-bg);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 5px 8px;
  min-height: 32px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.tablink:hover { background: var(--surface-2); color: var(--text); }
.tablink--plain {
  color: var(--text-muted);
  border-color: var(--border-strong);
  cursor: default;
}

.step__why {
  margin: 10px 0 0;
  font-size: 0.89rem;
  color: var(--text-muted);
}
.step__why strong { color: var(--text); }
.step__ask {
  margin: 8px 0 0;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.kqlbox { margin: 12px 0 0; }
.kqlbox__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.kqlbox__label {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.pitfalls {
  margin: 18px 0 0;
  border: 1px solid #7a6228;
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px 14px;
}
.pitfalls h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
}
.pitfalls ul { margin: 0; padding-left: 20px; }
.pitfalls li { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 6px; }
.pitfalls li:last-child { margin-bottom: 0; }

/* ---------- Relationship map (feature 2) ---------- */

.maplayout {
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: start;
}

.mapframe {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mapframe svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.zone-box { fill: var(--bg-sunken); stroke: var(--border); stroke-width: 1; }
.zone-label {
  fill: var(--text-dim);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.edge {
  stroke: var(--border-strong);
  stroke-width: 1.5;
  fill: none;
}
.edge--weak { stroke-dasharray: 5 4; }
.edge-label {
  fill: var(--text-dim);
  font-family: var(--mono);
  font-size: 9.5px;
  opacity: 0;
}
.edge-label__bg { fill: var(--bg-sunken); opacity: 0; }

.node { cursor: pointer; }
.node__box {
  fill: var(--surface-2);
  stroke: var(--border-strong);
  stroke-width: 1;
  rx: 5;
}
.node__text {
  fill: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
  pointer-events: none;
}
.node:hover .node__box { fill: var(--surface-3); stroke: var(--accent-line); }
.node:focus { outline: none; }
.node:focus-visible .node__box {
  stroke: var(--focus);
  stroke-width: 3;
}

/* Selection states, driven by a class on the <svg> root. */
.map--sel .node .node__box { fill: var(--surface); stroke: var(--border); }
.map--sel .node .node__text { fill: var(--text-dim); }
.map--sel .edge { stroke: var(--border); opacity: 0.45; }

.map--sel .node.is-adj .node__box { fill: var(--surface-2); stroke: var(--accent-line); }
.map--sel .node.is-adj .node__text { fill: var(--text); }

.map--sel .node.is-sel .node__box {
  fill: var(--accent);
  stroke: var(--accent);
}
.map--sel .node.is-sel .node__text { fill: var(--accent-ink); }

.map--sel .edge.is-lit {
  stroke: var(--accent);
  stroke-width: 2.25;
  opacity: 1;
}
.map--sel .edge-label.is-lit,
.map--sel .edge-label__bg.is-lit { opacity: 1; }
.map--sel .edge-label.is-lit { fill: var(--accent); }

.mapside {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.mapside h3 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.mapside__role {
  margin: 0 0 12px;
  font-size: 0.84rem;
  color: var(--text-dim);
}
.mapside__empty { font-size: 0.89rem; color: var(--text-muted); margin: 0; }

.rel {
  border-top: 1px solid var(--border);
  padding: 11px 0 0;
  margin: 11px 0 0;
}
.rel:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.rel__top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.rel__dir {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
.rel__keys {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.rel__note { margin: 0 0 6px; font-size: 0.84rem; color: var(--text-muted); }
.rel__caveat { margin: 0; font-size: 0.82rem; color: var(--warn); }
.rel__caveat span { color: var(--text-muted); }
.rel__acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }

.maplegend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.maplegend li { display: inline-flex; align-items: center; gap: 7px; }
.maplegend .swatch {
  width: 22px;
  height: 0;
  border-top: 2px solid var(--border-strong);
  display: inline-block;
}
.maplegend .swatch--weak { border-top-style: dashed; }
.maplegend .swatch--box {
  width: 12px;
  height: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  border-top-width: 1px;
}

/* ---------- Concept explorer (feature 4) ---------- */

.concept {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin: 0 0 var(--gap);
}
.concept:last-child { margin-bottom: 0; }
.concept__title {
  margin: 0 0 4px;
  font-size: 1.02rem;
}
.concept__aka {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.concept__aka span { font-family: var(--mono); }
.concept__summary { margin: 0 0 14px; color: var(--text-muted); font-size: 0.91rem; }
.concept__sub {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 16px 0 7px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.loctable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.loctable th,
.loctable td {
  text-align: left;
  vertical-align: top;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
}
.loctable thead th {
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom-color: var(--border-strong);
  white-space: nowrap;
}
.loctable td { color: var(--text-muted); }
.loctable .loc-path {
  font-family: var(--mono);
  color: var(--text);
  overflow-wrap: anywhere;
}
.loctable .loc-path b { color: var(--warn); font-weight: 700; }
.loctable .loc-table { white-space: nowrap; }

.ctips { margin: 0; padding-left: 20px; }
.ctips li { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 6px; }
.ctips li:last-child { margin-bottom: 0; }
.ctips--caveat li { color: var(--warn); }
.ctips--caveat li span { color: var(--text-muted); }

/* ---------- Join recipes (feature 5) ---------- */

.recipe {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin: 0 0 var(--gap);
}
.recipe:last-child { margin-bottom: 0; }
.recipe__title { margin: 0 0 6px; font-size: 1.02rem; }
.recipe__title:focus-visible { outline-offset: 4px; }
.recipe__flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.recipe__flow li { display: inline-flex; align-items: center; gap: 7px; }
.recipe__arrow { color: var(--text-dim); font-family: var(--mono); }
.recipe__goal { margin: 0 0 12px; color: var(--text-muted); font-size: 0.91rem; }

.keytable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0;
}
.keytable th,
.keytable td {
  text-align: left;
  vertical-align: top;
  padding: 6px 9px;
  border-bottom: 1px solid var(--border);
}
.keytable thead th {
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom-color: var(--border-strong);
}
.keytable td { color: var(--text-muted); }
.keytable .mono { color: var(--text); overflow-wrap: anywhere; }

.jumplist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

/* ---------- Sub-pane empty states ---------- */

.mini-empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 26px 20px;
  text-align: center;
}
.mini-empty[hidden] { display: none; }
.mini-empty h3 { margin: 0 0 8px; font-size: 1rem; }
.mini-empty p { margin: 0 auto 14px; color: var(--text-muted); max-width: 56ch; font-size: 0.9rem; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 0 0 14px;
}
.filter-row .field { flex: 1 1 280px; }

.count-note {
  margin: 0 0 14px;
  font-size: 0.86rem;
  color: var(--text-dim);
}
.count-note strong { color: var(--text); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .maplayout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .tab { padding: 9px 11px; font-size: 0.85rem; }
  .guide, .concept, .recipe { padding: 14px; }
  .step { padding: 12px 13px; }
  .loctable, .keytable { font-size: 0.82rem; }
  .loctable .loc-table { white-space: normal; }
  .mapframe { padding: 6px; }
}

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

@media (prefers-reduced-motion: reduce) {
  .tab, .exq-btn, .tablink { transition: none; }
}

/* ---------- Forced colors / high contrast ---------- */

@media (forced-colors: active) {
  .guide, .concept, .recipe, .step, .mapframe, .mapside, .pitfalls,
  .mini-empty { border: 1px solid CanvasText; }
  .tab[aria-selected="true"] { forced-color-adjust: none; }
  .node__box { fill: Canvas; stroke: CanvasText; }
  .node__text { fill: CanvasText; }
  .edge { stroke: CanvasText; }
  .map--sel .edge.is-lit { stroke: Highlight; }
  .map--sel .node.is-sel .node__box { fill: Highlight; }
  .edge-label.is-lit { fill: CanvasText; }
}

/* ==========================================================
   Build shim: replaces the two inline style="" attributes the
   single-file build carried, so the CSP needs no 'unsafe-inline'.
   ========================================================== */
.wrap--flush { padding-bottom: 0; }
.stack-top { margin: 12px 0 0; }
