:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #24304a;
  background: #f7f8fb;
  font-size: 16px;
  line-height: 1.5;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  background: #6054a5;
  color: white;
  border: 1px solid #6054a5;
  border-radius: 10px;
  min-height: 44px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}
button.secondary {
  background: #fff;
  border-color: #c6cbd8;
  color: #38435a;
}
button.danger {
  background: #a72c43;
  border-color: #a72c43;
}
header {
  padding: calc(12px + env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right)) 12px
    max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e3e5ef;
  background: #fff;
}
.wordmark {
  font-size: 24px;
  font-weight: 600;
  color: #6054a5;
  text-decoration: none;
}
.wordmark span {
  display: block;
  font-size: 12px;
  color: #4e596c;
  font-weight: 400;
}
#identity {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
#identity span {
  overflow-wrap: anywhere;
}
main {
  max-width: 1180px;
  margin: auto;
  padding: 24px max(16px, env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
}
h2 {
  font-size: 20px;
  font-weight: 600;
}
h3 {
  font-size: 16px;
  font-weight: 500;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #6054a5;
  font-weight: 500;
  margin-bottom: 8px;
}
.muted {
  color: #4e596c;
  font-size: 14px;
}
.login-card {
  max-width: 440px;
  margin: 32px auto 64px;
  background: #fff;
  padding: 28px;
  border: 1px solid #e3e5ef;
  border-radius: 18px;
}
.login-card > p {
  margin: 8px 0 20px;
}
form label {
  display: block;
  margin: 14px 0;
}
label {
  font-size: 14px;
  font-weight: 500;
}
input,
select {
  display: block;
  width: 100%;
  min-height: 46px;
  font-size: 16px;
  line-height: 1.5;
  padding: 9px 12px;
  border: 1px solid #939bad;
  border-radius: 10px;
  background: #fff;
  color: #24304a;
  margin-top: 5px;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, #6054a5 50%),
    linear-gradient(135deg, #6054a5 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 10px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
input:read-only {
  background: #f7f8fb;
}
.footnote {
  font-size: 12px;
  color: #4e596c;
}
#login-form button {
  width: 100%;
  margin-top: 8px;
}
.error {
  color: #a1243c;
  font-size: 14px;
  margin-top: 12px;
  white-space: pre-wrap;
}
.error:empty {
  display: none;
}
.workspace-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.workspace-heading h1 {
  font-size: 24px;
}
.workspace-heading button {
  flex-shrink: 0;
}
nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e3e5ef;
  padding-bottom: 14px;
  margin-bottom: 20px;
}
nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border-color: transparent;
  color: #4e596c;
}
nav button span {
  font-size: 20px;
  line-height: 1;
}
nav button[aria-current] {
  background: #f0ecfa;
  color: #51418c;
  border-color: #dfd7f0;
}
#feedback:not(:empty) {
  padding: 12px 16px;
  background: #eaf5f4;
  border: 1px solid #b9dcd7;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}
#feedback.failure {
  color: #a1243c;
  background: #fff0f1;
  border-color: #efc7cf;
}
.intro-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px;
  border: 1px solid #dfd7f0;
  border-radius: 18px;
  background: #f0ecfa;
}
.intro-card h2 {
  font-size: 24px;
  margin-top: 8px;
}
.intro-card p {
  max-width: 590px;
  color: #4e596c;
  margin: 10px 0 18px;
}
.care-mark {
  font-size: 110px;
  color: #6054a5;
  font-weight: 600;
  line-height: 1;
}
.care-mark span {
  font-size: 52px;
  color: #247e78;
  vertical-align: top;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.summary-grid article {
  padding: 18px;
  background: #fff;
  border: 1px solid #e3e5ef;
  border-radius: 14px;
}
.summary-grid strong {
  display: block;
  font-size: 28px;
  font-weight: 600;
  margin: 6px 0;
}
.summary-grid p {
  font-size: 13px;
  color: #4e596c;
}
.notice {
  padding: 14px 16px;
  background: #eaf5f4;
  border: 1px solid #b9dcd7;
  border-radius: 12px;
}
.notice strong {
  font-size: 15px;
  font-weight: 600;
}
.notice p {
  font-size: 14px;
  margin-top: 4px;
  color: #345653;
}
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar label {
  flex: 1;
  min-width: 160px;
}
.toolbar button {
  flex-shrink: 0;
}
#timezone-note {
  margin-bottom: 12px;
}
.record-card {
  background: #fff;
  border: 1px solid #e3e5ef;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.record-body {
  min-width: 0;
  overflow-wrap: anywhere;
}
.record-body h3 {
  font-weight: 600;
}
.record-body p {
  font-size: 14px;
  color: #4e596c;
  margin-top: 4px;
  white-space: pre-wrap;
}
.record-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.status {
  display: inline-block;
  border-radius: 20px;
  background: #eaf5f4;
  color: #245d58;
  padding: 3px 9px;
  font-size: 12px;
  margin-top: 8px;
}
.empty {
  padding: 32px 16px;
  border: 1px dashed #c6cbd8;
  border-radius: 12px;
  background: #fff;
  color: #4e596c;
  text-align: center;
}
.empty button {
  margin-top: 12px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  font-size: 13px;
}
.pagination button:disabled {
  cursor: default;
}
footer {
  margin-top: 32px;
  border-top: 1px solid #e3e5ef;
  padding-top: 16px;
  color: #4e596c;
  font-size: 12px;
}
dialog {
  border: 1px solid #e3e5ef;
  border-radius: 18px;
  padding: 24px;
  width: min(640px, calc(100% - 24px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  color: #24304a;
  background: #fff;
}
dialog::backdrop {
  background: #20273a80;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.icon-button {
  font-size: 24px;
  width: 44px;
  padding: 4px;
  background: #fff;
  color: #4e596c;
  border-color: #dce0e8;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.fields .wide {
  grid-column: 1/-1;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.lookup {
  display: block;
  font-size: 12px;
  color: #4e596c;
  margin-top: 5px;
}
.skip {
  position: absolute;
  top: -80px;
  padding: 12px;
  background: #fff;
  color: #423774;
  z-index: 2;
}
.skip:focus {
  top: 8px;
}
:focus-visible {
  outline: 3px solid #6054a5;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 650px) {
  header {
    align-items: flex-start;
  }
  .wordmark span {
    max-width: 160px;
  }
  #identity {
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 140px;
  }
  #identity span {
    font-size: 12px;
  }
  .login-card {
    padding: 20px;
    margin-top: 12px;
  }
  main {
    padding-top: 20px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
  .workspace-heading {
    align-items: flex-start;
  }
  .workspace-heading h1 {
    font-size: 22px;
  }
  .workspace-heading button {
    padding: 8px 10px;
  }
  nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    background: #fff;
    margin: 0;
    padding: 6px max(8px, env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    border-top: 1px solid #e3e5ef;
    gap: 4px;
  }
  nav button {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    font-size: 11px;
    font-weight: 400;
    padding: 6px 2px;
  }
  nav button[aria-current] {
    font-weight: 500;
  }
  nav button span {
    font-size: 20px;
  }
  .intro-card {
    padding: 18px;
  }
  .intro-card h2 {
    font-size: 22px;
  }
  .care-mark {
    display: none;
  }
  .summary-grid {
    gap: 8px;
  }
  .summary-grid article {
    padding: 12px;
  }
  .summary-grid h3 {
    font-size: 13px;
  }
  .summary-grid strong {
    font-size: 24px;
  }
  .summary-grid p {
    font-size: 12px;
  }
  .record-card {
    display: block;
  }
  .record-actions {
    margin-top: 14px;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .fields .wide {
    grid-column: auto;
  }
  dialog {
    padding: 16px;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar label {
    flex-basis: 100%;
  }
  .toolbar button {
    flex: 1;
  }
  .pagination {
    gap: 10px;
  }
  h2 {
    font-size: 18px;
  }
  #confirm-dialog p {
    margin-top: 12px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background 0.15s;
  }
}
@media (max-width: 350px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .workspace-heading {
    flex-wrap: wrap;
  }
}
/* Universal identity and account entry */
.header-logo {
  display: block !important;
  width: 136px;
  height: 42px;
  overflow: hidden;
  position: relative;
}
.header-logo img {
  width: 165px;
  height: auto;
  max-width: none;
  position: absolute;
  left: -15px;
  top: -21px;
}
.wordmark > span:last-child {
  font-size: 11px;
}
.auth-logo {
  width: 240px;
  height: 98px;
  position: relative;
  overflow: hidden;
  margin: 0 auto 20px;
}
.auth-logo img {
  position: absolute;
  width: 282px;
  height: auto;
  max-width: none;
  top: -23px;
  left: -22px;
}
.login-card {
  max-width: 460px;
  margin: 22px auto 44px;
  padding: 24px;
}
.login-card h1 {
  font-size: 23px;
}
.login-card .eyebrow {
  font-size: 11px;
  margin-bottom: 8px;
}
.login-card > p.muted {
  margin-top: 8px;
  margin-bottom: 20px;
}
.full-button {
  width: 100%;
}
.password-field {
  display: flex;
  align-items: center;
  position: relative;
}
.password-field input {
  padding-right: 80px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  bottom: 1px;
  padding: 6px 10px;
  min-width: 70px;
  min-height: 44px;
  background: transparent;
  color: #6054a5;
  border: 0;
  font-size: 13px;
}
.auth-link-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -6px;
}
.link-button {
  background: transparent;
  color: #51418c;
  border-color: transparent;
  min-height: 44px;
  padding: 8px 0;
  font-size: 14px;
}
.link-button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
  color: #4e596c;
  font-size: 13px;
}
.auth-divider:before,
.auth-divider:after {
  content: "";
  flex: 1;
  border-top: 1px solid #e3e5ef;
}
.login-card .footnote {
  text-align: center;
  margin: 16px 0 0;
}
.auth-success {
  color: #245d58;
  background: #eaf5f4;
  border-radius: 10px;
  font-size: 14px;
  padding: 12px;
  margin: 12px 0;
}
.auth-success:empty {
  display: none;
}
.identity-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.acting-banner {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  background: #fff4dc;
  border: 1px solid #d6b56d;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.acting-banner p {
  font-size: 13px;
  color: #68521b;
  margin-top: 4px;
}
.acting-banner strong {
  font-size: 15px;
  font-weight: 600;
}
.acting-banner button {
  flex-shrink: 0;
}
.platform-intro {
  margin-bottom: 22px;
}
.platform-intro p {
  font-size: 15px;
  color: #4e596c;
  max-width: 740px;
  margin-top: 8px;
}
.organization-status {
  font-size: 12px;
  color: #4e596c;
}
.platform-only main {
  padding-bottom: 24px;
}
#target-organization {
  margin: 12px 0;
}
.context-warning p {
  margin: 14px 0;
}
@media (max-width: 650px) {
  .login-card {
    padding: 20px;
    margin: 10px auto 24px;
  }
  .auth-logo {
    margin-bottom: 14px;
  }
  .login-card h1 {
    font-size: 22px;
  }
  .acting-banner {
    display: block;
  }
  .acting-banner button {
    margin-top: 12px;
  }
  .identity-actions {
    justify-content: flex-start;
  }
  .workspace-heading {
    flex-wrap: wrap;
  }
  .platform-intro h2 {
    font-size: 20px;
  }
}
@media (max-width: 359px) {
  .auth-logo {
    width: 220px;
  }
  .auth-logo img {
    width: 260px;
    left: -20px;
    top: -21px;
  }
  .header-logo {
    width: 120px;
  }
  .header-logo img {
    width: 150px;
    top: -18px;
  }
}
#login-form .password-toggle {
  width: 70px;
  margin: 0;
}
#login-form .link-button {
  width: auto;
  margin: 0;
}
/* Clinical records use the same compact controls and safe-area layout. */
#clinical-dialog {
  width: min(920px, calc(100% - 24px));
}
.clinical-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.clinical-fields {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.clinical-fields textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #9ba5ba;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  color: #24304a;
  background: #fff;
}
.clinical-fields input {
  width: 100%;
}
.clinical-note {
  border: 1px solid #d8dce8;
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  background: #fff;
}
.clinical-note h3 {
  font-size: 17px;
  font-weight: 600;
}
.clinical-note h4 {
  margin: 14px 0 6px;
  font-size: 15px;
  font-weight: 600;
}
.clinical-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.clinical-note summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
  color: #6054a5;
}
.clinical-note .muted,
#clinical-patient,
#clinical-access-description {
  overflow-wrap: anywhere;
}
#clinical-form .notice {
  margin: 12px 0;
  font-size: 14px;
}
#clinical-form > .muted {
  font-size: 13px;
  margin-top: 12px;
}
#clinical-dialog .pagination {
  flex-wrap: wrap;
}
@media (max-width: 650px) {
  #clinical-dialog {
    padding: 16px;
  }
  .clinical-note {
    padding: 12px;
  }
  #clinical-title {
    font-size: 20px;
  }
}
.workspace-controls,
.context-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.workspace-controls {
  justify-content: space-between;
  margin: 14px 0 8px;
}
.context-filters label {
  min-width: 150px;
}
.view-switch {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.view-switch button[aria-pressed="true"] {
  background: #f0ecfa;
  border-color: #8274b7;
  color: #51418c;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
}
.check-label input {
  width: 22px;
  min-height: 22px;
  margin: 0;
}
#filter-description {
  font-size: 13px;
  margin: 8px 0 14px;
}
.records-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 12px;
}
.records-cards .record-card {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  margin: 0;
}
.records-cards .record-body {
  flex-basis: 100%;
}
.records-list .record-card {
  padding: 12px 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.records-list .record-body {
  flex: 1;
  min-width: 180px;
}
.record-actions {
  flex-wrap: wrap;
}
.record-card > button {
  margin-top: 8px;
}
nav .nav-label {
  font-size: 14px;
  font-weight: 400;
}
.sidebar-heading,
.sidebar-search,
#navigation-empty {
  display: none;
}
.clinical-history-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
  align-items: flex-end;
}
.clinical-history-controls label {
  flex: 1;
  min-width: 150px;
}
.clinical-list .clinical-note {
  border-radius: 0;
  border-width: 0 0 1px;
  margin: 0;
  padding: 14px 4px;
}
@media (min-width: 1100px) {
  body.has-workspace {
    --sidebar-width: 216px;
  }
  body.has-workspace.sidebar-collapsed {
    --sidebar-width: 76px;
  }
  .has-workspace main {
    margin-left: calc(var(--sidebar-width) + 32px);
    margin-right: auto;
    width: calc(100% - var(--sidebar-width) - 48px);
    max-width: 1400px;
  }
  .has-workspace #navigation {
    position: fixed;
    left: 16px;
    top: 104px;
    bottom: 24px;
    width: var(--sidebar-width);
    padding: 12px;
    margin: 0;
    flex-direction: column;
    border: 1px solid #e3e5ef;
    border-radius: 16px;
    background: #fff;
    overflow-y: auto;
    z-index: 4;
  }
  .sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    color: #4e596c;
  }
  .sidebar-heading strong {
    font-weight: 500;
  }
  .sidebar-search {
    display: block;
    font-size: 13px;
    margin: 4px 0 12px;
  }
  .sidebar-search input {
    font-size: 14px;
    padding: 9px 8px;
  }
  #navigation-empty:not([hidden]) {
    display: block;
    font-size: 13px;
  }
  #navigation button[data-screen] {
    justify-content: flex-start;
    padding: 10px;
    flex-shrink: 0;
  }
  .sidebar-collapsed .sidebar-heading {
    justify-content: center;
  }
  .sidebar-collapsed .sidebar-heading strong,
  .sidebar-collapsed .sidebar-search,
  .sidebar-collapsed #navigation .nav-label {
    display: none;
  }
  .sidebar-collapsed #navigation button[data-screen] {
    justify-content: center;
    padding: 10px 4px;
  }
}
@media (max-width: 650px) {
  nav .nav-label {
    font-size: 11px;
    font-weight: 400;
  }
  nav button[aria-current] .nav-label {
    font-weight: 500;
  }
  .workspace-controls {
    gap: 12px;
  }
  .context-filters {
    gap: 8px;
    width: 100%;
  }
  .context-filters label {
    flex: 1;
    min-width: 140px;
  }
  .clinical-history-controls label:first-child {
    flex-basis: 100%;
  }
}
.clinical-fields label {
  margin: 0;
}
