/* Pooja Hospital HMS v2 — Deep Navy + Electric Blue */
:root {
  --sidebar-bg: #0b1437;
  --sidebar-active: #1e3a8a;
  --sidebar-muted: #5b7fbd;
  --sidebar-text-active: #93c5fd;
  --sidebar-accent: #3b82f6;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --page-bg: #f0f4ff;
  --card: #ffffff;
  --card-border: #e2e8f0;
  --table-head: #f8faff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --waiting-bg: #fef3c7;
  --waiting-text: #92400e;
  --process-bg: #dbeafe;
  --process-text: #1e40af;
  --done-bg: #d1fae5;
  --done-text: #065f46;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --header-h: 60px;
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-input: 8px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 16px;
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.5;
  font-weight: 400;
  padding-bottom: env(safe-area-inset-bottom);
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  color: var(--primary-hover);
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-muted);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.2s ease, transform 0.2s ease;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-section-title {
  display: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
  height: var(--header-h);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--sidebar-text-active);
}
.sidebar-brand-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0 1rem;
}
.nav-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 0.75rem 1rem 0.35rem;
  opacity: 0.85;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  margin: 0 0.5rem 0.15rem;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-weight: 500;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-active);
  text-decoration: none;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--sidebar-accent);
}
.nav-item svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.2s ease;
}
.sidebar.collapsed ~ .main-wrap {
  margin-left: var(--sidebar-collapsed);
}

.top-header {
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  height: var(--header-h);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-card);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.sidebar-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--card-border);
  background: var(--table-head);
  border-radius: var(--radius-btn);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.page-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}
.header-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.header-user strong {
  color: var(--text);
  font-weight: 600;
}
.badge-role {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--table-head);
  color: var(--primary);
  font-weight: 600;
  text-transform: capitalize;
}

.content-area {
  padding: 1.25rem;
  flex: 1;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-btn);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.flash.ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.flash.err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--card-border);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.15rem;
}
.card-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 1100px) {
  .grid-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .grid-stats {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  border-left: 3px solid var(--primary);
  position: relative;
}
.stat-card.stat-wait {
  border-left-color: var(--warning);
}
.stat-card.stat-done {
  border-left-color: var(--success);
}
.stat-card.stat-follow {
  border-left-color: #8b5cf6;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
  font-weight: 500;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.stat-trend {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--card-border);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.data-table thead th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: var(--table-head);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table tbody tr:nth-child(even) {
  background: var(--table-head);
}
.data-table tbody tr:nth-child(odd) {
  background: #fff;
}
.data-table tbody td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background: #eff6ff !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 38px;
  padding: 0 18px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
/* Anchor styled as primary: global a:hover must not turn label blue on blue */
a.btn-primary,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:focus-visible {
  color: #fff;
}
.btn-secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.btn-secondary:hover {
  background: #f8fafc;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(0.92);
}
.user-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.user-delete-form {
  display: inline;
  margin: 0;
}
.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8125rem;
}
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: #eff6ff;
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-btn);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 720px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}
.req::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}
.input,
select.input,
textarea.input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-input);
  font-size: 0.875rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px #3b82f6;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-badge.waiting {
  background: var(--waiting-bg);
  color: var(--waiting-text);
}
.status-badge.in_process {
  background: var(--process-bg);
  color: var(--process-text);
}
.status-badge.completed {
  background: var(--done-bg);
  color: var(--done-text);
}
.status-badge.neutral {
  background: #e5e7eb;
  color: #475569;
}
.status-badge.active-doc {
  background: var(--done-bg);
  color: var(--done-text);
}

.pill-overdue {
  background: #fee2e2;
  color: #b91c1c;
}
.pill-today {
  background: #fef3c7;
  color: var(--waiting-text);
}
.pill-upcoming {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  min-height: 1.25rem;
}
.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.filter-tag button {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
  opacity: 0.7;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.empty-state img {
  max-width: 220px;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
}
.empty-state h3 {
  margin: 0 0 0.35rem;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
}

.queue-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 960px) {
  .queue-columns {
    grid-template-columns: 1fr;
  }
}
.queue-col {
  background: var(--card);
  border-radius: var(--radius-card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  min-height: 160px;
}
.queue-col-head {
  padding: 0.65rem 0.85rem;
  font-weight: 600;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.queue-col-body {
  padding: 0.65rem;
}
.queue-card {
  background: var(--table-head);
  border-radius: 8px;
  padding: 0.65rem;
  margin-bottom: 0.45rem;
  border: 1px solid var(--card-border);
  font-size: 0.8125rem;
}
.queue-card .name {
  font-weight: 600;
  color: var(--text);
}
.queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}
.wait-live {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--primary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: var(--radius-card);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
}
.modal h3 {
  margin: 0 0 1rem;
  font-weight: 600;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--table-head);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 99;
}
.sidebar-backdrop.show {
  display: block;
}

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 150;
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  color: var(--sidebar-muted);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.35rem 0.15rem;
  text-decoration: none;
}
.bottom-nav a:hover,
.bottom-nav a.active {
  color: var(--sidebar-text-active);
}
.bottom-nav svg {
  display: block;
  margin: 0 auto 0.15rem;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0 !important;
  }
  .bottom-nav {
    display: flex;
  }
  .content-area {
    padding-bottom: 4.5rem;
  }
}

@media (min-width: 901px) {
  .bottom-nav {
    display: none !important;
  }
}

.quick-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 480px;
}
.quick-search .input {
  flex: 1;
  min-width: 160px;
}

/* —— Reports / analytics dashboard —— */
.rep-dashboard {
  max-width: 1200px;
  margin: 0 auto;
}
.rep-head {
  margin-bottom: 0.65rem;
}
.rep-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.rep-lead {
  margin: 0.3rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.rep-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}
.rep-filter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.rep-filter-btn {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.rep-filter-btn:hover {
  background: #e2e8f0;
  color: #334155;
}
.rep-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.rep-filter-btn--custom .rep-chevron {
  font-size: 0.65rem;
  margin-left: 0.15rem;
  opacity: 0.85;
}
.rep-custom-wrap {
  position: relative;
}
.rep-custom-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 40;
  min-width: 280px;
  padding: 0.65rem 0.75rem 0.75rem;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 0.65rem;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}
.rep-custom-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.65rem;
}
.rep-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.rep-field label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.rep-filter-tags {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 0.15rem;
}
.rep-range-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-weight: 500;
}
.rep-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
@media (max-width: 900px) {
  .rep-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .rep-kpi-grid {
    grid-template-columns: 1fr;
  }
}
.rep-kpi-card {
  background: #fff;
  border: 1px solid #e8ecf2;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.rep-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.rep-kpi-icon {
  display: flex;
  color: var(--primary);
  opacity: 0.9;
}
.rep-kpi-trend {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.rep-kpi-trend--good {
  color: #059669;
}
.rep-kpi-trend--bad {
  color: #dc2626;
}
.rep-kpi-trend--neutral {
  color: #64748b;
}
.rep-kpi-value {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.2;
}
.rep-kpi-label {
  margin-top: 0.15rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.rep-kpi-sub {
  margin-top: 0.35rem;
  font-size: 0.6875rem;
  color: #94a3b8;
}
.rep-insight-box {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 0.75rem 1rem 0.85rem;
  margin-bottom: 0.65rem;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.06);
}
.rep-insight-head {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.rep-insight-list {
  margin: 0 0 0.5rem;
  padding-left: 1.15rem;
  font-size: 0.8125rem;
  color: #334155;
  line-height: 1.55;
}
.rep-insight-narr {
  margin: 0;
  font-size: 0.8125rem;
  color: #475569;
  line-height: 1.5;
}
.rep-section {
  margin-bottom: 0.75rem;
}
.rep-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.rep-section-title--inline {
  margin: 0;
}
.rep-section-lead {
  margin: -0.15rem 0 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.rep-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
@media (max-width: 900px) {
  .rep-chart-grid {
    grid-template-columns: 1fr;
  }
}
.rep-chart-card {
  background: #fff;
  border: 1px solid #e8ecf2;
  border-radius: 12px;
  padding: 14px 16px 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  min-height: 0;
}
.rep-chart-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #1e293b;
}
.rep-chart-hint {
  margin: 0.2rem 0 0.45rem;
  font-size: 0.6875rem;
  color: #94a3b8;
  line-height: 1.35;
}
.rep-chart-canvas {
  position: relative;
  width: 100%;
  height: 220px;
  min-height: 200px;
}
.rep-chart-canvas--wide {
  height: 260px;
  min-height: 220px;
}
.rep-chart-canvas canvas {
  max-width: 100% !important;
}
.rep-table-card {
  background: #fff;
  border: 1px solid #e8ecf2;
  border-radius: 12px;
  padding: 0.5rem 0.65rem 0.65rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.rep-doc-table tbody tr:hover {
  background: #f8fafc;
}
.rep-table-empty {
  color: #94a3b8;
  text-align: center;
  padding: 1rem !important;
}
.rep-follow-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.rep-empty-note {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.rep-section--followups {
  margin-bottom: 1.25rem;
}

.data-table--dense thead th {
  padding: 0.4rem 0.55rem;
  font-size: 0.68rem;
}
.data-table--dense tbody td {
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 800px) {
  .metric-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
.metric-pill {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.metric-pill .v {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}
.metric-pill .l {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.refraction-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 800px) {
  .refraction-grid {
    grid-template-columns: 1fr;
  }
}
.refraction-block h4 {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Refraction page header (premium) */
.refraction-page-head--lux {
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 48%, #eef2ff 100%);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}
.refraction-page-head-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.refraction-page-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}
.refraction-page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.refraction-page-meta {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 42rem;
}
.refraction-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Prescription sheet — production clinical */
.refraction-card--rx {
  position: relative;
  border: 1px solid #d4d4d8;
  background: #fafafa;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.refraction-card--rx::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #3b82f6;
  opacity: 0.85;
  pointer-events: none;
}
.ref-rx-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e4e4e7;
}
.ref-rx-toolbar-main {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
}
.ref-rx-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #1e40af;
  background: #e8f0fe;
  border: 1px solid #bfdbfe;
}
.ref-rx-heading {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.ref-rx-toolbar-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 38rem;
}
.ref-rx-toolbar-hint strong {
  color: #1e3a8a;
  font-weight: 600;
}
.ref-rx-kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  margin: 0 0.1rem;
  font-size: 0.7rem;
  font-family: inherit;
  font-weight: 600;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 0 #e4e4e7;
  vertical-align: middle;
}
.ref-rx-copy-btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  color: #1e40af;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.ref-rx-copy-btn:hover {
  border-color: var(--primary);
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}
.ref-rx-copy-btn:active {
  transform: translateY(1px);
}

.ref-rx-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  border: 1px solid #d4d4d8;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ref-rx-col-corner {
  width: 3.25rem;
  min-width: 2.75rem;
  max-width: 4rem;
}
/* Six data columns share remaining width equally (table-layout: fixed). */
.ref-rx-col-data {
  width: auto;
}
.ref-rx-table {
  width: 100%;
  min-width: 420px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.ref-rx-table th,
.ref-rx-table td {
  border-bottom: 1px solid #d4d4d8;
  border-right: 1px solid #d4d4d8;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}
.ref-rx-table thead th {
  border-top: none;
}
.ref-rx-table tbody tr:last-child th,
.ref-rx-table tbody tr:last-child td {
  border-bottom: none;
}
.ref-rx-table th:last-child,
.ref-rx-table td:last-child {
  border-right: none;
}
.ref-rx-th-corner {
  width: 3.25rem;
  min-width: 2.75rem;
  background: #f4f4f5;
  border-right: 1px solid #d4d4d8 !important;
}
.ref-rx-th-eye {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  padding: 0.5rem 0.35rem;
}
.ref-rx-th-eye--re {
  background: #e8f0fe;
  color: #1e3a8a;
  border-bottom: 1px solid #cbd5e1 !important;
}
.ref-rx-th-eye--le {
  background: #eef1f5;
  color: #334155;
  border-bottom: 1px solid #cbd5e1 !important;
}
.ref-rx-th-metric,
.ref-rx-td {
  padding: 0.42rem 0.4rem;
}
.ref-rx-th-metric {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #52525b;
  background: #fafafa;
  border-bottom: 1px solid #d4d4d8 !important;
}
.ref-rx-th-metric--re {
  color: #1d4ed8;
  background: #f8fafc;
}
.ref-rx-th-metric--le {
  color: #475569;
  background: #fafafa;
}
.ref-rx-td--re {
  background: #fafdff;
}
.ref-rx-td--le {
  background: #ffffff;
}
.ref-rx-td--re-last {
  border-right: 2px solid #94a3b8;
}
.ref-rx-row-label {
  text-align: left !important;
  padding: 0.55rem 0.65rem;
  border-right: 1px solid #d4d4d8 !important;
  vertical-align: middle;
  font-weight: 800;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  color: #0f172a;
  background: #fafafa;
}
.ref-rx-row--dist .ref-rx-row-label {
  background: #f4f4f5;
}
.ref-rx-row--near .ref-rx-row-label {
  background: #fafafa;
}
.ref-rx-input-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.ref-rx-auto-hint {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #64748b;
  text-align: center;
  line-height: 1.2;
}
.ref-rx-input {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  text-align: center;
  font-weight: 600;
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.25;
  padding: 0.42rem 0.35rem;
  border-radius: 6px;
  border: 1px solid #d4d4d8;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.ref-rx-td > .ref-rx-input {
  display: block;
  width: 50%;
  margin-left: auto;
  margin-right: auto;
}
.ref-rx-td .ref-rx-input-stack {
  width: 50%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
.ref-rx-td .ref-rx-input-stack .ref-rx-input {
  width: 100%;
}
.ref-rx-input:hover {
  border-color: #a1a1aa;
  background: #fff;
}
.ref-rx-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.ref-rx-input--auto-filled {
  background: #eff6ff !important;
  border-color: #93c5fd !important;
}
.ref-rx-row--near .ref-rx-input:not(.ref-rx-input--auto-filled) {
  background: #fff;
}

@media (max-width: 640px) {
  .ref-rx-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .ref-rx-copy-btn {
    width: 100%;
  }
  .ref-rx-table {
    display: block;
    min-width: 0;
    width: 100%;
  }
  .ref-rx-table thead {
    display: none;
  }
  .ref-rx-table tbody {
    display: block;
  }
  .ref-rx-row {
    display: block;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    margin-bottom: 0.65rem;
    overflow: hidden;
    background: #fff;
  }
  .ref-rx-row-label {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border-right: none !important;
    border-bottom: 1px solid #e4e4e7;
  }
  .ref-rx-td {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    box-sizing: border-box;
    border-right: none !important;
    border-bottom: 1px solid #e4e4e7;
    text-align: left;
    padding: 0.5rem 0.65rem;
  }
  .ref-rx-row .ref-rx-td:last-of-type {
    border-bottom: none;
  }
  .ref-rx-td::before {
    content: attr(data-eye) " · " attr(data-field);
    flex: 0 0 5.75rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
  }
  .ref-rx-td > .ref-rx-input {
    flex: 1 1 auto;
    width: 50%;
    max-width: min(50%, 9.5rem);
    margin-left: auto;
    margin-right: auto;
  }
  .ref-rx-td > .ref-rx-input-stack {
    flex: 1 1 auto;
    width: 50%;
    max-width: min(50%, 9.5rem);
    margin-left: auto;
    margin-right: auto;
  }
  .ref-rx-td--re-last {
    border-right: none !important;
  }
}

@media (max-width: 480px) {
  .ref-rx-input {
    font-size: 0.875rem;
    padding: 0.4rem 0.28rem;
  }
}

.refraction-eyes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}
@media (max-width: 800px) {
  .refraction-eyes {
    grid-template-columns: 1fr;
  }
}
.refraction-eyes .refraction-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-input);
  padding: 0.75rem 0.85rem 0.85rem;
}
.ref-metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 5.5rem));
  gap: 0.5rem 0.65rem;
  align-items: end;
}
.ref-metric-field {
  margin-bottom: 0 !important;
}
.ref-metric-field label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.2rem;
}
.input-ref {
  width: 100%;
  max-width: 5.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 0.42rem 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.ref-va-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: flex-end;
}
.ref-va-field {
  margin-bottom: 0 !important;
}
.input-ref-va {
  width: 100%;
  max-width: 7.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 0.42rem 0.5rem;
  font-size: 0.875rem;
}
.refraction-hint {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.ref-fu-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

/* Refraction: VA + follow-up + remarks clinical panel */
.ref-clinical-panel {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}
.ref-clinical-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: stretch;
}
@media (max-width: 820px) {
  .ref-clinical-grid {
    grid-template-columns: 1fr;
  }
}
.ref-clinical-col--stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}
.ref-clinical-col--remarks {
  display: flex;
  min-width: 0;
}
.ref-clinical-card {
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-card);
  padding: 0.7rem 0.95rem 0.8rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 16px rgba(15, 23, 42, 0.04);
}
.ref-clinical-card-title {
  margin: 0 0 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #e8edf4;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.ref-va-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.85rem;
}
.ref-va-eye {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.ref-va-eye-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.ref-va-input {
  width: 100%;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.45rem 0.5rem;
  border-radius: 0.5rem;
}
.ref-fu-date-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-bottom: 0.45rem;
}
.ref-fu-date-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}
.ref-fu-date-input {
  width: 100%;
  max-width: 100%;
  border-radius: 0.5rem;
  padding: 0.42rem 0.55rem;
}
.ref-clinical-card .ref-fu-quick {
  margin-top: 0.15rem;
}
.ref-fu-quick-btn {
  appearance: none;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.ref-fu-quick-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #334155;
}
.ref-fu-quick-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.ref-fu-quick-btn--active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.28);
}
.ref-clinical-footnote {
  margin: 0.45rem 0 0;
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.ref-remarks-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ref-remarks-textarea {
  flex: 1;
  min-height: 6.5rem;
  resize: vertical;
  border-radius: 0.65rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.55rem 0.7rem;
  font-size: 0.875rem;
  line-height: 1.45;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.ref-remarks-textarea:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: none;
}
.ref-remarks-textarea::placeholder {
  color: #94a3b8;
}
.ref-clinical-actions {
  margin-top: 0.65rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--card-border);
}
.btn-ref-save {
  padding: 0.5rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.refraction-form .refraction-card .form-group {
  margin-bottom: 0.65rem;
}

/* Patient registry — premium SaaS */
.patient-registry-card--premium {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 28px rgba(15, 23, 42, 0.06);
  border: 1px solid #e8ecf2;
  padding: 1.15rem 1.25rem 1.2rem;
}
.pr-registry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem 1.25rem;
  margin-bottom: 0.85rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--card-border);
}
.pr-registry-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}
.pr-registry-sub {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 36rem;
}
.pr-btn-new-patient {
  flex-shrink: 0;
  height: 40px;
  padding: 0 1.1rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}
.pr-icon-plus {
  flex-shrink: 0;
  display: block;
}
.patient-filter-tags.pr-filter-tags {
  margin-bottom: 0.65rem;
  min-height: 0;
}
.filter-tag.pr-filter-tag {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  padding: 0.2rem 0.45rem 0.2rem 0.65rem;
  font-weight: 600;
  font-size: 0.75rem;
}
.pr-filter-tag-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0 0.15rem;
  font-size: 0.85rem;
  line-height: 1;
  color: #64748b;
  border-radius: 4px;
}
.pr-filter-tag-remove:hover {
  color: var(--danger);
  background: #fef2f2;
}
.patient-filters-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
.patient-filters-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}
.patient-filters-toggle:hover {
  background: rgba(241, 245, 249, 0.8);
}
.patient-filters-chevron {
  flex-shrink: 0;
  color: #64748b;
  transition: transform 0.2s ease;
}
.patient-filters-card.is-open .patient-filters-chevron {
  transform: rotate(180deg);
}
.patient-filters-body {
  padding: 0 0.9rem 0.85rem;
  border-top: 1px solid #eef2f7;
}
.patient-filters-form {
  padding-top: 0.65rem;
}
.patient-filters-row {
  display: grid;
  gap: 0.5rem 0.75rem;
  align-items: end;
}
.patient-filters-row--r1 {
  grid-template-columns: minmax(8rem, 2fr) minmax(5.5rem, 0.75fr) minmax(7rem, 1.15fr) minmax(8rem, 1fr);
}
.patient-filters-row--r2 {
  margin-top: 0.5rem;
  grid-template-columns: minmax(7rem, 1fr) minmax(7rem, 1fr) minmax(12rem, 1.5fr);
}
.patient-filters-form .form-group {
  margin-bottom: 0;
}
.patient-filters-form .form-group label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.28rem;
}
.patient-filters-row .fg-follow--check {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.15rem;
}
@media (max-width: 960px) {
  .patient-filters-row--r1 {
    grid-template-columns: 1fr 1fr;
  }
  .patient-filters-row--r1 .fg-search {
    grid-column: 1 / -1;
  }
  .patient-filters-row--r2 {
    grid-template-columns: 1fr 1fr;
  }
  .patient-filters-row--r2 .fg-follow--check {
    grid-column: 1 / -1;
  }
}
@media (max-width: 520px) {
  .patient-filters-row--r1,
  .patient-filters-row--r2 {
    grid-template-columns: 1fr;
  }
}
.patient-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.patient-checkbox-label input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}
.input--compact {
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
}
.pr-table-shell {
  border-radius: var(--radius-card);
  border: 1px solid var(--card-border);
  overflow: hidden;
  overflow-x: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.pr-data-table tbody tr:nth-child(odd) {
  background: #fff;
}
.pr-data-table tbody tr:nth-child(even) {
  background: #f6f8fc;
}
.pr-data-table tbody tr:hover {
  background: #e8f1ff !important;
}
.pr-data-table tbody td {
  padding: 0.58rem 0.75rem;
  font-size: 0.8125rem;
  vertical-align: middle;
  border-bottom: 1px solid #e8ecf2;
}
.pr-data-table thead th {
  padding: 0.55rem 0.75rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--card-border);
}
.pr-data-table .th-num,
.pr-data-table .th-actions {
  text-align: right;
}
.pr-data-table thead th:nth-child(8),
.pr-data-table tbody td:nth-child(8) {
  text-align: center;
}
.pr-data-table td:last-child {
  text-align: right;
}
.pr-mid {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  letter-spacing: 0.02em;
}
.pr-name-link {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.pr-name-link:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}
/* Mobile: readable digits, no “input chip” — matches row height & clinical grid */
.pr-mobile {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 500;
  font-size: 0.8125rem;
  color: #475569;
  letter-spacing: 0.03em;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.35;
}
.pr-fu-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.pr-fu-badge--none {
  background: #f1f5f9;
  color: #94a3b8;
  font-weight: 600;
}
.pr-fu-badge--today {
  background: #fee2e2;
  color: #b91c1c;
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.15);
}
.pr-fu-badge--overdue {
  background: #fecaca;
  color: #7f1d1d;
}
.pr-fu-badge--upcoming {
  background: #fef3c7;
  color: #92400e;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}
.pr-fu-badge--future {
  background: #f1f5f9;
  color: #64748b;
}
.pr-visits-cell {
  text-align: center;
}
.pr-visits-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: #e0e7ff;
  color: #3730a3;
  font-variant-numeric: tabular-nums;
}
.pr-table-row {
  cursor: pointer;
  transition: background 0.1s ease;
}
.pr-table-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.pr-actions-cell {
  cursor: default;
}
.pr-actions-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.55rem;
}
.pr-btn-visit {
  height: 30px;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}
.pr-history-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 0.15rem 0.1rem;
  border-radius: 4px;
}
.pr-history-link:hover {
  text-decoration: underline;
  background: rgba(37, 99, 235, 0.06);
}
.patient-loading-cell {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}
.patient-empty-wrap {
  padding: 0 !important;
  border: none !important;
  vertical-align: middle;
}
.btn-xs {
  height: 28px;
  padding: 0 10px;
  font-size: 0.6875rem;
  font-weight: 600;
}
.pr-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--card-border);
}
.pr-pager-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 28rem;
}
.pr-pager-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}
.pr-pager-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 0.85rem;
}
.pr-pager-btn {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.pr-pager-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}
.pr-pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pr-pager-page {
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.pr-pager-page strong {
  color: var(--text);
  font-weight: 700;
}
.pr-empty-state {
  text-align: center;
  padding: 2.25rem 1.25rem 2.5rem;
}
.pr-empty-illustration {
  margin-bottom: 0.75rem;
}
.pr-empty-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.pr-empty-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.doctor-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.badge-count {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--table-head);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Standalone login — premium SaaS */
body:has(.login-page) {
  background: #f1f5f9;
}
.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 460px);
  font-family: var(--font);
}
.login-visual {
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, #0c1929 0%, #1e3a8a 42%, #2563eb 78%, #3b82f6 100%);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 15% 85%, rgba(147, 197, 253, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 88% 12%, rgba(96, 165, 250, 0.25), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.12), transparent 65%);
  pointer-events: none;
}
.login-visual-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.login-shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(0.5px);
  opacity: 0.55;
}
.login-shape--1 {
  width: 220px;
  height: 220px;
  left: -8%;
  top: 10%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%);
}
.login-shape--2 {
  width: 160px;
  height: 160px;
  right: 5%;
  bottom: 18%;
  background: radial-gradient(circle, rgba(191, 219, 254, 0.2), transparent 65%);
}
.login-shape--3 {
  width: 100px;
  height: 100px;
  right: 22%;
  top: 22%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0.9;
}
.login-shape--4 {
  width: 140px;
  height: 140px;
  left: 18%;
  bottom: 8%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 40% 60% 55% 45%;
  opacity: 0.7;
}
.login-grid-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: linear-gradient(rgba(255, 255, 255, 0.7) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.7) 1px, transparent 1px);
  background-size: 48px 48px;
}
.login-visual-inner {
  position: relative;
  z-index: 1;
  max-width: 28rem;
}
.login-illo {
  margin-bottom: 0.25rem;
}
.login-illo-svg {
  width: min(200px, 42vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.15));
}
.login-brand-title {
  margin: 1rem 0 0.55rem;
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.login-brand-sub {
  margin: 0 0 1.35rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: rgba(226, 232, 240, 0.9);
  max-width: 26rem;
}
.login-features {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(241, 245, 249, 0.95);
}
.login-features li {
  position: relative;
  padding-left: 1.65rem;
  margin-bottom: 0.55rem;
  line-height: 1.45;
}
.login-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.15rem;
  height: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
}
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 3vw, 1.75rem);
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 24px 48px -12px rgba(15, 23, 42, 0.14);
  padding: 2rem 1.85rem 1.75rem;
}
.login-form-title {
  margin: 0 0 0.35rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.login-card .sub {
  margin: 0 0 1.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.login-flash {
  margin-bottom: 1rem;
}
.login-field-group {
  margin-bottom: 1rem;
}
.login-input-wrap {
  position: relative;
  display: block;
}
.login-input-wrap .login-input {
  width: 100%;
  padding-left: 2.75rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  display: flex;
  pointer-events: none;
  transition: color 0.15s ease;
}
.login-input-wrap:focus-within .login-input-icon {
  color: #2563eb;
}
.login-input-wrap .login-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.login-submit {
  width: 100%;
  margin-top: 0.25rem;
  height: 44px;
  font-weight: 600;
  border-radius: 10px;
  background: linear-gradient(90deg, #2563eb, #1d4ed8) !important;
  border: none;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
  filter: brightness(1.03);
}
.login-submit:active:not(:disabled) {
  transform: translateY(0);
}
.login-submit:disabled {
  opacity: 0.88;
  cursor: wait;
  transform: none;
}
.login-demo {
  margin: 1.35rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid #e8ecf2;
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.55;
}
.login-demo code {
  font-size: 0.7rem;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.login-trust {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}
@media (max-width: 900px) {
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-visual {
    display: none !important;
  }
  .login-panel {
    min-height: 100vh;
    align-items: center;
    padding: 1.5rem 1rem;
  }
}
