:root {
  --ink: #142d2a;
  --muted: #6d7d7a;
  --paper: #f4f6f2;
  --white: #fff;
  --green: #174d43;
  --lime: #d8ed9c;
  --line: #dfe5df;
  --danger: #a84040;
  --shadow: 0 16px 45px rgba(24, 59, 51, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Manrope, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button, input, select, textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 252px;
  padding: 26px 18px;
  background: #123b35;
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
  border-bottom: 1px solid #ffffff1f;
  font-size: 20px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--lime);
  color: var(--green);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand div:last-child {
  display: flex;
  gap: 5px;
}

.brand span {
  font-weight: 400;
  color: #b7cdc7;
}

.context {
  margin: 22px 4px 14px;
  padding: 14px;
  border-radius: 12px;
  background: #ffffff0c;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.context-label, .nav-caption, .eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  color: #8ca6a0;
}

.context strong {
  font-size: 13px;
}

.status {
  font-size: 11px;
  color: #b7cdc7;
}

.status i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9ef72;
  margin-right: 5px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #c6d7d3;
  padding: 11px 13px;
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  gap: 11px;
}

.nav-item span {
  width: 18px;
  text-align: center;
}

.nav-item:hover, .nav-item.active {
  color: #fff;
  background: #ffffff14;
}

.nav-item.active {
  box-shadow: inset 3px 0 var(--lime);
}

.nav-caption {
  margin: 19px 13px 6px;
}

.api-link {
  margin-top: auto;
  border: 1px solid #ffffff24;
  border-radius: 10px;
  padding: 12px;
  color: #d9e5e2;
  text-decoration: none;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
}

.api-link span:first-child {
  color: var(--lime);
  font-weight: 800;
}

main {
  margin-left: 252px;
  min-height: 100vh;
}

.topbar {
  height: 94px;
  padding: 0 38px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 21px;
  margin: 3px 0 0;
}

.eyebrow {
  margin: 0;
  color: #7a918b;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 38px;
  height: 38px;
  background: #e9eee9;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.button {
  border: 0;
  border-radius: 9px;
  padding: 11px 17px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.button:disabled {
  opacity: .55;
  cursor: wait;
}

.button-secondary {
  background: #eef2ed;
  color: var(--green);
}

.button-primary {
  background: var(--green);
  color: #fff;
}

.button-light {
  background: #fff;
  color: var(--green);
  align-self: flex-end;
}

.full {
  width: 100%;
}

.mobile-menu {
  display: none;
}

.tab-panel {
  display: none;
  padding: 32px 38px 60px;
  max-width: 1500px;
  margin: auto;
}

.tab-panel.active {
  display: block;
}

.hero {
  min-height: 240px;
  border-radius: 18px;
  background: linear-gradient(115deg, #174d43, #236658);
  padding: 36px 42px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.hero:after {
  content: "";
  position: absolute;
  width: 330px;
  height: 330px;
  border: 65px solid #ffffff09;
  border-radius: 50%;
  right: 9%;
  top: -110px;
}

.hero h2 {
  font-size: 34px;
  line-height: 1.2;
  margin: 16px 0 12px;
  letter-spacing: -.04em;
}

.hero p {
  max-width: 600px;
  color: #cfe0db;
  font-size: 13px;
}

.pill {
  padding: 6px 10px;
  border: 1px solid #ffffff35;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: .12em;
}

.hero .button {
  position: relative;
  z-index: 2;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.stat-card {
  background: #fff;
  padding: 20px;
  border-radius: 13px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.stat-card span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--muted);
}

.stat-card strong {
  font-size: 28px;
  margin: 8px 0 1px;
}

.stat-card small {
  font-size: 10px;
  color: #8c9996;
}

.stat-card.accent {
  background: #e6f1c9;
  border-color: #d6e8a7;
}

.stat-card.accent strong {
  font-size: 14px;
  margin-top: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.panel, .form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 1px #1c3c3410;
}

.panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel h3, .form-card h3 {
  margin: 4px 0 0;
  font-size: 16px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.empty-state {
  padding: 35px;
  text-align: center;
  color: #8b9996;
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.sync-summary {
  display: grid;
  gap: 9px;
}

.sync-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #edf0ed;
  font-size: 12px;
}

.sync-row strong {
  color: var(--green);
}

.section-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-intro h2 {
  font-size: 26px;
  margin: 6px 0 7px;
  letter-spacing: -.03em;
}

.section-intro p:last-child {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.steps {
  display: flex;
  align-items: center;
}

.steps button {
  border: 0;
  background: transparent;
  color: #82918e;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 0;
  cursor: pointer;
}

.steps button span {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #e4e9e4;
  color: #82918e;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
}

.steps button small {
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.steps button.active span,
.steps button.complete span {
  background: var(--green);
  color: #fff;
}

.steps button.active small {
  color: var(--green);
}

.steps i {
  width: 38px;
  height: 1px;
  background: #d9dfd9;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.form-layout > div {
  display: grid;
  gap: 16px;
}

.ipom-step-panel {
  display: grid;
  gap: 16px;
}

.ipom-step-panel[hidden] {
  display: none;
}

.ipom-step-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 4px 0 20px;
}

.ipom-step-actions span {
  margin-right: auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.form-card {
  padding: 24px;
}

.form-card-title {
  display: flex;
  gap: 13px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e7ebe7;
}

.form-card-title > span {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eaf1d5;
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.form-card-title p {
  margin: 3px 0 0;
  font-size: 10px;
  color: var(--muted);
}

.fields {
  display: grid;
  gap: 15px;
}

.fields.columns-3 {
  grid-template-columns: repeat(3, 1fr);
}

.fields.columns-2 {
  grid-template-columns: repeat(2, 1fr);
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

label {
  font-size: 10px;
  font-weight: 700;
  color: #526660;
  display: grid;
  gap: 7px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #dce3dd;
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  font-size: 12px;
}

input:focus, select:focus, textarea:focus {
  border-color: #6d9c92;
  box-shadow: 0 0 0 3px #4e8c7d15;
}

textarea {
  resize: vertical;
}

.radio-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.radio-cards label {
  display: block;
}

.radio-cards input {
  position: absolute;
  opacity: 0;
  width: 0;
}

.radio-cards span {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 13px;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.radio-cards input:checked + span {
  background: #eff5df;
  border-color: #9bb86a;
}

.radio-cards small {
  color: #8da06b;
}

.repeat-list {
  display: grid;
  gap: 10px;
}

.repeat-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 9px;
  align-items: end;
}

.repeat-row.medication {
  grid-template-columns: 1.5fr 1fr 1fr auto;
}

.repeat-row.education {
  grid-template-columns: 1fr auto;
}

.repeat-row.diagnostic {
  grid-template-columns: minmax(120px, .55fr) 1.5fr auto;
}

.repeat-row.consultation {
  grid-template-columns: 1.4fr .7fr 1fr auto;
}

.compact-list,
.plan-subsection {
  margin-top: 16px;
}

.plan-subsection + .plan-subsection {
  padding-top: 18px;
  border-top: 1px solid #e7ebe7;
}

.plan-subsection h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 11px;
}

.dictionary-field { position: relative; }
.dictionary-help { color: var(--muted); font-size: 8px; font-weight: 500; line-height: 1.35; }
input.dictionary-autofilled {
  border-color: #91aa69;
  background: #f3f7e9;
}
.dictionary-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #cfd9d2;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 28px #24453b26;
}
.dictionary-results button {
  display: grid;
  grid-template-columns: minmax(60px, auto) 1fr;
  gap: 3px 9px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #edf0ed;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.dictionary-results button:hover,
.dictionary-results button.active { background: #f1f5e7; }
.dictionary-results button strong { color: var(--green); font-size: 9px; }
.dictionary-results button span { font-size: 9px; font-weight: 600; }
.dictionary-results button small { grid-column: 1 / -1; color: var(--muted); font-size: 8px; }
.dictionary-message { display: block; padding: 10px 11px; color: var(--muted); font-size: 9px; }
.dictionary-message.error { color: var(--danger); }

.remove-button {
  height: 39px;
  width: 39px;
  border: 1px solid #eadede;
  background: #fff7f7;
  color: var(--danger);
  border-radius: 8px;
  cursor: pointer;
}

.add-button {
  margin-top: 12px;
  border: 1px dashed #9db0aa;
  border-radius: 8px;
  background: #f8faf7;
  color: var(--green);
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.sticky {
  position: sticky;
  top: 18px;
}

.document-note {
  background: #f1f5e7;
  border-radius: 9px;
  padding: 13px;
  margin: 19px 0;
}

.document-note strong {
  font-size: 11px;
}

.document-note p {
  font-size: 9px;
  line-height: 1.5;
  color: var(--muted);
  margin: 5px 0 0;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  padding: 15px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}

.table-search {
  max-width: 280px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th {
  text-align: left;
  padding: 11px 36px;
  background: #f8faf7;
  color: #6e817c;
  font-size: 9px;
  letter-spacing: .1em;
}

.data-table td {
  padding: 13px 20px;
  border-top: 1px solid #edf0ed;
  vertical-align: middle;
}

.data-table a {
  color: var(--green);
  font-weight: 700;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
}

.view-button {
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  background: #eaf1d5;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.link-button {
  display: inline-block;
  text-decoration: none;
}

.documentation-panel { margin-bottom: 28px; }
.documentation-panel .panel-heading { padding: 13px 20px 15px; margin: 0; }
.documentation-heading { margin: 13px 20px 14px; }
.documentation-heading h3 { margin: 5px 0 0; font-size: 17px; }
.documentation-panel .data-table { margin: 0 0 0; width: calc(100% + 44px); }

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.resource-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.resource-card header {
  padding: 17px 20px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.resource-card h3 {
  font-size: 14px;
  margin: 0;
}

.resource-card header span {
  font-size: 10px;
  background: #edf2ed;
  border-radius: 999px;
  padding: 4px 8px;
}

.resource-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.resource-actions button, .edit-button {
  border: 0;
  background: #edf2ed;
  color: var(--green);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.resource-items {
  max-height: 420px;
  overflow: auto;
}

.resource-item {
  padding: 13px 20px;
  border-bottom: 1px solid #edf0ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.resource-item strong {
  display: block;
  font-size: 11px;
}

.resource-item small {
  color: var(--muted);
  font-size: 9px;
}

.source-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 7px;
  margin-right: 4px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.source-badge.mydr { background: #dfece9; color: var(--green); }
.source-badge.local { background: #edf4d7; color: #617b31; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  z-index: 2147483647;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.error {
  background: var(--danger);
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: #0f2c2788;
  backdrop-filter: blur(2px);
}

.dialog-card {
  width: min(520px, calc(100vw - 30px));
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow);
}

.dialog-card h2 {
  margin: 7px 0;
}

.wide-dialog {
  width: min(680px, calc(100vw - 30px));
}

.wide-dialog .button.full {
  margin-top: 20px;
}

.ipom-preview-dialog {
  width: min(880px, calc(100vw - 30px));
  max-height: min(850px, calc(100vh - 30px));
  overflow: auto;
}

.ipom-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-right: 35px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.ipom-preview-header h2 {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.ipom-status {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf1d5;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
}

.ipom-preview-meta {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.ipom-preview-meta > div,
.ipom-preview-list > div {
  padding: 13px;
  border-radius: 9px;
  background: #f5f7f3;
}

.ipom-preview-meta span,
.ipom-preview-meta strong,
.ipom-preview-meta small,
.ipom-preview-list strong,
.ipom-preview-list span {
  display: block;
}

.ipom-preview-meta span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ipom-preview-meta strong { margin-top: 5px; font-size: 11px; }
.ipom-preview-meta small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.ipom-preview-section { padding: 17px 0; border-top: 1px solid var(--line); }
.ipom-preview-section h3 { margin: 0 0 10px; font-size: 13px; }
.ipom-preview-section p { margin: 0; color: #526660; font-size: 11px; line-height: 1.65; white-space: pre-wrap; }
.ipom-preview-section .muted { color: var(--muted); }
.ipom-preview-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.ipom-preview-list strong { color: var(--green); font-size: 10px; }
.ipom-preview-list span { margin-top: 4px; color: #526660; font-size: 10px; }
.ipom-preview-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 18px; border-top: 1px solid var(--line); }
.ipom-preview-actions .button { text-decoration: none; }
.ipom-version-history { display: grid; gap: 8px; }
.ipom-version-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfa;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.ipom-version-item.selected { border-color: #8eaa68; background: #f1f5e7; }
.ipom-version-item span { color: var(--green); font-size: 9px; font-weight: 700; }
.ipom-version-item small { grid-column: 1 / -1; color: var(--muted); font-size: 8px; }

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 16px;
}

.calendar-navigation, .calendar-filters {
  display: flex;
  align-items: end;
  gap: 9px;
}

.calendar-navigation strong {
  margin-left: 10px;
  min-width: 190px;
  font-size: 13px;
}

.clinical-date { width: 190px; }
.clinical-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 18px; align-items: start; }
.clinical-queue { position: sticky; top: 18px; padding: 18px; }
.clinical-visit-list { display: grid; gap: 7px; max-height: calc(100vh - 245px); overflow: auto; }
.clinical-visit-item {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 11px; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px;
  text-align: left; cursor: pointer; color: var(--ink);
}
.clinical-visit-item:hover, .clinical-visit-item.active { border-color: #a9c8a0; background: #f3f7e8; }
.clinical-visit-item time { font-size: 12px; font-weight: 800; color: var(--green); }
.clinical-visit-item span, .clinical-visit-item strong, .clinical-visit-item small { display: block; }
.clinical-visit-item strong { font-size: 10px; }
.clinical-visit-item small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.clinical-visit-item em { grid-column: 2; color: #6c7f79; font-size: 8px; font-style: normal; }
.clinical-workspace { min-width: 0; }
#clinical-visit-form:not([hidden]) { display: grid; gap: 16px; }
.clinical-patient-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.clinical-patient-header h2 { margin: 6px 0; font-size: 22px; }
.clinical-patient-header p:last-child { margin: 0; color: var(--muted); font-size: 10px; }
.clinical-state { flex: 0 0 auto; padding: 7px 11px; border-radius: 999px; background: #eaf1d5; color: var(--green); font-size: 9px; font-weight: 800; }
.clinical-vitals { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; margin-bottom: 16px; }
.clinical-actions {
  position: sticky; bottom: 12px; z-index: 3; display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fffffff2; box-shadow: var(--shadow);
}

.calendar-filters label {
  min-width: 190px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.calendar-day {
  min-height: 440px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.calendar-day > header {
  padding: 13px;
  background: #f8faf7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 9px;
}

.calendar-day > header strong { font-size: 17px; color: var(--ink); }
.calendar-day.today { border-color: #94b663; box-shadow: inset 0 3px #94b663; }
.calendar-events { display: grid; gap: 8px; padding: 8px; }
.calendar-events .empty-state { padding: 22px 8px; }

.calendar-event {
  background: #edf4df;
  border-left: 3px solid #7d9e48;
  border-radius: 7px;
  padding: 9px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.calendar-event time, .calendar-event strong, .calendar-event span, .calendar-event small { display: block; }
.calendar-event time { color: var(--green); font-size: 9px; font-weight: 800; }
.calendar-event strong { margin: 4px 0 2px; font-size: 10px; }
.calendar-event span, .calendar-event small { font-size: 8px; color: var(--muted); }
.calendar-event button { border: 0; background: transparent; color: var(--danger); cursor: pointer; align-self: start; }

.ewus-button {
  border: 1px solid #aac4bd;
  background: #edf5f2;
  color: var(--green);
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.ewus-button:disabled { opacity: .45; cursor: not-allowed; }
.ewus-patient { display: flex; justify-content: space-between; padding: 13px; margin: 14px 0; background: #f3f6ef; border-radius: 9px; font-size: 12px; }
.ewus-patient span { color: var(--muted); }
.ewus-actions { display: flex; justify-content: flex-end; gap: 9px; margin: 18px 0; }
.ewus-result { margin-top: 12px; }
.ewus-status { padding: 13px; border-radius: 9px; background: #eef2f1; }
.ewus-status strong, .ewus-status span { display: block; }
.ewus-status span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.ewus-status.insured { background: #e5f2dc; color: #315d2d; }
.ewus-status.not-insured { background: #f8e5e2; color: #8a352e; }
.ewus-history { display: grid; gap: 7px; margin-top: 12px; max-height: 220px; overflow: auto; }
.ewus-history > div { display: grid; grid-template-columns: 120px 1fr; gap: 8px; align-items: center; }
.ewus-history > div > span { color: var(--muted); font-size: 8px; }

.drug-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.drug-import-meta { display: grid; min-width: 110px; text-align: right; }
.drug-import-meta strong { font-size: 18px; color: var(--green); }
.drug-import-meta span, .drug-import-meta small { color: var(--muted); font-size: 8px; }
.drugs-data-table small { display: block; margin-top: 3px; color: var(--muted); }
.pagination { padding: 13px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; align-items: center; gap: 12px; font-size: 10px; }

.dialog-card > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.dialog-close {
  position: absolute;
  right: 16px;
  top: 12px;
  border: 0;
  background: transparent;
  font-size: 25px;
  color: #71827e;
  cursor: pointer;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 19px 0;
}

.check-grid label, .toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-grid input, .toggle-row input {
  width: auto;
}

.toggle-row {
  margin-bottom: 16px;
}

.recent-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid #edf0ed;
  font-size: 11px;
}

.recent-row span {
  color: var(--muted);
}

@media(max-width:1050px) {
  .sidebar {
    width: 215px;
  }

  .topbar, main {
    margin-left: 0;
  }

  main {
    margin-left: 215px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-layout {
    grid-template-columns: 1fr;
  }

  .form-sidebar .sticky {
    position: static;
  }

  .resource-grid {
    grid-template-columns: 1fr;
  }

  .clinical-layout { grid-template-columns: 1fr; }
  .clinical-queue { position: static; }
  .clinical-visit-list { max-height: 280px; }
  .clinical-vitals { grid-template-columns: repeat(3, 1fr); }

}

@media(max-width:760px) {
  .sidebar {
    transform: translateX(-100%);
    transition: .2s;
  }

  .sidebar.open {
    transform: none;
  }

  .mobile-menu {
    display: block;
    border: 0;
    background: transparent;
    font-size: 20px;
  }

  .topbar {
    height: 80px;
    padding: 0 18px;
  }

  .topbar .eyebrow, .topbar h1 {
    display: none;
  }

  main {
    margin-left: 0;
  }

  .tab-panel {
    padding: 22px 16px 50px;
  }

  .hero {
    padding: 28px;
    display: block;
  }

  .hero h2 {
    font-size: 27px;
  }

  .hero .button {
    margin-top: 20px;
  }

  .stat-grid, .content-grid, .fields.columns-3, .fields.columns-2, .resource-grid {
    grid-template-columns: 1fr;
  }

  .ipom-preview-meta, .ipom-preview-list {
    grid-template-columns: 1fr;
  }

  .ipom-preview-header {
    display: block;
  }

  .ipom-status {
    display: inline-block;
    margin-top: 8px;
  }

  .span-3 {
    grid-column: auto;
  }

  .span-2 {
    grid-column: auto;
  }

  .calendar-toolbar, .calendar-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .clinical-vitals { grid-template-columns: repeat(2, 1fr); }
  .clinical-actions { flex-direction: column; }
  .clinical-actions .button { width: 100%; }

  .drug-toolbar {
    grid-template-columns: 1fr;
  }

  .drug-import-meta {
    text-align: left;
  }

  .radio-cards {
    grid-template-columns: 1fr;
  }

  .repeat-row, .repeat-row.medication {
    grid-template-columns: 1fr 1fr;
  }

  .remove-button {
    grid-column: 2;
  }

  .section-intro {
    align-items: flex-start;
  }

  .steps {
    display: none;
  }

  .top-actions .button {
    font-size: 0;
  }

  .top-actions .button:after {
    content: "↻";
    font-size: 18px;
  }

  .data-table {
    min-width: 650px;
  }

  .table-panel {
    overflow: auto;
  }

}

.logo-container {
  display: flex;
  align-items: center;
}

.logo {
  display: block;
  width: 320px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 20px;
}
