/* =========================================================
   dashboard.css — Opportunity Dashboard
   Matches app.css dark palette. Responsive sortable table.
   ========================================================= */

/* ---- Layout ---- */
.dash-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* ---- Header ---- */
.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  color: #f0ede8;
  margin: 0 0 4px;
  line-height: 1.1;
}
.dash-sub { font-size: 13px; color: #55535c; margin: 0; }
.dash-header-actions { display: flex; gap: 8px; align-items: center; }
.dash-header-actions .btn-ghost { width: auto; }

/* ---- Stats row ---- */
.dash-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: #141416;
  border: 1px solid #1e1e24;
  border-radius: 10px;
  padding: 0;
  margin-bottom: 28px;
  overflow: hidden;
}
.dash-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
  gap: 4px;
}
.dash-stat-divider {
  width: 1px;
  height: 40px;
  background: #1e1e24;
  flex-shrink: 0;
}
.dash-stat-value {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: #f59e0b;
  line-height: 1;
}
.dash-stat-label {
  font-size: 11px;
  color: #55535c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ---- Table ---- */
.dash-table-wrap {
  overflow-x: auto;
}
.dash-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
.dash-table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #55535c;
  padding: 0 14px 10px;
  text-align: left;
  border-bottom: 1px solid #1e1e24;
  white-space: nowrap;
  user-select: none;
}
.dash-table thead th.sortable { cursor: pointer; }
.dash-table thead th.sortable:hover { color: #8a8790; }
.sort-icon { font-size: 10px; margin-left: 4px; }
.text-right { text-align: right !important; }

.dash-row {
  border-bottom: 1px solid #1e1e24;
  transition: background 0.12s;
}
.dash-row:hover { background: #1c1c20; }
.dash-row td { padding: 14px 14px; vertical-align: middle; }

/* Deal name cell */
.dash-deal-name {
  font-size: 14px;
  font-weight: 600;
  color: #f0ede8;
  line-height: 1.3;
}
.dash-deal-company {
  font-size: 12px;
  color: #55535c;
  margin-top: 2px;
}

/* Stage badge */
.dash-stage {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 12px;
  background: #222228;
  color: #8a8790;
  white-space: nowrap;
}
.dash-stage.discovery { background: rgba(139,92,246,0.12); color: #a78bfa; }
.dash-stage.qualification { background: rgba(59,130,246,0.12); color: #60a5fa; }
.dash-stage.proposal { background: rgba(245,158,11,0.12); color: #f59e0b; }
.dash-stage.negotiation { background: rgba(34,197,94,0.1); color: #4ade80; }
.dash-stage.closed-won { background: rgba(34,197,94,0.15); color: #22c55e; }
.dash-stage.closed-lost { background: rgba(239,68,68,0.1); color: #f87171; }

/* ARR */
.dash-arr { font-size: 13px; color: #8a8790; font-variant-numeric: tabular-nums; }

/* Close date */
.dash-close { font-size: 13px; color: #8a8790; }

/* Health score badge */
.dash-score-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.dash-score-badge.red { background: rgba(239,68,68,0.12); color: #ef4444; }
.dash-score-badge.amber { background: rgba(245,158,11,0.12); color: #f59e0b; }
.dash-score-badge.green { background: rgba(34,197,94,0.12); color: #22c55e; }

/* MEDDPPICC progress bar */
.dash-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.dash-progress-bar {
  flex: 1;
  height: 4px;
  background: #2a2a30;
  border-radius: 2px;
  overflow: hidden;
}
.dash-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.dash-progress-fill.red { background: #ef4444; }
.dash-progress-fill.amber { background: #f59e0b; }
.dash-progress-fill.green { background: #22c55e; }
.dash-progress-label { font-size: 11px; color: #55535c; white-space: nowrap; }

/* Next action cell */
.dash-next-col { max-width: 220px; }
.dash-next-action { display: flex; flex-direction: column; gap: 2px; }
.dash-next-pillar {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #92610a;
}
.dash-next-q {
  font-size: 12px;
  color: #8a8790;
  line-height: 1.4;
}
.dash-next-done { font-size: 12px; color: #22c55e; }

/* Loading row */
.dash-loading-row td {
  padding: 40px;
  text-align: center;
  color: #55535c;
  font-size: 14px;
}
.dash-error { color: #ef4444 !important; }

/* Empty state */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
  gap: 12px;
}
.dash-empty-icon { font-size: 48px; color: #f59e0b; opacity: 0.35; }
.dash-empty-title { font-family: 'Instrument Serif', Georgia, serif; font-size: 24px; margin: 0; color: #f0ede8; }
.dash-empty-body { font-size: 14px; color: #8a8790; max-width: 360px; line-height: 1.6; margin: 0; }

/* Next Actions strip in table */
.dash-next-col { cursor: pointer; min-width: 220px; max-width: 280px; }
.dash-actions-strip { display: flex; flex-direction: column; gap: 5px; }
.dash-action-item { display: flex; align-items: flex-start; gap: 6px; }
.dash-action-pill {
  font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
  background: #fef3c7; color: #92400e; margin-top: 1px;
}
.dash-action-text { font-size: 12px; color: var(--fg-base); line-height: 1.4; }
.dash-actions-link {
  font-size: 11px; color: var(--fg-muted); text-decoration: none;
  margin-top: 3px; display: inline-block;
}
.dash-actions-link:hover { color: var(--accent); text-decoration: underline; }

/* Stakeholder map link in table */
.dash-sh-col { white-space: nowrap; }
.dash-sh-map {
  font-size: 12px; color: var(--fg-muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border-faint);
  transition: border-color 0.15s, color 0.15s;
}
.dash-sh-map:hover { color: var(--accent); border-color: var(--border); text-decoration: none; }

/* Responsive */
@media (max-width: 768px) {
  .dash-main { padding: 24px 16px 60px; }
  .dash-header { flex-direction: column; align-items: flex-start; }
  .dash-stats { flex-wrap: wrap; }
  .dash-stat { min-width: 100px; }
}