:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #657085;
  --line: #d9e0ea;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --green: #16a36a;
  --blue: #2877c9;
  --orange: #e7832f;
  --red: #d94343;
  --focus: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

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

button {
  cursor: pointer;
}

.survey-body {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbff 0%, #eef3f8 100%);
}

.survey-shell {
  min-height: 100vh;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 48px);
  display: grid;
  place-items: center;
}

.survey-step {
  display: none;
  width: 100%;
}

.survey-step.is-active {
  display: block;
}

.survey-step h1 {
  max-width: 920px;
  margin: 0 auto clamp(26px, 5vw, 48px);
  text-align: center;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.source-chip {
  width: fit-content;
  margin: 0 auto 22px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
}

.faces-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: clamp(12px, 2vw, 22px);
}

.face-option {
  min-height: clamp(140px, 24vw, 260px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  align-content: center;
  font-weight: 800;
  font-size: clamp(1.25rem, 2.6vw, 2.4rem);
  box-shadow: none;
  transition: transform 160ms ease, filter 160ms ease;
}

.face-option:active {
  transform: scale(0.98);
}

.face-option:hover,
.face-option:focus-visible {
  transform: translateY(-3px) scale(1.03);
  outline: 4px solid rgba(24, 33, 47, 0.16);
}

.face-icon {
  width: clamp(100px, 16vw, 190px);
  height: clamp(100px, 16vw, 190px);
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(24, 33, 47, 0.18));
}

.back-button {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.6rem;
  margin-bottom: 20px;
}

.nps-scale {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 8px;
}

.nps-scale button {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #c8d4e1;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: clamp(1.05rem, 3vw, 2rem);
  font-weight: 800;
}

.nps-scale button:hover,
.nps-scale button:focus-visible,
.nps-scale button.is-selected {
  border-color: var(--focus);
  background: var(--focus);
  color: white;
}

.scale-labels,
.actions-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 600;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #c8d4e1;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 14px 16px;
}

textarea {
  resize: vertical;
  min-height: 170px;
  font-size: 1.15rem;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 18px;
  border: 1px solid var(--focus);
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  background: var(--focus);
  color: white;
}

.secondary-button {
  background: white;
  color: var(--focus);
}

.thanks-step {
  text-align: center;
}

.thanks-step p {
  margin: -24px 0 0;
  color: var(--muted);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
}

.thanks-icon {
  width: clamp(86px, 16vw, 150px);
  height: clamp(86px, 16vw, 150px);
  margin: 0 auto 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
}

.error-text {
  min-height: 24px;
  color: var(--red);
  font-weight: 700;
}

.success-text {
  color: var(--green);
  font-weight: 800;
}

.admin-body {
  background: #f6f8fb;
}

.admin-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.login-panel,
.panel,
.metrics-grid article,
.filters {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(24, 33, 47, 0.06);
}

.login-panel {
  width: min(430px, 100%);
  margin: 14vh auto;
  padding: 26px;
}

.login-panel h1,
.admin-header h1 {
  margin: 0 0 18px;
}

.login-panel form {
  display: grid;
  gap: 12px;
}

.muted,
.eyebrow {
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.admin-header,
.header-actions,
.filters,
.admin-layout,
.config-form,
.token-form {
  display: grid;
  gap: 14px;
}

.admin-header {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.header-actions {
  grid-template-columns: repeat(2, auto);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 900;
}

.filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  padding: 16px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.9rem;
}

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

.metrics-grid article {
  padding: 18px;
}

.metrics-grid span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 8px;
}

.metrics-grid strong {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.admin-layout {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
}

.token-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  margin-bottom: 12px;
}

.token-form button {
  min-width: 0;
}

td a {
  color: var(--blue);
  font-weight: 800;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 44px;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}

.bar-track {
  height: 14px;
  background: #e9eef5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

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

th {
  color: var(--muted);
  font-size: 0.84rem;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-row input {
  width: auto;
}

@media (max-width: 820px) {
  .faces-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .nps-scale {
    grid-template-columns: repeat(4, 1fr);
  }

  .filters,
  .metrics-grid,
  .admin-layout,
  .admin-header,
  .token-form {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 520px) {
  .survey-shell {
    padding: 18px 12px;
  }

  .survey-step h1 {
    font-size: clamp(2rem, 11vw, 2.8rem);
    margin-bottom: 30px;
  }

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

  .face-option {
    min-height: 82px;
    padding: 0;
  }

  .face-icon {
    width: clamp(62px, 21vw, 82px);
    height: clamp(62px, 21vw, 82px);
    filter: drop-shadow(0 6px 12px rgba(24, 33, 47, 0.16));
  }

  .scale-labels,
  .actions-row {
    flex-direction: column;
  }
}
