:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
  background: #f5f6f8;
  color: #203046;
}

* { box-sizing: border-box; }

body { margin: 0; }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e7ed;
  padding: 18px max(20px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-main {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
}

.brand-sub {
  font-size: 12px;
  letter-spacing: .15em;
  margin-top: 5px;
  color: #67768a;
}

.account-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.initials {
  border-radius: 50%;
  height: 36px;
  width: 36px;
  background: #23476b;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: #23476b;
  font-weight: 600;
  cursor: pointer;
}

main {
  flex: 1;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 32px 18px;
}

h1 {
  font-size: clamp(26px, 5vw, 36px);
  margin: 8px 0 12px;
  letter-spacing: -.025em;
}

h2 { font-size: 19px; }

p {
  color: #5b697a;
  line-height: 1.55;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .13em;
  color: #53718e;
  font-weight: 750;
}

.panel, .patient-card {
  background: #fff;
  border: 1px solid #e2e7ed;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
}

.auth-panel {
  max-width: 450px;
  margin: 7vh auto 0;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 9px;
  font-size: 14px;
}

input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #c8d2dc;
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
  color: #203046;
}

button {
  cursor: pointer;
  font: inherit;
}

.primary, .secondary {
  padding: 12px 17px;
  border-radius: 8px;
  font-weight: 650;
}

.primary {
  color: white;
  background: #23476b;
  border: 1px solid #23476b;
}

.secondary {
  color: #23476b;
  background: #fff;
  border: 1px solid #b5c5d5;
}

.auth-panel .primary {
  width: 100%;
  margin-top: 16px;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-row input { flex: 1; min-width: 0; }

.patient-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
}

.patient-secondary {
  color: #6b7888;
  font-size: 13px;
  margin-top: 7px;
  overflow-wrap: anywhere;
}

.impersonation-banner {
  border: 1px solid #b4c7d9;
  background: #eaf1f8;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.impersonation-banner strong {
  display: block;
  margin-bottom: 5px;
}

.notice {
  padding: 12px 15px;
  background: #eef3f8;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.fineprint {
  font-size: 12px;
  margin-top: 18px;
}

footer {
  padding: 25px 18px;
  text-align: center;
  color: #8290a0;
  font-size: 12px;
  line-height: 1.8;
}

@media (max-width: 600px) {
  .topbar { padding: 16px; }
  main { padding: 22px 14px; }
  .panel { padding: 20px; }
  .patient-card, .impersonation-banner {
    align-items: stretch;
    flex-direction: column;
  }
  .patient-card button, .impersonation-banner button {
    width: 100%;
  }
  .search-row { flex-direction: column; }
}

.appointment-section {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid #e4e9ee;
}

.appointment-section h2 {
  font-size: 19px;
  margin: 0 0 14px;
}

.appointment-card {
  padding: 16px;
  border: 1px solid #dce5ed;
  border-radius: 10px;
  margin-bottom: 12px;
  background: #fafcfe;
  line-height: 1.65;
}

.appointment-card strong {
  display: block;
  margin: 4px 0;
}

.appointment-type {
  font-size: 11px;
  color: #52708d;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.appointment-detail {
  font-size: 13px;
  color: #506176;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.development-notice {
  margin-top: 24px;
  padding: 15px;
  background: #f1f4f7;
  border-radius: 9px;
  color: #5d6b79;
  font-size: 13px;
}


/* CEM_MOBILE_PATIENT_V1 */

.cem-patient-layout {
  padding-bottom: 100px;
}

.cem-mobile-heading {
  padding: 6px 2px 16px;
}

.cem-mobile-heading h1 {
  margin-bottom: 5px;
}

.cem-mobile-heading p {
  margin-top: 0;
}

.cem-mobile-banner {
  position: relative;
  z-index: 2;
}

.cem-banner-label {
  font-size: 11px;
  color: #52718f;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 750;
  margin-bottom: 7px;
}

.cem-patient-name {
  font-size: 17px;
  font-weight: 650;
  margin-top: 5px;
}

.cem-account-label {
  font-size: 12px;
  color: #596d82;
  margin-top: 5px;
}

.cem-summary-panel h2,
.cem-schedule-panel h2 {
  margin-top: 0;
}

.cem-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.cem-stat {
  background: #f0f4f8;
  border-radius: 11px;
  padding: 18px 6px;
  text-align: center;
}

.cem-stat strong {
  display: block;
  font-size: 29px;
  color: #23476b;
}

.cem-stat span {
  font-size: 12px;
  color: #617386;
}

.cem-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cem-section-header h2 {
  margin: 0;
}

.cem-section-header a {
  font-size: 13px;
  font-weight: 650;
  color: #23476b;
  text-decoration: none;
}

.cem-mobile-appointment {
  padding: 16px 0;
  border-bottom: 1px solid #e6ebf0;
  line-height: 1.7;
}

.cem-mobile-appointment:last-child {
  border-bottom: 0;
}

.cem-mobile-appointment strong {
  display: block;
  color: #203046;
}

.cem-appointment-kind {
  color: #52718f;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 750;
}

.cem-appointment-detail {
  color: #526579;
  font-size: 13px;
  overflow-wrap: anywhere;
  margin-top: 4px;
}

.cem-disabled-note {
  background: #f1f4f7;
  color: #536578;
  border-radius: 9px;
  padding: 15px;
  font-size: 13px;
  margin-top: 20px;
}

.cem-feature-icon {
  display: inline-flex;
  padding: 13px;
  background: #eff3f7;
  color: #23476b;
  border-radius: 13px;
  margin-bottom: 10px;
}

.cem-contact-item {
  padding: 19px 0;
  border-bottom: 1px solid #e6ebf0;
}

.cem-contact-label {
  font-size: 12px;
  font-weight: 650;
  color: #627487;
  margin-bottom: 6px;
}

.cem-contact-item a {
  color: #23476b;
  font-weight: 650;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.cem-contact-disclaimer {
  margin-top: 22px;
  font-size: 12px;
}

.cem-bottom-nav {
  position: fixed;
  z-index: 50;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #fff;
  border-top: 1px solid #dce3ea;
  padding: 7px max(8px, env(safe-area-inset-right))
    calc(7px + env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  box-shadow: 0 -3px 18px rgba(24,45,67,.07);
}

.cem-bottom-nav a {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #728092;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
}

.cem-bottom-nav a.active {
  color: #23476b;
  background: #eaf1f8;
}

.cem-bottom-nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cem-account-menu {
  position: relative;
}

.cem-account-menu summary {
  cursor: pointer;
  list-style: none;
}

.cem-account-menu summary::-webkit-details-marker {
  display: none;
}

.cem-account-dropdown {
  position: absolute;
  top: 46px;
  right: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid #dce3ea;
  box-shadow: 0 7px 22px rgba(0,0,0,.12);
  border-radius: 12px;
  width: 220px;
  padding: 15px;
}

.cem-menu-heading {
  font-size: 13px;
  font-weight: 750;
}

.cem-menu-email {
  font-size: 12px;
  color: #65778b;
  margin: 5px 0 12px;
  overflow-wrap: anywhere;
}

.cem-account-dropdown form {
  margin-top: 5px;
}

.cem-account-dropdown button {
  width: 100%;
  border: 0;
  background: #f1f4f8;
  color: #23476b;
  border-radius: 7px;
  padding: 10px;
  text-align: left;
  font-weight: 600;
}

@media (max-width: 600px) {
  .cem-patient-layout {
    padding-bottom: 112px;
  }

  .cem-mobile-banner {
    position: sticky;
    top: 0;
  }

  .cem-summary-panel,
  .cem-schedule-panel {
    padding: 19px;
  }

  .cem-stats {
    gap: 7px;
  }

  .cem-stat {
    padding: 16px 4px;
  }

  .cem-stat strong {
    font-size: 26px;
  }

  .cem-bottom-nav a {
    min-height: 53px;
  }
}

/* CEM PASSKEY REGISTRATION */

.cem-menu-passkey {
  display: block;
  color: #23476b;
  background: #f1f4f8;
  border-radius: 7px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  padding: 11px 10px;
  margin-bottom: 8px;
}

#cem-register-passkey:disabled {
  opacity: .65;
  cursor: wait;
}

#cem-passkey-status {
  font-size: 13px;
  min-height: 22px;
  margin-top: 15px;
}

/* CEM FACE ID SIGN IN */

.cem-face-login-box {
  margin: 18px 0 25px;
}

.cem-face-login-box .primary {
  width: 100%;
}

#cem-face-login:disabled {
  opacity: .65;
  cursor: wait;
}

#cem-face-login-status {
  font-size: 13px;
  min-height: 20px;
}

.cem-login-divider {
  text-align: center;
  margin-top: 23px;
  font-size: 12px;
  color: #778597;
}

/* CEM PATIENT HEADER LOGO */

.cem-header-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  gap: 3px;
}

.cem-header-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  max-width: 100%;
}

.cem-header-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 235px;
  max-height: 56px;
  object-fit: contain;
  object-position: left center;
}

.cem-header-portal-name {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .06em;
  color: #617386;
}

@media (max-width: 600px) {
  .cem-header-logo {
    max-width: min(195px, 55vw);
    max-height: 46px;
  }

  .cem-header-portal-name {
    font-size: 11px;
  }

  .topbar {
    gap: 10px;
  }

  .account-controls {
    flex-shrink: 0;
  }
}

/* CEM LIVE PATIENT SEARCH */

.cem-patient-search-panel {
  margin-top: 18px;
}

#cem-patient-search {
  min-height: 48px;
}

#cem-search-status {
  min-height: 20px;
}

.cem-search-result {
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .cem-search-result {
    align-items: stretch;
  }

  .cem-search-result form,
  .cem-search-result button {
    width: 100%;
  }
}

/* CEM PATIENT SEARCH RESULT CLEANUP */

.cem-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 8px;
}

.cem-search-result > div {
  flex: 1;
  min-width: 0;
}

.cem-search-result strong {
  font-size: 15px;
  font-weight: 600;
}

.cem-search-result form {
  flex-shrink: 0;
  width: auto;
}

.cem-search-result button {
  width: auto;
  min-width: 76px;
  padding: 9px 15px;
  background: #23476b;
  color: #fff;
  border: 1px solid #23476b;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

@media (max-width: 600px) {
  .cem-search-result {
    flex-direction: row;
    align-items: center;
  }

  .cem-search-result form,
  .cem-search-result button {
    width: auto;
  }

  .cem-search-result button {
    min-width: 70px;
  }
}

/* CEM PATIENT VIEWING BANNER */

.cem-viewing-patient {
  font-size: 15px;
  font-weight: 650;
  color: #23476b;
  line-height: 1.4;
}

.cem-mobile-banner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cem-mobile-banner form {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .cem-mobile-banner {
    flex-direction: row;
    align-items: center;
  }

  .cem-viewing-patient {
    font-size: 13px;
    min-width: 0;
  }

  .cem-mobile-banner form {
    width: auto;
  }

  .cem-mobile-banner button {
    width: auto;
    font-size: 12px;
    padding: 9px 11px;
    white-space: nowrap;
  }
}

/* CEM CLICKABLE APPOINTMENT SUMMARY */

.cem-stat-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.cem-stat-link:visited {
  color: inherit;
}

.cem-stat-link:hover,
.cem-stat-link:focus-visible {
  background-color: rgba(35, 71, 107, 0.07);
}

.cem-stat-link:focus-visible {
  outline: 2px solid #23476b;
  outline-offset: 2px;
}

/* Keep administrator patient-viewing banner on one line */
.cem-viewing-patient {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.cem-mobile-banner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.cem-mobile-banner form {
    flex-shrink: 0;
}
