:root {
  --primary: #0f172a;
  --secondary: #0d9488;
  --tertiary: #3b82f6;
  --neutral: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f3f6fb;
  --surface-muted: #eef2f7;
  --text: #111827;
  --text-soft: #4b5563;
  --text-faint: #6b7280;
  --line: #d4dae4;
  --line-strong: #aeb7c5;
  --danger: #dc2626;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-sans: "Public Sans", "Segoe UI", sans-serif;
  --shell-max: 1180px;
  --mobile-shell: 414px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.15) 1px, transparent 0),
    linear-gradient(180deg, #20242d, #171a20);
  background-size: 16px 16px, auto;
  padding: 0;
}

a {
  color: inherit;
}

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

button {
  border: 0;
  background: transparent;
}

.app-shell {
  width: min(100%, var(--mobile-shell));
  min-height: 100vh;
  margin: 0 auto;
  background: var(--neutral);
  border-left: 3px solid #4f46e5;
  border-right: 3px solid #4f46e5;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15), 0 36px 90px rgba(0, 0, 0, 0.35);
  position: relative;
  display: flex;
  flex-direction: column;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1rem;
}

.brand-mark {
  width: 22px;
  height: 22px;
  color: var(--secondary);
  flex: 0 0 auto;
}

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

.topbar-actions form {
  margin: 0;
}

.avatar-chip,
.icon-button,
.icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
}

.avatar-chip {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #20242d, #7aa79a);
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.icon-button {
  width: 34px;
  height: 34px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--primary);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.icon-button svg,
.avatar-chip svg,
.icon-circle svg,
.nav-link svg,
.inline-icon svg,
.info-line svg,
.list-icon svg,
.stat-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-accent {
  height: 4px;
  width: 120px;
  background: linear-gradient(90deg, var(--secondary), #b9d7d4 85%);
  border-bottom-right-radius: 999px;
}

.screen-content {
  flex: 1 0 auto;
  padding: 22px 16px 112px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.flash {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.95rem;
}

.flash-error {
  color: #8d1f1f;
  background: #fef2f2;
  border-color: #fecaca;
}

.hero-block {
  padding: 6px 4px 12px;
}

.hero-block h1,
.page-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.hero-block.hero-large h1,
.page-title.page-large {
  font-size: clamp(1.95rem, 5.8vw, 2.45rem);
}

.hero-block p,
.page-subtitle,
.text-muted {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.info-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 16px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.info-line .inline-icon {
  color: var(--secondary);
  margin-top: 2px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.content-card,
.section-card,
.login-card,
.dashboard-card,
.legal-card {
  padding: 18px;
}

.section-card + .section-card,
.dashboard-card + .dashboard-card,
.legal-card + .legal-card {
  margin-top: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 1.15rem;
}

.list-icon,
.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 148, 136, 0.14);
  color: var(--secondary);
}

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

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

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 2px 4px;
  font-size: 0.82rem;
  color: var(--secondary);
}

.save-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.save-status[data-tone="default"] {
  color: var(--text-soft);
}

.save-status[data-tone="success"] {
  color: var(--secondary);
}

.question-block + .question-block {
  margin-top: 0;
}

.question-label,
.question-title {
  display: block;
  margin-bottom: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #212937;
  line-height: 1.35;
}

.helper-text {
  margin: -4px 0 12px;
  color: var(--text-faint);
  font-size: 0.88rem;
  line-height: 1.45;
}

select,
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  min-height: 52px;
  padding: 14px 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

textarea {
  min-height: 132px;
  resize: vertical;
}

.choice-list,
.checkbox-list,
.score-grid,
.price-grid {
  display: grid;
  gap: 10px;
}

.option-card,
.score-chip {
  position: relative;
}

.option-card input,
.score-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  pointer-events: none;
}

.option-card span,
.score-chip span {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-height: 54px;
  padding: 14px 15px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: white;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.option-card.radio span::before,
.option-card.checkbox span::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 1.8px solid var(--line-strong);
  flex: 0 0 auto;
}

.option-card.radio span::before {
  border-radius: 999px;
}

.option-card.checkbox span::before {
  border-radius: 5px;
}

.option-card:has(input:checked) span,
.score-chip:has(input:checked) span {
  border-color: var(--secondary);
  background: rgba(13, 148, 136, 0.08);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.option-card.radio:has(input:checked) span::before,
.option-card.checkbox:has(input:checked) span::before {
  border-color: var(--secondary);
  background: var(--secondary);
  box-shadow: inset 0 0 0 4px #fff;
}

.checkbox-list.two-col,
.price-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

.score-grid {
  grid-template-columns: repeat(5, 1fr);
}

.score-grid.score-grid-ten {
  grid-template-columns: repeat(5, 1fr);
}

.score-chip span {
  justify-content: center;
  align-items: center;
  font-weight: 700;
  min-height: 54px;
}

.inline-grid {
  display: grid;
  gap: 16px;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  color: white;
  background: #0f766e;
}

.secondary-button {
  color: var(--primary);
  background: white;
  border-color: var(--line-strong);
}

.ghost-button {
  color: var(--text-soft);
  background: transparent;
  border-color: var(--line);
}

.button-full {
  width: 100%;
}

.fine-print {
  color: var(--text-faint);
  font-size: 0.88rem;
  line-height: 1.45;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, var(--mobile-shell));
  transform: translateX(-50%);
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(248, 250, 252, 0), rgba(248, 250, 252, 0.92) 18%, rgba(248, 250, 252, 1));
  z-index: 20;
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.nav-link {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 8px;
  color: var(--text-soft);
  text-decoration: none;
  border-radius: 14px;
  font-size: 0.84rem;
  min-height: 60px;
}

.nav-link.active {
  color: #0f766e;
  background: #9cf3e8;
}

.nav-link svg {
  width: 20px;
  height: 20px;
}

.login-wrap {
  min-height: calc(100vh - 78px);
  display: grid;
  align-content: start;
  padding-top: 64px;
}

.login-intro {
  text-align: center;
  padding: 0 12px;
  margin-bottom: 18px;
}

.login-intro h1 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.login-intro p {
  margin: 0;
  color: var(--text-soft);
}

.login-card {
  padding: 28px 12px 18px;
}

.login-panel {
  padding: 28px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.login-panel label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.login-panel .field + .field {
  margin-top: 16px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-left: 42px;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
}

.login-footer {
  text-align: center;
  margin-top: 26px;
  color: #9ca3af;
}

.dashboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 2px 14px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  margin-top: 16px;
  border-radius: 999px;
  background: #a7f3d0;
  color: #0f766e;
  font-size: 0.88rem;
  font-weight: 700;
}

.dashboard-stack {
  display: grid;
  gap: 16px;
}

.metric-card {
  padding: 22px 16px;
}

.metric-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.metric-number {
  margin: 14px 0 4px;
  font-size: 3.2rem;
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.metric-label {
  color: var(--text-soft);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-progress {
  height: 4px;
  margin-top: 14px;
  background: #e8edf4;
  border-radius: 999px;
  overflow: hidden;
}

.mini-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
}

.score-bar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  margin-top: 14px;
}

.score-bar-grid span {
  height: 28px;
  border-radius: 2px;
}

.score-bar-grid span:nth-child(1) { background: #d7ece9; }
.score-bar-grid span:nth-child(2) { background: #afd9d3; }
.score-bar-grid span:nth-child(3) { background: #6ba9a4; }
.score-bar-grid span:nth-child(4) { background: #2f8c87; }
.score-bar-grid span:nth-child(5) { background: #0f766e; }

.dark-card {
  background: var(--primary);
  color: white;
  border-color: rgba(15, 23, 42, 0.75);
}

.dark-card .metric-label,
.dark-card .text-muted,
.dark-card .simple-table li span {
  color: rgba(255, 255, 255, 0.7);
}

.dark-card .mini-progress {
  background: rgba(255, 255, 255, 0.14);
}

.simple-table {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.simple-table li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.simple-table li span,
.simple-table li strong,
.response-copy p,
.response-meta strong {
  overflow-wrap: anywhere;
}

.dark-card .simple-table li {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.responses-card {
  padding: 18px 16px;
}

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

.response-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfe;
}

.response-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.92rem;
}

.response-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 14px;
  margin-bottom: 14px;
}

.response-meta span {
  display: block;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.response-meta strong {
  display: block;
  margin-top: 2px;
}

.response-copy + .response-copy {
  margin-top: 12px;
}

.response-copy h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.response-copy p {
  margin: 0;
  color: var(--text-soft);
  white-space: pre-line;
}

.legal-tabs {
  display: flex;
  gap: 24px;
  margin: 18px 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.legal-tabs a {
  padding-bottom: 10px;
  text-decoration: none;
  color: var(--text-soft);
  border-bottom: 2px solid transparent;
}

.legal-tabs a.active {
  color: var(--secondary);
  border-bottom-color: var(--secondary);
  font-weight: 700;
}

.legal-template h2 {
  margin: 24px 0 8px;
  font-size: 1.02rem;
}

.legal-template p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.pre-line {
  white-space: pre-line;
}

.thankyou-card {
  margin-top: 52px;
  text-align: center;
}

@media (max-width: 359px) {
  .screen-content {
    padding-inline: 12px;
  }

  .checkbox-list.two-col,
  .price-grid.two-col,
  .score-grid,
  .score-grid.score-grid-ten,
  .response-meta {
    grid-template-columns: 1fr;
  }

  .metric-number {
    font-size: 2.65rem;
  }
}

@media (max-width: 520px) {
  .choice-list,
  .checkbox-list.two-col,
  .price-grid.two-col {
    grid-template-columns: 1fr;
  }

  .screen-content {
    padding: 20px 14px 112px;
  }

  .section-heading {
    font-size: 1.06rem;
  }

  .hero-block.hero-large h1,
  .page-title.page-large {
    font-size: clamp(1.85rem, 8vw, 2.25rem);
  }

  .content-card,
  .section-card,
  .login-card,
  .dashboard-card,
  .legal-card,
  .responses-card {
    padding: 16px;
  }

  .metric-number {
    font-size: 2.9rem;
  }

  .response-head,
  .dashboard-head {
    flex-direction: column;
  }
}

@media (min-width: 700px) {
  body {
    padding: 18px;
  }

  .app-shell {
    width: min(100%, var(--shell-max));
    min-height: calc(100vh - 36px);
    margin: 0 auto;
    border-radius: 22px;
    overflow: hidden;
    border-left-width: 0;
    border-right-width: 0;
  }

  .app-shell::before {
    border-radius: 22px;
  }

  .topbar {
    padding: 16px 26px;
  }

  .brand {
    font-size: 1.5rem;
    gap: 12px;
  }

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

  .header-accent {
    width: 156px;
  }

  .screen-content {
    padding: 34px 30px 28px;
  }

  .hero-block {
    padding-inline: 2px;
  }

  .hero-block p,
  .page-subtitle,
  .text-muted {
    max-width: 72ch;
  }

  .hero-block.hero-large h1,
  .page-title.page-large {
    font-size: clamp(2.6rem, 4.8vw, 4rem);
  }

  .info-line {
    max-width: 720px;
  }

  .survey-form {
    gap: 22px;
  }

  .survey-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 22px;
    align-items: start;
  }

  .survey-section .section-heading,
  .question-block-full {
    grid-column: 1 / -1;
  }

  .question-block-half {
    grid-column: span 1;
  }

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

  .checkbox-list.two-col,
  .price-grid.two-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .score-grid {
    grid-template-columns: repeat(5, minmax(84px, 1fr));
    max-width: 560px;
  }

  .score-grid.score-grid-ten {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    max-width: none;
  }

  .inline-grid {
    max-width: 720px;
  }

  .login-wrap {
    min-height: auto;
    justify-items: center;
    padding-top: 90px;
  }

  .login-intro {
    max-width: 640px;
  }

  .login-card {
    width: min(100%, 620px);
    padding: 18px 0 0;
  }

  .dashboard-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .dashboard-stack > .responses-card {
    grid-column: 1 / -1;
  }

  .dashboard-stack > .dashboard-card:last-of-type {
    grid-column: 1 / -1;
  }

  .response-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .legal-template {
    max-width: 900px;
  }

  .bottom-nav {
    position: sticky;
    left: auto;
    bottom: 0;
    width: 100%;
    transform: none;
    padding: 16px 30px 24px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0), rgba(248, 250, 252, 0.98) 28%, rgba(248, 250, 252, 1));
    margin-top: auto;
  }

  .bottom-nav-inner {
    width: min(100%, 560px);
    margin: 0 auto;
  }

  .nav-link {
    min-height: 64px;
    font-size: 0.92rem;
  }

  .response-item {
    padding: 16px;
  }
}

@media (min-width: 1100px) {
  .screen-content {
    padding: 38px 42px 30px;
  }

  .survey-form {
    gap: 24px;
  }

  .survey-section {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .survey-section .section-heading,
  .question-block-full {
    grid-column: 1 / -1;
  }

  .question-block-half {
    grid-column: span 6;
  }

  .checkbox-list.two-col,
  .price-grid.two-col {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .dashboard-stack {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .dashboard-stack > .metric-card:nth-child(1) {
    grid-column: span 4;
  }

  .dashboard-stack > .metric-card:nth-child(2) {
    grid-column: span 4;
  }

  .dashboard-stack > .metric-card:nth-child(3) {
    grid-column: span 4;
  }

  .dashboard-stack > .dashboard-card:nth-child(4) {
    grid-column: span 12;
  }

  .dashboard-stack > .responses-card {
    grid-column: span 12;
  }

  .response-item {
    padding: 18px;
  }
}
