:root {
  color-scheme: light;
  --orange: #ef5a08;
  --orange-dark: #c74400;
  --orange-soft: #fff2e9;
  --green: #079b70;
  --green-soft: #e9faf4;
  --purple: #7337e6;
  --red: #d72c2c;
  --ink: #202a3a;
  --muted: #687386;
  --line: #dfe4ec;
  --bg: #f4f7f6;
  --white: #fff;
  --shadow: 0 18px 50px rgba(39, 45, 55, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 100% 0, #e9faf3, transparent 28rem), radial-gradient(circle at 0 12rem, #fff0e7, transparent 24rem), var(--bg); }
button, input, select, textarea { font: inherit; }
button, select, input[type="date"] { cursor: pointer; }
.hidden { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem max(1rem, calc((100vw - 1120px)/2)); background: var(--orange); color: white; box-shadow: 0 3px 14px rgba(113, 45, 5, .18); }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: .7rem; min-width: 0; }
.brand-logo { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 50%; color: var(--green); background: white; border: 3px solid #ffd3b8; font-size: 1.65rem; font-weight: 800; }
.brand strong { display: block; font-size: 1.25rem; line-height: 1.1; }
.brand small { display: block; margin-top: .15rem; opacity: .92; }

.patient-shell { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.info-banner { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.15rem; border-left: 5px solid #317ff2; border-radius: 0 14px 14px 0; background: #edf5ff; box-shadow: 0 8px 24px rgba(34, 90, 160, .07); }
.info-banner h1 { font-size: 1rem; color: #1854ac; margin: 0 0 .25rem; }
.info-banner p { color: #245cae; margin: 0; line-height: 1.55; }
.info-icon { display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; color: white; background: #347fed; font-weight: 800; }
.card { margin-top: 1rem; padding: clamp(1rem, 3vw, 2rem); background: rgba(255,255,255,.96); border: 1px solid rgba(255,255,255,.8); border-radius: 22px; box-shadow: var(--shadow); }
.form-card { max-width: 880px; margin-left: auto; margin-right: auto; }
.section-heading { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: 1.1rem; }
.section-heading > span { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; background: var(--orange-soft); color: var(--orange); font-size: 1.4rem; }
.section-heading h2 { margin: 0; font-size: 1.3rem; }
.section-heading p { margin: .25rem 0 0; color: var(--muted); }
.section-heading.divider { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .42rem; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { color: #3b4658; font-size: .92rem; font-weight: 700; }
.field em { color: var(--muted); font-weight: 500; font-style: normal; }
.field b { color: var(--red); }
.field small { color: #8a94a5; line-height: 1.35; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #ccd4df; border-radius: 13px; color: var(--ink); background: white; padding: .83rem .95rem; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.field textarea { resize: vertical; cursor: text; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #ff8b4b; box-shadow: 0 0 0 3px rgba(239,90,8,.13); }
.field input:disabled, .field select:disabled, .field textarea:disabled { cursor: not-allowed; color: #768093; background: #f2f4f7; }
.message { margin: 1rem 0; padding: .85rem 1rem; border-radius: 12px; background: #edf5ff; color: #285b9d; line-height: 1.45; font-weight: 600; }
.message.success { background: var(--green-soft); color: #067655; }
.message.error { background: #fff0f0; color: #b21f1f; }
.message.warning { background: #fff8df; color: #8d5c03; }
.session-list { display: grid; gap: .55rem; }
.session-option { position: relative; display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .8rem; border: 1px solid #d8deea; border-radius: 12px; background: white; cursor: pointer; }
.session-option:has(input:checked) { border-color: var(--purple); background: #f5f0ff; box-shadow: 0 0 0 2px rgba(115,55,230,.08); }
.session-option:has(input:disabled) { cursor: not-allowed; opacity: .58; background: #f4f5f7; }
.session-option strong, .session-option small { display: block; }
.session-option small { margin-top: .15rem; color: var(--muted); }
.empty { color: var(--muted); margin: .65rem 0; }
.consent { display: flex; align-items: flex-start; gap: .7rem; margin: 1.25rem 0; padding: .9rem; border: 1px solid #ffd17b; background: #fff9e9; border-radius: 13px; color: #60431d; line-height: 1.48; }
.consent input { flex: 0 0 auto; width: 20px; height: 20px; margin-top: .1rem; accent-color: var(--orange); }
.button { border: 0; border-radius: 11px; padding: .78rem 1rem; font-weight: 750; transition: transform .1s, filter .15s, opacity .15s; }
.button:hover:not(:disabled) { filter: brightness(.97); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { color: white; background: linear-gradient(135deg, #fa690f, var(--orange)); box-shadow: 0 8px 20px rgba(239,90,8,.18); }
.button-secondary { color: var(--ink); background: #eef1f5; }
.button-soft { color: white; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); }
.button-wide { width: 100%; }
footer { padding: 1.25rem; text-align: center; color: #8a93a1; font-size: .85rem; }

.dialog { width: min(94vw, 620px); max-height: min(90vh, 820px); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 30px 90px rgba(12,19,30,.3); }
.dialog::backdrop { background: rgba(10,16,25,.65); backdrop-filter: blur(3px); }
.dialog-card { position: relative; max-height: 90vh; overflow: auto; padding: clamp(1.25rem, 4vw, 2rem); }
.dialog-card h2 { margin: .6rem 0 .4rem; text-align: center; }
.dialog-card > p { color: var(--muted); text-align: center; line-height: 1.45; }
.dialog-close { position: sticky; float: right; top: 0; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%; color: #596579; background: #edf0f4; font-size: 1.5rem; line-height: 1; }
.dialog-icon { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto; border: 5px solid; border-radius: 50%; font-size: 2.1rem; font-weight: 800; }
.dialog-icon.warning { color: #ed8a31; border-color: #ffd0a3; }
.dialog-icon.info { color: #4d6fe8; border-color: #cad6ff; }
.dialog-icon.success { color: var(--green); border-color: #bfeeda; }
.dialog-icon.error { color: #e45151; border-color: #ffc7c7; }
.summary-list { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 1.1rem 0; }
.summary-list div { padding: .7rem .8rem; border-radius: 10px; background: #f5f7fa; }
.summary-list dt { color: var(--muted); font-size: .78rem; }
.summary-list dd { margin: .2rem 0 0; font-weight: 750; overflow-wrap: anywhere; }
.confirm-consent { margin-bottom: 1rem; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: .65rem; }
.result-card { text-align: center; }

@media (max-width: 640px) {
  .topbar { padding: .6rem .75rem; }
  .brand-logo { flex-basis: 39px; height: 39px; }
  .brand strong { font-size: 1.03rem; }
  .brand small { font-size: .72rem; }
  .button-soft { padding: .65rem .75rem; white-space: nowrap; font-size: .86rem; }
  .patient-shell { padding: .85rem .65rem 2rem; }
  .info-banner { border-radius: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .card { border-radius: 17px; }
  .section-heading p { font-size: .88rem; }
  .summary-list { grid-template-columns: 1fr; }
  .dialog-actions { grid-template-columns: 1fr; }
  .dialog-actions .button-primary { grid-row: 1; }
}
