:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #657282;
  --line: #d7dde3;
  --accent: #67b82f;
  --accent-dark: #3f7f1c;
  --blue: #315b9f;
  --danger: #b13737;
  --shadow: 0 14px 40px rgba(22, 33, 43, 0.09);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

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

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

.as-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: 8px;
  border-radius: 8px;
  padding: 0 18px;
  text-decoration: none;
  font-weight: 700;
}

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

.ghost:hover {
  background: #eef3f6;
}

.app-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 18px auto 40px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: #9be22d;
  color: #fff;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--blue);
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.18;
}

h3 {
  margin: 18px 0 10px;
  font-size: 18px;
}

.resume-form {
  display: grid;
  gap: 6px;
}

.resume-form label,
.field label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
}

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

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

.progress-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px 16px;
}

.progress-panel > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.progress-panel strong {
  color: var(--text);
}

.progress-bar {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #e4e9ee;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #2e8fb7);
  transition: width 0.2s ease;
}

.survey-panel {
  padding: 22px;
}

.intro-text,
.hint,
.notice {
  color: var(--muted);
  line-height: 1.5;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #c9ddeb;
  border-radius: 8px;
  background: #f0f7fb;
}

.notice.error {
  border-color: #e3b3b3;
  background: #fff1f1;
  color: var(--danger);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

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

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

.question:first-of-type {
  border-top: 0;
  padding-top: 4px;
}

.question-title {
  margin: 0 0 12px;
  font-weight: 800;
  line-height: 1.35;
}

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

.option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}

.option:hover {
  border-color: #9bb4c2;
  background: #f7fbfd;
}

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

.option span {
  line-height: 1.35;
}

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

.matrix {
  overflow-x: auto;
}

.matrix table,
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.matrix th,
.matrix td,
.admin-table th,
.admin-table td {
  border: 1px solid var(--line);
  padding: 10px;
  vertical-align: middle;
}

.matrix th,
.admin-table th {
  background: #eef3f6;
  text-align: left;
}

.matrix td:not(:first-child),
.matrix th:not(:first-child) {
  min-width: 112px;
  text-align: center;
}

.matrix input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.nav-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.review-item strong {
  display: block;
  margin-bottom: 5px;
}

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

.success-panel {
  display: grid;
  gap: 14px;
}

.policy-document {
  max-height: 48vh;
  min-height: 280px;
  overflow-y: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
  color: #394653;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.policy-loading {
  margin: 0;
  color: var(--muted);
}

.consent-check {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid #b9d3aa;
  border-radius: 8px;
  padding: 14px;
  background: #f3faef;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.45;
}

.consent-check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.consent-check:has(input:disabled) {
  cursor: wait;
  opacity: 0.65;
}

.consent-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.access-code {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 48px;
  border: 1px dashed var(--accent-dark);
  border-radius: 8px;
  padding: 8px 14px;
  background: #f3faef;
  color: var(--accent-dark);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.login-form {
  display: grid;
  max-width: 420px;
  gap: 14px;
}

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

.admin-table th,
.admin-table td {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 16px, 640px);
    margin-top: 10px;
  }

  .topbar,
  .field-grid,
  .branch-choice {
    grid-template-columns: 1fr;
  }

  .survey-panel {
    padding: 16px;
  }

  .policy-document {
    max-height: 46vh;
    min-height: 240px;
    padding: 13px;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 21px;
  }

  .resume-row,
  .nav-actions {
    grid-template-columns: 1fr;
  }

  .nav-actions {
    display: grid;
  }

  .nav-actions button {
    width: 100%;
  }

  .as-link {
    justify-content: center;
    width: 100%;
    margin: 8px 0 0;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    justify-content: stretch;
  }

  .admin-actions button {
    width: 100%;
  }
}
