/* === Status icons ============================================================ */
.icon-ok, .icon-fail, .icon-na {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}
.icon-ok   { border: 1.5px solid #15803d; color: #15803d; background: #f0fdf4; }
.icon-fail { border: 1.5px solid #b91c1c; color: #b91c1c; background: #fef2f2; }
.icon-na   { border: 1.5px solid #9ca3af; background: transparent; }
.icon-na::before {
  content: '';
  display: block;
  width: 8px; height: 1.5px;
  background: #9ca3af;
  border-radius: 1px;
}

/* === Disabled / waiting states ============================================== */
.lform-disabled { opacity: 0.40; cursor: pointer; }
.lform-disabled input,
.lform-disabled select,
.lform-disabled textarea,
.lform-disabled button { pointer-events: none; }
.lform-waiting { opacity: 0.55; background: #fafafa; }
.lform-waiting:hover { background: #f0f4f8; }

/* === Auto-fill badge ========================================================= */
.auto-badge {
  font-size: 13px;
  cursor: help;
  transition: opacity .2s;
  flex-shrink: 0;
}

/* === linkId tag in preview =================================================== */
.preview-linkid {
  font-family: monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--c-primary);
  background: var(--c-primary-lt);
  border-radius: 20px;
  padding: 1px 8px;
  flex-shrink: 0;
  margin-top: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.lform-item:hover .preview-linkid { background: #c9e2f9; }

/* === item.prefix badge ======================================================= */
.preview-prefix {
  font-family: monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--c-amber);
  background: var(--c-amber-lt);
  border-radius: 20px;
  padding: 1px 8px;
  flex-shrink: 0;
  margin-top: 3px;
  white-space: nowrap;
}

/* === Preview helpers ========================================================= */
.preview-no-visible   { color: #999; font-size: 13px; padding: 12px; }
.preview-icon-ph      { width: 20px; flex-shrink: 0; display: inline-block; margin-top: 1px; }
.preview-row--pointer { cursor: pointer; }

/* === Preview → builder navigation icon ===================================== */
.preview-nav-btn {
  flex-shrink: 0;
  width: 24px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.2;
  transition: opacity 0.15s, background 0.15s;
  color: var(--c-primary);
  user-select: none;
  margin-top: 1px;
}
.lform-item:hover .preview-nav-btn       { opacity: 0.7; }
.lform-item:hover .preview-nav-btn:hover { opacity: 1; background: #e8f0fe; }
.preview-label--dim   { color: #aaa; }

/* ======================================================================
   Patient View — .patient-view on #lform
   Clean questionnaire form, no builder chrome.
   ====================================================================== */
.patient-view {
  background: #fff;
  box-shadow: 0 1px 12px rgba(0,0,0,0.07);
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.patient-view .lform-item {
  padding: 16px 24px;
  gap: 14px;
  border-bottom: 1px solid #f3f4f6;
  transition: none;
  cursor: default;
}
.patient-view .lform-item:hover { background: #fff; }
.patient-view .lform-item--invalid {
  border-left: 3px solid #ef4444;
  background: #fef2f2;
}
.patient-view .lform-item--invalid:hover { background: #fef2f2; }
.patient-view .lform-item.success,
.patient-view .lform-item.error {
  background: #fff;
  border-left: none;
}
.patient-view .preview-nested {
  border-left: none;
  margin-left: 0;
  padding-left: 24px;
  background: transparent;
}
.patient-view .preview-nested .lform-item {
  font-size: 14px;
  padding: 12px 24px;
}
.patient-view .group-label {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.01em;
  padding: 4px 0 2px;
}
.patient-view .display-info-label {
  font-size: 14px;
  color: #6b7280;
}
.patient-view .preview-required-star { font-size: 14px; }
.patient-view .preview-linkid,
.patient-view .preview-prefix,
.patient-view .preview-logic-badge,
.patient-view .preview-optional-badge,
.patient-view .preview-condition-hint,
.patient-view .preview-constraint-badge,
.patient-view .preview-meta-badge { margin-top: 1px; }
.patient-view .preview-nav-btn { display: none; }
.patient-view .preview-prefix {
  font-size: 14px;
  color: #374151;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}
.patient-view .preview-calc-value {
  font-size: 14px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 2px 10px;
}
.patient-view .preview-collapse-toggle {
  color: #9ca3af;
  font-size: 11px;
}
.patient-view .preview-collapse-toggle:hover { color: #374151; }
.patient-view input[type="text"],
.patient-view input[type="number"],
.patient-view input[type="date"],
.patient-view input[type="url"],
.patient-view textarea,
.patient-view select {
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  min-width: 180px;
}
.patient-view input[type="text"]:focus,
.patient-view input[type="number"]:focus,
.patient-view input[type="date"]:focus,
.patient-view input[type="url"]:focus,
.patient-view textarea:focus,
.patient-view select:focus {
  outline: none;
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.patient-view input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4f46e5;
}
.patient-view .preview-readonly-value {
  font-size: 14px;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 10px;
}

/* === No-badges mode ========================================================== */
/* Activated by .preview--no-badges class on #lform */
.preview--no-badges .preview-optional-badge,
.preview--no-badges .preview-required-star,
.preview--no-badges .preview-logic-badge,
.preview--no-badges .preview-condition-hint,
.preview--no-badges .preview-constraint-badge,
.preview--no-badges .preview-meta-badge,
.preview--no-badges .preview-short-text-badge,
.preview--no-badges .auto-badge { display: none; }

/* linkId and prefix: strip badge styling, show as plain text */
.preview--no-badges .preview-linkid,
.preview--no-badges .preview-prefix {
  background: none;
  border: none;
  color: var(--c-text-2);
  font-size: 11px;
  font-weight: normal;
  padding: 0;
  border-radius: 0;
}

/* === View options (independent toggles) ===================================== */
/* Hide linkId when option is unchecked */
.preview--no-linkid .preview-linkid {
  display: none;
}

/* Hide prefix when option is unchecked */
.preview--no-prefix .preview-prefix {
  display: none;
}

/* Hide hidden items when option is unchecked */
.preview--no-hidden [data-hidden="true"] {
  display: none;
}

/* === FHIR JSON view ========================================================= */
.fhir-json-view {
  margin: 0;
  padding: 18px 20px;
  overflow: auto;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Menlo', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: var(--r);
  border: 1px solid #1e293b;
  box-shadow: var(--shadow);
  white-space: pre;
  tab-size: 2;
  /* fill right panel just like preview-card */
  min-height: 100%;
}
/* JSON syntax tokens */
.jv-k    { color: #93c5fd; }           /* object key       — light blue  */
.jv-s    { color: #86efac; }           /* string value     — light green */
.jv-n    { color: #fbbf24; }           /* number           — amber       */
.jv-b    { color: #c4b5fd; }           /* boolean          — violet      */
.jv-null { color: #94a3b8; font-style: italic; } /* null  — slate grey  */
/* Search marks inside JSON view */
.fhir-json-view mark.search-match {
  background: rgba(251,191,36,.35);
  color: inherit;
  border-radius: 2px;
  outline: 1px solid rgba(251,191,36,.6);
}
.fhir-json-view mark.search-match--active {
  background: rgba(251,191,36,.75);
  outline: 1px solid #fbbf24;
}

/* calc-badge: hide entirely in no-badges mode */
.preview--no-badges .calc-badge { display: none; }

