/* ===== AUTH SCREEN ===== */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  max-height: 48px;
  width: auto;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 0.25rem;
  text-align: center;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0 0 1.25rem;
  text-align: center;
}

.auth-form-hidden {
  display: none;
}

.auth-field {
  margin-bottom: 1rem;
}

.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.3rem;
}

.auth-field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.auth-field input:focus {
  border-color: rgba(56, 189, 248, 0.7);
}

.auth-field input::placeholder {
  color: #64748b;
}

.auth-error {
  font-size: 0.8rem;
  color: #f87171;
  min-height: 1.2em;
  margin: 0.25rem 0 0.75rem;
}

/* MFA enrollment QR + manual secret key */
.mfa-qr {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 1rem;
}

.mfa-qr img {
  width: 180px;
  height: 180px;
  background: #fff;
  padding: 8px;
  border-radius: 8px;
}

.mfa-secret {
  display: block;
  word-break: break-all;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  user-select: all;
}

.auth-btn {
  width: 100%;
  padding: 0.65rem;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(34, 211, 238, 0.9));
  color: #020617;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-btn:hover {
  opacity: 0.9;
}

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}




.app-container-hidden {
  display: none;
}

/* Header user / logout */
.header-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 1rem;
}

.user-email {
  font-size: 0.75rem;
  color: #94a3b8;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  padding: 0.3rem 0.7rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 6px;
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}


/* ===== END AUTH ===== */

html {
  /* Prevent header/logo "jump" when content adds/removes scrollbar */
  scrollbar-gutter: stable;
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  /* Fallback for browsers that don't support scrollbar-gutter */
  overflow-y: scroll;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: radial-gradient(circle at top left, #1d4ed8, #020617 60%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  max-height: 40px;
  width: auto;
}

.brand-logo-small {
  max-height: 24px;
  width: auto;
  opacity: 0.7;
}

.top-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.7);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(34, 211, 238, 0.9));
  border-color: transparent;
  color: #020617;
}

.tab-panel-hidden {
  display: none;
}

.under-construction {
  min-height: calc(100vh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0;
}

.under-construction-card {
  width: min(680px, 100%);
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.55), rgba(15, 23, 42, 0.98));
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 1);
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.under-construction-card h2 {
  margin: 0 0 0.35rem 0;
  font-size: 1.25rem;
}

.under-construction-card p {
  margin: 0;
  color: #cbd5f5;
}


.file-card {
  min-width: 360px;
  max-width: 520px;
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.2), rgba(15, 23, 42, 0.95));
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 0.85rem 1rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Upload card — compact, sits flush with sibling cards ───────── */





.upload-section {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.metrics-column {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex: 2 1 0;
  min-width: 0;
}


.stats-card {
  flex: 1 1 320px;
  min-width: 280px;
  max-width: none;
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.4), rgba(15, 23, 42, 0.98));
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 0.85rem 1rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stats-card-body {
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}









.match-method-row {
  cursor: pointer;
  transition: background 120ms ease;
}

.match-method-row:hover td {
  background: rgba(56, 189, 248, 0.18);
}

.match-method-row-active td {
  background: rgba(56, 189, 248, 0.35) !important;
  color: #f8fafc;
  font-weight: 600;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.stats-table th,
.stats-table td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid rgba(30, 64, 175, 0.5);
  text-align: center;
  white-space: nowrap;
}

.stats-table thead th {
  font-weight: 600;
  color: #e5e7eb;
  border-bottom: 1px solid rgba(56, 189, 248, 0.7);
}

.stats-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.65);
}

.stats-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.9);
}

.stats-table tbody tr:last-child td {
  font-weight: 600;
}

.file-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.file-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e5e7eb;
}

.file-card-subtitle {
  margin: 0.15rem 0 0 0;
  font-size: 0.8rem;
  color: #9ca3af;
}

.file-card-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.file-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.file-input-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.file-input-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e5e7eb;
}





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

.dropzone {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px dashed rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.9);
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  color: #e5e7eb;
  font-size: 0.8rem;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}











.dropzone-clear {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.05rem 0.25rem;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}



.dropzone-clear:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #e5e7eb;
}

.dropzone.selected {
  border-style: solid;
  border-color: #22c55e;
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.15), rgba(15, 23, 42, 0.95));
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.3);
}



.dropzone.drag-over {
  border-style: solid;
  border-color: #22d3ee;
  background: radial-gradient(circle at top left, rgba(34, 211, 238, 0.18), rgba(15, 23, 42, 1));
}


.file-card-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-start;
}

.primary-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.9);
  background: linear-gradient(135deg, #22c55e, #22d3ee);
  color: #020617;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease, opacity 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
}

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



.primary-btn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

label {
  font-size: 0.8rem;
  color: #9ca3af;
}

select,
input[type="text"] {
  padding: 0.5rem 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

select:focus,
input[type="text"]:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
  background: rgba(15, 23, 42, 1);
}

select {
  cursor: pointer;
}

.app-main {
  padding: 1rem 1.5rem 2rem;
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.search-group {
  min-width: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.column-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 2;
}

.column-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 160px;
  max-width: 240px;
}

.column-filter label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-section {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), #020617 65%);
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.status-text {
  color: #9ca3af;
}

.pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination button {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pagination button:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e, #22d3ee);
  border-color: transparent;
  color: #020617;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.table-actions #runMatchingBtn {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.15), rgba(15, 23, 42, 0.95));
  color: #e5e7eb;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.table-actions #runMatchingBtn:hover {
  background: linear-gradient(135deg, #22c55e, #22d3ee);
  border-color: transparent;
  color: #020617;
}

.icon-button {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e, #22d3ee);
  border-color: transparent;
  color: #020617;
}

.table-wrapper {
  border-radius: 0.75rem;
  border: 1px solid rgba(51, 65, 85, 0.9);
  overflow: auto;
  max-height: calc(100vh - 230px);
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.25), rgba(15, 23, 42, 0.95));
}



























table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

thead tr {
  background: rgba(15, 23, 42, 0.98);
}

th,
td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(30, 64, 175, 0.4);
  text-align: left;
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: #e5e7eb;
  border-bottom: 1px solid rgba(56, 189, 248, 0.6);
  position: relative;
}

th span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.7);
}

tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.9);
}

tbody tr:hover {
  background: rgba(56, 189, 248, 0.12);
}

.app-footer {
  padding: 0.75rem 1.5rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.loading-overlay.visible {
  display: flex;
}

.loading-card {
  background: radial-gradient(circle at top, rgba(30, 64, 175, 0.8), #020617);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 1);
  max-width: 420px;
  text-align: center;
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.5);
  border-top-color: #22c55e;
  margin: 0 auto 0.75rem auto;
  animation: spin 0.9s linear infinite;
}

.loading-text-main {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 0.3rem;
}

.loading-text-sub {
  font-size: 0.8rem;
  color: #cbd5f5;
}

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

/* ── Patient Validator – DB status ─────────────────────────────── */

.pv-top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.db-status-card {
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.55), rgba(15, 23, 42, 0.98));
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 1);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.db-status-card-inline {
  min-width: 280px;
  max-width: 360px;
}

.pv-search-card {
  flex: 1;
  min-width: 320px;
}

.pv-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.pv-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 160px;
}

.pv-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pv-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="date"].pv-search-input {
  color-scheme: dark;
}

.pv-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.pv-search-btn {
  align-self: flex-end;
  white-space: nowrap;
}

.db-status-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.db-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.db-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.db-indicator-unknown .db-indicator-dot {
  background: #6b7280;
  box-shadow: 0 0 6px rgba(107, 114, 128, 0.6);
}

.db-indicator-unknown .db-indicator-text {
  color: #9ca3af;
}

.db-indicator-success .db-indicator-dot {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.db-indicator-success .db-indicator-text {
  color: #22c55e;
}

.db-indicator-error .db-indicator-dot {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

.db-indicator-error .db-indicator-text {
  color: #ef4444;
}

.db-status-message {
  margin: 0;
  font-size: 0.8rem;
  color: #cbd5f5;
  word-break: break-word;
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .file-select-wrapper,
  .file-card,
  .stats-card,
  .time-card {
    width: 100%;
  }

  .file-card-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-main {
    padding: 0.75rem 0.75rem 1.5rem;
  }

  .table-section {
    padding: 0.5rem 0.5rem 0.75rem;
  }
}

/* ── Patient Validator: encounter list & detail view ─────────────── */

.pv-list-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 1rem 0 0.75rem;
}

.pv-list-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #e2e8f0;
}

.pv-list-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

.pv-encounter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.pv-encounter-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease, background 0.15s ease;
  font: inherit;
  color: inherit;
}

.pv-encounter-card:hover {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.18);
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.2), rgba(15, 23, 42, 0.95));
}

.pv-encounter-card:active {
  transform: translateY(1px);
}

.pv-enc-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.pv-enc-card-date {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e0f2fe;
}

.pv-enc-card-days {
  font-size: 0.78rem;
  color: #94a3b8;
}

.pv-enc-card-middle {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pv-enc-card-visit {
  font-size: 0.9rem;
  color: #e2e8f0;
  font-weight: 500;
}

.pv-enc-card-doctor {
  font-size: 0.85rem;
  color: #cbd5e1;
}

.pv-enc-card-bottom {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.pv-enc-pill {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Detail view */

.pv-detail-header {
  margin: 1rem 0 0.9rem;
}

.pv-back-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pv-back-btn:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
}

.pv-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pv-detail-card {
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.25), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
}

.pv-detail-card-wide {
  grid-column: 1 / -1;
}

.pv-detail-section-title {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0f2fe;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 0.55rem;
  letter-spacing: 0.01em;
}

.pv-detail-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.7rem 1.1rem;
}

.pv-field-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.pv-field-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.pv-field-value {
  font-size: 0.9rem;
  color: #e2e8f0;
  overflow-wrap: anywhere;
}

.pv-item-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pv-item {
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left: 3px solid rgba(56, 189, 248, 0.6);
  border-radius: 8px;
}

.pv-item-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #e0f2fe;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.pv-item-sub {
  font-size: 0.85rem;
  color: #cbd5e1;
  margin-top: 0.25rem;
}

.pv-item-meta {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 0.4rem;
}

.pv-item-badge {
  display: inline-block;
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.pv-empty {
  font-size: 0.85rem;
  color: #94a3b8;
  font-style: italic;
  padding: 0.5rem 0;
}

@media (max-width: 768px) {
  .pv-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ===== RULE ENGINE MODAL ===== */

.clickable-row {
  cursor: pointer;
  transition: background-color 0.15s;
}

.clickable-row:hover {
  background-color: rgba(56, 189, 248, 0.08) !important;
}

.row-rules-passed {
  border-left: 3px solid #22c55e;
}

.row-rules-failed {
  border-left: 3px solid #ef4444;
}

.row-rules-passed td:first-child {
  padding-left: 0.6rem;
}

.row-rules-failed td:first-child {
  padding-left: 0.6rem;
}

/* Confidence-tier side bar. Recolors the left border by tier — green = exact,
   amber = manual check needed, red = no match — overriding the PASS/FAIL border
   above (same specificity, declared later so it wins). */
.pr-row-exact { border-left: 3px solid #22c55e; }
.pr-row-manual-check { border-left: 3px solid #f59e0b; }
.pr-row-no-match { border-left: 3px solid #ef4444; }
.pr-row-exact td:first-child,
.pr-row-manual-check td:first-child,
.pr-row-no-match td:first-child {
  padding-left: 0.6rem;
}

/* ── Confidence-tier filter chips (Referral Capture tab) ───────────────────── */
.cc-confidence-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 0.25rem;
}
.cc-confidence-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-right: 0.25rem;
}
.cc-conf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.cc-conf-chip:hover { border-color: rgba(148, 163, 184, 0.5); }
.cc-conf-chip-active { box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45); }
.cc-conf-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cc-conf-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.cc-conf-chip-exact .cc-conf-dot { background: #22c55e; }
.cc-conf-chip-exact .cc-conf-count { color: #4ade80; }
.cc-conf-chip-exact.cc-conf-chip-active { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.5); }
.cc-conf-chip-manual .cc-conf-dot { background: #f59e0b; }
.cc-conf-chip-manual .cc-conf-count { color: #fbbf24; }
.cc-conf-chip-manual.cc-conf-chip-active { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.5); }
.cc-conf-chip-nomatch .cc-conf-dot { background: #94a3b8; }
.cc-conf-chip-nomatch .cc-conf-count { color: #94a3b8; }
.cc-conf-chip-nomatch.cc-conf-chip-active { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.45); }

.rule-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 2rem;
}

.rule-overlay.visible {
  display: flex;
}

.rule-modal {
  width: 96vw;
  max-width: 1400px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.rule-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  flex-shrink: 0;
}

/* ── Two-pane body: evidence (left) + rule review (right) ───────────────── */
.rule-modal-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
}

.rule-modal-left {
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.4);
}

.rule-modal-right {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.35);
}

/* Section heading shown at the top of the right pane */
.rule-pane-heading {
  padding: 1rem 1.5rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  flex-shrink: 0;
}

/* Right-pane scroll regions fill the available height */
.rule-modal-right .rule-gate-pipeline,
.rule-modal-right #prReviewPanel {
  min-height: 0;
}


/* Review panel becomes a column: gates scroll, footer pins to the bottom */
#prReviewPanel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.rule-modal-right .rule-gate-pipeline {
  flex: 1;
  overflow-y: auto;
}

.pr-review-gates {
  flex: 1;
  overflow-y: auto;
}

.pr-review-footer {
  flex-shrink: 0;
}

/* Stack to a single scrolling column on narrower screens */
@media (max-width: 1024px) {
  .rule-modal {
    width: 94vw;
    overflow-y: auto;
  }
  .rule-modal-body {
    display: block;
  }
  .rule-modal-left {
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  }
  .rule-modal-right {
    overflow: visible;
  }
  #prReviewPanel {
    display: block;
  }
  .rule-modal-right .rule-gate-pipeline,
  .pr-review-gates {
    overflow-y: visible;
  }
}

.rule-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}

.rule-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.rule-modal-close:hover {
  color: #f1f5f9;
  background: rgba(148, 163, 184, 0.15);
}

.rule-patient-summary {
  padding: 1.25rem 1.5rem;
  background: transparent;
}




/* ── Patient + Prescriber info cards (Pipeline Results modal) ── */
.rule-info-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
}

.rule-info-card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.75));
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rule-info-card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.rule-info-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.rule-info-card-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cbd5e1;
  flex: 1;
}

.rule-info-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1rem;
}

.rule-info-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.rule-info-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

.rule-info-value {
  font-size: 0.88rem;
  color: #f1f5f9;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.rule-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.rule-status-pill-icon {
  font-size: 0.8rem;
  line-height: 1;
}

.rule-status-pill-yes {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.35);
}

.rule-status-pill-no {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}

.rule-status-pill-unknown {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.3);
}

@media (max-width: 768px) {
  .rule-info-grid {
    grid-template-columns: 1fr;
  }
  .rule-info-card-body {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .rule-info-card-body {
    grid-template-columns: 1fr;
  }
}

/* Full-width card variant (used for the referrals list) */
.rule-info-card-wide {
  margin-top: 1rem;
  grid-column: 1 / -1;
}

.rule-info-card-wide .rule-info-card-body {
  display: block;
}

/* Field-grid variant inside a wide card (used by the Frontera Referral panel) */
.rule-info-card-wide .rule-info-card-body.rule-info-card-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem 1rem;
}

@media (max-width: 768px) {
  .rule-info-card-wide .rule-info-card-body.rule-info-card-fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .rule-info-card-wide .rule-info-card-body.rule-info-card-fields {
    grid-template-columns: 1fr;
  }
}


.rule-info-card-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.18);
  white-space: nowrap;
}

/* Loading placeholder for async-fetched fields (e.g. specialty) */
.rule-info-value.rule-info-loading {
  color: #94a3b8;
  font-style: italic;
  font-size: 0.82rem;
}

/* Referrals table */
.rule-referrals-body {
  overflow-x: auto;
  max-height: 240px;
  overflow-y: auto;
}

.rule-referrals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.rule-referrals-table thead th {
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  color: #94a3b8;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.95);
  z-index: 1;
}

.rule-referrals-table tbody td {
  padding: 0.45rem 0.6rem;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: top;
}

.rule-referrals-table tbody tr:last-child td {
  border-bottom: none;
}

.rule-referrals-date {
  white-space: nowrap;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.rule-referrals-loading,
.rule-referrals-empty,
.rule-referrals-error {
  margin: 0;
  padding: 0.35rem 0;
  font-size: 0.82rem;
  color: #94a3b8;
}

.rule-referrals-error {
  color: #f87171;
}

/* ── Specialty match indicator (rule engine card + all-referrals table) ─ */

.rule-spec-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.2;
}

.rule-spec-pill-icon {
  font-size: 0.75rem;
  line-height: 1;
}

.rule-spec-match-yes {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
}

.rule-spec-match-no {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.25);
}

.rule-info-muted {
  color: #94a3b8;
}

.rule-referrals-match-cell {
  white-space: nowrap;
}

.rule-referrals-row-match td {
  background: rgba(34, 197, 94, 0.07);
}

.rule-referrals-row-match td:first-child {
  border-left: 2px solid rgba(74, 222, 128, 0.7);
  padding-left: calc(0.6rem - 2px);
}





.rule-gate-pipeline {
  padding: 1.5rem;
}

.rule-loading,
.rule-empty {
  color: #94a3b8;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
}

.rule-error {
  color: #f87171;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem 0;
}

.rule-gates {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rule-gate {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.4);
  transition: border-color 0.2s;
}

.rule-gate.gate-passed {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.06);
}

.rule-gate.gate-failed {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
}

.rule-gate.gate-skipped {
  border-color: rgba(148, 163, 184, 0.15);
  background: rgba(30, 41, 59, 0.3);
  opacity: 0.6;
}

.rule-gate-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.rule-gate-icon {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.gate-passed .rule-gate-icon { color: #22c55e; }
.gate-failed .rule-gate-icon { color: #ef4444; }
.gate-skipped .rule-gate-icon { color: #64748b; }

.rule-gate-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rule-gate-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
  flex: 1;
}

.rule-gate-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rule-gate-badge.gate-passed {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.rule-gate-badge.gate-failed {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.rule-gate-badge.gate-skipped {
  color: #64748b;
  background: rgba(100, 116, 139, 0.15);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.rule-gate-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
  padding-left: 1.7rem;
}

.rule-gate-msg {
  font-size: 0.8rem;
  color: #cbd5e1;
  padding-left: 1.7rem;
  font-style: italic;
}

.rule-gate-connector {
  display: flex;
  justify-content: center;
  padding: 0.35rem 0;
  color: #475569;
  font-size: 1.1rem;
}

@media (max-width: 600px) {
  .rule-modal {
    max-width: 100%;
    margin: 1rem;
  }
  .rule-summary-row {
    flex-direction: column;
    gap: 0.4rem;
  }
}

/* ===== PIPELINE RESULTS TAB ===== */

.pr-tab {
  gap: 0.6rem !important;   /* tighter spacing between sections */
}

.pr-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pr-header-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.pr-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}

.pr-meta {
  font-size: 0.8rem;
  color: #64748b;
}

.pr-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pr-timestamp-label {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr-timestamp {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

/* Summary pills — clickable filter buttons */
.pr-summary-row {
  display: flex;
  gap: 0.5rem;
}

.pr-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.6);
  min-width: 80px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.pr-pill:hover {
  border-color: rgba(148, 163, 184, 0.4);
}

.pr-pill.pr-pill-active {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.5);
  border-color: rgba(56, 189, 248, 0.6);
}

.pr-pill-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}

.pr-pill-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.pr-pill-total .pr-pill-value { color: #e2e8f0; }

/* Capture-state filter chips. One color per bucket; the active chip gets a
   stronger background and a focus ring (.pr-pill.pr-pill-active above). */
.pr-pill-doctor-specialty .pr-pill-value { color: #22c55e; }
.pr-pill-doctor-specialty:not(.pr-pill-active) {
  border-color: rgba(34, 197, 94, 0.30);
  background: rgba(34, 197, 94, 0.06);
}
.pr-pill-doctor-specialty.pr-pill-active { background: rgba(34, 197, 94, 0.14); }

.pr-pill-doctor-only .pr-pill-value { color: #f59e0b; }
.pr-pill-doctor-only:not(.pr-pill-active) {
  border-color: rgba(245, 158, 11, 0.30);
  background: rgba(245, 158, 11, 0.06);
}
.pr-pill-doctor-only.pr-pill-active { background: rgba(245, 158, 11, 0.14); }

.pr-pill-specialty-only .pr-pill-value { color: #eab308; }
.pr-pill-specialty-only:not(.pr-pill-active) {
  border-color: rgba(234, 179, 8, 0.30);
  background: rgba(234, 179, 8, 0.06);
}
.pr-pill-specialty-only.pr-pill-active { background: rgba(234, 179, 8, 0.14); }

.pr-pill-frontera .pr-pill-value { color: #38bdf8; }
.pr-pill-frontera:not(.pr-pill-active) {
  border-color: rgba(56, 189, 248, 0.30);
  background: rgba(56, 189, 248, 0.06);
}
.pr-pill-frontera.pr-pill-active { background: rgba(56, 189, 248, 0.14); }

.pr-pill-medication .pr-pill-value { color: #a78bfa; }
.pr-pill-medication:not(.pr-pill-active) {
  border-color: rgba(167, 139, 250, 0.30);
  background: rgba(167, 139, 250, 0.06);
}
.pr-pill-medication.pr-pill-active { background: rgba(167, 139, 250, 0.14); }

.pr-pill-uncaptured .pr-pill-value { color: #94a3b8; }
.pr-pill-uncaptured:not(.pr-pill-active) {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.05);
}
.pr-pill-uncaptured.pr-pill-active { background: rgba(148, 163, 184, 0.12); }

/* Confidence-tier filter chips (second row): Exact / Manual check / No match. */
.pr-confidence-row {
  margin-top: 0.5rem;
}
.pr-pill-conf-exact .pr-pill-value { color: #22c55e; }
.pr-pill-conf-exact:not(.pr-pill-active) {
  border-color: rgba(34, 197, 94, 0.30);
  background: rgba(34, 197, 94, 0.06);
}
.pr-pill-conf-exact.pr-pill-active { background: rgba(34, 197, 94, 0.14); }

.pr-pill-conf-manual .pr-pill-value { color: #f59e0b; }
.pr-pill-conf-manual:not(.pr-pill-active) {
  border-color: rgba(245, 158, 11, 0.30);
  background: rgba(245, 158, 11, 0.06);
}
.pr-pill-conf-manual.pr-pill-active { background: rgba(245, 158, 11, 0.14); }

.pr-pill-conf-nomatch .pr-pill-value { color: #94a3b8; }
.pr-pill-conf-nomatch:not(.pr-pill-active) {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.05);
}
.pr-pill-conf-nomatch.pr-pill-active { background: rgba(148, 163, 184, 0.12); }

/* ── Capture-path badge (table cell + modal banner) ────────────────────── */
.pr-badge {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pr-badge-doctor-specialty {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.40);
}
.pr-badge-doctor-only {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.40);
}
.pr-badge-specialty-only {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border-color: rgba(234, 179, 8, 0.40);
}
.pr-badge-frontera {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.40);
}
.pr-badge-medication {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.40);
}
/* Small secondary pill shown beside a capture badge when the row ALSO has a
   medication match (i.e. captured on both a referral and a medication). */
.pr-badge-med-pill {
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.35);
  font-size: 0.62rem;
  padding: 0.12rem 0.45rem;
  letter-spacing: 0.02em;
}
.pr-badge-uncaptured {
  background: rgba(148, 163, 184, 0.10);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.30);
}
/* Fallback capture-path badge when the path is unrecognised. */
.pr-badge-unknown {
  background: rgba(100, 116, 139, 0.10);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.30);
}

/* Match-column header + body cell stay tight so the badge reads cleanly. */
.pr-table-wrap th.pr-th-match {
  white-space: nowrap;
}
.pr-table-wrap td.pr-td-match {
  white-space: nowrap;
  padding-right: 1rem;
}

/* ── Modal: two-card evidence grid ────────────────────── */

.pr-evidence-grid {
  display: grid;
  /* One evidence card per row (full width) so the prescriber↔referral
     connection has room to sit side-by-side instead of wrapping. */
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.pr-evidence-card {
  /* Inherits .rule-info-card spacing; just makes the body fields denser. */
  margin: 0;
}
.pr-evidence-card-wide {
  grid-column: 1 / -1;
}
.pr-evidence-empty {
  opacity: 0.65;
}
.pr-evidence-empty .rule-info-card-body {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Force grid items to allow shrinking + word-wrap so long values don't
   degrade into one-character-per-line columns. */
.pr-evidence-grid .rule-info-card,
.pr-evidence-grid .rule-info-card-body,
.pr-evidence-grid .rule-info-field {
  min-width: 0;
}
.pr-evidence-grid .rule-info-value {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* ── Link cards (prescriber↔referral, dispensed↔patient med) ───────────── */
/* These bodies override the default 2-column .rule-info-card-body grid. */
.pr-link-body { display: block; }

/* Slim "what matched" banner above the two parties. */
.pr-link-banner {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  margin-bottom: 0.85rem;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.22);
}
.pr-link-banner-icon { color: #4ade80; font-weight: 700; }
.pr-link-banner-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #4ade80;
}
.pr-link-banner-sep { color: #475569; }
.pr-link-banner-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e2e8f0;
  overflow-wrap: anywhere;
}
/* Medication banner uses the medication violet. */
.pr-link-banner-med {
  background: rgba(167, 139, 250, 0.10);
  border-color: rgba(167, 139, 250, 0.22);
}
.pr-link-banner-med .pr-link-banner-icon,
.pr-link-banner-med .pr-link-banner-label { color: #c4b5fd; }
/* Warning banner — a match that needs a manual check (specialty mismatch). */
.pr-link-banner-warn {
  background: rgba(248, 113, 113, 0.10);
  border-color: rgba(248, 113, 113, 0.30);
}
.pr-link-banner-warn .pr-link-banner-icon,
.pr-link-banner-warn .pr-link-banner-label { color: #f87171; }
/* The manual-check note drops to its own full-width line under the match. */
.pr-link-banner-note {
  flex-basis: 100%;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fca5a5;
}

/* Two light, borderless text columns linked by an arrow. */
.pr-link-parties {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pr-link-party {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.pr-link-role {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.pr-link-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #e2e8f0;
  overflow-wrap: anywhere;
}
.pr-link-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  overflow-wrap: anywhere;
}
.pr-link-arrow {
  flex: 0 0 auto;
  align-self: center;
  font-size: 1.1rem;
  color: #475569;
}

/* The all-referrals table row that the engine flagged as the matched
   referral — highlighted so the reviewer can find it at a glance. */
.rule-referrals-row-engine-match td {
  background: rgba(56, 189, 248, 0.08);
}
.rule-referrals-row-engine-match td:first-child {
  border-left: 3px solid #38bdf8;
}

/* Per-row pills used in the match cell ("Identity" / "Specialty"). */
.pr-row-pill {
  display: inline-block;
  padding: 0.10rem 0.45rem;
  margin-right: 0.25rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.pr-row-pill-identity {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.40);
}
.pr-row-pill-specialty {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.40);
}

/* Controls row (search + filter + pagination inline) */
.pr-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pr-search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  font-size: 0.85rem;
}

.pr-search:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.6);
}

.pr-search::placeholder { color: #475569; }



/* Table wrapper — no outer card needed, minimal border */
.pr-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.5);
}

.pr-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.pr-table-wrap th {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.95);
  padding: 0.5rem 0.6rem;
  text-align: left;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  white-space: nowrap;
}

.pr-table-wrap td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
  color: #cbd5e1;
  white-space: nowrap;
}

.pr-table-wrap td.rv-cell-passed { color: #22c55e; font-weight: 600; }
.pr-table-wrap td.rv-cell-failed { color: #ef4444; font-weight: 600; }
.pr-table-wrap td.rv-cell-skipped { color: #64748b; font-style: italic; }

.pr-table-wrap tbody tr:hover {
  background: rgba(56, 189, 248, 0.04);
}

@media (max-width: 768px) {
  .pr-summary-row { flex-wrap: wrap; }
  .pr-bar-name { width: 120px; font-size: 0.65rem; }
  .pr-header-bar { flex-direction: column; align-items: flex-start; }
}

/* ===== PIPELINE REVIEW PANEL IN MODAL ===== */

.pr-review-gates {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pr-gate-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.4);
  transition: border-color 0.2s, background 0.2s;
}

.pr-gate-card[data-status="passed"] {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.06);
}
.pr-gate-card[data-status="failed"] {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}
.pr-gate-card[data-status="skipped"] {
  opacity: 0.55;
}

.pr-gate-icon {
  font-size: 1.1rem;
  font-weight: 700;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
}
.pr-gate-card[data-status="passed"] .pr-gate-icon { color: #22c55e; }
.pr-gate-card[data-status="failed"] .pr-gate-icon { color: #ef4444; }
.pr-gate-card[data-status="skipped"] .pr-gate-icon { color: #64748b; }

.pr-gate-info {
  flex: 1;
  min-width: 0;
}

.pr-gate-info-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.pr-gate-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr-gate-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

/* Inline detail under a gate (e.g. the qualifying encounter date for gate 5). */
.pr-gate-detail {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.22);
  border-radius: 6px;
  padding: 0.08rem 0.4rem;
}


/* Three-state toggle for each gate */
.pr-toggle-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
  flex-shrink: 0;
}

.pr-toggle-btn {
  padding: 0.3rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: none;
  background: rgba(15, 23, 42, 0.6);
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pr-toggle-btn:not(:last-child) {
  border-right: 1px solid rgba(148, 163, 184, 0.2);
}

.pr-toggle-btn:hover {
  background: rgba(51, 65, 85, 0.6);
  color: #cbd5e1;
}

.pr-toggle-btn.pr-toggle-pass.active {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.pr-toggle-btn.pr-toggle-fail.active {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}


/* Footer: overall toggle + notes + submit */
.pr-review-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  margin-top: 1rem;
}

.pr-review-overall {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.pr-review-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.pr-review-toggle-group {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.pr-review-toggle-group .pr-toggle-btn {
  padding: 0.4rem 1.1rem;
  font-size: 0.8rem;
}

.pr-review-notes {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.pr-review-input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 0.85rem;
}

.pr-review-input:focus {
  border-color: rgba(56, 189, 248, 0.6);
  outline: none;
}

.pr-review-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.pr-review-audit {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  font-size: 0.78rem;
  color: #64748b;
}

.pr-review-audit strong { color: #94a3b8; }

/* ===== RULE VALIDATION TAB ===== */

.rv-cell-passed { color: #22c55e; font-weight: 600; }
.rv-cell-failed { color: #ef4444; font-weight: 600; }
.rv-cell-skipped { color: #64748b; font-style: italic; }

.rv-select {
  padding: 0.5rem 0.75rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: #f1f5f9;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
  max-width: 220px;
}

.rv-select:focus {
  border-color: rgba(56, 189, 248, 0.7);
}


/* =====================================================================
   COMPLIANCE REDESIGN — "Compact toolbar / KPI strip"
   Self-contained block; uses cc-* classes so other tabs are untouched.
   Palette: page #0a1224 · card #0f1a30 · text #e7ecf3 · green #10d6a0
            green2 #22d36a · amber #f4c14b · sign-out red #ff5266
   ===================================================================== */

/* ── Shared top header (restyled to match the mock) ── */
.app-header {
  padding: 0 1.5rem;
  min-height: 56px;
  background: linear-gradient(90deg, #1a3aa0 0%, #0c1a33 60%, #050a16 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-logo {
  max-height: 24px;
}
.brand-logo-small {
  max-height: 16px;
  opacity: 0.85;
}

.top-tabs {
  gap: 0.4rem;
}

.tab-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #e7ecf3;
  padding: 0.48rem 1rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}
.tab-btn:hover {
  background: rgba(16, 214, 160, 0.12);
  border-color: rgba(16, 214, 160, 0.55);
  color: #e7ecf3;
}
.tab-btn.active {
  background: #10d6a0;
  border-color: transparent;
  color: #04231a;
}
.tab-btn.active:hover {
  background: #15e0ad;
  color: #04231a;
}

.user-email {
  color: rgba(231, 236, 243, 0.62);
  font-size: 0.9rem;
}

.logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 82, 102, 0.55);
  color: #ff5266;
  font-size: 0.9rem;
  padding: 0.45rem 0.9rem;
}
.logout-btn:hover {
  background: rgba(255, 82, 102, 0.14);
}

/* ── Page shell ── */
.cc-page:not(.tab-panel-hidden) {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: #e7ecf3;
}
.cc-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Title bar ── */
.cc-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.cc-title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #e7ecf3;
}
.cc-subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  color: rgba(231, 236, 243, 0.62);
}
.cc-titlebar-actions {
  display: inline-flex;
  gap: 0.6rem;
  flex-shrink: 0;
}
.cc-ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  color: #e7ecf3;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cc-ghost-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}
.cc-ghost-icon {
  font-size: 0.9rem;
}

/* ── Compact toolbar ── */
.cc-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 1rem 1.25rem;
}
.cc-toolbar-left,
.cc-toolbar-right {
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
  min-width: 0;
}
.cc-toolbar-left {
  flex: 1 1 auto;
}
.cc-toolbar-right {
  flex: 0 1 auto;
}
/* Keep the toolbar on one row at desktop widths. */
.cc-toolbar .cc-field {
  flex: 0 0 auto;
}
.cc-toolbar-right .cc-input {
  width: 162px;
}
.cc-toolbar .cc-select {
  min-width: 186px;
}
.cc-toolbar-divider {
  align-self: stretch;
  width: 1px;
  background: rgba(255, 255, 255, 0.07);
  flex: 0 0 auto;
}

.cc-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border: 1px dashed transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  position: relative;
}
.cc-upload:hover,
.cc-upload.drag-over {
  background: rgba(16, 214, 160, 0.06);
  border-color: rgba(16, 214, 160, 0.4);
}
.cc-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 11px;
  background: rgba(16, 214, 160, 0.14);
  color: #10d6a0;
  font-size: 1.2rem;
}
.cc-upload-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.cc-upload-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e7ecf3;
}
.cc-upload-sub {
  font-size: 0.92rem;
  color: rgba(231, 236, 243, 0.62);
  max-width: 195px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-upload.selected .cc-upload-sub {
  color: #10d6a0;
}
.cc-upload-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #e7ecf3;
  font-size: 0.7rem;
  cursor: pointer;
}
.cc-upload.selected .cc-upload-clear {
  display: inline-flex;
}
.cc-upload-clear:hover {
  background: rgba(255, 82, 102, 0.7);
}

.cc-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.cc-field > label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(231, 236, 243, 0.5);
}
.cc-input,
.cc-select {
  width: 100%;
  background: #0a1224;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e7ecf3;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  height: 46px;
}
.cc-input:focus,
.cc-select:focus {
  border-color: rgba(16, 214, 160, 0.6);
}
.cc-input::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
}
.cc-select-wrap {
  position: relative;
}
.cc-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 1.9rem;
  cursor: pointer;
}
.cc-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.7rem;
  color: rgba(231, 236, 243, 0.5);
}
/* Native dropdown list (open state) */
.cc-select option {
  background: #0a1224;
  color: #e7ecf3;
}

.cc-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 46px;
  padding: 0 1.1rem;
  border: none;
  border-radius: 9px;
  background: linear-gradient(#15e0ad, #0bb486);
  color: #04231a;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: filter 0.15s ease, opacity 0.15s ease;
}
.cc-primary-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}
.cc-primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.cc-btn-icon {
  font-size: 0.7rem;
}
.cc-apply-btn {
  align-self: flex-end;
}
.cc-filter-status {
  margin: -0.4rem 0 0;
  font-size: 0.82rem;
  color: rgba(231, 236, 243, 0.62);
}
.cc-filter-status.is-error {
  color: #ff5266;
}

/* ── KPI strip ── */
.cc-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
}
.cc-kpi {
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 3px solid transparent;
  border-radius: 12px;
  padding: 0.95rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
}
.cc-kpi-accent-green {
  border-left-color: #10d6a0;
}
.cc-kpi-accent-amber {
  border-left-color: #f4c14b;
}
.cc-kpi-accent-green2 {
  border-left-color: #22d36a;
}
.cc-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.cc-kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(231, 236, 243, 0.62);
}
.cc-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(231, 236, 243, 0.62);
  font-size: 0.75rem;
}
.cc-icon-green {
  background: rgba(16, 214, 160, 0.13);
  color: #10d6a0;
}
.cc-icon-amber {
  background: rgba(244, 193, 75, 0.13);
  color: #f4c14b;
}
.cc-icon-green2 {
  background: rgba(34, 211, 106, 0.13);
  color: #22d36a;
}
.cc-kpi-body {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.cc-kpi-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
  color: #e7ecf3;
}
.cc-val-green {
  color: #10d6a0;
}
.cc-val-amber {
  color: #f4c14b;
}
.cc-val-green2 {
  color: #22d36a;
}
.cc-kpi-sub {
  font-size: 0.8rem;
  color: rgba(231, 236, 243, 0.62);
}
.cc-kpi-scope {
  font-size: 0.625rem;
  font-weight: 600;
  color: #04231a;
  background: #10d6a0;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

/* ── How claims were captured ── */
.cc-capture-card {
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 1.1rem 1.25rem 1.2rem;
}
.cc-capture-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cc-capture-titles {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.cc-capture-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e7ecf3;
}
.cc-capture-hint {
  font-size: 0.82rem;
  color: rgba(231, 236, 243, 0.62);
}
.cc-capture-badge {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: #10d6a0;
  background: rgba(16, 214, 160, 0.14);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  white-space: nowrap;
}
.cc-capture-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 2.5rem;
  row-gap: 0.55rem;
}
.cc-cap-row {
  display: grid;
  grid-template-columns: minmax(110px, 150px) 1fr 36px 52px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.cc-cap-row:hover {
  background: rgba(255, 255, 255, 0.03);
}
.cc-cap-row.match-method-row-active {
  background: rgba(16, 214, 160, 0.1);
  box-shadow: inset 2px 0 0 #10d6a0;
}
.cc-cap-name {
  font-size: 0.9rem;
  color: #e7ecf3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-cap-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.cc-cap-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10d6a0 0%, #22d36a 100%);
  transition: width 0.45s ease;
}
.cc-cap-count {
  font-size: 0.9rem;
  color: rgba(231, 236, 243, 0.62);
  text-align: right;
}
.cc-cap-pct {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e7ecf3;
  text-align: right;
}

/* ── Results / search bar ── */
.cc-results-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.cc-results-label {
  font-size: 0.9rem;
  color: rgba(231, 236, 243, 0.62);
  flex: 0 0 auto;
}
.cc-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 320px;
  max-width: 520px;
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
}
.cc-search:focus-within {
  border-color: rgba(16, 214, 160, 0.6);
}
.cc-search-icon {
  font-size: 0.8rem;
  opacity: 0.7;
}
.cc-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e7ecf3;
  font-size: 0.9rem;
}
.cc-search input::placeholder {
  color: rgba(231, 236, 243, 0.5);
}
.cc-results-right {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}
.cc-results-right .status-text {
  font-size: 0.82rem;
  color: rgba(231, 236, 243, 0.62);
}
.cc-pagination {
  font-size: 0.82rem;
}
.cc-pagination button {
  padding: 0.25rem 0.55rem;
}

.cc-table-wrap {
  border-color: rgba(255, 255, 255, 0.08);
  background: #0f1a30;
}
.cc-table-wrap table {
  font-size: 0.88rem;
}
.cc-table-wrap th,
.cc-table-wrap td {
  padding: 0.55rem 0.7rem;
}

.cc-table-wrap th.sortable-col {
  cursor: pointer;
  user-select: none;
}
.cc-table-wrap th.sortable-col:hover {
  background: rgba(255, 255, 255, 0.06);
}
.cc-table-wrap th .sort-indicator {
  margin-left: 0.25rem;
  opacity: 0.45;
  font-size: 0.85em;
}
.cc-table-wrap th.sorted-asc .sort-indicator,
.cc-table-wrap th.sorted-desc .sort-indicator {
  opacity: 1;
}

/* Keep the (empty) per-column filter container out of the layout. */
.column-filters[hidden] {
  display: none;
}

/* The toolbar's two groups wrap to separate rows below ~1500px; the vertical
   divider only makes sense while they share one row, so hide it when wrapped. */
@media (max-width: 1499px) {
  .cc-toolbar-divider {
    display: none;
  }
}

/* Responsive: collapse the KPI strip and capture grid on narrow viewports. */
@media (max-width: 1100px) {
  .cc-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .cc-capture-grid {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
  .cc-toolbar-divider {
    display: none;
  }
}

/* ── Analytics tab ─────────────────────────────────────────── */
.an-filterbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  background: #0d1830;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}
.an-filter-label {
  color: rgba(231, 236, 243, 0.6);
  font-size: 0.85rem;
}
.an-filter-quick {
  color: rgba(231, 236, 243, 0.4);
  font-size: 0.78rem;
  margin-left: 0.25rem;
}
.an-preset-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.an-preset {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.an-preset:hover {
  border-color: #38bdf8;
  color: #e7ecf3;
}
.an-preset.is-active {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #22c55e;
  font-weight: 600;
}
.an-custom-range {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.5rem;
}
/* `display: flex` above would otherwise override the `hidden` attribute, so the
   date pickers must only appear when the "custom" preset is selected. */
.an-custom-range[hidden] {
  display: none;
}
.an-range-from-label,
.an-range-to-label {
  color: rgba(231, 236, 243, 0.55);
  font-size: 0.8rem;
}
.an-export-btn {
  margin-left: auto;
  opacity: 0.7;
}

.an-subtab-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}
.an-subtab-chevron {
  color: rgba(231, 236, 243, 0.5);
  font-size: 0.85rem;
}
.an-subtabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.an-subtab {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.an-subtab:hover {
  border-color: #38bdf8;
}
.an-subtab.is-active {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #22c55e;
  font-weight: 600;
}
.an-subtab-hint {
  margin-left: auto;
  color: rgba(231, 236, 243, 0.4);
  font-size: 0.78rem;
}

.an-panel {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.an-panel[hidden] {
  display: none;
}
.an-panel-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.an-panel-title {
  margin: 0;
  font-size: 1.1rem;
  color: #e7ecf3;
}
.an-panel-subtitle {
  color: rgba(231, 236, 243, 0.55);
  font-size: 0.85rem;
}
.an-gran-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}
.an-gran-label {
  color: rgba(231, 236, 243, 0.45);
  font-size: 0.78rem;
}
.an-gran {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.an-gran:hover {
  border-color: #38bdf8;
  color: #e7ecf3;
}
.an-gran.is-active {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #22c55e;
  font-weight: 600;
}
.an-secondary-toolbar {
  padding: 0;
  background: transparent;
  border: none;
}

.an-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.an-kpi {
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.an-kpi-label {
  font-size: 0.78rem;
  color: rgba(231, 236, 243, 0.55);
}
.an-kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e7ecf3;
  margin-top: 0.25rem;
}

.an-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
.an-chart-grid-single {
  grid-template-columns: minmax(0, 1fr);
}
/* When a sub-tab groups its charts into titled sections, the outer container
   stops being a grid and stacks the sections; each section keeps its own grid. */
.an-chart-grid.is-sectioned {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.an-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.an-section-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #e7ecf3;
  letter-spacing: 0.01em;
  text-align: center;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.an-chart-card {
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 1rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.an-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.an-chart-title {
  margin: 0;
  font-size: 0.98rem;
  color: #e7ecf3;
  font-weight: 600;
}
.an-chart-subtitle {
  font-size: 0.78rem;
  color: rgba(231, 236, 243, 0.45);
}
.an-chart-header-aside {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.an-csv-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.72rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.an-csv-btn:hover {
  border-color: #45d4bf;
  color: #45d4bf;
  background: rgba(69, 212, 191, 0.1);
}
.an-chart-canvas-wrap {
  position: relative;
  height: 320px;
  min-height: 260px;
}
.an-table-card .an-chart-header {
  margin-bottom: 0.25rem;
}
.an-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}
.an-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  color: rgba(231, 236, 243, 0.88);
}
.an-data-table thead th {
  position: sticky;
  top: 0;
  background: #142547;
  color: rgba(231, 236, 243, 0.75);
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.an-data-table tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.an-data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
.an-empty-cell {
  text-align: center;
  color: rgba(231, 236, 243, 0.45);
  font-style: italic;
  padding: 1.25rem 0.75rem !important;
}
.an-chart-message {
  margin: 0;
  min-height: 1.1em;
  font-size: 0.83rem;
  color: rgba(231, 236, 243, 0.6);
}
.an-chart-message.is-error {
  color: #f97373;
}
/* Dose-changes: table + "Hide Medication" side panel */
.an-dose-layout {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}
.an-dose-layout .an-table-wrap {
  flex: 1 1 auto;
  min-width: 0;
}
.an-dose-hide-panel {
  flex: 0 0 230px;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.6rem;
}
.an-dose-hide-head {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(231, 236, 243, 0.8);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.an-dose-hide-list {
  flex: 1 1 auto;
  overflow: auto;
  margin: 0.5rem 0;
}
.an-dose-hide-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.2rem;
  font-size: 0.8rem;
  color: rgba(231, 236, 243, 0.85);
  cursor: pointer;
  border-radius: 6px;
}
.an-dose-hide-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.an-dose-hide-item input {
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #45d4bf;
}
.an-dose-hide-empty {
  margin: 0.5rem 0.2rem;
  font-size: 0.8rem;
  font-style: italic;
  color: rgba(231, 236, 243, 0.45);
}
.an-dose-hide-apply {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(69, 212, 191, 0.5);
  color: #45d4bf;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.an-dose-hide-apply:hover {
  background: rgba(69, 212, 191, 0.12);
}
.an-dose-hide-apply:disabled {
  opacity: 0.5;
  cursor: default;
}

.an-panel-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: rgba(231, 236, 243, 0.55);
  background: #0f1a30;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
}
.an-panel-empty h2 {
  color: #e7ecf3;
  margin: 0 0 0.5rem;
}

@media (max-width: 900px) {
  .an-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .an-chart-grid {
    grid-template-columns: 1fr;
  }
  /* Stack the Hide Medication panel below the dose table on narrow screens. */
  .an-dose-layout {
    flex-direction: column;
  }
  .an-dose-hide-panel {
    flex-basis: auto;
    width: 100%;
    max-height: 260px;
  }
}


