/* ============================================================
   DDFM Simulator — Main Page Styles
   Requires: design-system.css loaded first
   ============================================================ */

/* ── Page Layout ────────────────────────────────────────────── */
.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

.page-title {
  margin-bottom: var(--space-4);
}

/* ── Workflow Stepper ───────────────────────────────────────── */
.workflow-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 2.5rem 0;
  padding: 1.25rem 2rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(15,52,96,0.07);
}
.stepper-step {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex: 0 0 auto;
}
.stepper-bubble {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  transition: all 0.4s cubic-bezier(0.34,1.56,0.64,1);
  background: #e2e8f0; color: #94a3b8;
  border: 2px solid #e2e8f0;
  flex-shrink: 0;
}
.stepper-step.active .stepper-bubble {
  background: var(--navy-arc); color: var(--gold-arc);
  border-color: var(--navy-arc);
  box-shadow: 0 0 0 4px rgba(15,52,96,0.15);
}
.stepper-step.complete .stepper-bubble {
  background: #1b6f3a; color: #fff;
  border-color: #1b6f3a;
}
.stepper-step.complete .stepper-bubble::before { content: '✓'; }
.stepper-step.complete .stepper-bubble span { display: none; }
.stepper-label { display: flex; flex-direction: column; gap: 2px; }
.stepper-title {
  font-weight: 700; font-size: 0.9rem; color: #1a2e4a;
  transition: color 0.3s;
}
.stepper-sub {
  font-size: 0.75rem; color: #94a3b8;
}
.stepper-step.locked .stepper-title { color: #94a3b8; }
.stepper-step.active .stepper-title { color: var(--navy-arc); }
.stepper-step.complete .stepper-title { color: #1b6f3a; }

.stepper-connector {
  flex: 1; height: 3px; background: #e2e8f0;
  margin: 0 1.5rem; border-radius: 2px; overflow: hidden;
}
.stepper-connector-fill {
  height: 100%; width: 0%; background: #1b6f3a;
  transition: width 0.6s ease; border-radius: 2px;
}
.stepper-connector-fill.filled { width: 100%; }

/* ── Step Panels ────────────────────────────────────────────── */
.step-panel {
  margin-bottom: 2rem;
  border-radius: 16px;
  border: 1.5px solid #e2e8f0;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.step-panel:not(.step-panel--locked) {
  box-shadow: 0 4px 20px rgba(15,52,96,0.08);
  border-color: #cbd5e1;
}
.step-panel--locked {
  border-color: #e9ecef;
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.4s ease, border-color 0.3s;
}
.step-panel--unlocked {
  opacity: 1;
  pointer-events: all;
  border-color: #1b6f3a;
  box-shadow: 0 4px 24px rgba(27,111,58,0.12);
}

.step-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.5rem 2rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.step-panel-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--navy-arc);
  color: var(--gold-arc);
  flex-shrink: 0;
  margin-top: 3px;
}
.step-panel-badge--locked {
  background: #e2e8f0;
  color: #94a3b8;
}
.step-panel-badge--active {
  background: #1b6f3a;
  color: #fff;
}
.step-panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a2e4a;
  margin: 0 0 3px 0;
}
.step-panel-sub {
  font-size: 0.84rem;
  color: #64748b;
  margin: 0;
}
.step2-lock-msg {
  margin-left: auto;
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 8px;
}
.step2-lock-msg.hidden { display: none; }

/* ── Continue to Step 2 CTA in analysis card footer ─────────── */
.arc-continue-btn {
  background: linear-gradient(135deg, #1b6f3a 0%, #145a2e 100%);
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(27,111,58,0.3);
  letter-spacing: 0.01em;
}
.arc-continue-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(27,111,58,0.4);
}
.arc-continue-btn:active { transform: translateY(0); }


.page-title h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy-800);
  letter-spacing: -0.02em;
}

.page-title p {
  margin-top: var(--space-1);
  font-size: 0.9375rem;
  color: var(--gray-500);
}

/* ── Main Grid ──────────────────────────────────────────────── */
.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr;
  }
}

/* ── Form ───────────────────────────────────────────────────── */
.form {
  background: #fff;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Accordion Sections ─────────────────────────────────────── */
.form-section {
  border-bottom: 1px solid var(--gray-100);
  overflow: hidden;
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0;
  cursor: pointer;
  user-select: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.form-section-header:hover {
  color: var(--navy-600);
}

.form-section-header h2 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--navy-700);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--navy-100);
  color: var(--navy-600);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.form-section.active .section-number {
  background: var(--navy-700);
  color: #fff;
}

.section-chevron {
  width: 20px;
  height: 20px;
  color: var(--gray-400);
  transition: transform var(--dur-normal) var(--ease-out);
  flex-shrink: 0;
}

.form-section.active .section-chevron {
  transform: rotate(180deg);
  color: var(--navy-600);
}

.form-section-body {
  max-height: 0;
  opacity: 0;
  padding: 0;
  transition: max-height var(--dur-slow) var(--ease-out),
              opacity var(--dur-normal) var(--ease-out),
              padding var(--dur-normal) var(--ease-out);
}

.form-section.active .form-section-body {
  max-height: 600px;
  opacity: 1;
  padding: 0 0 var(--space-6) 0;
}

/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0.01em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-primary);
  color: var(--gray-800);
  background: #fff;
  transition: all var(--dur-normal) var(--ease-out);
}

.form-group input:hover,
.form-group select:hover {
  border-color: var(--navy-300);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-group input::placeholder {
  color: var(--gray-400);
}

/* Checkbox */
.form-group input[type="checkbox"] {
  position: relative;
  width: 18px;
  height: 18px;
  margin-right: var(--space-2);
  cursor: pointer;
  accent-color: var(--navy-700);
  vertical-align: middle;
}

.form-group input[type="checkbox"] + label,
.form-group label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-actions {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--gray-100);
}

/* ── Results Panel ──────────────────────────────────────────── */
.results-panel {
  background: #fff;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-height: 85vh;
  overflow-y: auto;
  position: sticky;
  top: calc(var(--top-bar-h) + var(--space-6));
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
}

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

@media (max-width: 1024px) {
  .results-panel {
    position: static;
  }
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-5);
  border-bottom: 2px solid var(--navy-100);
}

.results-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--navy-800);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-400);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease-out);
}

.btn-close:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* ── Score Summary ──────────────────────────────────────────── */
.score-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.score-card {
  background: var(--navy-50);
  padding: var(--space-6);
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--navy-100);
  transition: all var(--dur-normal) var(--ease-out);
}

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

.score-value,
.risk-value {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--navy-700);
  margin-bottom: var(--space-2);
  letter-spacing: -0.03em;
  line-height: 1;
}

.score-label {
  font-size: 0.8125rem;
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-unit {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: var(--space-1);
}

.score-margin {
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* Risk tier colors */
.risk-profile.low .risk-value    { color: var(--success); }
.risk-profile.medium .risk-value { color: var(--warning); }
.risk-profile.high .risk-value   { color: #f97316; }
.risk-profile.critical .risk-value { color: var(--danger); }

/* ── Governance Gauge ───────────────────────────────────────── */
.gauge-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto var(--space-4);
}

.gauge-wrapper canvas {
  width: 200px;
  height: 200px;
}

.gauge-wrapper .score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0;
  letter-spacing: -0.03em;
  animation: countUp var(--dur-slow) var(--ease-out) both;
}

/* ── Risk Flags ─────────────────────────────────────────────── */
.risk-flags {
  background: var(--warning-bg);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning);
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
  animation-delay: 100ms;
}

.risk-flags.hidden { display: none; }

.risk-flags h3 {
  margin-top: 0;
  margin-bottom: var(--space-3);
  color: var(--warning-text);
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.flags-list {
  list-style: none;
  padding: 0;
}

.flags-list li {
  padding: var(--space-2) 0;
  color: var(--warning-text);
  font-size: 0.8125rem;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.flags-list li::before {
  content: "⚠";
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Eligibility Matrix ─────────────────────────────────────── */
.eligibility-matrix {
  padding: var(--space-5);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
  animation-delay: 150ms;
}

.eligibility-matrix h3 {
  margin-top: 0;
  margin-bottom: var(--space-4);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--navy-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: var(--space-3);
}

.eligibility-item {
  padding: var(--space-3) var(--space-4);
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all var(--dur-fast) var(--ease-out);
}

.eligibility-item.eligible {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.eligibility-item.ineligible {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.eligibility-item.eligible::before {
  content: "✓ ";
  font-weight: bold;
}

.eligibility-item.ineligible::before {
  content: "✗ ";
  font-weight: bold;
}

/* Score sits within the +/-3 margin of error of this stage's threshold —
   the pass/fail badge above is still shown, but this signals it could
   plausibly flip either way once the margin is accounted for. */
.eligibility-item.near-threshold {
  border-style: dashed;
  position: relative;
}

.eligibility-item.near-threshold::after {
  content: "±3";
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gray-600, #4b5563);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 999px;
}

/* ── Criteria Breakdown ─────────────────────────────────────── */
.criteria-breakdown {
  padding: var(--space-5);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
  animation-delay: 200ms;
}

.criteria-breakdown h3 {
  margin-top: 0;
  margin-bottom: var(--space-4);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--navy-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: #fff;
  border-left: 3px solid var(--navy-300);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: all var(--dur-fast) var(--ease-out);
}

.breakdown-item:hover {
  background: var(--navy-50);
  border-left-color: var(--navy-500);
}

.breakdown-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--gray-700);
}

.breakdown-score {
  display: flex;
  gap: var(--space-4);
  font-size: 0.8125rem;
}

.breakdown-score-value {
  font-weight: 700;
  color: var(--navy-700);
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── AI Explanation ─────────────────────────────────────────── */
.ai-explanation {
  position: relative;
  padding: var(--space-6);
  background: linear-gradient(135deg, rgba(59,130,246,0.04) 0%, rgba(139,92,246,0.04) 100%);
  border: 1.5px solid var(--info-border);
  border-radius: var(--radius-md);
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
  animation-delay: 250ms;
}

.ai-explanation::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-md);
  padding: 1.5px;
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(139,92,246,0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out);
}

.ai-explanation:hover::before {
  opacity: 1;
}

.ai-explanation.hidden { display: none; }

.ai-explanation h3 {
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--navy-700);
  font-size: 0.9375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.explanation-text {
  line-height: 1.8;
  color: var(--gray-700);
  font-size: 0.875rem;
}

.ai-disclaimer {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: var(--space-4);
  margin-bottom: 0;
  font-style: italic;
}

.ai-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.ai-actions .btn {
  font-size: 0.8125rem;
  padding: var(--space-2) var(--space-5);
}

.btn-edit {
  background: #fff;
  color: var(--navy-700);
  border: 1.5px solid var(--navy-200);
}

.btn-edit:hover {
  background: var(--navy-50);
  border-color: var(--navy-400);
}

.ai-edit-textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--space-4);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  display: none;
  transition: border-color var(--dur-normal) var(--ease-out);
}

.ai-edit-textarea:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ai-save-status {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-top: var(--space-3);
  animation: fadeIn var(--dur-normal) var(--ease-out);
}

.ai-save-status.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.ai-save-status.hidden { display: none; }

.ai-confirmed-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  background: var(--success-bg);
  color: var(--success-text);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Export Actions ─────────────────────────────────────────── */
.export-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-top: var(--space-5);
  border-top: 1px solid var(--gray-100);
}

.export-actions .btn {
  flex: 1;
  min-width: 140px;
  text-align: center;
  font-size: 0.8125rem;
}

@media (max-width: 640px) {
  .export-actions {
    flex-direction: column;
  }
  .export-actions .btn {
    flex: none;
    width: 100%;
  }
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary, #6b7280);
  border: 1.5px solid var(--border, #d1d5db);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.btn-outline:hover {
  background: var(--surface-2, #f3f4f6);
  color: var(--text-primary, #111827);
  border-color: var(--text-secondary, #6b7280);
}

/* ── Upload Section ─────────────────────────────────────────── */
.upload-section {
  background: #fff;
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  border: 2px dashed var(--gray-200);
  transition: border-color var(--dur-normal) var(--ease-out);
}

.upload-section:hover {
  border-color: var(--navy-300);
}

.upload-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy-700);
  margin-bottom: var(--space-2);
}

.upload-hint {
  color: var(--gray-500);
  font-size: 0.8125rem;
  margin-bottom: var(--space-5);
}

.upload-button-group {
  display: flex;
  align-items: flex-end;
}

.upload-status {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  animation: fadeIn var(--dur-normal) var(--ease-out);
}

.upload-status.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.upload-status.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.upload-status.hidden { display: none; }

.upload-tab-panel { padding-top: 4px; }

/* ── Multi-Document Grid ─────────────────────────────────────── */
.multi-doc-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.doc-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s, background 0.2s;
}
.doc-slot:hover { border-color: var(--primary-light, #4f8ef7); background: var(--surface-hover, rgba(255,255,255,0.05)); }
.doc-slot.success { border-color: #22c55e; background: rgba(34,197,94,0.05); }
.doc-slot.error { border-color: #ef4444; background: rgba(239,68,68,0.05); }
.doc-slot.loading { border-color: var(--primary); opacity: 0.8; }
.doc-slot.drag-over { border-color: var(--primary); background: rgba(79,142,247,0.08); box-shadow: 0 0 0 3px rgba(79,142,247,0.2); transform: scale(1.01); transition: all 0.15s ease; cursor: copy; }

.doc-slot-icon { font-size: 1.4rem; flex-shrink: 0; width: 32px; text-align: center; }
.doc-slot-info { flex: 1; min-width: 0; }
.doc-slot-label { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.doc-slot-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.doc-slot-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.doc-file-input { display: none; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.doc-slot-status {
  font-size: 0.78rem;
  font-weight: 500;
  min-width: 80px;
  text-align: right;
  color: var(--text-muted);
}
.doc-slot-status.ok   { color: #22c55e; }
.doc-slot-status.fail { color: #ef4444; }
.doc-slot-status.wait { color: var(--primary); }

/* Clear button — shown only when a slot has files */
.doc-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
  line-height: 1;
  padding: 0;
}
.doc-clear-btn:hover {
  background: #fca5a5;
  transform: scale(1.12);
}

/* Slot highlight when it has accumulated files */
.doc-slot.has-files {
  border-color: var(--primary, #2563eb);
  background: rgba(37,99,235,.04);
}

.multi-doc-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ── G25 Results Panel ───────────────────────────────────────── */
.g25-panel {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--surface-2, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 12px;
}
.g25-panel-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px; }
.g25-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.g25-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
}
.g25-badge.none    { background: rgba(107,114,128,0.15); color: #9ca3af; }
.g25-badge.silver  { background: rgba(148,163,184,0.15); color: #94a3b8; }
.g25-badge.gold    { background: rgba(234,179,8,0.15);   color: #eab308; }
.g25-badge.diamond { background: rgba(56,189,248,0.15);  color: #38bdf8; }
.g25-badge.grade   { background: rgba(99,102,241,0.15);  color: #818cf8; }

.g25-category-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.g25-category-bar-label { font-size: 0.75rem; color: var(--text-muted); width: 160px; flex-shrink: 0; }
.g25-category-bar-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.g25-category-bar-fill { height: 100%; border-radius: 3px; background: var(--primary); transition: width 0.6s; }
.g25-category-bar-value { font-size: 0.72rem; color: var(--text-muted); width: 60px; text-align: right; flex-shrink: 0; }

/* Company ID auto-fill hint */
.company-id-hint {
  display: block;
  font-size: 0.75rem;
  margin-top: 4px;
  font-weight: 500;
  min-height: 1rem;
}
.company-id-hint.hint-new { color: #0d9488; }       /* teal — new ID generated */
.company-id-hint.hint-existing { color: #6366f1; }  /* indigo — existing company */

/* ── Board Submissions ──────────────────────────────────────── */
.status-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.submitted    { background: var(--info-bg);    color: var(--info-text); }
.status-badge.under_review { background: var(--warning-bg); color: var(--warning-text); }
.status-badge.approved     { background: var(--success-bg); color: var(--success-text); }
.status-badge.rejected     { background: var(--danger-bg);  color: var(--danger-text); }

.submission-action-btn {
  padding: var(--space-1) var(--space-3);
  margin-right: var(--space-1);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  background: #fff;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-primary);
  transition: all var(--dur-fast) var(--ease-out);
}

.submission-action-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

/* ── Loading Spinner ────────────────────────────────────────── */
.loading-spinner {
  display: none;
  text-align: center;
  padding: var(--space-12);
}

.loading-spinner.hidden { display: none !important; }

.spinner {
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--navy-600);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--space-4);
}

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner p {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* ── Error Message ──────────────────────────────────────────── */
.error-message {
  padding: var(--space-4);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  color: var(--danger-text);
  font-size: 0.875rem;
  margin-bottom: var(--space-5);
  animation: fadeIn var(--dur-normal) var(--ease-out);
}

.error-message.hidden { display: none; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--navy-900);
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  padding: var(--space-6);
  margin-top: var(--space-12);
  font-size: 0.8125rem;
}

.footer p { margin: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-title h1 {
    font-size: 1.375rem;
  }

  .form {
    padding: var(--space-5);
  }

  .results-panel {
    padding: var(--space-5);
  }

  .score-summary {
    grid-template-columns: 1fr;
  }

  .gauge-wrapper {
    width: 160px;
    height: 160px;
  }

  .gauge-wrapper canvas {
    width: 160px;
    height: 160px;
  }
}

/* ═══════════════════════════════════════════════════════════
   DOCUMENT ANALYSIS RESULT CARD
   ═══════════════════════════════════════════════════════════ */

.btn-analyze {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, var(--navy-arc) 100%);
  color: var(--gold-arc);
  border: 1px solid #e2c97e40;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(226,201,126,0.12);
}
.btn-analyze:hover { background: linear-gradient(135deg, var(--navy-arc), #533483); color: #fff; transform: translateY(-1px); }
.btn-analyze:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.doc-analysis-status {
  padding: 0.65rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin: 0.5rem 0;
  display: none;
}
.doc-analysis-status:not(.hidden) { display: block; }
.doc-analysis-status.info    { background: #e8f4fd; color: #1565c0; border: 1px solid #90caf9; }
.doc-analysis-status.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.doc-analysis-status.error   { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.doc-analysis-status.warn    { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }

.analysis-result-section { padding: 0 2rem 2rem; max-width: 1100px; margin: 0 auto; }
.analysis-result-section.hidden { display: none; }

.analysis-result-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 40px rgba(0,0,0,0.10);
  overflow: hidden;
  border: 1px solid #e8eaf0;
  animation: arcFadeIn 0.5s ease;
}
@keyframes arcFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.arc-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, var(--navy-arc) 100%);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  break-inside: avoid; page-break-inside: avoid;
}
.arc-name  { color: var(--gold-arc); font-size: 1.5rem; font-weight: 700; margin: 0 0 0.2rem; }
.arc-meta  { color: #9eb3d8; font-size: 0.85rem; text-transform: capitalize; }

.arc-badges { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.arc-score-ring {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.arc-score-inner {
  width: 56px; height: 56px; border-radius: 50%; background: #1a1a2e;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.arc-score-val { color: var(--gold-arc); font-size: 1.1rem; font-weight: 800; line-height: 1; }
.arc-score-lbl { color: #9eb3d8; font-size: 0.6rem; line-height: 1; }
.arc-score-confidence {
  color: #9eb3d8; font-size: 0.5rem; line-height: 1; margin-top: 1px;
  cursor: help; opacity: 0.85;
}

.arc-badge {
  padding: 0.35rem 0.8rem; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600;
}
.arc-grade { background: #1e3a5f30; color: #7ec8e3; border: 1px solid #7ec8e340; }
.arc-gov   { background: #2d1b6930; color: #b89bff; border: 1px solid #b89bff40; }

.arc-body {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 350px;
}
.arc-left  { padding: 1.5rem 1.5rem 1.5rem 2rem; border-right: 1px solid #f0f0f0; }
.arc-right { padding: 1.5rem 2rem; }

.arc-section-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #6c757d; margin-bottom: 0.6rem;
}

.arc-metrics-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.arc-metrics-table td { padding: 0.25rem 0; border-bottom: 1px solid #f5f5f5; }
.arc-metrics-table td:first-child { color: #6c757d; }
.arc-metrics-table td:last-child  { text-align: right; color: #1a1a2e; }

.arc-list { margin: 0 0 0 1rem; padding: 0; font-size: 0.83rem; }
.arc-list li { margin-bottom: 0.3rem; color: #444; }
.arc-strengths li { color: #2e7d32; }
.arc-strengths li::marker { content: '✓ '; }
.arc-risks li { color: #c62828; }
.arc-risks li::marker { content: '⚠ '; }
.arc-recs li::marker { content: '→ '; color: #1565c0; }

.arc-report {
  font-size: 0.875rem; line-height: 1.75; color: #333;
  background: #fafafa; border-radius: 8px; padding: 1rem 1.25rem;
  border: 1px solid #eee; min-height: 180px;
}

/* Markdown styles inside the report and AI explanation */
.arc-report .md-p,
.arc-report p,
#aiExplanationText .md-p,
#aiExplanationText p { margin: 0 0 0.75em 0; }

.arc-report .md-h2,
#aiExplanationText .md-h2 {
  font-size: 1rem; font-weight: 700; color: #1a2e4a;
  margin: 1.3em 0 0.4em 0; letter-spacing: 0.01em;
}
.arc-report .md-h3,
#aiExplanationText .md-h3 {
  font-size: 0.9rem; font-weight: 700; color: #1a2e4a;
  margin: 1.1em 0 0.3em 0; letter-spacing: 0.01em;
}
.arc-report .md-h4,
#aiExplanationText .md-h4 {
  font-size: 0.85rem; font-weight: 700; color: #2d4a6e;
  margin: 0.9em 0 0.2em 0;
}
.arc-report .md-ul,
#aiExplanationText .md-ul {
  margin: 0.4em 0 0.75em 0; padding-left: 1.4em;
}
.arc-report .md-ul li,
#aiExplanationText .md-ul li {
  margin-bottom: 0.2em;
}
.arc-report .md-hr,
#aiExplanationText .md-hr {
  border: none; border-top: 1px solid #e2e8f0;
  margin: 0.75em 0;
}
.arc-report strong,
#aiExplanationText strong { color: #1a2e4a; }
#aiExplanationText em { color: #374151; font-style: italic; }

/* Same treatment for the PDF report-box */
.report-box .md-p, .report-box p { margin: 0 0 0.6em 0; }
.report-box .md-h3 { font-size: 0.85rem; font-weight: 700; margin: 0.9em 0 0.3em 0; }
.report-box .md-ul { margin: 0.3em 0 0.6em 0; padding-left: 1.4em; }


.arc-warnings {
  margin-top: 0.75rem; font-size: 0.75rem; color: #8a6d00;
  background: #fff8e1; border-radius: 6px; padding: 0.5rem 0.75rem;
}
.arc-warnings-title { font-weight: 600; margin-bottom: 0.35rem; }
.arc-warnings-list {
  margin: 0; padding-left: 1.1rem;
}
.arc-warnings-list li { margin-bottom: 0.3rem; }
.arc-warnings-list li:last-child { margin-bottom: 0; }

.arc-footer {
  background: #f8f9fa; border-top: 1px solid #eee;
  padding: 1.25rem 2rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.arc-footer-secondary {
  display: flex; gap: 0.75rem; justify-content: flex-end;
}
.arc-board-btn {
  background: var(--navy-arc); color: var(--gold-arc); border: none;
  padding: 0.6rem 1.4rem; border-radius: 8px; font-weight: 600;
  cursor: pointer; font-size: 0.875rem; transition: background 0.2s;
}
.arc-board-btn:hover { background: #1565c0; color: #fff; }
.arc-dl-btn {
  background: #1b6f3a; color: #fff; border: none;
  padding: 0.6rem 1.4rem; border-radius: 8px; font-weight: 600;
  cursor: pointer; font-size: 0.875rem; transition: background 0.2s;
}
.arc-dl-btn:hover { background: #145a2e; }
.arc-reset-btn {
  background: transparent; color: #6c757d; border: 1px solid #dee2e6;
  padding: 0.6rem 1.2rem; border-radius: 8px; cursor: pointer; font-size: 0.875rem;
}
.arc-reset-btn:hover { background: #f8d7da; color: #c62828; border-color: #c62828; }

/* Simulation status line shown while auto-running Step 2 */
.arc-sim-status {
  font-size: 0.85rem; color: #555; min-height: 1.2em;
  display: flex; align-items: center; gap: 0.4rem;
}
.arc-sim-status.success { color: #1b6f3a; font-weight: 600; }
.arc-sim-status.warn    { color: #b45309; }
.arc-dl-btn:disabled {
  background: #9ca3af; cursor: not-allowed; opacity: 0.7;
}


@media (max-width: 700px) {
  .arc-body { grid-template-columns: 1fr; }
  .arc-left  { border-right: none; border-bottom: 1px solid #f0f0f0; }
  .arc-header { flex-direction: column; }
}

.field-required-hint {
  font-size: 0.8em;
  color: #8a6d1a;
  font-style: italic;
}
