/* ============================================================
   REPORT TYPE BUILDER — the Report module's "Report Types" tab.
   Field rows, the type cards on the list, and the live preview.
============================================================ */

/* ----- Field pills (list cards + template picker) ----- */
.rt-field-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.rt-field-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--text2);
  font-size: 0.78rem;
  line-height: 1.4;
}
.rt-field-pill em {
  font-style: normal;
  color: var(--text3);
  font-size: 0.72rem;
}

.rt-template { transition: border-color 0.15s, transform 0.15s; }
.rt-template:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ----- One field being edited ----- */
.rt-field-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.rt-field-grip {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg2);
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 22px; /* sits level with the first input, not its label */
}
.rt-field-main { flex: 1; min-width: 0; }
.rt-field-actions-col {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
}
.rt-field-actions-col .icon-btn {
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
  line-height: 1;
}
.rt-field-actions-col .icon-btn[disabled] { opacity: 0.3; cursor: default; }

.rt-field-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

/* A checkbox with a sentence beside it — the app's default label styling is
   small-caps, which is right for a field caption and wrong here. */
.rf-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text2);
  margin: 0;
}
.rf-check input { accent-color: var(--accent); flex: none; margin: 0; }
.rf-check.is-disabled { opacity: 0.45; cursor: not-allowed; }
.rf-check.is-disabled input { cursor: not-allowed; }

/* Required marker on a field label. */
.rf-req { color: var(--accent); font-weight: 700; }

/* The preview renders live form markup; nothing in it should invite a click. */
#rtPreview .form-card { pointer-events: none; }
#rtPreview .form-card input,
#rtPreview .form-card textarea,
#rtPreview .form-card select { background: var(--bg2); }

@media (max-width: 720px) {
  .rt-field-row { flex-wrap: wrap; }
  .rt-field-grip { margin-top: 0; }
  .rt-field-actions-col {
    flex-direction: row;
    margin-top: 4px;
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================================
   RECOVERED REPORT SECTIONS

   A report keeps the labels it was written with, so a draft whose report type
   was since deleted or switched off still opens, reads and sends correctly.
   These mark that state without making it look like an error — the content is
   perfectly fine, it is only the template behind it that has gone.
============================================================ */
.report-type-card--recovered .report-type-label {
  border-style: dashed;
  opacity: 0.85;
}
.report-type-card--recovered .report-type-desc {
  color: var(--status-draft);
  font-style: italic;
}
.rf-recovered-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--status-draft);
  background: var(--bg2);
  color: var(--text2);
  font-size: 0.85rem;
  line-height: 1.5;
}
