* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: #0f172a;
  color: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  direction: rtl;
}

.app-container {
  width: 100%;
  max-width: 760px;
  height: 95vh;
  background-color: #1e293b;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border: 1px solid #334155;
}

.app-header {
  padding: 16px 20px;
  background-color: #111827;
  border-bottom: 1px solid #334155;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.privacy-link-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 0.7rem;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.privacy-link-btn:hover {
  color: #f87171;
  border-color: #dc2626;
}

.app-header h1 {
  font-size: 1.3rem;
  color: #38bdf8;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
}

.category-selector-container {
  padding: 10px 16px;
  background-color: #1a2234;
  border-bottom: 1px solid #334155;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selector-title {
  font-size: 0.75rem;
  color: #cbd5e1;
}

.category-chips {
  display: flex;
  gap: 8px;
}

.category-btn {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  font-weight: bold;
}

.chat-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  width: 100%;
}

.message.user { justify-content: flex-start; }
.message.assistant { justify-content: flex-end; }

.bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.message.user .bubble {
  background-color: #0284c7;
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.message.assistant .bubble {
  background-color: #334155;
  color: #f1f5f9;
  border-bottom-left-radius: 2px;
}

.loading-bar {
  padding: 10px;
  background-color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #38bdf8;
  border-top: 1px solid #334155;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #38bdf8;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.input-container {
  padding: 14px 16px;
  background-color: #111827;
  border-top: 1px solid #334155;
}

#chatForm {
  display: flex;
  gap: 10px;
}

#userInput {
  flex: 1;
  background-color: #1e293b;
  border: 1px solid #475569;
  border-radius: 10px;
  padding: 12px 14px;
  color: #f8fafc;
  outline: none;
  font-size: 0.95rem;
}

#userInput:focus { border-color: #38bdf8; }

#sendBtn {
  background-color: #0284c7;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
}

#sendBtn:hover { background-color: #0369a1; }

.report-wrapper { max-width: 100% !important; }

.report-card {
  width: 100%;
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.report-header h2 { font-size: 1.1rem; color: #38bdf8; }

.category-badge {
  background: #0284c7;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
}

.classification-line {
  font-size: 0.82rem;
  color: #93c5fd;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #334155;
}

.report-section {
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.report-section h4 {
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: #f8fafc;
}

.report-section ul {
  padding-right: 20px;
  color: #cbd5e1;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.card-box {
  background: #0f172a;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #334155;
}

.summary-box {
  background: #0b1329;
  border: 1px solid #1e3a8a;
  padding: 12px;
  border-radius: 10px;
}

.pros-box { border-right: 3px solid #22c55e; }
.uncertainties-box { border-right: 3px solid #f59e0b; }
.red-flags-box { border-right: 3px solid #ef4444; }
.experiment-box { border-right: 3px solid #38bdf8; }

.golden-question-box {
  background: #2e1065;
  border: 1px solid #7c3aed;
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
}

.golden-question-box h4 { color: #c084fc; }

.golden-text {
  font-weight: bold;
  font-size: 0.95rem;
  color: #faf5ff;
  margin-top: 4px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.modal-header h3 {
  color: #38bdf8;
  margin-bottom: 12px;
  font-size: 1.15rem;
}

.modal-body {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.guide-steps {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num {
  background: #0284c7;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.privacy-note {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 12px;
}

.modal-btn {
  width: 100%;
  background: #0284c7;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: bold;
}

.modal-btn:hover { background: #0369a1; }

.plan-badge {
  background: #0f172a;
  border: 1px solid #38bdf8;
  padding: 14px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}

.plan-price {
  color: #38bdf8;
  font-weight: bold;
}

/* --- افزوده‌های موتور ریسک/راستی‌آزمایی/اطمینان --- */

.header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence-badge {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: bold;
  border: 1px solid transparent;
}

.confidence-badge.conf-high { background: rgba(34,197,94,0.15); color: #4ade80; border-color: #16a34a; }
.confidence-badge.conf-mid  { background: rgba(245,158,11,0.15); color: #fbbf24; border-color: #d97706; }
.confidence-badge.conf-low  { background: rgba(239,68,68,0.15); color: #f87171; border-color: #dc2626; }

.empty-note {
  color: #94a3b8;
  font-size: 0.85rem;
}

.risk-item {
  padding: 8px 0;
  border-bottom: 1px solid #1e293b;
}

.risk-item:last-child { border-bottom: none; }

.risk-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.risk-code {
  background: #334155;
  color: #e2e8f0;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: bold;
}

.risk-label {
  font-size: 0.88rem;
  color: #f1f5f9;
  flex: 1;
}

.risk-tier {
  font-size: 0.72rem;
  color: #fca5a5;
}

.risk-bar-track {
  background: #0f172a;
  border-radius: 6px;
  height: 6px;
  overflow: hidden;
}

.risk-bar-fill { height: 100%; border-radius: 6px; }
.risk-bar-fill.sev-1 { background: #64748b; }
.risk-bar-fill.sev-2 { background: #eab308; }
.risk-bar-fill.sev-3 { background: #f59e0b; }
.risk-bar-fill.sev-4 { background: #f97316; }
.risk-bar-fill.sev-5 { background: #ef4444; }

.risk-note {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 4px;
}

.verification-box { border-right: 3px solid #a855f7; }

.verification-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 0.85rem;
}

.verification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.verification-item.status-pending .verification-dot { background: #f59e0b; }
.verification-item.status-satisfied .verification-dot { background: #22c55e; }

.verification-label { color: #e2e8f0; flex: 1; }

.verification-status {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* --- Readiness Engine --- */

.readiness-box { border-right: 3px solid #38bdf8; }

.readiness-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.readiness-status-badge {
  font-size: 0.82rem;
  font-weight: bold;
  padding: 5px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.readiness-status-badge.ready-ok    { background: rgba(34,197,94,0.15); color: #4ade80; border-color: #16a34a; }
.readiness-status-badge.ready-attn  { background: rgba(56,189,248,0.15); color: #38bdf8; border-color: #0284c7; }
.readiness-status-badge.ready-review{ background: rgba(245,158,11,0.15); color: #fbbf24; border-color: #d97706; }
.readiness-status-badge.ready-block { background: rgba(239,68,68,0.15); color: #f87171; border-color: #dc2626; }

.readiness-score {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: normal;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 2px 8px;
}

.readiness-override-note {
  font-size: 0.78rem;
  color: #fbbf24;
  margin-bottom: 8px;
}

.gates-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gate-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #e2e8f0;
}

.gate-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

/* --- Stress Test Engine --- */

.stress-box { border-right: 3px solid #f472b6; }

.stress-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.stress-item {
  background: #1e293b;
  border-radius: 8px;
  padding: 8px 10px;
}

.stress-title {
  font-size: 0.78rem;
  color: #f472b6;
  font-weight: bold;
}

.stress-question {
  font-size: 0.85rem;
  color: #e2e8f0;
  margin-top: 4px;
}

.robustness-note {
  font-size: 0.8rem;
  color: #94a3b8;
  border-top: 1px dashed #334155;
  padding-top: 8px;
}

.stress-response-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.stress-response-input {
  flex: 1;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 8px 10px;
  color: #f8fafc;
  font-size: 0.82rem;
  outline: none;
}

.stress-response-input:focus { border-color: #f472b6; }

.stress-submit-btn {
  background: #db2777;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}

.stress-submit-btn:hover { background: #be185d; }
.stress-submit-btn:disabled { opacity: 0.6; cursor: default; }

.stress-result {
  font-size: 0.8rem;
  margin-top: 6px;
  font-weight: bold;
}

.stress-result.impact-vulnerable { color: #f87171; }
.stress-result.impact-resilient { color: #4ade80; }
.stress-result.impact-unclear { color: #94a3b8; }
