:root {
  --bg: #f5f7f7;
  --surface: #ffffff;
  --surface-soft: #edf3f3;
  --text: #17292e;
  --muted: #64777c;
  --line: #d7e0e2;
  --primary: #326b73;
  --primary-dark: #23535a;
  --primary-soft: #e1eeee;
  --danger: #a64646;
  --warning: #8a632a;
  --warning-soft: #fbf5e7;
  --success: #2f7654;
  --radius: 10px;
  --sidebar: 242px;
  --shadow: 0 10px 30px rgba(23, 41, 46, .06);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(50, 107, 115, .25); outline-offset: 2px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  background: #edf2f3;
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.brand strong { display: block; font-size: 14px; font-weight: 650; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.sidebar-logo {
  width: 72px;
  max-height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: left center;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-family: Georgia, serif;
  font-size: 19px;
}
.brand-mark.large { width: 52px; height: 52px; font-size: 27px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 7px;
  color: #31474c;
  font-weight: 520;
}
.sidebar nav a:hover { background: rgba(255,255,255,.7); text-decoration: none; }
.sidebar nav a[aria-current="page"] { background: var(--surface); color: var(--primary-dark); box-shadow: 0 1px 4px rgba(23,41,46,.08); }
.sidebar-footer { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.privacy-lock { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.privacy-lock span { color: var(--success); margin-right: 5px; }
.link-button { border: 0; padding: 5px 0; background: transparent; color: var(--primary-dark); cursor: pointer; }
.mobile-menu { display: none; }

main { margin-left: var(--sidebar); min-height: 100vh; }
.page { width: min(1280px, calc(100% - 56px)); margin: 0 auto; padding: 38px 0 72px; }
.page.narrow { width: min(840px, calc(100% - 56px)); }
.page.form-page { width: min(1040px, calc(100% - 56px)); }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-header h1 { margin-bottom: 5px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
h1, h2, h3 { line-height: 1.2; }
h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.025em; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
h3 { margin: 0; font-size: 15px; }
p { margin-top: 0; }
.muted { color: var(--muted); }
.prose { white-space: normal; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 30px !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 620;
  cursor: pointer;
}
.button:hover { border-color: #afc2c5; text-decoration: none; }
.button.primary { border-color: var(--primary); background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.danger { border-color: #c87979; color: var(--danger); background: #fffafa; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.full { width: 100%; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.button-row form { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
.stat { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat span { display: block; color: var(--muted); margin-bottom: 7px; }
.stat strong { display: block; font-size: 31px; font-weight: 560; line-height: 1; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 32px; margin-bottom: 36px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 13px; }
.section-heading > span { color: var(--muted); font-size: 13px; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: #f8fafa; font-size: 12px; font-weight: 650; letter-spacing: .02em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfc; }
td.actions { text-align: right; white-space: nowrap; }
.bar-list { display: grid; gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.bar-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.bar-track { height: 7px; overflow: hidden; border-radius: 99px; background: #dfe8e9; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.clinic-calendar-section { margin-top: 42px; }
.calendar-heading { align-items: flex-end; }
.calendar-heading span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.calendar-navigation { display: flex; align-items: center; gap: 10px; }
.calendar-navigation strong { min-width: 145px; text-align: center; text-transform: capitalize; }
.clinic-calendar {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.calendar-weekdays,
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  min-width: 924px;
}
.calendar-weekdays { background: #f5f8f8; border-bottom: 1px solid var(--line); }
.calendar-weekdays span {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.calendar-day {
  min-height: 150px;
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.calendar-week:last-child .calendar-day { border-bottom: 0; }
.calendar-day:last-child { border-right: 0; }
.calendar-day.outside-month { background: #fafbfb; opacity: .52; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-day-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.calendar-day-header time { font-size: 13px; font-weight: 700; }
.calendar-day-header button {
  display: grid;
  width: 25px;
  height: 25px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--primary-dark);
  cursor: pointer;
}
.calendar-location {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  padding: 7px;
  border-left: 3px solid var(--primary);
  border-radius: 5px;
  background: #f2f7f7;
}
.calendar-location > div { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.calendar-location strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.calendar-location > div a { font-size: 10px; }
.calendar-patient { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.calendar-empty { color: var(--muted); font-size: 10px; }
.calendar-add-form {
  display: grid;
  grid-template-columns: minmax(210px, .7fr) minmax(170px, .4fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 16px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.calendar-add-form h3,
.calendar-add-form p { margin-bottom: 4px; }
.calendar-add-form .field { margin: 0; }
.inherited-history-notice { margin-top: 18px !important; }

.filter-row { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.filter-row .search { flex: 1 1 320px; }
.control {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #bdcbce;
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}
textarea.control { resize: vertical; min-height: 80px; line-height: 1.45; }
.control:focus { border-color: var(--primary); outline: 3px solid rgba(50,107,115,.12); }
.select { padding-right: 32px; }
.field { min-width: 0; margin-bottom: 17px; }
.inline-action { display: inline-block; margin: -10px 0 17px; font-size: 13px; font-weight: 650; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
.field small { display: block; color: var(--muted); margin-top: 4px; }
.field-error, .errorlist { color: var(--danger); font-size: 13px; margin: 5px 0 0; }
.has-error .control { border-color: var(--danger); }
.checkbox { width: 19px; height: 19px; accent-color: var(--primary); vertical-align: middle; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.compact { grid-template-columns: repeat(2, minmax(150px, 230px)); }
.clinical-form { margin: 0; }
.form-section {
  margin: 0 0 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
details.form-section { padding: 0; }
details.form-section > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 19px 22px;
  cursor: pointer;
  list-style: none;
}
details.form-section > summary::-webkit-details-marker { display: none; }
details.form-section > summary span { font-size: 18px; font-weight: 650; }
details.form-section > summary small { color: var(--muted); }
details.form-section[open] > summary { border-bottom: 1px solid var(--line); }
details.form-section[open] > :not(summary) { margin-left: 22px; margin-right: 22px; }
details.form-section[open] > .field:first-of-type,
details.form-section[open] > .form-grid:first-of-type { margin-top: 20px; }
.surgery-section { border-left: 4px solid var(--primary); }
.infiltration-section { border-left: 4px solid #668c7e; }
.consent-helper {
  padding: 14px 15px;
  margin: 0 22px 20px !important;
  border-radius: 8px;
  background: #edf5f1;
  color: #2d5448;
}
.consent-helper p { margin: 4px 0 12px; }
.template-tool {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  padding: 14px;
  margin: -8px 0 18px;
  border: 1px solid #cddddd;
  border-radius: 8px;
  background: #f7fafa;
}
.template-tool label { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 650; }
.template-tool > small { grid-column: 1 / -1; }
.inline-save { display: flex; gap: 8px; }
.inline-save .control { flex: 1; }
.template-success { color: var(--success); }
.template-error { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; }
.sticky-actions {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.sticky-actions span { color: var(--muted); font-size: 13px; }
.sticky-actions span.dirty { color: var(--warning); font-weight: 650; }

.detail-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 28px; margin-bottom: 32px; }
.detail-grid > section { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.detail-grid > section h2 { margin-bottom: 17px; }
.details { display: grid; grid-template-columns: minmax(110px, .6fr) minmax(0, 1.4fr); gap: 10px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; margin: 0 0 28px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; color: var(--text); font-weight: 620; }
.tabs a span { color: var(--muted); font-size: 12px; }
.timeline { display: grid; margin-bottom: 36px; }
.timeline article { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.timeline time { color: var(--muted); }
.timeline h3 { margin: 7px 0 4px; }
.timeline p { color: var(--muted); margin: 0; }
.clinical-note-form {
  display: grid;
  grid-template-columns: minmax(190px, .7fr) minmax(150px, .35fr) minmax(280px, 1.4fr) auto;
  align-items: end;
  gap: 16px;
  margin: 8px 0 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.clinical-note-form h3 { margin: 0 0 5px; }
.clinical-note-form p { margin: 0; }
.clinical-note-form .field { margin: 0; }
.private-note-badge { background: #eee9f8; color: #57467b; }
.timeline .clinical-note-content { margin-top: 9px; color: var(--text); white-space: normal; }
.signature-image-preview {
  display: grid;
  gap: 8px;
  width: min(100%, 380px);
  margin: 12px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}
.signature-image-preview img {
  display: block;
  max-width: 100%;
  max-height: 130px;
  object-fit: contain;
  object-position: left center;
}
.badge, .status { display: inline-flex; align-items: center; width: fit-content; padding: 3px 8px; border-radius: 99px; background: var(--surface-soft); color: #38585e; font-size: 12px; font-weight: 650; white-space: nowrap; }
.status-indicated { background: #eef1f2; color: #52656a; }
.status-waitlist { background: #fff4d8; color: #7a5a18; }
.status-prehospitalized { background: #e8eef8; color: #385d8a; }
.status-operating_room { background: #e6f3eb; color: var(--success); }
.preop-result { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.preop-result::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.preop-green { background: #e1f3e7; color: #267049; }
.preop-yellow { background: #fff4cf; color: #846315; }
.preop-blue { background: #e4effb; color: #2d6492; }
.preop-red { background: #f7e3e3; color: #a33e3e; }

.clinical-summary { display: grid; gap: 14px; }
.clinical-summary article { padding: 21px 23px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.clinical-summary h2 { margin-bottom: 12px; color: var(--primary-dark); }
.clinical-summary h3 { margin: 13px 0 5px; color: var(--muted); }
.clinical-summary p { margin-bottom: 0; white-space: normal; }
.clinical-summary .metric-line { margin-top: 12px; color: var(--muted); font-weight: 650; }
.clinical-summary .surgery-callout { border-left: 4px solid var(--primary); background: #f9fcfc; }
.clinical-summary .consent-callout { border-left: 4px solid #668c7e; background: #f7fbf9; }

.surgery-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.event-list { display: grid; border-left: 2px solid var(--line); margin-left: 8px; padding-left: 22px; }
.event-list article { position: relative; display: grid; grid-template-columns: 150px 1fr; gap: 18px; padding: 4px 0 24px; }
.event-list article::before { content: ""; position: absolute; left: -29px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--bg); }
.event-list time, .event-list span { color: var(--muted); }
.event-list p { margin: 4px 0 0; }

.report-page { width: min(1180px, calc(100% - 56px)); }
.report-frame { width: 100%; height: 1080px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 28px; margin-bottom: 38px; }
.settings-grid > section { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-grid h2 { margin-bottom: 18px; }
.settings-section { margin-bottom: 38px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.location-settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .5fr); gap: 24px; align-items: start; }
.location-create-form { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafa; }
.location-create-form h3 { margin-bottom: 17px; }
.logo-preview { display: grid; place-items: center; min-height: 100px; margin-bottom: 18px; padding: 15px; border: 1px dashed #afc2c5; border-radius: 8px; background: #fafcfc; }
.logo-preview img { max-width: 100%; max-height: 80px; object-fit: contain; }
.empty-state-action { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.empty-state-action p { margin: 3px 0 0; }
.operating-sessions { margin-top: 42px; }
.session-list { display: grid; gap: 11px; }
.session-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.session-date { display: grid; place-items: center; padding: 8px 4px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); text-align: center; }
.session-date strong { font-size: 25px; line-height: 1; }
.session-date span { margin-top: 4px; font-size: 11px; text-transform: uppercase; }
.session-card h3 { margin: 3px 0 6px; }
.session-card p { margin-bottom: 8px; }
.session-patients { display: grid; gap: 4px; font-size: 13px; }
.danger-zone { max-width: 620px; margin: 34px 0; padding: 20px; border: 1px solid #ebcccc; border-radius: var(--radius); background: #fffafa; }
.danger-zone h2 { color: var(--danger); margin-bottom: 7px; }
.revenue-panel { margin-bottom: 34px; padding: 22px; border: 1px solid #cad8d9; border-radius: var(--radius); background: linear-gradient(145deg, #f8fbfb, #edf4f4); box-shadow: var(--shadow); }
.revenue-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 12px 0 20px; border-bottom: 1px solid var(--line); }
.revenue-total span { color: var(--muted); }
.revenue-total strong { font-size: 32px; line-height: 1; }
.revenue-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding-top: 20px; }
.revenue-grid h3 { margin-bottom: 12px; }
.revenue-breakdown { display: grid; gap: 9px; }
.revenue-breakdown > div { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding-bottom: 8px; border-bottom: 1px solid rgba(215,224,226,.75); }
.revenue-breakdown small { color: var(--muted); }
.sensitive-value { filter: blur(8px); user-select: none; transition: filter .18s ease; }
.revenue-panel.revealed .sensitive-value,
body.revenue-revealed .sensitive-value { filter: none; user-select: text; }
.revenue-inline-form { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.money-input { display: flex; align-items: center; width: 105px; border: 1px solid #bdcbce; border-radius: 7px; background: white; overflow: hidden; }
.money-input span { padding-left: 8px; color: var(--muted); }
.money-input input { width: 100%; min-width: 0; padding: 7px 7px 7px 4px; border: 0; outline: 0; background: transparent; }
.compact-button { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.clinic-statistics { margin: 0 0 36px; }
.statistic-note { margin-top: 9px; font-size: 12px; }
.notice { padding: 13px 15px; margin: 0 0 20px; border-left: 3px solid var(--primary); background: var(--primary-soft); color: #315158; }
.notice.warning { border-left-color: var(--warning); background: var(--warning-soft); color: #684c25; }

.messages { position: fixed; z-index: 50; top: 15px; right: 18px; width: min(390px, calc(100vw - 36px)); display: grid; gap: 8px; }
.message { padding: 12px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.message.success { border-left: 4px solid var(--success); }
.message.error { border-left: 4px solid var(--danger); }
.message.info { border-left: 4px solid var(--primary); }

.auth-main { margin-left: 0; display: grid; min-height: 100vh; place-items: center; padding: 30px 18px; }
.auth-shell { width: min(440px, 100%); text-align: center; }
.auth-brand { margin-bottom: 22px; }
.auth-brand .brand-mark { margin-bottom: 10px; }
.auth-brand p { color: var(--muted); }
.auth-card { padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.auth-card.wide { width: min(560px, 100vw - 36px); margin-left: 50%; transform: translateX(-50%); }
.auth-card h1 { font-size: 29px; margin-bottom: 9px; }
.auth-note { color: var(--muted); font-size: 12px; margin-top: 18px; }
.stack { display: grid; gap: 3px; }
.setup-steps { color: var(--muted); padding-left: 20px; }
.qr-code { display: grid; place-items: center; padding: 12px; margin: 14px 0; background: white; }
.qr-code svg { width: 210px; height: 210px; max-width: 100%; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 20px 0; }
.recovery-grid code { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-align: center; }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 35px rgba(23,41,46,.15); }
  main { margin-left: 0; }
  .mobile-menu { position: fixed; z-index: 30; top: 12px; left: 12px; display: grid; gap: 4px; width: 42px; height: 42px; place-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
  .mobile-menu span { display: block; width: 18px; height: 2px; background: var(--text); }
  .page { padding-top: 72px; }
  .dashboard-grid, .settings-grid, .location-settings-grid, .revenue-grid { grid-template-columns: 1fr; }
  .calendar-add-form { grid-template-columns: 1fr 1fr; }
  .calendar-add-form > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .page, .page.narrow, .page.form-page, .report-page { width: min(100% - 28px, 100%); padding-bottom: 50px; }
  .page-header { align-items: stretch; flex-direction: column; }
  .page-header .button-row { width: 100%; }
  .page-header .button-row > * { flex: 1; }
  .stats { grid-template-columns: 1fr; }
  .stat { display: flex; align-items: center; justify-content: space-between; }
  .stat span { margin: 0; }
  .detail-grid, .surgery-detail { grid-template-columns: 1fr; gap: 14px; }
  .form-grid, .form-grid.two { grid-template-columns: 1fr; }
  .template-tool { grid-template-columns: 1fr; }
  .template-tool > small { grid-column: auto; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .empty-state-action { align-items: stretch; flex-direction: column; }
  .filter-row .search { flex-basis: auto; }
  .timeline article { grid-template-columns: 84px minmax(0, 1fr); }
  .clinical-note-form { grid-template-columns: 1fr; align-items: stretch; }
  .session-card { grid-template-columns: 54px minmax(0, 1fr); }
  .session-card > .status { grid-column: 2; }
  .timeline article > a { grid-column: 2; }
  .tabs { overflow-x: auto; }
  details.form-section > summary { align-items: flex-start; flex-direction: column; gap: 4px; }
  .sticky-actions { bottom: 8px; }
  .sticky-actions span { display: none; }
  .sticky-actions .button { width: 100%; }
  .report-frame { height: 760px; }
  .calendar-heading { align-items: stretch; flex-direction: column; }
  .calendar-navigation { justify-content: space-between; width: 100%; }
  .calendar-add-form { grid-template-columns: 1fr; }
  .calendar-add-form > div:first-child { grid-column: auto; }
}

@media (max-width: 420px) {
  body { font-size: 14px; }
  .form-grid.compact { grid-template-columns: 1fr; }
  .button-row { align-items: stretch; flex-direction: column; }
  .button-row > *, .button-row .button { width: 100%; }
  .recovery-grid { grid-template-columns: 1fr; }
  th, td { padding: 10px 11px; }
}

@media print {
  .sidebar, .mobile-menu, .page-header, .messages { display: none !important; }
  main { margin: 0; }
  .page { width: 100%; padding: 0; }
}
