:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --line: #d8e0dc;
  --text: #17211d;
  --muted: #64736d;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #b7791f;
  --danger: #b42318;
  --success: #1f7a4d;
  --shadow: 0 1px 2px rgba(23, 33, 29, 0.08);
}

/* Document workspace refresh (rollback snapshot: backups/ui_document_workspace_20260802_1725). */
.document-section-head {
  position: relative;
  align-items: center;
}

.document-screen.document-screen {
  grid-template-rows: auto minmax(0, 1fr);
}

.document-section-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.document-upload-disclosure {
  position: relative;
  margin-left: auto;
}

.document-upload-disclosure > summary {
  list-style: none;
  cursor: pointer;
}

.document-upload-disclosure > summary::-webkit-details-marker {
  display: none;
}

.document-upload-form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  width: min(520px, calc(100vw - 48px));
  gap: 10px;
  padding: 14px;
  border: 1px solid #cbd8e6;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(31, 53, 79, 0.2);
}

.document-upload-form label,
.document-upload-form label span {
  display: block;
}

.document-upload-form label span {
  margin-bottom: 4px;
  color: #4b5f76;
  font-size: 0.82rem;
  font-weight: 700;
}

.document-workspace.document-viewer-shell {
  display: grid;
  grid-template-columns: minmax(300px, 36%) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  min-height: clamp(620px, calc(100vh - 238px), 1080px);
  height: calc(100vh - 205px);
}

.document-index-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #d7e2ed;
  border-radius: 10px;
  background: #ffffff;
}

.document-index-toolbar {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid #dbe5f0;
  background: #f7faff;
}

.document-index-toolbar input[type="search"] {
  width: 100%;
}

.document-filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.document-filter-chip {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #cbd8e6;
  border-radius: 999px;
  color: #40566f;
  background: #ffffff;
  font: inherit;
  font-size: 0.79rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.document-filter-chip:hover,
.document-filter-chip.is-active {
  color: #174f91;
  border-color: #74a8d8;
  background: #e5f2ff;
}

.document-filter-selects {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(105px, 0.55fr);
  gap: 7px;
}

.document-filter-selects select {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  font-size: 0.82rem;
}

.document-index-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.document-index-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 11px 10px;
  border-bottom: 1px solid #e3eaf2;
  outline: none;
  background: #ffffff;
  cursor: pointer;
}

.document-index-item:hover {
  background: #f2f7fd;
}

.document-index-item:focus-visible {
  box-shadow: inset 0 0 0 2px #4b93d2;
}

.document-index-item.is-active {
  background: #dfefff;
  box-shadow: inset 4px 0 0 #2563eb;
}

.document-index-item time {
  color: #536981;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.document-index-copy {
  min-width: 0;
}

.document-index-copy strong,
.document-index-copy span,
.document-index-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-index-copy strong {
  color: #20364f;
  line-height: 1.25;
}

.document-index-copy span {
  margin-top: 3px;
  color: #5d7187;
  font-size: 0.8rem;
  white-space: nowrap;
}

.document-index-copy .document-provider {
  color: #304f70;
  font-weight: 700;
  white-space: normal;
}

.document-index-copy small {
  display: -webkit-box;
  margin-top: 4px;
  color: #6a7785;
  font-size: 0.76rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.document-index-badges {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.document-source-badge,
.document-file-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 800;
  white-space: nowrap;
}

.document-source-badge {
  color: #40566f;
  background: #edf2f7;
}

.document-file-badge.has-file {
  color: #17623d;
  background: #dff6e9;
}

.document-file-badge.no-file {
  color: #7b5a19;
  background: #fff1cc;
}

.document-list-empty {
  padding: 30px 16px;
  color: #66788b;
  text-align: center;
}

.document-workspace .document-preview-panel {
  min-width: 0;
  min-height: 0;
}

.document-workspace .document-preview-frame-wrap,
.document-workspace .document-preview-frame-wrap iframe {
  min-height: 0;
  height: 100%;
}

.document-workspace.is-document-fullscreen {
  grid-template-columns: minmax(0, 1fr);
}

.document-workspace.is-document-fullscreen .document-index-panel {
  display: none;
}

.patient-search-progress {
  min-width: 92px;
  align-self: end;
  padding-bottom: 9px;
}

@media (max-width: 1050px) {
  .document-workspace.document-viewer-shell {
    grid-template-columns: minmax(280px, 42%) minmax(0, 1fr);
  }

  .document-index-item {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .document-index-badges {
    grid-column: 2;
    display: flex;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .document-section-head {
    align-items: flex-start;
  }

  .document-workspace.document-viewer-shell {
    height: auto;
    min-height: 720px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(260px, 42vh) minmax(420px, 1fr);
  }

  .document-preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-preview-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .document-upload-form {
    right: -4px;
  }

  .patient-search-progress {
    width: 100%;
    min-width: 0;
    padding: 0;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 132px;
  resize: vertical;
}

label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 1.75rem;
  font-weight: 700;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 4px;
}

.navlinks a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-weight: 600;
}

.navlinks a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.userbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-name,
.tenant-pill {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-tenant-picker {
  margin: 0;
}

.nav-tenant-picker label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.nav-tenant-picker label > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.nav-tenant-picker select {
  width: auto;
  max-width: 220px;
  min-height: 32px;
  padding: 5px 28px 5px 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.tenant-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e5f2ef;
  color: #164e48;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-completed {
  background: #e6f4ec;
  color: var(--success);
}

.badge-failed,
.alert-error {
  background: #fff0ed;
  color: var(--danger);
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.page-head,
.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.muted {
  color: var(--muted);
}

.strong {
  font-weight: 700;
}

.mono {
  font-family: Consolas, "Liberation Mono", monospace;
}

.right {
  text-align: right;
}

.grow {
  flex: 1 1 280px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.button-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-ghost {
  background: transparent;
}

.button-small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 0.86rem;
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  font-weight: 600;
}

.alert-success {
  background: #e8f5ee;
  color: var(--success);
  border-color: #b7dfc9;
}

.alert-error {
  border-color: #f1b8b1;
}

.login-wrap {
  min-height: calc(100vh - 108px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 24px;
  text-align: center;
}

.microsoft-sign-in-button {
  display: block;
  width: 100%;
  text-align: center;
}

.stack-form {
  display: grid;
  gap: 13px;
}

.server-archive-import {
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.server-archive-import h3 {
  margin: 0 0 0.45rem;
}

.server-import-progress {
  display: grid;
  gap: 0.3rem;
  min-width: 210px;
}

.server-import-progress progress {
  accent-color: var(--primary);
  height: 0.85rem;
  width: 100%;
}

.inline-form,
.search-form,
.document-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.search-form label:first-child {
  flex: 0 1 260px;
}

.stat-strip {
  display: grid;
  justify-items: end;
  gap: 1px;
  min-width: 180px;
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 800;
  background: #f9fbfa;
}

tr:hover td {
  background: #fbfcfc;
}

.empty {
  color: var(--muted);
  padding: 18px 9px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) repeat(2, minmax(280px, 420px));
  gap: 16px;
  align-items: start;
}

.admin-grid-with-tenants .admin-tenant-card {
  grid-column: 1;
  grid-row: 1;
}

.admin-grid-with-tenants .export-data-card {
  grid-column: 2;
  grid-row: 1;
}

.admin-grid-with-tenants .import-data-card {
  grid-column: 3;
  grid-row: 1;
}

.admin-grid-without-tenants {
  grid-template-columns: minmax(300px, 1fr);
}

.admin-tenant-card,
.admin-side-card {
  min-width: 0;
}

.recent-imports-title {
  align-items: flex-start;
}

.recent-imports-title h2 {
  margin-bottom: 2px;
}

.recent-imports-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fbfd;
}

.recent-imports-empty p {
  margin: 4px 0 0;
}

.tenant-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.tenant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.patient-meta span {
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 6px;
}

.patient-meta .mrn {
  background: #e5f2ef;
  color: #164e48;
  font-weight: 800;
}

.chart-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.demographic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.demographic-grid div {
  min-height: 62px;
  padding: 10px;
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.demographic-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.demographic-grid strong {
  overflow-wrap: anywhere;
}

.clinical-sections {
  display: grid;
  gap: 10px;
}

.clinical-detail {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.clinical-detail summary {
  cursor: pointer;
  padding: 11px 12px;
  font-weight: 800;
}

.clinical-text,
.note-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.clinical-text {
  padding: 0 12px 12px;
  color: #26332f;
}

.note-form {
  margin-bottom: 16px;
}

.note-list {
  display: grid;
  gap: 10px;
}

.note-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
  padding: 12px;
}

.note-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
}

.note-item header strong {
  color: var(--text);
}

@media (max-width: 900px) {

  .topbar,
  .page-head,
  .chart-head,
  .userbar {
    align-items: stretch;
  }

  .topbar,
  .page-head,
  .chart-head,
  .userbar,
  .inline-form,
  .search-form,
  .document-form {
    flex-direction: column;
  }

  .navlinks {
    width: 100%;
  }

  .userbar {
    margin-left: 0;
    width: 100%;
  }

  .userbar form,
  .userbar .button,
  .chart-actions,
  .chart-actions .button {
    width: 100%;
  }

  .admin-grid,
  .demographic-grid {
    grid-template-columns: 1fr;
  }

  .admin-grid-with-tenants .admin-tenant-card,
  .admin-grid-with-tenants .export-data-card,
  .admin-grid-with-tenants .import-data-card,
  .admin-grid-without-tenants .export-data-card,
  .admin-grid-without-tenants .import-data-card,
  .provider-department-admin {
    grid-column: 1;
    grid-row: auto;
  }

  .shell {
    padding: 14px;
  }

  .stat-strip {
    justify-items: start;
  }
}

.ssn-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover,
.icon-button.is-active {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #e5f2ef;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-active {
  background: #e6f4ec;
  color: var(--success);
}

.status-inactive {
  background: #f1f3f2;
  color: var(--muted);
}
/* EMR module layout */
.shell {
  width: 100%;
  max-width: none;
}

.app-tabs {
  min-height: 42px;
  padding: 0 14px;
  gap: 12px;
  background: #f8fafc;
}

.app-tabs .brand {
  color: #52659f;
  font-size: 1.02rem;
}

.app-tabs .brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: #f3a51b;
  font-size: 0.78rem;
}

.module-tabs {
  align-self: stretch;
  gap: 0;
}

.module-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 0;
  border-left: 1px solid #d7dde8;
  color: #445479;
}

.module-tabs a:last-child {
  border-right: 1px solid #d7dde8;
}

.module-tabs a.active,
.module-tabs a:hover {
  background: #5c6fa9;
  color: #ffffff;
  text-decoration: none;
}

.appointments-workspace {
  min-height: calc(100vh - 86px);
  border: 1px solid #d5dee8;
  background: #e8f2fb;
}

.patient-workspace {
  min-height: calc(100vh - 86px);
}

.patient-search-strip {
  border: 1px solid #cfd9e3;
  border-bottom: 0;
  background: #eef4fb;
  padding: 10px;
}

.patient-tab-search {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.patient-tab-search label:first-child {
  flex: 0 1 260px;
}

.patient-history-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.7fr) minmax(210px, 0.8fr);
  gap: 10px;
  flex: 1 0 100%;
  align-items: end;
  padding-top: 8px;
  border-top: 1px solid #d5e0eb;
}

.patient-history-filters label,
.patient-history-filters label span {
  display: block;
}

.patient-history-filters label span {
  margin-bottom: 4px;
  color: #53647a;
  font-size: 0.78rem;
  font-weight: 800;
}

.patient-history-filters select,
.patient-history-filters input {
  width: 100%;
}

.patient-history-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 9px 14px;
  border-top: 1px solid #dce5ee;
  border-bottom: 1px solid #dce5ee;
  color: #43556d;
  background: #f7faff;
  font-size: 0.86rem;
}

.patient-results {
  border-radius: 0 0 8px 8px;
}

.patient-seen-report {
  display: grid;
  gap: 16px;
}

.patient-seen-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.patient-seen-report-header h1,
.patient-seen-report-header p {
  margin: 0;
}

.report-screen-actions {
  display: flex;
  gap: 8px;
}

.patient-seen-report-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.patient-seen-report-filters div {
  padding: 9px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.patient-seen-report-filters dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.patient-seen-report-filters dd {
  margin: 3px 0 0;
  font-weight: 700;
}

.patient-seen-report-table {
  font-size: 0.82rem;
}

.patient-seen-report-table th,
.patient-seen-report-table td {
  padding: 6px 8px;
}

@media (max-width: 1050px) {
  .patient-history-filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media print {
  @page {
    size: landscape;
    margin: 0.4in;
  }

  body.patient-seen-report-page {
    color: #000000;
    background: #ffffff;
  }

  body.patient-seen-report-page .topbar,
  body.patient-seen-report-page .report-screen-actions,
  body.patient-seen-report-page .session-timeout-backdrop {
    display: none !important;
  }

  body.patient-seen-report-page .shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .patient-seen-report {
    gap: 10px;
  }

  .patient-seen-report-header h1 {
    font-size: 18pt;
  }

  .patient-seen-report-filters {
    grid-template-columns: repeat(6, 1fr);
    break-inside: avoid;
  }

  .patient-seen-report-filters div {
    padding: 5px 7px;
  }

  .patient-seen-report-table {
    width: 100%;
    font-size: 8.5pt;
  }

  .patient-seen-report-table thead {
    display: table-header-group;
  }

  .patient-seen-report-table tr {
    break-inside: avoid;
  }

  .patient-seen-report-table th,
  .patient-seen-report-table td {
    padding: 3px 5px;
    color: #000000;
    background: #ffffff;
  }
}

.encounter-shell {
  min-height: calc(100vh - 86px);
  margin: -22px;
  background: #e7f1fa;
  border-top: 1px solid #c8d5e2;
}

.encounter-patient-banner {
  display: grid;
  grid-template-columns: minmax(230px, 1.2fr) minmax(135px, 0.72fr) minmax(220px, 1fr) minmax(120px, 0.62fr) minmax(145px, 0.72fr);
  gap: 0;
  align-items: stretch;
  background: #f2e5b9;
  border-bottom: 1px solid #cdbd87;
  min-height: 48px;
}


.banner-block {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px 10px;
  border-left: 1px solid rgba(129, 112, 63, 0.25);
  min-width: 0;
}

.banner-block span {
  color: #536078;
  font-size: 0.78rem;
  font-weight: 800;
}

.banner-block strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-identity strong {
  color: #34467d;
}

.encounter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  background: #5c6fa9;
  color: #ffffff;
  padding: 0 14px;
  border-bottom: 1px solid #465889;
}

.encounter-breadcrumbs {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 0.88rem;
}

.encounter-breadcrumbs a,
.encounter-breadcrumbs span {
  color: #ffffff;
  font-weight: 800;
  min-width: 0;
}

.encounter-breadcrumbs a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.encounter-breadcrumbs a:hover {
  text-decoration: underline;
}

.encounter-breadcrumbs a::after {
  content: '>';
  margin: 0 8px;
  opacity: 0.72;
  text-decoration: none;
}

.encounter-breadcrumbs span[aria-current="page"] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.encounter-body {
  display: grid;
  grid-template-columns: 146px minmax(0, 1fr);
  min-height: calc(100vh - 170px);
}

.encounter-sidebar {
  background: #e8f0f7;
  border-right: 1px solid #c7d3df;
  padding: 8px 0;
}

.encounter-sidebar a,
.encounter-sidebar span {
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-bottom: 1px solid rgba(199, 211, 223, 0.55);
  color: #1f2b3d;
  font-size: 0.84rem;
  font-weight: 700;
}

.encounter-sidebar a:hover {
  background: #d9e6f2;
  text-decoration: none;
}

.encounter-sidebar a.active {
  background: #5c6fa9;
  color: #ffffff;
}

.encounter-sidebar .disabled {
  color: #aab3bf;
}

.encounter-main {
  padding: 8px;
  overflow: auto;
}

.facesheet-workspace {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  grid-auto-rows: clamp(220px, 26vh, 310px);
  gap: 6px;
  align-items: stretch;
}

.facesheet-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  border: 1px solid #bcc8d3;
  border-radius: 7px;
  background: #ffffff;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.facesheet-panel:hover,
.facesheet-panel:focus-visible {
  border-color: #2563eb;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.14);
  outline: none;
  transform: translateY(-1px);
}

.facesheet-panel header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 8px;
  border-bottom: 1px solid #d9e1e8;
  background: #fbfcfe;
}

.facesheet-panel h2 {
  font-size: 0.86rem;
  font-weight: 800;
  margin: 0;
}


.panel-content {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.panel-highlight .panel-content {
  background: #fff3a8;
}

.encounter-section {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #bcc8d3;
  border-radius: 7px;
  background: #ffffff;
}

.compact-table table {
  min-width: 680px;
}

@media (max-width: 1100px) {
  .encounter-patient-banner {
    grid-template-columns: 36px 1fr 1fr;
  }

  .facesheet-workspace {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 760px) {
  .encounter-shell {
    margin: -14px;
  }

  .encounter-body {
    grid-template-columns: 1fr;
  }

  .encounter-sidebar {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #c7d3df;
  }

  .encounter-sidebar a,
  .encounter-sidebar span {
    white-space: nowrap;
    border-bottom: 0;
    border-right: 1px solid rgba(199, 211, 223, 0.55);
  }

  .facesheet-workspace,
  .encounter-patient-banner {
    grid-template-columns: 1fr;
  }

}
/* AcoEMR neutral clinical palette overrides */
.app-tabs {
  background: #ffffff;
  border-bottom-color: #d8dedb;
}

.app-tabs .brand {
  color: #20302b;
}

.app-tabs .brand-mark {
  background: #0f766e;
}

.module-tabs a {
  border-left-color: #d8dedb;
  color: #2d3a36;
}

.module-tabs a:last-child {
  border-right-color: #d8dedb;
}

.module-tabs a.active,
.module-tabs a:hover {
  background: #20302b;
  color: #ffffff;
}

.appointments-workspace,
.patient-search-strip,
.encounter-shell {
  background: #f3f6f5;
}

.patient-results,
.encounter-section,
.facesheet-panel {
  border-color: #ccd5d1;
}

.encounter-patient-banner {
  background: #ffffff;
  border-bottom-color: #d8dedb;
}


.banner-block {
  border-left-color: #e3e8e6;
}

.banner-block span {
  color: #687873;
}

.patient-identity strong {
  color: #20302b;
}

.encounter-bar {
  background: #2f3d38;
  border-bottom-color: #20302b;
}

.encounter-sidebar {
  background: #ffffff;
  border-right-color: #ccd5d1;
}

.encounter-sidebar a,
.encounter-sidebar span {
  border-bottom-color: #edf1ef;
  color: #24322e;
}

.encounter-sidebar a:hover {
  background: #e8f3f0;
}

.encounter-sidebar a.active {
  background: #0f766e;
  color: #ffffff;
}

.encounter-sidebar .disabled {
  color: #a2aca8;
}

.facesheet-panel header {
  background: #f8faf9;
  border-bottom-color: #dde5e2;
}

.panel-content {
  background: #ffffff;
}

.panel-highlight .panel-content {
  background: #eef8f5;
}


.document-screen,
.notes-screen {
  max-width: 1180px;
}
/* AcoShift-inspired light blue/gray theme */
:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #eef4fb;
  --line: #dbe5f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 8px 20px rgba(15, 23, 42, 0.045), 0 1px 3px rgba(15, 23, 42, 0.04);
}

body {
  background: radial-gradient(circle at top left, rgba(14, 165, 233, 0.08), transparent 22%), linear-gradient(180deg, #f8fbff 0%, #f3f6fb 220px);
}

.topbar.app-tabs {
  background: #dce3ea;
  border-bottom-color: #c7d0da;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.app-tabs .brand {
  color: #0284c7;
}

.app-tabs .brand-mark {
  background: #0ea5e9;
  color: #ffffff;
}

.module-tabs a {
  color: #64748b;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 10px;
  min-height: 34px;
  margin: 4px 0;
}

.module-tabs a.active,
.module-tabs a:hover {
  background: #e1e8f0;
  color: #0f3b66;
}

.module-tabs a.active {
  position: relative;
}

.module-tabs a.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: #60a5fa;
}

.button-primary {
  background: #2563eb;
  border-color: #2563eb;
}

.button-primary:hover {
  background: #1d4ed8;
}

.appointments-workspace,
.patient-search-strip,
.encounter-shell {
  background: #f3f6fb;
}

.surface,
.patient-results,
.encounter-section,
.facesheet-panel,
.login-panel {
  background: linear-gradient(180deg, #fbfdff, #ffffff);
  border-color: #dbe5f0;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045), 0 1px 3px rgba(15, 23, 42, 0.04);
}

.encounter-patient-banner {
  background: #ffffff;
  border-bottom-color: #dbe5f0;
}


.banner-block {
  border-left-color: #e2e8f0;
}

.banner-block span {
  color: #64748b;
}

.patient-identity strong {
  color: #0f172a;
}

.encounter-bar {
  background: #163250;
  border-bottom-color: #10263d;
}

.encounter-sidebar {
  background: #ffffff;
  border-right-color: #dbe5f0;
}

.encounter-sidebar a,
.encounter-sidebar span {
  border-bottom-color: #eef2f7;
  color: #334155;
}

.encounter-sidebar a:hover {
  background: #eef4fb;
}

.encounter-sidebar a.active {
  background: #2563eb;
  color: #ffffff;
}

.facesheet-panel header {
  background: #f8fbff;
  border-bottom-color: #dbe5f0;
}

.panel-highlight .panel-content {
  background: #eef7ff;
}

.facesheet-modal[hidden] {
  display: none;
}

.facesheet-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 34px);
  background: rgba(15, 23, 42, 0.48);
}

.facesheet-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1040px, 96vw);
  max-height: min(820px, 92vh);
  min-height: min(520px, 82vh);
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.facesheet-modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #dbe5f0;
  background: #f8fbff;
}

.facesheet-modal-card header p {
  margin: 0 0 3px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.facesheet-modal-card header h2 {
  margin: 0;
  font-size: 1.12rem;
}

.facesheet-modal-content {
  overflow: auto;
  padding: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 0.98rem;
  line-height: 1.55;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-inactive {
  background: #f1f5f9;
  color: #64748b;
}

.demographics-screen,
.appointments-screen,
.document-screen,
.notes-screen {
  max-width: 1220px;
}

.demographics-form,
.appointment-form {
  display: grid;
  gap: 16px;
}

.demographics-form fieldset,
.appointment-form fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid #dbe5f0;
  border-radius: 14px;
  background: #fbfdff;
}

.demographics-form legend,
.appointment-form legend {
  padding: 0 6px;
  color: #0f3b66;
  font-weight: 800;
}

.patient-photo-control {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f7faf8;
}

.patient-photo-preview {
  width: 112px;
  height: 132px;
  border: 1px solid #cbd8e3;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.patient-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.patient-photo-actions {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: center;
}

.patient-photo-actions label {
  max-width: 420px;
}
.demographics-form .wide,
.appointment-form .wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.appointment-list {
  margin-top: 16px;
}

.status-form select {
  min-height: 32px;
  padding: 4px 8px;
}

@media (max-width: 900px) {

  .demographics-form fieldset,
  .appointment-form fieldset {
    grid-template-columns: 1fr;
  }
}
.button-danger {
  border-color: var(--danger);
  background: #ffffff;
  color: var(--danger);
}

.button-danger:hover {
  background: #fff0ed;
  color: var(--danger);
}

.action-form {
  display: inline-flex;
  justify-content: flex-end;
  margin: 0;
}

.small-text {
  font-size: 0.82rem;
}

.badge-undone {
  background: #f1f5f9;
  color: #475569;
}
.subtab-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #eef4fb;
  overflow-x: auto;
}

.subtab-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  background: transparent;
  color: #334155;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.subtab-button:hover,
.subtab-button.is-active {
  background: #2563eb;
  color: #ffffff;
}

.subtab-panel {
  display: grid;
  gap: 16px;
}

.subtab-panel[hidden] {
  display: none;
}

.demographics-form .subtab-panel fieldset + fieldset {
  margin-top: 0;
}
.ssn-input-field {
  width: 100%;
  gap: 6px;
}

.ssn-input-field input {
  flex: 1 1 auto;
  min-width: 0;
}

.ssn-input-field .icon-button {
  flex: 0 0 38px;
  height: 40px;
}
.appointment-head { align-items: center; }
.view-switch, .segmented-tabs { display: inline-flex; align-items: center; border: 1px solid #cbd7e2; background: #f8fbfe; }
.view-switch a, .segmented-tabs span { min-height: 34px; padding: 8px 14px; color: #41506c; font-weight: 800; border-right: 1px solid #d9e2ec; }
.view-switch a:last-child, .segmented-tabs span:last-child { border-right: 0; }
.view-switch a.active, .segmented-tabs span.active { background: #2f6f73; color: #ffffff; text-decoration: none; }
.appointment-filters { margin-bottom: 12px; }
.appointment-count-report { display: grid; gap: 24px; max-width: 760px; }
.appointment-count-form { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)) auto; gap: 12px; align-items: end; }
.appointment-count-form label { display: grid; gap: 4px; }
.appointment-count-form label span { color: #61708a; font-size: 0.78rem; font-weight: 800; }
.appointment-count-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.appointment-count-result { display: grid; justify-items: center; gap: 4px; padding: 28px; border: 1px solid #b9d4d1; background: #eef8f6; text-align: center; }
.appointment-count-result > span { color: #41506c; font-weight: 800; }
.appointment-count-result > strong { color: #235f64; font-size: clamp(3rem, 9vw, 5.5rem); line-height: 1; font-variant-numeric: tabular-nums; }
.appointment-count-range { margin: -12px 0 0; color: #41506c; font-weight: 800; text-align: center; }
.appointment-count-note { margin: 0; }
.filter-grid { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)) minmax(220px, 1.4fr) auto auto auto; gap: 10px; align-items: end; }
.filter-grid label, .compact-filter label { display: grid; gap: 4px; }
.filter-grid span, .compact-filter span { color: #61708a; font-size: 0.78rem; font-weight: 800; }
.appointment-board { padding: 0; overflow: visible; min-width: 0; }
.appointment-table table { min-width: 1380px; }
.appointment-table th, .appointment-table td { vertical-align: top; }
.time-cell, .mono { font-variant-numeric: tabular-nums; }
.block { display: block; }
.patient-link { color: #235f64; font-weight: 900; }
.visit-status { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; background: #eaf3f0; color: #244c4f; border: 1px solid #c7ddd8; font-weight: 800; white-space: nowrap; }
.status-arrived, .status-with-doc, .status-with-clinical-staff { background: #fff4b8; border-color: #e2c65d; color: #5e4b00; }
.status-complete, .status-done { background: #dff3e6; border-color: #b3ddc1; color: #1f6b3d; }
.status-no-show, .status-cancelled { background: #fde7e5; border-color: #efb7b2; color: #9b2c25; }
.status-tentative { background: #edf0f7; border-color: #cbd3e2; color: #485675; }
.schedule-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; }
.schedule-filter-panel { position: sticky; top: 74px; }
.compact-filter { gap: 10px; }
.date-jump-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.date-jump-row .button { min-width: 0; padding-inline: 5px; }
.schedule-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid #dbe5ec; }
.schedule-filter-heading strong { color: #26364f; font-size: 0.9rem; }
.schedule-filter-heading a { color: #235f64; font-size: 0.78rem; font-weight: 900; }
.schedule-provider-dropdown { width: 100%; }
.schedule-provider-dropdown .provider-filter-options { right: auto; width: min(340px, calc(100vw - 32px)); }
.schedule-all-providers { position: sticky; top: 0; z-index: 1; width: 100%; border-color: #8eb8b4; background: #e8f4f2; color: #17494d; }
.schedule-all-providers:hover { background: #dcefeb; }

@media (min-width: 761px) {
  body.appointments-page {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  body.appointments-page > .topbar { position: relative; }
  body.appointments-page > .shell {
    display: grid;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  body.schedule-page > .shell { grid-template-rows: auto minmax(0, 1fr); }
  body.schedule-page .schedule-shell { min-height: 0; height: 100%; align-items: stretch; }
  body.schedule-page .schedule-filter-panel { position: static; min-height: 0; margin-bottom: 0; overflow-y: auto; }
  body.schedule-page .schedule-board { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; margin-bottom: 0; }
  body.schedule-page .schedule-grid-wrap { min-height: 0; height: 100%; max-height: none; }

  body.appointment-list-page > .shell { grid-template-rows: auto auto minmax(0, 1fr); }
  body.appointment-list-page .appointment-filters { min-height: 0; }
  body.appointment-list-page .appointment-board { min-height: 0; margin-bottom: 0; overflow: hidden; }
  body.appointment-list-page .appointment-table { height: 100%; overflow: auto; }
  body.appointment-list-page .filter-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
.schedule-board { padding: 0; overflow: hidden; min-width: 0; }
.schedule-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 10px; border-bottom: 1px solid #d5e0ea; background: #f5f8fb; }
.schedule-x-scroll { width: 100%; height: 18px; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid #d5e0ea; background: #f8fbfe; }
.schedule-x-scroll-inner { height: 1px; min-width: 100%; }
.schedule-grid-wrap { width: 100%; max-width: 100%; overflow: auto; max-height: calc(100vh - 228px); overscroll-behavior: contain; scrollbar-gutter: stable both-edges; }
.schedule-grid-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.schedule-grid-table th, .schedule-grid-table td { min-width: 220px; max-width: 260px; border-right: 1px solid #d8e1eb; border-bottom: 1px solid #d8e1eb; vertical-align: top; background: #ffffff; }
.schedule-grid-table thead th { position: sticky; top: 0; z-index: 8; height: 42px; padding: 8px 10px; background: #edf4f7; color: #26364f; white-space: nowrap; }
.filter-clear-link {
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #cbd7e2;
  border-radius: 6px;
  background: #ffffff;
  color: #235f64;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.filter-clear-link:hover {
  background: #eef7f5;
  text-decoration: none;
}

.schedule-provider-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-provider-link:hover,
.provider-filter-link:hover {
  color: #235f64;
  text-decoration: underline;
}

.schedule-provider-link.active,
.provider-filter-link.active {
  color: #17494d;
  font-weight: 900;
}

.provider-filter-link {
  color: #235f64;
  font-weight: 900;
  text-decoration: none;
}
.schedule-grid-table .sticky-time { position: sticky; left: 0; z-index: 9; min-width: 96px; max-width: 96px; width: 96px; background: #f6f9fc; color: #506076; font-variant-numeric: tabular-nums; }
.schedule-grid-table tbody .sticky-time { height: 24px; padding: 0 8px; text-align: right; font-size: 0.82rem; font-weight: 800; line-height: 24px; white-space: nowrap; }
.schedule-grid-table tr.hour-start th, .schedule-grid-table tr.hour-start td { border-top: 2px solid #aebdca; }
.schedule-slot-cell { position: relative; height: 24px; min-height: 24px; padding: 0; overflow: visible; background: #ffffff; }
.schedule-slot-cell.has-appointment { background: #fbfdfc; }
.schedule-card { position: absolute; top: 1px; z-index: 5; display: grid; align-content: start; gap: 2px; min-height: 22px; padding: 6px 8px; border: 1px solid #b9d3ce; border-left: 4px solid #2f6f73; background: #eef7f5; color: #203040; text-align: left; text-decoration: none; box-shadow: 0 1px 3px rgba(20, 42, 55, 0.18); overflow: hidden; cursor: pointer; font: inherit; }
.schedule-card:hover { z-index: 7; background: #e2f0ed; text-decoration: none; }
.schedule-card strong, .schedule-card span, .schedule-card small, .schedule-card em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-card strong { font-size: 0.9rem; }
.schedule-card span, .schedule-card small, .schedule-card em { font-size: 0.78rem; }
.schedule-card-time { color: #426169; font-weight: 800; }
.schedule-card small, .schedule-card em { color: #607086; font-style: normal; }
.schedule-card.is-compact { gap: 1px; padding: 4px 7px; box-shadow: none; }
.schedule-card.is-compact strong { font-size: 0.8rem; line-height: 1.1; }
.schedule-card.is-compact span { font-size: 0.72rem; line-height: 1.12; }
.schedule-card.is-compact .schedule-card-type { color: #4f6072; font-weight: 800; }
.schedule-card.is-tiny { display: flex; flex-direction: column; justify-content: center; padding: 2px 7px; }
.schedule-card.is-tiny .schedule-card-time { font-size: 0.68rem; }
.schedule-card.status-arrived, .schedule-card.status-with-doc, .schedule-card.status-with-clinical-staff { background: #fff4c2; border-color: #d8bf58; border-left-color: #b08b00; }
.schedule-card.status-complete, .schedule-card.status-done { background: #dff3e6; border-color: #aad6ba; border-left-color: #2f7d4a; }
.schedule-card.status-no-show, .schedule-card.status-cancelled { background: #fde7e5; border-color: #efb7b2; border-left-color: #b73930; }
.schedule-card.status-tentative { background: #edf0f7; border-color: #cbd3e2; border-left-color: #63708f; }
.schedule-modal-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(15, 28, 42, 0.48); }
.schedule-modal-backdrop[hidden] { display: none; }
.schedule-modal-card { width: min(620px, 100%); max-height: min(720px, calc(100vh - 48px)); overflow: auto; background: #ffffff; border: 1px solid #cbd7e2; box-shadow: 0 18px 48px rgba(15, 28, 42, 0.28); }
.schedule-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid #d8e1eb; background: #f5f8fb; }
.schedule-modal-head h2 { margin: 0 0 4px; font-size: 1.15rem; color: #16243a; }
.schedule-modal-head a { color: #235f64; font-weight: 900; }
.schedule-modal-close { width: 34px; height: 34px; font-size: 1.25rem; line-height: 1; }
.schedule-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; padding: 8px 18px 18px; }
.schedule-detail-grid div { display: grid; gap: 3px; padding: 10px 0; border-bottom: 1px solid #edf1f5; }
.schedule-detail-grid .wide { grid-column: 1 / -1; }
.schedule-detail-grid dt { color: #61708a; font-size: 0.78rem; font-weight: 900; text-transform: uppercase; }
.schedule-detail-grid dd { margin: 0; color: #203040; white-space: pre-wrap; }
.schedule-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid #d8e1eb; background: #fbfcfd; }
@media (max-width: 640px) { .schedule-detail-grid { grid-template-columns: 1fr; } .schedule-modal-actions { flex-direction: column; } }

.appointment-row {
  cursor: pointer;
}

.appointment-row:focus-visible,
.appointment-row:hover td {
  background: #eef7f9;
}

.appointment-row .status-form,
.appointment-row select {
  cursor: auto;
}
@media (max-width: 980px) { .filter-grid, .schedule-shell { grid-template-columns: 1fr; } .schedule-filter-panel { position: static; } }
@media (max-width: 640px) { .appointment-count-form, .appointment-count-results { grid-template-columns: 1fr; } }
.patient-table-wrap table {
  min-width: 920px;
}

.patient-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}

.patient-sort-link:hover,
.patient-sort-link.active {
  color: #235f64;
  text-decoration: underline;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-row-top {
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.button.disabled,
.button.disabled:hover {
  color: #8a9892;
  background: #eef2f0;
  border-color: #d9e0dc;
  cursor: default;
  text-decoration: none;
  pointer-events: none;
}

@media (max-width: 720px) {
  .pagination-row {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    justify-content: space-between;
  }
}
.import-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.import-actions .action-form {
  margin: 0;
}
.document-viewer-shell {
  display: grid;
  grid-template-rows: var(--document-list-height, minmax(180px, 280px)) 14px minmax(420px, 1fr);
  gap: 8px;
  min-height: 720px;
}

.document-list-panel {
  min-height: 0;
}

.document-preview-splitter {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 14px;
  border: 1px solid #d6e1ec;
  border-radius: 7px;
  background: #f4f8fb;
  cursor: row-resize;
  touch-action: none;
}

.document-preview-splitter span {
  display: block;
  width: 72px;
  height: 4px;
  border-radius: 999px;
  background: #8da0b8;
}

.document-preview-splitter:hover,
.document-preview-splitter:focus-visible,
.document-preview-splitter.is-dragging {
  border-color: #77a6c9;
  background: #e8f3fb;
  outline: none;
}

.document-preview-splitter:hover span,
.document-preview-splitter:focus-visible span,
.document-preview-splitter.is-dragging span {
  background: #2563eb;
}

.document-table-wrap {
  height: 100%;
  overflow: auto;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #ffffff;
}

.document-table {
  min-width: 980px;
}

.document-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eaf2fb;
  color: #233957;
}

.document-row {
  cursor: pointer;
  outline: none;
}

.document-row:hover {
  background: #f1f7ff;
}

.document-row.is-active {
  background: #d9ecff;
  box-shadow: inset 4px 0 0 #2563eb;
}

.document-row.is-active td {
  border-bottom-color: #b8d6f6;
}

.document-row.is-metadata-only {
  cursor: default;
}

.document-preview-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fbff;
  overflow: hidden;
}

.document-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #dbe5f0;
  background: #ffffff;
}

.document-preview-toolbar strong,
.document-preview-toolbar span {
  display: block;
}

.document-preview-toolbar span {
  margin-top: 2px;
  color: #64748b;
  font-size: 0.84rem;
}

.document-preview-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

body.document-fullscreen-active {
  overflow: hidden;
}

.document-viewer-shell.is-document-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  min-height: 100vh;
  width: 100vw;
  padding: 0;
  background: #ffffff;
}

.document-viewer-shell.is-document-fullscreen .document-list-panel,
.document-viewer-shell.is-document-fullscreen .document-preview-splitter {
  display: none;
}

.document-viewer-shell.is-document-fullscreen .document-preview-panel {
  border: 0;
  border-radius: 0;
}

.document-viewer-shell.is-document-fullscreen .document-preview-frame-wrap,
.document-viewer-shell.is-document-fullscreen .document-preview-frame-wrap iframe {
  min-height: 0;
  height: 100%;
}

.document-preview-frame-wrap {
  position: relative;
  min-height: 420px;
  background: #eef2f7;
}

.document-preview-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 540px;
  border: 0;
  background: #ffffff;
}

.document-preview-empty {
  display: grid;
  min-height: 420px;
  place-items: center;
  padding: 24px;
  color: #64748b;
  text-align: center;
}

@media (max-width: 900px) {

  .document-viewer-shell {
    grid-template-rows: var(--document-list-height, minmax(180px, 260px)) 14px minmax(360px, 1fr);
    min-height: 620px;
  }

  .document-preview-frame-wrap iframe {
    min-height: 420px;
  }
}
/* Fluid chart workspaces: let chart sections use the available page area. */
.encounter-main {
  min-width: 0;
  width: 100%;
}

.encounter-section,
.demographics-screen,
.appointments-screen,
.document-screen,
.notes-screen {
  width: 100%;
  max-width: none;
}

.document-screen {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
  min-height: calc(100vh - 190px);
}

.document-form {
  align-items: end;
}

.document-form .grow {
  flex: 1 1 380px;
  min-width: min(100%, 260px);
}

.document-viewer-shell {
  width: 100%;
  min-width: 0;
  min-height: clamp(560px, calc(100vh - 328px), 980px);
  grid-template-rows: var(--document-list-height, minmax(160px, 28vh)) 14px minmax(360px, 1fr);
}

.document-list-panel,
.document-preview-panel,
.document-preview-frame-wrap {
  min-width: 0;
}

.document-preview-frame-wrap,
.document-preview-empty {
  min-height: 0;
}

.document-preview-frame-wrap iframe {
  min-height: 100%;
}

.appointments-screen,
.demographics-screen,
.notes-screen {
  min-height: calc(100vh - 190px);
}

.appointment-list,
.note-list,
.demographics-form,
.appointment-form {
  width: 100%;
  max-width: none;
}

@media (max-width: 900px) {

  .document-screen,
  .appointments-screen,
  .demographics-screen,
  .notes-screen {
    min-height: auto;
  }

  .document-viewer-shell {
    min-height: clamp(500px, calc(100vh - 260px), 760px);
    grid-template-rows: minmax(160px, 260px) minmax(340px, 1fr);
  }
}
/* Laptop-scale density: keep wide monitor spacing, but reduce wasted space on common laptop viewports. */
@media (max-width: 1500px) {
  body {
    line-height: 1.36;
  }

  h1 {
    font-size: 1.52rem;
  }

  input,
  select,
  textarea {
    min-height: 36px;
    padding: 7px 9px;
  }

  .topbar {
    min-height: 48px;
    padding: 7px 14px;
    gap: 12px;
  }

  .navlinks a {
    padding: 7px 9px;
  }

  .shell {
    width: 100%;
    padding: 14px;
  }

  .surface {
    padding: 12px;
    margin-bottom: 12px;
  }

  .page-head,
  .chart-head {
    gap: 12px;
    margin-bottom: 10px;
  }

  .filter-grid,
  .patient-tab-search {
    gap: 8px;
  }

  .encounter-shell {
    margin: -14px;
    min-height: calc(100vh - 58px);
  }

  .encounter-patient-banner {
    grid-template-columns: minmax(220px, 1.2fr) minmax(124px, 0.72fr) minmax(190px, 1fr) minmax(110px, 0.62fr) minmax(132px, 0.72fr);
    min-height: 42px;
  }


  .banner-block {
    padding: 5px 8px;
  }

  .banner-block span {
    font-size: 0.72rem;
  }

  .encounter-bar {
    min-height: 32px;
    padding: 0 10px;
  }

  .encounter-breadcrumbs {
    font-size: 0.82rem;
  }

  .encounter-body {
    grid-template-columns: 132px minmax(0, 1fr);
    min-height: calc(100vh - 136px);
  }

  .encounter-sidebar {
    padding: 5px 0;
  }

  .encounter-sidebar a,
  .encounter-sidebar span {
    min-height: 25px;
    padding: 4px 8px;
    font-size: 0.79rem;
  }

  .encounter-main {
    padding: 6px;
  }

  .facesheet-workspace {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    grid-auto-rows: clamp(180px, 24vh, 250px);
    gap: 6px;
  }

  .facesheet-panel header {
    min-height: 26px;
    padding: 4px 7px;
  }

  .facesheet-panel h2 {
    font-size: 0.82rem;
  }

  .panel-content {
    padding: 7px;
    font-size: 0.82rem;
    line-height: 1.34;
  }

  .demographics-form,
  .appointment-form {
    gap: 12px;
  }

  .demographics-form fieldset,
  .appointment-form fieldset {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 10px;
    padding: 12px;
  }

  .document-viewer-shell {
    min-height: clamp(500px, calc(100vh - 286px), 900px);
  }

  .schedule-shell {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 10px;
  }

  .schedule-filter-panel {
    padding: 10px;
  }

  .schedule-grid-table th,
  .schedule-grid-table td {
    min-width: 190px;
  }

  .schedule-grid-table .sticky-time {
    min-width: 72px;
    width: 72px;
  }
}

@media (max-width: 1180px) {
  .facesheet-workspace {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }

  .encounter-patient-banner {
    grid-template-columns: minmax(220px, 1fr) minmax(130px, 0.7fr) minmax(180px, 0.9fr);
  }

  .encounter-patient-banner .banner-block:nth-last-child(-n+2) {
    display: none;
  }

  .demographics-form fieldset,
  .appointment-form fieldset {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .schedule-shell {
    grid-template-columns: 1fr;
  }

  .schedule-filter-panel .compact-filter {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    display: grid;
    align-items: end;
  }

  .schedule-filter-panel .date-jump-row {
    grid-column: auto;
  }
}
@media (max-width: 760px) {
  .shell {
    padding: 14px;
  }

  .encounter-shell {
    margin: -14px;
  }

  .encounter-body,
  .encounter-patient-banner,
  .facesheet-workspace {
    grid-template-columns: 1fr;
  }

  .encounter-sidebar {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #c7d3df;
  }

  .encounter-sidebar a,
  .encounter-sidebar span {
    white-space: nowrap;
    border-bottom: 0;
    border-right: 1px solid rgba(199, 211, 223, 0.55);
  }


  .demographics-form fieldset,
  .appointment-form fieldset,
  .schedule-filter-panel .compact-filter {
    grid-template-columns: 1fr;
  }

  .facesheet-modal-card {
    width: min(100%, 96vw);
    min-height: min(460px, 86vh);
  }
}
.encounter-patient-banner .banner-block:first-child {
  border-left: 0;
}

@media (max-width: 760px) {
  .facesheet-workspace {
    grid-auto-rows: clamp(180px, 34vh, 260px);
  }
}


.insurance-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 14px;
  align-items: start;
}

.insurance-card-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  min-width: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.insurance-card-preview header {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  background: #f6faf8;
}

.insurance-card-preview header strong {
  font-size: 0.86rem;
}

.insurance-card-preview iframe,
.insurance-card-image {
  display: block;
  width: 100%;
  height: clamp(260px, 13vw, 440px);
  border: 0;
  background: #f7faf8;
}

.insurance-card-image {
  object-fit: contain;
}

.insurance-card-preview p {
  margin: 0;
  padding: 5px 9px;
  font-size: 0.74rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.insurance-card-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f8faf9;
}

@media (max-width: 1180px) {
  .insurance-card-grid {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }

  .insurance-card-preview iframe,
  .insurance-card-image {
    height: clamp(230px, 24vw, 360px);
  }
}

@media (max-width: 900px) {

  .insurance-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .patient-photo-control {
    grid-template-columns: 1fr;
  }
}

.provider-department-admin {
  grid-column: 1 / -1;
}

.department-tenant-form {
  margin-bottom: 12px;
}

.provider-department-form {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  color: #61708a;
  font-size: 0.78rem;
  font-weight: 900;
}

.provider-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #d5e0ea;
  border-radius: 8px;
  background: #ffffff;
}

.provider-checklist label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #e4ebf2;
  border-radius: 6px;
  background: #fbfdff;
  color: #203040;
  font-weight: 800;
  line-height: 1.25;
}

.provider-checklist label:hover {
  border-color: #b9c9d9;
  background: #f3f8fb;
}

.provider-checklist input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.provider-checklist span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.provider-admin-dropdown summary {
  width: 100%;
}

.provider-admin-dropdown .provider-checklist {
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.provider-department-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.provider-department-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.department-actions {
  display: flex;
  justify-content: flex-end;
}
.provider-filter-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filter-grid .provider-filter-group {
  grid-column: span 2;
}

.filter-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-group-head > span {
  color: #61708a;
  font-size: 0.78rem;
  font-weight: 900;
}

.filter-group-head a {
  color: #235f64;
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
}

.provider-filter-options {
  display: grid;
  gap: 5px;
  max-height: 162px;
  overflow: auto;
  padding: 7px;
  border: 1px solid #d5e0ea;
  border-radius: 7px;
  background: #ffffff;
}

.filter-grid .provider-filter-options {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.provider-filter-options label.provider-check,
.compact-filter .provider-filter-options label.provider-check,
.filter-grid .provider-filter-options label.provider-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  box-sizing: border-box;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid #e5edf4;
  border-radius: 6px;
  background: #fbfdff;
  color: #203040;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
}

.provider-filter-options label.provider-check:hover {
  border-color: #b9c9d9;
  background: #f3f8fb;
}

.provider-filter-options .provider-check input {
  display: block;
  align-self: center;
  justify-self: center;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  margin: 0;
}

.provider-filter-options .provider-check span {
  display: block;
  align-self: center;
  min-width: 0;
  color: #203040;
  font-size: 0.82rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .filter-grid .provider-filter-group {
    grid-column: auto;
  }

  .filter-grid .provider-filter-options {
    grid-template-columns: 1fr;
  }
}

.banner-ssn-field {
  align-items: center;
  gap: 6px;
}

.banner-ssn-field .icon-button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.patient-tab-search .patient-provider-filter {
  flex: 0 1 310px;
  max-width: 340px;
}

.patient-tab-search .grow {
  flex: 1 1 360px;
}

.provider-filter-dropdown {
  position: relative;
  min-width: 0;
}

.provider-filter-dropdown summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 34px 8px 12px;
  border: 1px solid #cbd7e2;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2f46;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  list-style: none;
  white-space: nowrap;
}

.provider-filter-dropdown summary::-webkit-details-marker {
  display: none;
}

.provider-filter-dropdown summary::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #182638;
  border-bottom: 2px solid #182638;
  transform: translateY(-65%) rotate(45deg);
}

.provider-filter-dropdown[open] summary {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.provider-filter-dropdown[open] summary::after {
  transform: translateY(-35%) rotate(225deg);
}

.provider-filter-dropdown .provider-filter-options {
  position: absolute;
  z-index: 40;
  top: calc(100% - 1px);
  right: 0;
  left: 0;
  grid-template-columns: 1fr;
  max-height: 260px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
}

.patient-tab-search .provider-filter-dropdown .provider-filter-options,
.filter-grid .provider-filter-dropdown .provider-filter-options {
  grid-template-columns: 1fr;
}

.badge-muted {
  background: #eef2f6;
  color: #61708a;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tenant-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.tenant-page-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tenant-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.tenant-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}

.tenant-tabs a:hover,
.tenant-tabs a.active {
  background: #e8f1fb;
  color: var(--primary-dark);
  text-decoration: none;
}

.tenant-manage-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.tenant-left-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

.tenant-settings-card,
.tenant-tab-card {
  margin-bottom: 0;
}

.tenant-auth-card .stack-form {
  gap: 10px;
}

.tenant-auth-card input {
  min-height: 36px;
  font-size: 0.92rem;
}

.tenant-auth-card .button {
  min-height: 36px;
}

.tenant-settings-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.check-row span {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .tenant-page-actions,
  .tenant-page-actions .button,
  .tenant-tabs {
    width: 100%;
  }

  .tenant-tabs a {
    flex: 1;
  }

  .tenant-manage-grid {
    grid-template-columns: 1fr;
  }

  .tenant-settings-actions {
    grid-column: 1;
  }

  .tenant-settings-actions .button {
    width: 100%;
  }
}
.microsoft-login-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.microsoft-button {
  width: 100%;
  border-color: #9bb7d9;
  background: #f7fbff;
  color: #17456f;
}

.microsoft-button:hover {
  background: #edf6ff;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

@media (max-width: 900px) {
  .tenant-manage-grid {
    grid-template-columns: 1fr;
  }

  .tenant-auth-card,
  .tenant-users-card,
  .tenant-audit-card,
  .tenant-settings-actions {
    grid-column: 1;
  }

  .tenant-settings-actions .button,
  .page-actions .button {
    width: 100%;
  }
}
.user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 260px;
}

.user-role-form,
.user-action-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.user-role-form select {
  min-width: 92px;
  min-height: 34px;
  padding: 5px 28px 5px 8px;
  font-size: 0.86rem;
}

.local-credentials {
  position: relative;
}

.local-credentials > summary {
  list-style: none;
  cursor: pointer;
}

.local-credentials > summary::-webkit-details-marker {
  display: none;
}

.local-credentials-form {
  display: grid;
  gap: 9px;
  width: min(360px, 80vw);
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbff;
}

.local-credentials-form label {
  display: grid;
  gap: 4px;
}

.local-credentials-form label > span,
.local-credentials-form small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.button-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.button-danger {
  border-color: #d9a7a7;
  background: #fff5f5;
  color: #8f1d1d;
}

.button-danger:hover {
  background: #ffe7e7;
  color: #741818;
}

.readonly-field {
  display: grid;
  gap: 6px;
}

.readonly-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.readonly-field strong {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbfd;
  color: var(--text);
  font-size: 0.95rem;
}
.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.audit-filter-grid label {
  display: grid;
  gap: 4px;
}

.audit-filter-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.audit-search-field {
  grid-column: span 2;
}

.audit-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .audit-filter-grid {
    grid-template-columns: 1fr;
  }

  .audit-search-field {
    grid-column: 1;
  }
}
.session-timeout-active {
  overflow: hidden;
}

/* Keep patient chart screens within the viewport; each work area owns its scrolling. */
@media (min-width: 761px) {
  body.chart-page {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  body.chart-page > .topbar {
    position: relative;
  }

  body.chart-page > .shell {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  body.chart-page .encounter-shell {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: calc(100% + 44px);
    min-height: 0;
    overflow: hidden;
  }

  body.chart-page .encounter-body {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.chart-page .encounter-sidebar {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body.chart-page .encounter-main {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.chart-documents-page .encounter-main {
    overflow: hidden;
  }

  body.chart-documents-page .document-screen {
    height: 100%;
    min-height: 0;
  }

  body.chart-documents-page .document-workspace.document-viewer-shell {
    align-self: stretch;
    height: auto;
    min-height: 0;
  }

  body.chart-documents-page .document-index-list,
  body.chart-documents-page .document-preview-frame-wrap,
  body.chart-documents-page .document-preview-frame-wrap iframe {
    min-height: 0;
    overscroll-behavior: contain;
  }
}

@media (min-width: 761px) and (max-width: 1500px) {
  body.chart-page .encounter-shell {
    height: calc(100% + 28px);
  }
}

.session-timeout-backdrop[hidden] {
  display: none;
}

.session-timeout-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.session-timeout-card {
  width: min(460px, 100%);
  border: 1px solid #cbd7e2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  padding: 22px;
}

.session-timeout-kicker {
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.session-timeout-card h2 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 1.12rem;
  line-height: 1.25;
}

.session-timeout-card p {
  margin: 0 0 14px;
  color: #475569;
}

.session-timeout-remaining {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #dbe5f0;
  border-radius: 6px;
  background: #f8fbff;
  color: #334155;
  font-weight: 700;
}

.session-timeout-remaining strong {
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.session-timeout-card form {
  display: flex;
  justify-content: flex-end;
  margin: 0;
}

.session-timeout-card .button {
  min-width: 138px;
}

@media (max-width: 560px) {
  .session-timeout-backdrop {
    align-items: end;
    padding: 14px;
  }

  .session-timeout-card form,
  .session-timeout-card .button {
    width: 100%;
  }
}
.patient-identity {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  align-content: stretch;
  gap: 10px;
}

.chart-patient-photo {
  width: 52px;
  height: 52px;
  border: 1px solid #cbd7e2;
  border-radius: 7px;
  background: #f8fbff;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #2563eb;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

.chart-patient-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chart-patient-photo span {
  color: #2563eb;
  font-size: 1rem;
  font-weight: 900;
}

.patient-identity-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.patient-identity-text strong,
.patient-identity-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1500px) {
  .patient-identity {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 8px;
  }

  .chart-patient-photo {
    width: 46px;
    height: 46px;
  }
}

@media (max-width: 760px) {
  .patient-identity {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .chart-patient-photo {
    width: 48px;
    height: 48px;
  }
}
.chart-patient-photo-button {
  padding: 0;
  cursor: pointer;
}

.chart-patient-photo-button:hover,
.chart-patient-photo-button:focus-visible {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  outline: none;
}

.patient-photo-modal-active {
  overflow: hidden;
}

.patient-photo-modal[hidden] {
  display: none;
}

.patient-photo-modal {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 34px);
  background: rgba(15, 23, 42, 0.58);
}

.patient-photo-modal-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, 96vw);
  max-height: min(860px, 92vh);
  overflow: hidden;
  border: 1px solid #cbd7e2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
}

.patient-photo-modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #dbe5f0;
  background: #f8fbff;
}

.patient-photo-modal-card header p {
  margin: 0 0 3px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.patient-photo-modal-card header h2 {
  margin: 0;
  font-size: 1.12rem;
}

.patient-photo-modal-frame {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #eef2f7;
  overflow: auto;
}

.patient-photo-modal-frame img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 112px);
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
}

@media (max-width: 640px) {
  .patient-photo-modal-card {
    width: min(100%, 96vw);
  }

  .patient-photo-modal-card header {
    align-items: flex-start;
  }
}
.schedule-department-field { display: grid; gap: 8px; }
.schedule-default-button { width: 100%; min-height: 36px; }
.schedule-order-status { min-width: 96px; text-align: right; color: #607086; font-size: 0.78rem; font-weight: 800; }
.schedule-order-status.is-saving { color: #426169; }
.schedule-order-status.is-saved { color: #2f6f73; }
.schedule-order-status.is-error { color: #a23832; }
.schedule-provider-heading { cursor: grab; user-select: none; }
.schedule-provider-heading:active { cursor: grabbing; }
.schedule-provider-heading.is-dragging { opacity: 0.58; }
.schedule-provider-heading.is-drag-over { background: #dfecef; box-shadow: inset 4px 0 0 #2f6f73; }
@media (max-width: 640px) {
  .schedule-order-status { min-width: 0; }
}

/* Keep the schedule provider picker inside the scrolling filter rail. */
body.schedule-page .schedule-provider-dropdown .provider-filter-options {
  position: static;
  width: 100%;
  max-height: min(280px, 38vh);
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: none;
}

body.schedule-page .schedule-provider-dropdown[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Task-based Admin dashboard */
.admin-launch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 1100px;
}

.admin-launch-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 104px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.admin-launch-card:hover {
  border-color: #a9bdd4;
  box-shadow: 0 8px 22px rgba(30, 58, 95, 0.1);
  text-decoration: none;
  transform: translateY(-1px);
}

.admin-launch-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #e8f0ff;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 900;
}

.admin-launch-card strong,
.admin-launch-card small {
  display: block;
}

.admin-launch-card strong {
  margin-bottom: 4px;
  font-size: 1rem;
}

.admin-launch-card small {
  color: var(--muted);
  line-height: 1.4;
}

.admin-launch-card .button {
  pointer-events: none;
}

.admin-section-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: -2px 0 20px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-section-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 7px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.admin-section-nav a:hover {
  background: var(--surface-2);
}

.admin-section-nav a span {
  color: var(--primary);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.admin-section-nav-single {
  grid-template-columns: minmax(220px, 320px);
}

.admin-dashboard {
  display: grid;
  gap: 22px;
  margin-bottom: 22px;
}

.admin-dashboard > section,
.recent-imports-card {
  scroll-margin-top: 82px;
}

.admin-eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-card-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

.admin-card-heading h2,
.admin-card-heading h3,
.admin-section-heading h2 {
  margin: 0;
}

.admin-card-heading h3 {
  font-size: 1.05rem;
}

.admin-card-heading p:not(.admin-eyebrow),
.admin-section-heading p:not(.admin-eyebrow) {
  margin: 4px 0 0;
}

.admin-tenant-card {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  column-gap: 24px;
  align-items: start;
}

.admin-tenant-card .admin-card-heading {
  grid-column: 1 / -1;
}

.admin-tenant-card .tenant-list {
  margin-top: 0;
}

.admin-tenant-card .inline-form {
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.admin-transfer-section {
  min-width: 0;
}

.admin-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.admin-transfer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.admin-transfer-grid .import-data-card {
  order: 1;
}

.admin-transfer-grid .export-data-card {
  order: 2;
}

.admin-transfer-grid .admin-side-card {
  min-width: 0;
}

.provider-department-admin .department-tenant-form {
  max-width: 460px;
}

.provider-department-admin .provider-department-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.2fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  background: var(--surface-2);
}

.provider-department-admin .provider-department-list {
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.provider-department-card {
  align-content: start;
  box-shadow: none;
}

.recent-imports-card {
  margin-bottom: 0;
}

@media (max-width: 1000px) {
  .admin-tenant-card,
  .admin-transfer-grid {
    grid-template-columns: 1fr;
  }

  .admin-tenant-card .admin-card-heading {
    grid-column: 1;
  }

  .provider-department-admin .provider-department-form {
    grid-template-columns: 1fr 1fr;
  }

  .provider-department-admin .provider-department-form .button {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
}

.confirm-modal-backdrop[hidden] {
  display: none;
}

.confirm-modal-card {
  width: min(500px, 100%);
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
  padding: 24px;
  border: 1px solid #d7e2ee;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.confirm-modal-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 1.25rem;
  font-weight: 800;
}

.confirm-modal-backdrop.is-danger .confirm-modal-icon {
  background: #fee2e2;
  color: #b91c1c;
}

.confirm-modal-copy h2 {
  margin: 2px 0 8px;
  font-size: 1.15rem;
}

.confirm-modal-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.confirm-modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

body.confirm-modal-active {
  overflow: hidden;
}

@media (max-width: 520px) {
  .confirm-modal-card {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 20px;
  }

  .confirm-modal-icon {
    width: 36px;
    height: 36px;
  }

  .confirm-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.update-card,
.update-actions-card,
.update-notes-card {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.update-meta-grid,
.update-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.update-meta-grid > div,
.update-status-card {
  display: grid;
  gap: 6px;
}

.update-meta-grid > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.update-meta-grid strong {
  font-size: 1.08rem;
}

.update-status-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.update-status-card {
  align-content: start;
}

.update-status-card h2,
.update-status-card p {
  margin: 0;
}

.update-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.update-actions .button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.update-manifest-url {
  overflow-wrap: anywhere;
}

@media (max-width: 800px) {
  .update-meta-grid,
  .update-status-grid {
    grid-template-columns: 1fr;
  }

  .update-actions,
  .update-actions form,
  .update-actions .button {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .admin-launch-grid {
    grid-template-columns: 1fr;
  }

  .admin-launch-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .admin-launch-card .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .admin-section-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-tenant-card,
  .provider-department-admin .provider-department-form {
    grid-template-columns: 1fr;
  }

  .provider-department-admin .provider-department-form .button {
    grid-column: 1;
    width: 100%;
  }
}

/* Shared AcoEMR branding */
.topbar.app-tabs {
  min-height: 58px;
}

.brand-logo {
  display: block;
  width: auto;
  height: 36px;
  max-width: 180px;
  object-fit: contain;
}

.login-panel {
  width: min(600px, 100%);
  padding: clamp(36px, 5vw, 56px);
  border-radius: 14px;
}

.login-logo {
  display: block;
  width: min(390px, 86%);
  height: auto;
  margin: 0 auto 42px;
  object-fit: contain;
}

.microsoft-sign-in-button {
  min-height: 54px;
  padding: 15px 22px;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .topbar.app-tabs {
    min-height: 52px;
  }

  .brand-logo {
    height: 32px;
    max-width: 150px;
  }

  .login-panel {
    padding: 34px 24px;
  }

  .login-logo {
    width: min(330px, 90%);
    margin-bottom: 32px;
  }
}
