:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f0f4f8;
  --surface-strong: #e4ebf3;
  --text: #17202c;
  --muted: #677386;
  --line: #d9e1ea;
  --accent: #14b8a6;
  --accent-strong: #0f766e;
  --accent-soft: #d9f4ef;
  --danger: #b42318;
  --warning: #9a6700;
  --shadow: 0 16px 34px rgba(16, 24, 40, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e131b;
  --surface: #151c27;
  --surface-soft: #1d2633;
  --surface-strong: #283345;
  --text: #f7f9fc;
  --muted: #9aa7b8;
  --line: #2c384a;
  --accent: #34d6c5;
  --accent-strong: #7ce8dc;
  --accent-soft: #133b39;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 42%, var(--bg)) 0, var(--bg) 260px);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #22c55e);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 24%, transparent);
}

.brand-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 330px) 1fr;
  gap: 18px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.admin-shell {
  display: grid;
  gap: 20px;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 20px 28px 34px;
}

.admin-tabs {
  display: inline-grid;
  grid-auto-flow: column;
  justify-content: start;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 76%, var(--surface-soft));
  width: fit-content;
}

.admin-tab {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.admin-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.panel-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.panel-body {
  padding: 20px;
}

.survey-overview .panel-header,
.builder-header {
  background: color-mix(in srgb, var(--surface) 78%, var(--surface-soft));
}

.builder-panel .panel-body {
  padding: 20px;
}

.survey-basics {
  align-items: end;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 42px 24px;
  background:
    linear-gradient(145deg, color-mix(in srgb, #f0fdfa 62%, var(--bg)) 0%, var(--bg) 54%, color-mix(in srgb, #fff7ed 38%, var(--bg)) 100%);
}

:root[data-theme="dark"] .auth-wrap {
  background:
    linear-gradient(145deg, color-mix(in srgb, #0f3f3a 42%, var(--bg)) 0%, var(--bg) 50%, color-mix(in srgb, #3a2f12 26%, var(--bg)) 100%);
}

.auth-landing {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 42px;
  align-items: center;
}

.auth-landing.with-form {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 460px);
}

.auth-hero {
  display: grid;
  gap: 18px;
  align-content: center;
  max-width: 820px;
}

.auth-brand {
  margin-bottom: 12px;
}

.auth-eyebrow,
.auth-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.auth-hero-title {
  max-width: 760px;
  margin: 0;
  font-size: 56px;
  line-height: 1.04;
}

.auth-lead {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.auth-cta {
  min-width: 178px;
  min-height: 48px;
}

.auth-cta.active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.auth-side {
  width: min(460px, 100%);
  justify-self: end;
  display: grid;
  gap: 14px;
}

.auth-actions-side {
  width: 100%;
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(14px);
}

.auth-actions-side .auth-cta {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.auth-actions-side .auth-cta.active {
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 22%, transparent);
}

.promo-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.promo-point {
  display: grid;
  gap: 7px;
  padding-top: 14px;
  border-top: 3px solid var(--accent);
}

.promo-point:nth-child(2) {
  border-top-color: #2563eb;
}

.promo-point:nth-child(3) {
  border-top-color: #f59e0b;
}

.promo-point strong {
  font-size: 15px;
}

.promo-point span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-card {
  width: 100%;
  justify-self: stretch;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

.auth-title {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.15;
}

.auth-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-card .form {
  gap: 16px;
}

.auth-card .status {
  margin: 0;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field span,
.label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-soft));
  color: var(--text);
  font-family: inherit;
  font-weight: 650;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.select option {
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 750;
}

.textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--surface-strong);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #05201d;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #05201d;
}

.btn-ghost {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line);
}

.btn-danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-soft));
}

.btn-status.success {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.btn-status.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--danger) 20%, var(--line));
}

.btn-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.icon-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.btn-small.icon-btn {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.icon-btn svg {
  display: block;
}

.danger-icon {
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
  border-color: transparent;
}

.danger-icon:hover,
.danger-icon:focus-visible {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.segment {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
}

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--accent-strong);
}

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

.stat {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.stat strong {
  display: block;
  order: 2;
  font-size: 28px;
  line-height: 1;
}

.stat span {
  order: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.stat-active {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.stat-archived {
  border-color: color-mix(in srgb, var(--warning) 28%, var(--line));
}

.survey-list {
  display: grid;
  gap: 8px;
}

.survey-item {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.survey-item:hover,
.survey-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.survey-item strong {
  overflow-wrap: anywhere;
}

.survey-meta {
  color: var(--muted);
  font-size: 12px;
}

.survey-management-list {
  display: grid;
  gap: 10px;
}

.survey-manage-card {
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.survey-manage-card:hover {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-soft));
  transform: translateY(-1px);
}

.survey-manage-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
}

.survey-manage-main h3 {
  margin: 8px 0 5px;
  font-size: 21px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.survey-manage-main p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

.survey-actions {
  display: grid;
  gap: 8px;
}

.survey-actions-primary,
.survey-actions-secondary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.survey-actions-secondary .btn {
  color: var(--muted);
  min-height: 32px;
}

.survey-actions-secondary .danger-icon {
  color: color-mix(in srgb, var(--danger) 76%, var(--muted));
}

.survey-actions-secondary .danger-icon:hover,
.survey-actions-secondary .danger-icon:focus-visible {
  color: var(--danger);
}

.survey-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-panel {
  overflow: hidden;
}

.ai-panel-head {
  align-items: center;
}

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

.ai-summary,
.ai-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-soft));
}

.ai-summary {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.ai-summary p,
.ai-card p {
  margin: 0;
  line-height: 1.5;
}

.ai-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.ai-card-wide {
  grid-column: 1 / -1;
}

.ai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-card-head strong {
  font-size: 18px;
}

.sentiment-bar {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.sentiment-part {
  display: block;
  min-width: 0;
}

.sentiment-part.positive {
  background: var(--accent);
}

.sentiment-part.neutral {
  background: #3b82f6;
}

.sentiment-part.negative {
  background: var(--danger);
}

.sentiment-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sentiment-list div {
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.sentiment-list span,
.sentiment-list small,
.ai-list-item span,
.ai-footnote {
  color: var(--muted);
  font-size: 12px;
}

.sentiment-list strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.ai-list,
.executive-list,
.ai-chat-log {
  display: grid;
  gap: 8px;
}

.ai-list-item,
.executive-list div,
.ai-chat-item {
  display: grid;
  gap: 5px;
  padding: 11px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.ai-list-item strong,
.executive-list strong,
.ai-chat-item strong {
  overflow-wrap: anywhere;
}

.executive-list span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
}

.ai-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ai-footnote {
  margin-top: 2px;
}

.empty {
  display: grid;
  gap: 14px;
  align-items: start;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.empty h2,
.empty h3 {
  margin: 0;
}

.empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.builder-area {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.builder-area-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.builder-area-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.question-stack {
  display: grid;
  gap: 12px;
}

.add-question-row {
  display: flex;
  justify-content: center;
  padding: 6px 0 2px;
}

.add-question-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px dashed color-mix(in srgb, var(--accent) 54%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
  cursor: pointer;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 12%, transparent);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.add-question-button:hover,
.add-question-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: #05201d;
  box-shadow: 0 16px 30px color-mix(in srgb, var(--accent) 20%, transparent);
  transform: translateY(-1px);
}

.add-question-button svg {
  display: block;
}

.question-block {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-soft));
  animation: lift-in 180ms ease both;
}

.question-block .field {
  gap: 8px;
}

.question-block.dragging {
  opacity: 0.55;
  cursor: grabbing;
  pointer-events: none;
}

.question-block.drag-over-before {
  border-top: 3px solid var(--accent);
}

.question-block.drag-over-after {
  border-bottom: 3px solid var(--accent);
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.question-delete-button {
  align-self: flex-start;
  flex: 0 0 auto;
}

.question-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.question-type-field {
  min-width: min(300px, 100%);
}

.question-type-select {
  min-height: 38px;
  padding: 8px 34px 8px 12px;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.25;
}

.question-type-select option {
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 780;
}

.drag-handle {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.question-drag-active,
.question-drag-active * {
  cursor: grabbing !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-badge.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-badge.archived {
  background: color-mix(in srgb, var(--warning) 14%, var(--surface-soft));
  color: var(--warning);
}

.inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.option-field {
  gap: 10px;
}

.option-list {
  display: grid;
  gap: 8px;
}

.option-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 70%, transparent);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.option-row:focus-within {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.option-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.option-input {
  min-height: 40px;
  border-color: transparent;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.option-input:focus {
  border-color: var(--accent);
}

.option-remove-button {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  justify-self: end;
}

.option-add-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

.option-add-button:hover,
.option-add-button:focus-visible {
  background: var(--accent);
  color: #05201d;
  border-color: var(--accent);
}

.option-add-button svg {
  width: 16px;
  height: 16px;
}

.two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.series-area {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.preview {
  display: grid;
  gap: 14px;
}

.preview-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 16px;
}

.link-box {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.link-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.results-scroll {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.results-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

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

.results-table th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

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

.public-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.preview-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.preview-mode-bar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.public-header {
  display: grid;
  gap: 10px;
  margin: 24px 0 18px;
}

.public-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.public-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 180ms ease;
}

.question-view {
  display: grid;
  gap: 16px;
}

.answer-block {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.answer-block h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
}

.answer-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.section-heading-block {
  gap: 0;
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.section-heading-block h2 {
  font-size: 22px;
}

.choice-list {
  display: grid;
  gap: 8px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: pointer;
}

.choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 8px;
}

.scale button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.scale button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.footer-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 4px;
}

.footer-actions .status {
  text-align: center;
}

#save-survey-btn {
  min-width: min(300px, 100%);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .layout,
  .survey-manage-main,
  .ai-grid {
    grid-template-columns: 1fr;
  }

  .ai-summary,
  .ai-card-wide {
    grid-column: auto;
  }

  .survey-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .auth-landing {
    grid-template-columns: 1fr;
    max-width: 820px;
  }

  .auth-card {
    width: 100%;
    justify-self: stretch;
  }

  .auth-side {
    width: 100%;
    justify-self: stretch;
  }

}

@media (max-width: 680px) {
  .layout,
  .admin-shell,
  .public-shell {
    padding: 14px;
  }

  .topbar {
    padding: 0;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .topbar-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .sentiment-list,
  .ai-chat-form {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .auth-wrap {
    padding: 22px 14px;
  }

  .auth-landing {
    gap: 24px;
  }

  .auth-hero-title {
    font-size: 38px;
  }

  .auth-lead {
    font-size: 16px;
  }

  .promo-points {
    grid-template-columns: 1fr;
  }

  .auth-actions-side {
    grid-template-columns: 1fr;
  }

  .auth-actions .btn,
  .auth-card .btn {
    width: 100%;
  }

  .option-add-button {
    width: 100%;
    justify-content: center;
  }

  .auth-card {
    padding: 18px;
  }

  .stats,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .footer-actions,
  .link-box {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .panel-header,
  .footer-actions {
    flex-direction: column;
  }

  .question-head,
  .question-title {
    align-items: stretch;
    flex-direction: column;
  }

  .question-type-field {
    width: 100%;
  }

  .question-delete-button {
    align-self: flex-end;
  }

  .preview-mode-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .link-box {
    display: grid;
  }

  .topbar-actions,
  .inline-row,
  .survey-actions {
    width: 100%;
  }

  .topbar-actions .btn,
  .inline-row .btn,
  .footer-actions .btn,
  .survey-actions .btn:not(.icon-btn) {
    width: 100%;
  }

  .survey-actions-secondary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px;
    width: 100%;
  }

  .survey-actions-secondary .btn:first-child {
    grid-column: 1 / -1;
  }

  .survey-actions .icon-btn {
    width: 38px;
    min-width: 38px;
    justify-self: end;
  }
}
