:root {
  --bg: #0a1a14;
  --surface: #0f2b1f;
  --surface-hover: #163d2c;
  --border: #1e4d38;
  --text: #f0f4f2;
  --text-muted: #7faa96;
  --primary: #34d399;
  --primary-hover: #10b981;
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 20px 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-nav a.active {
  border-left: 3px solid var(--primary);
}

.main { margin-left: 220px; flex: 1; padding: 24px; min-width: 0; }

/* Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 24px; font-weight: 600; }

/* Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .label { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.data-table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:hover td { background: var(--surface-hover); }
.data-table tr:last-child td { border-bottom: none; }

.data-table td a { color: var(--primary); text-decoration: none; }
.data-table td a:hover { text-decoration: underline; }

/* Pipeline */
.pipeline {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-stage {
  flex: 1;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.pipeline-stage .stage-name {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.pipeline-stage .stage-value { font-size: 22px; font-weight: 700; }
.pipeline-stage .stage-count { font-size: 12px; color: var(--text-muted); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-lead { background: #0d3326; color: #6ee7b7; }
.badge-qualified { background: #134e4a; color: #5eead4; }
.badge-proposal { background: #422006; color: #fbbf24; }
.badge-negotiation { background: #431407; color: #fb923c; }
.badge-won { background: #052e16; color: #4ade80; }
.badge-lost { background: #450a0a; color: #f87171; }
.badge-new { background: #0d3326; color: #6ee7b7; }
.badge-contacted { background: #134e4a; color: #5eead4; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}

.form-control:focus { outline: none; border-color: var(--primary); }

select.form-control { appearance: auto; }

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

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 { font-size: 18px; margin-bottom: 20px; }

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Search bar */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-bar input { flex: 1; }

/* Section headings */
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Two column layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  z-index: 200;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Google status */
.google-status {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.google-status .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-green { background: var(--success); }
.dot-red { background: var(--danger); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
