/* =========================================================
   Survey Platform design system
   - Calm, neutral base so any client's logo and colour fit (white label).
   - --brand-primary comes from the organization (set in _Layout); IRC green by default.
   ========================================================= */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../lib/plex/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../lib/plex/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../lib/plex/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}

:root {
  /* Base palette */
  --ink: #17212b;          /* main text */
  --muted: #5a6573;        /* secondary text */
  --paper: #f4f6f5;        /* page background, faintly green-grey */
  --surface: #ffffff;      /* panels */
  --line: #dde3e0;         /* borders */
  --danger: #b42318;

  /* Brand (overridden per organization) */
  --brand: var(--brand-primary, #0e7a46);
  --brand-text: var(--brand-primary-text, #ffffff);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-strong: color-mix(in srgb, var(--brand) 82%, black);

  --radius-control: 6px;
  --radius-panel: 10px;
  --sidebar-width: 248px;

  /* Bootstrap hooks */
  /* --brand-font is set per organization in _Base.cshtml; IBM Plex Sans otherwise. */
  --bs-body-font-family: var(--brand-font, "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
  --bs-body-font-size: 0.9375rem; /* 15px */
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-link-color-rgb: 14, 122, 70;
  --bs-border-radius: var(--radius-control);
}

body {
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

a {
  color: var(--brand-strong);
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.text-muted {
  color: var(--muted) !important;
}

/* ---------- Buttons ---------- */
.btn {
  font-weight: 500;
  border-radius: var(--radius-control);
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-color: var(--brand-text);
  --bs-btn-hover-bg: var(--brand-strong);
  --bs-btn-hover-border-color: var(--brand-strong);
  --bs-btn-hover-color: var(--brand-text);
  --bs-btn-active-bg: var(--brand-strong);
  --bs-btn-active-border-color: var(--brand-strong);
  --bs-btn-active-color: var(--brand-text);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-disabled-color: var(--brand-text);
  --bs-btn-focus-shadow-rgb: 14, 122, 70;
}

.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--paper);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: #c4ccc8;
  --bs-btn-active-bg: var(--paper);
  --bs-btn-active-color: var(--ink);
}

/* ---------- Forms ---------- */
.form-label {
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-control,
.form-select {
  border-color: var(--line);
  border-radius: var(--radius-control);
  padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

.form-text {
  color: var(--muted);
}

.field-validation-error,
.text-danger {
  color: var(--danger) !important;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 1.5rem;
}

.panel + .panel {
  margin-top: 1.25rem;
}

.panel-title {
  font-size: 1.0625rem;
  margin-bottom: 0.25rem;
}

.panel-intro {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* ---------- App shell (logged in) ---------- */
.app-shell {
  min-height: 100vh;
}

@media (min-width: 992px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
  }
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
}

@media (min-width: 992px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

.sidebar .offcanvas-body {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
}

.sidebar-brand img {
  max-height: 40px;
  max-width: 100%;
}

.sidebar-section {
  padding: 1rem 0.75rem 0.25rem;
}

.sidebar-heading {
  padding: 0 0.5rem 0.35rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-control);
  color: var(--ink);
  text-decoration: none;
  position: relative;
}

.sidebar-link i {
  font-size: 1.05rem;
  color: var(--muted);
}

.sidebar-link:hover {
  background: var(--paper);
  color: var(--ink);
}

.sidebar-link.active {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 500;
}

.sidebar-link.active i {
  color: var(--brand);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.sidebar-link.is-upcoming {
  color: var(--muted);
  cursor: default;
}

.sidebar-link.is-upcoming:hover {
  background: none;
}

.soon-tag {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.5rem;
}

.app-main {
  min-width: 0; /* lets wide tables scroll instead of stretching the grid */
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 72px;
  padding: 0.75rem 2rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-title {
  font-size: 1.25rem;
  margin: 0;
}

.topbar .user-menu {
  margin-left: auto;
}

.user-menu .btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
}

.user-menu .btn:hover,
.user-menu .btn[aria-expanded="true"] {
  border-color: var(--line);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
  font-size: 0.875rem;
}

.app-content {
  padding: 2rem;
  max-width: 1080px;
}

@media (max-width: 575.98px) {
  .topbar,
  .app-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ---------- Dashboard: setup steps ---------- */
.setup-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.setup-step {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.setup-step:first-child {
  border-top: 0;
  padding-top: 0.25rem;
}

.step-marker {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
}

.setup-step.is-done .step-marker {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-text);
}

.setup-step.is-done .step-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line);
}

.step-title {
  font-weight: 500;
  margin: 0;
}

.step-detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Dashboard: modules ---------- */
.module-list {
  display: grid;
  gap: 0;
}

.module {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.module:first-child {
  border-top: 0;
  padding-top: 0.25rem;
}

.module-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--muted);
  font-size: 1.15rem;
}

.module h3 {
  font-size: 1rem;
  margin: 0 0 0.15rem;
}

.module p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Auth + public pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-text);
  font-size: 1.1rem;
}

.auth-panel {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 2rem;
}

.auth-panel h1 {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.auth-panel .lead-text {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--muted);
}

.auth-state-icon {
  font-size: 2rem;
  color: var(--brand);
  line-height: 1;
  margin-bottom: 0.75rem;
}

.auth-state-icon.is-problem {
  color: var(--danger);
}

/* Public home */
.public-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.public-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 2rem;
}

.public-header .actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.public-hero {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 3rem 2rem 4rem;
}

.public-hero-inner {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 3rem;
}

@media (min-width: 992px) {
  .public-hero-inner {
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
  }
}

.public-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 16ch;
  margin-bottom: 1rem;
}

.public-hero .intro {
  font-size: 1.0625rem;
  color: var(--muted);
  max-width: 46ch;
  margin-bottom: 1.75rem;
}

.workflow {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
}

.workflow li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--line);
}

.workflow li:first-child {
  border-top: 0;
}

.workflow i {
  font-size: 1.35rem;
  color: var(--brand);
}

.workflow h2 {
  font-size: 1rem;
  margin: 0 0 0.15rem;
}

.workflow p {
  margin: 0;
  color: var(--muted);
}

.public-footer {
  padding: 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Misc ---------- */
.brand-logo-preview {
  max-height: 60px;
  max-width: 240px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

.content-narrow {
  max-width: 640px;
}

/* ---------- Fixes from screenshot review ---------- */

/* Inputs are white on the grey page; read-only fields stay grey so they look fixed. */
.form-control,
.form-select {
  background-color: var(--surface);
}

.form-control[readonly] {
  background-color: var(--paper);
  color: var(--muted);
}

/* Validation summary: a single message doesn't need a bullet. */
.validation-summary-errors ul {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

/* Status message hugs its text instead of spanning the page. */
.status-message {
  display: inline-flex;
}

/* Mobile menu: narrower drawer with a close button. */
.sidebar.offcanvas-lg {
  --bs-offcanvas-width: 280px;
}

.sidebar-close {
  margin-left: auto;
}

@media (max-width: 575.98px) {
  .panel {
    padding: 1.25rem;
  }

  .module {
    grid-template-columns: 2.5rem 1fr;
  }

  .module .soon-tag {
    grid-column: 2;
    justify-self: start;
    margin-left: 0;
  }
}

/* ---------- Legal pages ---------- */
.legal-links {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.legal-links a {
  color: var(--muted);
}

.legal-page {
  max-width: 72ch;
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
}

.legal-page h1 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.legal-page h2 {
  font-size: 1.125rem;
  margin-top: 2rem;
}

.legal-page li {
  margin-bottom: 0.35rem;
}

.legal-nav {
  display: flex;
  gap: 1.25rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 575.98px) {
  .legal-page {
    padding: 1rem 1rem 3rem;
  }
}

/* Bootstrap switches focused inputs to the page background; keep them white. */
.form-control:focus,
.form-select:focus {
  background-color: var(--surface);
}

/* =========================================================
   Surveys: list, builder, responses
   ========================================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.status-badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.status-live {
  color: var(--brand-strong);
  border-color: color-mix(in srgb, var(--brand) 35%, white);
  background: var(--brand-soft);
}

.status-closed {
  color: #8a5a00;
  border-color: #ecd9a8;
  background: #fdf7e7;
}

.survey-table th {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}

.survey-table td,
.survey-table th {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.survey-table tbody tr:last-child td {
  border-bottom: 0;
}

.answer-cell {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-panel);
}

.empty-state i {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.builder-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.share-link {
  max-width: 28rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
}

details.panel > summary {
  cursor: pointer;
  margin: 0;
}

.builder-page {
  margin: 1.5rem 0;
}

.builder-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 1rem;
}

.question-card:target {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}

.question-summary {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.question-code {
  flex: none;
  min-width: 2.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}

.question-text {
  margin: 0;
  font-weight: 500;
}

.question-meta {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.required-mark {
  color: var(--danger);
  margin-left: 0.15rem;
}

.question-actions {
  display: flex;
  gap: 0.15rem;
  flex: none;
}

.btn-icon {
  padding: 0.25rem 0.45rem;
  color: var(--muted);
  border: 1px solid transparent;
}

.btn-icon:hover:not(:disabled) {
  border-color: var(--line);
  color: var(--ink);
}

.option-preview {
  list-style: none;
  margin: 0.6rem 0 0 3.35rem;
  padding: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.option-value {
  display: inline-block;
  min-width: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.question-editor {
  margin: 0.75rem 0 0 3.35rem;
}

.question-editor > summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--brand-strong);
  margin-bottom: 0.75rem;
}

.add-question,
.add-language {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.add-question .form-select,
.add-language .form-select {
  max-width: 16rem;
}

.danger-zone {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.danger-zone > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.875rem;
}

@media (max-width: 575.98px) {
  .option-preview,
  .question-editor {
    margin-left: 0;
  }
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-label {
  color: var(--muted);
  font-size: 0.875rem;
}

/* =========================================================
   Respondent survey page (mobile first)
   ========================================================= */
.respondent-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.respondent-header {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 64px;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.respondent-logo {
  max-height: 40px;
  max-width: 200px;
}

.respondent-main {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.respondent-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8125rem;
}

.respondent-footer a {
  color: var(--muted);
}

.preview-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-control);
  background: #fdf7e7;
  border: 1px solid #ecd9a8;
  font-size: 0.875rem;
}

.survey-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.survey-progress span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.survey-title {
  font-size: 1.5rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.survey-intro {
  color: var(--muted);
  white-space: pre-line;
  margin-bottom: 1.5rem;
}

.survey-questions {
  margin-top: 1rem;
}

.survey-question {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.survey-question.has-error {
  border-color: var(--danger);
}

.survey-question fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.question-label {
  display: block;
  float: none;
  width: 100%;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.question-help {
  color: var(--muted);
  font-size: 0.875rem;
  margin: -0.25rem 0 0.75rem;
}

.question-error {
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0.6rem 0 0;
}

.choice-list {
  display: grid;
  gap: 0.5rem;
}

/* Big tap targets: the whole row is clickable. */
.choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  cursor: pointer;
  background: var(--surface);
}

.choice:hover {
  border-color: #c4ccc8;
}

.choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.choice input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand);
  flex: none;
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.rating-scale {
  display: grid;
  grid-template-columns: repeat(var(--points), minmax(0, 1fr));
  gap: 0.35rem;
}

.rating-point {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 500;
  background: var(--surface);
}

.rating-point input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.rating-point:has(input:checked) {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-text);
}

.rating-point:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.rating-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.number-input {
  max-width: 12rem;
}

.survey-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.survey-nav .btn {
  min-width: 8rem;
}

.survey-page-count {
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
  margin-top: 1rem;
}

.survey-end {
  text-align: center;
  padding: 3rem 0;
}

/* Link-style buttons follow the brand colour like normal links. */
.btn-link {
  --bs-btn-color: var(--brand-strong);
  --bs-btn-hover-color: var(--brand-strong);
  --bs-btn-active-color: var(--brand-strong);
  font-weight: 400;
  font-size: inherit;
}

/* Page title in the builder */
.page-title-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.page-title-form .form-control {
  max-width: 28rem;
}

.page-title-text {
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.35rem;
}

.page-title-text::before {
  content: "· ";
}

.builder-page h2 {
  scroll-margin-top: 1rem;
}

/* Leave room above the error when the page jumps to it. */
.question-error-alert {
  scroll-margin-top: 6rem;
}

/* Font preview on the branding page */
.font-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  background: var(--surface);
}

.font-preview-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

/* Respondent language switcher */
.language-switcher {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.language-switcher a,
.language-switcher span {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.language-switcher .active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 500;
}

/* Languages panel and translate screen */
.language-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.language-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.language-list li:first-child {
  border-top: 0;
}

.translation-bar {
  height: 4px;
  max-width: 16rem;
  margin: 0.35rem 0 0.15rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.translation-bar span {
  display: block;
  height: 100%;
  background: var(--brand);
}

.translate-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.translate-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.translate-row.is-missing .form-control {
  border-color: #e3c78a;
  background: #fffcf3;
}

.translate-label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.translate-source {
  margin: 0.15rem 0 0;
  white-space: pre-line;
}

.translate-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  padding: 1rem 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

@media (max-width: 767.98px) {
  .translate-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
}

/* ---------- Survey logic in the builder ---------- */
.logic-summary {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--brand-strong);
}

.logic-panel > summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--brand-strong);
  margin-bottom: 0.5rem;
}

.condition-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.condition-lead .form-select {
  width: auto;
}

.condition-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1.4fr) minmax(8rem, 1fr) minmax(8rem, 1.4fr) auto;
  gap: 0.4rem;
  align-items: start;
  padding: 0.5rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
}

.condition-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.75rem;
  font-size: 0.875rem;
}

.condition-number {
  max-width: 7rem;
}

.condition-option {
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  .condition-row {
    grid-template-columns: 1fr auto;
  }
  .condition-row .condition-operator,
  .condition-row .condition-value {
    grid-column: 1;
  }
}

.page-rules {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.page-rules-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.rule-list {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.rule-list li {
  margin-bottom: 0.4rem;
}
