/* Native portal forms & consent (EMR-style activity list) */
.pfw-root { max-width: 900px; margin: 0 auto 32px; padding: 0 12px; }
.pfw-hero {
  background: linear-gradient(135deg, #e8f0ff 0%, #f0fdf4 100%);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.pfw-hero h1 { margin: 0 0 8px; font-size: 1.35rem; font-weight: 700; color: #0f172a; }
.pfw-hero p { margin: 0; color: #475569; font-size: 0.95rem; line-height: 1.5; }
.pfw-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}
.pfw-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin: 24px 0 12px;
}
.pfw-activity {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  font-size: 0.9rem;
}
.pfw-activity th, .pfw-activity td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}
.pfw-activity th { background: #f8fafc; color: #475569; font-weight: 600; }
.pfw-activity tr:last-child td { border-bottom: none; }
.pfw-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pfw-badge-ok { background: #dcfce7; color: #166534; }
.pfw-badge-warn { background: #fef3c7; color: #92400e; }
.pfw-badge-muted { background: #f1f5f9; color: #64748b; }
.pfw-cards { display: flex; flex-direction: column; gap: 14px; }
.pfw-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15,23,42,0.04);
}
.pfw-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
}
.pfw-card-head:hover { background: #fafafa; }
.pfw-card-title { font-weight: 700; color: #0f172a; font-size: 1.05rem; margin: 0; }

/* Two-line labels (activity consent buttons only, e.g. Telehealth / Consent) */
.pfw-consent-label-twoline {
  display: inline-block;
  line-height: 1.25;
  white-space: normal;
}

/* Activity: form-name buttons — label centered in column */
.pfw-activity td:first-child {
  text-align: center;
}
.pfw-activity .pfw-btn-view {
  display: inline-block;
  width: 100px;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  text-align: center;
  white-space: normal;
  vertical-align: middle;
}
.pfw-activity .pfw-consent-label-twoline {
  text-align: center;
}
.pfw-card-sub { font-size: 0.8rem; color: #64748b; margin: 4px 0 0; }
.pfw-card-body { padding: 0 18px 18px; display: none; border-top: 1px solid #f1f5f9; }
.pfw-card.open .pfw-card-body { display: block; }
.pfw-card.open .pfw-chevron { transform: rotate(180deg); }
.pfw-chevron { transition: transform 0.2s; font-size: 0.85rem; color: #94a3b8; }
.pfw-prose { color: #334155; font-size: 0.92rem; line-height: 1.55; margin: 14px 0; }
.pfw-prose ul { margin: 8px 0; padding-left: 1.2rem; }
.pfw-field { margin: 14px 0; }
.pfw-field label { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; color: #1e293b; cursor: pointer; }
.pfw-field input[type="checkbox"] { margin-top: 3px; }
.pfw-sig-wrap { margin-top: 12px; }
.pfw-sig-wrap label { display: block; font-size: 0.8rem; font-weight: 600; color: #475569; margin-bottom: 8px; }
.pfw-sig-canvas {
  width: 100%;
  max-width: 420px;
  height: 140px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #fafafa;
  touch-action: none;
  cursor: crosshair;
}
.pfw-sig-actions { margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.pfw-btn-clear {
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #64748b;
}
.pfw-btn-clear:hover { border-color: #014EE7; color: #014EE7; }
.pfw-btn-submit {
  background: #014EE7;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.pfw-btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.pfw-btn-submit:hover:not(:disabled) { background: #3b7cf0; }
.pfw-err { color: #b91c1c; font-size: 0.85rem; margin-top: 8px; }
.pfw-legacy {
  margin-top: 28px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}
.pfw-legacy summary { cursor: pointer; font-weight: 600; color: #475569; }
.pfw-legacy iframe { width: 100%; min-height: 520px; border: none; margin-top: 12px; background: #fff; border-radius: 8px; }
.doc-upload-section h2 { font-size: 1.1rem; margin: 0 0 12px; color: #0f172a; }

.pfw-emr-intro {
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 16px;
  max-width: 52rem;
}
.pfw-emr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.pfw-emr-loading,
.pfw-emr-empty {
  color: #94a3b8;
  font-size: 0.9rem;
  margin: 8px 0;
}
.pfw-emr-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.pfw-emr-card-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.98rem;
  margin-bottom: 6px;
}
.pfw-emr-card-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 12px;
}
.pfw-btn-view {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #014EE7;
  cursor: pointer;
}
.pfw-btn-view:hover {
  background: #e8f0ff;
  border-color: #014EE7;
}

.pfw-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}
.pfw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.pfw-modal-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 900px);
  height: min(88vh, 800px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pfw-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.pfw-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}
.pfw-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 4px 8px;
}
.pfw-modal-close:hover { color: #0f172a; }
.pfw-modal-iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: none;
  background: #fff;
}

.pfw-emr-editor-modal .pfw-modal-panel.pfw-emr-editor-panel {
  display: flex;
  flex-direction: column;
  width: min(96vw, 920px);
  height: min(92vh, 900px);
  max-height: none;
}
.pfw-emr-editor-modal .pfw-modal-header {
  flex-shrink: 0;
}
.pfw-emr-readonly-banner {
  margin: 0 16px 8px;
  padding: 10px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  color: #0369a1;
  font-size: 0.9rem;
}
.pfw-emr-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 16px 12px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.pfw-btn-draft {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}
.pfw-btn-draft:hover {
  background: #e2e8f0;
}
.pfw-btn-sign {
  background: #014ee7;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
}
.pfw-btn-sign:hover {
  background: #003bb5;
}
.pfw-btn-sign:disabled,
.pfw-btn-draft:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.pfw-emr-editor-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px;
  background: #f8fafc;
}
.pfw-emr-template-wrap {
  background: #fff;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  max-width: 100%;
  line-height: 1.55;
  font-size: 0.94rem;
  color: #1e293b;
}
.pfw-emr-sig-bar {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.pfw-emr-sig-bar label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}
.pfw-emr-sig-clear {
  margin-top: 8px;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Inline signature pad (replaces img.signature in the document body; sits beside "Signature:" like HIPAA) */
.pfw-emr-template-wrap .pfw-inline-sig-wrap {
  display: inline-block;
  vertical-align: middle;
  margin: 2px 0 6px 10px;
  max-width: 100%;
}
.pfw-emr-template-wrap .pfw-inline-sig-canvas {
  display: block;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  max-width: 100%;
  height: auto;
}
.pfw-emr-template-wrap .pfw-inline-sig-clear {
  margin-top: 6px;
}
