:root {
  --bg-page: #e8eef8;
  --bg-atmosphere: linear-gradient(165deg, #eef2f9 0%, #f0f3fa 45%, #edf1f8 100%);
  --bg-panel: #ffffff;
  --bg-panel-tint: #f6f8fc;
  --bg-sidebar: #f0f5fc;
  --border: #dde5f0;
  --border-strong: #c8d4e4;
  --text: #0f172a;
  --text-muted: #5b6b82;
  --text-soft: #7c8ba3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e8f0fe;
  --success: #15803d;
  --success-soft: #e8f7ee;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff6e8;
  --neutral-soft: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 4px 14px rgba(15, 23, 42, 0.06);
  --radius-shell: 28px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --sidebar-width: 216px;
  --shell-margin: 28px;
  --content-gutter: 30px;
  --sidebar-inset: 28px;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.28);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
  overflow-x: clip;
}

button:active:not(:disabled) { transform: translateY(1px); }

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

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
}
.skip-link:focus { left: 12px; top: 12px; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(37, 99, 235, 0.08), transparent 60%),
    var(--bg-page);
}

.login-card {
  width: min(420px, 100%);
  padding: 42px 42px 38px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-brand-mark {
  width: 46px;
  height: 46px;
  display: block;
  flex: 0 0 46px;
  object-fit: contain;
}

.portal-brand-mark--login {
  width: 60px;
  height: 60px;
  flex-basis: 60px;
}

.brand-eyebrow,
.topbar-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.login-card h1,
.page-header h1 {
  margin: 4px 0 0;
  font-size: clamp(1.65rem, 2vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.login-lead,
.page-header p {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.login-card .login-lead {
  margin-top: 26px;
}

.login-card > label:first-of-type {
  margin-top: 30px;
}

label {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

textarea { resize: vertical; min-height: 72px; }

.form-status,
.queue-status {
  min-height: 1.25rem;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.form-status.is-error,
.queue-status.is-error { color: var(--danger); }

.login-card > .btn.btn-primary.btn-block {
  margin-top: 16px;
}

.login-card .form-status {
  margin-top: 12px;
  min-height: 0;
}

.login-card .form-status:empty {
  margin-top: 0;
}

.login-card .form-status:not(:empty) {
  min-height: 1.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 13px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  background: var(--bg-panel);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-panel-tint); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--neutral-soft); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.72;
  cursor: not-allowed;
  color: var(--text-muted);
}
.btn-ghost:disabled { border-color: var(--border); background: var(--bg-panel-tint); }

.text-unresolved { color: var(--text-soft); font-size: 13px; }

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 15px; font-weight: 600; }
.empty-state p { margin: 0; font-size: 14px; line-height: 1.5; max-width: 420px; margin-inline: auto; }
.empty-state-ready .empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--bg-panel-tint);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.empty-state-ready .empty-state-icon svg { width: 18px; height: 18px; }

.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.icon-btn:hover { background: var(--bg-panel-tint); border-color: var(--border-strong); }
.icon-btn-round { border-radius: 50%; }
.icon-btn svg { width: 16px; height: 16px; display: block; margin: auto; }

/* Application shell */
#app-screen {
  min-height: 100vh;
  min-height: 100dvh;
}

.app-outer {
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--shell-margin);
  background:
    radial-gradient(1100px 640px at 50% -10%, rgba(37, 99, 235, 0.045), transparent 72%),
    var(--bg-page);
}

.app-inner.portal {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - (var(--shell-margin) * 2));
  min-height: calc(100dvh - (var(--shell-margin) * 2));
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-shell);
  overflow: clip;
  background: var(--bg-atmosphere);
  box-shadow: var(--shadow-sm);
  align-items: stretch;
}

@media (min-width: 861px) {
  body.portal-shell-active {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  body.portal-shell-active #app-screen {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.portal-shell-active .app-outer {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  body.portal-shell-active .app-inner.portal {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }
}

.panel-surface {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Portal shell */
.portal {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.portal-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  align-self: stretch;
}

.sidebar-brand {
  padding: 18px var(--sidebar-inset) 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-brand strong { display: block; font-size: 15px; font-weight: 600; }
.sidebar-brand span { color: var(--text-muted); font-size: 12px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav-primary {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px var(--sidebar-inset) 20px;
}
.sidebar-nav-footer {
  flex-shrink: 0;
  padding: 10px var(--sidebar-inset) 16px;
  border-top: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.72); color: var(--text); }
.nav-item.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.18);
}
.nav-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  overflow: visible;
}
.nav-icon {
  display: block;
  width: 18px;
  height: 18px;
  overflow: visible;
  flex-shrink: 0;
  opacity: 0.9;
}
.nav-item.is-active .nav-icon { opacity: 1; }

.portal-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 18px var(--content-gutter) 22px var(--content-gutter);
  gap: var(--topbar-content-gap, 30px);
  overflow: hidden;
  --topbar-content-gap: 30px;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 0;
  flex-shrink: 0;
  position: relative;
  top: auto;
  z-index: 20;
  min-width: 0;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.portal-topbar.is-scrolled {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  border-color: var(--border-strong);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-search {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-soft);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: var(--bg-panel-tint);
  border-color: transparent;
  border-radius: 999px;
  padding: 9px 14px 9px 36px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-field input:hover { background: #fff; border-color: var(--border); }
.search-field input:focus { background: #fff; border-color: var(--border-strong); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.profile-menu { position: relative; flex-shrink: 0; }

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 3px;
  max-width: min(200px, 28vw);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel-tint);
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.profile-trigger:hover { background: #fff; border-color: var(--border-strong); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.profile-text { text-align: left; min-width: 0; }
.profile-text strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-text span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-chevron { width: 12px; height: 12px; color: var(--text-soft); flex-shrink: 0; }

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  padding: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  z-index: 30;
}
.profile-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.profile-dropdown-item:hover { background: var(--bg-panel-tint); }
.profile-dropdown-item-danger { color: var(--danger); }

.session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #f5c2c7;
  border-radius: var(--radius-md);
  background: #fff5f5;
  color: var(--text);
  flex-shrink: 0;
}
.session-banner p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.portal-main {
  padding: 0;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
  overscroll-behavior: contain;
}

.portal-main,
.sidebar-nav-primary,
.drawer,
.modal-card {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.32) transparent;
}

.portal-main::-webkit-scrollbar,
.sidebar-nav-primary::-webkit-scrollbar,
.drawer::-webkit-scrollbar,
.modal-card::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.portal-main::-webkit-scrollbar-track,
.sidebar-nav-primary::-webkit-scrollbar-track,
.drawer::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track {
  background: transparent;
}

.portal-main::-webkit-scrollbar-thumb,
.sidebar-nav-primary::-webkit-scrollbar-thumb,
.drawer::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.30);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

.portal-main::-webkit-scrollbar-thumb:hover,
.sidebar-nav-primary::-webkit-scrollbar-thumb:hover,
.drawer::-webkit-scrollbar-thumb:hover,
.modal-card::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.50);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.view-panel { min-width: 0; }

.metrics-error {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f5c2c7;
  border-radius: var(--radius-sm);
}

.metrics-info {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid rgba(180, 83, 9, 0.22);
  border-radius: var(--radius-sm);
}

.page-header { margin-bottom: 18px; }
.page-header h1 {
  margin: 0;
  font-size: clamp(1.75rem, 2.2vw, 1.875rem);
  font-weight: 600;
}
.page-header p { margin: 6px 0 0; font-size: 14px; }
.section-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}
.summary-card {
  padding: 11px 12px;
  min-width: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.summary-card:hover { box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.summary-card-ready { background: linear-gradient(180deg, #f8fbff 0%, #fff 100%); }
.summary-card-warn {
  background: var(--bg-panel);
  border-color: var(--border);
}
.summary-card-warn .summary-icon-warn {
  background: var(--bg-panel-tint);
  color: var(--text-muted);
}
.summary-card-muted {
  background: var(--bg-panel-tint);
  border-style: dashed;
  border-color: var(--border);
  box-shadow: none;
}
.summary-card-muted:hover { box-shadow: none; border-color: var(--border); }
.summary-card-muted .summary-label,
.summary-card-muted .summary-hint { color: var(--text-soft); }

.summary-grid.compact .summary-hint { display: none; }

.summary-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-panel-tint);
  color: var(--text-muted);
}
.summary-icon svg { width: 16px; height: 16px; }
.summary-icon-ready { background: var(--primary-soft); color: var(--primary); }
.summary-icon-warn { background: var(--warn-soft); color: var(--warn); }

.summary-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.summary-value {
  display: block;
  margin-top: 2px;
  font-size: clamp(1.65rem, 2vw, 2rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.summary-value-muted {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0;
}
.summary-value.is-loading {
  position: relative;
  color: transparent;
  user-select: none;
}
.summary-value.is-loading::after {
  content: '';
  position: absolute;
  inset: 4px 0 auto 0;
  width: 48px;
  height: 1.1em;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf2f7 0%, #f7fafc 50%, #edf2f7 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.summary-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.dashboard-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

/* Doctor Overview dashboard */
.doc-overview {
  padding-top: 10px;
}

.doc-overview-header {
  margin-bottom: 24px;
}

.doc-overview-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.doc-overview-header h1 {
  margin: 0;
}

.doc-overview-header p {
  margin: 6px 0 0;
}

.doc-overview-refreshed {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}

.doc-overview-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.doc-overview-kpi .doc-kpi-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  min-height: 118px;
  padding: 20px;
}

.doc-overview-kpi .summary-value {
  font-size: clamp(1.85rem, 2.4vw, 2.35rem);
  align-self: end;
}

.doc-overview-kpi .summary-card-warn .summary-value {
  color: #b45309;
}

.summary-card-gap .summary-value {
  color: #c2410c;
}

.summary-icon-gap {
  color: #c2410c;
}

.doc-overview-map-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.doc-map-panel {
  grid-column: span 8;
  padding: 22px;
  min-width: 0;
}

.doc-coverage-insights {
  grid-column: span 4;
  padding: 22px;
  min-width: 0;
}

.doc-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 12px 0 14px;
  font-size: 11px;
  color: var(--text-muted);
}

.doc-map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.doc-map-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  flex-shrink: 0;
}

.doc-map-swatch--covered_demand { background: #3b82f6; }
.doc-map-swatch--coverage_gap { background: #f59e0b; }
.doc-map-swatch--covered_no_demand { background: #14b8a6; }
.doc-map-swatch--no_current_data { background: #e2e8f0; }
.doc-map-swatch--your_license {
  background: transparent;
  border: 2px solid #1d4ed8;
  box-shadow: inset 0 0 0 2px #fff;
}

.doc-map-host {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 600;
  max-height: min(52vh, 520px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  overflow: hidden;
}

.doc-map-host svg {
  display: block;
  width: 100%;
  height: 100%;
}

.doc-map-host .us-state {
  fill: #e2e8f0;
  stroke: #94a3b8;
  stroke-width: 0.6;
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease, stroke-width 0.15s ease;
}

.doc-map-host .us-state.map-status-covered_demand { fill: #3b82f6; stroke: #2563eb; }
.doc-map-host .us-state.map-status-coverage_gap { fill: #f59e0b; stroke: #d97706; }
.doc-map-host .us-state.map-status-covered_no_demand { fill: #14b8a6; stroke: #0d9488; }
.doc-map-host .us-state.map-status-no_current_data { fill: #e2e8f0; stroke: #94a3b8; }

.doc-map-host .us-state.map-your-license {
  stroke: #1d4ed8;
  stroke-width: 2.2;
  paint-order: stroke fill;
}

.doc-map-host .us-state:hover,
.doc-map-host .us-state:focus {
  outline: none;
  stroke: #0f172a;
  stroke-width: 2;
  filter: brightness(0.95);
}

.doc-map-host .us-state:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.doc-map-host .us-state.is-selected {
  stroke: #0f172a;
  stroke-width: 2.4;
}

.doc-map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
}

.doc-state-detail {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel-tint);
}

.doc-state-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.doc-state-detail-head h3 {
  margin: 0;
  font-size: 1rem;
}

.doc-state-detail-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.doc-state-detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.doc-state-detail-list dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.doc-state-detail-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.doc-state-detail-rec {
  margin: 12px 0 0;
  font-size: 13px;
}

.doc-map-list-alt {
  margin-top: 16px;
}

.doc-map-list-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-map-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}

.doc-map-list li button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel-tint);
  font-size: 12px;
  cursor: pointer;
}

.doc-map-list li button:hover,
.doc-map-list li button:focus-visible {
  border-color: #93c5fd;
  outline: none;
}

.doc-insights-summary {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.doc-insights-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.doc-insights-summary dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.doc-insights-summary dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.doc-insights-subtitle {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.doc-priority-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.doc-priority-list li button {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fffbeb;
  cursor: pointer;
  font-size: 13px;
}

.doc-priority-list li button strong {
  grid-column: 1;
}

.doc-priority-list li button span {
  grid-column: 2;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #c2410c;
}

.doc-priority-list li button em {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
}

.doc-insights-foot {
  margin: 12px 0 0;
  font-size: 12px;
}

.doc-your-licenses {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.doc-your-licenses button {
  background: none;
  border: none;
  padding: 0;
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc-workflow-panel--full {
  padding: 22px;
}

.doc-workflow-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.doc-workflow-panel-head .section-title {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.doc-workflow-meta {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}

.doc-workflow-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.doc-workflow-action .btn {
  min-width: 180px;
}

.doc-progress-row + .doc-progress-row {
  margin-top: 0;
}

.progress-fill-warn { background: linear-gradient(90deg, #b45309, #f59e0b); }

@media (max-width: 1279px) {
  .doc-overview-map-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .doc-map-panel,
  .doc-coverage-insights {
    grid-column: span 12;
  }
}

@media (max-width: 1024px) {
  .doc-overview-kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-workflow-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .doc-overview-kpi {
    grid-template-columns: minmax(0, 1fr);
  }

  .doc-overview-header-row {
    flex-direction: column;
  }
}
@media (min-width: 1080px) {
  .dashboard-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  }
}
.dashboard-widget { min-width: 0; min-height: 0; }
.dashboard-widget-compact { padding: 14px; }
.dashboard-widget-compact .section-title { font-size: 1.05rem; margin-bottom: 4px; }
.dashboard-widget-compact .widget-caption { margin-bottom: 10px; font-size: 12px; }
.dashboard-widget-wide { min-width: 0; }
.dashboard-widget-action { display: flex; flex-direction: column; justify-content: flex-start; }
.dashboard-widget-action .btn { margin-top: auto; }
.dashboard-widget-action .btn.btn-secondary { margin-top: 0; }
.widget-caption {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.widget-foot { margin: 10px 0 0; font-size: 12px; }

.progress-block { margin-top: 4px; }
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.progress-meta strong { color: var(--text); font-weight: 600; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--neutral-soft);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.35s ease;
}
.progress-fill-primary { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.progress-fill-success { background: linear-gradient(90deg, #15803d, #22c55e); }

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.activity-item {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel-tint);
}
.activity-main { font-size: 13px; font-weight: 500; color: var(--text); }
.activity-sub { font-size: 12px; color: var(--text-muted); }
.activity-empty { font-size: 13px; padding: 8px 0; }

.panel-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  min-width: 0;
}
.panel-card:hover { border-color: var(--border-strong); }

.queue-panel { padding: 0; min-width: 0; }
.queue-panel .queue-toolbar,
.queue-panel .queue-status,
.queue-panel .pagination-bar { padding-left: 18px; padding-right: 18px; }
.queue-panel .queue-status { padding-top: 14px; }
.queue-panel .pagination-bar { padding-bottom: 16px; }

.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding-top: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.queue-toolbar-left { flex: 0 1 auto; }

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-panel-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 3px;
}
.segment {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
}
.segment.is-active {
  background: var(--primary);
  color: #fff;
}

.queue-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1 1 280px;
}
.filter-field select {
  min-width: 0;
  width: 100%;
  max-width: 140px;
  height: 34px;
  padding: 6px 28px 6px 12px;
  border-radius: 999px;
  background: var(--bg-panel-tint);
  border-color: var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.filter-field select:hover { background-color: #fff; border-color: var(--border-strong); }
.filter-field-tenant select,
.filter-tenant {
  max-width: 120px;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
.data-table th,
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-soft);
  background: var(--bg-panel-tint);
  padding-top: 8px;
  padding-bottom: 8px;
}
.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: #f8fafd; }

.doc-id-hint {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.status-pill.pending,
.status-pill.unresolved { color: var(--primary); background: var(--primary-soft); border-color: #c7dafc; }
.status-pill.verified,
.status-pill.resolved,
.status-pill.approved { color: var(--success); background: var(--success-soft); border-color: #b9e4c9; }
.status-pill.rejected,
.status-pill.denied { color: var(--danger); background: var(--danger-soft); border-color: #f5c2c7; }
.status-pill.confirmation_required,
.status-pill.clarification_requested { color: var(--warn); background: var(--warn-soft); border-color: #f3ddb0; }
.status-pill.expired,
.status-pill.admin_overridden { color: #5b21b6; background: #f3e8ff; border-color: #ddd0f7; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.page-info { font-size: 13px; color: var(--text-muted); }
.pagination-actions { display: flex; gap: 8px; }

/* Skeleton */
.skeleton-row td { padding: 14px 16px; }
.skeleton-block {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf2f7 0%, #f7fafc 50%, #edf2f7 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0);
  display: flex;
  justify-content: flex-end;
  transition: background 0.22s ease;
  pointer-events: none;
}
.drawer-overlay:not(.hidden) { pointer-events: auto; }
.drawer-overlay.is-open { background: rgba(15, 23, 42, 0.38); }

.drawer {
  width: min(720px, 100%);
  height: 100vh;
  overflow: auto;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 28px rgba(15, 23, 42, 0.08);
  padding: 20px 22px 28px;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer-overlay.is-open .drawer { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.drawer-header h2 { margin: 0; font-size: 1.35rem; }
.drawer-subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.drawer-section {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-tint);
}
.drawer-section-image {
  background: #fff;
  padding: 12px;
}
.drawer-section h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

.image-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel-tint);
  padding: 10px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.image-status { margin: 0 0 8px; font-size: 13px; }

.eligibility-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--neutral-soft);
  font-size: 13px;
}
.eligibility-banner.is-eligible {
  border-color: #b9e4c9;
  background: var(--success-soft);
  color: var(--success);
}
.eligibility-banner.is-ineligible {
  border-color: #f3ddb0;
  background: var(--warn-soft);
  color: var(--warn);
}
.eligibility-banner ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.detail-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
}
.detail-item span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}
.detail-item strong {
  display: block;
  margin-top: 4px;
  word-break: break-word;
}

.rx-image {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.attestation-box {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid #c7dafc;
}
.attestation-box span { color: var(--text-muted); font-size: 13px; }

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.checkbox-row input { width: auto; margin-top: 3px; }

.decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.decision-actions .btn { flex: 1 1 180px; }

.badge-future {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--neutral-soft);
  color: var(--text-soft);
  vertical-align: middle;
}

.settings-list {
  margin: 0 0 18px;
  display: grid;
  gap: 12px;
}
.settings-list div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.settings-list dt { color: var(--text-muted); font-weight: 600; }
.settings-list dd { margin: 0; }

/* Responsive */
@media (max-width: 1280px) {
  :root { --content-gutter: 24px; }
}

@media (max-width: 1080px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-row { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  body.portal-shell-active {
    height: auto;
    overflow: auto;
  }

  body.portal-shell-active #app-screen,
  body.portal-shell-active .app-outer,
  body.portal-shell-active .app-inner.portal {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .app-outer {
    padding: 0;
    background: var(--bg-page);
  }
  .app-inner.portal {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
  .portal { grid-template-columns: 1fr; }
  .portal-body {
    height: auto;
    overflow: visible;
    padding: 14px 16px 18px;
    gap: 12px;
    --topbar-content-gap: 26px;
  }
  .portal-topbar { margin: 0; border-radius: 0; }
  .portal-main {
    overflow: visible;
    padding: 0;
  }
  .portal-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    grid-template-rows: auto auto auto;
    height: auto;
  }
  .sidebar-brand { padding: 14px 16px 12px; }
  .sidebar-nav-primary {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 16px 10px;
    gap: 4px;
  }
  .sidebar-nav-footer {
    padding: 8px 16px 12px;
    border-top: 1px solid var(--border);
  }
  .nav-item { white-space: nowrap; flex: 0 0 auto; width: auto; }
  .portal-topbar { flex-wrap: wrap; }
  .topbar-right { margin-left: auto; }
  .search-field input { width: 100%; }
  .profile-text { display: none; }
  .profile-chevron { display: none; }
  .profile-trigger { max-width: none; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
