/* Interviewer Studio — Clients and Fieldwork.
 *
 * Every colour resolves through a theme variable so these views work on
 * Aurora (dark), Daylight (light), and Papyrus without per-theme overrides.
 * Semi-transparent fills use color-mix against the theme's own text colour
 * rather than a hardcoded white or black.
 */

/* Preview gating. Anything marked .intv-preview-only stays hidden until the
 * preview-access check confirms the signed-in user holds the grant named in its
 * data-preview-feature attribute. interviewer-app.js sets one body class per
 * granted key (is-preview-<key>). Org owners/admins hold every key implicitly,
 * so they see these surfaces without any grant existing. The backend enforces
 * the same rule — this only keeps the UI honest. */
body.intv-app .intv-preview-only {
  display: none !important;
}

body.is-preview-interviewer_fieldwork.intv-app .intv-preview-only[data-preview-feature="interviewer_fieldwork"],
body.is-preview-interviewer_branding.intv-app .intv-preview-only[data-preview-feature="interviewer_branding"] {
  display: flex !important;
}

.intv-fw-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.intv-fw-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.intv-fw-header h1 {
  margin: 0 0 4px;
  font-size: 1.75rem;
  color: var(--text-color);
}

.intv-fw-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.intv-fw-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.intv-fw-back {
  background: none;
  border: none;
  padding: 0 0 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
}

.intv-fw-back:hover {
  color: var(--accent-color);
}

.intv-fw-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  justify-content: center;
  color: var(--text-secondary);
}

/* ── Summary stats ───────────────────────────────────────────────────────── */

.intv-fw-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.intv-fw-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
}

.intv-fw-stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-color);
}

.intv-fw-stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

/* ── Workspace panel card ────────────────────────────────────────────────── */

.intv-fw-panel-card {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin-bottom: 16px;
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  background: color-mix(in srgb, var(--text-color) 4%, transparent);
}

.intv-fw-panel-card strong {
  display: block;
  color: var(--text-color);
}

.intv-fw-panel-card span {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.intv-fw-panel-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.intv-fw-name {
  font-weight: 600;
  color: var(--text-color);
}

.intv-fw-num {
  font-variant-numeric: tabular-nums;
}

.intv-fw-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

.intv-fw-chip {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 4px 2px 0;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-color) 8%, transparent);
}

/* ── Progress ────────────────────────────────────────────────────────────── */

.intv-fw-progress {
  min-width: 150px;
}

.intv-fw-progress-track {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--text-color) 12%, transparent);
}

.intv-fw-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-color);
  transition: width 0.3s ease;
}

.intv-fw-progress-text {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ── Status pills ────────────────────────────────────────────────────────── */

.intv-fw-round-open,
.intv-fw-inv-completed,
.intv-fw-status-active {
  color: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color) 14%, transparent);
}

.intv-fw-round-closed,
.intv-fw-round-archived,
.intv-fw-inv-revoked,
.intv-fw-inv-expired,
.intv-fw-status-archived {
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--text-color) 8%, transparent);
}

.intv-fw-inv-bounced,
.intv-fw-status-bounced,
.intv-fw-status-unsubscribed {
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-color) 10%, transparent);
  text-decoration: line-through;
}

/* ── Dialogs ─────────────────────────────────────────────────────────────── */

.intv-fw-dialog {
  width: min(720px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--containerbackground, var(--bg-color));
  color: var(--text-color);
}

.intv-fw-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 24px 24px;
}

.intv-fw-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.intv-fw-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.intv-fw-person-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
}

.intv-fw-person em {
  color: var(--text-tertiary);
  font-style: normal;
  font-size: 0.82rem;
  margin-left: 6px;
}

/* ── Import review ───────────────────────────────────────────────────────── */

.intv-fw-import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.intv-fw-import-summary strong {
  color: var(--text-color);
  font-size: 1.1rem;
}

.intv-fw-import-table {
  max-height: 340px;
  overflow-y: auto;
}

.intv-fw-import-error td {
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-color) 6%, transparent);
}

.intv-fw-import-create td:first-child {
  border-left: 3px solid var(--accent-color);
}

@media (max-width: 720px) {
  .intv-fw-shell { padding: 16px 12px 48px; }
  .intv-fw-header { flex-direction: column; }
  .intv-fw-actions { justify-content: flex-start; }
}
