:root {
  color-scheme: light;
  --background: oklch(0.985 0.004 80);
  --surface: #ffffff;
  --surface-subtle: oklch(0.97 0 0);
  --surface-sheet: #ffffff;
  --text: oklch(0.18 0.005 60);
  --muted: oklch(0.556 0 0);
  --border: oklch(0.922 0 0);
  --border-strong: oklch(0.86 0 0);
  --primary: oklch(0.205 0 0);
  --primary-hover: oklch(0.27 0 0);
  --primary-contrast: oklch(0.985 0 0);
  --green: #277a54;
  --green-soft: #dff1e7;
  --amber: #a76412;
  --amber-soft: #fff0c7;
  --red: #b33a3a;
  --red-soft: #fdeaea;
  --blue: #2f6fb2;
  --blue-soft: #dcecff;
  --dark-pill: #4c4c4c;
  --ring: oklch(0.708 0 0);
  --shadow: 0 12px 28px rgba(28, 27, 25, 0.08);
  --radius: 0.625rem;
  --sidebar-expanded: 208px;
  --sidebar-collapsed: 68px;
  --sidebar-inset: 0px;
  --sidebar-gap: 16px;
  font-family: Geist, Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
}

body:not(.authenticated) .app-shell {
  display: none;
}

body.authenticated .auth-screen {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-logo {
  width: 190px;
  max-height: 54px;
  object-fit: contain;
  object-position: left center;
}

.auth-card h1 {
  font-size: 28px;
}

.auth-message {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.auth-message.error {
  border-color: #e2b7b7;
  background: var(--red-soft);
  color: #872626;
}

.app-shell {
  min-height: 100vh;
  padding-left: calc(var(--sidebar-expanded) + var(--sidebar-gap));
  transition: padding-left 320ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.sidebar {
  position: fixed;
  z-index: 30;
  top: var(--sidebar-inset);
  bottom: var(--sidebar-inset);
  left: var(--sidebar-inset);
  width: var(--sidebar-expanded);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: #fbfbfa;
  box-shadow: none;
  padding: 0;
  transition: width 320ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.brand {
  position: relative;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  padding: 0 42px 0 10px;
}

.brand-logo {
  width: 150px;
  max-height: 50px;
  object-fit: contain;
  object-position: center;
  transition: opacity 150ms ease, width 180ms ease;
}

.collapse-chip {
  position: absolute;
  right: 12px;
  top: 32px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(28, 27, 25, 0.06);
  display: grid;
  place-items: center;
  font-size: 15px;
}

.sidebar-nav {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 8px;
}

.sidebar-nav .database-bottom-link {
  margin-top: auto;
}

.sidebar-nav button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.nav-icon {
  width: 20px;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  font-size: 20px;
  line-height: 1;
  opacity: 0.88;
}

.sidebar-nav button:hover .nav-icon {
  color: var(--text);
}

.sidebar-nav button.active .nav-icon {
  color: var(--text);
}

.sidebar-nav button:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.sidebar-nav button.active {
  background: #e9e9e7;
  color: var(--text);
  font-weight: 600;
}

.nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.sidebar-collapsed .nav-count {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 16px;
  padding: 0 4px;
  font-size: 9px;
  line-height: 16px;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 14px 8px;
  color: var(--muted);
}

.secure-vault-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 12px;
}

.secure-vault-copy .vault-avatar {
  flex: 0 0 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #167d68;
  color: white;
  font-size: 19px;
}

.secure-vault-copy span {
  display: block;
  margin: 0 0 2px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.secure-vault-copy p {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.settings-nav-link {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.settings-nav-link:hover,
.settings-nav-link.active {
  background: var(--surface-subtle);
  color: var(--text);
}

.app-shell.sidebar-collapsed {
  padding-left: calc(var(--sidebar-collapsed) + var(--sidebar-gap));
}

.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.app-shell.sidebar-collapsed .brand-logo,
.app-shell.sidebar-collapsed .sidebar-nav button span:not(.nav-icon),
.app-shell.sidebar-collapsed .secure-vault-copy,
.app-shell.sidebar-collapsed .settings-nav-link span:not(.nav-icon) {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-nav button {
  justify-content: center;
  padding: 0 8px;
}

.app-shell.sidebar-collapsed .nav-icon {
  width: 32px;
}

.app-shell.sidebar-collapsed .sidebar-foot {
  padding: 8px;
}

.app-shell.sidebar-collapsed .collapse-chip i {
  transform: rotate(180deg);
}

.app-shell.sidebar-collapsed .settings-nav-link {
  justify-content: center;
  padding: 0;
}

.app-main {
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

button {
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

h1, h2, h3, p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
}

h2 {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
}

h3 {
  font-size: 16px;
  font-weight: 600;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  padding: 0 20px;
}

.global-search-wrap {
  position: relative;
  width: min(520px, 46vw);
  margin-left: clamp(18px, 4vw, 72px);
}

.global-search-wrap > i {
  position: absolute;
  z-index: 1;
  left: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  font-size: 18px;
}

.global-search-wrap input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 0 54px 0 38px;
  font-size: 13px;
}

.global-search-wrap input:focus {
  outline: 2px solid color-mix(in oklch, var(--primary) 28%, transparent);
  border-color: color-mix(in oklch, var(--primary) 45%, var(--border));
}

.global-search-wrap kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  translate: 0 -50%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--muted);
  padding: 2px 5px;
  font: 11px/1.2 Geist, sans-serif;
}

.global-search-results {
  position: absolute;
  z-index: 70;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(28, 27, 25, 0.14);
}

.global-search-result {
  width: 100%;
  display: grid;
  gap: 2px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.global-search-result:last-child { border-bottom: 0; }
.global-search-result:hover { background: var(--surface-subtle); }
.global-search-result strong { font-size: 13px; }
.global-search-result span { color: var(--muted); font-size: 11px; }

.global-search-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-icon-button {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #555;
  cursor: pointer;
  font-size: 20px;
}

.topbar-icon-button:hover,
.topbar-icon-button.active {
  background: var(--surface-subtle);
  color: var(--text);
}

.topbar-alert-count {
  position: absolute;
  right: 4px;
  top: 3px;
  min-width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  font-size: 9px;
  font-weight: 700;
}

.topbar-emergency-button.has-items,
.topbar-emergency-button.has-items:hover,
.topbar-emergency-button.has-items.active {
  background: #d92d20;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, .14);
}

.topbar-emergency-button.has-items .topbar-alert-count {
  border-color: #d92d20;
  background: #fff;
  color: #b42318;
}

.account-menu-wrap { position: relative; }

.account-menu-trigger {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-subtle);
  color: var(--text);
  padding: 4px 10px 4px 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.account-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #167d68;
  color: white;
  font-size: 11px;
  font-weight: 700;
}

.account-menu {
  position: absolute;
  z-index: 70;
  top: calc(100% + 7px);
  right: 0;
  width: 260px;
  display: grid;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(28, 27, 25, 0.15);
  padding: 12px;
}

.account-menu-email {
  margin: -12px -12px 4px;
  border-bottom: 1px solid var(--border);
  padding: 13px 14px;
  color: var(--muted);
  font-size: 12px;
}

.account-menu label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.account-menu select { width: 100%; }

.account-menu > button {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 0 8px;
  text-align: left;
  cursor: pointer;
}

.account-menu > button:hover { background: var(--surface-subtle); }
.account-menu > button i { font-size: 18px; }
.account-menu-status { border-top: 1px solid var(--border); padding: 9px 8px 0; color: var(--muted); font-size: 11px; }

body.calm-display { --background: #f7faf9; --surface-subtle: #eef6f3; }
body.calm-display .topbar-icon-button#topbar-theme { background: #e5f3ee; color: #167d68; }

@media (max-width: 1040px) {
  #account-name { display: none; }
  .global-search-wrap { width: min(280px, 38vw); }
}

main {
  width: min(1152px, 100%);
  min-height: 0;
  margin: 0 auto;
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 48px;
}

.app-shell.wide-workspace main {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.tabs {
  display: none;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 28px;
}

.tabs button,
.primary,
.secondary-button,
.danger,
.actions button,
.dialog-head button,
.table-action {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.tabs button:active,
.primary:active,
.secondary-button:active,
.danger:active,
.actions button:active,
.dialog-head button:active,
.table-action:active {
  transform: translateY(1px);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.tabs button {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.tabs button:hover {
  background: var(--surface-subtle);
}

.tabs button.active,
.primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.tabs button.active:hover,
.primary:hover {
  background: var(--primary-hover);
}

.secondary-button {
  border-color: var(--border);
  background: var(--background);
  color: var(--text);
}

.secondary-button:hover {
  background: var(--surface-subtle);
}

.secondary-button.compact {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.danger {
  background: var(--red);
  color: #fff;
}

.screen {
  display: none;
}

.active-screen {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

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

.date-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.date-control input {
  width: 150px;
  min-height: 34px;
  padding: 6px 9px;
}

.section-head.subhead {
  margin-top: 28px;
}

.call-log-layout {
  display: grid;
  gap: 16px;
}

.panel,
.table-frame,
.sheet-frame,
.card,
.audit-row {
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--text) 10%, transparent);
}

.panel {
  padding: 16px;
}

.quick-entry-panel {
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--text) 10%, transparent);
}

.grid {
  display: grid;
  gap: 12px;
}

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

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 24%, transparent);
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.auto-field {
  background: #f3f2ef;
  color: #55514b;
  cursor: default;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.table-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.filter-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.table-toolbar label {
  width: 220px;
}

.filter-row label {
  width: 180px;
}

.filter-row .call-search-field {
  width: min(320px, 100%);
}

.table-toolbar p {
  max-width: 720px;
  padding-bottom: 9px;
}

.auto-note {
  color: var(--muted);
  font-size: 12px;
}

.table-frame,
.sheet-frame {
  position: relative;
  overflow: auto;
  background: var(--surface-sheet);
}

.sheet-frame {
  border-radius: 12px;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: static;
  top: 0;
  z-index: 2;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

td {
  height: 36px;
  background: #fff;
}

tfoot td {
  background: #f5f4f1;
  font-weight: 800;
}

.call-log-table {
  min-width: 1240px;
}

.call-log-table th {
  background: #fff;
  color: var(--text);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.call-log-table tbody tr:hover td,
.lineup-table tbody tr:hover td,
.database-row:hover td,
.database-row.selected td {
  background: #fbfaf8;
}

.database-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.database-filters {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 14px;
}

.database-count {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.database-table-frame {
  min-height: 220px;
}

.database-table-frame table {
  min-width: 1040px;
}

.database-table-frame th:first-child,
.database-table-frame td:first-child {
  min-width: 220px;
}

.database-row {
  cursor: pointer;
}

.database-row.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

.address-label-dialog article {
  width: min(1080px, calc(100vw - 32px));
  max-width: none;
}

.address-label-dialog-body {
  display: grid;
  grid-template-columns: minmax(340px, .9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.label-settings-panel {
  display: grid;
  gap: 14px;
}

.label-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.label-summary article {
  width: auto;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.label-summary span,
.label-summary strong {
  display: block;
}

.label-summary span {
  color: var(--muted);
  font-size: 11px;
}

.label-summary strong {
  margin-top: 3px;
  font-size: 18px;
}

.label-position-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.label-position-picker button {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.label-position-picker button.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.label-position-picker button.used-before {
  background: #eee;
  color: #999;
}

.label-warning {
  color: #805e18;
  background: #fff4cf;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12px;
}

.label-advanced summary,
.label-skipped-details summary {
  cursor: pointer;
  font-weight: 650;
}

#address-label-skipped-list {
  max-height: 150px;
  overflow: auto;
  margin-top: 8px;
  font-size: 12px;
}

#address-label-skipped-list p {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.label-print-instructions {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 12px;
}

.label-print-instructions ul {
  margin: 7px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.label-preview-panel {
  position: sticky;
  top: 0;
}

.label-preview-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.address-label-preview {
  aspect-ratio: 8.5 / 11;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 0 2.27%;
  padding: 4.55% 2.2%;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.label-preview-cell {
  min-width: 0;
  overflow: hidden;
  border: 1px dashed #d2d2d2;
  padding: 4px;
  font-size: 7px;
  line-height: 1.12;
}

.label-preview-cell.blank {
  background: #f5f5f5;
}

.label-preview-cell strong,
.label-preview-cell span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.label-dialog-actions {
  flex-wrap: wrap;
}

.patient-profile-screen {
  max-width: 1180px;
}

.patient-profile-page {
  display: grid;
  gap: 14px;
}

.profile-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.patient-profile-card {
  display: grid;
  gap: 14px;
}

.patient-profile-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.patient-profile-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  white-space: nowrap;
  font-weight: 650;
}

.patient-profile-tab:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.patient-profile-tab.active {
  border-color: var(--border);
  background: var(--text);
  color: #fff;
}

.patient-profile-tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  padding: 0 6px;
  font-size: 11px;
}

.patient-profile-pane {
  display: none;
}

.patient-profile-pane.active {
  display: block;
}

.profile-treatment-panel,
.patient-journal-form {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfaf8;
  padding: 14px;
}

.profile-treatment-panel .actions,
.patient-journal-form .actions {
  margin-top: 12px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-record-selector {
  display: block;
  max-width: 620px;
  margin-bottom: 14px;
}

.field-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.patient-activity-list {
  border-top: 1px solid var(--border);
}

.patient-activity-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 110px;
  gap: 14px;
  align-items: start;
  border-bottom: 1px solid var(--border);
  padding: 14px 4px;
}

.patient-activity-date strong,
.patient-activity-date span {
  display: block;
}

.patient-activity-date span,
.patient-activity-author,
.patient-activity-item small {
  color: var(--muted);
  font-size: 0.78rem;
}

.patient-activity-item p {
  margin: 4px 0;
  white-space: pre-wrap;
}

.activity-kind {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.patient-activity-author {
  text-align: right;
}

.patient-journal-form {
  margin-top: 14px;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-head h2 {
  margin: 0;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 420px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: #efeeeb;
  color: #65625e;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
}

.tag-picker {
  position: relative;
  width: 100%;
}

.tag-picker summary {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 9px 34px 9px 11px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
}

.tag-picker summary::-webkit-details-marker {
  display: none;
}

.tag-picker summary::after {
  content: "⌄";
  position: absolute;
  right: 12px;
  top: 9px;
  color: var(--muted);
  font-size: 16px;
}

.tag-picker[open] summary {
  border-color: #cfcac2;
  box-shadow: 0 0 0 3px rgba(26, 26, 25, 0.04);
}

.tag-picker.disabled summary {
  cursor: default;
  color: var(--muted);
  background: var(--surface-subtle);
}

.patient-status-select {
  font-weight: 650;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.patient-status-select[data-patient-status="active"] {
  border-color: #9ccdb2;
  background-color: #e8f5ed;
  color: #176b43;
}

.patient-status-select[data-patient-status="inactive"] {
  border-color: #e1aaaa;
  background-color: #fdecec;
  color: #a12b2b;
}

.patient-status-select[data-patient-status="new_patient"] {
  border-color: #e2bd80;
  background-color: #fff2dd;
  color: #9a5b00;
}

.patient-status-select option[value="active"] {
  color: #176b43;
}

.patient-status-select option[value="inactive"] {
  color: #a12b2b;
}

.patient-status-select option[value="new_patient"] {
  color: #9a5b00;
}

.tag-picker-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px;
}

.tag-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
}

.tag-choice:hover {
  background: var(--surface-subtle);
}

.tag-choice input {
  width: auto;
  min-height: auto;
}

.profile-metrics {
  margin-top: 2px;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.profile-summary div {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfaf8;
  padding: 10px;
}

.profile-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.profile-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
}

.profile-edit-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfaf8;
  padding: 14px;
}

.profile-edit-panel .actions {
  margin-top: 10px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .patient-activity-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .patient-activity-author {
    grid-column: 2;
    text-align: left;
  }
}

.profile-save-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.profile-save-status[data-status="saved"] {
  color: #15803d;
}

.profile-save-status[data-status="saving"],
.profile-save-status[data-status="pending"] {
  color: #92400e;
}

.profile-save-status[data-status="error"] {
  color: #b91c1c;
}

.settings-panel {
  margin-bottom: 18px;
}

.compact-head {
  margin-bottom: 12px;
}

.compact-head h3 {
  margin: 0;
  font-size: 1.2rem;
}

.settings-inline-form {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.settings-inline-form label {
  min-width: min(360px, 100%);
  flex: 1;
}

.settings-inline-form button {
  min-height: 40px;
}

.settings-table-frame {
  margin-top: 8px;
}

.settings-name-input {
  min-width: 180px;
  width: min(300px, 100%);
}

.settings-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.settings-disclosures {
  display: grid;
  gap: 10px;
}

.settings-disclosure {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.settings-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  padding: 15px 17px;
}

.settings-disclosure summary::-webkit-details-marker {
  display: none;
}

.settings-disclosure summary > span:first-child {
  display: grid;
  gap: 3px;
}

.settings-disclosure summary strong {
  font-size: 15px;
}

.settings-disclosure summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.settings-chevron {
  color: var(--muted);
  font-size: 24px;
  transition: transform 160ms ease;
}

.settings-disclosure[open] .settings-chevron {
  transform: rotate(90deg);
}

.settings-disclosure-body {
  border-top: 1px solid var(--border);
  padding: 16px;
}

.rescheduling-table td {
  vertical-align: middle;
}

.rescheduling-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.removal-choice-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-subtle);
  padding: 13px;
}

.removal-choice-divider {
  position: relative;
  margin: 14px 0;
  text-align: center;
}

.removal-choice-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
}

.removal-choice-divider span {
  position: relative;
  background: var(--background);
  color: var(--muted);
  padding: 0 10px;
}

.rescheduling-queue-button {
  width: 100%;
  margin-bottom: 8px;
}

.household-alert {
  border: 1px solid #efd58d;
  border-radius: 12px;
  background: var(--amber-soft);
  color: #6b430d;
  padding: 10px 12px;
  font-size: 13px;
}

.mailing-controls {
  margin-bottom: 16px;
}

.mailing-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mailing-summary article {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
}

.mailing-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.mailing-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  line-height: 1;
}

.mailing-table-frame td {
  vertical-align: top;
}

.thank-you-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.thank-you-selection-copy {
  display: grid;
  gap: 2px;
  font-size: 12px;
}

.custom-mailing-mode-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.custom-mailing-mode {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
}

.custom-mailing-mode.new {
  background: color-mix(in oklch, var(--green) 12%, var(--background));
  color: var(--green);
}

.custom-mailing-mode.view {
  background: var(--surface-subtle);
  color: var(--muted);
}

.custom-mailing-mode.edit {
  background: #fff3d6;
  color: #8a5100;
}

.custom-mailing-update-summary {
  margin-bottom: 14px;
  border: 1px solid #e8c36b;
  border-radius: 10px;
  background: #fffaf0;
  padding: 14px;
  line-height: 1.5;
}

.duplicate-prevention-summary {
  grid-column: span 3;
}

.duplicate-prevention-summary small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.mailing-row-needs-attention td {
  background: #fffaf0;
}

.mailing-batch-workspace {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}

.mailing-batch-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mailing-batch-flow article,
.mailing-batch-metrics article {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
}

.mailing-batch-flow span,
.mailing-batch-metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.mailing-batch-flow strong,
.mailing-batch-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}

.mailing-batch-layout {
  display: grid;
  grid-template-columns: minmax(210px, .72fr) minmax(0, 2.28fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.mailing-batch-history {
  border-right: 1px solid var(--border);
  background: var(--surface-subtle);
  padding: 14px;
}

.mailing-batch-history-head {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.mailing-batch-history-head .secondary-button {
  width: 100%;
}

.mailing-batch-history-list {
  display: grid;
  gap: 8px;
}

.mailing-batch-history-item {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.mailing-batch-history-item:hover,
.mailing-batch-history-item.active {
  border-color: color-mix(in oklch, var(--green) 55%, var(--border));
  background: color-mix(in oklch, var(--green) 8%, var(--surface));
}

.mailing-batch-history-item span {
  color: var(--muted);
  font-size: 12px;
}

.mailing-batch-detail {
  min-width: 0;
  padding: 16px;
}

.mailing-batch-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.mailing-batch-detail-head h3 {
  margin: 3px 0 4px;
}

.mailing-batch-status,
.mailing-recipient-state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.mailing-batch-status.draft,
.mailing-recipient-state.ready {
  background: var(--green-soft);
  color: var(--green);
}

.mailing-batch-status.mailed,
.mailing-recipient-state.mailed {
  background: var(--blue-soft);
  color: var(--blue);
}

.mailing-recipient-state.excluded {
  background: var(--surface-subtle);
  color: var(--muted);
}

.mailing-recipient-state.blocked {
  background: var(--red-soft);
  color: var(--red);
}

.mailing-recipient-state.override {
  background: var(--amber-soft);
  color: var(--amber);
}

.mailing-batch-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.mailing-batch-override {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
  padding: 10px 12px;
  font-weight: 650;
}

.mailing-batch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.mailing-batch-safety-note {
  margin: 8px 0 0;
  text-align: right;
  font-size: 12px;
}

.mailing-row-muted td {
  background: var(--surface-subtle);
  color: var(--muted);
}

#mailing-thank-you-toolbar:not([hidden]) + #mailing-status-message:not([hidden]) {
  margin-bottom: 12px;
}

.marketing-period-panel {
  margin-bottom: 16px;
}

.marketing-period-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.spend-table-frame {
  margin-bottom: 22px;
}

.marketing-spend-cell {
  max-width: 160px;
}

.marketing-spend-cell .sheet-input {
  min-width: 96px;
}

.journey-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.journey-list h3 {
  margin: 2px 0 4px;
  font-size: 15px;
}

.journey-item {
  border-left: 2px solid var(--border);
  padding: 8px 0 8px 12px;
}

.journey-item p {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.notes-cell {
  min-width: 300px;
  white-space: normal;
}

.sheet-input,
.sheet-select {
  width: 100%;
  min-width: 96px;
  min-height: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 3px 7px;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  outline: none;
}

.sheet-input:hover,
.sheet-input:focus,
.sheet-select:hover,
.sheet-select:focus {
  border-color: var(--border-strong);
  background: #fff;
  box-shadow: none;
}

.sheet-input[type="date"] {
  min-width: 118px;
}

.sheet-select {
  border-radius: 999px;
  cursor: pointer;
}

.sheet-select.positive {
  background: #188257;
  color: white;
}

.sheet-select.negative {
  background: #c90808;
  color: white;
}

.sheet-select.pending {
  background: #ffe4a3;
  color: #6b430d;
}

.sheet-select.dark {
  background: var(--dark-pill);
  color: white;
}

.sheet-select.new-lead {
  background: #d7ebff;
  color: #087842;
}

.sheet-select.neutral {
  background: #e9ecef;
  color: #24292f;
}

.empty-cell {
  height: 56px;
  text-align: center;
  color: var(--muted);
}

.muted-cell {
  display: inline-block;
  color: #a4a19b;
  font-weight: 500;
  padding-inline: 8px;
}

.dropdown-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 20px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.dropdown-pill::after {
  content: "▾";
  margin-left: 7px;
  font-size: .8em;
}

.positive {
  background: #188257;
  color: white;
}

.negative {
  background: #c90808;
  color: white;
}

.pending {
  background: #ffe4a3;
  color: #6b430d;
}

.dark {
  background: var(--dark-pill);
  color: white;
}

.new-lead {
  background: #d7ebff;
  color: #087842;
}

.neutral {
  background: #e9ecef;
  color: #24292f;
}

.positive-soft {
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}

.pending-soft {
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
}

.danger-soft {
  border-radius: 999px;
  background: #fde8e7;
  color: #a12a24;
}

.neutral-soft {
  border-radius: 999px;
  background: #efeeeb;
  color: #65625e;
}

.negative-soft {
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
}

.table-action {
  min-height: 30px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 5px 8px;
  font-size: 11px;
}

.table-action:hover {
  background: var(--surface-subtle);
}

.danger-row-action {
  border-color: #e3b5b5;
  color: var(--red);
}

.danger-row-action:hover {
  background: var(--red-soft);
}

.quota-band {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 0;
  overflow: hidden;
  margin: 22px 0 24px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--text) 10%, transparent);
}

.morning-plan-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  border: 1px solid #d8c28c;
  border-radius: 12px;
  background: #fff8e6;
  padding: 13px 15px;
}

.morning-plan-prompt p {
  margin-top: 3px;
  color: #6d6042;
  font-size: 12px;
}

.morning-plan-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -14px 0 22px;
}

.morning-plan-meta .section-actions {
  align-items: center;
}

.monthly-goals input[readonly] {
  cursor: default;
}

.monthly-goals input:disabled {
  opacity: 1;
  color: var(--text);
}

.monthly-goals label {
  display: block;
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--border);
}

.monthly-goals label span,
.monthly-goals div span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.monthly-goals input {
  margin-top: 5px;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.monthly-goals input:focus {
  border: 0;
  box-shadow: none;
  background: rgba(255,255,255,.65);
}

.quota-band div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--border);
}

.quota-band div:last-child {
  border-right: 0;
}

.quota-band span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.quota-band strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.quota-focus {
  background: #eef7f5;
}

.quota-focus-alt {
  background: #eef3f9;
}

.morning-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 12px;
}

.lineup-table {
  min-width: 1220px;
  table-layout: fixed;
}

.morning-lineup-frame {
  overflow: visible;
}

.lineup-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 1px 0 var(--border);
}

.lineup-table td {
  height: 64px;
  vertical-align: top;
  font-size: 12px;
  line-height: 1.35;
}

.patient-identity-cell {
  min-width: 140px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.patient-identity-stack {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
}

.patient-identity-stack strong,
.patient-identity-stack span {
  display: block;
  min-width: 0;
}

.patient-identity-stack span {
  color: var(--muted);
  line-height: 1.3;
}

.morning-inline-text {
  min-height: 44px;
  height: auto;
  overflow: hidden;
  border-color: transparent;
  background: transparent;
  padding: 5px 6px;
  font-size: 12px;
  line-height: 1.4;
  resize: none;
}

.morning-inline-text:hover,
.morning-inline-text:focus,
.morning-money-input:hover,
.morning-money-input:focus {
  border-color: var(--border-strong);
  background: #fff;
  box-shadow: none;
}

.morning-money-input {
  min-width: 88px;
  height: 30px;
  border-color: transparent;
  background: transparent;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 750;
}

.morning-opportunity-value {
  display: block;
  margin-top: 5px;
}

.morning-opportunity-value .morning-money-input {
  display: block;
  width: 100%;
}

.inline-money-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  color: var(--muted);
}

.day-notes-section,
.history-section {
  margin-top: 18px;
}

.recent-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-day {
  min-width: 150px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.recent-day:hover {
  background: var(--surface-subtle);
}

.recent-day span {
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  min-height: 238px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 10px;
}

.empty-state h3 {
  color: var(--muted);
}

.audit-list,
.cards {
  display: grid;
  gap: 8px;
}

.pending-pipeline-screen {
  min-width: 0;
}

.pending-pipeline-head {
  align-items: flex-start;
  margin-bottom: 22px;
}

.pending-pipeline-head h2 {
  font-size: 30px;
  letter-spacing: -0.035em;
}

.pending-pipeline-head .muted {
  margin-top: 5px;
  font-size: 14px;
}

.pending-head-actions {
  display: grid;
  justify-items: end;
  gap: 18px;
}

.pending-head-actions .primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding-inline: 18px;
}

.pending-pipeline-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  font-size: 14px;
}

.pending-pipeline-summary strong:last-child {
  color: #13796f;
}

.pending-pipeline-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.pending-pipeline-toolbar label {
  position: relative;
  width: 180px;
}

.pending-pipeline-toolbar .pending-search-field {
  width: min(300px, 100%);
}

.pending-search-field i {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.pending-search-field input {
  padding-left: 36px;
}

.pending-pipeline-toolbar input,
.pending-pipeline-toolbar select {
  min-height: 40px;
  border-color: var(--border);
  background: var(--surface);
  font-size: 13px;
}

.pending-pipeline-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(245px, 1fr));
  gap: 8px;
  min-width: 1020px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.pending-pipeline-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 580px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fcfbf9;
  padding: 10px;
}

.pending-pipeline-column.drag-over {
  border-color: #178678;
  background: #eef8f6;
}

.pending-pipeline-column > header {
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  padding: 2px 4px 10px;
}

.pending-pipeline-column > header div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-pipeline-column > header strong {
  font-size: 14px;
}

.pending-stage-count {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #efeeeb;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pending-pipeline-column > header p {
  margin: 5px 0 0;
  color: #13796f;
  font-size: 13px;
  font-weight: 650;
}

.pending-stage-cards {
  display: grid;
  align-content: start;
  gap: 7px;
  flex: 1;
  padding-top: 8px;
}

.pending-pipeline-card {
  position: relative;
  display: grid;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px;
  cursor: grab;
}

.pending-pipeline-card.dragging {
  opacity: .45;
}

.pending-pipeline-card.overdue {
  border-left: 3px solid var(--red);
}

.pending-pipeline-card.due-today {
  border-left: 3px solid #168477;
}

.pending-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pending-card-head > strong {
  font-size: 14px;
}

.pending-card-menu {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
}

.pending-card-menu:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.pending-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-right: 34px;
}

.pending-card-tags span {
  border: 1px solid #e6be72;
  border-radius: 5px;
  background: #fffaf0;
  padding: 3px 6px;
  color: #5d4b2f;
  font-size: 10px;
  line-height: 1.1;
}

.pending-card-amount {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.pending-card-contact {
  min-height: 17px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.pending-card-next {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 7px;
  font-size: 11px;
}

.pending-card-next span {
  color: var(--muted);
}

.pending-card-next strong {
  color: var(--text);
  text-align: right;
}

.pending-pipeline-card.overdue .pending-card-next strong {
  color: var(--red);
}

.pending-owner-avatar {
  position: absolute;
  top: 48px;
  right: 11px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fbfaf7;
  color: var(--text);
  font-size: 9px;
  font-weight: 700;
}

.pending-stage-control select {
  width: 100%;
  min-height: 30px;
  border-color: transparent;
  background: var(--surface-subtle);
  padding: 5px 26px 5px 8px;
  color: #306b63;
  font-size: 10px;
  font-weight: 700;
}

.pending-stage-add {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: #13796f;
  padding: 8px 4px 2px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.pending-stage-empty {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px 12px;
  text-align: center;
  font-size: 11px;
}

.pending-pipeline-footnote {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.funnel-band {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.funnel-step {
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--text) 10%, transparent);
}

.funnel-step span,
.funnel-step small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.funnel-step strong {
  display: block;
  margin: 5px 0 3px;
  font-size: 28px;
  font-weight: 700;
}

.card {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.card-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in oklch, var(--background) 55%, white);
  padding: 10px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.audit-row {
  padding: 10px 12px;
}

.errors {
  margin-top: 12px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.import-help {
  margin-bottom: 14px;
  line-height: 1.5;
}

.import-preview {
  min-height: 34px;
  display: flex;
  align-items: center;
  white-space: pre-wrap;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  background: var(--surface-subtle);
  padding: 8px 10px;
}

.import-status {
  margin: 0 0 14px;
  border: 1px solid color-mix(in oklch, var(--green) 36%, var(--border));
  border-radius: 10px;
  background: color-mix(in oklch, var(--green) 10%, var(--background));
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 750;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.inline-check input {
  width: auto;
  min-height: auto;
}

dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 0;
  border-radius: 12px;
  background: var(--background);
  color: var(--text);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--text) 10%, transparent), var(--shadow);
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px 0;
}

.dialog-head button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--background);
  color: var(--text);
  padding: 0;
  font-size: 18px;
}

dialog .panel {
  margin: 18px;
  border: 0;
  padding: 0;
}

.morning-plan-help {
  max-width: 660px;
  margin-top: 6px;
  line-height: 1.45;
}

.morning-patient-help {
  max-width: 660px;
  margin-top: 6px;
  line-height: 1.45;
}

.morning-patient-results {
  display: grid;
  gap: 6px;
  max-height: 310px;
  overflow: auto;
  margin: 8px 0;
}

.morning-patient-result {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.morning-patient-result:hover,
.morning-patient-result:focus-visible {
  border-color: var(--green);
  background: #eef7f5;
}

.morning-patient-result span {
  display: grid;
  gap: 2px;
}

.morning-patient-result span:last-child {
  justify-items: end;
  text-align: right;
}

.morning-patient-result small,
.morning-patient-new span {
  color: var(--muted);
  font-size: 11px;
}

.morning-patient-new {
  display: grid;
  gap: 3px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: var(--surface-subtle);
  padding: 11px 12px;
}

.morning-status-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 34px;
  box-sizing: border-box;
  border: 0;
  border-radius: 999px;
  padding: 6px 26px 6px 9px;
  font-size: 11px;
  font-weight: 700;
}

.morning-row-actions {
  display: grid;
  align-content: start;
  gap: 6px;
}

.morning-row-actions .table-action {
  width: 100%;
  white-space: normal;
  line-height: 1.2;
}

.morning-order-controls {
  display: grid;
  grid-template-columns: minmax(30px, 1fr) auto minmax(30px, 1fr);
  align-items: center;
  gap: 4px;
}

.morning-order-controls span,
.morning-order-readonly {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.morning-order-controls .morning-order-button {
  width: 100%;
  min-height: 30px;
  padding: 3px 7px;
  font-size: 16px;
  line-height: 1;
}

.care-share-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.care-share-summary > div {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  padding: 13px 15px;
}

.care-share-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.care-share-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.care-share-summary .care-share-success {
  border-color: color-mix(in oklch, var(--green) 35%, var(--border));
  background: #eef7f5;
}

.care-share-summary .care-share-warning {
  border-color: color-mix(in oklch, var(--amber) 42%, var(--border));
  background: color-mix(in oklch, var(--amber) 9%, var(--surface));
}

.care-share-default-expiration {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.care-share-default-expiration strong {
  color: var(--text);
  font-size: 18px;
}

.care-share-default-expiration button {
  grid-column: 1 / -1;
  justify-self: end;
}

.care-share-status-stack {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.care-share-timing {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.care-share-timing.is-expiring,
.care-share-timing.is-expired {
  border-radius: 999px;
  padding: 3px 7px;
  font-weight: 700;
}

.care-share-timing.is-expiring {
  background: color-mix(in oklch, var(--amber) 12%, var(--surface));
  color: color-mix(in oklch, var(--amber) 70%, var(--text));
}

.care-share-timing.is-expired {
  background: color-mix(in oklch, var(--red) 10%, var(--surface));
  color: var(--red);
}

@media (max-width: 900px) {
  .care-share-summary { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}

.care-share-table-frame {
  margin-top: 10px;
}

.care-share-table td {
  vertical-align: middle;
}

.morning-plan-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, .55fr);
  gap: 12px;
  margin-bottom: 16px;
}

.morning-plan-summary > div {
  display: grid;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
  padding: 10px 12px;
}

.morning-plan-summary > div span {
  color: var(--muted);
  font-size: 11px;
}

.morning-plan-summary > div strong {
  margin-top: 4px;
  font-size: 22px;
}

.morning-plan-migration {
  margin-bottom: 14px;
  border: 1px solid #c6d8d2;
  border-radius: 10px;
  background: #eef7f5;
  color: #355b50;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
}

.morning-calendar-fieldset {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.morning-calendar-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
}

.morning-calendar-weekdays,
.morning-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.morning-calendar-weekdays {
  margin-bottom: 6px;
}

.morning-calendar-weekdays span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.morning-calendar-day {
  min-height: 58px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px;
  cursor: pointer;
}

.morning-calendar-day:hover {
  border-color: var(--border-strong);
}

.morning-calendar-day.selected {
  border-color: #83b6a6;
  background: #eef7f5;
  color: #1f5d4a;
}

.morning-calendar-day input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.morning-calendar-day span {
  font-size: 16px;
  font-weight: 750;
}

.morning-calendar-day small {
  font-size: 9px;
  font-weight: 650;
  text-transform: uppercase;
}

.routing-slip-help {
  max-width: 690px;
  margin-top: 6px;
  line-height: 1.45;
}

.routing-slip-preview {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.routing-slip-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 13px;
}

.routing-slip-card.duplicate {
  border-color: #d8c28c;
  background: #fffaf0;
}

.routing-slip-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.routing-slip-card-head label {
  width: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.routing-slip-card-head input {
  width: auto;
  min-height: auto;
}

.routing-slip-meta,
.routing-slip-treatment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.routing-slip-meta div,
.routing-slip-treatment-block {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-subtle);
  padding: 9px 10px;
}

.routing-slip-meta span,
.routing-slip-treatment-block > span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.routing-slip-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.routing-slip-treatment-block {
  grid-column: span 2;
}

.routing-slip-procedure-list {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.routing-slip-procedure {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 8px;
  font-size: 12px;
}

.routing-slip-procedure strong:last-child {
  font-variant-numeric: tabular-nums;
}

.routing-slip-warning {
  color: #805e18;
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 980px) {
  .pending-pipeline-toolbar {
    flex-wrap: wrap;
  }

  .pending-pipeline-toolbar label {
    flex: 1 1 180px;
  }

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

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

  .morning-plan-meta,
  .morning-plan-prompt {
    align-items: flex-start;
  }

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

  .database-filters {
    position: static;
  }

  .address-label-dialog-body {
    grid-template-columns: 1fr;
  }

  .label-preview-panel {
    position: static;
  }

  .thank-you-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .mailing-batch-history {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .mailing-batch-history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mailing-batch-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .marketing-period-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .topbar,
  .section-head,
  .morning-heading {
    height: auto;
    display: grid;
    align-items: start;
  }

  .pending-head-actions {
    width: 100%;
    justify-items: start;
  }

  .pending-pipeline-toolbar {
    display: grid;
  }

  .pending-pipeline-toolbar label,
  .pending-pipeline-toolbar .pending-search-field {
    width: 100%;
  }

  .topbar {
    min-height: 60px;
    padding: 10px 12px;
    grid-template-columns: 1fr auto;
  }

  .global-search-wrap {
    width: 100%;
    margin-left: 0;
  }

  .topbar-actions { margin-left: 0; }

  .account-menu {
    position: fixed;
    top: 68px;
    right: 12px;
  }

  .role-picker {
    min-width: 0;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    display: grid;
    align-items: start;
  }

  .profile-head {
    display: grid;
  }

  .profile-summary {
    grid-template-columns: 1fr;
  }

  .marketing-period-grid {
    grid-template-columns: 1fr;
  }

  main {
    padding: 20px 14px 40px;
  }

  .grid.two,
  .grid.four,
  .card-row,
  .quota-band {
    grid-template-columns: 1fr;
  }

  .mailing-batch-flow,
  .mailing-batch-history-list,
  .mailing-batch-metrics {
    grid-template-columns: 1fr;
  }

  .mailing-batch-detail-head,
  .mailing-batch-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mailing-batch-actions button {
    width: 100%;
  }

  .morning-plan-summary {
    grid-template-columns: 1fr;
  }

  .routing-slip-meta,
  .routing-slip-treatment-grid {
    grid-template-columns: 1fr;
  }

  .routing-slip-treatment-block {
    grid-column: auto;
  }

  .morning-calendar-weekdays,
  .morning-calendar {
    gap: 3px;
  }

  .morning-calendar-day {
    min-height: 48px;
    padding: 3px;
  }

  .wide-field {
    grid-column: auto;
  }
}
/* Secure patient surveys */
.survey-page-head { align-items: flex-start; }
.vault-boundary-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 12px; border: 1px solid #bbf7d0; border-radius: 999px; background: #f0fdf4; color: #166534; font-size: 12px; font-weight: 700; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.survey-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.survey-campaign-sidebar { position: sticky; top: 14px; padding: 14px; }
.survey-icon-button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border-radius: 10px; }
.survey-campaign-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 12px; padding: 4px; border-radius: 10px; background: #f1f5f9; }
.survey-campaign-tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 5px 8px; border: 0; border-radius: 7px; background: transparent; color: #64748b; font-size: 11px; font-weight: 800; }
.survey-campaign-tabs button.active { background: #fff; color: #0f766e; box-shadow: 0 1px 3px rgba(15,23,42,.10); }
.survey-campaign-tabs span { min-width: 18px; padding: 2px 5px; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 10px; }
.survey-campaign-tabs button.active span { background: #ccfbf1; color: #115e59; }
.survey-list { display: grid; gap: 8px; margin-top: 12px; }
.survey-list-empty { min-height: 118px; display: grid; place-items: center; align-content: center; gap: 7px; color: #94a3b8; text-align: center; font-size: 12px; }
.survey-list-empty i { font-size: 26px; }
.survey-campaign-card { width: 100%; display: flex; justify-content: space-between; gap: 10px; padding: 13px; text-align: left; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; background: #fff; color: inherit; }
.survey-campaign-card:hover, .survey-campaign-card.active { border-color: #5eead4; background: #f0fdfa; box-shadow: 0 0 0 2px rgba(20,184,166,.08); }
.survey-campaign-card > span { display: grid; gap: 4px; min-width: 0; }
.survey-campaign-card strong, .survey-campaign-card small { overflow: hidden; text-overflow: ellipsis; }
.survey-campaign-card small { color: #6b7280; font-size: 11px; }
.survey-card-meta { text-align: right; justify-items: end; flex: 0 0 auto; }
.survey-status { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #f3f4f6; color: #4b5563; font-size: 10px; font-style: normal; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.survey-status.active { background: #dcfce7; color: #166534; }
.survey-status.paused { background: #fef3c7; color: #92400e; }
.survey-status.completed { background: #dbeafe; color: #1d4ed8; }
.survey-status.archived { background: #e2e8f0; color: #475569; }
.survey-detail { min-width: 0; }
.survey-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.survey-campaign-actions { justify-content: flex-end; flex-wrap: wrap; }
.survey-delete-button { min-height: 36px; border: 1px solid transparent; background: transparent; color: #b91c1c; padding-inline: 10px; font-size: 12px; font-weight: 750; }
.survey-delete-button:hover { border-color: #fecaca; background: #fef2f2; }
.survey-archive-banner { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid #cbd5e1; border-radius: 12px; background: #f8fafc; color: #475569; font-size: 12px; line-height: 1.45; }
.survey-archive-banner i { flex: 0 0 auto; margin-top: 1px; color: #64748b; font-size: 18px; }
.survey-detail-archived .survey-designer-panel, .survey-detail-archived .survey-enrollment-panel, .survey-detail-archived .survey-lower-grid { background: #fbfcfd; }
.survey-detail-archived :disabled { cursor: not-allowed; }
.survey-back-link { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 8px; color: #6b7280; font-size: 12px; font-weight: 700; text-decoration: none; }
.survey-title-line { display: flex; align-items: center; gap: 9px; }
.survey-title-line h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(24px, 3vw, 34px); }
.survey-name-edit { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; color: #64748b; border-radius: 8px; }
.survey-name-edit:hover { background: #f1f5f9; color: #0f766e; }
.survey-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.survey-metrics > div { min-height: 104px; padding: 15px; border: 1px solid var(--line, #e5e7eb); border-radius: 14px; background: #fff; display: grid; align-content: center; gap: 6px; }
.survey-metrics > div.attention { border-color: #99f6e4; background: #f0fdfa; }
.survey-metrics > div.primary { border-color: #0f766e; background: #0f766e; color: #fff; box-shadow: 0 12px 24px rgba(15,118,110,.18); }
.survey-metrics span { color: #6b7280; font-size: 11px; font-weight: 800; }
.survey-metrics strong { font-size: 24px; line-height: 1; }
.survey-metrics small { color: #64748b; font-size: 10px; font-weight: 700; }
.survey-metrics .primary span, .survey-metrics .primary small { color: #d9fffa; }
.survey-insight-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 14px; margin-bottom: 14px; }
.survey-insight-grid > .panel { min-height: 190px; padding: 16px; }
.survey-insight-grid h3 { margin: 0; font-family: Georgia, serif; }
.survey-insight-grid .panel-heading > span { color: #64748b; font-size: 12px; font-weight: 800; }
.survey-insight-empty { min-height: 120px; display: grid; place-items: center; margin: 0; color: #94a3b8; text-align: center; }
.survey-referral-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.survey-referral-tags span { padding: 7px 10px; border-radius: 999px; background: #ecfeff; color: #155e75; font-size: 12px; font-weight: 700; }
.survey-testimonials { display: grid; gap: 10px; margin-top: 14px; max-height: 190px; overflow: auto; }
.survey-testimonials blockquote { margin: 0; padding-left: 12px; border-left: 3px solid #cbd5e1; color: #334155; font-family: Georgia, serif; font-style: italic; line-height: 1.45; }
.survey-testimonials cite { display: block; margin-top: 4px; color: #94a3b8; font-family: Inter, sans-serif; font-size: 10px; font-style: normal; }
.survey-enrollment-panel, .survey-lower-grid > .panel, .survey-designer-panel { padding: 17px; }
.survey-enrollment-panel { margin-top: 14px; }
.survey-patient-options { max-height: 270px; overflow: auto; display: grid; gap: 6px; margin-top: 10px; }
.survey-patient-options label { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; background: #fff; }
.survey-patient-options label:has(input:disabled) { opacity: .55; }
.survey-patient-options span { display: grid; gap: 2px; }
.survey-patient-options small, .survey-patient-options em { color: #6b7280; font-size: 11px; font-style: normal; }
.survey-enrollment-dialog { width: min(760px, calc(100vw - 30px)); }
.survey-enrollment-dialog > article { width: 100%; max-height: min(88vh, 820px); overflow: auto; }
.survey-enrollment-dialog .dialog-head { padding-bottom: 15px; }
.survey-enrollment-dialog .dialog-head h2 { margin-bottom: 4px; }
.survey-enrollment-dialog .panel { padding: 0 18px 18px; }
.survey-enrollment-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 5px; border-radius: 13px; background: #f1f5f9; }
.survey-enrollment-tabs > button { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px; min-width: 0; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #475569; text-align: left; }
.survey-enrollment-tabs > button i { font-size: 19px; }
.survey-enrollment-tabs > button span { display: grid; gap: 2px; font-size: 12px; font-weight: 850; }
.survey-enrollment-tabs > button small { color: #94a3b8; font-size: 9px; font-weight: 700; }
.survey-enrollment-tabs > button.active { border-color: #99f6e4; background: #fff; color: #0f766e; box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.survey-enrollment-tabs > button.active small { color: #5b7875; }
.survey-enrollment-body { min-height: 300px; padding: 18px 0 4px; }
.survey-enrollment-source { display: grid; gap: 13px; }
.survey-enrollment-source > label, .survey-enrollment-source .survey-name-import-head > label:first-child { display: grid; gap: 6px; font-weight: 800; }
.survey-enrollment-source label span { color: #64748b; font-size: 11px; font-weight: 600; }
.survey-enrollment-snapshot { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid #bae6fd; border-radius: 10px; background: #f0f9ff; color: #475569; font-size: 11px; line-height: 1.45; }
.survey-enrollment-snapshot i { margin-top: 1px; color: #0369a1; font-size: 18px; }
.survey-enrollment-snapshot span { display: grid; gap: 2px; }
.survey-enrollment-review { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.survey-enrollment-review > div { display: grid; gap: 3px; padding: 13px; border: 1px solid #e2e8f0; border-radius: 11px; background: #fff; }
.survey-enrollment-review > div.ready { border-color: #99f6e4; background: #f0fdfa; }
.survey-enrollment-review strong { font-size: 21px; line-height: 1; }
.survey-enrollment-review span { color: #64748b; font-size: 10px; font-weight: 750; }
.survey-enrollment-ready-names { margin: 0; color: #64748b; font-size: 11px; line-height: 1.55; }
.survey-enrollment-ready-names > span { color: #0f766e; font-weight: 800; }
.survey-name-import-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.survey-file-button { display: inline-flex !important; grid-template-columns: none !important; align-items: center; width: auto; cursor: pointer; white-space: nowrap; }
.survey-file-status { min-height: 18px; margin: -5px 0 0; color: #64748b; font-size: 10px; }
.survey-file-status i { color: #0f766e; }
.survey-enrollment-prompt { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 90px; border: 1px dashed #cbd5e1; border-radius: 11px; color: #64748b; font-size: 12px; }
.survey-enrollment-prompt i { font-size: 18px; }
.survey-enrollment-detail { padding: 9px 11px; border: 1px solid #fed7aa; border-radius: 9px; background: #fff7ed; color: #9a3412; font-size: 11px; }
.survey-enrollment-detail summary { cursor: pointer; font-weight: 800; }
.survey-enrollment-detail p { margin: 7px 0 0; line-height: 1.45; }
.survey-enrollment-patient-options { max-height: 310px; margin-top: 0; padding-right: 3px; }
.survey-enrollment-empty { min-height: 270px; display: grid; place-items: center; align-content: center; gap: 8px; color: #64748b; text-align: center; }
.survey-enrollment-empty > i { color: #0f766e; font-size: 34px; }
.survey-enrollment-empty h3, .survey-enrollment-empty p { margin: 0; }
.survey-enrollment-empty p { max-width: 440px; font-size: 12px; line-height: 1.5; }
.survey-enrollment-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.survey-enrollment-footer p { display: grid; gap: 3px; margin: 0; }
.survey-enrollment-footer p strong { font-size: 12px; }
.survey-enrollment-footer p span { color: #64748b; font-size: 10px; }
.survey-enrollment-footer .actions { margin: 0; }
.survey-recipient-table-wrap { overflow: auto; margin-top: 12px; }
.survey-recipient-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.survey-recipient-table th, .survey-recipient-table td { padding: 11px 8px; border-bottom: 1px solid #eef0f2; text-align: left; vertical-align: middle; white-space: nowrap; }
.survey-recipient-table td:first-child { display: grid; gap: 2px; min-width: 150px; }
.survey-recipient-table td small { color: #6b7280; }
.survey-mini-action { padding: 5px 7px; border: 0; background: transparent; color: #0f766e; font-size: 11px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.survey-opened, .survey-complete { display: inline-flex; gap: 5px; align-items: center; font-weight: 700; }
.survey-opened { color: #0f766e; }
.survey-complete { color: #15803d; }
.survey-credit { display: inline-flex; margin-right: 5px; padding: 3px 7px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 10px; font-weight: 800; text-transform: capitalize; }
.survey-credit.redeemed { background: #dcfce7; color: #166534; }
.survey-credit.voided, .survey-credit.expired { background: #f3f4f6; color: #6b7280; }
.survey-designer-panel { margin-top: 14px; overflow: hidden; }
.survey-designer-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.survey-designer-heading h3 { margin: 1px 0 4px; font-family: Georgia, serif; font-size: 24px; }
.survey-preview-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 5px 9px; border-radius: 999px; background: #fff7ed; color: #9a3412; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.survey-design-save { display: flex; align-items: center; gap: 10px; }
.survey-design-save span { color: #64748b; font-size: 11px; font-weight: 700; }
.survey-design-save span.dirty { color: #b45309; }
.survey-designer-tabs { display: inline-grid; grid-template-columns: 1fr 1fr; margin: 16px 0 12px; padding: 4px; border-radius: 10px; background: #f1f5f9; }
.survey-designer-tabs button { min-width: 78px; padding: 8px 13px; border: 0; border-radius: 7px; background: transparent; font-weight: 800; }
.survey-designer-tabs button.active { background: #fff; box-shadow: 0 1px 5px rgba(15,23,42,.12); }
.survey-simple-designer { display: grid; grid-template-columns: minmax(270px, .7fr) minmax(430px, 1.25fr); gap: 22px; align-items: start; }
.survey-simple-controls { display: grid; gap: 13px; }
.survey-simple-controls label { display: grid; gap: 6px; font-weight: 750; }
.survey-simple-note { display: flex; gap: 8px; padding: 11px; border-radius: 10px; background: #f8fafc; color: #64748b; font-size: 12px; line-height: 1.4; }
.survey-format-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 4px; border-radius: 10px; background: #f3f4f6; }
.survey-format-tabs button { padding: 8px 5px; border: 0; border-radius: 7px; background: transparent; text-transform: capitalize; font-size: 11px; font-weight: 800; }
.survey-format-tabs button.active { background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.12); }
.survey-print-actions { display: flex; justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
.survey-preview-only { max-width: 330px; color: #64748b; font-size: 11px; line-height: 1.4; }
.survey-design-preview-shell { display: grid; place-items: center; min-width: 0; padding: 18px; border: 1px solid #e2e8f0; border-radius: 14px; background: #f8fafc; overflow: auto; }
.survey-design-preview-shell.canvas { align-items: start; min-height: 650px; background-color: #edf1f4; background-image: linear-gradient(#dde3e8 1px, transparent 1px), linear-gradient(90deg, #dde3e8 1px, transparent 1px); background-size: 18px 18px; }
.survey-design-stage { position: relative; width: min(100%, 520px); aspect-ratio: 612 / 792; flex: 0 0 auto; overflow: hidden; background: var(--survey-design-background); box-shadow: 0 16px 34px rgba(15,23,42,.16); transform-origin: top center; }
.survey-design-stage[data-material-format="postcard"] { width: min(100%, 620px); aspect-ratio: 1.55 / 1; }
.survey-design-stage[data-material-format="flyer"] { border-radius: 8px; }
.survey-design-element { position: absolute; box-sizing: border-box; user-select: none; touch-action: none; }
.survey-design-stage.editable .survey-design-element { cursor: move; }
.survey-design-stage.editable .survey-design-element:hover { outline: 1px dashed #14b8a6; }
.survey-design-stage.editable .survey-design-element.selected { outline: 2px solid #3b82f6; outline-offset: 1px; }
.survey-design-text { width: 100%; height: 100%; overflow: hidden; line-height: 1.32; white-space: normal; }
.survey-design-element img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.survey-design-element.type-image img:not(.survey-design-qr) { object-fit: contain; }
.survey-design-qr { padding: 6%; background: #fff; image-rendering: pixelated; }
.survey-design-shape { width: 100%; height: 100%; }
.survey-design-shape.circle { border-radius: 50% !important; }
.survey-design-placeholder { display: grid; place-items: center; width: 100%; height: 100%; border: 2px dashed #94a3b8; background: rgba(255,255,255,.7); color: #64748b; font-size: 30px; }
.survey-resize-handle { position: absolute; right: -7px; bottom: -7px; width: 15px; height: 15px; padding: 0; border: 2px solid #fff; border-radius: 4px; background: #3b82f6; box-shadow: 0 1px 4px rgba(15,23,42,.3); cursor: nwse-resize; }
.survey-canvas-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px; border: 1px solid #e2e8f0; border-radius: 11px; background: #fff; }
.survey-canvas-toolbar button { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #334155; font-weight: 750; }
.survey-canvas-toolbar button:hover { border-color: #99f6e4; background: #f0fdfa; }
.survey-canvas-toolbar button.danger { color: #b91c1c; }
.survey-toolbar-separator { width: 1px; height: 25px; margin: 0 3px; background: #e2e8f0; }
.survey-canvas-workspace { display: grid; grid-template-columns: minmax(430px, 1fr) 245px; gap: 13px; margin-top: 12px; align-items: start; }
.survey-design-inspector { min-height: 420px; padding: 15px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; }
.survey-design-inspector h4 { margin: 0 0 13px; font-size: 16px; }
.survey-design-inspector label, .survey-inspector-empty { display: grid; gap: 6px; }
.survey-design-inspector .grid { margin-top: 12px; }
.survey-inspector-empty { align-content: start; justify-items: stretch; color: #64748b; text-align: center; }
.survey-inspector-empty > i { margin: 20px auto 4px; font-size: 38px; color: #94a3b8; }
.survey-inspector-empty label { margin-top: 20px; text-align: left; }
.survey-canvas-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 12px; color: #64748b; font-size: 11px; }
.survey-canvas-footer > div { display: flex; gap: 8px; flex-wrap: wrap; }
.survey-material-empty, .survey-empty-copy { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; color: #6b7280; }
.survey-lower-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.survey-response-list, .survey-credit-list { display: grid; gap: 10px; margin-top: 12px; max-height: 420px; overflow: auto; }
.survey-response-list article, .survey-credit-list article { padding: 12px; border: 1px solid #eef0f2; border-radius: 11px; background: #fafafa; }
.survey-response-list header, .survey-credit-list article { display: flex; justify-content: space-between; gap: 12px; }
.survey-response-list time, .survey-response-list small, .survey-credit-list small { color: #6b7280; font-size: 11px; }
.survey-response-list article > div { margin-top: 10px; }
.survey-response-list p { margin: 3px 0 0; }
.survey-credit-list span:first-child { display: grid; gap: 3px; }
.survey-empty { min-height: 420px; display: grid; place-items: center; align-content: center; text-align: center; }
.survey-empty > i { font-size: 48px; color: #14b8a6; }
.survey-campaign-dialog > article { width: min(920px, calc(100vw - 30px)); max-height: 90vh; overflow: auto; }
.survey-campaign-lifecycle-dialog { width: min(560px, calc(100vw - 30px)); }
.survey-campaign-lifecycle-dialog > article { width: 100%; }
.survey-lifecycle-copy { display: grid; justify-items: start; gap: 8px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; }
.survey-lifecycle-copy p { margin: 0; color: #475569; line-height: 1.5; }
.survey-lifecycle-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #e2e8f0; color: #475569; font-size: 20px; }
.survey-lifecycle-icon.danger { background: #fee2e2; color: #b91c1c; }
#survey-delete-confirmation-row { margin-top: 16px; line-height: 1.35; }
.survey-lifecycle-actions { justify-content: flex-end; margin-top: 16px; }
.survey-lifecycle-actions .danger { border-color: #b91c1c; background: #b91c1c; }
.survey-lifecycle-actions .danger:hover:not(:disabled) { background: #991b1b; }
.survey-lifecycle-actions button:disabled { opacity: .45; cursor: not-allowed; }
.survey-question-builder { display: grid; gap: 10px; }
.survey-question-builder-head { display: grid; justify-items: start; gap: 9px; }
.survey-question-builder-head > div { display: grid; gap: 3px; }
.survey-question-builder-head .muted { font-size: 12px; font-weight: 500; }
.survey-question-builder-head .secondary-button { max-width: 100%; }
.survey-question-builder-note { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 9px 11px; border-radius: 9px; background: #ecfeff; color: #155e75; font-size: 11px; line-height: 1.4; }
.survey-question-builder-note i { flex: 0 0 auto; margin-top: 1px; font-size: 15px; }
.survey-question-list { display: grid; gap: 10px; }
.survey-question-card { display: grid; gap: 12px; padding: 14px; border: 1px solid #dbe4e8; border-radius: 13px; background: #f8fafc; }
.survey-question-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.survey-question-number { color: #0f766e; font-size: 12px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.survey-question-actions { display: flex; gap: 5px; }
.survey-question-actions button { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 1px solid #dbe4e8; border-radius: 8px; background: #fff; color: #475569; }
.survey-question-actions button:hover:not(:disabled) { border-color: #5eead4; background: #f0fdfa; color: #0f766e; }
.survey-question-actions button.danger:hover:not(:disabled) { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.survey-question-actions button:disabled { opacity: .35; cursor: default; }
.survey-question-card-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .72fr); gap: 12px; align-items: end; }
.survey-question-card-grid > label { display: grid; gap: 6px; }
.survey-question-prompt, .survey-question-options { grid-column: 1 / -1; }
.survey-question-flags { display: flex; align-items: center; gap: 18px; min-height: 44px; padding: 0 4px; }
.survey-question-flags .inline-check { display: flex; align-items: center; gap: 7px; margin: 0; white-space: nowrap; }
.survey-question-options[hidden] { display: none; }
.survey-question-options .muted, .survey-question-options small { font-size: 11px; font-weight: 500; }
.survey-delivery-options { display: flex; gap: 18px; padding: 12px; border: 1px solid #e5e7eb; border-radius: 11px; }
.survey-delivery-options legend { padding: 0 6px; font-weight: 700; }
.public-survey-screen { position: fixed; inset: 0; z-index: 10000; overflow: auto; padding: 28px 16px; background: linear-gradient(160deg, #ecfeff, #f8fafc 45%, #f0fdf4); }
.public-survey-card { width: min(620px, 100%); margin: 0 auto; padding: clamp(22px, 5vw, 42px); border: 1px solid #dbe4e8; border-radius: 22px; background: #fff; box-shadow: 0 25px 65px rgba(15,23,42,.12); }
.public-survey-card > img { width: 190px; max-width: 55%; }
.public-survey-card h1 { margin: 10px 0; font-size: clamp(28px, 7vw, 42px); }
#public-survey-questions { display: grid; gap: 22px; margin: 28px 0 20px; }
#public-survey-questions > label, #public-survey-questions fieldset { display: grid; gap: 9px; padding: 0; border: 0; font-weight: 700; }
#public-survey-questions textarea, #public-survey-questions input[type="text"] { width: 100%; font: inherit; font-weight: 400; }
.public-rating > div { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.public-rating label input { position: absolute; opacity: 0; }
.public-rating label span { display: grid; place-items: center; height: 48px; border: 1px solid #cbd5e1; border-radius: 10px; }
.public-rating label:has(input:checked) span { border-color: #0f766e; background: #ccfbf1; color: #115e59; }
.public-rating small { color: #6b7280; font-weight: 400; }
.public-choice-question { display: grid; gap: 10px; }
.public-choice-options { display: grid; gap: 8px; }
.public-choice-options label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; border: 1px solid #dbe4e8; border-radius: 10px; background: #fff; font-weight: 500; cursor: pointer; }
.public-choice-options label:has(input:checked) { border-color: #5eead4; background: #f0fdfa; color: #115e59; }
.public-choice-options input { width: auto; margin: 0; }
.public-choice-question small { color: #64748b; font-weight: 400; }
.public-consent { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0 20px; color: #475569; font-size: 13px; line-height: 1.4; }
.public-survey-form > button, #public-survey-form > button { width: 100%; min-height: 48px; }
.public-survey-state { min-height: 380px; display: grid; place-items: center; align-content: center; text-align: center; }
.public-survey-state i { font-size: 62px; color: #64748b; }
.public-survey-state.complete i { color: #16a34a; }
.vault-notice { position: fixed; right: 22px; bottom: 22px; z-index: 12000; max-width: 380px; padding: 13px 16px; border-radius: 12px; background: #0f172a; color: #fff; box-shadow: 0 12px 30px rgba(15,23,42,.25); font-weight: 700; }
.vault-notice.error { background: #991b1b; }
.public-survey-mode > :not(#public-survey-screen) { display: none !important; }

/* Emergency website intake queue */
.emergency-screen { --line: var(--border); --panel: var(--surface); --ink: var(--text); --brand: var(--green); --emergency-red: #b42318; --emergency-red-soft: #fff1ef; --emergency-amber: #b54708; --emergency-amber-soft: #fff7e8; }
.emergency-head { align-items: flex-start; }
.emergency-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); overflow: hidden; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.emergency-summary > div { display: grid; gap: 5px; min-height: 96px; padding: 20px 22px; border-right: 1px solid var(--line); }
.emergency-summary > div:last-child { border-right: 0; }
.emergency-summary span { color: var(--muted); font-size: 13px; font-weight: 650; }
.emergency-summary strong { color: var(--ink); font-size: 28px; letter-spacing: -.04em; }
.emergency-summary-primary { background: var(--emergency-red-soft); }
.emergency-summary-primary strong { color: var(--emergency-red); }
.emergency-toolbar { display: grid; grid-template-columns: minmax(240px,1fr) auto minmax(280px,auto); align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px; }
.emergency-toolbar label,.emergency-toolbar p { margin: 0; }
.emergency-toolbar p { text-align: right; }
.emergency-search { position: relative; }
.emergency-search i { position: absolute; top: 50%; left: 13px; z-index: 1; transform: translateY(-50%); color: var(--muted); }
.emergency-search input { width: 100%; padding-left: 38px; }
.emergency-lead-list { display: grid; gap: 12px; }
.emergency-lead-card { position: relative; display: grid; grid-template-columns: minmax(0,1fr) minmax(210px,250px); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 8px 24px rgba(25,35,48,.045); }
.emergency-priority-rail { position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--emergency-red); }
.emergency-lead-card.reopen-priority .emergency-priority-rail { background: var(--emergency-amber); }
.emergency-lead-main { min-width: 0; padding: 20px 22px 18px 27px; }
.emergency-lead-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.emergency-lead-title-row h3 { margin: 8px 0 3px; font-size: 21px; letter-spacing: -.025em; }
.emergency-priority-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--emergency-red-soft); color: var(--emergency-red); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.emergency-priority-badge.reopen { background: var(--emergency-amber-soft); color: var(--emergency-amber); }
.emergency-phone { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; font-weight: 650; text-decoration: none; }
.emergency-phone:hover { color: var(--brand); }
.emergency-submitted { display: grid; flex: 0 0 auto; gap: 4px; text-align: right; }
.emergency-submitted span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.emergency-submitted strong { font-size: 14px; }
.emergency-lead-facts { display: grid; grid-template-columns: repeat(4,minmax(115px,1fr)); gap: 10px; margin-top: 18px; }
.emergency-lead-facts > div { display: grid; align-content: start; gap: 4px; min-height: 68px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); }
.emergency-lead-facts span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.emergency-lead-facts strong { font-size: 14px; line-height: 1.25; }
.emergency-lead-facts small { color: var(--muted); overflow-wrap: anywhere; }
.emergency-match-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 11px; background: var(--surface-subtle); }
.emergency-match-row.has-match { background: #fff8e8; color: #7a4c00; }
.emergency-match-row i { font-size: 21px; }
.emergency-match-row div { display: grid; gap: 2px; }
.emergency-match-row strong { font-size: 13px; }
.emergency-match-row span { color: currentColor; font-size: 12px; opacity: .78; }
.emergency-last-attempt { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.emergency-lead-actions { display: grid; align-content: center; gap: 11px; padding: 18px; border-left: 1px solid var(--line); background: var(--surface-subtle); }
.emergency-lead-actions label { display: grid; gap: 5px; margin: 0; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.emergency-lead-actions select { width: 100%; color: var(--ink); font-size: 13px; font-weight: 600; text-transform: none; }
.emergency-lead-actions button { justify-content: center; width: 100%; }
.emergency-empty { padding: 56px 24px; border: 1px dashed var(--line); border-radius: 18px; }
.emergency-empty i { color: var(--brand); font-size: 34px; }
.emergency-booking-dialog { width: min(560px,calc(100vw - 32px)); }
.emergency-booking-dialog article { width: 100%; }
.emergency-booking-patient { display: grid; gap: 3px; margin-bottom: 14px; padding: 14px; border-radius: 12px; background: var(--surface-subtle); }
.emergency-booking-patient strong { font-size: 17px; }
.emergency-booking-patient span { color: var(--muted); font-size: 13px; }

@media (max-width: 1050px) {
  .emergency-summary { grid-template-columns: repeat(2,1fr); }
  .emergency-summary > div:nth-child(2) { border-right: 0; }
  .emergency-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .emergency-toolbar { grid-template-columns: 1fr auto; }
  .emergency-toolbar p { grid-column: 1/-1; text-align: left; }
  .emergency-lead-facts { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 760px) {
  .emergency-summary { grid-template-columns: 1fr 1fr; }
  .emergency-summary > div { min-height: 80px; padding: 15px; }
  .emergency-toolbar { grid-template-columns: 1fr; }
  .emergency-lead-card { grid-template-columns: 1fr; }
  .emergency-lead-actions { border-top: 1px solid var(--line); border-left: 0; }
  .emergency-lead-title-row { display: grid; }
  .emergency-submitted { text-align: left; }
  .emergency-lead-facts { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .survey-layout { grid-template-columns: 1fr; }
  .survey-campaign-sidebar { position: static; }
  .survey-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .survey-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .survey-simple-designer, .survey-canvas-workspace { grid-template-columns: 1fr; }
  .survey-design-inspector { min-height: 0; }
}

@media (max-width: 700px) {
  .survey-list, .survey-lower-grid, .survey-insight-grid { grid-template-columns: 1fr; }
  .survey-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .survey-detail-head, .survey-designer-heading, .survey-canvas-footer { align-items: stretch; flex-direction: column; }
  .survey-design-save { justify-content: space-between; }
  .survey-canvas-workspace { display: block; }
  .survey-design-inspector { margin-top: 12px; }
  .vault-boundary-chip { display: none; }
  .survey-question-card-grid { grid-template-columns: 1fr; }
  .survey-question-prompt, .survey-question-options { grid-column: auto; }
  .survey-question-flags { align-items: flex-start; flex-direction: column; gap: 8px; }
  .survey-enrollment-tabs { grid-template-columns: 1fr; }
  .survey-enrollment-tabs > button { grid-template-columns: auto 1fr; }
  .survey-enrollment-body { min-height: 250px; }
  .survey-enrollment-review { grid-template-columns: 1fr; }
  .survey-name-import-head, .survey-enrollment-footer { align-items: stretch; flex-direction: column; }
  .survey-enrollment-footer .actions, .survey-enrollment-footer .actions button { width: 100%; }
}

@media print {
  body.printing-survey-flyer > * { display: none !important; }
  body.printing-survey-flyer .app-shell, body.printing-survey-flyer main, body.printing-survey-flyer #surveys, body.printing-survey-flyer #survey-detail, body.printing-survey-flyer .survey-designer-panel, body.printing-survey-flyer .survey-simple-designer, body.printing-survey-flyer .survey-canvas-designer, body.printing-survey-flyer .survey-design-preview-shell, body.printing-survey-flyer #survey-flyer-preview { display: block !important; }
  body.printing-survey-flyer .survey-designer-panel > :not(.survey-simple-designer):not(.survey-canvas-designer), body.printing-survey-flyer .survey-simple-controls, body.printing-survey-flyer .survey-canvas-toolbar, body.printing-survey-flyer .survey-design-inspector, body.printing-survey-flyer .survey-canvas-footer { display: none !important; }
  body.printing-survey-flyer .survey-design-preview-shell { padding: 0; border: 0; background: #fff; }
  body.printing-survey-flyer #survey-flyer-preview { width: 7.5in; max-width: 7.5in; margin: .2in auto; border: 0; box-shadow: none; }
  body.printing-survey-flyer .survey-resize-handle { display: none !important; }
}
