/* ========================================
   NOD AI — Pipeline Dashboard
   Brand: #0693e3 blue, light theme
   ======================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', 'Helvetica Neue', -apple-system, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #0a0a0a;
  background: #f5f5f5;
}

a { color: #0693e3; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── HEADER ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.logo {
  font-size: 24px;
  font-weight: 800;
  color: #000;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-decoration: none;
}

.logo .ai { color: #0693e3; }
.logo .dash-label {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 1px;
  color: rgba(0,0,0,0.35);
  text-transform: none;
  margin-left: 8px;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  color: rgba(0,0,0,0.5);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.nav-link:hover {
  color: #0693e3;
  border-color: rgba(6,147,227,0.2);
  text-decoration: none;
}

.header-meta {
  font-size: 12px;
  color: rgba(0,0,0,0.4);
}

/* ── MAIN ── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── FOOTER ── */
.footer {
  max-width: 1200px;
  margin: 40px auto 0;
  padding: 20px 24px;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(0,0,0,0.3);
}

/* ── CARD ── */
.card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 18px;
  font-weight: 700;
  color: #000;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  color: #000;
  margin-bottom: 12px;
}

/* ── STATUS BADGES ── */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border: 1px solid;
}

.badge-completed { color: #27ae60; border-color: rgba(39,174,96,0.35); background: rgba(39,174,96,0.06); }
.badge-running   { color: #0693e3; border-color: rgba(6,147,227,0.35); background: rgba(6,147,227,0.06); }
.badge-failed    { color: #e74c3c; border-color: rgba(231,76,60,0.35); background: rgba(231,76,60,0.06); }
.badge-pending   { color: #95a5a6; border-color: rgba(149,165,166,0.35); background: rgba(149,165,166,0.06); }
.badge-cancelled { color: #e67e22; border-color: rgba(230,126,34,0.35); background: rgba(230,126,34,0.06); }

/* Lead statuses */
.badge-new           { color: #0693e3; border-color: rgba(6,147,227,0.35); background: rgba(6,147,227,0.06); }
.badge-audit_running { color: #e67e22; border-color: rgba(230,126,34,0.35); background: rgba(230,126,34,0.06); }
.badge-audit_done    { color: #27ae60; border-color: rgba(39,174,96,0.35); background: rgba(39,174,96,0.06); }
.badge-proposal_sent { color: #9b59b6; border-color: rgba(155,89,182,0.35); background: rgba(155,89,182,0.06); }
.badge-negotiation   { color: #e67e22; border-color: rgba(230,126,34,0.35); background: rgba(230,126,34,0.06); }
.badge-won           { color: #27ae60; border-color: rgba(39,174,96,0.35); background: rgba(39,174,96,0.06); }
.badge-lost          { color: #e74c3c; border-color: rgba(231,76,60,0.35); background: rgba(231,76,60,0.06); }
.badge-qualified     { color: #0693e3; border-color: rgba(6,147,227,0.35); background: rgba(6,147,227,0.06); }
.badge-archived      { color: #95a5a6; border-color: rgba(149,165,166,0.35); background: rgba(149,165,166,0.06); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(0,0,0,0.35);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  vertical-align: top;
  font-size: 13px;
}

tr:hover td { background: rgba(6,147,227,0.02); }

/* ── FILTERS ── */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  color: rgba(0,0,0,0.6);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: #0693e3; color: #0693e3; text-decoration: none; }
.filter-btn.active { background: #0693e3; color: #fff; border-color: #0693e3; }

/* ── RUN DETAIL ── */
.run-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.run-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #000;
}

.run-meta {
  display: flex;
  gap: 24px;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(0,0,0,0.45);
}

.run-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.back-link {
  font-size: 13px;
  color: rgba(0,0,0,0.4);
}

/* ── PHASE SECTION ── */
.phase-section {
  margin-bottom: 32px;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.phase-number {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: #0693e3;
  letter-spacing: 2px;
  font-weight: 700;
}

.phase-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #000;
  margin: 0;
}

/* ── AGENT CARD ── */
.agent-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 16px;
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.agent-card-header:hover { background: rgba(6,147,227,0.02); }

.agent-card-header .agent-name {
  font-size: 14px;
  font-weight: 600;
  color: #000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-card-header .agent-icon {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: #0693e3;
  letter-spacing: 1px;
}

.agent-card-header .agent-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: rgba(0,0,0,0.4);
}

.agent-card-header .chevron {
  transition: transform 0.2s;
  color: rgba(0,0,0,0.25);
  font-size: 18px;
}

.agent-card.open .chevron { transform: rotate(180deg); }

.agent-card-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.agent-card.open .agent-card-body { display: block; }

.agent-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding-top: 12px;
}

.btn-sm {
  font-size: 11px;
  padding: 4px 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  color: rgba(0,0,0,0.6);
  cursor: pointer;
  text-decoration: none;
}

.btn-sm:hover { border-color: #0693e3; color: #0693e3; text-decoration: none; }

/* ── RENDERER STYLES ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.data-table th {
  font-size: 10px;
  padding: 10px 12px;
}

.data-table td {
  padding: 10px 12px;
  font-size: 13px;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 12px 0;
}

.data-card {
  padding: 16px 20px;
  border-left: 3px solid #0693e3;
  background: rgba(6,147,227,0.03);
}

.data-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: #000;
  margin-bottom: 6px;
}

.data-card p, .data-card li {
  font-size: 12px;
  color: rgba(0,0,0,0.6);
  line-height: 1.7;
}

.data-card ul {
  list-style: none;
  padding: 0;
}

.data-card ul li { padding-left: 14px; position: relative; }
.data-card ul li::before {
  content: "\2014";
  position: absolute;
  left: 0;
  color: rgba(0,0,0,0.2);
}

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border: 1px solid;
  margin: 2px 4px 2px 0;
}

.tag-blue   { color: #0693e3; border-color: rgba(6,147,227,0.3); }
.tag-green  { color: #27ae60; border-color: rgba(39,174,96,0.3); }
.tag-orange { color: #e67e22; border-color: rgba(230,126,34,0.3); }
.tag-red    { color: #e74c3c; border-color: rgba(231,76,60,0.3); }
.tag-purple { color: #9b51e0; border-color: rgba(155,81,224,0.3); }
.tag-gray   { color: #95a5a6; border-color: rgba(149,165,166,0.3); }

/* SWOT grid */
.swot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.swot-cell {
  padding: 14px 16px;
  border: 1px solid rgba(0,0,0,0.06);
}

.swot-cell h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.swot-cell.strengths h4    { color: #27ae60; }
.swot-cell.weaknesses h4   { color: #e74c3c; }
.swot-cell.opportunities h4 { color: #0693e3; }
.swot-cell.threats h4       { color: #e67e22; }

.swot-cell ul {
  list-style: disc;
  padding-left: 18px;
  font-size: 12px;
  color: rgba(0,0,0,0.6);
}

.swot-cell li { margin-bottom: 4px; }

/* Subsection */
.subsection {
  margin: 20px 0 12px;
}

.subsection-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(0,0,0,0.35);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* Funnel */
.funnel-stages {
  display: flex;
  gap: 12px;
  margin: 12px 0;
  overflow-x: auto;
}

.funnel-stage {
  flex: 1;
  min-width: 160px;
  padding: 14px 16px;
  border: 1px solid rgba(0,0,0,0.06);
  text-align: center;
}

.funnel-stage h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #0693e3;
  margin-bottom: 8px;
}

.funnel-stage p {
  font-size: 12px;
  color: rgba(0,0,0,0.5);
}

/* Checklist */
.checklist { list-style: none; padding: 0; }
.checklist li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.checklist .check-icon { flex-shrink: 0; font-size: 14px; }
.check-critical { color: #e74c3c; }
.check-high { color: #e67e22; }
.check-medium { color: #0693e3; }

/* FAQ accordion */
.faq-item { border-bottom: 1px solid rgba(0,0,0,0.06); }
.faq-question {
  padding: 12px 0;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  padding: 0 0 12px;
  font-size: 13px;
  color: rgba(0,0,0,0.6);
  line-height: 1.7;
  display: none;
}

.faq-item.open .faq-answer { display: block; }

/* JSON fallback */
.json-block {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 20px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.json-block .json-key { color: #82aaff; }
.json-block .json-string { color: #c3e88d; }
.json-block .json-number { color: #f78c6c; }
.json-block .json-bool { color: #c792ea; }
.json-block .json-null { color: #ff5370; }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.kpi-card {
  background: #fafafa;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 16px;
  text-align: center;
}

.kpi-card .kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: #000;
  font-family: 'Courier New', monospace;
}

.kpi-card .kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(0,0,0,0.35);
  margin-top: 4px;
}

/* CJM flow */
.cjm-flow {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
}

.cjm-step {
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.06);
  position: relative;
}

.cjm-step h5 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #0693e3;
  margin-bottom: 6px;
}

.cjm-step p { font-size: 11px; color: rgba(0,0,0,0.5); margin-bottom: 4px; }

.emotion-positive { color: #27ae60; }
.emotion-neutral  { color: #e67e22; }
.emotion-negative { color: #e74c3c; }

/* Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 12px 0;
}

.calendar-cell {
  padding: 8px;
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 11px;
  min-height: 60px;
}

.calendar-cell .cal-day {
  font-weight: 700;
  font-size: 12px;
  color: #000;
  margin-bottom: 4px;
}

.calendar-cell .cal-topic {
  font-size: 10px;
  color: rgba(0,0,0,0.5);
}

/* Wireframe blocks */
.wireframe-blocks {
  border: 1px solid rgba(0,0,0,0.08);
  margin: 12px 0;
}

.wireframe-block {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.wireframe-block:last-child { border-bottom: none; }

.wireframe-block .block-order {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #0693e3;
  font-weight: 700;
  min-width: 28px;
}

.wireframe-block .block-type {
  font-weight: 600;
  color: #000;
  min-width: 100px;
}

.wireframe-block .block-desc {
  color: rgba(0,0,0,0.5);
  flex: 1;
}

/* Color palette preview */
.color-palette {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0,0,0,0.1);
  position: relative;
}

.color-swatch .swatch-label {
  position: absolute;
  bottom: -18px;
  left: 0;
  font-size: 9px;
  color: rgba(0,0,0,0.4);
  white-space: nowrap;
}

/* Error state */
.error-banner {
  background: rgba(231,76,60,0.08);
  border: 1px solid rgba(231,76,60,0.2);
  color: #e74c3c;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: rgba(0,0,0,0.35);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: rgba(0,0,0,0.25);
  margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .main { padding: 16px 12px; }
  .swot-grid { grid-template-columns: 1fr; }
  .data-grid { grid-template-columns: 1fr; }
  .funnel-stages { flex-direction: column; }
  .run-header { flex-direction: column; gap: 12px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .calendar-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Auth header user block */
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding-left: 24px;
}
.header-user-name {
  font-size: 13px;
  color: #888;
}
.btn-logout {
  background: transparent;
  border: 1px solid #2a2f4a;
  border-radius: 6px;
  color: #888;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-logout:hover {
  border-color: #7b8cde;
  color: #fff;
}
