/* ═══════════════════════════════════════════════════════════
   BitsclanOS — Detail Page CSS (project + deal detail views)
   Design tokens from theme.css
   ═══════════════════════════════════════════════════════════ */

/* ── BREADCRUMB ──────────────────────────────────────────── */
.detail-breadcrumb {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.detail-breadcrumb-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
}

.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb-back:hover { color: var(--accent); }
.breadcrumb-back svg { flex-shrink: 0; }

/* ── DETAIL HEADER ───────────────────────────────────────── */
.detail-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 36px 24px 32px;
  position: relative;
  overflow: hidden;
}

.detail-header::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -120px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
}

.health-bg-red::before    { background: radial-gradient(circle, rgba(248,113,113,0.08) 0%, transparent 60%); }
.health-bg-yellow::before { background: radial-gradient(circle, rgba(251,191,36,0.08) 0%, transparent 60%); }

.detail-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.detail-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.detail-client {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.detail-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 10px;
}

.detail-stack {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 14px;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}

.detail-meta-sep { color: var(--border); }

/* Deal-specific header */
.deal-header .detail-header-inner { padding-bottom: 4px; }

.deal-service-tag {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
}

.stage-badge-header {
  font-size: 11px !important;
  padding: 4px 12px !important;
}

.deal-contact-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.deal-contact-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--fg);
}

.deal-contact-email {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}
.deal-contact-email:hover { opacity: 0.8; }

.deal-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

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

.deal-value-label {
  font-size: 14px;
  color: var(--fg-muted);
  margin-right: 8px;
}

.deal-value-sep { color: var(--border); font-size: 18px; }

.deal-weighted {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: #34d399;
}

.deal-weighted-label {
  font-size: 13px;
  color: var(--fg-muted);
}

/* ── MAIN LAYOUT ─────────────────────────────────────────── */
.detail-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── DETAIL CARDS ────────────────────────────────────────── */
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.detail-card-full { grid-column: 1 / -1; }

.detail-card-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 20px;
}

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

/* ── BUDGET TRACKER ──────────────────────────────────────── */
.detail-card-budget .detail-card-label { margin-bottom: 16px; }

.budget-overview { margin-bottom: 24px; }

.budget-numbers {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.budget-big {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.budget-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 4px;
}

.budget-pct-badge {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: var(--radius);
}
.budget-ok     { background: rgba(52,211,153,0.12); color: #34d399; }
.budget-warn   { background: rgba(251,191,36,0.12);  color: #fbbf24; }
.budget-danger { background: rgba(248,113,113,0.12); color: #f87171; }

.budget-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.budget-stat {
  flex: 1;
  padding: 16px;
  text-align: center;
}

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

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

.budget-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── MILESTONE RING ──────────────────────────────────────── */
.milestone-header-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.milestone-big {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}

.milestone-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.milestone-pct-ring {
  margin-left: auto;
  width: 72px;
  height: 72px;
}

.ring-svg { width: 100%; height: 100%; }

.ring-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 5; }

.ring-fill {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}
.ring-fill.green  { stroke: #34d399; }
.ring-fill.yellow { stroke: #fbbf24; }
.ring-fill.red    { stroke: #f87171; }

.ring-text {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  fill: #fff;
}

/* ── MILESTONE LIST ──────────────────────────────────────── */
.milestone-list { display: flex; flex-direction: column; gap: 4px; }

.milestone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.milestone-row:hover { border-color: var(--border); }
.milestone-row.milestone-done { opacity: 0.55; }

.milestone-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: transparent;
}
.milestone-check:hover { border-color: #34d399; color: #34d399; }
.milestone-check.checked { background: #34d399; border-color: #34d399; color: #000; }

.milestone-body { flex: 1; min-width: 0; }

.milestone-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.milestone-done .milestone-title { text-decoration: line-through; }

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

.milestone-tag {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 100px;
  flex-shrink: 0;
}
.tag-overdue { background: rgba(248,113,113,0.12); color: #f87171; }
.tag-soon    { background: rgba(251,191,36,0.12);  color: #fbbf24; }

.milestone-empty {
  font-size: 14px;
  color: var(--fg-muted);
  padding: 16px 0;
  text-align: center;
}

/* ── TEAM LIST ───────────────────────────────────────────── */
.team-list { display: flex; flex-direction: column; gap: 8px; }

.team-member-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.team-avatar {
  width: 38px;
  height: 38px;
  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;
}

.team-info { flex: 1; min-width: 0; }

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

.team-role {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 1px;
}

.team-alloc-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.team-alloc-bar {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
}

.team-alloc-pct {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  min-width: 32px;
  text-align: right;
}

/* ── COMPLETION RING ─────────────────────────────────────── */
.completion-ring-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.completion-ring {
  width: 160px;
  height: 160px;
}

.ring-bg-lg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 7; }

.ring-fill-lg {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}
.ring-fill-lg.green  { stroke: #34d399; }
.ring-fill-lg.yellow { stroke: #fbbf24; }
.ring-fill-lg.red    { stroke: #f87171; }

.completion-num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  fill: #fff;
}

.completion-label-svg {
  font-size: 11px;
  fill: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.project-notes-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.notes-preview-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.notes-preview-text {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.6;
}

/* ── ACTIVITY FEED ───────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
  max-height: 380px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.activity-item:hover { border-color: var(--border); }

.activity-avatar {
  width: 32px;
  height: 32px;
  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: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.activity-body { flex: 1; min-width: 0; }

.activity-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.activity-author {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

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

.activity-text {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
}

.activity-empty {
  font-size: 14px;
  color: var(--fg-muted);
  padding: 20px;
  text-align: center;
}

/* Add note form */
.add-note-form {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.note-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}
.note-input:focus { border-color: rgba(92,225,230,0.3); }

.note-form-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.note-author-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  width: 180px;
  transition: border-color 0.15s;
}
.note-author-input:focus { border-color: rgba(92,225,230,0.3); }

.note-submit { margin-left: auto; }

/* ── STAGE TRACK ─────────────────────────────────────────── */
.stage-track {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
}

.stage-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 100px;
  flex: 1;
}

.stage-node-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}

.stage-done .stage-node-dot {
  background: rgba(52,211,153,0.15);
  border: 2px solid #34d399;
  color: #34d399;
}

.stage-active .stage-node-dot {
  background: rgba(92,225,230,0.15);
  border: 2px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(92,225,230,0.3);
}

.stage-future .stage-node-dot {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--fg-muted);
}

.stage-lost-node .stage-node-dot {
  background: rgba(248,113,113,0.12);
  border: 2px solid #f87171;
  color: #f87171;
}

.stage-node-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.stage-done   .stage-node-label { color: #34d399; }
.stage-active .stage-node-label { color: var(--accent); }
.stage-future .stage-node-label { color: var(--fg-muted); }
.stage-lost-node .stage-node-label { color: #f87171; }

.stage-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-bottom: 22px;
  transition: background 0.2s;
}
.stage-connector.connector-done { background: #34d399; }

/* ── DEAL INFO GRID ──────────────────────────────────────── */
.deal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 20px;
}

.deal-info-item {}

.deal-info-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

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

.deal-notes-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.deal-notes-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.deal-notes-text {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.6;
}

/* ── NEXT STEPS ──────────────────────────────────────────── */
.next-steps-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.next-step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.next-step-row:hover { border-color: var(--border); }
.next-step-row.step-done { opacity: 0.5; }
.next-step-row.step-done .milestone-title { text-decoration: line-through; }

.add-step-form { border-top: 1px solid var(--border); padding-top: 14px; }

.step-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.step-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.step-input:focus { border-color: rgba(92,225,230,0.3); }

.step-date {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  width: 140px;
  transition: border-color 0.15s;
}
.step-date:focus { border-color: rgba(92,225,230,0.3); }

/* ── INTERACTION TIMELINE ────────────────────────────────── */
.interaction-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 20px;
  max-height: 440px;
  overflow-y: auto;
}

.interaction-item {
  display: flex;
  gap: 16px;
}

.interaction-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16px;
  flex-shrink: 0;
  padding-top: 4px;
}

.interaction-icon-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(92,225,230,0.2);
}

.interaction-line {
  flex: 1;
  width: 2px;
  background: var(--border);
  min-height: 20px;
  margin: 4px 0;
}

.interaction-body {
  flex: 1;
  padding-bottom: 16px;
}

.interaction-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.interaction-type-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: capitalize;
}
.type-email   { background: rgba(167,139,250,0.12); color: #a78bfa; }
.type-call    { background: rgba(52,211,153,0.12);  color: #34d399; }
.type-meeting { background: rgba(92,225,230,0.12);  color: var(--accent); }
.type-note    { background: rgba(136,136,160,0.12); color: var(--fg-muted); }

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

.interaction-summary {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.55;
}

/* Log interaction form */
.add-interaction-form { border-top: 1px solid var(--border); padding-top: 16px; }

.interaction-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.interaction-type-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  width: 140px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.interaction-type-select:focus { border-color: rgba(92,225,230,0.3); }
.interaction-type-select option { background: var(--bg-card); }

.interaction-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.interaction-input:focus { border-color: rgba(92,225,230,0.3); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .detail-row { grid-template-columns: 1fr; }
  .deal-info-grid { grid-template-columns: 1fr 1fr; }
  .milestone-header-stats { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .detail-header { padding: 24px 16px 20px; }
  .detail-main { padding: 20px 16px 60px; }
  .detail-title { font-size: 26px; }
  .deal-value-main { font-size: 28px; }
  .stage-track { gap: 0; }
  .stage-node { min-width: 70px; }
  .stage-node-label { font-size: 10px; }
  .interaction-form-row { flex-wrap: wrap; }
  .interaction-type-select { width: 100%; }
  .step-date { width: 100%; }
  .step-form-row { flex-wrap: wrap; }
  .note-form-footer { flex-wrap: wrap; }
  .note-author-input { width: 100%; }
  .budget-stats { flex-wrap: wrap; }
  .budget-stat-divider { display: none; }
}
