/* ============================================
   AutoCode IQ — Design System & Styles
   ============================================ */

/* --- CSS Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- CSS Variables --- */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --panel: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --teal: #0f62fe;
  --teal-light: rgba(15, 98, 254, 0.08);
  --teal-mid: rgba(15, 98, 254, 0.15);
  --amber: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.1);
  --red: #ef4444;
  --red-light: rgba(239, 68, 68, 0.1);
  --blue: #3b82f6;
  --blue-light: rgba(59, 130, 246, 0.1);
  --green: #10b981;
  --green-light: rgba(16, 185, 129, 0.1);
  --text: #0f172a;
  --subtext: #475569;
  --muted: #64748b;
  --faint: #94a3b8;
  --sidebar-bg: #ffffff;
  --sidebar-text: #334155;
  --sidebar-muted: #64748b;
  --sidebar-active-bg: rgba(15, 98, 254, 0.08);
  --sidebar-active-text: #0f62fe;
  --sidebar-hover-bg: #f8fafc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

/* --- Selection --- */
::selection {
  background: var(--teal);
  color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 10px;
}

/* --- Body --- */
body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s ease;
  overflow-x: hidden;
}

/* --- Utility --- */
.font-mono {
  font-family: "JetBrains Mono", monospace;
}

.font-display {
  font-family: "Outfit", sans-serif;
}

.transition-all {
  transition: all 0.15s ease;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 224px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 8px;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.sidebar-logo-text p {
  font-size: 10px;
  color: var(--sidebar-muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sidebar-muted);
  padding: 16px 12px 6px;
  font-weight: 500;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  position: relative;
  margin-bottom: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  animation: sidebarFadeIn 0.3s ease forwards;
}

.sidebar-item:nth-child(1) {
  animation-delay: 0.05s;
}

.sidebar-item:nth-child(2) {
  animation-delay: 0.1s;
}

.sidebar-item:nth-child(3) {
  animation-delay: 0.15s;
}

.sidebar-item:nth-child(4) {
  animation-delay: 0.2s;
}

.sidebar-item:nth-child(5) {
  animation-delay: 0.25s;
}

.sidebar-item:nth-child(6) {
  animation-delay: 0.3s;
}

.sidebar-item:nth-child(7) {
  animation-delay: 0.35s;
}

@keyframes sidebarFadeIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar-item:hover {
  background: var(--sidebar-hover-bg);
}

.sidebar-item.active {
  color: var(--teal);
  background: var(--sidebar-active-bg);
  box-shadow: 0 2px 8px var(--teal-light);
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item.active svg {
  opacity: 1;
}

.sidebar-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: auto;
}

.sidebar-badge-teal {
  background: var(--teal-mid);
  color: var(--teal);
}

.sidebar-badge-amber {
  background: var(--amber-light);
  color: var(--amber);
}

.sidebar-badge-red {
  background: var(--red-light);
  color: var(--red);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f62fe, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  position: relative;
}

.sidebar-avatar .pulse-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--sidebar-bg);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

.sidebar-footer-text h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.sidebar-footer-text p {
  font-size: 10px;
  color: var(--sidebar-muted);
}

/* --- Main Content Area --- */
.main-content {
  margin-left: 224px;
  min-height: 100vh;
}

/* --- Top Header --- */
.top-header {
  position: sticky;
  top: 0;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 40;
  gap: 16px;
}

.header-title {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
  white-space: nowrap;
}

.header-search {
  flex: 1;
  max-width: 380px;
  margin: 0 auto;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: all 0.15s ease;
}

.header-search input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-light);
}

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

.header-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.header-pills {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fy-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--teal);
  background: var(--teal-light);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.fy-pill .pulse-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse 2s infinite;
}

.header-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-btn:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.header-btn svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.header-btn .notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.api-key-indicator {
  color: var(--green);
}

.api-key-indicator.not-set svg {
  color: var(--muted);
}

/* --- Page Content --- */
.page-content {
  padding: 24px;
}

.page-container {
  display: none;
}

.page-container.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* --- Stat Cards --- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.15s ease;
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-icon svg {
  width: 20px;
  height: 20px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.stat-card-value {
  font-family: "Outfit", sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card-trend {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card-trend svg {
  width: 14px;
  height: 14px;
}

.trend-up {
  color: var(--green);
}

.trend-down {
  color: var(--green);
}

.trend-neutral {
  color: var(--amber);
}

/* --- Charts Row --- */
.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 20px;
}

.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

/* --- Activity Table --- */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  overflow: hidden;
}

.table-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 16px 20px 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--subtext);
  border-bottom: 1px solid var(--border);
}

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

.data-table tbody tr:hover {
  background: var(--panel);
}

/* --- Status Badges --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge-teal {
  background: var(--teal-light);
  color: var(--teal);
}

.badge-amber {
  background: var(--amber-light);
  color: var(--amber);
}

.badge-red {
  background: var(--red-light);
  color: var(--red);
}

.badge-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-green {
  background: var(--green-light);
  color: var(--green);
}

/* --- Coding Workspace --- */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.workspace-panel {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.workspace-panel h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-zone {
  border: 2px dashed var(--teal);
  background: var(--teal-light);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 12px;
}

.upload-zone:hover {
  background: var(--teal-mid);
  border-color: var(--teal);
}

.upload-zone svg {
  width: 32px;
  height: 32px;
  color: var(--teal);
  margin-bottom: 8px;
}

.upload-zone p {
  font-size: 13px;
  color: var(--muted);
}

.upload-zone span {
  color: var(--teal);
  font-weight: 500;
}

.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.divider-or::before,
.divider-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-or span {
  font-size: 12px;
  color: var(--faint);
}

.clinical-textarea {
  width: 100%;
  min-height: 200px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  resize: vertical;
  outline: none;
  transition: all 0.15s ease;
}

.clinical-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-light);
}

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--faint);
  margin-top: 4px;
}

.btn-analyze {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
  box-shadow: 0 2px 4px var(--blue-light);
}

.btn-analyze:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--blue-light);
  filter: brightness(1.05);
}

.btn-analyze:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-clear {
  width: 100%;
  padding: 10px;
  background: #fff;
  color: var(--subtext);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 8px;
}

.btn-clear:hover {
  background: var(--panel);
}

/* --- ICD Code Cards (Enhanced) --- */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.code-count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), #06b6d4);
  color: #fff;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(15, 98, 254, 0.25);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--faint);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 13px;
}

.code-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
  opacity: 0;
  transform: translateY(12px);
  animation: slideUp 0.4s ease forwards;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.code-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), #06b6d4, var(--blue));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.code-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 25px -5px rgba(15, 98, 254, 0.12),
    0 4px 10px -3px rgba(0, 0, 0, 0.06);
  border-color: rgba(15, 98, 254, 0.2);
}

.code-card:hover::before {
  opacity: 1;
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.workspace-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.workspace-tab {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--subtext);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.workspace-tab span {
  display: inline-flex;
  min-width: 22px;
  justify-content: center;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
}

.workspace-tab.active {
  background: linear-gradient(135deg, var(--blue), var(--teal));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 98, 254, 0.18);
}

.workspace-tab.active span {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.review-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff8e6, #fff2cc);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.processing-shell {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.1), transparent 32%),
    radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.09), transparent 36%),
    linear-gradient(145deg, #ffffff, #f7fbff 48%, #f2f8ff);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.processing-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(59, 130, 246, 0.08) 45%, transparent 70%);
  transform: translateX(-100%);
  animation: processingSweep 3s linear infinite;
}

.processing-orb {
  position: relative;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
}

.processing-orb span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(59, 130, 246, 0.22);
  animation: processingOrbit 3.8s ease-in-out infinite;
}

.processing-orb span:nth-child(2) {
  inset: 8px;
  animation-delay: 0.4s;
}

.processing-orb span:nth-child(3) {
  inset: 16px;
  animation-delay: 0.8s;
}

.processing-copy {
  position: relative;
  z-index: 1;
}

.processing-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #0f766e;
  margin-bottom: 8px;
}

.processing-copy h3 {
  font-size: 24px;
  line-height: 1.15;
  color: #0f172a;
  margin-bottom: 10px;
}

.processing-copy p {
  max-width: 540px;
  font-size: 13px;
  line-height: 1.7;
  color: #475569;
}

.processing-meter {
  position: relative;
  z-index: 1;
  margin-top: 22px;
}

.processing-meter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.processing-timeline {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.processing-timeline div {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.95);
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}

.document-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.btn-analyze:disabled {
  background: #cbd5e1;
  color: #475569;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.code-card.accepted {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
}

.code-card.accepted::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  animation: pulse 2s infinite;
}

.code-card.flagged {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.08);
}

.code-card.flagged::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.code-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.code-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-light);
  padding: 2px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.code-card:hover .code-value {
  background: var(--teal-mid);
  box-shadow: 0 0 12px rgba(15, 98, 254, 0.15);
}

.code-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.type-principal {
  background: linear-gradient(135deg, #3b82f6, #0f62fe);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  animation: principalGlow 3s ease-in-out infinite;
}

@keyframes principalGlow {

  0%,
  100% {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  }

  50% {
    box-shadow: 0 2px 16px rgba(59, 130, 246, 0.5);
  }
}

.type-secondary {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
}

.code-description {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.body-system-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--panel), #e8ecf4);
  color: var(--subtext);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  letter-spacing: 0.2px;
}

.confidence-bar-wrap {
  margin-bottom: 12px;
}

.confidence-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  font-weight: 500;
}

.confidence-label span:last-child {
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
}

.confidence-track {
  height: 8px;
  background: var(--panel);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.confidence-fill {
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.confidence-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.3) 50%,
      rgba(255, 255, 255, 0) 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.confidence-high {
  background: linear-gradient(90deg, var(--teal), #06b6d4);
  box-shadow: 0 0 8px rgba(15, 98, 254, 0.2);
}

.confidence-medium {
  background: linear-gradient(90deg, var(--amber), #f59e0b);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.confidence-low {
  background: linear-gradient(90deg, var(--red), #f87171);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.source-sentence {
  background: linear-gradient(135deg, var(--panel), #edf2f7);
  padding: 10px 14px;
  font-size: 12px;
  font-style: italic;
  color: var(--subtext);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  line-height: 1.5;
  position: relative;
  transition: all 0.2s ease;
}

.source-sentence::before {
  content: "\201C";
  font-size: 24px;
  font-style: normal;
  color: var(--teal);
  opacity: 0.4;
  position: absolute;
  top: 2px;
  left: 6px;
  font-family: Georgia, serif;
}

.code-card:hover .source-sentence {
  border-color: var(--teal-light);
  background: linear-gradient(135deg, #edf1f9, #e8f0fe);
}

.flag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--amber-light);
  color: var(--amber);
  margin-bottom: 12px;
  margin-right: 4px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  animation: flagPulse 3s ease-in-out infinite;
}

@keyframes flagPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

.code-actions {
  display: flex;
  gap: 8px;
}

.btn-accept {
  flex: 1;
  padding: 8px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(15, 98, 254, 0.15);
}

.btn-accept:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 98, 254, 0.25);
}

.btn-flag {
  flex: 1;
  padding: 8px;
  background: #fff;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-flag:hover {
  background: var(--amber-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.summary-bar {
  background: linear-gradient(135deg, var(--panel), #e8ecf4);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0 0 12px 12px;
  margin: 14px -20px -18px;
  font-size: 12px;
  color: var(--subtext);
  font-weight: 500;
}

.summary-bar button {
  padding: 7px 16px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(15, 98, 254, 0.15);
}

.summary-bar button:disabled {
  background: #cbd5e1;
  color: #475569;
  cursor: not-allowed;
  box-shadow: none;
}

.summary-bar button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 98, 254, 0.25);
}

.summary-bar button:disabled:hover {
  filter: none;
  transform: none;
  box-shadow: none;
}

@keyframes processingSweep {
  100% {
    transform: translateX(100%);
  }
}

@keyframes processingOrbit {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.35;
  }

  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

/* --- Claims Queue --- */
.claims-toolbar {
  background: var(--panel);
  padding: 12px 16px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.claims-toolbar select {
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  cursor: pointer;
}

.claims-toolbar select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-light);
}

.btn-new-claim {
  margin-left: auto;
  padding: 7px 16px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-new-claim:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-view-claim {
  padding: 5px 12px;
  background: #fff;
  color: var(--subtext);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-view-claim:hover {
  color: var(--teal);
  border-color: var(--teal);
}

/* --- Slide-over Panel --- */
.slideover-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  z-index: 60;
}

.slideover-overlay.active {
  display: block;
}

.slideover-panel {
  position: fixed;
  right: -460px;
  top: 0;
  width: 460px;
  height: 100vh;
  background: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 61;
  padding: 24px;
  overflow-y: auto;
  transition: right 0.3s ease;
}

.slideover-panel.active {
  right: 0;
}

.slideover-panel h2 {
  font-family: "Outfit", sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
}

.slideover-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.slideover-close:hover {
  background: var(--panel);
}

.slideover-close svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.slideover-field {
  margin-bottom: 16px;
}

.slideover-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.slideover-field .value {
  font-size: 14px;
  color: var(--text);
}

.btn-submit-claim {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 20px;
  box-shadow: 0 2px 4px var(--blue-light);
}

.btn-submit-claim:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--blue-light);
  filter: brightness(1.05);
}

/* --- Compliance Alerts --- */
.compliance-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.compliance-header h2 {
  font-family: "Outfit", sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.alert-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.alert-card.resolved {
  opacity: 0.5;
}

.alert-card.resolved .alert-title {
  text-decoration: line-through;
}

.alert-card.border-red {
  border-color: rgba(239, 68, 68, 0.3);
  background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.alert-card.border-amber {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.alert-card.border-yellow {
  border-color: rgba(234, 179, 8, 0.3);
  background: linear-gradient(135deg, #ffffff 0%, #fefce8 100%);
}

.alert-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.alert-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.alert-desc {
  font-size: 13px;
  color: var(--subtext);
  margin-bottom: 8px;
}

.alert-link {
  font-size: 12px;
  color: var(--teal);
  cursor: pointer;
}

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

.btn-resolve {
  padding: 6px 14px;
  background: #fff;
  color: var(--subtext);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-resolve:hover {
  border-color: var(--green);
  color: var(--green);
}

.btn-resolve.resolved-btn {
  background: var(--green-light);
  color: var(--green);
  border-color: transparent;
  cursor: default;
}

/* --- API Key Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #fff;
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  padding: 32px;
  width: 420px;
  max-width: 90vw;
}

.modal-card h2 {
  font-family: "Outfit", sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  text-align: center;
}

.modal-card .modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 20px;
}

.modal-input-wrap {
  position: relative;
  margin-bottom: 16px;
}

.modal-input-wrap input {
  width: 100%;
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.modal-input-wrap input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-light);
}

.modal-toggle-vis {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--muted);
  background: none;
  border: none;
}

.modal-toggle-vis svg {
  width: 18px;
  height: 18px;
}

.btn-save-key {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px var(--blue-light);
}

.btn-save-key:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--blue-light);
  filter: brightness(1.05);
}

.modal-footer {
  text-align: center;
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
}

.modal-footer a {
  color: var(--teal);
  text-decoration: none;
}

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* --- Error Toast --- */
.error-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--red);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  animation: slideUp 0.3s ease;
  max-width: 400px;
}

.error-toast.active {
  display: block;
}

/* --- Upload pulse animation --- */
@keyframes borderPulse {

  0%,
  100% {
    border-color: var(--teal);
  }

  50% {
    border-color: rgba(0, 153, 168, 0.3);
  }
}

.upload-zone.drag-over {
  animation: borderPulse 1s ease infinite;
  background: var(--teal-mid);
}

/* --- Tagged Document Preview --- */
.tagged-doc-preview {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.icd-tag {
  background: linear-gradient(135deg, rgba(15, 98, 254, 0.08), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(15, 98, 254, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  position: relative;
  transition: all 0.2s ease;
  cursor: help;
}

.icd-tag:hover {
  background: linear-gradient(135deg, rgba(15, 98, 254, 0.15), rgba(6, 182, 212, 0.15));
  border-color: var(--teal);
  box-shadow: 0 0 12px rgba(15, 98, 254, 0.15);
}

.icd-tag-code {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #06b6d4);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

/* --- OCR Progress --- */
.ocr-progress-label {
  font-size: 12px;
  color: var(--teal);
  font-weight: 600;
  margin: 12px 0 6px;
  display: flex;
  justify-content: space-between;
}

/* --- File Info Bar --- */
.file-info-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--teal-light);
  border: 1px solid rgba(15, 98, 254, 0.15);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--teal);
  margin-top: 10px;
  animation: slideUp 0.3s ease;
}

.file-info-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
