/* =========================
   AgentoFlow /app UI - PROD
   ========================= */

/* Reset */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #020817 0, #000 55%);
  color: #e5e7eb;
  line-height: 1.5;
}

.af-app {
  background: radial-gradient(circle at top left, #111827 0, #020817 40%, #020817 100%);
  color: #e5e7eb;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", -sans-serif;
}

/* Page wrapper */

.page {
  min-height: 100vh;
  padding: 24px 16px 40px;
  max-width: 1320px;          /* CENTRARE + lățime limitată */
  margin: 0 auto;
}

/* Topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.logo-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(to bottom right, #38bdf8, #4ade80);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.9);
}

.brand-name {
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.04em;
}

.brand-tag {
  font-size: 12px;
  color: #9ca3af;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge.demo {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* HEADER / TOPBAR doar în app */

.af-app .topbar {
  max-width: 1240px;
  margin: 24px auto 16px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(56,189,248,0.14), transparent),
              rgba(9,9,11,0.92);
  border: 1px solid rgba(75,85,99,0.8);
  box-shadow: 0 18px 60px rgba(15,23,42,0.9);
  backdrop-filter: blur(18px);
}

.af-app .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.af-app .logo-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #38bdf8, #4f46e5);
  box-shadow: 0 0 18px rgba(56,189,248,0.9);
}

/* nav */

.af-app .nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: #9ca3af;
}

.af-app .nav-links a {
  color: #9ca3af;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.18s, border-color 0.18s;
}

.af-app .nav-links a:hover {
  color: #e5e7eb;
  border-color: rgba(56,189,248,0.6);
}

.af-app .nav-muted {
  opacity: 0.6;
  cursor: default;
}

.af-app .divider {
  width: 1px;
  height: 16px;
  background: rgba(75,85,99,0.9);
}

.af-app .theme-toggle {
  margin-left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(75,85,99,0.9);
  background: transparent;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.af-app .theme-toggle:hover {
  background: rgba(15,23,42,0.96);
  box-shadow: 0 0 14px rgba(56,189,248,0.5);
}

/* variantă light simplă */

.af-app.light {
  background: #f3f4f6;
  color: #111827;
}

.af-app.light .topbar {
  background: rgba(255,255,255,0.96);
  border-color: rgba(209,213,219,1);
  box-shadow: 0 18px 40px rgba(148,163,253,0.15);
}

.af-app.light .panel,
.af-app.light .report,
.af-app.light .card-soft {
  background: white;
  border-color: rgba(229,231,235,1);
  box-shadow: 0 18px 40px rgba(148,163,253,0.08);
}

.af-app.light .nav-links a {
  color: #6b7280;
}

.af-app.light .nav-links a:hover {
  color: #111827;
}

/* Layout: 2 panouri */

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: flex-start;
}

/* Panouri */

.panel {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.04), transparent),
    rgba(7, 11, 22, 0.98);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 253, 0.09);
  padding: 18px 18px 16px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.66);
}

.panel-form {
  backdrop-filter: blur(12px);
}

.panel-report {
  padding: 18px;
}

/* Form */

.panel-title {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 4px;
}

.field-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(75, 85, 99, 0.9);
  background: rgba(4, 7, 16, 0.98);
  color: #e5e7eb;
  font-size: 13px;
  outline: none;
  transition: border 0.18s, box-shadow 0.18s, background 0.18s, transform 0.1s;
}

.field-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
  background: #020817;
  transform: translateY(-1px);
}

.field-textarea {
  resize: vertical;
  min-height: 90px;
  margin-bottom: 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 10px;
}

/* Button */

.btn-primary {
  width: 100%;
  padding: 9px 14px;
  margin-top: 4px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(to right, #38bdf8, #4ade80);
  color: #020817;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.32);
  transition: all 0.18s ease-out;
}

.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.72);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
  box-shadow: none;
}

/* Text ajutor */

.hint {
  margin-top: 8px;
  font-size: 10px;
  color: #6b7280;
}

code {
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(10, 16, 30, 0.98);
  border: 1px solid rgba(75, 85, 99, 0.85);
}

/* Alerts */

.alert {
  margin-top: 6px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 11px;
}

.alert-error {
  background: rgba(248, 113, 113, 0.06);
  border: 1px solid rgba(248, 113, 113, 0.32);
  color: #fecaca;
}

.hidden {
  display: none !important;
}

/* Report header */

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.report-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #6b7280;
}

.report-title {
  font-size: 18px;
  font-weight: 600;
}

.report-period {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
}

.report-eligibility {
  text-align: right;
}

.eligibility-label {
  font-size: 9px;
  color: #9ca3af;
  margin-bottom: 2px;
}

.eligibility-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #020817;
  border: 1px solid rgba(56, 189, 248, 0.38);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
}

.eligibility-pill.good {
  border-color: #22c55e;
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.24);
}

.eligibility-pill.bad {
  border-color: #f97316;
  box-shadow: 0 10px 24px rgba(248, 115, 22, 0.24);
}

.eligibility-score {
  font-size: 16px;
  font-weight: 700;
  color: #38bdf8;
}

/* KPI cards */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  padding: 8px 9px;
  border-radius: 12px;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.06), transparent),
    rgba(5, 7, 16, 0.98);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.kpi-label {
  font-size: 9px;
  color: #9ca3af;
  margin-bottom: 1px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-size: 15px;
  font-weight: 600;
}

.kpi-note {
  font-size: 9px;
  color: #6b7280;
}

/* 2 coloane: grafic + concluzii */

.layout-2col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

.card-soft {
  padding: 10px;
  border-radius: 12px;
  background: rgba(4, 6, 15, 0.98);
  border: 1px solid rgba(55, 65, 81, 0.75);
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Chart */

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 90px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 8px;
  color: #9ca3af;
}

.chart-bar-fill {
  width: 100%;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(to top, #38bdf8, #4ade80);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.4);
}

.chart-bar-label {
  margin-top: 2px;
}

.chart-bar-value {
  font-size: 8px;
  color: #6b7280;
}

/* Highlights */

.highlights {
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 10px;
  color: #9ca3af;
}

.highlights li::before {
  content: "• ";
  color: #38bdf8;
}

/* Raw JSON toggle */

.raw-toggle {
  margin-top: 10px;
  font-size: 9px;
  color: #6b7280;
}

.raw-toggle summary {
  cursor: pointer;
  list-style: none;
}

.raw-toggle summary::marker,
.raw-toggle summary::-webkit-details-marker {
  display: none;
}

.raw-toggle summary::before {
  content: "▸ ";
  display: inline-block;
  transform-origin: center;
  transition: transform 0.16s;
}

.raw-toggle[open] summary::before {
  transform: rotate(90deg);
}

.raw-toggle pre {
  margin-top: 6px;
  padding: 8px;
  border-radius: 8px;
  background: #020817;
  border: 1px solid rgba(75, 85, 99, 0.9);
  max-height: 200px;
  overflow: auto;
}

/* Empty-state */

.report-empty {
  padding: 14px;
  font-size: 13px;
  color: #9ca3af;
}

.report-empty h2 {
  font-size: 16px;
  color: #e5e7eb;
  margin-bottom: 6px;
}

.report-empty ul {
  list-style: disc;
  margin-left: 18px;
  margin-top: 4px;
  display: grid;
  gap: 2px;
}

/* Responsive */

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .panel {
    margin-bottom: 10px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .layout-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 16px 10px 24px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ========== Dropzone (UI only) ========== */

.dropzone {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 253, 0.45);
  background: radial-gradient(circle at top left,
              rgba(56, 189, 248, 0.08), transparent),
              rgba(6, 8, 18, 0.98);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.dropzone:hover {
  border-color: #38bdf8;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.dropzone.is-dragover {
  border-color: #4ade80;
  box-shadow: 0 14px 32px rgba(22, 163, 74, 0.32);
  background: rgba(4, 7, 16, 1);
}

.dropzone-icon {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: rgba(17, 24, 39, 1);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.9);
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #9ca3af;
}

.dropzone-text strong {
  font-size: 12px;
  color: #e5e7eb;
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone-list {
  margin-top: 6px;
  list-style: none;
  display: grid;
  gap: 2px;
  font-size: 9px;
  color: #9ca3af;
}

.dropzone-list li {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(7, 11, 22, 0.98);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.dropzone-list span.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-list span.meta {
  opacity: 0.7;
}
