/* ============================================ */
/*  SOURCINGTERMS DASHBOARD - POST-PAYWALL UI    */
/*  RAG (Red/Amber/Green) Methodology            */
/* ============================================ */

/* --- CSS Variables for RAG System --- */
:root {
  /* RED - Assess / Danger / Critical */
  --rag-red: #dc2626;
  --rag-red-light: #fef2f2;
  --rag-red-border: #fecaca;
  --rag-red-bg: #fef2f2;
  --rag-red-hover: #fee2e2;
  --rag-red-text: #991b1b;

  /* AMBER - Verify / Caution / Research */
  --rag-amber: #d97706;
  --rag-amber-light: #fffbeb;
  --rag-amber-border: #fde68a;
  --rag-amber-bg: #fffbeb;
  --rag-amber-hover: #fef3c7;
  --rag-amber-text: #92400e;

  /* GREEN - Action / Safe / Next Steps */
  --rag-green: #16a34a;
  --rag-green-light: #f0fdf4;
  --rag-green-border: #bbf7d0;
  --rag-green-bg: #f0fdf4;
  --rag-green-hover: #dcfce7;
  --rag-green-text: #166534;

  /* Dashboard Layout */
  --nav-height: 56px;
  --topbar-height: 48px;
}

/* --- Horizontal Tab Navigation Bar --- */
.dashboard-tab-nav {
  display: flex;
  align-items: stretch;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 1rem;
  min-height: var(--nav-height);
  overflow-x: auto;
  gap: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.dashboard-tab-nav::-webkit-scrollbar {
  height: 3px;
}
.dashboard-tab-nav::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.dashboard-tab-nav::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* --- RAG Group Container --- */
.rag-group {
  display: flex;
  align-items: stretch;
  flex: 1;
}

/* --- RAG Group Divider --- */
.rag-group-divider {
  width: 1px;
  background: #e2e8f0;
  margin: 10px 8px;
  flex-shrink: 0;
}

/* --- RAG Section Label --- */
.rag-section-label {
  display: flex;
  align-items: center;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 0 10px 0 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.rag-section-label .rag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.rag-section-label.label-red { color: var(--rag-red-text); }
.rag-section-label.label-red .rag-dot { background: var(--rag-red); box-shadow: 0 0 6px rgba(220,38,38,0.4); }
.rag-section-label.label-amber { color: var(--rag-amber-text); }
.rag-section-label.label-amber .rag-dot { background: var(--rag-amber); box-shadow: 0 0 6px rgba(217,119,6,0.4); }
.rag-section-label.label-green { color: var(--rag-green-text); }
.rag-section-label.label-green .rag-dot { background: var(--rag-green); box-shadow: 0 0 6px rgba(22,163,74,0.4); }

/* --- Individual Tab Pill --- */
.tab-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
}

.tab-pill:hover {
  color: #1e293b;
  background: #f8fafc;
}

.tab-pill .tab-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* --- Active State by RAG Group --- */
.tab-pill.active-red {
  color: var(--rag-red);
  border-bottom-color: var(--rag-red);
  background: var(--rag-red-light);
}
.tab-pill.active-red .tab-icon { opacity: 1; color: var(--rag-red); }

.tab-pill.active-amber {
  color: var(--rag-amber);
  border-bottom-color: var(--rag-amber);
  background: var(--rag-amber-light);
}
.tab-pill.active-amber .tab-icon { opacity: 1; color: var(--rag-amber); }

.tab-pill.active-green {
  color: var(--rag-green);
  border-bottom-color: var(--rag-green);
  background: var(--rag-green-light);
}
.tab-pill.active-green .tab-icon { opacity: 1; color: var(--rag-green); }

/* --- Tab Content Area --- */
#tab-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
  min-width: 0;
  overflow-x: hidden;
}

.tab-panel {
  display: none;
  overflow-y: auto;
  padding: 24px;
  min-width: 0;
  overflow-x: hidden;
}

.tab-panel.active {
  display: block;
}

/* --- Tab Panel Inner Layout --- */
.tab-panel-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.tab-panel h2 {
  font-size: 1.5rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.tab-panel .tab-subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

/* --- Placeholder Card Component --- */
.placeholder-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color 0.15s;
}
.placeholder-card:hover {
  border-color: #cbd5e1;
}

.placeholder-card .card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.placeholder-card .card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.placeholder-card .card-body {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
}

/* --- RAG Badge on Cards --- */
.rag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 4px;
}

.rag-badge-red {
  background: var(--rag-red-light);
  color: var(--rag-red);
  border: 1px solid var(--rag-red-border);
}

.rag-badge-amber {
  background: var(--rag-amber-light);
  color: var(--rag-amber);
  border: 1px solid var(--rag-amber-border);
}

.rag-badge-green {
  background: var(--rag-green-light);
  color: var(--rag-green);
  border: 1px solid var(--rag-green-border);
}

/* --- Dashboard Layout Fix --- */
#app-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#report-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

/* --- Search Bar (for PRC Law Search) --- */
.search-bar-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-bar-wrapper input[type="text"] {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar-wrapper input[type="text"]:focus {
  border-color: var(--rag-amber);
  box-shadow: 0 0 0 3px var(--rag-amber-light);
}
.search-bar-wrapper .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #94a3b8;
  pointer-events: none;
}

/* --- Checklist Styling (Due Diligence) --- */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.checklist-item:last-child { border-bottom: none; }

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--rag-green);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-item .checklist-text {
  flex: 1;
}
.checklist-item .checklist-text .item-title {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.9rem;
}
.checklist-item .checklist-text .item-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 2px;
}
.checklist-item input[type="checkbox"]:checked ~ .checklist-text .item-title {
  text-decoration: line-through;
  color: #94a3b8;
}

/* --- Exit Strategy Steps --- */
.exit-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #f1f5f9;
}
.exit-step:last-child { border-bottom: none; }
.exit-step .step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.exit-step .step-number.step-green { background: var(--rag-green-light); color: var(--rag-green); border: 2px solid var(--rag-green-border); }
.exit-step .step-number.step-amber { background: var(--rag-amber-light); color: var(--rag-amber); border: 2px solid var(--rag-amber-border); }
.exit-step .step-number.step-red { background: var(--rag-red-light); color: var(--rag-red); border: 2px solid var(--rag-red-border); }

.exit-step .step-content h4 {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.exit-step .step-content p {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.5;
}

/* --- Version History Timeline --- */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}
.timeline-item {
  position: relative;
  padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #94a3b8;
  border: 2px solid #ffffff;
}
.timeline-item.current::before { background: var(--rag-green); box-shadow: 0 0 0 3px var(--rag-green-light); }
.timeline-item.prior::before { background: var(--rag-amber); }
.timeline-item.archived::before { background: #cbd5e1; }

.timeline-item .tl-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.timeline-item .tl-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.9rem;
  margin-top: 2px;
}
.timeline-item .tl-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 2px;
}

/* --- Stat Cards (Executive Overview) --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.03em;
}
.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-top: 4px;
}
.stat-card .stat-badge {
  display: inline-block;
  margin-top: 8px;
}

/* ============================================ */
/*  TAB 1: EXECUTIVE OVERVIEW - NEW COMPONENTS   */
/* ============================================ */

/* --- Inverted Risk Score Card --- */
.stat-card-inverted {
  background: #dc2626;
  border: 2px solid #b91c1c;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220,38,38,0.25);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.stat-value-inverted {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff !important;
  letter-spacing: -0.03em;
}

.stat-label-inverted {
  color: rgba(255,255,255,0.85) !important;
}

/* RAG color classes for the inverted risk card */
.stat-card-inverted.risk-green {
  background: #16a34a;
  border-color: #15803d;
  box-shadow: 0 4px 12px rgba(22,163,74,0.25);
}
.stat-card-inverted.risk-amber {
  background: #d97706;
  border-color: #b45309;
  box-shadow: 0 4px 12px rgba(217,119,6,0.25);
}
.stat-card-inverted.risk-red {
  background: #dc2626;
  border-color: #b91c1c;
  box-shadow: 0 4px 12px rgba(220,38,38,0.25);
}
.stat-card-inverted.risk-critical {
  background: #7f1d1d;
  border-color: #450a0a;
  box-shadow: 0 4px 12px rgba(127,29,29,0.4);
}

.risk-badge {
  margin-top: 8px;
}
.risk-critical-badge {
  background: #450a0a !important;
  color: #fca5a5 !important;
  border-color: #7f1d1d !important;
}

/* --- Document Metrics Mini-List --- */
.metrics-list {
  margin-top: 8px;
  text-align: left;
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
}
.metric-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 4px;
  font-size: 0.8rem;
}
.metric-item + .metric-item {
  border-top: 1px solid #f1f5f9;
}
.metric-label {
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}
.metric-value {
  font-weight: 800;
  color: #1e293b;
  font-size: 0.85rem;
}

/* --- Summary + Chart Row --- */
.summary-chart-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: stretch;
}

.summary-box {
  flex: 1;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.summary-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #3b82f6;
}

.summary-box-text {
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.6;
  margin: 0;
}

.chart-container {
  width: 120px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.chart-container canvas {
  max-width: 80px;
  max-height: 80px;
}

.chart-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-top: 6px;
  text-align: center;
}

/* --- Findings List (Critical & Compliant) --- */
.findings-list {
  margin-top: 4px;
  padding-left: 20px;
  list-style: disc;
  line-height: 1.8;
}

.findings-list-item {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 4px;
}

.findings-list-item--red {
  color: #991b1b;
}

.findings-list-item--green {
  color: #166534;
}

/* --- Responsive: Stack chart below summary on small screens --- */
@media (max-width: 640px) {
  .summary-chart-row {
    flex-direction: column;
  }
  .chart-container {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    gap: 12px;
    padding: 12px 16px;
  }
  .chart-container canvas {
    max-width: 60px;
    max-height: 60px;
  }
  .chart-label {
    margin-top: 0;
  }
}

/* ============================================ */
/*  TWO-WAY BINDING RISK FEED - SPLIT SCREEN     */
/* ============================================ */

/* Split screen container — wider document viewer (7/5 grid split) */
.split-screen-container {
  display: grid;
  grid-template-columns: 70fr 30fr;
  gap: 16px;
  margin-top: 16px;
  height: calc(100vh - 200px);
  background: #f1f5f9;
  padding: 16px;
}

/* Left column - Document Viewer (wider — ~58%) */
.document-viewer-column {
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
  align-items: center;
}

.document-viewer-column h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

/* Right column - Risk Feed (narrower — ~42%) */
.risk-feed-column {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow: hidden;
}

.risk-feed-column h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

/* Stack on mobile */
@media (max-width: 768px) {
  .split-screen-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .document-viewer-column {
    max-height: 50vh;
  }
}

/* Document viewer content area — A4 paper styling */
.document-viewer {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  line-height: 1.8;
  font-size: 0.95rem;
  color: #0f172a;
  background-color: #ffffff;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 2px;
}

/* Scrollable feed for risk items */
.scrollable-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Document highlight styling */
.document-highlight {
  background-color: rgba(255, 255, 0, 0.3); /* Semi-transparent yellow */
  border-radius: 2px;
  padding: 1px 2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.document-highlight:hover {
  background-color: rgba(255, 255, 0, 0.5);
  box-shadow: 0 0 3px rgba(255, 255, 0, 0.7);
}

/* Highlight classes for different severities */
.highlight-high {
  background-color: rgba(220, 38, 38, 0.3); /* Red highlight */
}

.highlight-medium {
  background-color: rgba(217, 119, 6, 0.3); /* Amber highlight */
}

.highlight-low {
  background-color: rgba(22, 163, 74, 0.3); /* Green highlight */
}

/* ============================================ */
/*  TAB 3: KEY CLAUSES - NEW COMPONENTS          */
/* ============================================ */

/* --- Snapshot Header (Top Section) --- */
.snapshot-header {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: stretch;
}

.clause-health-section {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.top-risks-spotlight-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Spotlight Cards --- */
.spotlight-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: border-color 0.15s;
}

.spotlight-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.spotlight-body h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.spotlight-body p {
  font-size: 0.875rem;
  color: #475569;
  margin: 0;
  line-height: 1.5;
}

/* --- Accordion Styles --- */
.accordion-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
}

.accordion-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.accordion-toggle {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--rag-red);
  transition: transform 0.2s ease;
}

.accordion-content {
  display: none;
  padding: 20px;
  border-top: 1px solid #f1f5f9;
}

.accordion-content.show {
  display: block;
}

.clause-item {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f1f5f9;
}

.clause-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.clause-item h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}

.clause-item p {
  font-size: 0.875rem;
  color: #475569;
  margin: 8px 0;
  line-height: 1.5;
}

.business-impact {
  margin: 16px 0;
}

.business-impact strong {
  color: #0f172a;
  display: block;
  margin-bottom: 4px;
}

.prc-context {
  margin: 16px 0;
}

.prc-context strong {
  color: #0f172a;
  display: block;
  margin-bottom: 4px;
}

.recommended-fix {
  margin: 16px 0;
  padding: 12px;
  background: var(--rag-green-light);
  border: 1px solid var(--rag-green-border);
  border-radius: 8px;
}

.recommended-fix strong {
  color: #0f172a;
  display: block;
  margin-bottom: 4px;
}

/* ============================================ */
/*  TAB 6: VERSION HISTORY - NEW COMPONENTS      */
/* ============================================ */

/* --- Upload Slots Container --- */
.upload-slots-container {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* --- Bento Box Style --- */
.bento-box {
  flex: 1;
  min-width: 120px;
  height: 140px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
  position: relative;
}

/* --- Current File Bento Box --- */
.bento-box.current-file {
  background: #fffbeb;
  border-color: #fde68a;
  box-shadow: 0 1px 3px rgba(217,119,6,0.1);
}

.bento-box.current-file .bento-icon {
  color: var(--rag-amber);
}

/* --- Upload Dropzone Bento Box --- */
.bento-box.upload-dropzone {
  cursor: pointer;
  background: #ffffff;
  border: 2px dashed #e2e8f0;
}

.bento-box.upload-dropzone:hover {
  border-color: var(--rag-amber);
  background: #fffbeb;
}

/* --- Dropzone Elements --- */
.dropzone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 8px;
}

.dropzone-plus {
  font-size: 32px;
  font-weight: 300;
  color: #94a3b8;
  margin-bottom: 8px;
}

.dropzone-text {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.file-input {
  display: none;
}

/* --- Compare Button --- */
.full-width-bar {
  width: 100%;
  padding: 16px;
  background: var(--rag-amber);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-bottom: 24px;
}

.full-width-bar:hover:not(:disabled) {
  background: #e69028;
}

.full-width-bar:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* --- Results Grid --- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* --- Result Panel --- */
.result-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.panel-header {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.panel-content {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
}

/* --- Bento Icon --- */
.bento-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
}

.bento-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #0f172a;
  text-align: center;
}

/* ============================================ */
/*  END VERSION HISTORY STYLES                   */
/* ============================================ */

/* --- Version Tag Input --- */
.version-tag-input {
  font-family: inherit;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.7rem;
  color: #475569;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.version-tag-input:focus {
  border-color: var(--rag-amber);
  box-shadow: 0 0 0 2px var(--rag-amber-light);
}
.version-tag-input::placeholder {
  color: #94a3b8;
}

/* --- Comparison Matrix Grid --- */
#comparison-matrix {
  display: grid;
  gap: 16px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 16px;
}

/* --- Individual Matrix Column Card --- */
.matrix-column {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.matrix-column:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Rank badge styles */
.matrix-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.matrix-rank-badge.rank-1 {
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(22,163,74,0.4);
}
.matrix-rank-badge.rank-2 {
  background: #65a30d;
  color: #ffffff;
}
.matrix-rank-badge.rank-3 {
  background: #ca8a04;
  color: #ffffff;
}
.matrix-rank-badge.rank-4 {
  background: #d97706;
  color: #ffffff;
}
.matrix-rank-badge.rank-5 {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220,38,38,0.4);
}

.matrix-rank-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-bottom: 2px;
}

.matrix-filename {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
  word-break: break-word;
  line-height: 1.3;
}

.matrix-tag {
  display: inline-block;
  background: var(--rag-amber-light);
  color: var(--rag-amber);
  border: 1px solid var(--rag-amber-border);
  border-radius: 9999px;
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.matrix-divider {
  width: 100%;
  border: none;
  border-top: 1px solid #f1f5f9;
  margin: 0 0 16px 0;
}

.matrix-risk-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.matrix-risk-row:last-child {
  border-bottom: none;
}
.matrix-risk-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.matrix-risk-value {
  font-size: 1rem;
  font-weight: 900;
  color: #0f172a;
}
.matrix-risk-value.risks-high {
  color: #dc2626;
}
.matrix-risk-value.risks-mid {
  color: #d97706;
}
.matrix-risk-value.good-high {
  color: #16a34a;
}

/* --- Version Slot Card (selected file state) --- */
.version-slot-card.has-file {
  background: #ffffff;
  border: 2px solid #d97706;
}
.version-slot-card .slot-dropzone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 8px;
  cursor: pointer;
}

/* --- Overlay spinner animation --- */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================ */
/*  TAB 6: PRC LAW SEARCH - NEW COMPONENTS       */
/* ============================================ */

/* --- Law Breadcrumbs --- */
.law-breadcrumbs {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.breadcrumb-tag {
  background: var(--rag-amber-light);
  color: var(--rag-amber);
  border: 1px solid var(--rag-amber-border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Law Cards (Bento-style) --- */
.result-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}

.result-panel:hover {
  border-color: var(--rag-amber);
  box-shadow: 0 4px 6px rgba(217,119,6,0.1);
  transform: translateY(-2px);
}

.panel-header {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.4;
}

.panel-subheader {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 8px;
}

.panel-content {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
}

/* --- Section Header --- */
.section-header {
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.section-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.section-subtext {
  font-size: 0.9rem;
  color: #64748b;
  margin: 4px 0 0;
  font-weight: 400;
}

/* -------------------------------------------- */
/*  END PRC LAW SEARCH STYLES                    */
/* ============================================ */



/* --- Leverage Matrix Container --- */
.leverage-matrix-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.leverage-column {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.leverage-column h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.leverage-list {
  min-height: 120px;
}

.leverage-column:nth-child(1) {
  border-top: 4px solid var(--rag-green);
}

.leverage-column:nth-child(2) {
  border-top: 4px solid var(--rag-red);
}

.leverage-column:nth-child(3) {
  border-top: 4px solid var(--rag-amber);
}

/* --- Timeline Container --- */
.timeline-container {
  position: relative;
  padding-left: 28px;
  margin-bottom: 24px;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.timeline-node {
  position: relative;
  padding-bottom: 20px;
  padding-left: 1.5rem;
}

.timeline-node::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #94a3b8;
  border: 2px solid #ffffff;
}

.timeline-node.current::before { background: var(--rag-green); box-shadow: 0 0 0 3px var(--rag-green-light); }
.timeline-node.prior::before { background: var(--rag-amber); }
.timeline-node.archived::before { background: #cbd5e1; }

.timeline-node .tl-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-node .tl-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.9rem;
  margin-top: 2px;
}

.timeline-node .tl-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 2px;
}

/* --- CTA Banner --- */
.cta-banner {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: white;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(22,163,74,0.25);
}

.cta-banner h3 {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.cta-banner p {
  font-size: 1rem;
  margin-bottom: 20px;
  opacity: 0.9;
  line-height: 1.5;
}

.cta-button {
  background: #ffffff;
  color: var(--rag-green);
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cta-button:hover {
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

@media (max-width: 768px) {
  .leverage-matrix-container {
    grid-template-columns: 1fr;
  }
  
  .timeline-container {
    padding-left: 16px;
  }
  
  .timeline-container::before {
    left: 4px;
  }
  
  .timeline-node {
    padding-left: 1rem;
  }
  
  .timeline-node::before {
    left: -16px;
  }
}

/* --- Kanban Board Styles --- */
#dd-kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.kanban-column {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.kanban-column-content {
  min-height: 200px;
  border-radius: 8px;
}

.column-header {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

/* High priority column (Red border) */
#dd-high-col .kanban-column-content {
  border-top: 4px solid var(--rag-red);
}

/* Medium priority column (Amber border) */
#dd-med-col .kanban-column-content {
  border-top: 4px solid var(--rag-amber);
}

/* Low priority column (Green border) */
#dd-low-col .kanban-column-content {
  border-top: 4px solid var(--rag-green);
}

/* Post-sign column (Blue border) */
#dd-post-col .kanban-column-content {
  border-top: 4px solid #3b82f6;
}

.kanban-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  cursor: grab;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s ease;
}

.kanban-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}

.card-grip {
  font-size: 1.2rem;
  color: #94a3b8;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-text {
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.5;
}

.card-checkbox {
  align-self: flex-start;
  margin-top: 2px;
  accent-color: var(--rag-green);
}

.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

/* Trash Zone */
.trash-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: #fee2e2;
  border: 2px dashed var(--rag-red);
  border-radius: 8px;
  color: var(--rag-red);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.trash-dropzone:hover {
  background: #fecaca;
  border-color: #dc2626;
}

.trash-dropzone.drag-over {
  background: #fee2e2;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.2);
}

/* Progress Header */
.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.progress-badge {
  background: #f0fdf4;
  color: var(--rag-green);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid #bbf7d0;
}

/* General Checklist */
.general-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.checklist-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--rag-green);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-item .checklist-text {
  flex: 1;
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.5;
}

.checklist-item input[type="checkbox"]:checked ~ .checklist-text {
  text-decoration: line-through;
  color: #94a3b8;
}

/* ============================================ */
/*  EXIT STRATEGY TAB - NEW COMPONENTS           */
/* ============================================ */

/* --- Red Button Stepper --- */
.red-button-stepper {
  display: flex;
  flex-direction: column;
  margin-bottom: 32px;
}

.stepper-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 16px 0;
  z-index: 1;
}

.stepper-node:first-child {
  align-items: flex-start;
}

.stepper-node:last-child {
  align-items: flex-end;
}

.stepper-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--rag-red-light);
  color: var(--rag-red);
  border: 2px solid var(--rag-red-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  z-index: 2;
  margin-bottom: 8px;
}

.stepper-active .stepper-number {
  background: var(--rag-red);
  color: white;
  border-color: var(--rag-red);
}

.stepper-label {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  text-align: center;
}

.stepper-description {
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
}

.stepper-content {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: var(--rag-red-light);
  border-radius: 8px;
  border: 1px solid var(--rag-red-border);
  transition: all 0.3s ease;
}

.stepper-active .stepper-content {
  background: var(--rag-red-light);
  border-color: var(--rag-red-border);
}

.stepper-line {
  flex: 1;
  width: 2px;
  background: #e2e8f0;
  margin: 0 8px;
  z-index: 0;
}

.stepper-active .stepper-line {
  background: var(--rag-red);
}

/* --- Battleground Grid --- */
#battleground-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.battleground-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.battleground-card:hover {
  border-color: var(--rag-amber);
  box-shadow: 0 4px 6px rgba(217,119,6,0.1);
  transform: translateY(-2px);
}

.battleground-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--rag-amber);
}

.battleground-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 8px;
}

.battleground-stat {
  font-size: 1.25rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

/* --- Cost/Tactics Panels --- */
.exposure-panel {
  background: var(--rag-red-light);
  border: 1px solid var(--rag-red-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}

.tactics-panel {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}

.exposure-panel:hover {
  border-color: var(--rag-red);
  box-shadow: 0 4px 6px rgba(220,38,38,0.1);
}

.tactics-panel:hover {
  border-color: var(--rag-green);
  box-shadow: 0 4px 6px rgba(22,163,74,0.1);
}

/* --- Escalation Banner --- */
.escalation-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-bottom: 24px;
}

.banner-content h3 {
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
  margin-bottom: 8px;
}

.banner-content p {
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.6;
  margin: 0;
}

.banner-cta .cta-button {
  background: #ffffff;
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  min-width: 220px;
}

.banner-cta .cta-button:hover {
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* --- Responsive adjustments --- */
@media (max-width: 768px) {
  .red-button-stepper {
    flex-direction: column;
  }
  
  .stepper-node {
    flex-direction: row;
    align-items: center;
    padding: 16px 0;
  }
  
  .stepper-node:first-child,
  .stepper-node:last-child {
    align-items: center;
  }
  
  .stepper-number {
    margin-bottom: 0;
    margin-right: 16px;
  }
  
  .stepper-description {
    text-align: left;
  }
  
  .stepper-content {
    margin-top: 0;
    margin-left: 48px;
  }
  
  #battleground-grid {
    grid-template-columns: 1fr;
  }
  
  .escalation-banner {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }
  
  .banner-cta .cta-button {
    min-width: 180px;
  }
}
