/* ═══════════════════════════════════════════════════════════
   BitsclanOS — Dashboard CSS
   Design tokens from theme.css (var(--bg), --accent, etc.)
   ═══════════════════════════════════════════════════════════ */

.dashboard-body {
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── NAV ─────────────────────────────────────────────────── */
.dash-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.dash-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}

.nav-logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
}

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

.nav-link {
  padding: 6px 16px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: all 0.15s;
}

.nav-link:hover { color: var(--fg); background: var(--bg-surface); }
.nav-link.active { color: var(--accent); background: var(--accent-glow); }

.nav-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.nav-date {
  font-size: 13px;
  color: var(--fg-muted);
}

.nav-pulse {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #34d399;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ── COMMAND BAR ─────────────────────────────────────────── */
.command-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.command-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.cmd-stat {
  padding: 0 28px;
  flex-shrink: 0;
}

.cmd-stat:first-child { padding-left: 0; }
.cmd-stat:last-child { padding-right: 0; }

.cmd-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.cmd-stat-label {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cmd-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

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

/* ── TAB PANELS ──────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PANEL HEADER ────────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-top: 8px;
}

/* ── SHARED UTILITIES ────────────────────────────────────── */
.text-red    { color: #f87171 !important; }
.text-yellow { color: #fbbf24 !important; }
.text-green  { color: #34d399 !important; }
.accent      { color: var(--accent) !important; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-add {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.btn-add:hover { opacity: 0.88; }

/* ═══════════════════════════════════════════════════════════
   PROJECTS
   ═══════════════════════════════════════════════════════════ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color 0.2s, transform 0.15s;
}

.project-card:hover {
  border-color: rgba(92, 225, 230, 0.15);
  transform: translateY(-1px);
}

.project-card.health-red  { border-left: 3px solid #f87171; }
.project-card.health-yellow { border-left: 3px solid #fbbf24; }
.project-card.health-green  { border-left: 3px solid #34d399; }

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

.pc-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.health-dot-green  { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,0.5); }
.health-dot-yellow { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,0.5); }
.health-dot-red    { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.5); }

.pc-client {
  font-size: 12px;
  color: var(--fg-muted);
  flex: 1;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pc-status-badge {
  font-size: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
}
.status-active    { background: rgba(52,211,153,0.12); color: #34d399; }
.status-on_hold   { background: rgba(251,191,36,0.12); color: #fbbf24; }
.status-completed { background: rgba(92,225,230,0.12); color: var(--accent); }

.pc-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.pc-stack {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* Progress bars */
.pc-progress-section, .pc-budget-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pc-progress-label, .pc-budget-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-muted);
}
.pc-progress-pct, .pc-budget-pct { font-weight: 600; }

.pc-progress-bar {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}

.pc-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.6s ease;
}

.pc-budget-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease;
}
.fill-green  { background: #34d399; }
.fill-yellow { background: #fbbf24; }
.fill-red    { background: #f87171; }

.pc-budget-numbers {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-muted);
}

/* Timeline */
.pc-deadline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--fg-muted);
}
.pc-deadline.urgent  { color: #fbbf24; }
.pc-deadline.overdue { color: #f87171; }

/* Team avatars */
.pc-team {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.avatar-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  cursor: default;
}
.avatar-more { color: var(--fg-muted); font-size: 9px; }

/* ═══════════════════════════════════════════════════════════
   TEAM
   ═══════════════════════════════════════════════════════════ */
.util-summary { display: flex; gap: 8px; align-items: center; }

.util-chip {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}
.chip-avail { color: #34d399; border-color: rgba(52,211,153,0.2); background: rgba(52,211,153,0.07); }

.office-section { margin-bottom: 36px; }

.office-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--fg-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.office-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.engineer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.engineer-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.engineer-row:hover { border-color: rgba(92,225,230,0.12); }

.eng-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(92,225,230,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.eng-info { min-width: 160px; }
.eng-name { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: #fff; }
.eng-role { font-size: 12px; color: var(--fg-muted); margin-top: 1px; }

.eng-projects { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }

.eng-proj-chip {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 100px;
  font-family: var(--font-display);
  font-weight: 500;
  white-space: nowrap;
}
.health-chip-green  { background: rgba(52,211,153,0.1); color: #34d399; }
.health-chip-yellow { background: rgba(251,191,36,0.1); color: #fbbf24; }
.health-chip-red    { background: rgba(248,113,113,0.1); color: #f87171; }
.chip-bench         { background: rgba(136,136,160,0.1); color: var(--fg-muted); }

.eng-util-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
  flex-shrink: 0;
}

.eng-util-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}

.eng-util-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease;
}

.eng-util-pct {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  min-width: 36px;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════
   PIPELINE
   ═══════════════════════════════════════════════════════════ */
.pipeline-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.kpi-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.kpi-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 3px;
}

/* Stage funnel */
.stage-funnel {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.funnel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 100px;
  padding: 0 12px;
  text-align: center;
}

.funnel-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.funnel-count {
  font-size: 12px;
  color: var(--fg-muted);
}

.funnel-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.funnel-arrow {
  color: var(--fg-muted);
  font-size: 20px;
  flex-shrink: 0;
}

/* Deal table */
.deal-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.deal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.deal-table thead {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.deal-table th {
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.deal-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.deal-table tr:last-child td { border-bottom: none; }
.deal-table tr:hover td { background: rgba(255,255,255,0.02); }

.deal-company {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.deal-contact {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.deal-value {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg);
}

.stage-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 100px;
}

.stage-discovery   { background: rgba(136,136,160,0.12); color: var(--fg-muted); }
.stage-proposal    { background: rgba(167,139,250,0.12); color: #a78bfa; }
.stage-negotiation { background: rgba(92,225,230,0.12);  color: var(--accent); }
.stage-won         { background: rgba(52,211,153,0.12);  color: #34d399; }
.stage-lost        { background: rgba(248,113,113,0.12); color: #f87171; }

.prob-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg);
}

.prob-bar {
  width: 60px;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
}

.deals-loading {
  color: var(--fg-muted);
  text-align: center;
  padding: 40px;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--fg); }

.modal-form {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-2 {
  flex-direction: row;
  gap: 16px;
}
.form-row-2 > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.form-row input,
.form-row select,
.form-row textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-row input:focus,
.form-row select:focus {
  border-color: rgba(92,225,230,0.3);
}

.form-row select option {
  background: var(--bg-card);
}

.btn-submit {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}
.btn-submit:hover { opacity: 0.88; }

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  padding: 80px;
  text-align: center;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: #fff; margin-bottom: 8px; }
.empty-sub { font-size: 15px; color: var(--fg-muted); }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .pipeline-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .dash-nav-inner { gap: 16px; }
  .nav-date { display: none; }
  .command-bar-inner { gap: 0; }
  .cmd-stat { padding: 0 16px; }
  .cmd-stat-value { font-size: 18px; }
  .project-grid { grid-template-columns: 1fr; }
  .pipeline-kpis { grid-template-columns: repeat(2, 1fr); }
  .stage-funnel { display: none; }
  .engineer-row { flex-wrap: wrap; }
  .eng-projects { display: none; }
  .panel-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 520px) {
  .command-bar-inner { overflow-x: auto; }
  .pipeline-kpis { grid-template-columns: 1fr 1fr; }
  .nav-links { gap: 0; }
}
