@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --color-accent: #11538c;
  --color-accent-dark: #0d3a5e;
  --color-secondary: #ff8a00;
  --color-secondary-dark: #e07800;
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-border: #dde3ea;
  --color-border-strong: #c2cdd8;
  --color-text: #1a2636;
  --color-muted: #5f6b7a;
  --color-error: #b3261e;
  --color-success: #2e7d32;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Instrument Serif', 'Times New Roman', serif;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 83, 140, 0.06);
  --shadow-md: 0 4px 12px rgba(17, 83, 140, 0.08);

  --container-width: 760px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-accent); }
a:hover { color: var(--color-secondary); }

/* Layout */
.app-header {
  background-color: var(--color-accent);
  color: #fff;
  padding: 24px 20px;
}
.app-header__inner {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}
.app-header__logo-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.app-header__logo {
  height: 38px;
  width: auto;
  display: block;
}
.app-header__subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 16px;
}

.app-main {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.app-footer {
  border-top: 1px solid var(--color-border);
  background-color: #f7f9fc;
  padding: 18px 20px;
  font-size: 13px;
  color: var(--color-muted);
  text-align: center;
}
.app-footer a { color: var(--color-muted); text-decoration: underline; }

/* Progress */
.progress {
  margin-bottom: 28px;
}
.progress__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.progress__bar {
  background-color: var(--color-border);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.progress__fill {
  background-color: var(--color-secondary);
  height: 100%;
  width: 0%;
  transition: width 280ms ease-out;
}

/* Card / step */
.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 32px;
}

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

.step__eyebrow {
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--color-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}
.step__title {
  font-family: var(--font-heading);
  font-size: 32px;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--color-accent);
}
.step__intro {
  color: var(--color-muted);
  margin: 0 0 24px;
}

/* Questions */
.question {
  border-top: 1px solid var(--color-border);
  padding-top: 22px;
  margin-top: 22px;
}
.question:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.question__code {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  background-color: #e8f0f9;
  color: var(--color-accent);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: 0.4px;
}
.question__label {
  display: block;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 6px;
  color: var(--color-text);
}
.question__required {
  color: var(--color-secondary);
  margin-left: 2px;
}
.question__hint {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 12px;
}
.question__sub-label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  margin: 14px 0 6px;
  color: var(--color-text);
}

/* Form controls */
input[type="text"],
input[type="email"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background-color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text);
  transition: border-color 150ms, box-shadow 150ms;
}
textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(17, 83, 140, 0.12);
}
input[readonly] {
  background-color: #f4f1ea;
  color: var(--color-muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
}
.field label {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--color-text);
}
.field--full { grid-column: 1 / -1; }

/* Radio / checkbox list */
.options {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.options__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background-color: #f7f9fc;
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms;
}
.options__item:hover {
  border-color: var(--color-border-strong);
  background-color: #f6f1e6;
}
.options__item input {
  margin-top: 4px;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}
.options__item input:checked + span {
  font-weight: 500;
}
.options__item--checked {
  border-color: var(--color-accent);
  background-color: #e8f0f9;
}

/* Scale 1-5 */
.scale {
  margin-top: 8px;
}
.scale__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.scale__option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background-color: #fff;
  cursor: pointer;
  font-weight: 500;
  transition: all 120ms;
}
.scale__option:hover {
  border-color: var(--color-accent);
}
.scale__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.scale__option--checked {
  background-color: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.scale__labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 8px;
}

/* Error */
.error {
  display: none;
  color: var(--color-error);
  font-size: 13px;
  margin-top: 6px;
}
.error.is-visible { display: block; }
.field.has-error input,
.field.has-error textarea,
.field.has-error select,
.question.has-error input,
.question.has-error textarea,
.question.has-error select {
  border-color: var(--color-error);
}

/* Navigation */
.nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.btn {
  appearance: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 120ms, transform 120ms, border-color 120ms;
  min-width: 120px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background-color: var(--color-accent);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background-color: var(--color-accent-dark);
}
.btn--secondary {
  background-color: transparent;
  color: var(--color-accent);
  border-color: var(--color-border-strong);
}
.btn--secondary:hover:not(:disabled) {
  border-color: var(--color-accent);
}
.btn--cta {
  background-color: var(--color-secondary);
  color: #fff;
}
.btn--cta:hover:not(:disabled) {
  background-color: var(--color-secondary-dark);
}

/* Privacy notice */
.privacy {
  margin-top: 32px;
  padding: 14px 16px;
  background-color: #f7f9fc;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--color-muted);
  line-height: 1.5;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(17, 83, 140, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-backdrop.is-open {
  display: flex;
}
.modal {
  background-color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  width: 100%;
  padding: 28px;
}
.modal__title {
  font-family: var(--font-heading);
  font-size: 24px;
  margin: 0 0 12px;
  color: var(--color-accent);
}
.modal__body {
  color: var(--color-text);
  margin-bottom: 20px;
  line-height: 1.55;
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Thank-you */
.thankyou {
  text-align: center;
  padding: 40px 20px;
}
.thankyou__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--color-secondary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 32px;
  margin-bottom: 16px;
}
.thankyou__title {
  font-family: var(--font-heading);
  font-size: 32px;
  color: var(--color-accent);
  margin: 0 0 12px;
}
.thankyou__body {
  color: var(--color-muted);
  margin-bottom: 18px;
}
.thankyou__protocol {
  display: inline-block;
  padding: 12px 18px;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-family: 'Courier New', monospace;
  font-size: 18px;
  letter-spacing: 1.5px;
  color: var(--color-accent);
}

/* Admin */
.admin-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}
.admin-page__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-page__title {
  font-family: var(--font-heading);
  font-size: 30px;
  color: var(--color-accent);
  margin: 0;
}
.admin-table-wrap {
  overflow-x: auto;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.admin-table th {
  background-color: #f7f9fc;
  font-weight: 600;
  color: var(--color-accent);
  position: sticky;
  top: 0;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background-color: #f7f9fc; }
.admin-meta {
  color: var(--color-muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.admin-empty {
  padding: 40px;
  text-align: center;
  color: var(--color-muted);
}
.admin-error {
  padding: 14px 18px;
  background-color: #fce8e6;
  color: var(--color-error);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.details-toggle {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  text-decoration: underline;
  padding: 0;
}
.details-row {
  background-color: #f9f7f3;
}
.details-row pre {
  margin: 0;
  padding: 12px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 12px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Responsive */
@media (max-width: 640px) {
  .card { padding: 22px 18px; }
  .step__title { font-size: 26px; }
  .field-grid { grid-template-columns: 1fr; }
  .nav { flex-direction: column-reverse; }
  .nav .btn { width: 100%; }
  .scale__row { flex-wrap: wrap; }
  .scale__option { min-width: 18%; }
}
