:root {
  --ink: #102f3d;
  --ink-deep: #0e232f;
  --green: #a4b09d;
  --green-dark: #2f4e53;
  --sand: #d4c7b4;
  --paper: #f4f0e8;
  --clay: #cbae93;
  --brown: #815e52;
  --white: #fffdf8;
  --danger: #8a3e3e;
  --shadow: 0 24px 70px rgba(14, 35, 47, 0.13);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", Avenir, "DejaVu Sans", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select { font: inherit; }

.skip {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  border-radius: 8px;
  transform: translateY(-150%);
}
.skip:focus { transform: none; }

.topbar {
  width: min(1160px, calc(100% - 40px));
  min-height: 86px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand > span:last-child { display: flex; align-items: baseline; gap: 7px; }
.brand strong { font-size: 1.7rem; letter-spacing: -0.06em; line-height: 1; }
.brand small { color: var(--brown); font-size: .68rem; font-style: italic; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.brand-face {
  position: relative;
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.brand-face::before, .brand-face::after {
  position: absolute;
  content: "";
  top: 9px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink);
}
.brand-face::before { left: 8px; }
.brand-face::after { right: 8px; }
.brand-face i {
  position: absolute;
  width: 16px;
  height: 8px;
  left: 7px;
  bottom: 6px;
  border-bottom: 2px solid var(--ink);
  border-radius: 0 0 50% 50%;
}

.account { display: flex; align-items: center; gap: 16px; color: rgba(16,47,61,.68); font-size: .88rem; }
.account form { margin: 0; }
.link-button { padding: 0; border: 0; color: var(--ink); background: none; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

.page-shell { width: min(1160px, calc(100% - 40px)); min-height: calc(100vh - 160px); margin: auto; padding: 55px 0 100px; }
.footer { width: min(1160px, calc(100% - 40px)); margin: auto; padding: 24px 0 30px; display: flex; justify-content: space-between; border-top: 1px solid rgba(16,47,61,.14); color: rgba(16,47,61,.62); font-size: .78rem; }

.eyebrow { margin: 0 0 14px; color: var(--brown); font-size: .76rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: -.05em; line-height: 1.03; }
h1 { margin-bottom: 20px; font-size: clamp(2.7rem, 6vw, 5.2rem); }
h2 { font-size: 1.7rem; }

.auth-page {
  display: grid;
  grid-template-columns: minmax(340px, .95fr) minmax(320px, 1.05fr);
  align-items: center;
  gap: clamp(40px, 8vw, 110px);
}

.auth-card { position: relative; max-width: 540px; padding: clamp(28px, 5vw, 58px); border: 1px solid rgba(16,47,61,.14); border-radius: 32px; background: rgba(255,253,248,.72); box-shadow: var(--shadow); }
.auth-card h1 { font-size: clamp(2.5rem, 5vw, 4.3rem); }
.auth-accent { position: absolute; right: 30px; top: 26px; color: var(--clay); font-size: 1.3rem; }
.intro { color: rgba(16,47,61,.7); }
.privacy-note { margin: 20px 0 0; color: rgba(16,47,61,.58); font-size: .8rem; }
.auth-message { position: relative; min-height: 500px; padding: 55px; display: flex; align-items: flex-end; border-radius: 180px 180px 30px 30px; overflow: hidden; color: var(--paper); background: var(--green-dark); }
.auth-message::before { position: absolute; content: ""; width: 180px; height: 180px; right: -20px; top: -25px; border-radius: 50%; background: var(--green); }
.auth-message p { position: relative; z-index: 2; max-width: 430px; margin: 0; font-size: clamp(2rem, 4vw, 4rem); font-weight: 800; letter-spacing: -.055em; line-height: 1.05; }
.soft-line { position: absolute; width: 72%; height: 220px; left: -15%; top: 23%; border: 3px solid var(--clay); border-color: var(--clay) transparent transparent; border-radius: 50%; transform: rotate(18deg); }

.auth-form, .admin-card { display: grid; gap: 10px; margin-top: 30px; }
label { font-size: .84rem; font-weight: 800; }
input, select { width: 100%; min-height: 54px; padding: 13px 15px; border: 1px solid rgba(16,47,61,.24); border-radius: 13px; color: var(--ink); background: var(--white); outline: none; }
input:focus, select:focus { border-color: var(--green-dark); box-shadow: 0 0 0 4px rgba(47,78,83,.12); }

.primary-button, .secondary-button {
  min-height: 54px;
  padding: 13px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 0;
  border-radius: 999px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { margin-top: 12px; color: var(--white); background: var(--ink); }
.primary-button:hover, .primary-button:focus-visible { background: var(--green-dark); }
.secondary-button { border: 1px solid rgba(16,47,61,.25); color: var(--ink); background: transparent; }
.back-link { display: inline-block; margin-top: 18px; font-size: .85rem; font-weight: 800; text-underline-offset: 4px; }

.notice { margin: 22px 0 8px; padding: 13px 15px; border-radius: 12px; color: var(--ink); background: rgba(164,176,157,.38); font-size: .86rem; }
.notice-error { color: var(--danger); background: rgba(138,62,62,.1); }
.code-input { font-size: 1.75rem; font-weight: 800; letter-spacing: .3em; text-align: center; }

.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 50px; margin-bottom: 55px; }
.dashboard-heading h1 { margin: 0; }
.dashboard-heading > p { max-width: 390px; margin: 0; color: rgba(16,47,61,.67); }
.compact-heading { margin-top: 35px; }

.assignment-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.assignment-card { min-height: 350px; padding: 28px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid rgba(16,47,61,.16); border-radius: 26px; background: rgba(255,253,248,.6); }
.assignment-card:nth-child(2n) { background: var(--sand); }
.card-topline, .result-heading, .list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-number { color: var(--brown); font-size: .75rem; font-weight: 800; }
.status { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.status-pending { background: rgba(203,174,147,.38); }
.status-in_progress { background: rgba(164,176,157,.55); }
.status-completed { color: var(--white); background: var(--green-dark); }
.assignment-card h2 { margin-bottom: 14px; font-size: clamp(1.8rem, 3vw, 2.8rem); }
.assignment-card p { color: rgba(16,47,61,.68); }
.card-action { display: flex; justify-content: space-between; padding-top: 18px; border-top: 1px solid rgba(16,47,61,.35); font-size: .86rem; font-weight: 850; text-decoration: none; }
.completed-note { color: rgba(16,47,61,.62); font-size: .82rem; }
.empty-state { padding: 80px 25px; text-align: center; border: 1px dashed rgba(16,47,61,.28); border-radius: 26px; }
.empty-state > span { color: var(--clay); font-size: 3rem; }
.empty-state h2 { margin: 10px 0; }
.empty-state p, .muted { color: rgba(16,47,61,.62); }

.form-page { max-width: 820px; }
.form-head { margin-bottom: 32px; }
.form-head .back-link { margin: 0 0 35px; }
.progress-meta { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 9px; color: rgba(16,47,61,.65); font-size: .78rem; font-weight: 700; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(16,47,61,.12); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green-dark); transition: width .25s ease; }
.questionnaire { padding: clamp(26px, 5vw, 54px); border: 1px solid rgba(16,47,61,.14); border-radius: 28px; background: rgba(255,253,248,.7); box-shadow: var(--shadow); }
.questionnaire-title { margin-bottom: 50px; padding-bottom: 28px; border-bottom: 1px solid rgba(16,47,61,.14); }
.questionnaire-title h1 { margin-bottom: 12px; font-size: clamp(2.4rem, 5vw, 4rem); }
.questionnaire-title > p:last-child { margin: 0; color: rgba(16,47,61,.65); }
.question-step { min-height: 310px; margin: 0; padding: 0; border: 0; }
.question-step legend { max-width: 660px; margin-bottom: 8px; font-size: clamp(1.6rem, 3.5vw, 2.45rem); font-weight: 850; letter-spacing: -.035em; line-height: 1.15; }
.required { color: var(--brown); }
.question-help { color: rgba(16,47,61,.58); font-size: .84rem; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 28px; }
.option { position: relative; min-height: 62px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.option span { width: 100%; min-height: 62px; padding: 16px 18px; display: flex; align-items: center; border: 1px solid rgba(16,47,61,.2); border-radius: 14px; background: var(--white); transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.option input:checked + span { border-color: var(--green-dark); background: rgba(164,176,157,.42); transform: translateY(-2px); }
.option input:focus-visible + span { box-shadow: 0 0 0 4px rgba(47,78,83,.14); }
.form-actions { display: flex; justify-content: space-between; gap: 14px; padding-top: 25px; border-top: 1px solid rgba(16,47,61,.14); }
.form-actions .primary-button { margin: 0 0 0 auto; }
.form-error { min-height: 24px; margin: 14px 0 0; color: var(--danger); font-size: .85rem; }

.admin-layout { display: grid; grid-template-columns: minmax(290px,.72fr) minmax(380px,1.28fr); gap: 24px; align-items: start; }
.admin-card, .patient-list { margin: 0; padding: 28px; border: 1px solid rgba(16,47,61,.15); border-radius: 24px; background: rgba(255,253,248,.64); }
.admin-card h2 { margin-bottom: 24px; }
.admin-card label:not(:first-of-type) { margin-top: 9px; }
.patient-list h2 { margin: 0; }
.list-heading { margin-bottom: 18px; }
.list-heading > span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--sand); font-size: .75rem; font-weight: 800; }
.patient-row { padding: 17px 0; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(16,47,61,.12); text-decoration: none; }
.patient-row strong, .patient-row small { display: block; }
.patient-row small { margin-top: 4px; color: rgba(16,47,61,.58); }
.results-list { display: grid; gap: 18px; }
.result-card { padding: 28px; border: 1px solid rgba(16,47,61,.15); border-radius: 24px; background: rgba(255,253,248,.65); }
.result-card h2 { margin: 0; }
.result-card dl { margin: 25px 0 0; }
.result-card dl > div { padding: 16px 0; border-top: 1px solid rgba(16,47,61,.12); }
.result-card dt { font-weight: 800; }
.result-card dd { margin: 5px 0 0; color: rgba(16,47,61,.68); }

@media (max-width: 820px) {
  .auth-page, .admin-layout { grid-template-columns: 1fr; }
  .auth-message { min-height: 320px; border-radius: 120px 120px 25px 25px; }
  .dashboard-heading { align-items: start; flex-direction: column; gap: 15px; }
  .assignment-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar, .page-shell, .footer { width: min(100% - 28px, 1160px); }
  .topbar { min-height: 75px; }
  .brand > span:last-child { display: block; }
  .brand small { display: block; margin-top: 3px; }
  .account > span { display: none; }
  .page-shell { padding-top: 30px; }
  .auth-card, .questionnaire { padding: 26px 20px; border-radius: 22px; }
  .auth-message { display: none; }
  .options { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  .form-actions button { width: 100%; }
  .footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
