:root {
  --ink: #17362f;
  --ink-soft: #526b65;
  --paper: #fffdf6;
  --cream: #f7eed9;
  --sun: #edaa24;
  --sun-soft: #ffd978;
  --coral: #d96d4b;
  --teal: #176a5a;
  --teal-dark: #0c483d;
  --line: rgba(23, 54, 47, 0.16);
  --danger: #9f2f28;
  --shadow: 0 24px 70px rgba(40, 52, 38, 0.14);
  --radius: 26px;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --body: "Avenir Next", Avenir, "Gill Sans", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--cream); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 217, 120, 0.75), transparent 28rem),
    radial-gradient(circle at 93% 92%, rgba(23, 106, 90, 0.2), transparent 34rem),
    linear-gradient(rgba(23, 54, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 54, 47, 0.045) 1px, transparent 1px),
    var(--cream);
  background-size: auto, auto, 32px 32px, 32px 32px, auto;
}

button, input, textarea, select { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.site-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }

.masthead { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px;
  color: var(--paper); background: var(--teal); font: 700 30px/1 var(--display);
  box-shadow: 7px 7px 0 var(--sun-soft); transform: rotate(-2deg);
}
.brand-kicker { margin: 0 0 2px; color: var(--coral); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.brand-name { margin: 0; font: 700 clamp(1.1rem, 3vw, 1.45rem)/1.1 var(--display); }
.status-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,253,246,.72); color: var(--ink-soft); font-size: .82rem; }

.panel {
  position: relative; overflow: hidden; padding: clamp(24px, 5vw, 52px);
  border: 1px solid rgba(255,255,255,.8); border-radius: var(--radius);
  background: rgba(255, 253, 246, 0.94); box-shadow: var(--shadow);
  animation: rise .45s ease both;
}
.panel::after { content: ""; position: absolute; right: -70px; bottom: -90px; width: 220px; height: 220px; border-radius: 50%; background: rgba(237,170,36,.12); pointer-events: none; }
.narrow { width: min(620px, 100%); margin: 7vh auto 0; }

.eyebrow { color: var(--coral); font-weight: 800; font-size: .78rem; letter-spacing: .15em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--display); }
h1 { margin: 8px 0 12px; font-size: clamp(2.35rem, 8vw, 5.2rem); line-height: .98; letter-spacing: -.035em; }
h2 { margin: 6px 0 14px; font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.03; }
h3 { margin: 0 0 12px; font-size: 1.3rem; }
.lede { max-width: 66ch; color: var(--ink-soft); font-size: clamp(1rem, 2.2vw, 1.16rem); line-height: 1.65; }
.quiet { color: var(--ink-soft); line-height: 1.55; }
.tiny { font-size: .82rem; }

.form-grid { display: grid; gap: 18px; margin-top: 28px; }
.field { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
.field input, .field textarea, .field select, .matrix-select, .rank-select {
  width: 100%; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  color: var(--ink); background: #fff; outline: none; transition: border .2s, box-shadow .2s;
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus, .matrix-select:focus, .rank-select:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(23,106,90,.12); }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; }
.button {
  min-height: 48px; padding: 12px 20px; border: 0; border-radius: 14px; font-weight: 800;
  color: white; background: var(--teal); box-shadow: 0 8px 20px rgba(23,106,90,.2); transition: transform .18s, background .18s;
}
.button:hover { transform: translateY(-2px); background: var(--teal-dark); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button.secondary { color: var(--teal); background: transparent; border: 1.5px solid var(--teal); box-shadow: none; }
.button.ghost { color: var(--ink-soft); background: transparent; box-shadow: none; }
.button.danger { background: var(--danger); }

.notice { margin: 18px 0; padding: 14px 16px; border-left: 5px solid var(--sun); border-radius: 10px; background: rgba(255,217,120,.22); line-height: 1.5; }
.error { border-left-color: var(--danger); color: var(--danger); background: rgba(159,47,40,.08); }
.success { border-left-color: var(--teal); color: var(--teal-dark); background: rgba(23,106,90,.09); }

.assessment-head { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; margin-bottom: 18px; }
.progress-copy { color: var(--ink-soft); font-weight: 700; text-align: right; }
.progress-track { width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 99px; background: rgba(23,54,47,.1); margin-bottom: 26px; appearance: none; }
.progress-track::-webkit-progress-bar { background: rgba(23,54,47,.1); border-radius: 99px; }
.progress-track::-webkit-progress-value { background: linear-gradient(90deg, var(--sun), var(--coral)); border-radius: 99px; }
.progress-track::-moz-progress-bar { background: linear-gradient(90deg, var(--sun), var(--coral)); border-radius: 99px; }
.question-number { color: var(--sun); font: 700 2rem/1 var(--display); }
.question-text { max-width: 30ch; margin: 12px 0 26px; font: 700 clamp(1.6rem, 4vw, 2.65rem)/1.14 var(--display); }
.response-help { margin: -12px 0 20px; color: var(--ink-soft); }

.choices { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; border: 0; padding: 0; margin: 0; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; min-height: 76px; padding: 16px; border: 1.5px solid var(--line); border-radius: 16px; background: white; font-weight: 650; line-height: 1.4; transition: transform .16s, border .16s, background .16s; }
.choice:hover { transform: translateY(-2px); border-color: rgba(23,106,90,.55); }
.choice:has(input:checked) { border-color: var(--teal); background: rgba(23,106,90,.08); box-shadow: inset 0 0 0 1px var(--teal); }
.choice input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--teal); }
.choice-small { min-height: auto; }

.subquestion { margin-top: 26px; padding-top: 22px; border-top: 1px dashed var(--line); }
.subquestion legend { margin-bottom: 12px; font-weight: 800; }
.compact-choices { grid-template-columns: repeat(4, minmax(0,1fr)); }
.compact-choices .choice { min-height: 92px; font-size: .9rem; }

.rank-list { display: grid; gap: 12px; }
.rank-row { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: center; }
.rank-number { color: var(--coral); font-weight: 800; }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: white; }
.matrix { width: 100%; border-collapse: collapse; min-width: 640px; }
.matrix th, .matrix td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.matrix tr:last-child th, .matrix tr:last-child td { border-bottom: 0; }
.matrix th { width: 48%; font-size: .92rem; }

.offline-banner { position: sticky; top: 10px; z-index: 10; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; color: #593a00; background: var(--sun-soft); font-weight: 750; text-align: center; }
.sync-note { margin-left: auto; color: var(--ink-soft); font-size: .88rem; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin-top: 26px; }
.dashboard-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.dashboard-card strong { display: block; color: var(--coral); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }
.subpanel { margin-top: 28px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.62); }
.subpanel h2 { margin-bottom: 6px; font-size: clamp(1.45rem, 4vw, 2.1rem); }
.subpanel .form-grid { margin-top: 18px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(9,31,26,.72); }
.modal { width: min(540px,100%); padding: 28px; border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.conflict-versions { display: grid; gap: 12px; margin: 20px 0; }
.conflict-versions > div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.62); }
.conflict-versions p { margin: 6px 0 0; overflow-wrap: anywhere; }

.report-page { padding: 0 0 70px; }
.report-shell { width: min(980px, calc(100% - 32px)); margin: 0 auto; }
.report-nav { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px 0; color: var(--ink-soft); font-size: .86rem; }
.report-nav a { color: var(--teal-dark); font-weight: 800; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.report-hero { padding: clamp(32px, 8vw, 76px); border-radius: 0 0 34px 34px; color: var(--paper); background: linear-gradient(135deg, var(--teal-dark), var(--teal) 62%, #2d7b67); box-shadow: var(--shadow); }
.report-hero h1 { max-width: 13ch; color: white; }
.report-hero p { max-width: 62ch; margin: 18px 0 0; color: rgba(255,255,255,.85); font-size: 1.08rem; line-height: 1.65; }
.report-hero .eyebrow { color: var(--sun-soft); }
.report-section { padding: 42px 0 10px; }
.report-section > h2 { max-width: 18ch; margin-bottom: 22px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.card-grid.compact { grid-template-columns: repeat(3, minmax(0,1fr)); }
.report-stack { display: grid; gap: 18px; }
.report-card { padding: 22px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,253,246,.94); box-shadow: 0 10px 30px rgba(20,46,40,.07); break-inside: avoid; }
.report-card p, .report-card li, .report-section > div > p, .report-section > div > ul { color: var(--ink-soft); line-height: 1.62; }
.report-card p:last-child, .report-card ul:last-child { margin-bottom: 0; }
.report-card h4 { margin: 20px 0 4px; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.family-card { border-top: 5px solid var(--sun); }
.report-callout { margin: 24px 0; padding: 20px 22px; border-radius: 16px; color: var(--paper); background: var(--coral); font: 700 1.05rem/1.55 var(--body); }
.report-callout.soft { color: var(--ink); background: var(--sun-soft); font-weight: 650; }
.report-callout.closing { padding: clamp(26px, 5vw, 46px); background: var(--teal-dark); font: 700 clamp(1.25rem, 3vw, 1.8rem)/1.45 var(--display); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .site-shell { width: min(100% - 20px, 1120px); padding-top: 16px; }
  .masthead { align-items: flex-start; }
  .status-chip { display: none; }
  .panel { padding: 22px 17px; border-radius: 20px; }
  .choices, .compact-choices, .dashboard-grid { grid-template-columns: 1fr; }
  .compact-choices .choice { min-height: auto; }
  .assessment-head { grid-template-columns: 1fr; }
  .progress-copy { text-align: left; }
  .rank-row { grid-template-columns: 1fr; gap: 5px; }
  .button-row .button { flex: 1 1 auto; }
  .report-shell { width: min(100% - 20px, 980px); }
  .report-hero { padding: 34px 22px; border-radius: 0 0 24px 24px; }
  .report-section { padding-top: 32px; }
  .card-grid, .card-grid.compact { grid-template-columns: 1fr; }
  .report-nav span { display: none; }
}

@media print {
  body { background: white; }
  .masthead .button, .no-print { display: none !important; }
  .site-shell { width: 100%; padding: 0; }
  .panel { box-shadow: none; border: 0; }
  .report-nav { display: none; }
  .report-shell { width: 100%; }
  .report-hero { color: var(--ink); background: white; box-shadow: none; border-bottom: 3px solid var(--ink); }
  .report-hero h1, .report-hero p, .report-hero .eyebrow { color: var(--ink); }
  .report-card { box-shadow: none; }
  .report-callout, .report-callout.soft, .report-callout.closing { color: var(--ink); background: white; border: 2px solid var(--ink); }

  /* Let the Student Report flow across pages without splitting columns. */
  .student-report { padding: 0; font-size: 11pt; }
  .student-report .report-shell { width: 100%; }
  .student-report .report-hero { padding: 0 0 14pt; border-radius: 0; }
  .student-report .report-hero h1 { max-width: none; font-size: 28pt; line-height: 1.15; }
  .student-report .report-hero p { font-size: 11pt; line-height: 1.45; margin-top: 8pt; }
  .student-report .report-section { padding: 12pt 0 0; }
  .student-report .report-section > h2 { max-width: none; font-size: 18pt; line-height: 1.2; margin: 0 0 8pt; }
  .student-report h2, .student-report h3, .student-report h4, .student-report .eyebrow { break-after: avoid; page-break-after: avoid; }
  .student-report .card-grid, .student-report .report-stack { display: block; }
  .student-report .report-card { break-inside: auto; padding: 10pt 12pt; margin: 0 0 9pt; border-radius: 8pt; background: white; }
  .student-report .report-card h3 { font-size: 12pt; line-height: 1.35; margin-bottom: 6pt; }
  .student-report .report-card h4 { margin: 9pt 0 4pt; font-size: 9pt; }
  .student-report p, .student-report li { font-size: 11pt; line-height: 1.45; color: var(--ink); orphans: 3; widows: 3; }
  .student-report p, .student-report ul { margin-top: 5pt; margin-bottom: 6pt; }
  .student-report .report-callout { margin: 10pt 0; padding: 10pt 12pt; font-size: 11pt; line-height: 1.45; border-width: 1pt; border-radius: 8pt; }
  .student-report .report-callout.closing { font-size: 13pt; line-height: 1.45; break-inside: avoid; }
}
