/* ============================================================
   Feebee Design System
   Based on Figma export — warm cream, sage green, organic browns
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Brand colors */
  --fb-bg: #fffdf5;
  --fb-text: #413100;
  --fb-text-subdued: rgba(65, 49, 0, 0.7);
  --fb-green: #6bb97f;
  --fb-green-hover: #5a9a68;
  --fb-green-light: rgba(107, 185, 127, 0.1);
  --fb-brown: #7a421b;
  --fb-brown-hover: #5f3315;
  --fb-gold: #e2ae6e;
  --fb-gold-light: rgba(226, 174, 110, 0.15);
  --fb-destructive: #d4183d;
  --fb-destructive-hover: #b8102f;
  --fb-muted-bg: #ececf0;
  --fb-muted-text: #717182;
  --fb-input-bg: #f3f3f5;
  --fb-border: #e5e7eb;

  /* Score palette */
  --fb-score-green: #22c55e;
  --fb-score-yellow: #eab308;
  --fb-score-orange: #f97316;
  --fb-score-red: #ef4444;

  /* Component tokens */
  --fb-card-radius: 1rem;
  --fb-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --fb-card-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
  --fb-radius-sm: 0.375rem;
  --fb-radius-md: 0.5rem;
  --fb-sidebar-width: 250px;

  /* Bootstrap overrides */
  --bs-body-bg: #fffdf5;
  --bs-body-color: #413100;
  --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-link-color: #6bb97f;
  --bs-link-hover-color: #5a9a68;
}

/* --- Global --- */
body {
  background-color: var(--fb-bg);
  color: var(--fb-text);
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  color: var(--fb-text);
}

a {
  color: var(--fb-green);
  text-decoration: none;
}
a:hover {
  color: var(--fb-green-hover);
}

label, .form-label {
  font-weight: 500;
  color: var(--fb-text);
}

code {
  color: var(--fb-brown);
  background: var(--fb-gold-light);
  padding: 0.125rem 0.375rem;
  border-radius: var(--fb-radius-sm);
  font-size: 0.875em;
}

/* --- Bootstrap Badge Color Overrides (preserves JS compatibility) --- */
.bg-success { background-color: var(--fb-green) !important; }
.bg-warning { background-color: var(--fb-gold) !important; color: var(--fb-text) !important; }
.bg-danger  { background-color: var(--fb-destructive) !important; }
.bg-info    { background-color: #3b82f6 !important; }
.bg-secondary { background-color: var(--fb-muted-bg) !important; color: var(--fb-muted-text) !important; }
.bg-primary { background-color: var(--fb-green) !important; }

.text-primary { color: var(--fb-green) !important; }
.text-success { color: var(--fb-green) !important; }
.text-warning { color: var(--fb-gold) !important; }
.text-danger  { color: var(--fb-destructive) !important; }
.text-muted   { color: var(--fb-muted-text) !important; }

/* --- Cards --- */
.fb-card, .card {
  background: #fff;
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-card-radius);
  box-shadow: var(--fb-card-shadow);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--fb-border);
  font-weight: 500;
  padding: 1rem 1.25rem;
  border-radius: var(--fb-card-radius) var(--fb-card-radius) 0 0 !important;
}

.card-body {
  padding: 1.25rem;
}

.card.shadow {
  box-shadow: var(--fb-card-shadow-lg) !important;
}

/* --- Buttons --- */
.btn {
  font-weight: 500;
  border-radius: var(--fb-radius-md);
  padding: 0.5rem 1.25rem;
  transition: all 0.2s ease;
}

.fb-btn-primary, .btn-primary {
  background-color: var(--fb-green) !important;
  border-color: var(--fb-green) !important;
  color: #fff !important;
}
.fb-btn-primary:hover, .btn-primary:hover,
.fb-btn-primary:focus, .btn-primary:focus {
  background-color: var(--fb-green-hover) !important;
  border-color: var(--fb-green-hover) !important;
  color: #fff !important;
}

.fb-btn-secondary {
  background-color: var(--fb-brown);
  border-color: var(--fb-brown);
  color: #fff;
}
.fb-btn-secondary:hover {
  background-color: var(--fb-brown-hover);
  border-color: var(--fb-brown-hover);
  color: #fff;
}

.btn-outline-primary {
  color: var(--fb-green) !important;
  border-color: var(--fb-green) !important;
}
.btn-outline-primary:hover {
  background-color: var(--fb-green) !important;
  border-color: var(--fb-green) !important;
  color: #fff !important;
}

.btn-outline-secondary {
  color: var(--fb-muted-text) !important;
  border-color: var(--fb-border) !important;
}
.btn-outline-secondary:hover {
  background-color: var(--fb-muted-bg) !important;
  color: var(--fb-text) !important;
}

.btn-outline-danger {
  color: var(--fb-destructive) !important;
  border-color: var(--fb-destructive) !important;
}
.btn-outline-danger:hover {
  background-color: var(--fb-destructive) !important;
  color: #fff !important;
}

.btn-success {
  background-color: var(--fb-green) !important;
  border-color: var(--fb-green) !important;
}
.btn-success:hover {
  background-color: var(--fb-green-hover) !important;
  border-color: var(--fb-green-hover) !important;
}

.btn-danger {
  background-color: var(--fb-destructive) !important;
  border-color: var(--fb-destructive) !important;
}
.btn-danger:hover {
  background-color: var(--fb-destructive-hover) !important;
}

.btn-dark {
  background-color: var(--fb-brown) !important;
  border-color: var(--fb-brown) !important;
}
.btn-dark:hover {
  background-color: var(--fb-brown-hover) !important;
  border-color: var(--fb-brown-hover) !important;
}

/* --- Form Inputs --- */
.form-control, .form-select {
  background-color: var(--fb-input-bg);
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius-md);
  color: var(--fb-text);
  padding: 0.5rem 0.75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--fb-green);
  box-shadow: 0 0 0 0.2rem rgba(107, 185, 127, 0.25);
  background-color: #fff;
}

.input-group-text {
  background-color: var(--fb-input-bg);
  border-color: var(--fb-border);
  color: var(--fb-muted-text);
}

.form-check-input:checked {
  background-color: var(--fb-green);
  border-color: var(--fb-green);
}

/* --- Progress Bars --- */
.progress {
  background-color: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar {
  background-color: var(--fb-green) !important;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  transition: width 0.3s ease-out;
}

/* --- Badges --- */
.badge {
  font-size: 0.75em;
  font-weight: 500;
  padding: 0.35em 0.65em;
  border-radius: var(--fb-radius-sm);
}

/* --- Tables --- */
.table {
  color: var(--fb-text);
}

.table > thead {
  background-color: var(--fb-input-bg);
}

.table > thead th {
  font-weight: 500;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fb-muted-text);
  border-bottom: 1px solid var(--fb-border);
  padding: 0.75rem 1rem;
}

.table > tbody td {
  vertical-align: middle;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--fb-border);
}

.table-hover > tbody > tr:hover {
  background-color: rgba(107, 185, 127, 0.04);
}

.table-light, .table-light th, .table-light td {
  background-color: var(--fb-input-bg) !important;
}

/* --- Accordion --- */
.accordion-item {
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius-md) !important;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.accordion-button {
  font-weight: 500;
  color: var(--fb-text);
  background-color: #fff;
}

.accordion-button:not(.collapsed) {
  background-color: var(--fb-green-light);
  color: var(--fb-text);
  box-shadow: none;
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.2rem rgba(107, 185, 127, 0.25);
  border-color: var(--fb-green);
}

.accordion-button::after {
  filter: brightness(0) saturate(100%);
}

.accordion-body {
  background-color: #fff;
}

.response-checkbox {
  transform: scale(1.1);
}

/* --- Alerts --- */
.alert-info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.alert-success {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.alert-warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.alert-danger {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* --- Modals --- */
.modal-content {
  border-radius: var(--fb-card-radius);
  border: 1px solid var(--fb-border);
  box-shadow: var(--fb-card-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--fb-border);
  background: #fff;
  border-radius: var(--fb-card-radius) var(--fb-card-radius) 0 0;
}

.modal-footer {
  border-top: 1px solid var(--fb-border);
  background: var(--fb-input-bg);
  border-radius: 0 0 var(--fb-card-radius) var(--fb-card-radius);
}

/* --- File Drop Zone --- */
.file-drop-zone {
  border: 2px dashed var(--fb-border);
  border-radius: var(--fb-radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fff;
}
.file-drop-zone:hover {
  border-color: var(--fb-green);
  background-color: var(--fb-green-light);
}
.file-drop-zone.dragover {
  border-color: var(--fb-green);
  background-color: var(--fb-green-light);
}

/* --- Public onboarding micro-interactions --- */
.fb-onboarding-step {
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-card-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.fb-onboarding-step--active {
  border-color: var(--fb-green);
  box-shadow: 0 6px 18px rgba(107, 185, 127, 0.12);
  transform: translateY(-1px);
}

/* --- Sidebar (Admin Layout) --- */
.fb-sidebar {
  width: var(--fb-sidebar-width);
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid var(--fb-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
}

.fb-sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--fb-border);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}

.fb-sidebar-logo .logo-text {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--fb-text);
  letter-spacing: -0.02em;
}

.fb-sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.fb-sidebar-nav .nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fb-muted-text);
  padding: 1rem 1.5rem 0.375rem;
}

.fb-sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: var(--fb-muted-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.fb-sidebar-nav .nav-item:hover {
  background-color: var(--fb-green-light);
  color: var(--fb-text);
}

.fb-sidebar-nav .nav-item.active {
  background-color: var(--fb-green-light);
  color: var(--fb-green);
  border-left-color: var(--fb-green);
}

.fb-sidebar-nav .nav-item [data-lucide] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.fb-sidebar-footer {
  border-top: 1px solid var(--fb-border);
  padding: 0.75rem 0;
}

/* Admin main content area */
.fb-admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.fb-admin-main {
  flex: 1;
  margin-left: var(--fb-sidebar-width);
  padding: 1.5rem 2rem;
  min-height: 100vh;
}

/* Mobile sidebar */
.fb-sidebar-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1050;
  background: #fff;
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius-md);
  padding: 0.5rem 0.625rem;
  cursor: pointer;
  box-shadow: var(--fb-card-shadow);
}

@media (max-width: 991.98px) {
  .fb-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .fb-sidebar.show {
    transform: translateX(0);
  }
  .fb-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1035;
  }
  .fb-sidebar-backdrop.show {
    display: block;
  }
  .fb-admin-main {
    margin-left: 0;
    padding: 1rem;
    padding-top: 3.5rem;
  }
  .fb-sidebar-toggle {
    display: block;
  }
}

/* --- Public Navbar --- */
.fb-navbar {
  background: #fff;
  border-bottom: 1px solid var(--fb-border);
  padding: 0.75rem 0;
}

.fb-navbar .navbar-brand {
  font-weight: 700;
  color: var(--fb-text) !important;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fb-navbar .nav-link {
  color: var(--fb-muted-text) !important;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem !important;
  border-radius: var(--fb-radius-sm);
  transition: all 0.15s ease;
}

.fb-navbar .nav-link:hover,
.fb-navbar .nav-link.active {
  color: var(--fb-text) !important;
  background-color: var(--fb-green-light);
}

/* --- Public Footer --- */
.fb-footer {
  background: #fff;
  border-top: 1px solid var(--fb-border);
  padding: 1.25rem 0;
  margin-top: auto;
  color: var(--fb-muted-text);
  font-size: 0.8125rem;
}

/* --- Stat Cards (Dashboard) --- */
.fb-stat-card {
  background: #fff;
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-card-radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.fb-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fb-stat-icon.green  { background: var(--fb-green-light); color: var(--fb-green); }
.fb-stat-icon.gold   { background: var(--fb-gold-light);  color: var(--fb-gold); }
.fb-stat-icon.blue   { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.fb-stat-icon.muted  { background: var(--fb-muted-bg); color: var(--fb-muted-text); }

.fb-stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  color: var(--fb-text);
}

.fb-stat-label {
  font-size: 0.8125rem;
  color: var(--fb-muted-text);
  margin-top: 0.125rem;
}

/* --- Insight Cards (Report) --- */
.fb-insight-strength {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: var(--fb-radius-md);
  padding: 1rem;
}
.fb-insight-risk {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--fb-radius-md);
  padding: 1rem;
}
.fb-insight-critical {
  background: #fef2f2;
  border: 2px solid #fca5a5;
  border-radius: var(--fb-radius-md);
  padding: 1rem;
}
.fb-insight-next {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--fb-radius-md);
  padding: 1rem;
}

/* --- Page Header --- */
.fb-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.fb-page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--fb-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Pagination --- */
.page-link {
  color: var(--fb-green);
  border-color: var(--fb-border);
}
.page-link:hover {
  color: var(--fb-green-hover);
  background-color: var(--fb-green-light);
}
.page-item.active .page-link {
  background-color: var(--fb-green);
  border-color: var(--fb-green);
  color: #fff;
}

/* --- Breadcrumb --- */
.breadcrumb-item a {
  color: var(--fb-muted-text);
}
.breadcrumb-item.active {
  color: var(--fb-text);
}
.breadcrumb-item + .breadcrumb-item::before {
  color: var(--fb-muted-text);
}

/* --- Misc Utilities --- */
.question-text {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.file-list-item {
  transition: all 0.2s ease;
}
.file-list-item:hover {
  background-color: var(--fb-input-bg);
}

.citation-card {
  font-size: 0.85rem;
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

.file-upload-preview {
  max-height: 200px;
  overflow-y: auto;
}

.submission-status {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--fb-radius-sm);
}

.bg-light {
  background-color: var(--fb-input-bg) !important;
}

/* Lucide icon spin animation (for loader) */
@keyframes fb-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.fb-spin [data-lucide], .fb-spin {
  animation: fb-spin 1s linear infinite;
}

/* Committed accordion items */
.accordion-item.committed {
  opacity: 0.7;
}

/* Attribute tree — Freshdesk-style category list */
.fb-tree-panel {
  background: #fff;
  border-radius: 0 0 var(--fb-card-radius) var(--fb-card-radius);
}

.fb-tree-ul {
  margin: 0;
  padding: 0;
  position: relative;
}

.fb-tree-ul[data-parent="root"] {
  padding-left: 0;
}

.fb-tree-ul:not([data-parent="root"]) {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 1px solid #e5e7eb;
}

.fb-tree-li {
  list-style: none;
  margin-bottom: 0;
  position: relative;
}

.fb-tree-li[data-depth="0"] > .fb-tree-node {
  padding-left: 0.5rem;
}

.fb-tree-branch {
  margin-top: 0;
}

.fb-tree-branch[hidden] {
  display: none !important;
}

.fb-tree-node.fb-tree-row {
  background: #fff;
  border: none;
  border-bottom: 1px solid #eceef2;
  border-radius: 0;
  padding: 0.55rem 0.75rem 0.55rem 0.5rem;
  margin-bottom: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 2.65rem;
  transition: background-color 0.12s ease;
}

.fb-tree-node.fb-tree-row:hover {
  background: #f9fafb;
}

.fb-tree-preview {
  color: var(--fb-muted-text, #6b7280);
  max-width: 42rem;
}

.fb-tree-type-icon {
  width: 18px;
  height: 18px;
  margin-top: 0.15rem;
  color: var(--fb-muted-text, #6b7280);
  flex-shrink: 0;
}

.fb-tree-node .fb-tree-chevron,
.fb-tree-node .fb-tree-disclosure-spacer {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  min-width: 1.5rem;
  min-height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.125rem;
}

.fb-tree-chevron {
  color: var(--fb-muted-text, #6c757d);
  border-radius: var(--fb-radius-sm, 4px);
}

.fb-tree-chevron:hover {
  color: var(--fb-text, #212529);
  background: rgba(0, 0, 0, 0.05);
}

.fb-tree-chevron:focus-visible {
  outline: 2px solid var(--fb-primary, #0d6efd);
  outline-offset: 2px;
}

.fb-tree-chevron svg {
  transition: transform 0.18s ease;
}

.fb-tree-chevron--expanded svg {
  transform: rotate(90deg);
}

.fb-tree-disclosure-spacer {
  visibility: hidden;
  pointer-events: none;
}

.fb-tree-node .fb-tree-grip {
  flex-shrink: 0;
  margin-top: 0.2rem;
  width: 14px;
  height: 14px;
  color: var(--fb-muted-text);
  cursor: grab;
}

.fb-tree-open-detail:focus-visible {
  outline: 2px solid var(--fb-primary, #0d6efd);
  outline-offset: 2px;
  border-radius: 2px;
}

.fb-tree-node .badge-leaf {
  background: var(--fb-green-light);
  color: var(--fb-green);
}
.fb-tree-node .badge-group {
  background: var(--fb-muted-bg);
  color: var(--fb-muted-text);
}

/* Score gauge helpers */
.fb-score-excellent { color: var(--fb-score-green); }
.fb-score-good      { color: var(--fb-score-yellow); }
.fb-score-risk      { color: var(--fb-score-orange); }
.fb-score-critical  { color: var(--fb-score-red); }

/* Reference code highlight */
.fb-ref-code {
  display: inline-block;
  background: var(--fb-gold-light);
  border: 1px solid var(--fb-gold);
  border-radius: var(--fb-radius-md);
  padding: 0.5rem 1rem;
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fb-brown);
  user-select: all;
  letter-spacing: 0.05em;
}

/* Empty state */
.fb-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--fb-muted-text);
}

.fb-empty-state [data-lucide] {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Processing stages visualization */
.processing-stages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.stage-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--fb-radius-md);
    background: var(--fb-input-bg);
    position: relative;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.stage-item[data-status="running"] {
    background: rgba(255, 193, 7, 0.1);
    border-left-color: #ffc107;
}

.stage-item[data-status="completed"] {
    background: rgba(40, 167, 69, 0.05);
    border-left-color: #28a745;
}

.stage-item[data-status="error"] {
    background: rgba(220, 53, 69, 0.05);
    border-left-color: #dc3545;
}

.stage-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    margin-right: 1rem;
    flex-shrink: 0;
    border: 2px solid var(--fb-border);
}

.stage-item[data-status="completed"] .stage-icon {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.stage-item[data-status="running"] .stage-icon {
    background: #ffc107;
    color: white;
    border-color: #ffc107;
    animation: pulse 2s infinite;
}

.stage-item[data-status="error"] .stage-icon {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

.stage-content {
    flex: 1;
}

.stage-title {
    font-weight: 600;
    color: var(--fb-text);
    margin-bottom: 0.25rem;
}

.stage-description {
    font-size: 0.875rem;
    color: var(--fb-muted-text);
}

.stage-timing {
    font-size: 0.75rem;
    color: var(--fb-success);
    margin-top: 0.25rem;
    font-weight: 500;
}

.stage-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
}

/* DSCIF gauge styling */
.dscif-score-container {
    margin: 1rem auto;
}

.dscif-gauge {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.index-gauge-item {
    padding: 1rem;
    background: var(--fb-input-bg);
    border-radius: var(--fb-radius-md);
    border: 1px solid var(--fb-border);
}

.index-gauge-item:hover {
    border-color: var(--fb-green);
    background: white;
}

/* Enhanced progress bars */
.progress {
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 9999px;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* --- Admin attribute taxonomy --- */
.fb-mindmap-panel {
  min-height: 420px;
  position: relative;
}

.fb-mindmap-toolbar {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.fb-mindmap-toolbar .btn {
  padding: 0.35rem 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fb-mindmap-toolbar .btn:disabled {
  opacity: 0.45;
}

.fb-mindmap-canvas {
  width: 100%;
  height: min(70vh, 560px);
  min-height: 360px;
  background-color: #fafbfc;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  border-radius: 0 0 var(--fb-card-radius) var(--fb-card-radius);
}

.fb-node-detail-offcanvas {
  --bs-offcanvas-width: min(420px, 100vw);
}

.fb-node-detail-offcanvas .offcanvas-header {
  background: var(--fb-input-bg, #f8f9fa);
}
.fb-tree-row-muted {
  opacity: 0.72;
  background: rgba(0, 0, 0, 0.03);
}
.fb-advanced-details summary {
  list-style-position: outside;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .btn-group {
    flex-direction: column;
  }
  .btn-group .btn {
    border-radius: var(--fb-radius-md) !important;
    margin-bottom: 0.25rem;
  }
  .table-responsive {
    font-size: 0.85rem;
  }
  .fb-page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   Help Sidebar — collapsible right panel
   ============================================================ */
.fb-help-toggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 1080;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--fb-green);
  background: #fff;
  color: var(--fb-green);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: background .2s, color .2s;
}
.fb-help-toggle:hover,
.fb-help-toggle.active {
  background: var(--fb-green);
  color: #fff;
}

.fb-help-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--fb-border);
  box-shadow: -4px 0 16px rgba(0,0,0,.08);
  z-index: 1070;
  transform: translateX(100%);
  transition: transform .3s ease;
  overflow-y: auto;
  padding: 60px 20px 24px;
}
.fb-help-sidebar.open {
  transform: translateX(0);
}

/* Keep help toggle outside the open panel and above Bootstrap offcanvas/modal layers */
.fb-admin-wrapper:has(.fb-help-sidebar.open) .fb-help-toggle {
  right: calc(340px + 16px);
}
@media (max-width: 400px) {
  .fb-admin-wrapper:has(.fb-help-sidebar.open) .fb-help-toggle {
    right: 16px;
  }
}

.fb-help-sidebar h5 {
  color: var(--fb-brown);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--fb-green);
}

.fb-help-topic {
  margin-bottom: 1.25rem;
}
.fb-help-topic .topic-title {
  font-weight: 600;
  font-size: .875rem;
  color: var(--fb-text);
  margin-bottom: .25rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fb-help-topic .topic-title i {
  color: var(--fb-green);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.fb-help-topic p {
  font-size: .8125rem;
  color: var(--fb-muted-text, #717182);
  margin-bottom: 0;
  line-height: 1.5;
}

/* ============================================================
   Info-tip — inline ? icon with tooltip
   ============================================================ */
.fb-info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--fb-muted-text, #717182);
  color: var(--fb-muted-text, #717182);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
  flex-shrink: 0;
  line-height: 1;
}
.fb-info-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1060;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.fb-info-tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1a2e;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1061;
}
.fb-info-tip:hover::after,
.fb-info-tip:focus::after,
.fb-info-tip:hover::before,
.fb-info-tip:focus::before {
  opacity: 1;
}

/* When tooltip would overflow top, flip to bottom */
.fb-info-tip.tip-bottom::after {
  bottom: auto;
  top: calc(100% + 8px);
}
.fb-info-tip.tip-bottom::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: #1a1a2e;
}

/* Rendered markdown (report bodies, assistant replies, etc.) */
.markdown-content {
  color: var(--fb-text, #1a1a2e);
  line-height: 1.6;
  word-wrap: break-word;
}
.markdown-content > :first-child { margin-top: 0; }
.markdown-content > :last-child { margin-bottom: 0; }
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-weight: 700;
  line-height: 1.25;
  margin: 1.4em 0 0.6em;
  color: #1a1a2e;
}
.markdown-content h1 { font-size: 1.6rem; border-bottom: 1px solid #e6e6ef; padding-bottom: 0.3em; }
.markdown-content h2 { font-size: 1.35rem; border-bottom: 1px solid #eef0f5; padding-bottom: 0.25em; }
.markdown-content h3 { font-size: 1.15rem; }
.markdown-content h4 { font-size: 1.0rem; }
.markdown-content h5,
.markdown-content h6 { font-size: 0.95rem; color: #555; }
.markdown-content p { margin: 0 0 0.9em; }
.markdown-content ul,
.markdown-content ol { margin: 0 0 0.9em 1.4em; padding: 0; }
.markdown-content li { margin-bottom: 0.25em; }
.markdown-content li > p { margin-bottom: 0.25em; }
.markdown-content blockquote {
  margin: 0 0 0.9em;
  padding: 0.5em 1em;
  color: #555;
  border-left: 3px solid #e2ae6e;
  background: #fffdf5;
}
.markdown-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f4f4f8;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}
.markdown-content pre {
  background: #f4f4f8;
  padding: 0.8em 1em;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0 0 0.9em;
}
.markdown-content pre code {
  background: transparent;
  padding: 0;
  font-size: 0.9em;
}
.markdown-content a {
  color: #4a6fa5;
  text-decoration: underline;
}
.markdown-content a:hover { color: #2a4e85; }
.markdown-content hr {
  border: 0;
  border-top: 1px solid #e6e6ef;
  margin: 1.4em 0;
}
.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 0.9em;
  font-size: 0.95em;
}
.markdown-content th,
.markdown-content td {
  border: 1px solid #e6e6ef;
  padding: 0.45em 0.7em;
  text-align: left;
}
.markdown-content th {
  background: #f7f7fb;
  font-weight: 700;
}
.markdown-content img { max-width: 100%; height: auto; }

/* Compact variant for assistant chat bubbles */
.markdown-content.markdown-compact { line-height: 1.5; }
.markdown-content.markdown-compact p { margin-bottom: 0.4em; }
.markdown-content.markdown-compact ul,
.markdown-content.markdown-compact ol { margin-bottom: 0.4em; }
.markdown-content.markdown-compact h1,
.markdown-content.markdown-compact h2,
.markdown-content.markdown-compact h3,
.markdown-content.markdown-compact h4 {
  margin: 0.6em 0 0.3em;
  font-size: 1rem;
}

.badge-warning {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #fbbf24;
  color: #1a1a1a;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* ============================================================
   Results page — DSCIF gauges + insight cards  (Task 10)
   ============================================================ */
:root {
  --gauge-red: #ef4444;
  --gauge-amber: #f59e0b;
  --gauge-green: #10b981;
  --card-success: #10b981;
  --card-info: #3b82f6;
  --card-warning: #f59e0b;
  --card-critical: #ef4444;
  --card-recommendation: #6b7280;
}

.results-header {
  text-align: center;
  margin: 2rem 0;
}
.results-header h1 {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
}
.results-subtitle {
  color: #6b7280;
  margin: 0.25rem 0 0 0;
}
.results-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.btn--primary {
  background: #111827;
  color: white;
  border-color: #111827;
}
.btn--secondary {
  background: white;
  color: #374151;
}

.results-scores {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  align-items: center;
}
.results-scores__primary {
  display: flex;
  align-items: center;
  justify-content: center;
}
.results-scores__indexes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.results-index-groups {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}
.results-index-groups__parents {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.results-index-groups__parent-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.5rem 0.25rem;
  margin: 0;
  color: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.results-index-groups__parent-btn:hover {
  background: #eef2f7;
}
.results-index-groups__parent-btn.is-active {
  border-color: #d1d5db;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.results-index-groups__parent-btn:focus {
  outline: none;
}
.results-index-groups__parent-btn:focus-visible {
  box-shadow: 0 0 0 2px #3b82f6;
}
.results-index-groups__parent-btn .gauge__svg,
.results-index-groups__parent-chip .gauge__svg {
  width: 92px;
  height: 92px;
}
.results-index-groups__panels {
  padding: 0.75rem 1rem 1rem 1rem;
}
.results-index-groups__panel.is-hidden {
  display: none;
}
.results-index-groups__panel-title {
  font-size: 0.9rem;
  color: #4b5563;
  margin: 0 0 0.5rem 0.25rem;
}
.results-index-group__children {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.25rem 0;
}
.results-index-group__children--empty {
  grid-template-columns: 1fr;
}
.results-index-groups--pdf {
  border: 0;
}
.results-index-groups--pdf .results-index-groups__parents {
  padding: 0 0 0.75rem 0;
  background: transparent;
  border-bottom: 0;
}
.results-index-groups--pdf .results-index-groups__parent-chip {
  display: flex;
  justify-content: center;
}
.results-index-groups--pdf .results-index-groups__panel--static {
  margin-top: 0.5rem;
}

.gauge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.gauge__svg {
  width: 100px;
  height: 100px;
}
.gauge--big .gauge__svg {
  width: 200px;
  height: 200px;
}
.gauge__bg {
  fill: none;
  stroke: #e5e7eb;
  stroke-width: 8;
}
.gauge__fg {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 600ms;
}
.gauge__fg.gauge__fg--red {
  stroke: #ef4444;
}
.gauge__fg.gauge__fg--amber {
  stroke: #f59e0b;
}
.gauge__fg.gauge__fg--green {
  stroke: #10b981;
}
.gauge__value {
  font-size: 28px;
  font-weight: 600;
  fill: #111827;
}
.gauge--big .gauge__value {
  font-size: 48px;
}
.gauge__label {
  font-size: 0.875rem;
  color: #4b5563;
  margin-top: 0.25rem;
  text-align: center;
}
.gauge--no-data .gauge__value {
  fill: #9ca3af;
}

.results-insights {
  margin-top: 2rem;
}
.results-insights h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
}
.insight-card {
  border: 1px solid #e5e7eb;
  border-left: 4px solid var(--card-info);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  background: white;
}
.insight-card--success { border-left-color: var(--card-success); }
.insight-card--info { border-left-color: var(--card-info); }
.insight-card--warning { border-left-color: var(--card-warning); }
.insight-card--critical {
  border-left-color: var(--card-critical);
  background: #fef2f2;
}
.insight-card--recommendation {
  border-left-color: var(--card-recommendation);
}
.insight-card__title {
  font-size: 0.95rem;
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}
.insight-card__body {
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.5;
}
.insight-card__body ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}
.insight-card__body p {
  margin: 0.5rem 0;
}

.no-data {
  color: #9ca3af;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
}

@media (max-width: 768px) {
  .results-scores {
    grid-template-columns: 1fr;
  }
  .results-scores__indexes {
    grid-template-columns: 1fr;
  }
  .results-index-groups__parents {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .results-index-group__children {
    grid-template-columns: 1fr;
  }
}

/* Admin submission detail view toggle */
.admin-view-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
}
.pd-nav-loading {
  margin-left: 0.5rem;
  color: var(--fb-muted-text);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.pd-link--loading {
  pointer-events: none;
  opacity: 0.7;
}

/* === Processing Details: state-aware header === */
.pd-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--fb-radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.pd-banner__text { flex: 1; }
.pd-banner__icon { font-size: 1.1rem; }
.pd-banner__actions { display: flex; gap: 0.5rem; }

.pd-banner--completed { background: var(--fb-green-light); color: var(--fb-text); }
.pd-banner--processing { background: #e0f2fe; color: #075985; }
.pd-banner--paused { background: #fef3c7; color: #92400e; border: 1px solid #f59e0b; }
.pd-banner--error { background: #fee2e2; color: #991b1b; border: 1px solid var(--fb-destructive); }
.pd-banner--pending { background: var(--fb-input-bg); color: var(--fb-muted-text); }

.pd-actions-menu { position: relative; display: inline-block; }
.pd-actions-menu summary { list-style: none; cursor: pointer; }
.pd-actions-menu summary::-webkit-details-marker { display: none; }
.pd-actions-menu__body {
  position: absolute; right: 0; top: calc(100% + 0.25rem);
  background: white; border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius-md); padding: 0.5rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  box-shadow: var(--fb-card-shadow-lg); z-index: 10; min-width: 220px;
}

.pd-scorecard {
  display: flex; gap: 2rem; align-items: center;
  background: white; border: 1px solid var(--fb-border);
  border-radius: var(--fb-card-radius); padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.pd-scorecard__label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--fb-muted-text); font-weight: 500;
}
.pd-scorecard__value {
  font-size: 2rem; font-weight: 600; line-height: 1.1; color: var(--fb-text);
}
.pd-scorecard__sublabel { font-size: 0.85rem; color: var(--fb-muted-text); }
.pd-scorecard__list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.pd-scorecard__leaf {
  display: inline-block; padding: 0.2rem 0.6rem; background: var(--fb-input-bg);
  border-radius: 9999px; font-size: 0.8rem; color: var(--fb-text);
}

/* === Processing Details: tab strip === */
.pd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--fb-border);
  margin: 1.5rem 0 1rem;
  padding: 0 0.5rem;
  overflow-x: auto;
}
.pd-tab {
  display: inline-flex; align-items: baseline; gap: 0.5rem;
  padding: 0.6rem 1.1rem; border-bottom: 2px solid transparent;
  margin-bottom: -2px; font-size: 0.95rem; color: var(--fb-muted-text);
  text-decoration: none; white-space: nowrap;
}
.pd-tab:hover { color: var(--fb-text); background: var(--fb-input-bg); }
.pd-tab--active {
  color: var(--fb-green); border-bottom-color: var(--fb-green); font-weight: 500;
}
.pd-tab__count {
  font-size: 0.78rem; padding: 0.05rem 0.5rem; border-radius: 9999px;
  background: var(--fb-input-bg); color: var(--fb-muted-text);
}
.pd-tab--active .pd-tab__count { background: var(--fb-green-light); color: var(--fb-green); }

/* === Processing Details: tab pane shared === */
.pd-tab-pane { padding: 0 0.5rem; }
.pd-tab-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem; background: var(--fb-input-bg);
  border-radius: var(--fb-card-radius); margin-bottom: 1rem;
}
.pd-tab-header__metrics { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.pd-metric { display: flex; flex-direction: column; gap: 0.1rem; }
.pd-metric__label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fb-muted-text); }
.pd-metric__value { font-size: 1.4rem; font-weight: 600; }
.pd-metric__pipeline { font-size: 0.7rem; color: var(--fb-muted-text); }
.pd-metric--empty { color: var(--fb-muted-text); font-style: italic; }
.pd-tab-header__actions { display: flex; gap: 0.5rem; }
.pd-section-title { margin: 1.5rem 0 0.5rem; font-size: 0.95rem; color: var(--fb-muted-text); font-weight: 500; }

.pd-table { font-size: 0.875rem; }
.pd-table .pd-num { text-align: right; font-variant-numeric: tabular-nums; }
.pd-table .pd-edit { width: 2rem; text-align: center; }
.pd-table .pd-dim { color: var(--fb-muted-text); opacity: 0.5; }
.pd-leaf-row { display: inline; }
.pd-leaf-row summary { cursor: pointer; }
.pd-leaf-row summary:hover { color: var(--fb-green); }
.pd-leaf-row[open] summary { font-weight: 500; color: var(--fb-text); }
.pd-drilldown { padding: 0.75rem 1rem; background: var(--fb-input-bg); border-radius: var(--fb-radius-md); margin: 0.5rem 0 1rem; }
.pd-drilldown__placeholder { font-size: 0.85rem; color: var(--fb-muted-text); }

/* Reserved for future inactive-leaf rendering */
.pd-dim-row td { opacity: 0.55; }

/* === Processing Details: empty card + expandable card === */
.pd-empty-card {
  text-align: center; padding: 3rem 2rem;
  background: white; border: 2px dashed var(--fb-border);
  border-radius: var(--fb-card-radius);
}
.pd-empty-card h4 { margin: 0 0 0.5rem; }
.pd-empty-card p { color: var(--fb-muted-text); max-width: 36rem; margin: 0 auto 1.25rem; }

.pd-card {
  background: white; border: 1px solid var(--fb-border);
  border-radius: var(--fb-card-radius); margin-bottom: 0.5rem;
}
.pd-card__summary {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1rem; cursor: pointer; list-style: none;
}
.pd-card__summary::-webkit-details-marker { display: none; }
.pd-card__summary::before {
  content: '▸'; transition: transform 0.15s; font-size: 0.9rem; color: var(--fb-muted-text);
}
.pd-card[open] .pd-card__summary::before { transform: rotate(90deg); }
.pd-card__title { flex: 1; font-weight: 500; }
.pd-card__badges { display: flex; gap: 0.4rem; align-items: center; font-size: 0.85rem; }
.pd-card__edit { color: var(--fb-green); padding: 0 0.5rem; text-decoration: none; }
.pd-card__body {
  padding: 1rem 1.25rem; border-top: 1px solid var(--fb-border);
  background: var(--fb-input-bg);
}
.pd-card__judge { margin-bottom: 0.75rem; font-size: 0.9rem; }
.pd-rules-breakdown {
  font-size: 0.78rem; background: white; padding: 0.75rem; border-radius: var(--fb-radius-md);
  max-height: 320px; overflow: auto;
}

/* === Processing Details: per-leaf drilldown === */
.pd-drilldown__header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem; font-size: 0.85rem;
}
.pd-drilldown__methodology { color: var(--fb-green); text-decoration: none; }
.pd-drilldown__pipelines {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.pd-drilldown__pane {
  background: white; padding: 0.75rem; border-radius: var(--fb-radius-md);
  border: 1px solid var(--fb-border);
}
.pd-drilldown__pane h6 { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--fb-muted-text); }
.pd-drilldown__picks { padding-left: 1.25rem; margin: 0; }
.pd-drilldown__picks li { margin-bottom: 0.5rem; font-size: 0.85rem; }
.pd-drilldown__quote {
  font-size: 0.78rem; color: var(--fb-muted-text); font-style: italic;
  margin-top: 0.25rem; padding-left: 0.25rem; border-left: 2px solid var(--fb-border);
}
.pd-citation summary { font-size: 0.75rem; color: var(--fb-green); cursor: pointer; }
.pd-citation pre { font-size: 0.7rem; max-height: 200px; overflow: auto; background: var(--fb-input-bg); padding: 0.5rem; border-radius: 0.25rem; }

@media (max-width: 900px) {
  .pd-drilldown__pipelines { grid-template-columns: 1fr; }
}

.results-scores__breakdown {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem;
  width: 100%; align-items: start;
}
.breakdown-col h4 {
  margin: 0 0 0.5rem; font-size: 0.95rem;
  color: var(--fb-muted-text, #555);
}
.breakdown-chip {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.65rem; border-radius: 0.5rem;
  margin: 0.3rem 0; background: #f6f7f9;
}
.breakdown-chip--up   { border-left: 4px solid #22c55e; }
.breakdown-chip--down { border-left: 4px solid #ef4444; }
.breakdown-chip__tier {
  font-weight: 600; font-size: 0.78rem; color: #6b7280;
  background: #fff; padding: 0.1rem 0.45rem; border-radius: 999px;
  white-space: nowrap;
}
.breakdown-chip__title { font-size: 0.92rem; color: #1f2937; }

@media (max-width: 700px) {
  .results-scores__breakdown { grid-template-columns: 1fr; }
}
