:root {
    color-scheme: light;
    --ink: #183329;
    --muted: #5d7169;
    --green: #2f7d5b;
    --green-dark: #215c43;
    --mint: #dff3e9;
    --peach: #ffe6d8;
    --yellow: #f6c85f;
    --berry: #d86b7d;
    --surface: rgba(255, 255, 255, 0.94);
    --line: #d9e8e0;
    --shadow: 0 1.25rem 3.5rem rgb(33 92 67 / 10%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
    color: var(--ink);
    background: #f8fbf8;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 5% 0%, #edf8f0 0, transparent 32rem), linear-gradient(145deg, #fbfdfb, #f7fbf8 55%, #fffaf6); }
.public-shell, .portal-shell { display: flex; flex-direction: column; }
a { color: var(--green-dark); }
button, input, textarea, select { font: inherit; }
button, .button { cursor: pointer; }
h1, h2, h3 { margin: 0 0 .65rem; line-height: 1.16; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 6vw, 3.5rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: .5rem 0 1.1rem; }

.public-header, .portal-header {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 2rem, 78rem);
    margin-inline: auto;
    padding: 1.15rem 0;
}
.portal-header { width: 100%; padding: .85rem max(1rem, calc((100% - 78rem) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.brand { display: inline-flex; gap: .65rem; align-items: center; color: var(--ink); font-size: 1.1rem; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; width: 2.25rem; aspect-ratio: 1; place-items: center; border-radius: 42% 58% 55% 45%; background: linear-gradient(145deg, var(--green), #56ad79); color: white; box-shadow: 0 .5rem 1rem rgb(47 125 91 / 22%); }
.text-link { font-weight: 700; text-decoration: none; }
.public-main, .portal-main { position: relative; z-index: 2; flex: 1; width: min(100% - 2rem, 78rem); margin-inline: auto; padding: clamp(1.2rem, 4vw, 3.5rem) 0 5rem; }
.page { width: min(100% - 2rem, 38rem); margin-inline: auto; padding-block: 2rem; }

.card { overflow-wrap: anywhere; padding: clamp(1.3rem, 4vw, 2.25rem); border: 1px solid rgba(201, 225, 213, .9); border-radius: 1.35rem; background: var(--surface); box-shadow: var(--shadow); }
.wide-card { width: min(100%, 70rem); margin-inline: auto; }
.form-card { width: min(100%, 48rem); margin-inline: auto; }
.questionnaire-card { width: min(100%, 54rem); margin-inline: auto; }
.center { text-align: center; }
.lead { max-width: 48rem; color: #38594c; font-size: clamp(1.05rem, 2vw, 1.25rem); }
.muted { color: var(--muted); }
.privacy-reference { margin: 0; padding: .9rem 1rem; border-radius: .8rem; background: #f7faf8; color: var(--muted); font-weight: 620; }
.eyebrow { margin: 0 0 .75rem; color: var(--green); font-size: .78rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.top-space { margin-top: 1.25rem; }

.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(16rem, .8fr); gap: clamp(2rem, 7vw, 5rem); align-items: center; min-height: 34rem; background: linear-gradient(140deg, rgba(255,255,255,.97), rgba(239,249,242,.92)); }
.hero-visual { position: relative; display: grid; min-height: 24rem; place-items: center; overflow: hidden; border-radius: 50% 42% 48% 45%; background: linear-gradient(145deg, var(--peach), #fff5d9 55%, var(--mint)); color: #6f786f; font-weight: 750; text-align: center; }
.hero-visual::before, .hero-visual::after { content: ""; position: absolute; border-radius: 50%; filter: blur(.3px); }
.hero-visual::before { width: 5rem; height: 5rem; left: 12%; bottom: 12%; background: radial-gradient(circle at 35% 30%, #ffb58f, #e96f56); }
.hero-visual::after { width: 3.8rem; height: 3.8rem; right: 14%; top: 15%; background: radial-gradient(circle at 35% 30%, #ffe590, #f2bc3f); }
.leaf { position: absolute; width: 3.5rem; height: 1.7rem; border-radius: 100% 0 100% 0; background: #74aa72; transform: rotate(-25deg); }
.leaf-one { left: 18%; bottom: 29%; }.leaf-two { right: 22%; top: 29%; transform: rotate(150deg); }
.fruit { position: fixed; z-index: 0; border-radius: 50%; opacity: .18; filter: blur(1px); pointer-events: none; }
.fruit-lemon { width: 8rem; height: 8rem; top: 8rem; right: -3rem; background: #f3c64c; }
.fruit-berry { width: 5rem; height: 5rem; bottom: 4rem; left: -2rem; background: var(--berry); }

label { display: block; font-weight: 720; }
input, textarea, select { display: block; width: 100%; margin-top: .4rem; padding: .78rem .9rem; border: 1px solid #a9c0b5; border-radius: .75rem; background: white; color: var(--ink); }
input, select { min-height: 3rem; }
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, .button:focus-visible, a:focus-visible { outline: 3px solid rgb(246 200 95 / 75%); outline-offset: 2px; }
fieldset { min-width: 0; }
legend { font-weight: 760; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem; }
.form-grid .full { grid-column: 1 / -1; }
.compact-fieldset { margin: .25rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; }
.check-label, .consent { display: flex; gap: .75rem; align-items: flex-start; }
.check-label input, .consent input { flex: 0 0 1.2rem; width: 1.2rem; min-height: 1.2rem; margin: .2rem 0 0; }
.consent { padding: 1rem; border-radius: .9rem; background: #f1f8f3; font-weight: 620; }

button, .button { display: inline-flex; min-height: 3rem; width: auto; margin: 0; padding: .72rem 1.2rem; border: 0; border-radius: .8rem; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--green), var(--green-dark)); color: white; font-weight: 800; text-align: center; text-decoration: none; box-shadow: 0 .5rem 1.1rem rgb(33 92 67 / 16%); }
button:hover, .button:hover { transform: translateY(-1px); }
.button.secondary, button.secondary { background: linear-gradient(135deg, #d96854, #b84d44); }
.button.ghost, button.ghost { border: 1px solid #a6bdb2; background: white; color: var(--green-dark); box-shadow: none; }
.button.small, button.small { min-height: 2.35rem; padding: .45rem .75rem; font-size: .86rem; }
.button-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: 1.35rem; }
.button-row.split { justify-content: space-between; }
.button-row.split > * { min-width: 8rem; }

.notice { width: min(100%, 54rem); margin: 0 auto 1rem; padding: .9rem 1rem; border-left: .35rem solid var(--green); border-radius: .45rem; background: #eaf6ee; }
.notice.error { border-color: #bd4b58; background: #fff0f1; color: #7c2530; }
.notice.success { border-color: var(--green); background: #e8f7ed; }
.notice.warning { border-color: #c47a1d; background: #fff4dd; color: #70400b; }
.notice ul { margin: .4rem 0 0; padding-left: 1.25rem; }
.field-error, .error { color: #9f2431; font-weight: 700; }
.field-error, .field-help { display: block; margin-top: .35rem; font-size: .86rem; }
.field-help { color: var(--muted); font-weight: 600; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: #bd4b58; background: #fffafa; }
.required { color: #b14754; }
.success-icon { display: grid; width: 4.5rem; height: 4.5rem; margin: 0 auto 1rem; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green-dark); font-size: 2rem; font-weight: 900; }

.progress-meta { display: flex; justify-content: space-between; margin-bottom: .4rem; color: var(--muted); font-size: .82rem; font-weight: 750; }
.progress { height: .55rem; margin-bottom: 2rem; overflow: hidden; border-radius: 1rem; background: #e5eee9; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #73b872, var(--yellow)); }
.question { margin: 1.15rem 0; padding: 1.15rem; border: 1px solid var(--line); border-radius: 1rem; background: #fbfdfb; }
.question[hidden], [hidden] { display: none !important; }
.choice-row, .choice-stack { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: .85rem; }
.choice-stack { flex-direction: column; }
.choice { display: inline-flex; min-width: 6rem; gap: .55rem; align-items: center; padding: .68rem .85rem; border: 1px solid #bcd0c6; border-radius: .75rem; background: white; font-weight: 700; cursor: pointer; }
.choice input { width: 1.15rem; min-height: 1.15rem; margin: 0; accent-color: var(--green); }
.choice:has(input:checked) { border-color: var(--green); background: var(--mint); box-shadow: inset 0 0 0 1px var(--green); }
.choice-row.wrap .choice { min-width: 4.5rem; }

.portal-nav { display: flex; gap: .85rem; align-items: center; flex-wrap: wrap; }
.portal-nav a { padding: .55rem .3rem; color: var(--ink); font-weight: 700; text-decoration: none; }
.portal-nav form { margin: 0; }
.nav-button { min-height: 2.4rem; padding: .45rem .75rem; border: 1px solid var(--line); background: white; color: var(--ink); box-shadow: none; }
.page-heading, .section-heading { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.3rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stat-card { display: flex; min-height: 9rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1.15rem; flex-direction: column; justify-content: center; background: white; color: var(--ink); text-decoration: none; box-shadow: 0 .6rem 1.6rem rgb(33 92 67 / 7%); }
.stat-card strong { color: var(--green); font-size: 2.4rem; }.stat-card span { color: var(--muted); font-weight: 700; }
.stat-card.accent { background: linear-gradient(145deg, #fff7e6, #fff); }
.action-panel, .table-card, .link-card, .version-card, .answers-card { margin-top: 1.2rem; }
.copy-row { display: flex; gap: .65rem; align-items: flex-end; }.copy-row input { margin: 0; }.copy-row button { flex: 0 0 auto; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.badge { display: inline-flex; padding: .28rem .58rem; border-radius: 99rem; background: var(--mint); color: var(--green-dark); font-size: .76rem; font-weight: 800; }
.badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.advisor-list, .questionnaire-list { display: grid; gap: .9rem; }
.advisor-row, .questionnaire-row { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(20rem, 1.5fr); gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: #fbfdfb; color: var(--ink); text-decoration: none; }
.advisor-row > div:first-child, .questionnaire-row > div:first-child { display: flex; flex-direction: column; }
.inline-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; align-items: end; }
.inline-form button { grid-column: 1 / -1; }
.advisor-link { grid-column: 1 / -1; display: grid; gap: .9rem; }
.advisor-link code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participant-link-tools { display: grid; grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr); gap: 1.25rem; align-items: center; }
.participant-qr { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: white; }
.participant-link-details { min-width: 0; }
.participant-link-actions { margin-top: .75rem; }
.participant-link-actions .button, .participant-link-actions button { min-height: 2.5rem; padding: .5rem .8rem; font-size: .86rem; }
.copy-status { min-height: 1.5rem; margin: .45rem 0 0; }
.qr-print-page { display: grid; min-height: 100vh; place-items: center; background: white; }
.qr-print-sheet { width: min(100% - 2rem, 42rem); padding: 2rem; text-align: center; }
.print-qr { width: min(100%, 26rem); margin: 1.5rem auto; }
.print-url { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
summary { cursor: pointer; }
.version-card { margin-bottom: 1.5rem; }
.editor-section { margin: 1rem 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: #fbfdfb; }
.editor-questions { display: grid; gap: .55rem; padding-left: 1.5rem; }
.editor-questions li { padding: .6rem .75rem; border-radius: .7rem; background: white; }
.editor-questions li div { display: flex; gap: .5rem; flex-direction: column; }
.editor-questions span, .editor-questions small { color: var(--muted); }
.editor-form { margin-top: .9rem; padding: .85rem; border: 1px dashed #9db9aa; border-radius: .8rem; }
.add-section { background: #f4faf5; }
.detail-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 1.2rem; }
.detail-list, .answer-row { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 9rem 1fr; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); font-weight: 750; } dd { margin: 0; }
.answer-section { padding: 1rem 0; border-top: 1px solid var(--line); }
.answer-row { display: grid; grid-template-columns: minmax(12rem, 1.8fr) minmax(8rem, 1fr); gap: 1rem; padding: .65rem 0; }

.qr-code { width: min(100%, 16rem); margin: 1rem auto; }.qr-code svg { display: block; width: 100%; height: auto; }
.recovery-codes { padding-left: 1.4rem; overflow-wrap: anywhere; }
.legal-footer { position: relative; z-index: 2; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .9); }
.legal-footer-inner { display: flex; width: min(100% - 2rem, 78rem); margin-inline: auto; padding: 1.25rem 0; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 700; }
.legal-footer nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.legal-footer a { font-weight: 800; }
.legal-card { width: min(100%, 62rem); margin-inline: auto; }
.legal-document { display: grid; gap: 1.6rem; }
.legal-document section { padding-top: 1.4rem; border-top: 1px solid var(--line); }
.legal-document section:first-of-type { padding-top: 0; border-top: 0; }
.legal-document ul { padding-left: 1.3rem; }
.legal-document li + li { margin-top: .35rem; }
.legal-details { display: grid; gap: .65rem; margin: 0; }
.legal-details > div { display: grid; grid-template-columns: minmax(12rem, .65fr) minmax(0, 1.35fr); gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.preserve-lines { white-space: pre-line; }
.draft-banner { margin: 0 0 1.5rem; border-color: #c47a1d; background: #fff4dd; color: #70400b; }

@media (max-width: 860px) {
    .hero, .detail-grid, .participant-link-tools { grid-template-columns: 1fr; }
    .hero { min-height: auto; }
    .hero-visual { min-height: 17rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .advisor-row { grid-template-columns: 1fr; }
    .inline-form { grid-template-columns: 1fr 1fr; }
    .inline-form button { grid-column: 1 / -1; }
}
@media print {
    .print-button { display: none; }
    .qr-print-page, .qr-print-sheet { width: 100%; min-height: 0; padding: 0; }
}
@media (max-width: 640px) {
    .public-header, .portal-header { align-items: flex-start; }
    .portal-header { flex-direction: column; }
    .portal-nav { width: 100%; margin-top: .7rem; overflow-x: auto; flex-wrap: nowrap; }
    .portal-nav a { white-space: nowrap; }
    .form-grid, .stat-grid { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: auto; }
    .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
    .choice-row { display: grid; grid-template-columns: 1fr 1fr; }
    .choice-row.wrap { grid-template-columns: repeat(3, 1fr); }
    .choice { width: 100%; min-width: 0; }
    .button-row.split > * { flex: 1 1 8rem; }
    .copy-row, .advisor-link { align-items: stretch; flex-direction: column; }
    .copy-row button { width: 100%; }
    .answer-row, .detail-list > div { grid-template-columns: 1fr; gap: .25rem; }
    .legal-footer-inner { align-items: flex-start; flex-direction: column; gap: .75rem; }
    .legal-details > div { grid-template-columns: 1fr; gap: .2rem; }
    h1 { font-size: clamp(1.8rem, 10vw, 2.6rem); }
}
