/* ═══════════════════════════════════════════════════════════════
   hl7online.com — "Trusted Authority" Dark Theme
   Design System: Inter + Monospace, 4px spacing base, navy palette
   ═══════════════════════════════════════════════════════════════ */

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

/* ── Splash Screen ── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080e1e;
  overflow: hidden;
  transition: opacity 600ms ease, transform 600ms ease;
}
.splash.leaving {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}
.splash-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: orb-drift 12s ease-in-out infinite alternate;
}
.splash-orb-1 {
  width: 400px; height: 400px;
  background: #4A7FE0;
  top: -100px; left: -100px;
  animation-duration: 14s;
}
.splash-orb-2 {
  width: 300px; height: 300px;
  background: #6366f1;
  bottom: -80px; right: -80px;
  animation-duration: 10s;
  animation-delay: -4s;
}
.splash-orb-3 {
  width: 200px; height: 200px;
  background: #22d3ee;
  top: 50%; left: 60%;
  opacity: 0.15;
  animation-duration: 16s;
  animation-delay: -8s;
}
@keyframes orb-drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.1); }
  100% { transform: translate(-20px, 30px) scale(0.95); }
}
.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px;
  animation: splash-rise 800ms ease-out;
}
@keyframes splash-rise {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
.splash-logo-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 24px;
}
.splash-logo {
  width: 140px;
  height: 140px;
  filter: drop-shadow(0 0 30px rgba(74, 127, 224, 0.4));
  animation: splash-float 4s ease-in-out infinite;
}
@keyframes splash-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.splash-pulse-ring {
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(74, 127, 224, 0.3);
  border-radius: 50%;
  animation: splash-pulse-ring 2.5s ease-out infinite;
}
@keyframes splash-pulse-ring {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}
.splash-title {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 48px;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: -1.5px;
  margin-bottom: 4px;
}
.splash-subtitle {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #60a5fa;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.splash-tagline {
  font-size: 15px;
  color: #64748b;
  margin-bottom: 40px;
  font-weight: 400;
}
.splash-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  padding: 14px 36px;
  border-radius: 12px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}
.splash-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
}
.splash-btn:active {
  transform: translateY(0);
}
.splash-btn svg {
  transition: transform 200ms ease;
}
.splash-btn:hover svg {
  transform: translateX(3px);
}

@media (max-width: 768px) {
  .splash-logo-wrap { width: 100px; height: 100px; }
  .splash-logo { width: 100px; height: 100px; }
  .splash-title { font-size: 36px; }
  .splash-subtitle { font-size: 14px; }
  .splash-btn { padding: 12px 28px; font-size: 15px; }
}

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

:root {
  /* Colors */
  --bg-page: #0f172a;
  --bg-input: #0c1322;
  --bg-panel: #111827;
  --bg-surface: #1e293b;
  --border-default: #334155;
  --border-hover: #475569;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #8494a7;
  --blue: #60a5fa;
  --blue-button: #3b82f6;
  --blue-pressed: #2563eb;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --blue-border: rgba(59, 130, 246, 0.25);
  --green: #4ade80;
  --green-bg: rgba(34, 197, 94, 0.12);
  --green-border: rgba(34, 197, 94, 0.3);
  --gold: #fbbf24;
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --red-border: rgba(239, 68, 68, 0.3);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.3);
  --purple-start: #8b5cf6;
  --purple-end: #6366f1;

  /* Typography */
  --font-ui: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-logo: 10px;

  /* Shadows */
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.2);
  --shadow-button: 0 2px 8px rgba(59,130,246,0.3);

  /* Transitions */
  --transition: 150ms ease;
}

html { font-size: 16px; }
body {
  font-family: var(--font-ui);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.4;
}

/* ── Skip Link (a11y) ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue-button);
  color: #fff;
  padding: var(--sp-2) var(--sp-4);
  z-index: 1000;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
}
.skip-link:focus { left: var(--sp-4); }

/* ── Focus Ring (a11y) ── */
*:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ── Top Navigation ── */
.topnav {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-page) 100%);
  border-bottom: 1px solid var(--border-default);
  padding: 0 var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  height: 32px;
  width: auto;
}
.logo-text {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.logo-text span { color: var(--blue); }
.logo-divider {
  width: 1px;
  height: 24px;
  background: var(--border-default);
  margin: 0 var(--sp-2);
}
.product-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
}

.nav-center {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  padding: 5px var(--sp-3);
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--green);
}
.privacy-badge .dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
}
.privacy-badge .dot.pulse { animation: pulse 2s infinite; }

.ai-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px var(--sp-3);
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
}
.ai-status-badge.ready { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }
.ai-status-badge.loading { background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber); }
.ai-status-badge.unavailable { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.nav-links {
  display: flex;
  gap: var(--sp-1);
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.nav-links a:hover { background: var(--bg-surface); color: var(--text-primary); }

/* ── Main Layout ── */
.main-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 56px);
}

/* ── Left Panel ── */
.left-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--bg-surface);
  background: var(--bg-page);
  overflow: hidden;
}

/* Input Area — takes half the left panel */
.input-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border-bottom: 1px solid var(--bg-surface);
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 20px;
  border-bottom: 1px solid var(--bg-surface);
}
.panel-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.toolbar-actions {
  display: flex;
  gap: 6px;
}

.btn {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 32px;
}
.btn:hover { background: var(--border-default); color: var(--text-primary); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue-button), var(--blue-pressed));
  border-color: var(--blue-button);
  color: #fff;
  box-shadow: var(--shadow-button);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--blue), var(--blue-button)); }

.mode-switch {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}
.mode-switch-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.mode-switch-option:not(:last-child) {
  border-right: 1px solid var(--border);
}
.mode-switch-option:hover:not(.active) {
  background: var(--bg-tertiary, rgba(0,0,0,0.04));
  color: var(--text-primary);
}
.mode-switch-option.active {
  background: var(--blue);
  color: #fff;
  cursor: default;
}
.mode-switch-option svg { flex-shrink: 0; }

.hl7-input-wrapper {
  flex: 1;
  position: relative;
  min-height: 0;
  display: flex;
}

.hl7-input {
  flex: 1;
  width: 100%;
  padding: var(--sp-4) 20px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.8;
  background: var(--bg-input);
  color: var(--text-primary);
  border: none;
  resize: none;
  outline: none;
  overflow-y: auto;
  min-height: 0;
}
.hl7-input::placeholder { color: var(--text-muted); }

/* Syntax-highlighted overlay (replaces textarea after parsing) */
.hl7-highlight {
  flex: 1;
  width: 100%;
  padding: var(--sp-4) 20px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.8;
  background: var(--bg-input);
  color: var(--text-primary);
  overflow-y: auto;
  cursor: text;
  min-height: 0;
}

.hl7-highlight .hl7-line {
  display: block;
  padding: 1px 0;
  border-left: 3px solid transparent;
  padding-left: var(--sp-3);
  border-radius: 2px;
  transition: background var(--transition), border-color var(--transition);
}
.hl7-highlight .hl7-line:hover {
  background: rgba(59, 130, 246, 0.04);
}
.hl7-highlight .hl7-line.line-error {
  border-left-color: var(--red);
  background: rgba(239, 68, 68, 0.06);
}
.hl7-highlight .hl7-line.line-warning {
  border-left-color: var(--amber);
  background: rgba(245, 158, 11, 0.06);
}
.hl7-highlight .hl7-line.line-active {
  background: rgba(59, 130, 246, 0.15);
  border-left: 3px solid var(--blue);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
  border-radius: 3px;
}

.hl7-highlight .seg-id {
  color: var(--blue);
  font-weight: 700;
}
.hl7-highlight .hl7-pipe {
  color: var(--border-hover);
}
.hl7-highlight .hl7-field {
  color: var(--text-primary);
  border-radius: 2px;
  transition: background var(--transition);
}
.hl7-highlight .hl7-field.field-error {
  background: rgba(239, 68, 68, 0.2);
  border-bottom: 2px solid var(--red);
  color: var(--red);
}
.hl7-highlight .hl7-field.field-warning {
  background: rgba(245, 158, 11, 0.15);
  border-bottom: 2px solid var(--amber);
}
.hl7-highlight .hl7-field.field-flash {
  animation: field-flash 2s ease;
  border-radius: 3px;
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
.hl7-highlight .hl7-field.field-flash.field-error {
  outline-color: var(--red);
}
.hl7-highlight .hl7-field.field-flash.field-warning {
  outline-color: var(--amber);
}
@keyframes field-flash {
  0%, 25% { background: rgba(59, 130, 246, 0.45); }
  50% { background: rgba(59, 130, 246, 0.15); }
  75% { background: rgba(59, 130, 246, 0.35); }
  100% { background: rgba(59, 130, 246, 0.12); }
}

.input-error {
  display: none;
  padding: var(--sp-2) 20px;
  background: var(--red-bg);
  border-top: 1px solid var(--red-border);
  color: var(--red);
  font-size: var(--text-xs);
  font-weight: 600;
}
.input-error.visible { display: flex; align-items: center; gap: var(--sp-2); }
.input-error a { color: var(--blue); text-decoration: none; margin-left: var(--sp-2); }

/* ── AI Chat Section — same width as input above ── */
.ai-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-page), #131c31);
  min-height: 0;
}

.ai-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  border-bottom: 1px solid var(--bg-surface);
  flex-shrink: 0;
}
.ai-avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--purple-start), var(--purple-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-base);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.ai-title { font-size: var(--text-sm); font-weight: 600; }
.ai-subtitle { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3) 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.msg {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
}
.msg.user {
  background: #1e3a5f;
  border: 1px solid var(--blue-pressed);
  align-self: flex-end;
  color: #bfdbfe;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
}
.msg.ai {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  align-self: flex-start;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
}
.msg.ai strong { color: var(--blue); }
.msg.error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  align-self: flex-start;
}

.msg .source {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.source-chips {
  display: flex;
  gap: var(--sp-1);
  margin-top: 6px;
  flex-wrap: wrap;
}
.source-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px var(--sp-2);
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-sm);
  color: var(--blue);
  font-weight: 600;
}

.suggested-questions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-top: var(--sp-2);
}
.suggested-q {
  font-size: var(--text-xs);
  color: var(--blue);
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  border: none;
  background: none;
  text-align: left;
  font-family: var(--font-ui);
}
.suggested-q:hover { background: var(--blue-bg); }

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.typing-indicator span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.ai-input-bar {
  padding: var(--sp-3) 20px;
  display: flex;
  gap: var(--sp-2);
  border-top: 1px solid var(--bg-surface);
  flex-shrink: 0;
  align-items: center;
}
.ai-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-logo);
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.ai-input:focus { border-color: var(--blue); }
.ai-input::placeholder { color: var(--text-muted); }
.ai-input:disabled { opacity: 0.5; cursor: not-allowed; }

.anonymize-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  user-select: none;
  flex-shrink: 0;
}
.anonymize-toggle:hover { color: var(--text-secondary); }
.anonymize-toggle input { accent-color: var(--blue); }
.anonymize-toggle.active { color: var(--green); }

/* ── Right Panel ── */
.right-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  overflow-y: auto;
}

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--bg-surface);
  background: var(--bg-page);
  padding: 0 var(--sp-3);
  flex-shrink: 0;
}
.tab {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-ui);
}
.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue-button);
}
.tab.tab-alert {
  color: var(--red);
  border-bottom-color: var(--red);
  animation: tab-pulse 0.5s ease 3;
}
.tab.tab-warn {
  color: var(--amber);
  border-bottom-color: var(--amber);
  animation: tab-pulse 0.5s ease 2;
}
@keyframes tab-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
}
.tab-content.active { display: flex; flex-direction: column; }

/* Parsed Segments View */
.parsed-view { padding: var(--sp-2) 0; }

.segment-card {
  margin: 6px var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.segment-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.seg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(59, 130, 246, 0.06);
  border-bottom: 1px solid var(--border-default);
}
.seg-badge {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: var(--text-sm);
  color: var(--blue);
  background: rgba(59, 130, 246, 0.15);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--blue-border);
}
.seg-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.seg-fields {
  padding: 10px 14px;
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: var(--sp-1) 14px;
  font-size: 12.5px;
}
.f-key {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}
.f-val { color: var(--text-primary); word-break: break-word; }
.f-val.accent { color: var(--gold); font-weight: 600; }
.f-val.highlight {
  background: var(--blue-bg);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  color: #93c5fd;
}
.f-val.ok { color: var(--green); font-weight: 600; }
.f-val.abnormal { color: var(--red); font-weight: 600; }
.f-val.bold { font-weight: 700; }
.f-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: var(--sp-1);
}
.f-decoded {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: var(--sp-1);
}

/* Validation View */
.validation-view { padding: var(--sp-4); }

.validation-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
  color: var(--text-muted);
  text-align: center;
  gap: var(--sp-2);
}
.validation-empty .check-icon {
  font-size: 32px;
  color: var(--green);
}

.validation-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
}
.validation-item.error { border-left: 3px solid var(--red); }
.validation-item.warning { border-left: 3px solid var(--amber); }
.validation-item.info { border-left: 3px solid var(--blue); }

.severity-icon {
  font-size: var(--text-base);
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.validation-item.error .severity-icon { color: var(--red); }
.validation-item.warning .severity-icon { color: var(--amber); }
.validation-item.info .severity-icon { color: var(--blue); }

.validation-detail {
  flex: 1;
}
.validation-field {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.validation-msg {
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-top: 2px;
}

.empty-state-icon {
  font-size: 48px;
  opacity: 0.4;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  color: var(--text-muted);
  gap: var(--sp-4);
  flex: 1;
}
.empty-state h3 {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  font-weight: 700;
}
.empty-state p {
  font-size: var(--text-sm);
  max-width: 320px;
  line-height: 1.6;
}

/* Status Bar */
.status-bar {
  padding: var(--sp-2) 20px;
  border-top: 1px solid var(--bg-surface);
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  background: var(--bg-page);
  flex-shrink: 0;
}
.status-ok { color: var(--green); display: flex; align-items: center; gap: 5px; }
.status-error { color: var(--red); font-weight: 600; }
.status-warn { color: var(--amber); font-weight: 600; }

/* ══ About Modal ══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--sp-6);
  animation: modal-fade-in 200ms ease;
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  animation: modal-slide-up 250ms ease;
}
@keyframes modal-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-surface); color: var(--text-primary); }

.about-header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--border-default);
}
.about-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.about-tagline {
  font-size: var(--text-sm);
  color: var(--blue);
  font-weight: 600;
  margin-top: 2px;
}

.about-body {
  padding: var(--sp-6);
}
.about-body p {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}
.about-body h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
  margin-top: var(--sp-6);
}

.about-services {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.about-services li {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--blue);
}
.about-services li strong {
  color: var(--text-primary);
}

.about-cta-section {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-default);
}

/* Contact (direct email button) */

.btn-cta {
  align-self: flex-start;
  padding: 10px 28px;
  font-size: var(--text-base);
  margin-top: var(--sp-2);
}
.btn-email {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  font-size: 15px;
  padding: 12px 32px;
  margin-top: var(--sp-4);
}

.about-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-default);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  justify-content: center;
}

@media (max-width: 768px) {
  .modal-overlay { padding: var(--sp-3); }
  .modal-content { max-height: 95vh; }
  .about-header { padding: var(--sp-4); }
  .about-body { padding: var(--sp-4); }
  .form-row { flex-direction: column; }
}

/* ══ Wishlist Modal ══ */
.wishlist-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-ui);
  line-height: 1.5;
}
.wishlist-charcount {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: var(--sp-1);
}
.wishlist-history {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-default);
}
.wishlist-history h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--sp-2);
}
.wishlist-item {
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-2);
  font-size: var(--text-xs);
}
.wishlist-item-text {
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
  line-height: 1.4;
}
.wishlist-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wishlist-item-date {
  color: var(--text-muted);
  font-size: 10px;
}
.wishlist-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}
.wishlist-status-badge.new { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); }
.wishlist-status-badge.read { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border-default); }
.wishlist-status-badge.contacted { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.wishlist-status-badge.built { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.wishlist-empty {
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-align: center;
  padding: var(--sp-3);
}

/* ══ Examples Modal ══ */
.examples-modal-content {
  max-width: 780px;
}

.examples-header {
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--border-default);
}
.examples-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.examples-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
  margin-top: var(--sp-1);
}

.examples-body {
  padding: var(--sp-6);
}

.examples-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.example-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: all var(--transition);
}
.example-card:hover {
  border-color: var(--blue-border);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.example-card-top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.example-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.example-type {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: var(--text-sm);
  color: var(--blue);
  background: rgba(59, 130, 246, 0.15);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--blue-border);
}

.example-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

.example-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.example-load-btn {
  margin-top: var(--sp-2);
  align-self: flex-start;
  font-size: var(--text-xs);
  padding: 6px 18px;
  min-height: 30px;
}

@media (max-width: 640px) {
  .examples-grid {
    grid-template-columns: 1fr;
  }
  .examples-body {
    padding: var(--sp-4);
  }
  .examples-header {
    padding: var(--sp-4);
  }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .seg-fields {
    grid-template-columns: 1fr;
  }
  .f-key { margin-bottom: -2px; }
  .topnav { padding: 0 var(--sp-4); }
}

@media (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 48px);
  }
  .left-panel { border-right: none; border-bottom: 1px solid var(--bg-surface); }
  .hl7-input { min-height: 80px; }
  .right-panel { min-height: 50vh; }
  .nav-links { display: none; }
  .privacy-badge .badge-text { display: none; }
  .privacy-badge::after { content: 'Private'; font-size: 11px; }
  .product-name { display: none; }
  .logo-divider { display: none; }
  .topnav { height: 48px; }
  .ai-section { max-height: none; }
}

/* ── Wishlist Trigger Button ── */
.wishlist-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  padding: 3px var(--sp-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
  font-family: var(--font-ui);
}
.wishlist-trigger:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.08);
}

/* ── AI Disclaimer Badge ── */
.ai-disclaimer {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  padding: 3px var(--sp-2);
  border-radius: var(--radius-sm);
  cursor: help;
  flex-shrink: 0;
}

/* ── Auth UI ── */
.nav-auth {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.nav-auth-signin {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.nav-auth-signin:hover { background: var(--bg-surface); color: var(--text-primary); }
.btn-sm {
  font-size: var(--text-xs);
  padding: 5px 14px;
  min-height: 28px;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.nav-username {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.nav-user a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-user a:hover { color: var(--text-primary); background: var(--bg-surface); }

/* Auth Modals */
.modal-auth {
  max-width: 420px;
}
.auth-modal-header {
  padding: var(--sp-6) var(--sp-6) var(--sp-3);
  text-align: center;
}
.auth-modal-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}
.auth-modal-header p {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.auth-form {
  padding: var(--sp-3) var(--sp-6) var(--sp-6);
}
.form-group {
  margin-bottom: var(--sp-4);
}
.form-group label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--sp-1);
}
.form-group .optional {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}
.auth-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.auth-input:focus { border-color: var(--blue); }
.auth-input::placeholder { color: var(--text-muted); }

.password-wrapper {
  position: relative;
}
.password-wrapper .auth-input {
  padding-right: 40px;
}
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.password-toggle:hover, .password-toggle.active { color: var(--blue); }

.auth-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}
.auth-success {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}
.auth-resend {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}
.auth-resend a {
  color: var(--blue-button);
  text-decoration: underline;
  cursor: pointer;
}
.auth-resend a:hover {
  color: var(--blue-button-hover);
}

.btn-full {
  width: 100%;
  padding: 12px;
  font-size: var(--text-base);
  margin-bottom: var(--sp-3);
}
.btn-full:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-consent {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--sp-3);
  text-align: center;
}
.auth-consent a { color: var(--blue); text-decoration: none; }
.auth-consent a:hover { text-decoration: underline; }

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
}
.auth-links a {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.auth-links a:hover { color: var(--blue); }

/* Usage Meter */
.usage-meter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.usage-bar {
  width: 48px;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 300ms ease, background 300ms ease;
}
.usage-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Toast */
.auth-toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 2000;
  animation: toast-in 300ms ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.auth-toast.success { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }
.auth-toast.info { background: var(--blue-bg); border: 1px solid var(--blue-border); color: var(--blue); }
.auth-toast.error { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red); }
@keyframes toast-in {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}
.hamburger:hover { background: var(--bg-surface); }
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all var(--transition);
}
.hidden-desktop { display: none; }

@media (max-width: 768px) {
  .hidden-desktop { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    flex-direction: column;
    padding: var(--sp-2);
    min-width: 180px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  .nav-links.mobile-open { display: flex; }
  .nav-links a { padding: 10px 14px; }
  .nav-auth { flex-direction: column; width: 100%; }
  .nav-auth-signin { text-align: center; }
  .nav-auth .btn-sm { width: 100%; text-align: center; }
  .nav-user { flex-direction: column; width: 100%; padding: var(--sp-2); }
  .usage-meter { order: -1; }
}

/* ── Site Footer ── */
.site-footer {
  padding: var(--sp-3) var(--sp-6);
  border-top: 1px solid var(--border-default);
  background: var(--bg-page);
  text-align: center;
  flex-shrink: 0;
}
.footer-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: var(--sp-1);
}
.footer-links {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-links a:hover {
  color: var(--blue);
}

/* ══ Docs Modal ══ */
.docs-modal {
  max-width: 800px;
}

.docs-header {
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--border-default);
}
.docs-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.docs-subtitle {
  font-size: var(--text-sm);
  color: var(--blue);
  font-weight: 600;
  margin-top: 2px;
}

/* Docs Tab Bar */
.docs-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-page);
  padding: 0 var(--sp-4);
  overflow-x: auto;
}
.docs-tab {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.docs-tab:hover {
  color: var(--text-secondary);
}
.docs-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue-button);
}

/* Docs Tab Content */
.docs-tab-content {
  display: none;
  padding: var(--sp-6);
}
.docs-tab-content.active {
  display: block;
}
.docs-intro {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
  line-height: 1.5;
}
.docs-tip {
  margin-top: var(--sp-6);
  padding: var(--sp-3) var(--sp-4);
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.docs-tip strong {
  color: var(--blue);
}
.docs-tip em {
  color: var(--text-primary);
  font-style: normal;
  font-weight: 600;
}

/* ── Getting Started: Workflow Steps ── */
.workflow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
}
.workflow-step {
  flex: 1;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.workflow-step:hover {
  border-color: var(--blue-border);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.08);
}
.workflow-step-number {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--blue-button), var(--blue-pressed));
  color: white;
  font-size: 12px;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.workflow-step-icon {
  margin-bottom: var(--sp-3);
}
.workflow-step-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}
.workflow-step-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.4;
}
.workflow-arrow {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ── How It Works: Architecture Diagram ── */
.arch-diagram {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.arch-node {
  flex: 1;
  max-width: 280px;
  padding: var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}
.arch-browser {
  border-color: var(--blue-border);
}
.arch-server {
  border-color: rgba(139, 92, 246, 0.25);
}
.arch-node-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border-default);
}
.arch-features {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-3) 0;
  flex: 1;
}
.arch-features li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: 3px 0;
  padding-left: var(--sp-4);
  position: relative;
}
.arch-features li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}
.arch-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  text-align: center;
}
.arch-badge-local {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
}
.arch-badge-secure {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: var(--purple-start);
}
.arch-connection {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}
.arch-conn-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.arch-privacy-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.arch-privacy-banner svg {
  flex-shrink: 0;
}
.arch-privacy-banner strong {
  color: var(--green);
}

/* ── HL7 Basics: Anatomy Diagram ── */
.hl7-anatomy {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.hl7-anatomy-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
}
.hl7-anatomy-msg {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 2;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: var(--sp-3);
}
.hl7a-seg {
  color: var(--blue);
  font-weight: 700;
}
.hl7a-enc {
  color: var(--amber);
  font-weight: 600;
}
.hl7a-pipe {
  color: var(--border-hover);
}
.hl7a-field {
  color: var(--text-primary);
  position: relative;
  cursor: default;
  padding: 2px 1px;
  border-radius: 2px;
  transition: background var(--transition);
}
.hl7a-field:hover {
  background: var(--blue-bg);
}
.hl7a-field:hover::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-page);
  border: 1px solid var(--blue-border);
  color: var(--blue);
  font-size: 10px;
  font-family: var(--font-sans);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.hl7-anatomy-legend {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.hl7a-legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.hl7a-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.hl7a-swatch-seg { background: var(--blue); }
.hl7a-swatch-enc { background: var(--amber); }
.hl7a-swatch-pipe { background: var(--border-hover); }
.hl7a-swatch-field { background: var(--text-primary); }

/* HL7 Key Concepts */
.hl7-concepts h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
}
.hl7-concept-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.hl7-concept {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.hl7-concept-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--blue);
  margin-bottom: var(--sp-1);
}
.hl7-concept p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.hl7-concept code {
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: var(--text-xs);
  color: var(--blue);
  font-family: var(--font-mono);
}

/* ── AI Features: Question Grid ── */
.ai-question-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.ai-question-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  color: inherit;
  font-family: inherit;
}
.ai-question-card:hover {
  border-color: var(--blue-border);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.08);
}
.ai-q-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
}
.ai-q-text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.4;
  font-weight: 500;
}
.ai-q-category {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Docs Modal Responsive ── */
@media (max-width: 768px) {
  .docs-modal { max-width: 100%; }
  .docs-tab-content { padding: var(--sp-4); }
  .workflow-steps {
    flex-direction: column;
    gap: var(--sp-3);
  }
  .workflow-step {
    max-width: 100%;
    width: 100%;
    flex-direction: row;
    text-align: left;
    padding: var(--sp-4);
    gap: var(--sp-3);
  }
  .workflow-step-number {
    position: static;
    transform: none;
    flex-shrink: 0;
  }
  .workflow-step-icon {
    margin-bottom: 0;
    flex-shrink: 0;
  }
  .workflow-arrow {
    transform: rotate(90deg);
  }
  .arch-diagram {
    flex-direction: column;
    align-items: center;
  }
  .arch-node {
    max-width: 100%;
    width: 100%;
  }
  .arch-connection {
    transform: rotate(90deg);
  }
  .hl7-concept-grid {
    grid-template-columns: 1fr;
  }
  .ai-question-grid {
    grid-template-columns: 1fr;
  }
  .hl7-anatomy-legend {
    gap: var(--sp-2);
  }
  .docs-tabs {
    padding: 0 var(--sp-2);
  }
  .docs-tab {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-xs);
  }
}

/* ── HL7 Segment Docs Tooltip ── */
.doc-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 360px;
  padding: 12px 14px;
  background: #0b1220;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.doc-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
.doc-tooltip .dt-head {
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 4px;
  font-size: 13px;
}
.doc-tooltip .dt-body {
  color: #cbd5e1;
  margin-bottom: 8px;
}
.doc-tooltip .dt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.doc-tooltip .dt-chip {
  display: inline-block;
  padding: 2px 6px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  font-size: 11px;
  color: #94a3b8;
}
.doc-tooltip .dt-example {
  color: #8494a7;
  font-size: 11px;
  margin-top: 4px;
}
.doc-tooltip .dt-example code {
  background: #1e293b;
  padding: 1px 5px;
  border-radius: 3px;
  color: #4ade80;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}
.f-key {
  cursor: help;
}
.seg-badge[data-doc-segment] {
  cursor: help;
}

/* ── Utility ── */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}
