/* CRM pages — extends theme.css */

/* Page wrapper */
.crm-page {
  background: var(--bg);
  min-height: 100vh;
}
.crm-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}
.crm-page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.crm-page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--navy);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.625rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-quote     { background: #f3f4f6; color: #6b7280; }
.badge-submitted { background: #eff6ff; color: #1d4ed8; }
.badge-processing{ background: #fef3c7; color: #d97706; }
.badge-shipped   { background: #e0f2fe; color: #0284c7; }
.badge-fulfilled { background: #d1fae5; color: #059669; }
.badge-cancelled { background: #fee2e2; color: #dc2626; }

/* Urgent badges */
.urgency-critical { background: #fee2e2; color: #dc2626; }
.urgency-high    { background: #fef3c7; color: #d97706; }
.urgency-medium  { background: #eff6ff; color: #1d4ed8; }

/* Cards */
.crm-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.crm-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.crm-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.crm-card-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--navy);
  line-height: 1;
}
.crm-card-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.375rem; }

/* Pipeline stages */
.pipeline-stages {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.stage-card {
  flex: 1;
  min-width: 140px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}
.stage-name {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.stage-count {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--navy);
  line-height: 1;
}
.stage-value { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }

/* Data tables */
.data-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
}
table.data-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
table.data-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--bg); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost {
  background: transparent;
  color: var(--slate);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.75rem; }

/* Alerts */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; }
.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.alert-icon.critical { background: #fee2e2; }
.alert-icon.high    { background: #fef3c7; }
.alert-icon.medium  { background: #eff6ff; }
.alert-content { flex: 1; }
.alert-product { font-weight: 600; color: var(--navy); font-size: 0.9rem; margin-bottom: 0.25rem; }
.alert-reason  { font-size: 0.8125rem; color: var(--muted); }
.alert-stock {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.25rem;
}
.alert-stock span { color: var(--navy); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--slate); margin-bottom: 0.375rem; }
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--card-bg);
  color: var(--fg);
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* Search */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.search-input {
  flex: 1;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--card-bg);
  color: var(--fg);
}
.search-input:focus { outline: none; border-color: var(--accent); }

/* Section titles */
.section-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--navy);
  margin: 2rem 0 1rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}
.empty-state p { margin-top: 0.5rem; font-size: 0.875rem; }

/* Customer pills */
.customer-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 0.125rem;
}
.customer-name { font-weight: 600; color: var(--navy); font-size: 0.875rem; }
.customer-company { font-size: 0.75rem; color: var(--muted); }

/* Money */
.money { font-weight: 600; color: var(--navy); }
.money-large { font-family: var(--font-display); font-size: 1.5rem; color: var(--navy); }

/* Activity feed */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.4rem;
  flex-shrink: 0;
}
.activity-text { color: var(--slate); line-height: 1.5; }
.activity-text strong { color: var(--navy); }

/* Modal select dropdown */
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--navy); }
.tab.active { color: var(--navy); border-bottom-color: var(--accent); }

@media (max-width: 768px) {
  .crm-grid-3 { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .pipeline-stages { gap: 0.5rem; }
  .crm-container { padding: 1rem; }
}