:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", sans-serif;
    color: #17233b;
    background: #f4f7fb;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 5vw; background: #fff; border-bottom: 1px solid #dfe7f1; }
.brand { color: #0b5d56; font-weight: 750; text-decoration: none; }
.environment { color: #607089; font-size: .875rem; }
.app-header nav { display: flex; align-items: center; gap: 1.25rem; }
.app-header nav a { color: #34445d; text-decoration: none; }
.current-user { color: #52627a; font-size: .9rem; }
.logout-form { margin: 0; }
.logout-form button { border: 0; padding: 0; color: #34445d; background: transparent; font: inherit; cursor: pointer; }
.page-shell { width: min(1120px, 90vw); margin: 0 auto; padding: 5rem 0; }
.hero { max-width: 780px; }
.eyebrow { color: #087f72; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: .5rem 0 1.25rem; font-size: clamp(2.4rem, 6vw, 5rem); line-height: .98; letter-spacing: -.045em; }
.lead { color: #52627a; font-size: 1.2rem; line-height: 1.7; }
.module-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 4rem; }
.module-grid article { padding: 1.4rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; box-shadow: 0 12px 35px rgb(34 62 89 / 7%); }
.module-grid span { color: #0b8f80; font-weight: 800; }
.module-grid h2 { margin: 2rem 0 .5rem; font-size: 1.05rem; }
.module-grid p { margin: 0; color: #68778c; line-height: 1.5; }
.schedule-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; }
.schedule-heading h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.schedule-actions { display: flex; align-items: end; gap: 1rem; }
.date-form { display: flex; align-items: end; gap: .6rem; padding-bottom: 1rem; }
.date-form label { display: grid; gap: .4rem; color: #52627a; font-size: .85rem; }
.date-form input, .date-form button { min-height: 2.75rem; border-radius: .7rem; border: 1px solid #cdd9e8; padding: 0 .9rem; font: inherit; }
.date-form button { color: #fff; background: #0b766b; border-color: #0b766b; cursor: pointer; }
.empty-state { margin-top: 3rem; padding: 3rem; text-align: center; background: #fff; border: 1px dashed #bccbdb; border-radius: 1rem; }
.schedule-list { display: grid; gap: .8rem; margin-top: 2.5rem; }
.appointment-card { display: grid; grid-template-columns: 9rem 1fr auto; align-items: center; gap: 1.2rem; padding: 1.2rem 1.4rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.appointment-card time { color: #087f72; font-weight: 800; font-size: 1.15rem; }
.appointment-card h2 { margin: 0 0 .35rem; font-size: 1.05rem; }
.appointment-card p { margin: 0; color: #68778c; }
.appointment-meta { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: end; }
.appointment-meta span { padding: .35rem .6rem; border-radius: 999px; background: #eef4f7; color: #52627a; font-size: .78rem; }
.auth-shell { display: grid; place-items: center; min-height: 60vh; }
.auth-card { width: min(440px, 100%); padding: 2.2rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1.2rem; box-shadow: 0 18px 50px rgb(34 62 89 / 9%); }
.auth-card h1 { font-size: 2.3rem; }
.auth-intro { color: #607089; line-height: 1.6; }
.auth-form { display: grid; gap: .55rem; margin-top: 1.6rem; }
.auth-form label { margin-top: .6rem; color: #34445d; font-weight: 650; }
.auth-form input { min-height: 3rem; border: 1px solid #cdd9e8; border-radius: .7rem; padding: 0 .9rem; font: inherit; }
.auth-form input:focus { outline: 3px solid rgb(11 118 107 / 18%); border-color: #0b766b; }
.auth-form button, .button-link { min-height: 3rem; margin-top: 1rem; border: 0; border-radius: .7rem; padding: .8rem 1rem; color: #fff; background: #0b766b; font: inherit; font-weight: 700; text-decoration: none; text-align: center; cursor: pointer; }
.validation-summary, .field-error { color: #aa2737; font-size: .88rem; }
.validation-summary ul { margin: 0; padding-left: 1.2rem; }
.patient-search, .visit-form, .stage-card { margin-top: 1.5rem; padding: 1.5rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.patient-search > label, .visit-form > label { display: block; margin-bottom: .5rem; font-weight: 650; }
.patient-search > div { display: flex; gap: .6rem; }
.patient-search input { flex: 1; }
.patient-search input, .patient-search button, .visit-form select, .visit-form textarea, .visit-form button, .stage-form input, .stage-form select, .stage-form button, .participant-form select, .participant-form button { min-height: 2.8rem; border: 1px solid #cdd9e8; border-radius: .65rem; padding: .55rem .8rem; font: inherit; }
.patient-search button, .visit-form button, .stage-form button, .participant-form button { color: #fff; background: #0b766b; border-color: #0b766b; cursor: pointer; }
.visit-form { display: grid; gap: .7rem; }
.visit-form fieldset { display: grid; gap: .65rem; margin: 0 0 .7rem; border: 0; padding: 0; }
.visit-form legend { margin-bottom: .7rem; font-weight: 750; }
.patient-option { display: flex; gap: .8rem; padding: .8rem; border: 1px solid #dfe7f1; border-radius: .7rem; cursor: pointer; }
.patient-option span { display: grid; gap: .2rem; }
.patient-option small, .muted { color: #68778c; }
.patient-option em { color: #aa6c00; font-size: .8rem; }
.visit-header { display: flex; justify-content: space-between; align-items: center; gap: 2rem; }
.visit-header h1 { font-size: clamp(2rem, 5vw, 3.8rem); }
.button-link.secondary { color: #34445d; background: #eaf0f5; }
.alert { margin: 1rem 0; padding: 1rem; border-radius: .7rem; }
.alert.error { color: #84202d; background: #ffecef; }
.alert.success { color: #075e53; background: #e3f7f2; }
.stage-list { display: grid; gap: 1rem; }
.stage-card header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; }
.stage-card header span, .stage-card header strong { color: #607089; font-size: .82rem; }
.stage-card h2 { margin: 0; }
.stage-form { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .7rem; margin-top: 1.2rem; }
.stage-form label { display: grid; gap: .35rem; color: #52627a; font-size: .82rem; }
.stage-form button { align-self: end; }
.scheduled-stage { margin-top: 1rem; padding: .8rem; background: #f4f7fb; border-radius: .7rem; }
.stage-services { display: grid; gap: .45rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.stage-services li { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem .8rem; border: 1px solid #e3eaf2; border-radius: .65rem; }
.stage-services small { color: #68778c; }
.stage-services em { color: #8a6412; font-size: .84rem; }
.participant-form { display: grid; grid-template-columns: 2fr 1.5fr auto; gap: .7rem; margin-top: .8rem; }
.participant-note { margin: .5rem 0 0; font-size: .82rem; }
.queue-tabs { display: flex; gap: .6rem; margin: 2rem 0 1rem; }
.queue-tabs a { padding: .7rem 1rem; border-radius: 999px; color: #34445d; background: #eaf0f5; text-decoration: none; }
.queue-tabs a.active { color: #fff; background: #0b766b; }
.resolution-list, .candidate-list { display: grid; gap: .8rem; }
.resolution-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: 1.2rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.resolution-card h2, .candidate-card h2 { margin: .25rem 0; font-size: 1.05rem; }
.resolution-card p, .candidate-card p { margin: 0; color: #68778c; }
.resolution-meta { display: flex; flex-wrap: wrap; gap: .4rem; }
.resolution-meta span { padding: .35rem .55rem; border-radius: 999px; color: #52627a; background: #eef4f7; font-size: .78rem; }
.next-page, .back-link { display: inline-block; margin-top: 1rem; color: #0b766b; font-weight: 700; text-decoration: none; }
.resolution-detail { margin: 1rem 0; padding: 1.5rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.resolution-detail h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
.resolution-detail dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.resolution-detail dl div { padding: .8rem; background: #f4f7fb; border-radius: .7rem; }
.resolution-detail dt { color: #68778c; font-size: .78rem; }
.resolution-detail dd { margin: .3rem 0 0; font-weight: 650; }
.candidate-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, .8fr) auto; align-items: end; gap: 1rem; padding: 1.2rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.candidate-card label { display: grid; gap: .35rem; color: #52627a; font-size: .82rem; }
.candidate-card input, .candidate-card button { min-height: 2.8rem; border: 1px solid #cdd9e8; border-radius: .65rem; padding: .55rem .8rem; font: inherit; }
.candidate-card button { color: #fff; background: #0b766b; border-color: #0b766b; cursor: pointer; }
.decision-form { display: grid; gap: .65rem; margin-top: 1rem; padding: 1.5rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.decision-form h2 { margin: 0; font-size: 1.2rem; }
.decision-form p { margin: 0 0 .4rem; color: #68778c; line-height: 1.55; }
.decision-form label { color: #52627a; font-size: .85rem; font-weight: 650; }
.decision-form select, .decision-form textarea, .decision-form button { min-height: 2.8rem; border: 1px solid #cdd9e8; border-radius: .65rem; padding: .65rem .8rem; font: inherit; }
.decision-form textarea { min-height: 6rem; resize: vertical; }
.decision-form button { color: #fff; background: #0b766b; border-color: #0b766b; font-weight: 700; cursor: pointer; }
.negative-decision { border-color: #edcbd0; }
.negative-decision button { background: #8f3341; border-color: #8f3341; }
.inline-link { display: inline-block; margin-left: .5rem; color: inherit; font-weight: 750; }
.readiness.patient_resolution_required { color: #84202d; background: #ffecef; }
.readiness.care_setting_review_required, .readiness.visit_creation_required { color: #74520a; background: #fff4d6; }
.admission-section { margin-top: 3rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin: .2rem 0 0; font-size: 1.65rem; }
.section-heading .eyebrow { margin: 0; }
.count-badge { display: grid; place-items: center; min-width: 2.3rem; min-height: 2.3rem; border-radius: 999px; color: #0b5d56; background: #dff3ef; font-weight: 800; }
.inline-action-form { margin: 0; }
.inline-action-form button { min-height: 2.8rem; border: 0; border-radius: .65rem; padding: .65rem .9rem; color: #fff; background: #0b766b; font: inherit; font-weight: 700; cursor: pointer; }
.current-inpatient-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.inpatient-card { padding: 1.25rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.inpatient-card small { color: #087f72; font-weight: 750; }
.inpatient-card h3 { margin: .6rem 0 .35rem; }
.inpatient-card p { margin: .25rem 0; }
.patient-flow-card { align-self: start; }
.flow-action { margin-top: .9rem; border-top: 1px solid #e3eaf2; padding-top: .75rem; }
.flow-action summary { color: #0b766b; font-weight: 750; cursor: pointer; }
.compact-flow-form { display: grid; gap: .65rem; margin-top: .8rem; }
.compact-flow-form label { display: grid; gap: .3rem; color: #52627a; font-size: .82rem; }
.compact-flow-form select, .compact-flow-form textarea, .compact-flow-form button,
.review-flow-form input, .review-flow-form button { min-height: 2.7rem; border: 1px solid #cdd9e8; border-radius: .65rem; padding: .55rem .7rem; font: inherit; }
.compact-flow-form textarea { min-height: 5rem; resize: vertical; }
.compact-flow-form button, .review-flow-form button { color: #fff; background: #0b766b; border-color: #0b766b; font-weight: 700; cursor: pointer; }
.workflow-list { display: grid; gap: .8rem; }
.workflow-card { padding: 1.25rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.workflow-card-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.workflow-card h3 { margin: .35rem 0; }
.workflow-card p { margin: .6rem 0; }
.status-pill { padding: .35rem .6rem; border-radius: 999px; color: #52627a; background: #eef4f7; font-size: .75rem; font-weight: 800; }
.status-pill.requested { color: #74520a; background: #fff4d6; }
.status-pill.approved { color: #075e53; background: #e3f7f2; }
.status-pill.in_transit { color: #235d8c; background: #e9f3ff; }
.review-flow-form { display: grid; grid-template-columns: minmax(14rem, 1fr) auto auto; gap: .6rem; margin-top: .9rem; }
.review-flow-form .danger-button { background: #8f3341; border-color: #8f3341; }
.workflow-card .inline-action-form { margin-top: .9rem; }
.admin-create-panel { margin: 2rem 0; padding: 1.25rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.admin-create-panel > summary { color: #0b766b; font-size: 1.05rem; font-weight: 800; cursor: pointer; }
.user-admin-form { display: grid; gap: .9rem; margin-top: 1rem; }
.user-admin-form.compact { padding-top: .3rem; }
.user-admin-form > label, .two-column-fields label, .department-access-grid label { display: grid; gap: .35rem; color: #52627a; font-size: .84rem; }
.user-admin-form input, .user-admin-form select, .user-admin-form button,
.user-search-form input, .user-search-form button { min-height: 2.8rem; border: 1px solid #cdd9e8; border-radius: .65rem; padding: .55rem .75rem; font: inherit; }
.user-admin-form > button, .user-search-form button { color: #fff; background: #0b766b; border-color: #0b766b; font-weight: 750; cursor: pointer; }
.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.role-grid, .department-access-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; margin: 0; border: 1px solid #e3eaf2; border-radius: .75rem; padding: 1rem; }
.role-grid legend, .department-access-grid legend { padding: 0 .3rem; color: #34445d; font-weight: 750; }
.role-grid label { display: flex; align-items: center; gap: .45rem; font-size: .88rem; }
.role-grid input, .toggle-label input { min-height: auto; }
.user-search-form { display: flex; gap: .6rem; margin: 2rem 0 1rem; }
.user-search-form input { flex: 1; }
.user-search-form a { align-self: center; color: #0b766b; font-weight: 700; text-decoration: none; }
.user-admin-list { display: grid; gap: .9rem; }
.user-admin-card { padding: 1.25rem; background: #fff; border: 1px solid #dfe7f1; border-radius: 1rem; }
.user-admin-card header { display: flex; justify-content: space-between; gap: 1rem; }
.user-admin-card h2 { margin: .3rem 0; font-size: 1.15rem; }
.user-admin-card p { margin: .35rem 0; }
.user-state { display: flex; align-items: start; flex-wrap: wrap; justify-content: end; gap: .4rem; }
.toggle-label { display: flex !important; align-items: center; gap: .5rem; font-weight: 700; }
@media (max-width: 800px) { .module-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .stage-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .resolution-card, .candidate-card { grid-template-columns: 1fr; } .resolution-detail dl { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .current-inpatient-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .schedule-heading, .visit-header { align-items: stretch; flex-direction: column; } .schedule-actions { align-items: stretch; flex-direction: column; } .appointment-card { grid-template-columns: 1fr; } .appointment-meta { justify-content: start; } .participant-form { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .module-grid { grid-template-columns: 1fr; } .page-shell { padding-top: 3rem; } }
@media (max-width: 600px) { .current-inpatient-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .review-flow-form { grid-template-columns: 1fr; } }
@media (max-width: 800px) { .role-grid, .department-access-grid { grid-template-columns: 1fr; } .two-column-fields { grid-template-columns: 1fr; } }
