/* RestrepoOS — VFO Command Center */

:root {
  --ink: #0a0f1a;
  --slate: #1a2332;
  --steel: #3d4f63;
  --mist: #8899aa;
  --cloud: #c4d0dc;
  --snow: #f0f3f7;
  --white: #ffffff;
  --gold: #c9a84c;
  --gold-light: #e8d48b;
  --gold-dim: rgba(201, 168, 76, 0.12);
  --gold-border: rgba(201, 168, 76, 0.2);
  --emerald: #2a9d6e;
}

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

html, body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ink);
  color: var(--cloud);
  line-height: 1.6;
  height: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  line-height: 1.15;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* NAV */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(20px);
  background: rgba(10, 15, 26, 0.85);
  border-bottom: 1px solid var(--gold-border);
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.01em;
}

.nav-brand span { color: var(--cloud); font-weight: 400; }

.nav-actions { display: flex; gap: 12px; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--gold);
  color: var(--ink);
}

.btn-primary:hover { background: var(--gold-light); }

.btn-ghost {
  background: transparent;
  color: var(--cloud);
  border: 1px solid var(--steel);
}

.btn-ghost:hover { border-color: var(--mist); color: var(--white); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

.btn-danger { background: #c0392b; color: var(--white); }
.btn-danger:hover { background: #e74c3c; }

/* MAIN LAYOUT */
.app-shell {
  padding-top: 72px;
  min-height: 100vh;
}

.page-header {
  padding: 40px 32px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.page-header h1 { font-size: 1.75rem; color: var(--white); margin-bottom: 4px; }
.page-header p { color: var(--mist); font-size: 0.9rem; }

/* PIPELINE BOARD */
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 28px 32px;
  min-height: calc(100vh - 180px);
  align-items: start;
}

.pipeline-stage {
  background: var(--slate);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.stage-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stage-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist);
}

.stage-count {
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.stage-cards {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 300px);
}

/* CLIENT CARDS */
.client-card {
  background: var(--ink);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.client-card:hover {
  border-color: var(--gold-border);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.client-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--white);
  margin-bottom: 6px;
}

.client-card-meta {
  font-size: 0.75rem;
  color: var(--mist);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.client-card-meta .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--gold-dim);
  color: var(--gold);
  width: fit-content;
}

.client-card-type {
  font-size: 0.7rem;
  color: var(--steel);
  margin-top: 4px;
}

.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  gap: 4px;
}

.client-card:hover .card-actions { display: flex; }

.card-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--mist);
  padding: 4px;
  border-radius: 4px;
  font-size: 0.7rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-actions button:hover { color: var(--gold); background: var(--gold-dim); }
.card-actions .delete-btn:hover { color: #e74c3c; background: rgba(192,57,43,0.15); }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 26, 0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--slate);
  border: 1px solid var(--gold-border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal { transform: scale(1); }

.detail-modal {
  max-width: 760px;
}

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

.modal-header h2 { font-size: 1.25rem; color: var(--white); }

.modal-close {
  background: none;
  border: none;
  color: var(--mist);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover { color: var(--white); }

.modal-body { padding: 24px 28px; }

/* FORMS */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mist);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--ink);
  border: 1px solid var(--steel);
  border-radius: 8px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-section {
  margin: 28px 0 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.form-section-title {
  color: var(--gold-light);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.form-help,
.detail-help {
  color: var(--mist);
  font-size: 0.78rem;
  line-height: 1.5;
  margin-bottom: 18px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 20px 28px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* SERVICES CHECKBOXES */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.service-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ink);
  border: 1px solid var(--steel);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--cloud);
  transition: all 0.15s ease;
}

.service-check:hover { border-color: var(--mist); }

.service-check input { display: none; }

.service-check.checked {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold-light);
}

/* DETAIL MODAL */
.detail-section { margin-bottom: 20px; }
.detail-review-section {
  margin-bottom: 26px;
  padding-bottom: 4px;
}
.detail-review-section + .detail-review-section {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 24px;
}
.detail-section h3 {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist);
  margin-bottom: 8px;
}

.detail-value { color: var(--white); font-size: 0.9rem; }
.detail-coordination-section { padding-top: 4px; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.detail-meta-item { min-width: 0; }
.detail-meta-wide { grid-column: 1 / -1; }
.detail-meta-label {
  display: block;
  color: var(--mist);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  text-transform: uppercase;
}
.detail-meta-value { display: block; white-space: pre-wrap; }
.detail-note-editor { width: 100%; }
.detail-note-editor textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: 10px 14px;
  background: var(--ink);
  border: 1px solid var(--steel);
  border-radius: 8px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.detail-note-editor textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-dim);
}
.detail-note-save-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.detail-empty {
  color: var(--mist);
  background: var(--ink);
  border: 1px dashed var(--steel);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.85rem;
}
.detail-intake-message {
  background: var(--ink);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  color: var(--white);
  font-size: 0.9rem;
  line-height: 1.6;
  min-height: 44px;
  padding: 10px 12px;
  white-space: pre-wrap;
}
.detail-missing { color: var(--mist); }
.detail-loading { color: var(--mist); font-size: 0.9rem; }
.detail-services { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-services span {
  background: var(--gold-dim);
  color: var(--gold);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 28px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* STAGE BADGE COLORS */
.stage-lead .stage-name { color: var(--mist); }
.stage-discovery .stage-name { color: #3498db; }
.stage-onboarding .stage-name { color: var(--gold); }
.stage-active .stage-name { color: var(--emerald); }

.stage-lead .stage-count { background: rgba(136,153,170,0.15); color: var(--mist); }
.stage-discovery .stage-count { background: rgba(52,152,219,0.15); color: #3498db; }
.stage-onboarding .stage-count { background: var(--gold-dim); color: var(--gold); }
.stage-active .stage-count { background: rgba(42,157,110,0.15); color: var(--emerald); }

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--slate);
  border: 1px solid var(--gold-border);
  border-radius: 10px;
  padding: 12px 20px;
  color: var(--white);
  font-size: 0.875rem;
  z-index: 500;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show { transform: translateY(0); opacity: 1; }

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

@media (max-width: 640px) {
  .pipeline-board { grid-template-columns: 1fr; padding: 16px; }
  .page-header { padding: 24px 16px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-meta { grid-template-columns: 1fr; }
  .detail-meta-wide { grid-column: auto; }
  .detail-modal { max-height: 94vh; }
  .detail-actions { padding: 16px; }
  .detail-note-save-row .btn { width: 100%; justify-content: center; }
  .services-grid { grid-template-columns: 1fr; }
  .nav { padding: 12px 16px; }
}
