:root {
  --ink: #16211f;
  --muted: #5d6965;
  --paper: #f6f3eb;
  --surface: #ffffff;
  --line: #d8d2c4;
  --green: #1f6f55;
  --green-dark: #124938;
  --gold: #d7942a;
  --clay: #b85532;
  --sky: #b8d7d4;
  --danger: #9b2d22;
  --shadow: 0 22px 50px rgba(22, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid rgba(22, 33, 31, 0.12);
  background: rgba(246, 243, 235, 0.94);
}

.brand,
nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  min-width: 0;
  font-weight: 700;
  text-decoration: none;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid var(--green-dark);
  border-radius: 50%;
  background:
    linear-gradient(135deg, transparent 52%, var(--green-dark) 53% 59%, transparent 60%),
    radial-gradient(circle at 34% 36%, var(--gold) 0 18%, transparent 19%),
    linear-gradient(160deg, var(--sky), #e8ece3);
}

nav a,
.back-link {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

nav a:hover,
.back-link:hover {
  color: var(--green-dark);
}

.hero {
  display: grid;
  min-height: calc(100vh - 76px);
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
  padding: clamp(54px, 8vw, 100px) clamp(18px, 5vw, 64px);
}

.landing-hero {
  min-height: calc(100vh - 155px);
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.7fr);
}

.landing-hero h1 {
  max-width: 760px;
  font-size: clamp(2.8rem, 7vw, 6.4rem);
}

.access-card h2 {
  max-width: 620px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.08;
}

.access-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.help-eyebrow {
  display: inline-flex;
  position: relative;
  align-items: center;
  gap: 8px;
}

.info-bubble {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  line-height: 1;
  outline: none;
}

.info-bubble-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: none;
}

.info-bubble-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  z-index: 30;
  width: min(320px, 78vw);
  padding: 12px 14px;
  border: 1px solid rgba(22, 33, 31, 0.2);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(22, 33, 31, 0.18);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transform: translate(-50%, 6px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.info-bubble-popover::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-right: 1px solid rgba(22, 33, 31, 0.2);
  border-bottom: 1px solid rgba(22, 33, 31, 0.2);
  background: #ffffff;
  content: "";
  transform: translate(-50%, -6px) rotate(45deg);
}

.info-bubble:hover .info-bubble-popover,
.info-bubble:focus .info-bubble-popover,
.info-bubble:focus-within .info-bubble-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 22px;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.panel h1,
.login-card h1 {
  max-width: 100%;
  font-size: clamp(2rem, 6vw, 4rem);
}

.lede {
  max-width: 700px;
  margin-bottom: 34px;
  color: #32403c;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button,
.secondary-button,
.danger-button,
button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid var(--green-dark);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.button.primary,
button.primary {
  background: var(--green-dark);
  color: #ffffff;
}

.button.secondary,
.secondary-button {
  background: rgba(255, 255, 255, 0.55);
  color: var(--green-dark);
}

.danger-button {
  border-color: var(--danger);
  background: #ffffff;
  color: var(--danger);
}

.status-card,
.panel,
.login-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-card,
.panel,
.login-card {
  padding: clamp(24px, 5vw, 42px);
}

.success-panel {
  margin-bottom: 18px;
  border-color: rgba(31, 111, 85, 0.35);
}

.status-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.privacy-panel {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto 58px;
  padding-top: 42px;
  border-top: 1px solid var(--line);
}

.privacy-panel h2 {
  max-width: 760px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.privacy-panel p {
  max-width: 760px;
  color: var(--muted);
}

.narrow-page,
.admin-page {
  width: min(980px, calc(100% - 36px));
  margin: 0 auto;
  padding: 42px 0;
}

.placeholder-form {
  margin-top: 28px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(480px, 100%);
}

.form-field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

label {
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(31, 111, 85, 0.22);
  outline-offset: 1px;
  border-color: var(--green);
}

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 6px;
  background: #f7ded8;
  color: var(--danger);
  font-weight: 700;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.app-header-shell {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #dfe4ec;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 8px rgba(20, 30, 48, 0.04);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 70px;
  padding: 0 20px;
}

.app-brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: #111827;
  font-size: 1.28rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.app-brand-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.admin-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
}

.admin-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 70px;
  padding: 0 12px;
  border-bottom: 3px solid transparent;
  color: #2f3b50;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.admin-nav a.active {
  border-color: #3867f2;
  color: #172033;
}

.admin-nav a.disabled {
  color: #8b948f;
  cursor: default;
  opacity: 0.62;
  pointer-events: none;
}

.admin-nav a:hover {
  color: #124938;
}

.app-user {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  color: #233047;
  font-weight: 700;
  white-space: nowrap;
}

.app-user a {
  color: #3867f2;
  text-decoration: none;
}

.workflow-header {
  padding: 0 20px 10px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
}

.filter-bar {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.filter-bar label {
  margin-left: 4px;
}

.filter-bar input,
.filter-bar select {
  width: auto;
  min-width: 220px;
}

.admin-header h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
}

.dashboard-page .admin-header {
  margin-bottom: 18px;
}

.dashboard-page .admin-header h1 {
  max-width: none;
  font-size: clamp(2.25rem, 6vw, 6rem);
  line-height: 0.98;
  white-space: nowrap;
}

.dashboard-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-current,
.dashboard-health,
.dashboard-funnel,
.dashboard-actions-panel,
.dashboard-attention {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
}

.dashboard-current {
  padding: 24px;
}

.dashboard-current h2,
.section-heading h2 {
  margin-bottom: 16px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.12;
}

.dashboard-current dl,
.dashboard-attention dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.dashboard-current dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-current dt,
.dashboard-attention dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.dashboard-current dd,
.dashboard-attention dd {
  margin: 0;
  font-weight: 800;
}

.dashboard-health {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.dashboard-health div {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 138px;
  padding: 18px;
  text-align: center;
}

.dashboard-health div + div {
  border-left: 1px solid var(--line);
}

.dashboard-health strong {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
}

.dashboard-health span {
  color: var(--muted);
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: flex;
  min-height: 106px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
}

.dashboard-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
  margin-top: 14px;
}

.dashboard-funnel,
.dashboard-actions-panel,
.dashboard-attention {
  padding: 22px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid rgba(216, 210, 196, 0.72);
}

.funnel-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.funnel-row span {
  color: var(--muted);
  font-weight: 800;
}

.funnel-row strong {
  font-weight: 900;
}

.funnel-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e3d8;
}

.funnel-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green-dark);
}

.dashboard-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.dashboard-actions {
  display: grid;
  gap: 10px;
}

.dashboard-actions .button {
  width: 100%;
}

.button.disabled {
  color: #8b948f;
  cursor: default;
  opacity: 0.62;
  pointer-events: none;
}

.dashboard-attention dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid rgba(216, 210, 196, 0.72);
}

.dashboard-attention dd {
  color: var(--danger);
}

.note {
  margin-top: 24px;
  color: var(--muted);
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
}

.check-ok,
.check-missing {
  font-weight: 800;
}

.check-ok {
  color: var(--green-dark);
}

.check-missing {
  color: var(--danger);
}

.admin-section {
  margin-top: 18px;
}

.admin-section h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.workflow-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.workflow-context-tabs {
  min-height: 54px;
  margin-bottom: 0;
}

.workflow-project-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
}

.workflow-project-form label {
  color: #243044;
  font-size: 0.9rem;
  font-weight: 800;
}

.workflow-project-form select {
  width: auto;
  min-width: 220px;
  min-height: 40px;
  padding: 6px 28px 6px 10px;
  font-weight: 700;
}

.workflow-step-links {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.workflow-step-links a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.workflow-step-links a.active {
  background: var(--green-dark);
  color: #ffffff;
}

.workflow-step-links a.disabled {
  color: #8b948f;
  cursor: default;
  opacity: 0.62;
  pointer-events: none;
}

.workflow-utility-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.workflow-utility-links a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 6px 9px;
  border-radius: 6px;
  color: #2f3b50;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.workflow-utility-links a.active,
.workflow-utility-links a:hover {
  background: rgba(31, 111, 85, 0.08);
  color: var(--green-dark);
}

.workflow-header .workflow-tabs {
  margin: 0;
  border-color: #dfe4ec;
  background: #f8fafc;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.section-title-row h2 {
  margin: 0;
}

.compact-admin-panel {
  padding: 18px;
}

.compact-admin-panel h2 {
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.compact-button,
a.compact-button,
button.compact-button {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.compact-select {
  width: auto;
  min-width: 180px;
  min-height: 40px;
  padding: 7px 28px 7px 10px;
  font-size: 0.9rem;
}

.compact-checkbox {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  accent-color: var(--green-dark);
  cursor: pointer;
}

.compact-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.setup-table-wrap {
  margin-top: 14px;
}

.setup-table th,
.setup-table td {
  padding: 10px;
}

.setup-table td {
  vertical-align: middle;
}

.setup-table .selected-row {
  background: rgba(31, 111, 85, 0.06);
}

.audience-table th,
.audience-table td {
  white-space: nowrap;
}

.audience-table th:first-child,
.audience-table td:first-child {
  width: 36px;
  text-align: center;
}

.audience-table td:nth-child(2),
.audience-table td:nth-child(3) {
  white-space: normal;
}

.questions-table th:nth-child(2),
.questions-table td:nth-child(2) {
  min-width: 320px;
}

.questions-table th,
.questions-table td {
  padding: 8px 10px;
}

.questions-table td {
  line-height: 1.25;
}

.questions-table td:last-child {
  width: 74px;
}

.questions-table .table-actions {
  gap: 5px;
  flex-wrap: nowrap;
}

.question-summary-row.selected-row td {
  border-bottom-color: transparent;
}

.question-position-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.drag-handle {
  display: inline-flex;
  width: 22px;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.question-summary-row.is-dragging {
  opacity: 0.58;
}

.row-expand-toggle {
  display: inline-flex;
  width: 22px;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
}

.row-expand-toggle::before {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid currentColor;
  content: "";
}

.row-expand-toggle.is-open::before {
  border-top: 8px solid currentColor;
  border-right: 6px solid transparent;
  border-bottom: 0;
  border-left: 6px solid transparent;
}

.question-detail-row > td {
  padding: 0 10px 14px;
  background: rgba(31, 111, 85, 0.06);
}

.inline-question-editor {
  margin: 0;
  border: 1px solid rgba(31, 111, 85, 0.16);
  background: #ffffff;
  box-shadow: none;
}

.question-order-form {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.question-order-status {
  margin: 14px 0 0;
}

.clipped-cell {
  display: block;
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clipped-cell.short {
  max-width: 180px;
}

.icon-button {
  display: inline-flex;
  box-sizing: border-box;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: transparent;
  color: var(--green-dark);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
}

.icon-button:hover {
  background: rgba(31, 111, 85, 0.08);
}

.danger-icon-button {
  border-color: var(--danger);
  color: var(--danger);
}

.danger-icon-button:hover {
  background: rgba(164, 49, 38, 0.08);
}

.setup-detail-panel {
  margin-top: 16px;
  padding: 18px;
  box-shadow: none;
}

.invitation-editor-panel {
  display: grid;
  gap: 16px;
}

.template-placeholder-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.template-placeholder-bar code {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
  color: var(--green-dark);
  font-size: 0.86rem;
}

.email-rich-editor {
  min-height: 360px;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  line-height: 1.5;
}

.email-rich-editor:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 73, 56, 0.14);
  outline: none;
}

.field-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.wide-admin-page {
  width: min(1680px, calc(100% - 36px));
}

.settings-page {
  display: flex;
  flex-direction: column;
}

.settings-access-section {
  order: 1;
}

.settings-categories-section {
  order: 2;
}

.settings-smtp-section {
  order: 3;
}

.settings-ai-section {
  order: 4;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.question-list {
  display: grid;
  gap: 18px;
}

.question-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.question-editor.panel {
  box-shadow: 0 14px 28px rgba(22, 33, 31, 0.06);
}

.audience-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.audience-layout-wide {
  align-items: start;
  grid-template-columns: minmax(340px, 0.9fr) minmax(480px, 1.25fr);
}

.stacked-form {
  display: grid;
  gap: 14px;
}

.stacked-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 800;
}

.nested-filter-bar {
  display: flex;
  justify-content: flex-end;
  margin: 14px 0;
}

.nested-filter-bar-left {
  margin: 14px 0 0;
}

.bulk-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.bulk-action-bar label {
  color: var(--muted);
  font-size: 0.9rem;
}

.inline-assign-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfaf6;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.status-sent,
.status-opened,
.status-replied {
  border-color: rgba(31, 111, 85, 0.3);
  background: rgba(31, 111, 85, 0.08);
  color: var(--green-dark);
}

.status-ready {
  border-color: rgba(215, 148, 42, 0.35);
  background: rgba(215, 148, 42, 0.12);
  color: #74511d;
}

.status-failed,
.status-unsubscribed {
  border-color: rgba(155, 45, 34, 0.3);
  background: rgba(155, 45, 34, 0.08);
  color: var(--danger);
}

.compact-table-wrap {
  max-height: 560px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.full-width {
  grid-column: 1 / -1;
}

.success-alert {
  background: rgba(31, 111, 85, 0.12);
  color: var(--green-dark);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.status-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.compact-status-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--green-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.table-actions form {
  margin: 0;
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.result-block {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.result-block:first-of-type {
  border-top: 0;
}

.result-block h3 {
  margin-bottom: 8px;
}

.text-answer-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 20px;
}

.ai-summary-box {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid rgba(31, 111, 85, 0.25);
  border-radius: 8px;
  background: rgba(31, 111, 85, 0.07);
}

.ai-summary-box p:last-child {
  margin-bottom: 0;
}

.app-footer {
  width: min(1100px, calc(100% - 48px));
  margin: 18px auto 28px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.wide-admin-page + .app-footer {
  width: min(1800px, calc(100% - 48px));
}

.survey-page {
  width: min(940px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 58px;
}

.survey-intro {
  margin: 28px 0;
}

.survey-intro h1 {
  max-width: 860px;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
}

.survey-intro .lede {
  margin-bottom: 18px;
}

.privacy-note {
  max-width: 820px;
  padding: 16px 18px;
  border-left: 5px solid var(--green);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.62);
  color: #32403c;
  font-weight: 700;
}

.survey-form {
  display: grid;
  gap: 18px;
}

.survey-form[hidden] {
  display: none;
}

.survey-progress {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 0 14px;
  background: var(--paper);
}

.survey-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.survey-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(22, 33, 31, 0.12);
}

.survey-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.survey-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.survey-step-actions > *,
.survey-submit-button {
  flex: 1 1 0;
}

.survey-form.is-progressive .question-card[hidden],
.survey-form.is-progressive [hidden] {
  display: none;
}

.question-card {
  margin: 0;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 28px rgba(22, 33, 31, 0.06);
}

.question-card::after {
  display: block;
  clear: both;
  content: "";
}

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

.question-card legend {
  display: grid;
  float: left;
  width: 100%;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0 0 2px;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.25;
}

.question-card legend span {
  color: var(--clay);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.question-card legend em {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(31, 111, 85, 0.12);
  color: var(--green-dark);
  font-size: 0.76rem;
  font-style: normal;
}

.help-text,
.field-error {
  margin: 12px 0 0;
}

.help-text,
.field-help {
  color: var(--muted);
  font-weight: 700;
}

.field-help {
  margin: 0;
  font-size: 0.92rem;
}

.field-error {
  color: var(--danger);
  font-weight: 800;
}

.option-list {
  display: grid;
  gap: 10px;
  clear: both;
  margin-top: 0;
}

.choice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
  font-weight: 700;
}

.choice input {
  width: 18px;
  min-height: 18px;
  margin: 3px 0 0;
  padding: 0;
}

.choice:has(input:checked) {
  border-color: var(--green);
  background: rgba(31, 111, 85, 0.09);
}

.other-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
}

.mobile-preview-page {
  min-height: 100vh;
  background: #e8ebe8;
}

.mobile-preview-shell {
  display: grid;
  min-height: 100vh;
  justify-items: center;
  gap: 18px;
  padding: 22px;
}

.mobile-preview-toolbar {
  display: flex;
  width: min(430px, 100%);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-preview-frame {
  width: min(390px, 100%);
  height: min(820px, calc(100vh - 110px));
  overflow: auto;
  border: 12px solid #111827;
  border-radius: 34px;
  background: var(--paper);
  box-shadow: 0 24px 60px rgba(22, 33, 31, 0.26);
}

.mobile-preview-frame .survey-page {
  width: 100%;
  padding: 18px 14px 28px;
}

.mobile-preview-frame .back-link,
.mobile-preview-page .app-footer {
  display: none;
}

.mobile-preview-frame .survey-intro {
  margin-top: 4px;
}

.mobile-preview-frame .survey-intro h1 {
  font-size: 2rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(18px, 5vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 820px) {
  .site-header,
  .admin-header,
  .app-header-shell,
  .app-header,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header-shell {
    position: static;
  }

  .app-header {
    width: 100%;
    gap: 10px;
    padding: 12px 18px;
  }

  .workflow-header {
    width: 100%;
    padding: 0 18px 12px;
  }

  .workflow-project-form,
  .workflow-step-links {
    width: 100%;
  }

  .workflow-project-form {
    flex-wrap: wrap;
    margin-left: 0;
  }

  .workflow-project-form select {
    flex: 1 1 220px;
  }

  .compact-actions {
    align-items: stretch;
  }

  .compact-actions > * {
    flex: 1 1 auto;
  }

  .admin-nav {
    width: 100%;
  }

  .admin-nav a {
    min-height: 42px;
  }

  .app-user {
    width: 100%;
    justify-content: space-between;
  }

  .hero,
  .dashboard-overview,
  .dashboard-workbench,
  .metrics,
  .audience-layout,
  .audience-layout-wide,
  .admin-form-grid,
  .status-grid,
  .question-editor {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .dashboard-current dl,
  .dashboard-health {
    grid-template-columns: 1fr;
  }

  .dashboard-health div {
    min-height: 96px;
  }

  .dashboard-health div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .funnel-row {
    grid-template-columns: 1fr;
  }

  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-bar input,
  .filter-bar select {
    width: 100%;
  }

  h1 {
    max-width: 100%;
  }

  .survey-page {
    width: min(100% - 24px, 940px);
    padding: 18px 0 34px;
  }

  .survey-intro {
    margin: 18px 0;
  }

  .survey-intro h1 {
    font-size: 2.15rem;
    line-height: 1.05;
  }

  .survey-intro .lede {
    font-size: 1.05rem;
  }

  .privacy-note {
    padding: 13px 14px;
    font-size: 0.94rem;
  }

  .question-card {
    padding: 18px 15px;
  }

  .question-card legend {
    font-size: 1.08rem;
  }

  .choice {
    min-height: 52px;
    align-items: center;
    padding: 12px 11px;
  }

  .survey-step-actions {
    position: sticky;
    bottom: 0;
    z-index: 12;
    margin: 0 -12px;
    padding: 12px;
    border-top: 1px solid var(--line);
    background: rgba(246, 243, 235, 0.96);
  }

  .survey-submit-button {
    position: sticky;
    bottom: 12px;
    z-index: 12;
    width: 100%;
  }
}
