/* Informed consents — list + upload + placement */

.informed-consents {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1rem;
}

.informed-consents__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.informed-consents__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--c-base-text);
}

.informed-consents__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.informed-consents__empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--c-base-subtitle-text);
  background-color: var(--c-surface-subtle);
  border: 1px dashed var(--c-border);
  border-radius: 0.5rem;
}

.informed-consents__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--c-popup-bg);
  border: 1px solid var(--c-border);
  border-radius: 0.5rem;
}

.informed-consents__item--inherited {
  background-color: var(--c-base-subtle-bg, rgba(0, 0, 0, 0.02));
}

.informed-consents__item-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  background-color: var(--c-base-subtle-bg, rgba(0, 0, 0, 0.06));
  color: var(--c-base-subtitle-text);
  flex-shrink: 0;
}

.informed-consents__item-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.informed-consents__item-icon {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--c-base-subtitle-text);
  flex-shrink: 0;
}

.informed-consents__item-name {
  font-size: 0.9rem;
  color: var(--c-base-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.informed-consents__item-status {
  padding: 0.15rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

.informed-consents__item-status--configuring {
  background-color: rgba(249, 115, 22, 0.12);
  color: var(--c-symptom-base);
}

.informed-consents__item-status--done {
  background-color: rgba(34, 197, 94, 0.12);
  color: var(--c-severity-good);
}

.informed-consents__item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.informed-consents__item-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  background: none;
  color: var(--c-base-subtitle-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.informed-consents__item-btn:hover {
  color: var(--c-brand);
  background-color: var(--c-brand-highlight);
}

.informed-consents__item-btn--danger:hover {
  color: var(--c-error);
  background-color: rgba(239, 68, 68, 0.1);
}

.informed-consents__item-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Upload popup */

.informed-consents__upload {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 22rem;
}

.informed-consents__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  border: 2px dashed var(--c-border);
  border-radius: 0.5rem;
  background-color: var(--c-surface-subtle);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.informed-consents__dropzone:hover,
.informed-consents__dropzone--active {
  border-color: var(--c-brand);
  background-color: var(--c-brand-highlight);
}

.informed-consents__dropzone-icon {
  width: 2rem;
  height: 2rem;
  color: var(--c-base-subtitle-text);
}

.informed-consents__dropzone-prompt {
  margin: 0;
  text-align: center;
  color: var(--c-base-subtitle-text);
  font-size: 0.875rem;
}

.informed-consents__url-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.informed-consents__or {
  font-size: 0.75rem;
  color: var(--c-base-subtitle-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.informed-consents__url-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.informed-consents__url-row > :first-child {
  flex: 1;
}

.informed-consents__error {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--c-error);
  font-size: 0.875rem;
}

.informed-consents__progress {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  background-color: var(--c-brand-highlight);
  color: var(--c-brand);
  font-size: 0.875rem;
  text-align: center;
}

/* Placement modal — fullscreen */

.informed-consents__placement {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(15, 23, 42, 0.6);
  display: none;
  flex-direction: column;
}

.informed-consents__placement-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background-color: var(--c-popup-bg);
  border-bottom: 1px solid var(--c-border);
}

.informed-consents__placement-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--c-base-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.informed-consents__placement-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.informed-consents__placement-close {
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  color: var(--c-base-subtitle-text);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
}

.informed-consents__placement-close:hover {
  background-color: var(--c-border);
  color: var(--c-base-text);
}

.informed-consents__placement-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.informed-consents__placement-pdf {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  background-color: var(--c-surface-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.informed-consents__placement-loading {
  padding: 2rem;
  text-align: center;
  color: var(--c-base-subtitle-text);
}

.informed-consents__placement-page {
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.informed-consents__placement-canvas {
  display: block;
  background-color: white;
}

.informed-consents__placement-marker-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.informed-consents__marker {
  position: absolute;
  border: 2px solid var(--c-brand);
  background-color: rgba(59, 130, 246, 0.15);
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
}

.informed-consents__marker--selected {
  border-color: var(--c-brand-secondary);
  background-color: rgba(249, 115, 22, 0.2);
  z-index: 2;
}

.informed-consents__marker-label {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 4px);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--c-brand);
  pointer-events: none;
  white-space: nowrap;
  background-color: rgba(255, 255, 255, 0.85);
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.1;
}

.informed-consents__marker--selected .informed-consents__marker-label {
  color: var(--c-brand-secondary);
}

.informed-consents__marker-resize {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 10px;
  height: 10px;
  background-color: var(--c-brand);
  border: 1px solid white;
  cursor: nwse-resize;
  border-radius: 2px;
}

.informed-consents__marker--selected .informed-consents__marker-resize {
  background-color: var(--c-brand-secondary);
}

/* Per-kind tinting */
.informed-consents__marker--patient_signature {
  border-color: var(--c-brand);
  background-color: rgba(59, 130, 246, 0.15);
}
.informed-consents__marker--patient_signature .informed-consents__marker-label { color: var(--c-brand); }

.informed-consents__marker--team_signature {
  border-color: #16a34a;
  background-color: rgba(22, 163, 74, 0.15);
}
.informed-consents__marker--team_signature .informed-consents__marker-label { color: #16a34a; }
.informed-consents__marker--team_signature .informed-consents__marker-resize { background-color: #16a34a; }

.informed-consents__marker--date {
  border-color: #9333ea;
  background-color: rgba(147, 51, 234, 0.12);
}
.informed-consents__marker--date .informed-consents__marker-label { color: #9333ea; font-size: 0.65rem; }
.informed-consents__marker--date .informed-consents__marker-resize { background-color: #9333ea; }

.informed-consents__marker--time {
  border-color: #db2777;
  background-color: rgba(219, 39, 119, 0.12);
}
.informed-consents__marker--time .informed-consents__marker-label { color: #db2777; font-size: 0.65rem; }
.informed-consents__marker--time .informed-consents__marker-resize { background-color: #db2777; }

/* Kind picker popup */
.informed-consents__kind-picker {
  position: fixed;
  z-index: 1010;
  background: var(--c-popup-bg);
  border: 1px solid var(--c-border);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 12rem;
  transform: translate(-50%, 8px);
}

.informed-consents__kind-picker-btn {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--c-base-text);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.informed-consents__kind-picker-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.informed-consents__kind-picker-btn::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 0.15rem;
  flex-shrink: 0;
}

.informed-consents__kind-picker-btn--patient_signature::before { background-color: var(--c-brand); }
.informed-consents__kind-picker-btn--team_signature::before    { background-color: #16a34a; }
.informed-consents__kind-picker-btn--date::before              { background-color: #9333ea; }
.informed-consents__kind-picker-btn--time::before              { background-color: #db2777; }

.informed-consents__marker-list-kind {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--c-base-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.informed-consents__marker-list-index--patient_signature { background-color: var(--c-brand); color: white; }
.informed-consents__marker-list-index--team_signature    { background-color: #16a34a; color: white; }
.informed-consents__marker-list-index--date              { background-color: #9333ea; color: white; }
.informed-consents__marker-list-index--time              { background-color: #db2777; color: white; }

.informed-consents__placement-sidebar {
  width: 18rem;
  background-color: var(--c-popup-bg);
  border-left: 1px solid var(--c-border);
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.informed-consents__placement-sidebar-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  color: var(--c-base-text);
}

.informed-consents__marker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.informed-consents__markers-empty {
  padding: 0.75rem;
  text-align: center;
  color: var(--c-base-subtitle-text);
  font-size: 0.8125rem;
  font-style: italic;
}

.informed-consents__marker-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 0.375rem;
  background-color: var(--c-surface-subtle);
  cursor: pointer;
  font-size: 0.8125rem;
}

.informed-consents__marker-list-item:hover {
  background-color: var(--c-brand-highlight);
}

.informed-consents__marker-list-item--selected {
  background-color: var(--c-brand-highlight);
  outline: 1px solid var(--c-brand);
}

.informed-consents__marker-list-index {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background-color: var(--c-brand);
  color: var(--c-brand-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.informed-consents__marker-list-page {
  flex: 0 0 auto;
  color: var(--c-base-subtitle-text);
  font-size: 0.75rem;
}

.informed-consents__marker-list-delete {
  width: 1.5rem;
  height: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-base-subtitle-text);
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 0.25rem;
}

.informed-consents__marker-list-delete:hover {
  color: var(--c-error);
  background-color: rgba(239, 68, 68, 0.1);
}

.informed-consents__placement-help {
  margin: 0;
  font-size: 0.75rem;
  color: var(--c-base-subtitle-text);
  line-height: 1.4;
}

/* Fine-tuning section host */

.fine-tuning__informed-consents {
  padding: 1rem 0;
}

/* Patient agreements list (status badges) */
.agreement-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.agreement-status--na {
  color: var(--c-base-subtitle-text);
  background: transparent;
  font-weight: 400;
}

.agreement-status--pending {
  background-color: rgba(249, 115, 22, 0.12);
  color: #c2410c;
}

.agreement-status--signed {
  background-color: rgba(22, 163, 74, 0.12);
  color: #166534;
}

/* Signing modal */
.informed-consent-signing {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
}

.informed-consent-signing__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.informed-consent-signing__dialog {
  position: relative;
  background-color: var(--c-popup-bg);
  border-radius: 0.75rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25);
  width: min(640px, 92vw);
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.informed-consent-signing__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.informed-consent-signing__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--c-base-text);
}

.informed-consent-signing__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--c-base-subtitle-text);
}

.informed-consent-signing__help {
  margin: 0;
  font-size: 0.85rem;
  color: var(--c-base-subtitle-text);
}

.informed-consent-signing__pad-wrap {
  border: 1px dashed var(--c-border);
  border-radius: 0.5rem;
  background: white;
  height: 220px;
  overflow: hidden;
}

.informed-consent-signing__pad {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.informed-consent-signing__error {
  color: #b91c1c;
  font-size: 0.85rem;
}

.informed-consent-signing__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
