:root {
  color-scheme: light;
  --bg: #fbfbfc;
  --ink: #181820;
  --muted: #606060;
  --panel: #ffffff;
  --line: #cfcfcf;
  --brand: #7040e8;
  --brand-dark: #4b269e;
  --brand-blue: #002afc;
  --accent: #ffb000;
  --soft: #f3efff;
  --warn: #ffb000;
  --danger: #ff0059;
  --good: #0a8f4f;
  --good-bg: #e8f8ef;
  --watch: #a66a00;
  --watch-bg: #fff4cf;
  --bad: #bd1745;
  --bad-bg: #ffe9ef;
  --neutral-bg: #f1f1f4;
  --shadow: 0 18px 45px rgba(24, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.intro {
  margin-bottom: 24px;
}

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

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

h1 {
  max-width: 900px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.intro-text {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.5;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  margin-top: 16px;
  padding: 24px;
}

.hidden {
  display: none;
}

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

label,
.open-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 760;
}

.identity-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(112, 64, 232, 0.16);
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

button.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.ghost:hover {
  background: var(--soft);
}

.hint {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

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

.mode-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  width: 100%;
  min-height: 188px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(24, 24, 32, 0.05);
  align-content: start;
}

.mode-card:not(.recommended) small {
  visibility: hidden;
}

.mode-card small {
  justify-self: start;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.mode-card.recommended {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f7f4ff 0%, #ffffff 100%);
  box-shadow: 0 12px 24px rgba(112, 64, 232, 0.14);
}

.mode-card.recommended em {
  background: var(--brand-dark);
}

.mode-card:hover {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--ink);
  transform: translateY(-1px);
}

.mode-card:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(112, 64, 232, 0.2);
  outline: none;
}

.mode-card.selected {
  border-color: var(--brand);
  background: var(--soft);
}

.mode-card strong,
.mode-card span,
.mode-card em {
  display: block;
}

.mode-card span {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
}

.mode-card em {
  align-self: end;
  justify-self: stretch;
  border-radius: 6px;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--brand);
  color: #fff;
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 850;
  text-align: center;
}

.mode-card:hover em,
.mode-card.selected em {
  background: var(--brand-dark);
}

.detail-panel {
  margin-top: 16px;
}

.identified-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.week-pill,
.progress {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.questions {
  display: grid;
  gap: 18px;
}

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

.question:first-child {
  border-top: 0;
  padding-top: 0;
}

.question-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.question-title legend {
  display: grid;
  gap: 3px;
}

.last-week-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 0.85rem;
  font-weight: 850;
  white-space: nowrap;
}

.dimension {
  display: block;
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 850;
}

.scale {
  display: grid;
  grid-template-columns: repeat(var(--scale-count, 5), minmax(42px, 1fr));
  gap: 8px;
}

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

.scale input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.scale label {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  background: #fff;
  cursor: pointer;
}

.scale input:checked + label {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.scale-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.question-open-answer {
  min-height: 112px;
}

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

.choice-option {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: #fff;
  cursor: pointer;
}

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

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

.conditional {
  display: none;
  margin-top: 14px;
}

.conditional.visible {
  display: block;
}

.conditional label {
  color: var(--warn);
}

.support-offer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid #ded6ff;
  border-radius: 8px;
  margin-top: 20px;
  padding: 16px;
  background: var(--soft);
}

.support-offer.hidden {
  display: none;
}

.support-offer p {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.support-offer a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.support-offer a:hover {
  background: var(--brand-dark);
}

.open-label {
  margin-top: 24px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.form-alert {
  border: 1px solid #ffb7cf;
  border-radius: 8px;
  margin-top: 18px;
  padding: 12px 14px;
  background: #fff0f6;
  color: var(--danger);
  font-weight: 720;
  line-height: 1.4;
}

.form-alert.success {
  border-color: #9de3ba;
  background: #effcf4;
  color: #166534;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.admin {
  box-shadow: none;
}

#raw-data {
  min-height: 220px;
  margin-top: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
}

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

.analysis-shell {
  width: min(1180px, calc(100% - 32px));
}

.analysis-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.inline-actions {
  margin-top: 0;
}

.analysis-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.analysis-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.analysis-tab.active,
.analysis-tab:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.filter-row label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.compact-filter {
  margin-bottom: 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.segmented button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.segmented button:hover:not(.active) {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand-dark);
}

.question-week-control {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.compact-segmented {
  justify-content: flex-end;
}

.question-week-input-row {
  display: grid;
  grid-template-columns: auto 128px auto;
  gap: 8px;
  align-items: center;
}

.question-week-input-row label {
  margin: 0;
}

.question-week-control input {
  width: 128px;
}

.week-helper {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.question-builder label {
  margin-bottom: 0;
}

.question-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.question-builder-layout {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr);
}

.question-admin-panel,
.question-builder {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.question-admin-panel h3,
.question-builder h3 {
  margin: 0 0 12px;
}

.builder-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.builder-heading h3 {
  margin-bottom: 0;
}

.compact-check {
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.primary-builder-field textarea {
  min-height: 110px;
  font-size: 1.05rem;
  line-height: 1.45;
}

.question-type-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.type-card {
  display: flex;
  flex-direction: column;
  min-height: 78px;
  justify-content: start;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.type-card:hover {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand-dark);
}

.type-card strong,
.type-card span {
  display: block;
}

.type-card strong {
  font-size: 0.95rem;
}

.type-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.type-card.active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand-dark);
}

.type-card.active span {
  color: var(--brand-dark);
}

.admin-list-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

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

.admin-question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.admin-question-card.editing {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(112, 64, 232, 0.12);
}

.admin-question-card strong {
  display: block;
  margin-bottom: 5px;
}

.admin-question-card span,
.admin-question-card em {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: normal;
  line-height: 1.35;
}

.admin-question-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.admin-question-card .actions button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.86rem;
}

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

.question-builder {
  display: grid;
  gap: 14px;
}

.question-builder select {
  width: 100%;
}

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

.question-type-fields.hidden {
  display: none;
}

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

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

.advanced-question-options {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.advanced-question-options summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.advanced-question-options .builder-grid {
  margin-top: 12px;
}

.extra-results-panel {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 22px;
}

.question-preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.question-user-preview {
  max-height: 640px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg);
}

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

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

.core-questions-panel {
  margin-top: 18px;
}

.preview-editing {
  border-color: var(--brand);
  background: #fff;
}

.preview-question .last-week-badge {
  background: #fff7ed;
  color: #9a3412;
}

.preview-conditional.visible {
  display: block;
}

.compact-heading {
  margin-bottom: 12px;
}

.extra-question-results {
  display: grid;
  gap: 14px;
}

.extra-result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.extra-result-card h4 {
  margin: 0 0 4px;
}

.extra-result-card > p {
  margin: 0 0 12px;
  color: var(--muted);
}

.extra-result-stat {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  margin: 0 12px 12px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.extra-result-stat strong {
  color: var(--ink);
  font-size: 1.15rem;
}

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

.extra-option-bar {
  display: grid;
  grid-template-columns: minmax(90px, 0.55fr) minmax(120px, 1fr) minmax(34px, auto);
  gap: 10px;
  align-items: center;
}

.extra-option-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.extra-option-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.extra-text-list {
  display: grid;
  gap: 10px;
}

.extra-text-list article {
  border-left: 3px solid var(--brand);
  padding-left: 10px;
}

.extra-text-list span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.extra-text-list p {
  margin: 4px 0 0;
}

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

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

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

.weekly-closure {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.closure-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.closure-card > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.closure-card span,
.closure-card em {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 720;
}

.closure-card strong {
  display: block;
  margin: 6px 0;
  font-size: 1.45rem;
  line-height: 1;
}

.closure-signals {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

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

.signal-item {
  border: 1px solid transparent;
  border-left: 5px solid var(--brand);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--soft);
}

.signal-good {
  border-color: rgba(10, 143, 79, 0.22);
  border-left-color: var(--good);
  background: var(--good-bg);
}

.signal-watch {
  border-color: rgba(255, 176, 0, 0.28);
  border-left-color: var(--warn);
  background: var(--watch-bg);
}

.signal-bad {
  border-color: rgba(189, 23, 69, 0.18);
  border-left-color: var(--bad);
  background: var(--bad-bg);
}

.signal-item strong,
.signal-item span {
  display: block;
}

.signal-item strong {
  margin-bottom: 6px;
}

.signal-item span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.analysis-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 22px;
}

.summary-comparison {
  grid-template-columns: 1fr;
}

.analysis-two-column > * {
  min-width: 0;
}

h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  white-space: nowrap;
}

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

.trend-row td:first-child {
  border-left: 4px solid transparent;
}

.trend-row-up td:first-child {
  border-left-color: var(--good);
}

.trend-row-down td:first-child {
  border-left-color: var(--bad);
}

.trend-row-flat td:first-child {
  border-left-color: var(--warn);
}

.score-badge,
.previous-score,
.delta-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 860;
  font-variant-numeric: tabular-nums;
}

.previous-score {
  min-width: 42px;
  opacity: 0.78;
}

.score-good {
  background: var(--good-bg);
  color: var(--good);
}

.score-watch {
  background: var(--watch-bg);
  color: var(--watch);
}

.score-bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.score-none {
  background: var(--neutral-bg);
  color: var(--muted);
}

.delta-good {
  background: var(--good-bg);
  color: var(--good);
}

.delta-bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.delta-flat {
  background: var(--neutral-bg);
  color: var(--muted);
}

.weekly-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 20px;
  padding: 16px;
  background: #fff;
}

.weekly-chart svg {
  display: block;
  width: 100%;
  min-height: 220px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 760;
}

.chart-legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.chart-legend i {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis {
  stroke: var(--muted);
  stroke-width: 1.5;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  stroke: #fff;
  stroke-width: 2;
}

.chart-x-label,
.chart-y-label {
  fill: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.chart-x-label {
  text-anchor: middle;
}

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

.distribution-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
}

.distribution-card h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
}

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

.distribution-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 780;
}

.distribution-legend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.distribution-legend i {
  width: 18px;
  height: 7px;
  border-radius: 999px;
}

.legend-current {
  background: var(--good);
}

.legend-previous {
  background: #b7b4c0;
}

.distribution-row {
  display: grid;
  grid-template-columns: 24px minmax(110px, 1fr) 44px 46px;
  gap: 10px;
  align-items: center;
}

.bucket-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 880;
}

.distribution-score-1 .bucket-label,
.distribution-score-2 .bucket-label {
  background: var(--bad-bg);
  color: var(--bad);
}

.distribution-score-3 .bucket-label {
  background: var(--watch-bg);
  color: var(--watch);
}

.distribution-score-4 .bucket-label,
.distribution-score-5 .bucket-label {
  background: var(--good-bg);
  color: var(--good);
}

.double-bar {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bar-line {
  height: 10px;
  border-radius: 999px;
  background: #f1eef8;
  overflow: hidden;
}

.bar-line.previous {
  height: 6px;
  background: #f0f0f2;
}

.bucket-counts {
  display: grid;
  gap: 1px;
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.bucket-counts strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.bucket-counts small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.bucket-delta {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 840;
  text-align: center;
  white-space: nowrap;
}

.bucket-good {
  background: var(--good-bg);
  color: var(--good);
}

.bucket-bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.bucket-watch {
  background: var(--watch-bg);
  color: var(--watch);
}

.bucket-flat {
  background: var(--neutral-bg);
  color: var(--muted);
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.bar-fill.previous {
  background: #b7b4c0;
}

.bar-fill.score-1,
.bar-fill.score-2 {
  background: var(--bad);
}

.bar-fill.score-3 {
  background: var(--warn);
}

.bar-fill.score-4,
.bar-fill.score-5 {
  background: var(--good);
}

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

.timeline-sections {
  display: grid;
  gap: 18px;
}

.timeline-section h3 {
  margin-bottom: 14px;
}

.timeline-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.timeline-header strong,
.timeline-header span {
  display: block;
}

.timeline-header span,
.timeline-trends {
  color: var(--muted);
  font-size: 0.9rem;
}

.individual-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 14px;
  background: #fff;
}

.search-field {
  margin: 0;
}

.search-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.individual-topline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.individual-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.individual-stat span,
.individual-stat em {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 720;
}

.individual-stat strong {
  display: block;
  margin: 5px 0;
  font-size: 1.45rem;
  line-height: 1;
}

.individual-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.individual-card.down {
  border-color: #ffb7cf;
  box-shadow: 0 10px 22px rgba(189, 23, 69, 0.08);
}

.individual-card.attention {
  border-color: #ff8cb1;
  box-shadow: 0 14px 26px rgba(189, 23, 69, 0.12);
}

.individual-card.up {
  border-color: #bdebd0;
}

.individual-card.new {
  border-color: #ded6ff;
}

.individual-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 840;
}

.individual-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.individual-score {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.individual-score span,
.individual-score em {
  display: block;
}

.individual-score span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.individual-score strong {
  display: block;
  margin: 7px 0;
  font-size: 1.55rem;
  line-height: 1;
}

.individual-score em {
  font-style: normal;
  line-height: 1.5;
}

.score-low {
  border-color: #ffb7cf;
  background: #fff7fa;
}

.score-mid {
  border-color: #f1dc82;
  background: #fffaf0;
}

.score-high {
  border-color: #bdebd0;
  background: #f4fff8;
}

.individual-notes {
  display: grid;
  gap: 8px;
  border: 1px solid #ded6ff;
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 12px;
  background: #fbf9ff;
}

.individual-notes > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 820;
  text-transform: uppercase;
}

.individual-notes section {
  border-left: 4px solid var(--brand);
  padding-left: 10px;
}

.individual-notes strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 0.9rem;
}

.individual-notes p {
  margin: 0;
  line-height: 1.45;
}

.timeline-trends {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.trend-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.82rem;
  font-weight: 840;
  line-height: 1;
  vertical-align: middle;
}

.trend-up {
  background: #e8f8ef;
  color: #0c7a3d;
}

.trend-down {
  background: #ffe9ef;
  color: #bd1745;
}

.trend-flat {
  background: #fff5cf;
  color: #8a5f00;
}

.trend-none {
  background: var(--soft);
  color: var(--muted);
}

.trend-delta {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-weight: 760;
}

.open-response-list {
  display: grid;
  gap: 14px;
}

.open-response-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.open-response-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.open-response-header strong,
.open-response-header span {
  display: block;
}

.open-response-header span {
  color: var(--muted);
  font-size: 0.9rem;
}

.open-notes {
  display: grid;
  gap: 10px;
}

.open-notes section {
  border-left: 4px solid var(--brand);
  padding-left: 12px;
}

.open-notes h3 {
  margin-bottom: 4px;
  color: var(--brand);
}

.open-notes p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.compact-table table {
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-card.recommended {
    grid-column: 1 / -1;
    min-height: 150px;
  }

  .metric-grid,
  .timeline-list,
  .individual-topline,
  .closure-card,
  .signal-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-two-column,
  .distribution-bars {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 960px);
    padding: 24px 0;
  }

  .intro,
  .identity-row,
  .identified-row,
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }

  .section-heading,
  .question-title,
  .support-offer {
    display: block;
  }

  .support-offer a {
    width: 100%;
    margin-top: 14px;
  }

  .last-week-badge {
    margin-top: 10px;
  }

  .week-pill,
  .progress {
    margin-top: 10px;
  }

  .scale,
  .scale.enps {
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  }

  .metric-grid,
  .timeline-list,
  .individual-topline,
  .individual-scores,
  .closure-card,
  .signal-list {
    grid-template-columns: 1fr;
  }

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

  .analysis-toolbar {
    display: block;
  }

  .question-admin-grid,
  .builder-grid,
  .question-type-picker,
  .extra-option-bar {
    grid-template-columns: 1fr;
  }

  .builder-heading {
    display: block;
  }

  .compact-check {
    margin-top: 12px;
  }

  .question-week-control {
    justify-items: stretch;
  }

  .question-week-input-row,
  .question-week-control input {
    width: 100%;
  }

  .question-week-input-row {
    grid-template-columns: 1fr;
  }

  .compact-segmented {
    justify-content: stretch;
  }

  .compact-segmented button {
    flex: 1 1 auto;
  }

  .question-week-control input {
    width: 100%;
  }

  .inline-actions {
    margin-top: 14px;
  }
}
