/*
 * PAT Wiz — FlyerWorks branding
 * Navy + royal blue + orange accent. Light/dark via data-theme on body.
 */

/* --- Light mode (default) --- */
:root,
[data-theme="light"] {
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #061A3A;
  --muted: #64748B;
  --primary: #0057B8;
  --primary-dark: #002B5C;
  --accent: #FF6A00;
  --border: #E2E8F0;
  --shadow: rgba(0, 43, 92, 0.12);
  --on-primary: #FFFFFF;
  --focus-ring: rgba(0, 87, 184, 0.2);
  --primary-soft: rgba(0, 87, 184, 0.1);
  --accent-soft: rgba(255, 106, 0, 0.15);
  --input-bg: #F8FAFC;
  --warning-bg: #FFF8EB;
  --warning-border: #FCD34D;
  --warning-text: #92400E;
  --warning-button-bg: #DC2626;
  --warning-button-hover: #B91C1C;
  --warning-button-text: #FFFFFF;
  --warning-button-accent: #991B1B;
  --warning-button-focus: rgba(220, 38, 38, 0.35);
  --highlight-green: #16A34A;
  --highlight-green-soft: rgba(22, 163, 74, 0.12);
  --chart-medication: #0057B8;
  --chart-procedure: #FF6A00;
  --chart-condition: #16A34A;
  --chart-icd: #7C3AED;
  --chart-cpt: #DB2777;
  --radius: 16px;
  --radius-sm: 12px;
  --max-width: 640px;
}

/* --- Dark mode --- */
[data-theme="dark"] {
  --bg: #061A3A;
  --card: #0B234A;
  --text: #F8FAFC;
  --muted: #A7B4C8;
  --primary: #1E90FF;
  --primary-dark: #0A4F9E;
  --accent: #FF7A1A;
  --border: #1E3A5F;
  --shadow: rgba(0, 0, 0, 0.35);
  --on-primary: #FFFFFF;
  --focus-ring: rgba(30, 144, 255, 0.25);
  --primary-soft: rgba(30, 144, 255, 0.15);
  --accent-soft: rgba(255, 122, 26, 0.2);
  --input-bg: #061A3A;
  --warning-bg: rgba(255, 193, 7, 0.12);
  --warning-border: rgba(255, 193, 7, 0.35);
  --warning-text: #FCD34D;
  --warning-button-bg: #EF4444;
  --warning-button-hover: #DC2626;
  --warning-button-text: #FFFFFF;
  --warning-button-accent: #B91C1C;
  --warning-button-focus: rgba(239, 68, 68, 0.35);
  --highlight-green: #4ADE80;
  --highlight-green-soft: rgba(74, 222, 128, 0.15);
  --chart-medication: #1E90FF;
  --chart-procedure: #FF7A1A;
  --chart-condition: #4ADE80;
  --chart-icd: #A78BFA;
  --chart-cpt: #F472B6;
}

/* --- Base reset --- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* --- Theme toggle --- */
.theme-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.theme-toggle-fixed {
  position: static;
  top: auto;
  right: auto;
}

.top-bar-actions {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
}

.personalize-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}

.personalize-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-flashes {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  text-align: center;
}

.page-flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  text-align: center;
}

.page-flash--error {
  background: rgba(220, 53, 69, 0.12);
  color: #b02a37;
  border: 1px solid rgba(220, 53, 69, 0.25);
}

.page-flash--success {
  background: rgba(25, 135, 84, 0.12);
  color: #146c43;
  border: 1px solid rgba(25, 135, 84, 0.25);
}

.password-rules {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  text-align: left;
}

.password-rule {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.2rem 0;
}

.password-rule.is-passed {
  color: #146c43;
}

.password-rule.is-passed::before {
  content: "✓ ";
}

.password-rule:not(.is-passed)::before {
  content: "○ ";
  opacity: 0.6;
}

.theme-toggle-nav {
  position: static;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  box-shadow: none;
}

.theme-toggle:hover {
  border-color: var(--primary);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.theme-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* --- Page shell --- */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

body.has-sidebar .page {
  min-height: auto;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 28px 24px 40px;
  width: 100%;
}

body.has-sidebar .page.page-search {
  align-items: center;
  justify-content: flex-start;
}

body.has-sidebar .page.page-auth {
  flex-direction: column;
  align-items: center;
}

.page-auth .card {
  width: min(100%, var(--max-width));
}

.page-auth .instruction,
.page-auth .form-hint,
.page-auth .login-error {
  text-align: center;
}

.card {
  width: 100%;
  max-width: var(--max-width);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px var(--shadow);
  padding: 32px 24px;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/* --- Brand / header --- */
.brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  margin-bottom: 0;
}

.logo {
  display: block;
  object-fit: contain;
}

.logo-large {
  width: min(100%, 400px);
  max-height: 104px;
  height: auto;
  margin: 0 auto 16px;
  object-fit: contain;
}

/* Keep the wide logo readable on dark backgrounds */
[data-theme="dark"] .logo-large {
  background: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}

.logo-small {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

[data-theme="dark"] .logo-small {
  background: #FFFFFF;
  padding: 4px;
  border-radius: 8px;
}

.app-name {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  position: relative;
  padding-bottom: 10px;
}

/* Thin orange accent under title — small, not everywhere */
.app-name::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.brand-compact .app-name::after {
  display: none;
}

.app-name-compact {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  padding-bottom: 0;
}

.instruction {
  margin: 12px 0 0;
  color: var(--muted);
}

/* --- Search form --- */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.textarea-wrap {
  position: relative;
}

.search-autocomplete {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* MedFlow main search: suggestions sit in document flow so they never cover Submit */
.search-autocomplete .search-suggestions {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  z-index: auto;
  max-height: min(220px, 40vh);
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px var(--shadow);
  padding: 6px;
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.search-suggestion-item:hover,
.search-suggestion-item.is-active {
  background: var(--primary-soft);
}

.search-suggestion-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.search-suggestion-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.search-suggestion-badge-procedure {
  background: var(--accent-soft);
  color: var(--accent);
}

.search-suggestion-badge-medication {
  background: var(--primary-soft);
  color: var(--primary);
}

.search-suggestion-badge-class {
  background: var(--highlight-green-soft);
  color: var(--highlight-green);
}

textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px 56px 16px 16px;
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

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

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.mic-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--primary);
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.mic-button:hover {
  background: var(--input-bg);
  border-color: var(--primary);
}

.mic-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.mic-button.is-listening {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  animation: pulse 1.4s ease-in-out infinite;
}

.mic-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.mic-unsupported {
  margin: -8px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.submit-button {
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--on-primary);
  background: var(--primary);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.submit-button.is-loading {
  opacity: 1;
  border-bottom-color: var(--accent);
  cursor: wait;
}

.submit-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--on-primary);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.submit-button:hover:not(:disabled) {
  background: var(--primary-dark);
  border-bottom-color: var(--accent);
}

.submit-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.submit-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-input {
  width: 100%;
  min-height: 52px;
  padding: 16px;
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.login-input::placeholder { color: var(--muted); }

.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.login-error {
  margin: -8px 0 0;
  font-size: 0.875rem;
  color: #DC2626;
}

.login-info {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
  text-align: center;
}

.login-dev-banner {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.login-code-display {
  white-space: pre-wrap;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  font-size: 1rem;
  line-height: 1.5;
}

[data-theme="dark"] .login-error {
  color: #F87171;
}

.hidden { display: none !important; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* --- Results page --- */
.results-card { padding: 24px 20px 28px; }

.results-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.results-header .brand {
  margin-bottom: 20px;
}

.search-meta {
  margin-top: 0;
  text-align: center;
}

.searched-label {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.searched-value {
  margin: 0 0 12px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.searched-original {
  margin: -8px 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
  word-break: break-word;
}

.page-nav {
  margin: 20px 0 0;
  text-align: center;
}

.page-nav-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.page-nav-link:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--accent);
}

.type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.type-medication {
  background: var(--primary-soft);
  color: var(--primary);
}

.type-class {
  background: var(--primary-soft);
  color: var(--primary);
}

.type-surgery {
  background: var(--primary-soft);
  color: var(--primary);
}

.type-condition {
  background: var(--primary-soft);
  color: var(--primary);
}

.type-code {
  background: var(--primary-soft);
  color: var(--primary);
}

.type-neither {
  background: rgba(100, 116, 139, 0.15);
  color: var(--muted);
}

.search-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.stat-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.2;
}

.stat-label-short {
  display: none;
}

.stat-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  white-space: nowrap;
}

[data-theme="dark"] .type-neither {
  background: rgba(167, 180, 200, 0.12);
}

.results-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  margin: 0 0 4px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.result-card {
  padding: 20px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.result-title {
  margin: 0 0 12px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.result-detail { margin: 0 0 8px; color: var(--text); }

.result-detail .label {
  font-weight: 600;
  color: var(--muted);
}

.highlight-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.highlight-primary {
  background: var(--highlight-green-soft);
  border-left: 4px solid var(--highlight-green);
}

/* Surgery consent risk checklist */
.surgery-risks-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.surgery-risk-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px var(--shadow);
}

.surgery-risk-section-header {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  background: var(--primary);
  color: var(--on-primary);
}

.surgery-risk-category {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: inherit;
}

.surgery-risk-items {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin: 0;
  padding: 12px;
}

.surgery-risk-card {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.surgery-risk-label {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text);
}

.ab-column .surgery-risks-panel {
  max-width: 100%;
}

.highlight-secondary {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
}

.highlight-label {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.highlight-text {
  margin: 0;
  line-height: 1.55;
  color: var(--text);
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

.medflow-copy-row > span {
  flex: 1;
  min-width: 0;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

.risk-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
}

.risk-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.risk-list li:last-child { margin-bottom: 0; }

.result-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.result-warning h2 {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  color: var(--warning-text);
}

.result-warning p {
  margin: 0;
  color: var(--warning-text);
}

.results-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 24px;
  width: 100%;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--on-primary);
  background: var(--primary);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.back-button:hover {
  background: var(--primary-dark);
  border-bottom-color: var(--accent);
  color: var(--on-primary);
}

.back-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.report-form {
  margin-top: 12px;
}

.report-json {
  display: none;
}

.report-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 14px 24px;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--warning-button-text);
  background: var(--warning-button-bg);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.report-button:hover:not(:disabled) {
  background: var(--warning-button-hover);
  border-bottom-color: var(--warning-button-accent);
  color: var(--warning-button-text);
}

.report-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--warning-button-focus);
}

.report-button:disabled {
  opacity: 0.7;
  cursor: default;
  color: var(--warning-button-text);
  background: var(--warning-button-bg);
}

/* --- Stats page --- */
.stats-card {
  width: 100%;
}

.stats-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.stats-header .back-link {
  display: block;
  text-align: left;
  margin-bottom: 8px;
}

.stats-title-block {
  margin: 0 auto;
}

.stats-title {
  margin: 0 0 8px;
  font-size: 1.75rem;
  color: var(--text);
}

.stats-subtitle,
.stats-meta {
  margin: 0;
  color: var(--muted);
}

.stats-meta {
  margin-top: 8px;
  font-size: 0.875rem;
}

.stats-section {
  margin-bottom: 32px;
}

.stats-grid,
.stats-category-grid {
  display: grid;
  gap: 16px;
}

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

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

.stats-period-card,
.stats-category-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.stats-period-label {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stats-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.stats-metric:last-child {
  margin-bottom: 0;
}

.stats-metric-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
}

.stats-metric-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stats-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stats-category-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stats-category-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stats-category-name {
  color: var(--text);
  font-size: 0.9375rem;
}

.stats-category-count {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.stats-top-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stats-top-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stats-top-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stats-top-rank {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 1.25rem;
}

.stats-top-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.stats-footer {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.stats-empty,
.stats-error {
  margin-bottom: 20px;
}

.stats-chart-section {
  margin-bottom: 28px;
}

.stats-chart-caption {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
}

.stats-chart-card {
  padding: 18px 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(
    180deg,
    var(--card) 0%,
    var(--input-bg) 100%
  );
  box-shadow: 0 10px 28px var(--shadow);
}

.stats-chart-wrap {
  position: relative;
  width: 100%;
  height: min(360px, 58vw);
  min-height: 260px;
}

.stats-chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .top-bar-actions {
    top: 12px;
    right: 12px;
  }

  .page {
    padding: 0;
    align-items: stretch;
  }

  .card {
    min-height: 100vh;
    max-width: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    padding: 28px 20px 32px;
  }

  .logo-large {
    width: min(100%, 360px);
    max-height: 92px;
  }
  .app-name { font-size: 1.5rem; }
  textarea { min-height: 160px; font-size: 1rem; }

  .search-stats {
    gap: 4px;
    padding: 10px 6px;
  }

  .stat-item {
    gap: 2px;
  }

  .stat-label {
    font-size: 0.5625rem;
    letter-spacing: 0.02em;
  }

  .stat-label-full {
    display: none;
  }

  .stat-label-short {
    display: inline;
  }

  .stat-value {
    font-size: 0.75rem;
  }

  .stats-grid,
  .stats-category-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) {
  .card { padding: 40px 36px; }
  .logo-large {
    width: min(100%, 440px);
    max-height: 112px;
  }

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

  .stats-category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- Top nav & logout --- */
.top-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  position: relative;
  z-index: 100;
}

.top-nav-menu {
  position: relative;
}

.nav-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.nav-menu-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.nav-menu-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.nav-menu-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.nav-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px var(--shadow);
}

.nav-menu-dropdown[hidden] {
  display: none;
}

.nav-menu-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.nav-menu-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-menu-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.top-nav-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.top-nav-link:hover { text-decoration: underline; }

.top-nav-email {
  color: var(--muted);
  margin-left: auto;
  font-size: 0.8125rem;
}

.top-nav-logout { color: var(--muted); }

/* --- Wide card layout for provider pages --- */
.card-wide {
  max-width: 900px;
}

/* --- Home specialty grid --- */
.home-nav-links {
  text-align: center;
  margin: 20px 0 8px;
  font-size: 0.9375rem;
}

.home-nav-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.home-nav-link:hover { text-decoration: underline; }

.home-nav-sep {
  color: var(--muted);
  margin: 0 8px;
}

.specialty-section {
  margin-top: 28px;
}

.section-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px;
  text-align: center;
}

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

.specialty-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.specialty-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

@media (min-width: 600px) {
  .specialty-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- Provider list & status colors --- */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 8px 0 4px;
  color: var(--text);
}

.page-subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 0.9375rem;
}

.page-title-center,
.page-subtitle-center {
  text-align: center;
}

.page-header-center .page-title {
  text-align: center;
}

.page-header-center .back-link {
  display: inline-block;
  margin-bottom: 8px;
}

.page-subtitle-center {
  margin-bottom: 20px;
}

.search-input-hint {
  color: var(--text);
  font-size: 1.125rem;
  line-height: 1.45;
}

.search-input-hint-label,
.search-input-hint-options {
  margin: 0;
}

.search-input-hint-label {
  margin-bottom: 6px;
}

.search-input-hint-term {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-empty {
  color: var(--muted);
  margin: 0;
  font-size: 0.9375rem;
}

.back-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.back-link:hover { text-decoration: underline; }

.audit-meta {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  text-align: left;
}

.audit-meta-line {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

.audit-meta-line + .audit-meta-line {
  margin-top: 4px;
}

.audit-meta-label {
  display: inline-block;
  min-width: 5.5rem;
  font-weight: 700;
  color: var(--text);
}

.provider-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.provider-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  background: var(--input-bg);
  transition: border-color 0.15s;
}

.provider-card:hover {
  border-color: var(--primary);
}

.provider-name {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.provider-meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.provider-status-label {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.status-green .status-dot { background: var(--highlight-green); }
.status-yellow .status-dot { background: #EAB308; }
.status-red .status-dot { background: #DC2626; }
.status-inactive .status-dot { background: var(--muted); }

.status-green .provider-status-label { color: var(--highlight-green); }
.status-yellow .provider-status-label { color: #CA8A04; }
.status-red .provider-status-label { color: #DC2626; }

.empty-message {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
}

/* --- Completion dashboard --- */
.completion-page .completion-header {
  text-align: center;
}

.completion-page .completion-header .back-link {
  display: block;
  text-align: left;
  margin-bottom: 8px;
}

.completion-page .dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.completion-page .completion-counts {
  justify-content: center;
}

.completion-page .completion-filters {
  margin-bottom: 8px;
}

.completion-filters-panel {
  width: 100%;
  max-width: 560px;
  margin: 0 auto 20px;
  padding: 20px 22px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 3px var(--shadow);
}

.completion-filters-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 560px) {
  .completion-filters-fields {
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
  }
}

.completion-filters .filter-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 0;
  text-align: center;
}

.completion-filters .filter-label {
  display: block;
  width: 100%;
  margin: 0 0 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.completion-filters .filter-control {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.completion-filters .filter-control::placeholder {
  color: var(--muted);
}

.completion-filters .filter-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.completion-filters .filter-control-select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-color: var(--card);
  cursor: pointer;
}

.completion-filters-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px 28px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.completion-filters .checkbox-label-compact {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text);
}

.completion-page .filter-hint {
  text-align: center;
  margin: 0 0 16px;
}

.completion-page .dashboard-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.completion-page .dashboard-list > li {
  min-width: 0;
}

@media (min-width: 640px) {
  .completion-page .dashboard-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .completion-page .dashboard-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.completion-page .dashboard-list > li {
  min-width: 0;
  display: flex;
}

.completion-page .dashboard-list .dashboard-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  flex: 1;
  width: 100%;
  min-height: 220px;
  padding: 14px 16px;
  gap: 0;
}

.completion-page .dashboard-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}

.completion-page .dashboard-card-details {
  flex: 1;
  width: 100%;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.completion-page .dashboard-list .provider-name {
  font-size: 0.9375rem;
  margin: 4px 0;
}

.completion-page .dashboard-list .provider-meta {
  font-size: 0.8125rem;
  margin: 0 0 8px;
}

.completion-page .dashboard-list .provider-missing {
  font-size: 0.8125rem;
  margin: 4px 0 0;
  width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.completion-page .provider-complete-label {
  margin: 8px 0 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--highlight-green);
}

.completion-page .completion-percent-label {
  margin: 4px 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.completion-page .completion-progress {
  width: 100%;
  max-width: 220px;
  height: 8px;
  margin: 0 auto;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.completion-page .completion-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.completion-page .completion-progress-bar.status-yellow {
  background: #CA8A04;
}

.completion-page .completion-progress-bar.status-red {
  background: #DC2626;
}

.completion-page .dashboard-actions {
  margin-top: auto;
  margin-left: 0;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  padding-top: 12px;
  flex-shrink: 0;
}

.dashboard-toolbar {
  margin-bottom: 16px;
}

.btn-inline {
  display: inline-flex;
  width: auto;
  padding: 10px 20px;
}

.completion-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.count-badge {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.count-green { background: var(--highlight-green-soft); }
.count-yellow { background: rgba(234, 179, 8, 0.15); }
.count-red { background: rgba(220, 38, 38, 0.12); }
.count-inactive { background: var(--input-bg); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-input {
  min-width: 180px;
  max-width: 240px;
  margin: 0;
}

.filter-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.filter-field .form-label {
  margin: 0;
}

.filter-select {
  min-width: 180px;
  margin: 0;
}

.form-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .form-row-split {
    grid-template-columns: 1fr;
  }
}

.dashboard-list .dashboard-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.dashboard-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.inline-form { margin: 0; }

.provider-missing {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 4px 0 0;
}

/* --- Cheat sheet detail (compact layout; print.css adds @media print color resets) --- */
.page-search .cheat-sheet-card {
  margin: 4vh auto 0;
  max-width: min(900px, 100%);
}

.cheat-sheet-card .cheat-sheet-header {
  text-align: center;
  margin-bottom: 0.35rem;
}

.cheat-sheet-card .cheat-sheet-header .back-link {
  display: block;
  text-align: left;
  margin-bottom: 8px;
}

.cheat-sheet-card .cheat-sheet-title-block {
  margin: 0 auto;
}

.cheat-sheet-card .page-title {
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  font-weight: 800;
  margin: 0 0 0.5rem;
  text-align: center;
  color: var(--primary-dark);
  line-height: 1.15;
}

[data-theme="dark"] .cheat-sheet-card .page-title {
  color: var(--text);
}

.cheat-sheet-card .cheat-sheet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.3;
}

.cheat-sheet-card .cheat-sheet-specialty {
  font-weight: 600;
  color: var(--primary);
}

.cheat-sheet-card .cheat-sheet-meta-sep {
  color: var(--muted);
  font-weight: 700;
}

.cheat-sheet-card .cheat-sheet-procedure {
  font-weight: 700;
  color: var(--text);
}

.cheat-sheet-card .cheat-sheet-procedure-label {
  color: var(--accent);
  font-weight: 800;
  margin-right: 0.25em;
}

.cheat-sheet-card .contact-print-box {
  border: 2px solid var(--primary);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  margin: 0.85rem 0 1rem;
  background: var(--primary-soft);
}

.cheat-sheet-card .contact-compact {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
}

.cheat-sheet-card .contact-compact-single .contact-group {
  flex: 1;
}

.cheat-sheet-card .contact-group {
  flex: 1;
  min-width: 0;
}

.cheat-sheet-card .contact-group-head {
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.cheat-sheet-card .contact-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.15rem 0.65rem;
}

.cheat-sheet-card .contact-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem;
  font-size: 0.8125rem;
  line-height: 1.25;
}

.cheat-sheet-card .contact-label {
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.cheat-sheet-card .contact-label::after {
  content: ":";
}

.cheat-sheet-card .contact-value {
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.cheat-sheet-card .contact-divider-vertical {
  flex-shrink: 0;
  align-self: stretch;
  width: 0;
  margin: 0 0.15rem;
  border-left: 1.5px solid var(--primary);
  opacity: 0.45;
}

.cheat-sheet-card .procedure-section {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.cheat-sheet-card .procedure-picker {
  margin: 0.75rem 0;
  padding: 0.65rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.cheat-sheet-card .procedure-picker-heading {
  font-size: 0.9375rem;
  margin: 0 0 0.25rem;
}

.cheat-sheet-card .procedure-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}

.cheat-sheet-card .procedure-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.cheat-sheet-card .cheat-final-pre {
  white-space: pre-wrap;
}


.cheat-sheet-card .special-instruction-item + .special-instruction-item {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.cheat-sheet-card .special-instruction-name {
  font-size: 0.875rem;
  font-weight: 800;
  margin: 0 0 0.15rem;
  color: var(--accent);
}

.cheat-sheet-card .special-instruction-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  white-space: pre-wrap;
  color: var(--text);
}

.procedure-row {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.procedure-row:last-child {
  border-bottom: none;
  margin-bottom: 0.75rem;
  padding-bottom: 0;
}

.procedure-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.procedure-row-title {
  font-size: 0.9375rem;
}

.btn-text {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}

.btn-text:hover {
  color: var(--primary);
}

.cheat-sheet-card .cheat-sheet-sections {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.15rem;
}

.cheat-sheet-card .special-instructions,
.cheat-sheet-card .special-notes {
  margin-top: 0.65rem;
}

.cheat-sheet-card .cheat-section {
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--primary);
  border-radius: 6px;
  background: var(--primary-soft);
}

.cheat-sheet-card .cheat-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.1rem;
}

.cheat-sheet-card .cheat-section-title {
  font-size: 1.0625rem;
  font-weight: 800;
  margin: 0;
  color: var(--primary);
}

.cheat-sheet-card .cheat-source {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--muted);
  white-space: nowrap;
}

.cheat-sheet-card .cheat-source-symbol {
  font-weight: 800;
  margin-right: 0.1em;
}

.cheat-sheet-card .cheat-source-standard .cheat-source-symbol {
  color: var(--highlight-green);
}

.cheat-sheet-card .cheat-source-surgeon .cheat-source-symbol {
  color: var(--primary);
}

.cheat-sheet-card .cheat-source-procedure .cheat-source-symbol {
  color: var(--accent);
}

.cheat-sheet-card .cheat-final {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
}

.cheat-sheet-card .cheat-final-label {
  font-weight: 800;
  color: var(--highlight-green);
  margin-right: 0.25em;
}

.cheat-sheet-card .special-notes-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.35;
  white-space: pre-wrap;
  color: var(--text);
}

/* Temporary layout used to measure printable height before window.print() */
body.cheat-sheet-print-prep .no-print,
body.cheat-sheet-print-prep .no-print-controls {
  display: none !important;
}

body.cheat-sheet-print-prep .cheat-sheet-card .cheat-sheet-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

body.cheat-sheet-print-prep .cheat-sheet-card .special-instructions,
body.cheat-sheet-print-prep .cheat-sheet-card .special-notes {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .cheat-sheet-card .contact-compact {
    flex-direction: column;
    gap: 0.45rem;
  }

  .cheat-sheet-card .contact-divider-vertical {
    width: 100%;
    height: 0;
    margin: 0.25rem 0;
    border-left: none;
    border-top: 1.5px solid var(--primary);
    opacity: 0.45;
  }

  .cheat-sheet-card .contact-items {
    grid-template-columns: 1fr;
  }
}

/* --- Forms --- */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-label-required {
  color: #DC2626;
}

.form-required-legend {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: #DC2626;
  font-size: 0.875rem;
  font-weight: 600;
}

.form-row-required .form-label,
.field-required .form-label {
  color: #DC2626;
}

.form-row-required .login-input,
.form-row-required .form-select,
.form-row-required .form-textarea,
.field-required .login-input,
.field-required .form-select,
.field-required .form-textarea {
  border-color: #DC2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.12);
}

.form-section-required {
  border-color: #DC2626;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.08);
}

.form-section-required > legend {
  color: #DC2626;
}

.form-select {
  width: 100%;
  min-height: 52px;
  padding: 16px 40px 16px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.55;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.form-section legend {
  font-weight: 700;
  padding: 0 6px;
}

.form-row {
  margin-bottom: 12px;
}

.provider-form .form-row:not(.form-row-split) {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.provider-form .form-row .form-label {
  margin: 0;
}

.provider-form .form-row .form-hint {
  margin-top: 0;
}

.provider-form .form-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.provider-form .form-row-split > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.provider-form .form-row .login-input,
.provider-form .form-row .form-select,
.provider-form .form-row .form-textarea {
  width: 100%;
  max-width: none;
}

.page-search .card-search.page-panel {
  margin: 4vh auto 0;
  max-width: min(900px, 100%);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.form-actions-danger {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
  margin-top: 10px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-danger {
  padding: 10px 18px;
  border: 1px solid #DC2626;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #DC2626;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.1);
}

.delete-confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 26, 58, 0.55);
}

.delete-confirm-dialog[hidden] {
  display: none;
}

.delete-confirm-card {
  width: min(100%, 420px);
  padding: 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px var(--shadow);
}

.delete-confirm-title {
  margin: 0 0 10px;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text);
}

.delete-confirm-text {
  margin: 0 0 18px;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--muted);
}

.delete-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.hospital-instruction-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.conference-call-button {
  margin: 0;
}

.conference-call-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 26, 58, 0.55);
}

.conference-call-dialog[hidden] {
  display: none;
}

.conference-call-card {
  width: min(100%, 520px);
  max-height: min(90vh, 640px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px var(--shadow);
}

.conference-call-title {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
}

.conference-call-intro {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.conference-call-steps {
  margin: 0 0 20px;
  padding-left: 1.35rem;
  font-size: 0.975rem;
  line-height: 1.55;
  color: var(--text);
}

.conference-call-steps li {
  margin-bottom: 10px;
}

.conference-call-steps li:last-child {
  margin-bottom: 0;
}

.conference-call-actions {
  display: flex;
  justify-content: flex-end;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9375rem;
}

.procedure-section {
  margin: 20px 0;
}

.login-form-secondary {
  margin-top: 10px;
}

/* Prompt A/B test */
.ab-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.ab-column {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface);
}

.ab-column-single {
  grid-column: 1 / -1;
}

.ab-column h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.ab-query {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.ab-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.ab-stats span {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 6px;
}

.ab-warning {
  color: var(--warning-text, #b45309);
}

.ab-match {
  grid-column: 1 / -1;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9375rem;
}

.ab-match-yes {
  background: #dcfce7;
  color: #166534;
}

.ab-match-no {
  background: #fef3c7;
  color: #92400e;
}

@media (max-width: 768px) {
  .ab-comparison {
    grid-template-columns: 1fr;
  }
}

/* --- Guidance review dashboard --- */
.review-page {
  --max-width: 960px;
}

.page-search .review-card {
  margin: 4vh auto 0;
  max-width: min(960px, 100%);
}

.review-card {
  max-width: var(--max-width);
}

.review-header .review-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
}

.review-type-label {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.review-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.review-section {
  margin-top: 28px;
}

.review-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.review-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
}

.review-count-med {
  background: var(--primary-soft);
  color: var(--primary);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.review-item-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  overflow: hidden;
}

.review-item-surgery {
  border-top: 3px solid var(--chart-procedure);
}

.review-item-medication {
  border-top: 3px solid var(--chart-medication);
}

.review-item-body {
  flex: 1;
  padding: 16px;
}

.review-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.review-item-date {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.review-item-title {
  margin: 0 0 6px;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
}

.review-item-meta,
.review-item-source {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.review-item-source {
  font-weight: 600;
  color: var(--primary);
}

.review-item-summary {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-item-instructions {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-instructions-panel {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
}

.review-instructions-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.review-quick-form {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.review-card-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.review-card-actions .review-action-btn {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.review-card-actions .btn-secondary.review-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.review-mark-ok-btn {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--highlight-green);
  border-radius: 10px;
  background: var(--highlight-green-soft);
  color: var(--highlight-green);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.review-card-actions .review-mark-ok-btn {
  width: 100%;
  border-radius: var(--radius-sm);
}

.review-mark-ok-btn:hover {
  filter: brightness(0.95);
}

.review-panel {
  margin-top: 20px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.review-edit-form .review-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.review-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

.review-field input,
.review-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.review-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.review-actions-secondary {
  margin-top: 12px;
}

.review-save-btn {
  border: none;
  cursor: pointer;
}

.review-mark-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  width: 100%;
}

.review-field-inline {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.review-flashes {
  margin-top: 12px;
}

.review-flash {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
}

.review-flash-success {
  background: var(--highlight-green-soft);
  color: var(--highlight-green);
}

.review-flash-error {
  background: var(--warning-bg);
  color: var(--warning-text);
}

@media (max-width: 640px) {
  .review-grid {
    grid-template-columns: 1fr;
  }
}

/* --- App shell & left sidebar --- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: 260px;
  background: var(--bg);
  transition: margin-left 0.25s ease;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  width: 260px;
  height: 100vh;
  padding: 0;
  background: linear-gradient(180deg, var(--primary-dark) 0%, #041228 100%);
  border-right: none;
  box-shadow: none;
  color: #E8F0FC;
  transition: transform 0.25s ease;
}

[data-theme="dark"] .app-sidebar {
  background: linear-gradient(180deg, #0B234A 0%, #061A3A 100%);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin: 12px 10px 0;
  padding: 8px 10px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  color: #E8F0FC;
}

.sidebar-brand-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 72px;
  padding: 0;
  border: none;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.sidebar-brand-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.sidebar-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
}

.sidebar-nav-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  color: #E8F0FC;
}

.sidebar-nav-card--admin {
  padding-top: 4px;
}

.sidebar-section-label {
  margin: 4px 8px 2px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 240, 252, 0.55);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 10px;
  color: rgba(232, 240, 252, 0.88);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.sidebar-link.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.sidebar-link {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.sidebar-theme-link .icon-moon {
  display: none;
}

[data-theme="dark"] .sidebar-theme-link .icon-sun {
  display: none;
}

[data-theme="dark"] .sidebar-theme-link .icon-moon {
  display: block;
}

.sidebar-reveal-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 210;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--shadow);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sidebar-reveal-btn:hover {
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 24%, var(--border));
}

.sidebar-reveal-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.sidebar-reveal-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-width: 901px) {
  body.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }

  body.sidebar-collapsed .sidebar-reveal-btn {
    display: inline-flex;
  }
}

.sidebar-email {
  display: block;
  width: 100%;
  padding: 0 4px;
  font-size: 0.6875rem;
  color: rgba(232, 240, 252, 0.6);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 210;
  width: 60px;
  height: 60px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  box-shadow: none;
  overflow: hidden;
}

.sidebar-toggle-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(6, 26, 58, 0.45);
}

.sidebar-backdrop[hidden] {
  display: none;
}

.page-panel {
  max-width: 960px;
  width: 100%;
}

.card-search {
  max-width: 720px;
  margin: 0 auto;
}

.page-search .card-search {
  margin-top: 4vh;
}

.search-feature-banner {
  margin: 0 0 16px;
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.5;
  color: #b91c1c;
  font-weight: 700;
}

.page-search .card-search .brand {
  margin-bottom: 12px;
}

.page-search .card-search .logo-large {
  margin-bottom: 0;
}

.section-title {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0 0 14px;
  color: var(--text);
}

.page-hint {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 8px 0 0;
}

/* --- Physician search results --- */
.physician-search-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 24px;
  overflow: visible;
}

.physician-search-bar .form-label {
  margin: 0;
}

.physician-search-stack {
  position: relative;
  width: 100%;
  overflow: visible;
}

.physician-search-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
  width: 100%;
}

.physician-search-row .physician-search-input {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  width: auto;
  margin: 0;
}

.physician-search-row .physician-search-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 6.5rem;
  align-self: stretch;
  min-height: 52px;
  padding-left: 20px;
  padding-right: 20px;
  white-space: nowrap;
}

.page-search .card-search {
  overflow: visible;
}

.provider-card-static {
  cursor: default;
}

.provider-card-static:hover {
  border-color: var(--border);
}

/* --- Hospital directory --- */
.directory-section {
  margin-bottom: 32px;
}

.directory-section:last-child {
  margin-bottom: 0;
}

.directory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.directory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.directory-item.is-highlighted {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.directory-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.directory-item-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 20px;
  width: 100%;
  align-items: end;
}

.directory-field-phone {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.directory-field-phone:hover {
  text-decoration: underline;
}

.directory-item-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.directory-item--admin.is-inactive {
  opacity: 0.55;
}

.directory-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.directory-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.directory-field-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.directory-field-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.directory-item-fields--person {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 24px;
  align-items: center;
}

.directory-person-name {
  justify-self: start;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  min-width: 0;
}

.directory-person-phone {
  justify-self: center;
  text-align: center;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  min-width: 0;
}

.directory-person-phone:hover {
  text-decoration: underline;
}

.directory-person-meta {
  justify-self: end;
  text-align: right;
  min-width: 0;
}

.directory-person-department {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.directory-person-position {
  display: block;
  margin-top: 3px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.directory-item--person {
  padding: 16px 18px;
}

.directory-name {
  font-weight: 700;
  font-size: 1rem;
}

.directory-position {
  font-size: 0.875rem;
  color: var(--muted);
}

.directory-phone {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.directory-phone:hover {
  text-decoration: underline;
}

.department-autocomplete-stack {
  position: relative;
  width: 100%;
  overflow: visible;
}

.hospital-search-bar {
  position: relative;
  z-index: 50;
  margin-bottom: 20px;
}

button.back-link.hospital-numbers-back {
  display: inline-block;
  margin: 0 0 10px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

button.back-link.hospital-numbers-back[hidden] {
  display: none !important;
}

.hospital-type-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.hospital-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.hospital-type-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.hospital-type-card.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.hospital-type-card-title {
  font-size: 1rem;
  font-weight: 700;
}

.hospital-pre-admit-block {
  margin-bottom: 28px;
}

.hospital-pre-admit-block:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hospital-pre-admit-block[hidden] {
  display: none !important;
}

#hospital-directory[hidden] {
  display: none !important;
}

.directory-section[hidden],
.directory-item[hidden] {
  display: none !important;
}

.hospital-pre-admit-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hospital-pre-admit-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: calc(var(--radius-sm) + 2px);
  background: var(--card);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--shadow) 40%, transparent),
    0 10px 30px color-mix(in srgb, var(--shadow) 65%, transparent);
}

.hospital-pre-admit-card--main::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 55%, #38bdf8) 100%);
}

.hospital-pre-admit-head {
  margin: 0;
  padding: 20px 24px 0;
  border: 0;
  text-align: center;
}

.hospital-pre-admit-head--section {
  padding-bottom: 0;
}

.hospital-pre-admit-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hospital-pre-admit-section-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.hospital-pre-admit-main-lines {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 24px 24px;
}

.hospital-pre-admit-contact-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 88px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 55%, var(--card)) 0%, var(--card) 100%);
  text-align: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.hospital-pre-admit-contact-tile:hover {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--shadow) 75%, transparent);
  transform: translateY(-1px);
}

.hospital-pre-admit-contact-tile--fax {
  background: linear-gradient(180deg, color-mix(in srgb, var(--input-bg) 88%, var(--card)) 0%, var(--card) 100%);
}

.hospital-pre-admit-contact-tile--language-line {
  background: linear-gradient(180deg, color-mix(in srgb, #0ea5e9 12%, var(--card)) 0%, var(--card) 100%);
}

.hospital-pre-admit-contact-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.hospital-pre-admit-contact-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hospital-pre-admit-contact-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hospital-pre-admit-contact-kind {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hospital-pre-admit-contact-value {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  text-decoration: none;
  word-break: break-word;
}

a.hospital-pre-admit-contact-value {
  color: var(--primary);
}

a.hospital-pre-admit-contact-value:hover {
  text-decoration: underline;
}

.hospital-pre-admit-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed color-mix(in srgb, var(--border) 90%, transparent);
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
  background: color-mix(in srgb, var(--input-bg) 70%, transparent);
}

.hospital-pre-admit-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 24px 24px;
}

.hospital-pre-admit-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 104px;
  padding: 16px 16px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--input-bg) 45%, var(--card)) 0%, var(--card) 100%);
  text-align: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.hospital-pre-admit-tile:hover {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--shadow) 70%, transparent);
  transform: translateY(-1px);
}

.hospital-pre-admit-tile-label {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.hospital-pre-admit-tile-ext {
  align-self: center;
  min-width: 3.25rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1;
}

.hospital-pre-admit-tile-ext.is-empty {
  background: color-mix(in srgb, var(--input-bg) 80%, transparent);
  color: var(--muted);
  font-weight: 500;
}

a.hospital-pre-admit-tile-ext,
a.dept-contact-ext {
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

a.hospital-pre-admit-tile-ext:hover,
a.dept-contact-ext:hover {
  background: color-mix(in srgb, var(--primary) 16%, var(--primary-soft));
  color: var(--primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
}

.dept-contact-card-wrap {
  margin-top: 8px;
  max-width: 720px;
  margin-inline: auto;
}

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

@media (max-width: 540px) {
  .dept-contact-tiles {
    grid-template-columns: 1fr;
  }
}

.hospital-pre-admit-main-lines--edit {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hospital-pre-admit-main-lines--edit .form-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}

.hospital-pre-admit-field {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hospital-pre-admit-contact-input {
  min-height: 48px;
  border-radius: 12px;
  text-align: center;
}

.hospital-pre-admit-tiles--edit {
  gap: 12px;
}

.hospital-pre-admit-edit-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 104px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: color-mix(in srgb, var(--input-bg) 55%, var(--card));
  text-align: center;
}

.hospital-pre-admit-edit-label,
.hospital-pre-admit-edit-ext-label {
  display: block;
  width: 100%;
}

.hospital-pre-admit-label-input,
.hospital-pre-admit-ext-input {
  min-width: 0;
  width: 100%;
  border-radius: 10px;
  text-align: center;
}

.hospital-pre-admit-ext-input {
  max-width: none;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.hospital-pre-admit-edit {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.hospital-pre-admit-block.is-editing:not([hidden]) .hospital-pre-admit-edit {
  display: flex;
}

.hospital-pre-admit-block.is-editing .hospital-pre-admit-view,
.hospital-pre-admit-block.is-editing .hospital-pre-admit-footer {
  display: none;
}

.hospital-pre-admit-footer,
.hospital-pre-admit-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.hospital-pre-admit-footer {
  padding-top: 2px;
}

.hospital-pre-admit-actions {
  margin-top: 2px;
}

.hospital-pre-admit-error {
  margin: 0;
  text-align: center;
}

.hospital-pre-admit-block .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .hospital-pre-admit-tiles,
  .hospital-pre-admit-main-lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hospital-pre-admit-contact-tile--language-line {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .hospital-pre-admit-tiles,
  .hospital-pre-admit-main-lines,
  .hospital-pre-admit-main-lines--edit {
    grid-template-columns: 1fr;
  }

  .hospital-pre-admit-head,
  .hospital-pre-admit-tiles,
  .hospital-pre-admit-main-lines {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hospital-pre-admit-title {
    font-size: 1.25rem;
  }

  .hospital-pre-admit-contact-value {
    font-size: 1.0625rem;
  }
}

/* --- Surgery standard rules --- */
.surgery-rules-block {
  margin-top: 8px;
}

.surgery-rules-block:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.surgery-rules-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.surgery-rules-card {
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: calc(var(--radius-sm) + 2px);
  background: var(--card);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--shadow) 40%, transparent),
    0 10px 30px color-mix(in srgb, var(--shadow) 65%, transparent);
  overflow: hidden;
}

.surgery-rules-head {
  margin: 0;
  padding: 18px 24px 0;
  text-align: center;
}

.surgery-rules-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.surgery-rules-body {
  padding: 14px 24px 22px;
}

.surgery-rules-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  text-align: center;
}

.surgery-rules-text.is-empty {
  color: var(--muted);
  font-style: italic;
}

.surgery-rules-textarea {
  min-height: 7rem;
  resize: vertical;
}

.surgery-rules-edit {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.surgery-rules-block.is-editing .surgery-rules-view,
.surgery-rules-block.is-editing .surgery-rules-footer,
.department-rules-block.is-editing .department-rules-view,
.department-rules-block.is-editing .department-rules-footer {
  display: none;
}

.surgery-rules-block.is-editing:not([hidden]) .surgery-rules-edit,
.department-rules-block.is-editing:not([hidden]) .department-rules-edit {
  display: flex;
}

.surgery-rules-footer,
.surgery-rules-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.surgery-rules-error {
  margin: 0;
  text-align: center;
}

.surgery-rules-block .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Updates page --- */
.sidebar-link-with-badge {
  position: relative;
}

.sidebar-link-text {
  flex: 1;
}

.sidebar-updates-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #DC2626;
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 1.25rem;
  text-align: center;
}

.updates-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.updates-view-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  margin: 0 0 18px;
}

.updates-view-nav .updates-view-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 6.5rem;
  min-height: 52px;
  padding-left: 20px;
  padding-right: 20px;
  white-space: nowrap;
}

.updates-view-nav .updates-view-button.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  pointer-events: none;
  cursor: default;
}

.updates-view-nav .updates-view-button.is-active:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.updates-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.updates-card--pending {
  background: #FEF9C3;
  border-color: #EAB308;
  box-shadow: inset 0 0 0 1px rgba(234, 179, 8, 0.25);
}

.updates-card--acked {
  background: #DCFCE7;
  border-color: #22C55E;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.2);
}

.updates-card-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.updates-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.updates-card-heading {
  min-width: 0;
}

.updates-card-title {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
}

.updates-card-section {
  margin: 0 0 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.updates-card-meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.updates-card-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.updates-ack-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: #15803D;
}

.updates-diff {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--input-bg) 45%, var(--card));
}

.updates-diff-block {
  padding: 14px 16px;
}

.updates-diff-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.updates-diff-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.updates-announcement {
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 12px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--input-bg) 45%, var(--card));
}

.updates-announcement-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.announcement-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}

.announcement-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.announcement-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}

.announcement-textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

.announcement-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.announcement-submit {
  align-self: flex-start;
  margin-top: 4px;
}

.announcement-flashes {
  list-style: none;
  margin: 0 auto 20px;
  padding: 0;
  max-width: 720px;
}

.announcement-flash {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9375rem;
}

.announcement-flash--success {
  background: color-mix(in srgb, #15803d 12%, var(--card));
  color: #15803d;
  border: 1px solid color-mix(in srgb, #15803d 35%, transparent);
}

.announcement-flash--error {
  background: color-mix(in srgb, #b91c1c 12%, var(--card));
  color: #b91c1c;
  border: 1px solid color-mix(in srgb, #b91c1c 35%, transparent);
}

.announcement-urgent-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  cursor: pointer;
}

.announcement-urgent-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.announcement-urgent-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

body.has-urgent-announcement {
  overflow: hidden;
}

.urgent-announcement-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(2px);
}

.urgent-announcement-modal {
  width: min(560px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  padding: 28px 24px 24px;
  border-radius: 16px;
  background: var(--card);
  border: 2px solid #b91c1c;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.urgent-announcement-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.urgent-announcement-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
  color: var(--text);
}

.urgent-announcement-text {
  margin: 0 0 24px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

.urgent-announcement-ack {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}

.updates-urgent-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.pre-admit-page-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.pre-admit-info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.directory-admin-nav,
.directory-nav,
.pat-sop-nav {
  margin: 0 0 20px;
}

.pat-sop-nav {
  flex-wrap: wrap;
}

.pat-sop-nav .updates-view-button {
  min-width: 0;
  min-height: 44px;
  padding-left: 14px;
  padding-right: 14px;
  font-size: 0.875rem;
}

.directory-admin-section-header {
  margin-bottom: 16px;
}

.directory-admin-section-header .section-title {
  margin: 0 0 6px;
  text-align: center;
}

.anesthesia-numbers {
  max-width: 720px;
  margin: 4px auto 0;
}

.anesthesia-numbers-title {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.anesthesia-numbers-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.anesthesia-number-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.3;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.anesthesia-number-chip:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--input-bg));
}

.anesthesia-number-name {
  font-weight: 600;
  color: var(--text);
}

.anesthesia-number-ext {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.anesthesia-info-list {
  margin-top: 24px;
}

.pre-admit-info-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.pre-admit-info-card-main {
  flex: 1 1 280px;
  min-width: 0;
}

.pre-admit-info-card-heading {
  margin: 0 0 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.pre-admit-info-card-detail {
  margin: 0;
  font-size: 0.975rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.pre-admit-info-card-meta {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.pre-admit-info-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.pre-admit-info-form {
  display: grid;
  gap: 18px;
  max-width: 720px;
  margin: 0 auto;
}

.pre-admit-info-form-field {
  display: grid;
  gap: 8px;
}

.pre-admit-info-detail-input {
  min-height: 220px;
  resize: vertical;
}

.pre-admit-info-form-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.pre-admit-info-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.updates-diff-divider {
  height: 1px;
  background: var(--border);
}

.updates-diff-empty {
  color: var(--muted);
  font-style: italic;
}

.updates-diff-unavailable {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
}

.updates-diff-text mark {
  border-radius: 3px;
  padding: 0 0.1em;
}

.updates-diff-text .diff-removed {
  background: #FECACA;
  color: #991B1B;
  text-decoration: line-through;
}

.updates-diff-text .diff-added {
  background: #BBF7D0;
  color: #166534;
}

[data-theme="dark"] .updates-diff-text .diff-removed {
  background: rgba(248, 113, 113, 0.22);
  color: #FCA5A5;
}

[data-theme="dark"] .updates-diff-text .diff-added {
  background: rgba(74, 222, 128, 0.18);
  color: #86EFAC;
}

[data-theme="dark"] .updates-card--pending {
  background: rgba(234, 179, 8, 0.16);
  border-color: #CA8A04;
}

[data-theme="dark"] .updates-card--acked {
  background: rgba(34, 197, 94, 0.14);
  border-color: #16A34A;
}

[data-theme="dark"] .updates-ack-label {
  color: #4ADE80;
}

.hospital-search-bar .form-label {
  margin-bottom: 8px;
}

.hospital-search-stack {
  overflow: visible;
}

.hospital-search-row .hospital-search-button,
.physician-search-row .hospital-search-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 6.5rem;
  align-self: stretch;
  min-height: 52px;
  padding-left: 20px;
  padding-right: 20px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .directory-item-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .directory-item-fields {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .directory-item-fields--person {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .directory-person-name,
  .directory-person-phone,
  .directory-person-meta {
    justify-self: stretch;
    text-align: left;
  }

  .directory-person-name {
    font-size: 1.625rem;
  }

  .directory-person-phone {
    font-size: 1.5rem;
  }

  .directory-item {
    flex-direction: column;
    align-items: stretch;
  }

  .directory-item-aside {
    align-items: stretch;
    width: 100%;
  }

  .directory-item-actions {
    align-self: flex-end;
  }
}

.directory-group {
  margin-bottom: 24px;
}

.directory-group:last-child {
  margin-bottom: 0;
}

.directory-group-title {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Admin entry forms --- */
.entry-form-section,
.entry-list-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.entry-form .login-input,
.entry-form .form-select,
.entry-form .form-textarea {
  width: 100%;
  max-width: none;
}

.entry-form .form-field .form-label {
  margin-bottom: 0;
}

.entry-form .btn-inline {
  min-height: 52px;
  padding: 14px 24px;
  font-size: 1.0625rem;
}

.entry-form .btn-secondary.btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-upload-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.file-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-upload-button {
  min-height: 52px;
  padding: 14px 24px;
  font-size: 1.0625rem;
  cursor: pointer;
}

.file-upload-name {
  flex: 1 1 180px;
  min-width: 0;
  font-size: 0.9375rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 0.875rem;
}

.form-success {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--highlight-green-soft);
  color: var(--highlight-green);
  font-size: 0.875rem;
}

.directory-admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.directory-admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.directory-admin-item.is-inactive {
  opacity: 0.55;
}

.directory-admin-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.directory-admin-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.directory-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.inline-form {
  display: inline;
}

/* --- Document library --- */
.documents-page .documents-toolbar {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.documents-page .documents-toolbar .btn-inline {
  min-height: 52px;
  padding: 14px 24px;
  font-size: 1.0625rem;
}

.documents-page .document-library-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.documents-page .document-library-list > li {
  min-width: 0;
  display: flex;
}

@media (min-width: 640px) {
  .documents-page .document-library-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .documents-page .document-library-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.document-library-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  flex: 1;
  width: 100%;
  min-height: 320px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.document-library-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 20px var(--shadow);
}

.document-library-card:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.document-library-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  width: 100%;
}

.document-library-thumb-wrap {
  width: 100%;
  max-width: 168px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
  flex-shrink: 0;
}

.document-library-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #FFFFFF;
}

.document-library-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
}

.document-library-thumb-placeholder svg {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.document-library-title {
  margin: 0 0 6px;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.document-library-description {
  margin: 0;
  width: 100%;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.document-library-description-empty {
  font-style: italic;
  opacity: 0.75;
}

.document-library-actions {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  justify-content: center;
}

.document-library-actions .submit-button {
  width: auto;
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.875rem;
  pointer-events: none;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.document-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.document-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 20px var(--shadow);
}

.document-thumb-wrap {
  aspect-ratio: 4 / 3;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.document-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.document-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
}

.document-thumb-placeholder svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.document-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.document-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.document-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.45;
}

.document-card-actions {
  margin-top: auto;
  padding-top: 4px;
}

@media (max-width: 900px) {
  .app-main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.has-sidebar .page {
    padding: 80px 16px 32px;
  }

  .provider-card-static {
    flex-wrap: wrap;
  }

  .provider-form .form-row-split {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1200px) {
  .card-wide {
    max-width: 1000px;
  }
}

/* --- Physician profile & search --- */
.physician-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(380px, 55vh);
  overflow-y: auto;
  padding: 8px;
}

.physician-suggestions .search-suggestion-item {
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.4;
  min-height: 52px;
  align-items: center;
}

.physician-suggestions .search-suggestion-label {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.35;
}

.physician-suggestions .search-suggestion-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  max-width: 42%;
  text-align: right;
  line-height: 1.25;
}

.provider-list-item {
  list-style: none;
}

.provider-list-item .provider-card {
  width: 100%;
}

.provider-list-item .provider-card-body {
  flex: 1;
  min-width: 0;
}

.provider-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
}

.provider-card-actions .submit-button,
.provider-card-actions .btn-secondary {
  width: auto;
  min-width: 0;
  min-height: auto;
  padding: 8px 14px;
  font-size: 0.8125rem;
  line-height: 1.3;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
}

.provider-card-actions .submit-button {
  border-bottom-width: 2px;
}

.physician-profile-card {
  margin-top: 2vh;
}

.physician-specialty-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8125rem;
}

.physician-profile-office {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.physician-contact-panel {
  margin: 8px 0 24px;
}

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

.physician-contact-grid-single {
  grid-template-columns: 1fr;
}

.physician-contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--card) 0%, var(--input-bg) 100%);
  box-shadow: 0 8px 24px var(--shadow);
  padding: 18px 20px;
}

.physician-contact-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.physician-contact-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.physician-contact-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.physician-contact-card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.physician-contact-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.physician-contact-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 12px;
  align-items: baseline;
}

.physician-contact-row dt {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.physician-contact-row dd {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.physician-contact-row.is-preferred-contact {
  margin: 0 -8px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
}

.physician-contact-row.is-preferred-contact dd {
  font-size: 1.1875rem;
  font-weight: 700;
}

.physician-contact-preferred-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: var(--card);
  border: 1px solid var(--primary);
  border-radius: 4px;
  vertical-align: middle;
}

.physician-contact-row dd a {
  color: var(--primary);
  text-decoration: none;
}

.physician-contact-row dd a:hover {
  text-decoration: underline;
}

.physician-contact-value-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.physician-contact-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.physician-contact-copy:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.physician-contact-copy.is-copied {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.physician-contact-copy svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.physician-contact-check-icon {
  display: none;
}

.physician-contact-copy.is-copied .physician-contact-copy-icon {
  display: none;
}

.physician-contact-copy.is-copied .physician-contact-check-icon {
  display: block;
}

.medflow-copy-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.medflow-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.medflow-copy:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.medflow-copy.is-copied {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.medflow-copy svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.medflow-copy-check-icon {
  display: none;
}

.medflow-copy.is-copied .medflow-copy-icon {
  display: none;
}

.medflow-copy.is-copied .medflow-copy-check-icon {
  display: block;
}

.physician-contact-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.physician-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

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

  .provider-list-item .provider-card {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .provider-card-actions {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: 0;
    margin-top: 4px;
    padding-left: 24px;
  }

  .provider-card-actions .submit-button,
  .provider-card-actions .btn-secondary {
    flex: 1 1 auto;
  }
}

/* --- Calendar page --- */
:root,
[data-theme="light"] {
  --calendar-weekend-bg: #E8EDF3;
  --calendar-weekend-border: #D5DDE8;
}

[data-theme="dark"] {
  --calendar-weekend-bg: rgba(167, 180, 200, 0.1);
  --calendar-weekend-border: rgba(167, 180, 200, 0.18);
}

body.has-sidebar .app-main:has(.page-calendar) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.has-sidebar .page.page-calendar {
  align-items: stretch;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.page-calendar .page-panel {
  max-width: none;
}

.card-calendar {
  max-width: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 24px 20px 20px;
}

.page-calendar .calendar-page-header {
  margin-bottom: 12px;
}

.page-calendar .calendar-page-header .page-title {
  margin: 0 0 10px;
}

.calendar-widget {
  margin-top: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.calendar-nav-section {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
  z-index: 20;
}

.calendar-print-actions {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 0;
}

.calendar-print-btn {
  min-width: 140px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.calendar-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.calendar-nav-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calendar-nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.calendar-nav-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.calendar-month-picker-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 360px;
}

.calendar-month-picker {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.calendar-month-picker:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.calendar-month-picker:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.calendar-month-picker.is-open {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.calendar-picker-popup {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 48px));
  z-index: 30;
}

.calendar-picker-popup[hidden] {
  display: none;
}

.calendar-picker-popup-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px var(--shadow);
  padding: 20px 22px 22px;
}

.calendar-picker-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.calendar-picker-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.calendar-picker-nav-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calendar-picker-nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.calendar-picker-month-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
}

.calendar-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.calendar-picker-day {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.calendar-picker-day:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.calendar-picker-day--other {
  color: var(--muted);
  opacity: 0.5;
  background: transparent;
}

.calendar-picker-day--weekend:not(.calendar-picker-day--other) {
  background: var(--calendar-weekend-bg);
  border-color: var(--calendar-weekend-border);
}

.calendar-picker-day--weekend.calendar-picker-day--other {
  background: color-mix(in srgb, var(--calendar-weekend-bg) 55%, transparent);
}

.calendar-picker-day--today {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.calendar-picker-day--picked {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.calendar-picker-day--picked:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--on-primary);
}

.calendar-picker-day--today.calendar-picker-day--picked {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 100%;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(5.5rem, 1fr);
  gap: 4px;
  flex: 1;
  width: 100%;
  min-height: 0;
}

.calendar-grid-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  --calendar-weeks: 6;
  --calendar-vacation-lanes: 0;
  --calendar-vacation-lane-height: 1.125rem;
}

.calendar-grid-wrap .calendar-grid {
  grid-auto-rows: unset;
  grid-template-rows: repeat(
    var(--calendar-weeks),
    minmax(calc(5.5rem + (var(--calendar-vacation-lanes) * var(--calendar-vacation-lane-height))), 1fr)
  );
}

.calendar-vacation-bars-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(
    var(--calendar-weeks),
    minmax(calc(5.5rem + (var(--calendar-vacation-lanes) * var(--calendar-vacation-lane-height))), 1fr)
  );
  gap: 4px;
  pointer-events: none;
}

.calendar-vacation-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: var(--calendar-vacation-lane-height);
  margin: calc(1.85rem + var(--calendar-vacation-bar-lane, 0) * var(--calendar-vacation-lane-height)) 3px 0;
  padding: 0 6px;
  border: 1px solid transparent;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  align-self: start;
}

.calendar-vacation-bar--single {
  border-radius: 4px;
}

.calendar-vacation-bar--start {
  border-radius: 4px 0 0 4px;
  margin-right: 0;
  border-right-width: 0;
}

.calendar-vacation-bar--mid {
  border-radius: 0;
  margin-left: 0;
  margin-right: 0;
  border-left-width: 0;
  border-right-width: 0;
}

.calendar-vacation-bar--end {
  border-radius: 0 4px 4px 0;
  margin-left: 0;
  border-left-width: 0;
}

.calendar-vacation-bar--pending {
  background: #FEF9C3;
  border-color: #EAB308;
  color: #713f12;
}

.calendar-vacation-bar--approved {
  background: color-mix(in srgb, #15803d 22%, var(--card));
  border-color: #16A34A;
  color: #166534;
}

.calendar-vacation-bar--colored {
  background: var(--vacation-bar-bg);
  border-color: var(--vacation-bar-border);
  color: var(--vacation-bar-text);
}

.calendar-vacation-bar--denied {
  background: color-mix(in srgb, #b91c1c 16%, var(--card));
  border-color: #DC2626;
  color: #991b1b;
}

.calendar-vacation-bar-name {
  flex-shrink: 0;
}

.calendar-vacation-bar-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 5.5rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--input-bg);
  border: 2px solid transparent;
  cursor: default;
  user-select: none;
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.calendar-day-num {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  flex-shrink: 0;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: 6px 6px 0 0;
  padding: 0 4px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
}

.calendar-day-events {
  flex: 1;
  min-height: 0;
  padding: 4px 6px 6px;
}

.calendar-shift-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid var(--border);
  color: var(--text);
}

.calendar-shift-badge--pending {
  background: color-mix(in srgb, #EAB308 22%, var(--card));
  border-color: #EAB308;
  color: #854d0e;
}

.calendar-shift-badge--working {
  display: block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.calendar-shift-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}

.calendar-shift-hours {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.calendar-shift-assign-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--primary) 55%, var(--border));
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--card));
  color: var(--primary);
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
}

.calendar-shift-assign-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.calendar-shift-assign-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.calendar-shift-assignment {
  display: block;
  margin-top: 2px;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.calendar-assignment-dialog {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
}

.calendar-assignment-dialog[hidden] {
  display: none !important;
}

.calendar-assignment-card {
  width: min(24rem, 100%);
  max-height: min(80vh, 32rem);
  overflow: auto;
  padding: 1.25rem 1.35rem 1.1rem;
  border-radius: var(--radius-md, 0.75rem);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
}

.calendar-assignment-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.calendar-assignment-shift {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}

.calendar-assignment-subtitle {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.calendar-assignment-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.calendar-assignment-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.35;
}

.calendar-assignment-role {
  flex: 0 0 5.75rem;
  font-weight: 700;
  color: var(--text);
}

.calendar-assignment-names {
  flex: 1 1 auto;
  color: var(--text);
}

.calendar-assignment-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.calendar-assignment-actions {
  display: flex;
  justify-content: flex-end;
}

body.calendar-assignment-open {
  overflow: hidden;
}

.calendar-day--scheduled-pending:not(.calendar-day--other) {
  border-color: #EAB308;
}

.calendar-day--scheduled-approved:not(.calendar-day--other) {
  border-color: #16A34A;
}

.calendar-day--weekend.calendar-day--scheduled-pending:not(.calendar-day--other) {
  border-color: #EAB308;
}

.calendar-day--weekend.calendar-day--scheduled-approved:not(.calendar-day--other) {
  border-color: #16A34A;
}

[data-theme="dark"] .calendar-day--scheduled-pending:not(.calendar-day--other) {
  border-color: #EAB308;
}

[data-theme="dark"] .calendar-day--scheduled-approved:not(.calendar-day--other) {
  border-color: #22C55E;
}

.calendar-off-badge {
  min-width: 1.5rem;
  text-align: center;
}

.calendar-day-unavailable {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.calendar-day--other {
  color: var(--muted);
  opacity: 0.45;
  background: transparent;
}

.calendar-day--weekend:not(.calendar-day--other) {
  background: var(--calendar-weekend-bg);
  border-color: var(--calendar-weekend-border);
}

.calendar-day--weekend.calendar-day--other {
  background: color-mix(in srgb, var(--calendar-weekend-bg) 55%, transparent);
}

.calendar-day:not(.calendar-day--other) {
  cursor: pointer;
}

.calendar-day:not(.calendar-day--other):hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.calendar-day--today {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.calendar-day--today .calendar-day-num {
  background: var(--accent);
  color: var(--on-primary);
  border-radius: 999px;
  font-weight: 700;
}

.calendar-day--today:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.calendar-day--picked {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.calendar-day--picked .calendar-day-num {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 999px;
  font-weight: 700;
}

.calendar-day--picked:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.calendar-day--today.calendar-day--picked {
  border-color: var(--accent);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.calendar-day--today.calendar-day--picked .calendar-day-num {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 0 0 2px var(--accent);
}

@media (max-width: 520px) {
  .card-calendar {
    padding: 20px 12px 12px;
  }

  .calendar-picker-popup {
    width: min(100%, calc(100vw - 24px));
  }

  .calendar-picker-popup-card {
    padding: 16px 14px 18px;
  }

  .calendar-picker-month-label {
    font-size: 1.125rem;
  }

  .calendar-picker-day {
    min-height: 2.75rem;
    font-size: 1rem;
  }

  .calendar-picker-nav-btn {
    width: 42px;
    height: 42px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(4.25rem, 1fr);
    gap: 3px;
  }

  .calendar-day {
    min-height: 4.25rem;
  }

  .calendar-day-num {
    min-width: 1.5rem;
    height: 1.5rem;
    margin: 4px 4px 0 0;
    font-size: 0.8125rem;
  }

  .calendar-day-events {
    padding: 2px 4px 4px;
  }

  .calendar-month-picker {
    font-size: 1rem;
    padding: 10px 12px;
  }

  .calendar-nav-btn {
    width: 40px;
    height: 40px;
  }
}

/* ---------------------------------------------------------------------------
   Nurse schedule grid
--------------------------------------------------------------------------- */

body.has-sidebar .app-main:has(.page-schedule) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.has-sidebar .page.page-schedule {
  align-items: stretch;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.page-schedule .page-panel {
  max-width: none;
}

.card-schedule {
  max-width: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 24px 20px 20px;
}

.page-schedule .page-header {
  margin-bottom: 12px;
}

.schedule-panel {
  max-width: none;
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 12px;
}

.schedule-toolbar .schedule-nav {
  margin-bottom: 0;
}

.schedule-status-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0 0 16px;
}

.schedule-status-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.schedule-status-group--admin {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.schedule-print-btn {
  flex-shrink: 0;
}

.schedule-print-header {
  display: none;
}

.schedule-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.schedule-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.schedule-block-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  min-width: 220px;
  text-align: center;
}

.schedule-approval-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.5rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.schedule-approval-card--approved {
  background: color-mix(in srgb, #15803d 20%, var(--card));
  border-color: #16A34A;
  color: #166534;
}

.schedule-approval-card--pending {
  background: color-mix(in srgb, #EAB308 24%, var(--card));
  border-color: #EAB308;
  color: #854d0e;
  font-weight: 800;
}

[data-theme="dark"] .schedule-approval-card--approved {
  color: #86efac;
}

[data-theme="dark"] .schedule-approval-card--pending {
  background: color-mix(in srgb, #EAB308 24%, var(--card));
  color: #fde047;
}

.schedule-approve-btn {
  flex-shrink: 0;
}

.schedule-shift-pending:not(.schedule-cell-closed):not([class*="schedule-cell-vacation-"]) {
  background: color-mix(in srgb, #EAB308 24%, var(--card)) !important;
}

.schedule-shift-pending .schedule-hours,
.schedule-shift-pending .schedule-hours-off,
.schedule-shift-pending .schedule-select {
  color: #854d0e;
  font-weight: 800;
}

.schedule-row-me td.schedule-shift-pending:not(.schedule-weekend):not(.schedule-cell-closed):not([class*="schedule-cell-vacation-"]) {
  background: color-mix(in srgb, #EAB308 26%, var(--card)) !important;
}

.schedule-row-editable td.schedule-shift-pending:not(.schedule-weekend):not(.schedule-cell-closed):not([class*="schedule-cell-vacation-"]) {
  background: color-mix(in srgb, #EAB308 24%, color-mix(in srgb, var(--primary) 4%, var(--card))) !important;
}

[data-theme="dark"] .schedule-shift-pending .schedule-hours,
[data-theme="dark"] .schedule-shift-pending .schedule-hours-off,
[data-theme="dark"] .schedule-shift-pending .schedule-select {
  color: #fde047;
}

.schedule-scroll {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.schedule-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 0.8125rem;
  --schedule-row-line: color-mix(in srgb, var(--border) 85%, var(--muted));
}

.schedule-table th,
.schedule-table td {
  border: none;
  border-left: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
  text-align: center;
  padding: 0;
}

.schedule-table thead th {
  border-top: none;
  border-bottom: none;
  box-shadow: inset 0 1px 0 var(--schedule-row-line), inset 0 -1px 0 var(--schedule-row-line);
}

.schedule-table tbody tr:not(.schedule-line-row) > th,
.schedule-table tbody tr:not(.schedule-line-row) > td {
  border-top: none;
  border-bottom: none;
  box-shadow: inset 0 -1px 0 var(--schedule-row-line);
}

.schedule-table tbody tr > th.schedule-name-col {
  box-shadow: none;
}

.schedule-table tbody tr > th.schedule-name-col::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--schedule-row-line);
  pointer-events: none;
}

.schedule-table tbody tr:has(+ tr.schedule-line-row) > th,
.schedule-table tbody tr:has(+ tr.schedule-line-row) > td {
  box-shadow: none;
}

.schedule-table tbody tr:has(+ tr.schedule-line-row) > th.schedule-name-col::after {
  display: none;
}

.schedule-table tbody tr.schedule-line-row > td {
  padding: 0;
  border: none;
  box-shadow: none;
  line-height: 0;
  vertical-align: top;
}

.schedule-table tbody tr.schedule-row-group-start > th,
.schedule-table tbody tr.schedule-row-group-start > td {
  border-top: 4px solid color-mix(in srgb, var(--text) 40%, var(--border)) !important;
  box-shadow: none !important;
}

.schedule-table tbody tr.schedule-row-group-start > th.schedule-name-col::after {
  display: none;
}

.schedule-table tbody tr.schedule-line-row--me > td {
  height: 2px;
  background: color-mix(in srgb, var(--text) 28%, var(--schedule-row-line));
}

.schedule-table tbody tr.schedule-line-row--total > td {
  height: 5px;
  background: var(--schedule-row-line);
}

.schedule-day-head {
  padding: 6px 4px;
  min-width: 44px;
  background: color-mix(in srgb, var(--input-bg) 60%, var(--card));
  font-weight: 600;
  color: var(--muted);
}

.schedule-day-weekday {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.schedule-day-date {
  display: block;
  font-size: 0.8125rem;
  color: var(--text);
}

.schedule-name-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  text-align: left;
  padding: 8px 12px;
  min-width: 190px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  vertical-align: middle;
  isolation: isolate;
}

.schedule-staff-name {
  display: block;
}

.schedule-name-col.schedule-name-rn {
  background: color-mix(in srgb, #3b82f6 14%, var(--card));
}

.schedule-name-col.schedule-name-lab {
  background: color-mix(in srgb, #8b5cf6 16%, var(--card));
}

.schedule-name-col.schedule-name-admin {
  background: color-mix(in srgb, #f59e0b 18%, var(--card));
}

.schedule-cell-off {
  background: color-mix(in srgb, #b91c1c 10%, var(--card)) !important;
}

.schedule-hours-off {
  color: #b91c1c;
  font-weight: 800;
}

thead .schedule-name-col {
  z-index: 3;
}

.schedule-cell {
  min-width: 44px;
  height: 38px;
}

.schedule-weekend {
  background: color-mix(in srgb, var(--muted) 14%, var(--card));
}

.schedule-week-start {
  border-left: 2px solid color-mix(in srgb, var(--muted) 45%, var(--border)) !important;
}

.schedule-today {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.schedule-row-me .schedule-name-col {
  color: var(--text);
}

.schedule-row-editable td:not(.schedule-weekend):not([class*="schedule-cell-vacation-"]) {
  background: color-mix(in srgb, var(--primary) 4%, var(--card));
}

.schedule-you-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.6875rem;
  font-weight: 700;
}

.schedule-hours {
  font-weight: 700;
  color: var(--text);
}

.schedule-select {
  width: 100%;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.schedule-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.schedule-cell--saved {
  background: color-mix(in srgb, #15803d 22%, var(--card)) !important;
  transition: background 0.2s ease;
}

.schedule-cell--error {
  background: color-mix(in srgb, #b91c1c 22%, var(--card)) !important;
  transition: background 0.2s ease;
}

.schedule-name-col.schedule-name-total {
  background: color-mix(in srgb, var(--muted) 12%, var(--card));
  font-weight: 800;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.schedule-total-cell {
  font-weight: 800;
  font-size: 0.875rem;
}

.schedule-total-count {
  display: inline-block;
  min-width: 1.25rem;
}

.schedule-total-low {
  background: color-mix(in srgb, #b91c1c 16%, var(--card)) !important;
  color: #991b1b;
}

.schedule-total-ok {
  background: color-mix(in srgb, #15803d 20%, var(--card)) !important;
  color: #166534;
}

.schedule-total-cell.schedule-weekend {
  background: color-mix(in srgb, var(--muted) 14%, var(--card)) !important;
  color: var(--muted);
}

/* --- Vacation requests --- */
.vacation-request-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.vacation-picker-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  margin: 0 0 14px;
  text-align: center;
}

.vacation-picker-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.vacation-picker-legend-item::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.vacation-picker-legend-item--pending::before {
  background: #FEF9C3;
  border-color: #EAB308;
}

.vacation-picker-legend-item--approved::before {
  background: color-mix(in srgb, #15803d 20%, var(--card));
  border-color: #16A34A;
}

.vacation-picker-legend-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.vacation-request-form {
  display: grid;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.vacation-date-row,
.vacation-notes-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vacation-date-picker {
  position: relative;
}

.vacation-date-trigger {
  width: 100%;
  min-height: 64px;
  padding: 16px 18px;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.vacation-date-trigger.is-open {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

.vacation-date-trigger-label.is-placeholder {
  color: var(--muted);
  font-weight: 500;
}

.vacation-date-popup {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(620px, calc(100vw - 48px));
  z-index: 40;
}

.vacation-date-popup[hidden] {
  display: none;
}

.vacation-date-popup-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px var(--shadow);
  padding: 20px 22px 22px;
}

.vacation-date-popup-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.vacation-date-popup-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.vacation-date-popup-nav-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vacation-date-popup-nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.vacation-date-popup-month {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
}

.vacation-date-popup-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vacation-date-popup-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.vacation-date-popup-day {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.vacation-date-popup-day:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.vacation-date-popup-day--other {
  color: var(--muted);
  opacity: 0.5;
  background: transparent;
}

.vacation-date-popup-day--weekend:not(.vacation-date-popup-day--other) {
  background: var(--calendar-weekend-bg);
  border-color: var(--calendar-weekend-border);
}

.vacation-date-popup-day--today {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.vacation-date-popup-day--picked {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.vacation-date-popup-day--picked:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--on-primary);
}

.vacation-date-popup-day--disabled,
.vacation-date-popup-day:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.vacation-date-popup-day--vacation-pending {
  background: #FEF9C3;
  border-color: #EAB308;
  color: #713f12;
}

.vacation-date-popup-day--vacation-approved {
  background: color-mix(in srgb, #15803d 20%, var(--card));
  border-color: #16A34A;
  color: #166534;
}

.vacation-date-popup-day--vacation-pending:disabled,
.vacation-date-popup-day--vacation-approved:disabled {
  opacity: 0.9;
  cursor: not-allowed;
}

.vacation-date-popup-day--vacation-pending:disabled {
  background: #FEF9C3;
  border-color: #EAB308;
  color: #713f12;
}

.vacation-date-popup-day--vacation-approved:disabled {
  background: color-mix(in srgb, #15803d 20%, var(--card));
  border-color: #16A34A;
  color: #166534;
}

@media (max-width: 640px) {
  .vacation-date-popup {
    width: min(100%, calc(100vw - 32px));
  }

  .vacation-date-popup-card {
    padding: 16px 14px 18px;
  }

  .vacation-date-popup-month {
    font-size: 1.125rem;
  }

  .vacation-date-popup-day {
    min-height: 3rem;
    font-size: 1rem;
  }

  .vacation-date-popup-nav-btn {
    width: 42px;
    height: 42px;
  }
}

.vacation-notes {
  min-height: 88px;
}

.vacation-submit-button {
  justify-self: start;
}

.vacation-form-message {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.vacation-form-message--ok {
  color: #166534;
}

.vacation-form-message--error {
  color: #b91c1c;
}

.vacation-view-nav .updates-view-button {
  min-width: 5.5rem;
}

.vacation-view-button-with-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.vacation-view-count-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #DC2626;
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 1.25rem;
  text-align: center;
}

.vacation-card--needs-review {
  box-shadow: inset 3px 0 0 #DC2626;
}

.vacation-mark-reviewed-btn {
  white-space: nowrap;
}

.vacation-layout-nav {
  margin-bottom: 12px;
}

.vacation-approval-months {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 8px;
}

.vacation-approval-month-heading {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.vacation-approval-month-list {
  margin: 0;
}

.vacation-approval-calendar-wrap {
  margin-top: 8px;
}

.vacation-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
}

.vacation-calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.vacation-calendar-legend-item::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.vacation-calendar-legend-item--pending::before {
  background: #FEF9C3;
  border-color: #EAB308;
}

.vacation-calendar-legend-item--approved::before {
  background: color-mix(in srgb, #15803d 20%, var(--card));
  border-color: #16A34A;
}

.vacation-calendar-legend-item--selection::before {
  background: color-mix(in srgb, var(--primary) 28%, var(--card));
  border-color: var(--primary);
}

.vacation-calendar-instructions {
  margin: 0 0 10px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.vacation-employee-calendar-wrap {
  margin-top: 8px;
}

.vacation-cal-day-btn {
  border: none;
  padding: 0;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.vacation-cal-day-btn.vacation-cal-day--disabled {
  cursor: default;
}

.vacation-cal-day-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  z-index: 2;
}

.vacation-cal-day--select-start,
.vacation-cal-day--select-end,
.vacation-cal-day--select-range,
.vacation-cal-day--select-preview {
  background: color-mix(in srgb, var(--primary) 22%, var(--card)) !important;
}

.vacation-cal-day--select-start .calendar-day-num,
.vacation-cal-day--select-end .calendar-day-num {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 999px;
}

.vacation-cal-bars-overlay--readonly,
.vacation-cal-bars-overlay--readonly .vacation-cal-bar {
  pointer-events: none;
}

.vacation-cal-bar--readonly {
  cursor: default;
}

.vacation-cal-submit-card {
  max-width: 28rem;
}

.vacation-cal-submit-notes-field {
  display: block;
  margin: 12px 0 0;
}

.vacation-cal-submit-error {
  margin: 10px 0 0;
  font-size: 0.875rem;
  color: #b91c1c;
}

[data-theme="dark"] .vacation-cal-submit-error {
  color: #fca5a5;
}

.vacation-approval-calendar-scroll {
  max-height: calc(100vh - 280px);
  min-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 12px;
}

.vacation-calendar-month {
  margin-bottom: 28px;
}

.vacation-calendar-month:last-of-type {
  margin-bottom: 8px;
}

.vacation-calendar-month-label {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

.vacation-cal-month-shell {
  width: 100%;
  --vacation-cal-weeks: 6;
  --vacation-cal-lanes: 1;
  --vacation-bar-lane-height: 1.125rem;
}

.vacation-cal-month-shell .calendar-weekdays {
  margin-bottom: 4px;
}

.vacation-cal-grid-wrap {
  position: relative;
  width: 100%;
}

.vacation-cal-grid {
  grid-template-rows: repeat(
    var(--vacation-cal-weeks),
    minmax(calc(5.5rem + (var(--vacation-cal-lanes) - 1) * var(--vacation-bar-lane-height)), 1fr)
  );
}

.vacation-cal-day-head {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
  min-width: 0;
  padding: 0;
  line-height: 1.15;
}

.vacation-cal-grid .calendar-day-num {
  flex-shrink: 0;
  margin: 6px 6px 0 0;
  margin-left: auto;
  align-self: flex-end;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 4px;
}

.vacation-cal-day-closed {
  font-size: 0.58rem;
  font-weight: 700;
  color: #b91c1c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
  align-self: center;
  margin: 6px 0 0 6px;
}

[data-theme="dark"] .vacation-cal-day-closed {
  color: #fca5a5;
}

.vacation-cal-bars-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(
    var(--vacation-cal-weeks),
    minmax(calc(5.5rem + (var(--vacation-cal-lanes) - 1) * var(--vacation-bar-lane-height)), 1fr)
  );
  gap: 4px;
  pointer-events: none;
}

.vacation-cal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: var(--vacation-bar-lane-height);
  margin: calc(1.85rem + var(--vacation-bar-lane, 0) * var(--vacation-bar-lane-height)) 3px 0;
  padding: 0 6px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: auto;
  align-self: start;
  transition: filter 0.15s;
}

.vacation-cal-bar--single {
  border-radius: 4px;
}

.vacation-cal-bar--start {
  border-radius: 4px 0 0 4px;
  margin-right: 0;
  border-right-width: 0;
}

.vacation-cal-bar--mid {
  border-radius: 0;
  margin-left: 0;
  margin-right: 0;
  border-left-width: 0;
  border-right-width: 0;
}

.vacation-cal-bar--end {
  border-radius: 0 4px 4px 0;
  margin-left: 0;
  border-left-width: 0;
}

.vacation-cal-bar--pending {
  background: #FEF9C3;
  border-color: #EAB308;
  color: #713f12;
}

.vacation-cal-bar--approved {
  background: color-mix(in srgb, #15803d 22%, var(--card));
  border-color: #16A34A;
  color: #166534;
}

.vacation-cal-bar--colored {
  background: var(--vacation-bar-bg);
  border-color: var(--vacation-bar-border);
  color: var(--vacation-bar-text);
}

.vacation-cal-bar:hover {
  filter: brightness(0.96);
}

.vacation-cal-bar-name {
  font-weight: 700;
  flex-shrink: 0;
}

.vacation-cal-bar-meta {
  font-weight: 500;
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vacation-approval-calendar-sentinel {
  height: 1px;
}

.vacation-day-dialog-card {
  width: min(100%, 34rem);
}

.vacation-day-request-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(50vh, 24rem);
  overflow-y: auto;
}

.vacation-day-request {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.vacation-day-request--pending {
  background: #FEF9C3;
  border-color: #EAB308;
}

.vacation-day-request--approved {
  background: color-mix(in srgb, #15803d 14%, var(--card));
  border-color: #16A34A;
}

.vacation-day-request-main {
  flex: 1;
  min-width: 0;
}

.vacation-day-request-name {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
}

.vacation-day-request-dates,
.vacation-day-request-status,
.vacation-day-request-notes {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.vacation-day-request-notes {
  margin-top: 6px;
  color: var(--text);
}

.vacation-day-request-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.vacation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vacation-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.vacation-card-main {
  flex: 1;
  min-width: 0;
}

.vacation-card-name {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.vacation-card-dates {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.vacation-card-meta {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.vacation-card-notes {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
}

.vacation-card-denial-reason {
  margin: 8px 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #991b1b;
  white-space: pre-wrap;
}

.vacation-deny-dialog-card {
  width: min(100%, 34rem);
}

.vacation-deny-reason-field {
  display: block;
  margin: 0 0 12px;
}

.vacation-deny-reason {
  width: 100%;
  margin-top: 6px;
  resize: vertical;
  min-height: 4.5rem;
}

.vacation-deny-error {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: #b91c1c;
}

.vacation-deny-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.vacation-modifications {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0;
}

.vacation-modification-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.vacation-edit-btn {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.vacation-edit-btn:hover {
  border-color: var(--primary-dark);
  background: color-mix(in srgb, var(--primary) 18%, var(--card));
}

.vacation-delete-btn {
  border-color: #DC2626;
  color: #991b1b;
  background: color-mix(in srgb, #b91c1c 10%, var(--card));
}

.vacation-delete-btn:hover {
  border-color: #b91c1c;
  background: color-mix(in srgb, #b91c1c 18%, var(--card));
}

.vacation-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 26, 58, 0.55);
}

.vacation-edit-modal[hidden] {
  display: none;
}

.vacation-edit-modal-card {
  width: min(100%, 680px);
  max-height: min(92vh, 900px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px var(--shadow);
}

.vacation-edit-title {
  margin: 0 0 18px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.vacation-edit-form {
  margin: 0;
}

.vacation-edit-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.vacation-card--pending {
  background: #FEF9C3;
  border-color: #EAB308;
}

.vacation-card--approved {
  background: color-mix(in srgb, #15803d 14%, var(--card));
  border-color: #16A34A;
}

.vacation-card--denied {
  background: color-mix(in srgb, #b91c1c 12%, var(--card));
  border-color: #DC2626;
}

.vacation-card--past {
  opacity: 0.82;
}

.vacation-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.vacation-approve-btn {
  border-color: #16A34A;
  color: #166534;
  background: color-mix(in srgb, #15803d 12%, var(--card));
}

.vacation-approve-btn:hover {
  border-color: #15803d;
  background: color-mix(in srgb, #15803d 20%, var(--card));
}

.vacation-deny-btn {
  border-color: #DC2626;
  color: #991b1b;
  background: color-mix(in srgb, #b91c1c 10%, var(--card));
}

.vacation-deny-btn:hover {
  border-color: #b91c1c;
  background: color-mix(in srgb, #b91c1c 18%, var(--card));
}

.vacation-archive-btn {
  border-color: var(--muted);
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 12%, var(--card));
}

.vacation-archive-btn:hover {
  border-color: var(--text);
  background: color-mix(in srgb, var(--muted) 20%, var(--card));
}

.schedule-cell-vacation-pending,
.schedule-weekend.schedule-cell-vacation-pending {
  background: #FEF9C3 !important;
  box-shadow: inset 0 0 0 1px #EAB308;
}

.schedule-cell-vacation-approved,
.schedule-weekend.schedule-cell-vacation-approved {
  background: color-mix(in srgb, #86efac 55%, #dcfce7) !important;
  box-shadow: inset 0 0 0 1px #16A34A;
}

.schedule-cell-vacation-denied,
.schedule-weekend.schedule-cell-vacation-denied {
  background: color-mix(in srgb, #fca5a5 45%, #fee2e2) !important;
  box-shadow: inset 0 0 0 1px #DC2626;
}

.schedule-hours-vacation {
  color: var(--text);
  font-weight: 800;
  font-size: 0.9375rem;
}

.schedule-cell-vacation-pending .schedule-hours-vacation {
  color: #854d0e;
}

.schedule-cell-vacation-approved .schedule-hours-vacation {
  color: #166534;
}

.schedule-cell-vacation-denied .schedule-hours-vacation {
  color: #991b1b;
}

[data-theme="dark"] .schedule-cell-vacation-pending,
[data-theme="dark"] .schedule-weekend.schedule-cell-vacation-pending {
  background: color-mix(in srgb, #EAB308 32%, var(--card)) !important;
  box-shadow: inset 0 0 0 1px #CA8A04;
}

[data-theme="dark"] .schedule-cell-vacation-approved,
[data-theme="dark"] .schedule-weekend.schedule-cell-vacation-approved {
  background: color-mix(in srgb, #15803d 35%, var(--card)) !important;
  box-shadow: inset 0 0 0 1px #16A34A;
}

[data-theme="dark"] .schedule-cell-vacation-denied,
[data-theme="dark"] .schedule-weekend.schedule-cell-vacation-denied {
  background: color-mix(in srgb, #b91c1c 30%, var(--card)) !important;
  box-shadow: inset 0 0 0 1px #DC2626;
}

.calendar-vacation-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid transparent;
}

.calendar-vacation-badge--pending {
  background: color-mix(in srgb, #EAB308 22%, var(--card));
  border-color: #EAB308;
  color: #854d0e;
}

.calendar-vacation-badge--approved {
  background: color-mix(in srgb, #15803d 20%, var(--card));
  border-color: #16A34A;
  color: #166534;
}

.calendar-vacation-badge--denied {
  background: color-mix(in srgb, #b91c1c 16%, var(--card));
  border-color: #DC2626;
  color: #991b1b;
}

[data-theme="dark"] .vacation-card--pending {
  background: color-mix(in srgb, #EAB308 16%, var(--card));
}

[data-theme="dark"] .vacation-card--approved {
  background: color-mix(in srgb, #15803d 18%, var(--card));
}

[data-theme="dark"] .vacation-card--denied {
  background: color-mix(in srgb, #b91c1c 16%, var(--card));
}

/* --- Important dates (admin import + calendar/schedule) --- */
.important-dates-form-section,
.important-dates-list-section {
  margin-top: 24px;
}

.important-dates-form {
  display: grid;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto 28px;
}

.important-dates-kind-fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.important-dates-kind-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.important-dates-kind-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  cursor: pointer;
  font-weight: 600;
}

.important-dates-kind-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.important-dates-field-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.important-dates-field-row.important-dates-field--inactive .form-label,
.important-dates-field-row.important-dates-field--inactive input {
  color: var(--muted);
}

.important-dates-field-row.important-dates-field--inactive input:disabled {
  background: color-mix(in srgb, var(--muted) 10%, var(--input-bg));
  border-color: color-mix(in srgb, var(--muted) 25%, var(--border));
  cursor: not-allowed;
  opacity: 0.75;
}

.important-dates-field-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.important-dates-view-nav {
  margin-bottom: 16px;
}

.important-dates-item--archived {
  opacity: 0.88;
}

.important-dates-item-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.important-dates-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.important-dates-message {
  margin: 0;
  font-size: 0.9375rem;
}

.important-dates-message--error {
  color: #b91c1c;
}

.important-dates-message--success {
  color: #15803d;
}

.important-dates-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.important-dates-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
}

.important-dates-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.important-dates-item-date {
  font-weight: 700;
  color: var(--text);
}

.important-dates-item-kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.important-dates-item-kind--timed {
  background: color-mix(in srgb, #3b82f6 18%, var(--card));
  color: #1d4ed8;
}

.important-dates-item-kind--all_day {
  background: color-mix(in srgb, #8b5cf6 18%, var(--card));
  color: #6d28d9;
}

.important-dates-item-kind--office_closed {
  background: color-mix(in srgb, #ef4444 16%, var(--card));
  color: #b91c1c;
}

.important-dates-item-title {
  color: var(--text);
}

.important-dates-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-day-event {
  display: block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-day-event--timed {
  background: color-mix(in srgb, #3b82f6 18%, var(--card));
  color: #1d4ed8;
}

.calendar-day-event--all_day {
  background: color-mix(in srgb, #8b5cf6 18%, var(--card));
  color: #6d28d9;
}

.calendar-day-event--holiday {
  background: color-mix(in srgb, #dc2626 16%, var(--card));
  color: #b91c1c;
}

.calendar-day-closed {
  display: block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.3;
  background: color-mix(in srgb, #ef4444 16%, var(--card));
  color: #b91c1c;
  white-space: normal;
  word-break: break-word;
}

.calendar-day--closed:not(.calendar-day--other) {
  background: color-mix(in srgb, #ef4444 10%, var(--input-bg));
  border-color: color-mix(in srgb, #ef4444 28%, transparent);
}

.schedule-day-closed,
.schedule-cell-closed {
  background: color-mix(in srgb, #ef4444 10%, var(--card)) !important;
}

.schedule-weekend.schedule-cell-closed,
.schedule-weekend.schedule-day-closed {
  background: color-mix(in srgb, #ef4444 14%, color-mix(in srgb, var(--muted) 14%, var(--card))) !important;
}

.schedule-row-me td.schedule-cell-closed:not(.schedule-weekend) {
  background: color-mix(in srgb, #ef4444 10%, var(--card)) !important;
}

.schedule-row-editable td.schedule-cell-closed:not(.schedule-weekend) {
  background: color-mix(in srgb, #ef4444 12%, color-mix(in srgb, var(--primary) 4%, var(--card))) !important;
}

.schedule-closed-overlay {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 4px 1px;
  overflow: visible;
}

.schedule-closed-overlay-text {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-weight: 700;
  color: color-mix(in srgb, #b91c1c 62%, transparent);
  white-space: nowrap;
}

[data-theme="dark"] .calendar-day-event--timed {
  color: #93c5fd;
}

[data-theme="dark"] .calendar-day-event--all_day {
  color: #c4b5fd;
}

[data-theme="dark"] .calendar-day-event--holiday {
  color: #fca5a5;
}

[data-theme="dark"] .calendar-day-closed,
[data-theme="dark"] .important-dates-item-kind--office_closed {
  color: #fca5a5;
}

[data-theme="dark"] .schedule-closed-overlay-text {
  color: color-mix(in srgb, #fca5a5 68%, transparent);
}
