:root {
  --accent: #087f78;
  --accent-hover: #066b65;
  --accent-soft: #e9f5f2;
  --ink: #1c302f;
  --text: #334744;
  --muted: #657671;
  --line: #e1e7e3;
  --line-strong: #bdcbc5;
  --surface: #ffffff;
  --canvas: #f5f7f4;
  --sidebar: #f1f5f1;
  --occupied: #e7ebe9;
  --danger: #a43f40;
  --danger-soft: #fbefee;
  --warning: #835e20;
  --radius: 12px;
  --sidebar-width: 208px;
  --motion: 150ms ease;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--text);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { transition: border-color var(--motion), background-color var(--motion), box-shadow var(--motion); }
button { border: 0; background: transparent; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid #3ca99d; outline-offset: 3px; }
button:active:not(:disabled) { filter: brightness(.97); }
input, select, textarea { max-width: 100%; min-width: 0; color: var(--ink); background: var(--surface); }
input, select { min-height: 44px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; padding: 10px 12px; }
input[type="date"] { font-variant-numeric: tabular-nums; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; min-height: 18px; }
input::placeholder, textarea::placeholder { color: #66776e; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: #91aaa0; }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
label { color: var(--text); }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { color: var(--ink); }
strong { font-weight: 600; }
small { font-size: 12px; }
svg { display: block; flex: 0 0 auto; }
[data-icon] { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; }
[data-icon] svg { width: 19px; height: 19px; }
[hidden] { display: none !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; }
.skip-link { position: fixed; z-index: 1000; top: -70px; left: 16px; padding: 12px 18px; border-radius: 8px; color: white; background: var(--accent); }
.skip-link:focus { top: 12px; }
.muted, .input-help { color: var(--muted); }
.input-help { font-size: 12px; line-height: 1.5; }
.mobile-menu, .mobile-back, .drawer-close { display: none; }

/* Quiet, persistent workspace navigation. */
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); background: var(--sidebar); border-right: 1px solid var(--line); padding: 28px 16px 16px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); margin: 0 0 44px; }
.brand:hover { text-decoration: none; }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.brand strong { display: block; font-size: 19px; letter-spacing: -.65px; line-height: 1.2; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .5px; }
.nav-caption { font-size: 9px; font-weight: 700; letter-spacing: 1.05px; margin: 0 10px 12px; color: #5b7164; }
#mainNav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 45px; width: 100%; padding: 10px 12px; border-radius: 8px; text-align: left; font-weight: 500; font-size: 13px; color: #586c63; }
.nav-item:hover { background: #e7eee8; color: var(--ink); }
.nav-item.active { background: #dfebe3; color: #08685e; font-weight: 650; }
.nav-item [data-icon] svg { width: 18px; height: 18px; }
.nav-count { margin-left: auto; min-width: 21px; padding: 0 5px; background: rgba(255,255,255,.65); border-radius: 5px; color: #64766c; text-align: center; font-size: 11px; line-height: 20px; }
.sidebar-note { margin-top: auto; padding: 24px 10px; font-size: 12px; color: #486154; }
.sidebar-note small { display: block; margin: 5px 0 0 14px; font-size: 10px; line-height: 1.7; color: var(--muted); }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #4f8871; margin: 0 8px 1px 0; }
.sidebar-bottom { display: flex; align-items: center; gap: 9px; padding: 16px 2px 0; border-top: 1px solid #dbe4db; }
.sidebar-bottom strong { display: block; font-size: 12px; }
.sidebar-bottom small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.avatar { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: #e1ece6; color: #3e6b57; font-size: 12px; font-weight: 650; }
.avatar-0 { background: #e6efe5; color: #456945; }
.avatar-1 { background: #e6edf3; color: #4d687d; }
.avatar-2 { background: #f2e9de; color: #8b6847; }
.avatar-3 { background: #eee7ef; color: #7a6080; }
.avatar-owner { width: 32px; height: 32px; background: #dfe9de; color: #436441; font-size: 12px; }

/* Main workspace. */
.main { margin-left: var(--sidebar-width); min-width: 0; padding: 0 28px; max-width: 1880px; }
.topbar { display: flex; align-items: center; gap: 16px; min-height: 64px; border-bottom: 1px solid var(--line); }
.breadcrumbs { font-size: 12px; color: #52685d; }
.breadcrumbs span { margin: 0 10px; color: #abb7b0; }
.prototype-badge { margin-left: auto; display: inline-flex; align-items: center; padding: 4px 9px; border: 1px solid #dce5dc; background: #edf2e9; border-radius: 5px; font-size: 10px; color: #5e715b; white-space: nowrap; }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 27px 0 22px; }
.eyebrow { font-size: 9px; font-weight: 700; letter-spacing: 1.6px; color: #5c7364; margin-bottom: 5px; }
h1 { font-size: 30px; font-weight: 650; letter-spacing: -1.05px; line-height: 1.2; }
.page-heading p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); font-size: 12px; font-weight: 600; text-align: center; line-height: 1.35; white-space: nowrap; }
.button:hover:not(:disabled) { border-color: #8fa99a; background: #f4f7f3; }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 1px 1px #003e3210; }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.secondary { border-color: #b8cfc5; color: var(--accent); background: #f9fcfa; }
.button.quiet { border-color: transparent; color: #576f60; background: transparent; }
.button.quiet:hover:not(:disabled) { background: #e8eee7; border-color: transparent; }
.button.danger { color: var(--danger); background: var(--danger-soft); border-color: #edc9c5; }
.button.danger:hover:not(:disabled) { background: #f8e1de; border-color: #dba8a4; }
.button.small { min-height: 36px; padding: 7px 10px; font-size: 11px; }
.icon-btn { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #5c7165; }
.icon-btn:hover:not(:disabled) { background: #e9efea; color: var(--accent); }
.icon-btn.mobile-menu, .icon-btn.drawer-close { display: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 60px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.date-navigation { display: flex; align-items: center; gap: 2px; }
.date-control { display: block; width: 158px; }
.date-control input { min-height: 38px !important; border: 0 !important; padding: 8px !important; background: transparent; font-size: 13px; font-weight: 600; }
.date-navigation .button { min-height: 38px; font-size: 11px; padding: 8px 10px; }
.doctor-filter { display: flex; align-items: center; gap: 8px; margin-left: auto; padding-left: 10px; color: var(--muted); }
.doctor-filter select { border: 0; padding: 8px 22px 8px 0; min-height: 38px; background: transparent; max-width: 230px; font-size: 12px; }
.view-switch { display: inline-flex; padding: 3px; background: #e9eeea; border: 1px solid #e1e7df; border-radius: 7px; }
.view-switch button { min-height: 32px; padding: 5px 12px; font-size: 11px; color: #66796c; border-radius: 5px; }
.view-switch button[aria-pressed="true"], .view-switch button.active { background: white; color: var(--ink); box-shadow: 0 1px 3px #273a2c14; font-weight: 600; }
.daily-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px; min-height: 53px; color: var(--muted); font-size: 11px; padding: 12px 0; }
.daily-strip strong { color: var(--ink); margin-right: 5px; font-size: 14px; }
.daily-strip > span { display: inline-flex; align-items: center; gap: 5px; }
.daily-strip .strip-separator { width: 1px; height: 14px; background: #d6e0d7; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 20px; align-items: start; padding-bottom: 20px; }
.calendar-card, .visit-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 3px #142f2003; overflow: hidden; }
.calendar-heading-controls { display: flex; align-items: center; gap: 10px; }
.overview-mode .day-back { display: none; }
.calendar-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; }
.calendar-card-heading h2 { font-size: 16px; font-weight: 650; letter-spacing: -.3px; }
.calendar-card-heading p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.step-label { flex: 0 0 auto; font-size: 10px; font-weight: 600; color: #65766b; border: 1px solid var(--line); border-radius: 5px; padding: 4px 7px; background: #fafbf8; }
.doctor-heading { display: flex; align-items: center; gap: 10px; padding: 0 22px 16px; }
.doctor-heading strong { display: block; font-size: 13px; }
.doctor-heading p, .doctor-heading small { display: block; color: var(--muted); font-size: 11px; }
.doctor-heading .avatar { width: 35px; height: 35px; font-size: 11px; }
.slots-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 0 22px 20px; }
.slot { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; min-width: 0; min-height: 65px; padding: 10px 11px; border: 1px solid #cfdcd5; border-radius: 7px; background: #fff; text-align: left; color: #4c695b; }
.slot:hover:not(:disabled) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fbfefd; }
.slot.free { background: #fff; }
.slot.booked { background: var(--occupied); color: #48564f; border-color: #d2d9d5; }
.slot.booked:hover:not(:disabled) { background: #dee6e1; }
.slot.blocked { background: repeating-linear-gradient(135deg, #f3f5f3, #f3f5f3 5px, #e9ede9 5px, #e9ede9 6px); border-color: #e1e6e2; color: #7b8980; opacity: 1; cursor: not-allowed; }
.slot.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); position: relative; }
.slot.selected::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); position: absolute; right: 8px; top: 9px; }
.slot-time { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 650; line-height: 1.2; }
.slot-caption, .slot-status { display: block; max-width: 100%; font-size: 9px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-status { font-size: 8px; }
.calendar-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; padding: 0 22px 20px; font-size: 10px; color: #627569; }
.calendar-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-square { display: inline-block; width: 10px; height: 10px; border: 1px solid #cbd6ce; border-radius: 2px; background: white; }
.legend-square.booked { background: var(--occupied); }
.legend-square.blocked { background: repeating-linear-gradient(135deg, #f3f5f3, #f3f5f3 3px, #d4dfd6 3px, #d4dfd6 4px); }
.overview-wrap { max-width: 100%; overflow-x: auto; padding: 0 0 16px; scrollbar-width: thin; scrollbar-color: #bfcfc2 #f2f6f2; }
.overview-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; table-layout: fixed; min-width: 550px; }
.overview-table th { font-weight: 500; text-align: center; padding: 8px 4px 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.overview-table th:first-child { width: 168px; text-align: left; padding-left: 20px; }
.overview-table th strong { display: block; font-size: 14px; color: var(--ink); font-weight: 600; }
.overview-table th small { font-size: 9px; }
.overview-table td { padding: 7px 4px; border-bottom: 1px solid #edf0ec; border-right: 1px solid #edf0ec; vertical-align: middle; }
.overview-table tr:last-child td { border-bottom: 0; }
.overview-table td:first-child { padding-left: 20px; border-right: 0; }
.overview-table td:first-child .avatar { width: 28px; height: 28px; font-size: 9px; }
.overview-table .doctor-heading { padding: 0; gap: 8px; }
.overview-table .doctor-heading strong { font-size: 11px; line-height: 1.4; }
.overview-table .doctor-heading small { font-size: 9px; }
.overview-cell, .overview-day { width: 100%; min-height: 50px; border: 1px solid transparent; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #65786b; }
.overview-cell:hover, .overview-day:hover { background: #edf5ef; border-color: #c0d6c6; }
.overview-cell.selected, .overview-day.selected { background: var(--accent-soft); border-color: #84b6a5; }
.overview-cell strong, .day-count { color: #3e6952; font-size: 15px; font-weight: 650; }
.overview-cell small { font-size: 9px; }
.overview-cell.busy, .overview-day.busy { background: #edf0ed; }
.upcoming-section { border-top: 1px solid var(--line); padding: 18px 22px 10px; }
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.section-heading h3 { font-size: 13px; font-weight: 650; }
.section-heading > span { font-size: 10px; }
.search-box { display: flex; gap: 9px; align-items: center; width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; color: #65776a; background: #fbfcfa; margin-bottom: 9px; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px #087f7814; }
.search-box input { min-height: 39px; padding: 8px 0 !important; background: transparent; border: 0 !important; font-size: 11px; box-shadow: none !important; outline: 0; }
.search-box input:focus-visible { outline: 0; }
.search-box [data-icon] svg { width: 15px; height: 15px; }
.appointment-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; border-bottom: 1px solid #edf0ec; border-radius: 0; padding: 10px 0; text-align: left; }
.appointment-row:last-child { border-bottom: 0; }
.appointment-row:hover { background: #f7faf7; }
.appointment-row.selected { background: #eff7f1; box-shadow: inset 3px 0 var(--accent); padding-left: 10px; padding-right: 8px; border-radius: 6px; border-bottom-color: transparent; }
.appointment-time { flex: 0 0 43px; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); }
.appointment-patient, .appointment-details { min-width: 0; flex: 1; }
.appointment-patient strong, .appointment-details strong { display: block; font-size: 12px; font-weight: 600; color: var(--ink); }
.appointment-patient small, .appointment-details small, .appointment-details p { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.row-status { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; padding: 3px 6px; color: #596b60; background: #eef1ee; font-size: 9px; line-height: 1.4; font-weight: 500; white-space: nowrap; }
.badge-booked { color: #596b60; background: #edf0ed; }
.badge-arrived { color: #087467; background: #e2f3ed; }
.badge-in_progress { color: #87651b; background: #faf0d4; }
.badge-completed { color: #526c9a; background: #e9eff8; }
.badge-cancelled, .badge-no_show { color: #926561; background: #f6eae7; }
.badge-paid { color: #34735c; background: #e6f3e9; }
.badge-partial { color: #896720; background: #faf0d6; }
.badge-unpaid { color: #62665b; background: #f2f0e8; }
.badge-overpaid { color: #8d6043; background: #f5e9dd; }

/* Visit: a single working panel, not a separate page per step. */
.visit-panel { position: sticky; top: 20px; }
.visit-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 49px; padding: 13px 20px; border-bottom: 1px solid var(--line); color: #68796e; font-size: 10px; }
.visit-topline > strong { color: #506556; font-size: 10px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; }
.visit-topline .icon-btn { width: 32px; height: 32px; margin: -7px -6px -7px 0; }
.visit-identity { display: flex; align-items: center; gap: 12px; padding: 19px 20px 14px; }
.visit-identity > div { min-width: 0; flex: 1; }
.visit-identity h2 { font-size: 19px; line-height: 1.35; letter-spacing: -.4px; font-weight: 650; margin-bottom: 5px; overflow-wrap: anywhere; }
.visit-identity .patient-id { font-size: 10px; color: #647565; letter-spacing: .4px; }
.visit-identity .badge { margin-top: 8px; margin-right: 4px; }
.visit-meta { display: grid; gap: 9px; margin: 0 0 12px; padding: 0 20px; color: #52685a; font-size: 11px; }
.visit-meta > span, .visit-meta > div, .visit-meta > a { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.visit-meta [data-icon] { color: #8a9b8d; padding-top: 1px; }
.visit-meta [data-icon] svg { width: 15px; height: 15px; }
.visit-meta strong { color: var(--ink); }
.visit-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 20px 17px; }
.visit-actions .button { flex: 1 0 auto; min-height: 38px; padding: 9px 10px; font-size: 11px; }
.visit-actions .button.quiet { flex-grow: 0; }
.visit-tabs { display: flex; padding: 0 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); gap: 9px; }
.visit-tabs button { position: relative; flex: 1; padding: 13px 3px; min-height: 44px; color: #5e7364; font-size: 11px; white-space: nowrap; }
.visit-tabs button.active, .visit-tabs button[aria-selected="true"] { color: var(--accent); font-weight: 650; }
.visit-tabs button.active::after, .visit-tabs button[aria-selected="true"]::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--accent); }
.visit-tabs button:hover { background: #f7faf6; }
.visit-body { padding: 19px 20px 21px; max-height: calc(100vh - 365px); min-height: 220px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #bfd0c2 #f7faf5; }
.visit-body h3 { font-size: 12px; margin-bottom: 12px; font-weight: 650; }
.visit-body .section-heading { margin-bottom: 12px; }
.visit-body .section-heading h3 { margin-bottom: 0; }
.visit-empty { display: flex; min-height: 390px; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 34px; color: var(--muted); }
.visit-empty [data-icon] { width: 56px; height: 56px; background: #eef4ed; border: 1px solid #e0e9de; border-radius: 13px; margin-bottom: 16px; color: #7b9783; }
.visit-empty [data-icon] svg { width: 25px; height: 25px; }
.visit-empty h2 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.visit-empty p { font-size: 12px; line-height: 1.7; max-width: 240px; }
.form-field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.form-field > label, .form-field > span:first-child, .field-label { display: block; color: #607367; font-size: 11px; font-weight: 500; }
.form-field input, .form-field select, .form-field textarea { font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.form-grid .full, .form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.form-actions .button { font-size: 11px; }
.field-error { color: var(--danger); font-size: 11px; line-height: 1.5; }
.form-field:has(.field-error:not(:empty)) input, .form-field:has(.field-error:not(:empty)) select, .form-field:has(.field-error:not(:empty)) textarea, [aria-invalid="true"] { border-color: #c36b66; }
.inline-error { padding: 11px 12px; border: 1px solid #ecc5c0; background: #fff4f1; border-radius: 7px; color: #993d39; font-size: 12px; margin-bottom: 14px; }
.inline-error:empty { display: none; }
.notice, .unsaved-notice { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 7px; background: #eef5ee; border: 1px solid #dce8dc; font-size: 11px; color: #61745b; line-height: 1.6; margin-bottom: 14px; }
.unsaved-notice { background: #fbf4e3; border-color: #ecdcb0; color: #8a6d32; }
.destructive { color: var(--danger) !important; }
.service-line { display: flex; align-items: flex-start; gap: 8px; padding: 12px 0; border-bottom: 1px solid #e9eee8; }
.service-line:first-child { padding-top: 0; }
.service-info { flex: 1; min-width: 0; }
.service-info strong { display: block; color: var(--ink); font-size: 12px; line-height: 1.5; font-weight: 500; }
.service-info small, .service-info p { display: block; color: var(--muted); margin-top: 4px; font-size: 10px; }
.service-price { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 1px; }
.service-line .icon-btn { width: 32px; height: 32px; margin-top: -6px; flex: 0 0 32px; }
.service-line .icon-btn [data-icon] svg { width: 15px; height: 15px; }
.service-line input[type="number"] { width: 55px; min-height: 32px; padding: 5px; font-size: 11px; text-align: center; }
.service-add { display: flex; gap: 7px; align-items: center; margin: 14px 0 18px; }
.service-add select { flex: 1; min-width: 0; font-size: 11px; padding: 9px 7px; }
.service-add .button { flex: 0 0 auto; padding: 9px; min-height: 44px; }
.totals-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 6px 0; color: #68786a; font-size: 12px; }
.totals-row strong { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals-row.total { margin-top: 7px; border-top: 1px solid #dce6dd; padding-top: 13px; color: var(--ink); font-weight: 600; }
.totals-row.total strong { font-size: 20px; letter-spacing: -.5px; color: var(--accent); }
.payment-methods { display: flex; gap: 6px; margin: 8px 0 15px; }
.payment-method { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 5px; min-height: 43px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 11px; color: #5b6d60; background: #fff; }
.payment-method:hover { background: #f3f8f2; border-color: #92b09a; }
.payment-method.active, .payment-method[aria-pressed="true"], .payment-method:has(input:checked) { background: var(--accent-soft); border-color: #6da99a; color: #076c61; box-shadow: inset 0 0 0 1px #087f7810; }
.payment-method input { accent-color: var(--accent); }
.payment-history { margin-top: 21px; padding-top: 17px; border-top: 1px solid var(--line); }
.payment-history h3 { margin-bottom: 8px; }
.payment-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid #edf0e9; font-size: 11px; }
.payment-item:last-child { border-bottom: 0; }
.payment-item strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.payment-item small { display: block; color: var(--muted); font-size: 9px; margin-top: 3px; }
.payment-item .button { min-height: 32px; padding: 6px 8px; font-size: 10px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-item { position: relative; padding: 0 0 19px 20px; border-left: 1px solid #dce7dc; margin-left: 4px; font-size: 11px; color: #556e5d; }
.history-item::before { content: ""; position: absolute; top: 3px; left: -4px; width: 7px; height: 7px; background: #8cad97; border-radius: 50%; border: 2px solid white; box-sizing: content-box; margin-left: -1px; }
.history-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.history-item strong { display: block; font-size: 11px; color: var(--ink); font-weight: 500; }
.history-item p { margin-top: 3px; line-height: 1.6; }
.history-item time, .history-item small { display: block; margin-top: 4px; color: #637464; font-size: 9px; }

/* Dialogs stay in the native top layer, with one clear primary action. */
.app-dialog { width: min(590px, calc(100vw - 40px)); max-width: calc(100vw - 40px); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid #d8e2d9; border-radius: 14px; box-shadow: 0 24px 90px #172a2340, 0 6px 24px #172a2317; background: #fff; color: var(--text); overflow: auto; scrollbar-width: thin; }
.app-dialog::backdrop { background: #17372d55; backdrop-filter: blur(3px); }
.compact-dialog { width: min(430px, calc(100vw - 40px)); }
.directory-dialog { width: min(720px, calc(100vw - 40px)); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: white; z-index: 2; }
.dialog-heading h2 { font-size: 19px; letter-spacing: -.45px; font-weight: 650; line-height: 1.4; }
.dialog-heading p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.dialog-heading .icon-btn { margin: -8px -9px -8px 0; }
.dialog-body { padding: 22px 24px; }
.dialog-body > p { font-size: 13px; line-height: 1.7; }
.dialog-body h3 { font-size: 13px; margin-bottom: 12px; }
.dialog-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fcfdfb; }
.dialog-footer .button { min-width: 100px; }
.patient-picker { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow-y: auto; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 7px; padding: 4px; }
.patient-option { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px; min-height: 49px; text-align: left; border-radius: 5px; padding: 8px 10px; border: 1px solid transparent; }
.patient-option:hover { background: #f1f7f0; }
.patient-option.selected { border-color: #9bc3ac; background: #eaf5ec; }
.patient-option strong { display: block; color: var(--ink); font-size: 12px; font-weight: 500; }
.patient-option small { color: var(--muted); font-size: 10px; }
.patient-option .badge { flex-shrink: 0; }
.patient-picker:empty { display: none; }
.empty-state { text-align: center; padding: 27px 14px; color: #647364; font-size: 12px; line-height: 1.7; }
.empty-state h3, .empty-state strong { display: block; margin-bottom: 6px; font-size: 13px; color: #536c59; }
.empty-state .button { margin-top: 13px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.summary-metric { padding: 14px 0; border-bottom: 1px solid var(--line); }
.summary-metric > span, .summary-metric > small { display: block; color: var(--muted); font-size: 11px; }
.summary-metric strong { display: block; color: var(--ink); font-size: 24px; font-weight: 600; letter-spacing: -.5px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.summary-metric p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.summary-table, .directory-table { border-collapse: collapse; width: 100%; font-size: 12px; margin-top: 12px; }
.summary-table th, .directory-table th { text-align: left; font-size: 10px; font-weight: 500; color: var(--muted); padding: 10px 8px; background: #f6f9f4; border-bottom: 1px solid var(--line); }
.summary-table td, .directory-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); }
.summary-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.directory-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.directory-row strong { display: block; font-size: 13px; }
.directory-row small { color: var(--muted); font-size: 11px; }
.directory-row .button { margin-left: auto; font-size: 11px; }
.page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 15px 0 20px; border-top: 1px solid var(--line); color: #617363; font-size: 9px; }
.toast { position: fixed; z-index: 200; bottom: 24px; left: calc(var(--sidebar-width) + 28px); max-width: min(460px, calc(100vw - 32px)); display: flex; align-items: center; gap: 10px; padding: 13px 18px; color: white; background: #233f33; border: 1px solid #456553; border-radius: 9px; box-shadow: 0 8px 28px #18352522; font-size: 12px; animation: toast-in 180ms ease-out; }
.toast.error { background: #883d3a; border-color: #aa6560; }
.drawer-scrim { position: fixed; inset: 0; z-index: 39; background: #18372d66; backdrop-filter: blur(2px); }
.drawer-open { overflow: hidden; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 0; color: var(--accent); font-size: 11px; font-weight: 500; border-radius: 4px; }
.text-button:hover { color: #045e56; text-decoration: underline; text-underline-offset: 3px; }
.text-button svg { width: 14px; height: 14px; }
.daily-strip .text-button { margin-left: auto; font-size: 10px; }
.full-width { width: 100%; }
.appointment-time small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 400; }
.appointment-row > .appointment-details { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 110px; }
.appointment-arrow { color: #7c9081; flex: 0 0 auto; }
.appointment-arrow svg { width: 15px; height: 15px; }
.visit-statuses { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 16px; }
.secondary-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 1 0 100%; padding-top: 3px; }
.secondary-actions .text-button { min-height: 30px; padding: 5px 0; font-size: 10px; }
.patient-avatar { width: 43px; height: 43px; font-size: 13px; color: #487456; background: #eaf1e5; }
.patient-option-info { flex: 1; min-width: 0; }
.patient-option-info strong { overflow-wrap: anywhere; }
.patient-option .patient-avatar { width: 36px; height: 36px; font-size: 11px; }
.quantity-control { display: block; flex: 0 0 44px; width: 44px; padding-top: 1px; }
.quantity-control input[type="number"] { width: 44px; padding: 5px 3px; }
.payment-methods { border: 0; padding: 0; min-width: 0; }
.payment-methods legend { padding: 0 0 8px; color: #607367; font-size: 11px; }
.payment-method input[type="radio"] { width: 13px; height: 13px; min-height: 13px; margin: 0; }
.payment-success { display: flex; gap: 9px; align-items: center; color: #36745b; font-size: 12px; background: #edf7ee; border: 1px solid #d3e6d4; padding: 12px; border-radius: 7px; margin-top: 16px; }
.payment-success svg { width: 18px; height: 18px; }
.payment-totals { margin-bottom: 19px; }
.form-field b { color: #a44741; font-weight: 500; margin-left: 2px; }
.history-dot { display: none; }
.visit-empty > svg { width: 48px; height: 48px; padding: 11px; background: #edf4ec; border-radius: 12px; margin-bottom: 17px; color: #6a9076; }
.visit-empty .button { margin-top: 18px; }
.dialog-body > .input-help { margin-top: 18px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 1600px) {
  :root { --sidebar-width: 224px; }
  .main { padding: 0 36px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; }
  .slots-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
  .slot { min-height: 75px; }
  .slot-time { font-size: 15px; }
  .slot-caption { font-size: 10px; }
}

@media (max-width: 1279px) {
  :root { --sidebar-width: 184px; }
  .sidebar { padding: 26px 12px 16px; }
  .brand strong { font-size: 17px; }
  .brand img { width: 36px; height: 36px; }
  .nav-caption { font-size: 8px; letter-spacing: .7px; margin-left: 9px; }
  .main { padding: 0 20px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 354px; gap: 16px; }
  .slots-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding-left: 18px; padding-right: 18px; }
  .slot { min-height: 63px; }
  .toolbar { gap: 8px; }
  .doctor-filter select { max-width: 180px; }
  .doctor-filter { padding-left: 0; }
  .calendar-card-heading, .upcoming-section { padding-left: 18px; padding-right: 18px; }
  .visit-body, .visit-identity { padding-left: 18px; padding-right: 18px; }
  .visit-actions, .visit-topline { padding-left: 18px; padding-right: 18px; }
  .daily-strip { gap: 6px 18px; }
}

@media (max-width: 1050px) and (min-width: 961px) {
  :root { --sidebar-width: 72px; }
  .sidebar { padding: 24px 12px 16px; align-items: center; }
  .brand { margin-bottom: 34px; }
  .brand span, .nav-caption, .nav-item .nav-count, .sidebar-note, .sidebar-bottom > span:last-child { display: none; }
  .brand img { width: 38px; height: 38px; }
  #mainNav { width: 100%; }
  .nav-item { width: 48px; min-height: 48px; padding: 14px; font-size: 0; gap: 0; }
  .nav-item [data-icon] svg { width: 20px; height: 20px; }
  .sidebar-bottom { margin-top: auto; padding-top: 18px; width: 100%; justify-content: center; }
  .main { padding: 0 18px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
  .date-navigation { flex-shrink: 0; }
  .toolbar .doctor-filter { order: 3; margin-left: 0; }
  .toolbar .view-switch { margin-left: auto; }
  .toolbar { padding: 8px 0; }
  .calendar-card-heading { padding-top: 17px; }
  .calendar-card-heading h2 { font-size: 14px; }
  .slots-grid { padding: 0 14px 17px; gap: 6px; }
  .slot { padding: 9px; }
  .slot-caption { font-size: 8px; }
  .appointment-row { gap: 8px; }
  .row-status .badge { font-size: 8px; }
  .appointment-patient strong { font-size: 11px; }
}

/* Mobile calendar + full-height visit drawer; the final native app reuses this flow. */
@media (max-width: 960px) {
  :root { --sidebar-width: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 0 16px; width: 100%; }
  .topbar { min-height: 54px; gap: 8px; padding-top: env(safe-area-inset-top, 0px); }
  .breadcrumbs { font-size: 11px; font-weight: 600; }
  .breadcrumbs span { margin: 0 6px; }
  .prototype-badge { font-size: 8px; padding: 3px 5px; margin-left: auto; white-space: normal; max-width: 128px; line-height: 1.4; }
  .icon-btn.mobile-menu { display: inline-flex; width: 36px; height: 44px; margin-right: -8px; }
  .page-heading { padding: 22px 0 18px; gap: 12px; align-items: flex-start; }
  .eyebrow { font-size: 8px; letter-spacing: 1.4px; }
  h1 { font-size: 27px; letter-spacing: -.7px; }
  .page-heading p { font-size: 11px; max-width: 180px; line-height: 1.5; }
  .page-heading > .button { padding: 10px 12px; font-size: 11px; margin-top: 15px; min-height: 44px; }
  .page-heading > .button [data-icon] svg { width: 16px; height: 16px; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; padding: 9px 0; }
  .date-navigation { grid-column: 1 / -1; justify-content: space-between; width: 100%; }
  .date-navigation .icon-btn { width: 40px; height: 44px; }
  .date-control { width: auto; flex: 1; }
  .date-control input { min-height: 44px !important; text-align: center; font-size: 14px; padding: 8px 12px !important; }
  .date-navigation .button { min-height: 44px; font-size: 11px; padding: 8px 9px; }
  .doctor-filter { margin: 0; min-width: 0; width: 100%; padding: 0 0 0 3px; }
  .doctor-filter select { max-width: 100%; min-height: 44px; font-size: 12px; padding-left: 0; }
  .doctor-filter [data-icon] svg { width: 17px; height: 17px; }
  .view-switch { flex: 0 0 auto; }
  .view-switch button { min-height: 38px; padding: 7px 10px; font-size: 11px; }
  .daily-strip { gap: 7px 16px; padding: 12px 0; min-height: 48px; font-size: 10px; }
  .daily-strip strong { font-size: 13px; }
  .daily-strip .strip-separator { display: none; }
  .workspace { display: block; padding-bottom: 18px; }
  .calendar-card { border-radius: 10px; }
  .calendar-card-heading { padding: 17px 15px 15px; }
  .calendar-card-heading h2 { font-size: 15px; }
  .calendar-card-heading p { font-size: 10px; }
  .step-label { font-size: 9px; }
  .doctor-heading { padding-left: 15px; padding-right: 15px; }
  .slots-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; padding: 0 14px 17px; }
  .slot { min-height: 66px; padding: 10px 8px; border-radius: 6px; gap: 4px; }
  .slot-time { font-size: 13px; }
  .slot-caption { font-size: 8px; }
  .slot-status { display: none; }
  .calendar-legend { padding: 0 15px 16px; gap: 12px; font-size: 9px; }
  .legend-square { width: 9px; height: 9px; }
  .upcoming-section { padding: 16px 14px 7px; }
  .search-box input { min-height: 44px; font-size: 12px; }
  .appointment-row { min-height: 75px; gap: 10px; }
  .appointment-time { flex-basis: 39px; font-size: 12px; }
  .appointment-patient strong, .appointment-details strong { font-size: 11px; }
  .appointment-patient small, .appointment-details small { font-size: 9px; }
  .row-status { max-width: 98px; gap: 4px; }
  .badge { font-size: 8px; padding: 3px 5px; }
  .overview-table { min-width: 580px; }
  .overview-table th:first-child { width: 164px; }
  .visit-panel { display: none; }
  .visit-panel.open { display: block; position: fixed; inset: max(12px, env(safe-area-inset-top, 12px)) 0 0; z-index: 40; border-radius: 14px 14px 0 0; border: 0; box-shadow: 0 -10px 50px #17372d22; max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 12px))); overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .visit-panel.open #visitContent { min-height: 100%; }
  .visit-topline { position: sticky; top: 0; z-index: 3; background: #fff; min-height: 54px; padding: 9px 18px; }
  .visit-topline .icon-btn { width: 44px; height: 44px; margin: -4px -8px -4px 0; }
  .icon-btn.drawer-close, .mobile-back { display: inline-flex; }
  .visit-identity { padding: 19px 20px 15px; }
  .visit-identity h2 { font-size: 23px; }
  .visit-identity .badge { font-size: 10px; padding: 4px 7px; }
  .visit-meta { font-size: 12px; gap: 11px; }
  .visit-meta [data-icon] svg { width: 17px; height: 17px; }
  .visit-actions { padding: 0 20px 20px; gap: 8px; }
  .visit-actions .button { min-height: 44px; font-size: 12px; }
  .secondary-actions .text-button { min-height: 44px; font-size: 11px; }
  .text-button { min-height: 44px; }
  .daily-strip .text-button { min-height: 28px; }
  .appointment-arrow { display: none; }
  .appointment-row > .appointment-details { max-width: 86px; }
  .visit-statuses .badge { font-size: 10px; padding: 4px 7px; }
  .visit-tabs { position: sticky; top: 54px; z-index: 2; background: white; padding: 0 16px; gap: 9px; }
  .visit-tabs button { min-height: 48px; font-size: 12px; }
  .visit-body { padding: 22px 20px 28px; max-height: none; min-height: 280px; overflow: visible; }
  .visit-body h3 { font-size: 13px; }
  .form-field { margin-bottom: 16px; gap: 7px; }
  .form-field > label, .form-field > span:first-child, .field-label { font-size: 12px; }
  .form-field input, .form-field select, .form-field textarea { font-size: 16px; min-height: 46px; }
  .form-field textarea { min-height: 100px; }
  .input-help, .field-error, .notice, .unsaved-notice { font-size: 11px; }
  .form-actions { margin-top: 20px; }
  .form-actions .button { min-height: 46px; font-size: 12px; }
  .service-line { padding: 14px 0; }
  .service-info strong { font-size: 13px; }
  .service-info small { font-size: 11px; }
  .service-price { font-size: 13px; }
  .service-line .icon-btn { width: 44px; height: 44px; flex-basis: 44px; }
  .service-line input[type="number"] { min-height: 44px; font-size: 16px; }
  .service-add select { min-height: 46px; font-size: 13px; }
  .service-add .button { min-height: 46px; }
  .payment-methods { gap: 7px; }
  .payment-method { min-height: 48px; font-size: 12px; }
  .payment-methods legend { font-size: 12px; }
  .payment-method input[type="radio"] { width: 15px; height: 15px; min-height: 15px; }
  .payment-item { font-size: 12px; padding: 13px 0; }
  .payment-item small { font-size: 10px; }
  .payment-item .button { min-height: 44px; font-size: 11px; }
  .history-item { font-size: 12px; padding-bottom: 23px; }
  .history-item strong { font-size: 12px; }
  .history-item time, .history-item small { font-size: 10px; }
  .payment-item .text-button { min-height: 44px; font-size: 12px; }
  .app-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 12px; }
  .dialog-heading { padding: 17px 18px; }
  .dialog-heading h2 { font-size: 19px; }
  .dialog-heading p { font-size: 11px; }
  .dialog-body { padding: 20px 18px; }
  .dialog-footer { padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .dialog-footer .button { min-height: 46px; flex: 1; min-width: 0; }
  .patient-option { min-height: 55px; }
  .patient-option strong { font-size: 13px; }
  .patient-option small { font-size: 11px; }
  .summary-grid { gap: 8px 15px; }
  .summary-metric strong { font-size: 23px; }
  .summary-metric > span { font-size: 11px; }
  .directory-row { flex-wrap: wrap; }
  .directory-row .button { min-height: 44px; }
  .page-footer { font-size: 9px; line-height: 1.7; padding: 14px 0 calc(18px + env(safe-area-inset-bottom, 0px)); }
  .page-footer > span { flex: 1 1 100%; }
  .toast { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: none; padding: 13px 15px; font-size: 12px; }
}

@media (min-width: 761px) and (max-width: 960px) {
  .main { padding-left: 24px; padding-right: 24px; }
  .slots-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
  .slot { min-height: 73px; padding: 12px; }
  .slot-caption { font-size: 10px; }
  .toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .toolbar .date-navigation { grid-column: auto; }
  .toolbar .doctor-filter { grid-column: 1; grid-row: 2; }
  .toolbar .view-switch { grid-column: 2; grid-row: 2; }
  .visit-panel.open { left: auto; width: 440px; border-radius: 14px 0 0 0; }
}

@media (min-width: 961px) {
  .drawer-scrim { display: none !important; }
  body.drawer-open { overflow: auto; }
}

@media (max-width: 359px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .page-heading > .button { padding: 10px; font-size: 10px; gap: 5px; }
  .page-heading p { font-size: 10px; }
  .slots-grid { gap: 6px; padding-left: 11px; padding-right: 11px; }
  .slot { padding: 9px 6px; }
  .slot-caption { font-size: 7px; }
  .calendar-legend { gap: 9px; }
  .form-grid { grid-template-columns: 1fr; }
  .visit-tabs { gap: 3px; }
  .visit-tabs button { font-size: 11px; }
}

/* The calendar starts with every doctor and a two-week day grid, as in the reference. */
.overview-mode .workspace,
.day-mode .workspace:not(.has-visit) { grid-template-columns: minmax(0, 1fr); }
.main.overview-mode .workspace .visit-panel,
.day-mode .workspace:not(.has-visit) .visit-panel { display: none; }
.overview-mode .upcoming-section,
.overview-mode .calendar-legend,
.overview-mode .doctor-filter { display: none; }
.overview-doctor-search { display: none; }
.overview-mode .overview-doctor-search { display: flex; align-items: center; gap: 8px; width: min(300px, 100%); min-height: 44px; margin-left: auto; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; color: #65776a; }
.overview-doctor-search input { min-height: 42px; padding: 8px 0 !important; border: 0 !important; outline: 0; background: transparent; font-size: 12px; }
.overview-doctor-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px #087f7814; }
.overview-doctor-search input:focus-visible { outline: 0; }
.overview-doctor-search [data-icon] svg { width: 17px; height: 17px; }
.overview-mode .calendar-card-heading { min-height: 77px; padding: 20px 22px; }
.overview-mode .overview-wrap { padding: 0; overflow-x: auto; scrollbar-gutter: stable; }
.overview-mode .overview-table { min-width: 1100px; table-layout: fixed; }
.overview-mode .overview-table th,
.overview-mode .overview-table td { border-right: 1px solid #d9e2dc; border-bottom: 1px solid #d9e2dc; }
.overview-mode .overview-table thead th { height: 66px; padding: 9px 4px; background: #f9fbf8; color: #65796b; font-size: 11px; line-height: 1.4; }
.overview-mode .overview-table thead th strong { font-size: 15px; font-weight: 600; margin-top: 1px; }
.overview-mode .overview-table thead th small { font-size: 10px; }
.overview-mode .overview-table th:first-child { position: sticky; left: 0; z-index: 2; width: 220px; min-width: 220px; padding: 12px 16px; background: white; box-shadow: 1px 0 #d9e2dc; text-align: left; }
.overview-mode .overview-table thead th:first-child { z-index: 3; background: #f9fbf8; font-size: 12px; font-weight: 600; }
.overview-mode .overview-table tbody th { height: 76px; vertical-align: middle; }
.overview-mode .overview-table tbody td { height: 76px; padding: 0; }
.overview-mode .overview-table tr:last-child > th,
.overview-mode .overview-table tr:last-child > td { border-bottom: 0; }
.overview-mode .overview-table .doctor-heading { display: flex; align-items: center; gap: 10px; padding: 0; }
.overview-mode .overview-table .doctor-heading > span:last-child { min-width: 0; }
.overview-mode .overview-table .doctor-heading strong { font-size: 13px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.overview-mode .overview-table .doctor-heading small { font-size: 10px; line-height: 1.5; margin-top: 3px; color: #607467; }
.overview-mode .overview-table .avatar { width: 32px; height: 32px; font-size: 10px; }
.overview-mode .overview-cell { min-height: 76px; height: 100%; border: 0; border-radius: 0; padding: 9px 3px; gap: 4px; background: white; color: #64766b; box-shadow: none; }
.overview-mode .overview-cell.is-empty,
.overview-mode .overview-table td.is-empty { background: white; }
.overview-mode .overview-cell.has-bookings,
.overview-mode .overview-table td.has-bookings { background: #e7ebe9; }
.overview-mode .overview-cell:hover { background: #edf6f0; box-shadow: inset 0 0 0 2px #75aa91; }
.overview-mode .overview-cell.selected { background: #e3f1e9; box-shadow: inset 0 0 0 2px var(--accent); }
.overview-mode .overview-cell strong,
.overview-mode .overview-cell .day-count { font-size: 18px; line-height: 1.2; color: #425e4d; }
.overview-mode .overview-cell > span { font-size: 10px; }
.day-mode .workspace:not(.has-visit) .slots-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }

@media (min-width: 961px) {
  .day-mode .workspace.has-visit .visit-panel { display: block; }
  .day-mode .workspace.has-visit .drawer-close { display: inline-flex; }
}

@media (max-width: 1050px) and (min-width: 961px) {
  .overview-mode .toolbar .view-switch { margin-left: 0; }
}

@media (max-width: 960px) {
  .overview-mode .toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .overview-mode .overview-doctor-search { grid-column: 1; grid-row: 2; width: 100%; min-width: 0; margin-left: 0; }
  .overview-mode .view-switch { grid-column: 2; grid-row: 2; }
  .overview-mode .calendar-card-heading { min-height: 75px; padding: 17px 15px; }
  .overview-mode .overview-table { min-width: 1018px; }
  .overview-mode .overview-table th:first-child { width: 150px; min-width: 150px; padding: 10px 11px; }
  .overview-mode .overview-table .doctor-heading { gap: 7px; }
  .overview-mode .overview-table .doctor-heading strong { font-size: 12px; line-height: 1.4; }
  .overview-mode .overview-table .doctor-heading small { font-size: 9px; }
  .overview-mode .overview-table .avatar { width: 27px; height: 27px; font-size: 9px; }
  .overview-mode .overview-table thead th { height: 65px; }
  .overview-mode .overview-table tbody th,
  .overview-mode .overview-table tbody td,
  .overview-mode .overview-cell { height: 82px; min-height: 82px; }
  .day-mode .workspace:not(.has-visit) .slots-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 761px) and (max-width: 960px) {
  .overview-mode .toolbar .date-navigation { grid-column: 1 / -1; }
  .day-mode .workspace:not(.has-visit) .slots-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* A doctor's day is a modal above the unchanged all-doctor calendar. */
body.day-dialog-open { overflow: hidden; }
.day-dialog { width: min(1120px, calc(100vw - 48px)); max-width: calc(100vw - 48px); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid #d6e1d9; border-radius: 15px; background: #f3f6f2; color: var(--text); box-shadow: 0 26px 100px #17332d45, 0 8px 28px #17332d1c; overflow: hidden; }
.day-dialog::backdrop { background: #17362d66; backdrop-filter: blur(2px); }
.day-dialog-heading { position: relative; z-index: 3; display: grid; grid-template-columns: 112px minmax(0, 1fr) 44px; align-items: center; gap: 12px; min-height: 79px; padding: 15px 22px; background: white; border-bottom: 1px solid #dce5dd; }
.day-dialog-heading h2 { font-size: 17px; font-weight: 600; line-height: 1.45; letter-spacing: -.2px; text-align: center; overflow-wrap: anywhere; }
.day-dialog-heading p { margin-top: 3px; font-size: 11px; color: var(--muted); text-align: center; }
.day-dialog-heading > button:first-child { display: inline-flex; align-items: center; justify-content: flex-start; gap: 7px; min-height: 44px; padding: 9px 6px; border-radius: 7px; color: #4e6e5d; font-size: 12px; font-weight: 500; }
.day-dialog-heading > button:first-child:hover { background: #eef5ee; }
.day-dialog-heading > button:first-child svg { width: 18px; height: 18px; }
.day-dialog-heading > .icon-btn { justify-self: end; }
.day-dialog.day-mode .day-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; max-height: calc(100dvh - 128px); padding: 24px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b9cbbc #f0f5ef; }
.day-dialog .day-calendar-card { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.day-dialog .calendar-card-heading { padding: 0 0 18px; min-height: 0; }
.day-dialog .calendar-card-heading h2 { font-size: 15px; }
.day-dialog .calendar-card-heading p { font-size: 11px; }
.day-dialog.day-mode .day-workspace .slots-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 0 0 18px; }
.day-dialog .slot { min-height: 67px; padding: 11px 12px; background: white; }
.day-dialog .slot.booked { background: var(--occupied); }
.day-dialog .slot.blocked { background: repeating-linear-gradient(135deg, #f3f5f3, #f3f5f3 5px, #e5eae5 5px, #e5eae5 6px); }
.day-dialog .slot-time { font-size: 15px; }
.day-dialog .slot-caption { font-size: 10px; }
.day-dialog .calendar-legend { padding: 0 0 20px; font-size: 10px; }
.day-dialog .upcoming-section { padding: 19px 0 0; border-top: 1px solid #dce6dd; }
.day-dialog .appointment-row { padding-left: 0; padding-right: 0; }
.day-dialog .appointment-row.selected { padding-left: 10px; padding-right: 8px; }
.day-dialog.day-mode .day-workspace .visit-panel { display: block; position: sticky; top: 0; max-height: calc(100dvh - 176px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #bfd0c2 #f7faf5; border: 1px solid #dce5dd; background: white; }
.day-dialog .visit-body { max-height: none; overflow: visible; }
.day-dialog .visit-topline { position: sticky; top: 0; z-index: 2; background: white; }
.day-dialog .visit-empty { min-height: 425px; }
.day-dialog .visit-empty p { max-width: 225px; }
.day-dialog .visit-empty .button { margin-top: 20px; }

@media (min-width: 961px) {
  .day-dialog .visit-panel .drawer-close { display: none; }
  .day-dialog .day-workspace.has-visit .visit-panel .drawer-close { display: inline-flex; }
}

@media (max-width: 1100px) and (min-width: 961px) {
  .day-dialog { width: calc(100vw - 32px); max-width: calc(100vw - 32px); }
  .day-dialog.day-mode .day-workspace { grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; padding: 20px; }
  .day-dialog .slot { padding: 10px; }
  .day-dialog .slot-caption { font-size: 9px; }
}

@media (max-width: 960px) {
  .day-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); border-radius: 12px; }
  .day-dialog-heading { grid-template-columns: 66px minmax(0, 1fr) 38px; gap: 6px; min-height: 75px; padding: 10px 12px; }
  .day-dialog-heading h2 { font-size: 13px; line-height: 1.5; letter-spacing: 0; }
  .day-dialog-heading p { font-size: 10px; }
  .day-dialog-heading > button:first-child { font-size: 11px; gap: 4px; padding: 8px 2px; }
  .day-dialog-heading > button:first-child svg { width: 15px; height: 15px; }
  .day-dialog-heading > .icon-btn { width: 38px; height: 44px; }
  .day-dialog.day-mode .day-workspace { display: block; max-height: calc(100dvh - 92px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); padding: 18px 14px calc(20px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
  .day-dialog .calendar-card-heading { padding-bottom: 17px; }
  .day-dialog .calendar-card-heading h2 { font-size: 14px; }
  .day-dialog.day-mode .day-workspace .slots-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; padding-bottom: 18px; }
  .day-dialog .slot { min-height: 66px; padding: 10px 7px; }
  .day-dialog .slot-time { font-size: 14px; }
  .day-dialog .slot-caption { font-size: 10px; }
  .day-dialog .calendar-legend { gap: 12px; font-size: 9px; }
  .day-dialog.day-mode .day-workspace .visit-panel { display: none; }
  .day-dialog.day-mode .day-workspace .visit-panel.open { display: block; position: fixed; inset: 0; z-index: 40; width: 100%; max-height: 100dvh; border: 0; border-radius: 0; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); overflow-y: auto; background: white; }
  .day-dialog .visit-panel.open .drawer-close { display: inline-flex; }
  .day-dialog .visit-topline { z-index: 3; }
  .day-dialog .visit-body { overflow: visible; max-height: none; }
  .day-dialog .visit-empty { min-height: 330px; }
  .day-dialog .drawer-scrim { z-index: 39; }
}

@media (min-width: 761px) and (max-width: 960px) {
  .day-dialog { width: min(740px, calc(100vw - 32px)); }
  .day-dialog-heading h2 { font-size: 16px; }
  .day-dialog.day-mode .day-workspace .slots-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
  .day-dialog .slot { min-height: 73px; padding: 11px; }
  .day-dialog .slot-caption { font-size: 10px; }
  .day-dialog.day-mode .day-workspace .visit-panel.open { left: auto; width: 440px; border-radius: 12px 0 0 0; }
}

/* One continuous visit workflow: arrival, patient details, services, payment. */
.day-dialog.day-mode .day-workspace { grid-template-columns: minmax(0, 1fr) 472px; }
.visit-workflow { padding: 0 20px 22px; }
.visit-workflow .workflow-section { padding: 20px 0; border-top: 1px solid #dce5dd; }
.visit-workflow .workflow-section:first-child { padding-top: 18px; }
.workflow-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.workflow-section-heading h3 { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 650; color: var(--ink); }
.workflow-section-heading > span { font-size: 11px; color: var(--muted); }
.visit-editor-form { margin: 0; }
.visit-workflow .form-field { margin-bottom: 15px; gap: 7px; }
.visit-workflow .form-field > span:first-child,
.visit-workflow .form-field > label { font-size: 12px; }
.visit-workflow .form-field input,
.visit-workflow .form-field select,
.visit-workflow .form-field textarea { font-size: 14px; min-height: 44px; }
.visit-workflow .form-field textarea { min-height: 96px; }
.visit-workflow .input-help { font-size: 11px; line-height: 1.6; }
.visit-panel .visit-actions { padding-bottom: 12px; }
.visit-panel .visit-actions > .button.primary { flex: 1 0 100%; min-height: 44px; font-size: 13px; }
.arrival-confirmed { display: flex; align-items: center; gap: 9px; flex: 1 0 100%; padding: 11px 12px; min-height: 44px; background: #e9f5ec; border: 1px solid #cfe4d4; border-radius: 7px; color: #326b4b; font-size: 13px; font-weight: 500; }
.arrival-confirmed svg { width: 18px; height: 18px; }
.arrival-confirmed small { display: block; margin-top: 2px; color: #506f59; font-weight: 400; font-size: 11px; }
.visit-more { flex: 1 0 100%; min-width: 0; margin-top: 1px; }
.visit-more > summary { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; list-style: none; color: #617568; font-size: 11px; cursor: pointer; }
.visit-more > summary::-webkit-details-marker { display: none; }
.visit-more > summary::after { content: ""; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: -3px 3px 0 2px; }
.visit-more[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.visit-more > summary:focus-visible { outline: 3px solid #3ca99d; outline-offset: 3px; border-radius: 4px; }
.visit-more > button, .visit-more .secondary-actions > button { min-height: 40px; margin: 0 10px 3px 0; font-size: 11px; }
.visit-more .secondary-actions { flex-wrap: wrap; justify-content: flex-start; padding: 0; gap: 0 8px; }
.patient-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 18px; color: #596f61; margin-bottom: 4px; }
.patient-summary > div, .patient-summary > span { min-width: 0; }
.patient-summary small, .patient-summary dt, .patient-summary .muted { display: block; margin-bottom: 3px; color: #647669; font-size: 11px; line-height: 1.5; }
.patient-summary strong, .patient-summary dd { display: block; margin: 0; color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.patient-editor, .visit-note, .payment-history-details, .visit-history-details { min-width: 0; }
.patient-editor > summary, .visit-note > summary, .payment-history-details > summary, .visit-history-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; list-style: none; cursor: pointer; color: var(--accent); font-size: 12px; font-weight: 500; line-height: 1.5; }
.patient-editor > summary::-webkit-details-marker,
.visit-note > summary::-webkit-details-marker,
.payment-history-details > summary::-webkit-details-marker,
.visit-history-details > summary::-webkit-details-marker { display: none; }
.patient-editor > summary::after,
.visit-note > summary::after,
.payment-history-details > summary::after,
.visit-history-details > summary::after { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: -4px 4px 0; }
.patient-editor[open] > summary::after,
.visit-note[open] > summary::after,
.payment-history-details[open] > summary::after,
.visit-history-details[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.patient-editor > summary:focus-visible,
.visit-note > summary:focus-visible,
.payment-history-details > summary:focus-visible,
.visit-history-details > summary:focus-visible { outline: 3px solid #3ca99d; outline-offset: 2px; border-radius: 4px; }
.patient-editor-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; padding-top: 10px; }
.patient-editor-fields > .form-field:first-child,
.patient-editor-fields > .form-field:has(textarea),
.patient-editor-fields > .form-grid { grid-column: 1 / -1; }
.visit-note { margin-top: 15px; }
.visit-note[open] > .form-field { margin-top: 10px; margin-bottom: 0; }
.visit-editor-form .service-line { display: grid; grid-template-columns: 54px minmax(0, 1fr) 40px; column-gap: 10px; row-gap: 8px; padding: 15px 0; align-items: center; }
.visit-editor-form .service-line:first-child { padding-top: 0; }
.visit-editor-form .service-info { grid-column: 1 / 3; grid-row: 1; min-width: 0; }
.visit-editor-form .service-info strong { font-size: 13px; line-height: 1.55; font-weight: 500; overflow-wrap: anywhere; }
.visit-editor-form .service-info small { font-size: 11px; margin-top: 3px; }
.visit-editor-form .quantity-control { grid-column: 1; grid-row: 2; width: 54px; padding: 0; }
.visit-editor-form .quantity-control input[type="number"] { width: 54px; min-height: 40px; padding: 7px 5px; font-size: 14px; }
.visit-editor-form .service-price { grid-column: 2; grid-row: 2; justify-self: end; padding: 0; color: var(--ink); font-size: 14px; line-height: 1.5; }
.visit-editor-form .service-line > .icon-btn { grid-column: 3; grid-row: 1 / 3; width: 40px; height: 44px; margin: 0; justify-self: end; align-self: center; color: #77877b; }
.visit-editor-form .service-line > .icon-btn:hover { background: #fcf0ee; color: #9b4740; }
.visit-editor-form .service-add { align-items: stretch; gap: 8px; margin: 15px 0 17px; }
.visit-editor-form .service-add select { min-height: 44px; font-size: 12px; padding: 10px 9px; }
.visit-editor-form .service-add .button { min-height: 44px; min-width: 82px; padding: 10px 12px; font-size: 12px; }
.visit-workflow .totals-row { font-size: 13px; padding: 7px 0; }
.visit-workflow .totals-row strong { font-size: 14px; }
.visit-workflow .totals-row.total { padding-top: 14px; }
.visit-workflow .totals-row.total strong { font-size: 22px; }
.editor-savebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding: 13px; border: 1px solid #ead8a7; border-radius: 8px; background: #fff8e6; }
.editor-save-state { flex: 1 0 100%; color: #7c6229; font-size: 12px; font-weight: 500; line-height: 1.6; }
.editor-savebar .button { flex: 1 1 auto; min-height: 44px; padding: 10px 12px; font-size: 12px; }
.editor-savebar .button.quiet { flex: 1 0 100%; min-height: 36px; padding: 6px 0; color: #806f4a; font-size: 11px; }
.editor-dirty .editor-savebar { box-shadow: 0 2px 8px #8c6c1d08; }
.payment-section { margin-top: 0; }
.payment-section .payment-totals { margin-bottom: 17px; }
.payment-section .payment-form { margin-top: 17px; }
.payment-form > .form-field { margin-bottom: 5px; }
.payment-form input[name="amount"] { font-size: 19px; font-weight: 600; letter-spacing: -.2px; min-height: 48px; }
.payment-amount-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 0 0 10px; }
.payment-amount-actions .text-button { min-height: 38px; padding: 5px 0; font-size: 11px; }
.payment-block-note { margin: 0 0 16px; padding: 11px 12px; color: #795d25; font-size: 12px; line-height: 1.6; border: 1px solid #e8d9af; border-radius: 7px; background: #fff8e8; }
.payment-section .payment-methods { margin: 9px 0 15px; gap: 8px; }
.payment-section .payment-methods legend { font-size: 12px; padding-bottom: 9px; }
.payment-section .payment-method { min-height: 45px; font-size: 12px; }
.payment-section .payment-method input[type="radio"] { width: 14px; height: 14px; min-height: 14px; }
.payment-form > .button.primary { min-height: 46px; margin-top: 16px; font-size: 13px; }
.payment-form :disabled { cursor: not-allowed; }
.payment-history-details { margin-top: 18px; padding-top: 6px; border-top: 1px solid #e1e8e2; }
.payment-history-details > summary,
.visit-history-details > summary { color: #5b7162; }
.payment-history-details .payment-history { border-top: 0; margin-top: 0; padding-top: 0; }
.payment-history-details .payment-item { font-size: 12px; padding: 12px 0; }
.payment-history-details .payment-item small { font-size: 10px; }
.payment-history-details .payment-item .text-button { min-height: 40px; font-size: 11px; }
.visit-completion { border-top: 1px solid #dce5dd; padding-top: 19px; margin-top: 1px; }
.visit-completion > .button { width: 100%; min-height: 45px; font-size: 13px; }
.visit-completion p, .visit-completion .input-help { margin-top: 8px; color: #65796a; font-size: 11px; line-height: 1.6; }
.visit-history-details { margin-top: 19px; padding-top: 5px; border-top: 1px solid #e1e8e2; }
.visit-history-details .history-list { padding-top: 12px; }
.visit-history-details .history-item { font-size: 12px; }
.visit-history-details .history-item strong { font-size: 12px; line-height: 1.6; }
.visit-history-details .history-item small { font-size: 10px; }

@media (max-width: 1100px) and (min-width: 961px) {
  .day-dialog.day-mode .day-workspace { grid-template-columns: minmax(0, 1fr) 430px; }
}

@media (max-width: 960px) {
  .day-dialog.day-mode .day-workspace { display: block; }
  .visit-workflow { padding: 0 20px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .visit-workflow .workflow-section { padding: 21px 0; }
  .workflow-section-heading h3 { font-size: 15px; }
  .visit-panel .visit-actions > .button.primary { min-height: 46px; font-size: 13px; }
  .arrival-confirmed { min-height: 46px; font-size: 13px; }
  .visit-more > summary,
  .visit-more > button,
  .visit-more .secondary-actions > button { min-height: 44px; font-size: 12px; }
  .visit-workflow .form-field input,
  .visit-workflow .form-field select,
  .visit-workflow .form-field textarea { font-size: 16px; min-height: 46px; }
  .visit-workflow .form-field > span:first-child,
  .visit-workflow .form-field > label { font-size: 12px; }
  .patient-summary strong { font-size: 14px; }
  .patient-editor > summary,
  .visit-note > summary,
  .payment-history-details > summary,
  .visit-history-details > summary { min-height: 46px; font-size: 12px; }
  .patient-editor-fields { column-gap: 10px; }
  .visit-editor-form .service-info strong { font-size: 14px; }
  .visit-editor-form .service-line { grid-template-columns: 56px minmax(0, 1fr) 44px; gap: 8px 10px; padding: 17px 0; }
  .visit-editor-form .quantity-control,
  .visit-editor-form .quantity-control input[type="number"] { width: 56px; }
  .visit-editor-form .quantity-control input[type="number"] { min-height: 44px; font-size: 16px; }
  .visit-editor-form .service-line > .icon-btn { width: 44px; height: 44px; }
  .visit-editor-form .service-price { font-size: 15px; }
  .visit-editor-form .service-add select { min-height: 46px; font-size: 13px; }
  .visit-editor-form .service-add .button { min-height: 46px; min-width: 78px; padding: 10px; font-size: 12px; }
  .editor-savebar { padding: 12px; gap: 8px; }
  .editor-savebar .button { min-height: 46px; font-size: 12px; }
  .editor-savebar .button.quiet { min-height: 44px; }
  .payment-amount-actions .text-button { min-height: 44px; font-size: 12px; }
  .payment-form input[name="amount"] { font-size: 20px; min-height: 50px; }
  .payment-section .payment-method { min-height: 48px; font-size: 12px; }
  .payment-form > .button.primary { min-height: 48px; font-size: 13px; }
  .payment-history-details .payment-item .text-button { min-height: 44px; font-size: 12px; }
  .visit-completion > .button { min-height: 48px; font-size: 13px; }
}

@media (max-width: 359px) {
  .visit-workflow { padding-left: 16px; padding-right: 16px; }
  .patient-summary { gap: 12px; }
  .patient-summary strong { font-size: 13px; }
  .patient-editor-fields { grid-template-columns: minmax(0, 1fr); }
  .visit-editor-form .service-add { flex-wrap: wrap; }
  .visit-editor-form .service-add select { flex-basis: 100%; }
  .visit-editor-form .service-add .button { margin-left: auto; }
}

.visit-action-links { display: flex; flex: 1 0 100%; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.visit-action-links > .visit-more { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.visit-action-links > .text-button { flex: 0 0 auto; min-height: 40px; white-space: nowrap; }
.visit-action-links .visit-more .secondary-actions { flex-wrap: wrap; gap: 2px 10px; }
.visit-action-links .visit-more > button,
.visit-action-links .visit-more .secondary-actions > button { white-space: normal; justify-content: flex-start; text-align: left; }
.patient-editor-footer { display: flex; grid-column: 1 / -1; align-items: center; justify-content: flex-end; gap: 8px; padding: 2px 0 6px; }
.patient-editor-footer .button { min-height: 44px; font-size: 12px; }
.payment-received { margin-top: 16px; }
.payment-received > span { display: flex; align-items: center; gap: 8px; color: #36704f; font-size: 12px; line-height: 1.6; padding: 9px 0 13px; }
.payment-received > span svg { width: 18px; height: 18px; }
.payment-received > .button { min-height: 46px; font-size: 13px; }

@media (max-width: 960px) {
  .visit-action-links { gap: 10px; }
  .visit-action-links > .text-button { min-height: 44px; font-size: 12px; }
  .patient-editor-footer .button { min-height: 46px; }
  .payment-received > .button { min-height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .sidebar, .topbar, .toolbar, .page-heading > .button, .page-footer, .visit-actions, .visit-tabs, .toast, .drawer-scrim { display: none !important; }
  .main { margin-left: 0; padding: 0; }
  .workspace { display: block; }
  .visit-panel { display: block; position: static; margin-top: 20px; }
  .visit-body { max-height: none; overflow: visible; }
  .calendar-card, .visit-panel { box-shadow: none; break-inside: avoid; }
}
