/* ── Help page — standalone FHIR Field Reference ───────────────────────────── */

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

:root {
  --help-bg:        #f8f9fa;
  --help-surface:   #ffffff;
  --help-border:    #dee2e6;
  --help-text:      #212529;
  --help-muted:     #6c757d;
  --help-accent:    #0d6efd;
  --help-code-bg:   #f1f3f5;
  --help-header-h:  110px;

  --cat-quest: #3b82f6;
  --cat-core:  #10b981;
  --cat-ext:   #f59e0b;
  --cat-sdc:   #8b5cf6;
  --cat-ns:    #9ca3af;
  --cat-qr:    #06b6d4;
  --cat-redcap: #e11d48;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--help-text);
  background: var(--help-bg);
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.help-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--help-surface);
  border-bottom: 1px solid var(--help-border);
  padding: 12px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.help-header-top {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.help-header h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--help-text);
}

.help-back-link {
  font-size: 12px;
  color: var(--help-accent);
  text-decoration: none;
}
.help-back-link:hover { text-decoration: underline; }

.help-subtitle {
  font-size: 12px;
  color: var(--help-muted);
}

.help-search {
  width: 100%;
  max-width: 520px;
  padding: 5px 10px;
  border: 1px solid var(--help-border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: var(--help-bg);
  color: var(--help-text);
}
.help-search:focus { border-color: var(--help-accent); box-shadow: 0 0 0 2px rgba(13,110,253,.15); }

.help-count {
  font-size: 11px;
  color: var(--help-muted);
  min-height: 14px;
}

/* ── Content wrapper ─────────────────────────────────────────────────────────── */
.help-wrap {
  padding: 12px 20px 32px;
  overflow-x: auto;
}

/* ── Table ───────────────────────────────────────────────────────────────────── */
#helpTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#helpTable thead th {
  position: sticky;
  top: 0;
  background: var(--help-surface);
  border-bottom: 2px solid var(--help-border);
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--help-muted);
  white-space: nowrap;
}

.col-field { width: 22%; }
.col-desc  { width: 32%; }
.col-where { width: 20%; }
.col-how   { width: 26%; }

#helpTable tbody tr {
  border-bottom: 1px solid var(--help-border);
  transition: background .1s;
}
#helpTable tbody tr:hover { background: #f0f4ff; }

#helpTable tbody td {
  padding: 7px 10px;
  vertical-align: top;
  font-size: 12.5px;
  line-height: 1.45;
}

.col-field code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11.5px;
  background: var(--help-code-bg);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--help-border);
  white-space: normal;
  word-break: break-all;
  display: inline;
}

/* ── Category separator rows ─────────────────────────────────────────────────── */
.help-cat-sep td {
  padding: 10px 10px 4px;
  background: transparent;
  border-bottom: none;
}

.help-cat-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
}

.cat-quest { background: var(--cat-quest); }
.cat-core  { background: var(--cat-core); }
.cat-ext   { background: var(--cat-ext); }
.cat-sdc   { background: var(--cat-sdc); }
.cat-ns    { background: var(--cat-ns); }
.cat-qr    { background: var(--cat-qr); }
.cat-redcap { background: var(--cat-redcap); }

/* ── Not-supported rows ─────────────────────────────────────────────────────── */
tr:has(.cat-ns) ~ tr .col-field code,
tr:has(.cat-ns) ~ tr td {
  color: var(--help-muted);
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.help-empty {
  padding: 32px;
  text-align: center;
  color: var(--help-muted);
  font-size: 14px;
}
