/* ========================================================================
   TurfKingz Dashboard — Design System
   ======================================================================== */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- CSS Variables ---- */
:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --green: #059669;
  --green-light: #ecfdf5;
  --green-border: #a7f3d0;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --gold: #d97706;
  --gold-light: #fffbeb;
  --teal: #0891b2;
  --teal-light: #ecfeff;
  --red: #dc2626;
  --red-light: #fef2f2;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.04);
  --transition: 0.15s ease;
}

/* ---- Base ---- */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ========================================================================
   Layout
   ======================================================================== */

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #111827;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.025em;
}

.sidebar-brand span {
  color: var(--green);
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  cursor: pointer;
}

.sidebar-item:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--green);
}

.sidebar-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item.active svg {
  opacity: 1;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.open {
  display: block;
}

/* ---- Main wrapper ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 50;
}

.topbar-spacer {
  flex: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

/* Hamburger (hidden on desktop) */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.25rem;
}

/* ---- Content ---- */
.content {
  flex: 1;
  padding: 1.5rem;
}


/* ========================================================================
   Components — Stat Cards
   ======================================================================== */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.025em;
}

.stat-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}


/* ========================================================================
   Components — Data Table
   ======================================================================== */

.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--text-secondary);
}

.data-table th.sorted-asc::after {
  content: ' \25B2';
  font-size: 0.6rem;
}

.data-table th.sorted-desc::after {
  content: ' \25BC';
  font-size: 0.6rem;
}

.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(249, 250, 251, 0.5);
}

.data-table tbody tr:hover {
  background: #f3f4f6;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr.clickable {
  cursor: pointer;
}


/* ========================================================================
   Components — Status Pill
   ======================================================================== */

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  line-height: 1.4;
}

.status-pill--new {
  background: var(--blue-light);
  color: var(--blue);
}

.status-pill--contacted {
  background: var(--gold-light);
  color: var(--gold);
}

.status-pill--follow-up {
  background: var(--orange-light);
  color: var(--orange);
}

.status-pill--quoted {
  background: var(--purple-light);
  color: var(--purple);
}

.status-pill--won {
  background: var(--green-light);
  color: var(--green);
}

.status-pill--lost {
  background: #f3f4f6;
  color: var(--text-muted);
}


/* ========================================================================
   Components — Buttons
   ======================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover {
  background: #f9fafb;
  border-color: var(--border-strong);
}

.btn--primary {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
}

.btn--primary:hover {
  background: #047857;
  border-color: #047857;
}

.btn--outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn--outline:hover {
  background: #f9fafb;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--danger {
  background: var(--red);
  color: #ffffff;
  border-color: var(--red);
}

.btn--danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn--small {
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
}

.btn--disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


/* ========================================================================
   Components — Lead Detail
   ======================================================================== */

.lead-detail {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.5rem;
  align-items: start;
}

.lead-detail__info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.lead-detail__sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lead-detail__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.lead-detail__name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lead-detail__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.lead-detail__field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.lead-detail__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.lead-detail__value {
  font-size: 0.9rem;
  color: var(--text);
}


/* ========================================================================
   Components — Timeline
   ======================================================================== */

.timeline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.timeline__title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.timeline__list {
  position: relative;
  padding-left: 1.5rem;
}

.timeline__list::before {
  content: '';
  position: absolute;
  left: 0.35rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item__dot {
  position: absolute;
  left: -1.25rem;
  top: 0.35rem;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--border-strong);
  border: 2px solid var(--bg-card);
}

.timeline-item__dot--green { background: var(--green); }
.timeline-item__dot--blue { background: var(--blue); }
.timeline-item__dot--gold { background: var(--gold); }
.timeline-item__dot--red { background: var(--red); }
.timeline-item__dot--purple { background: var(--purple); }

.timeline-item__time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.timeline-item__user {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.timeline-item__content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.15rem;
}

.timeline-item__card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}


/* ========================================================================
   Components — Toast
   ======================================================================== */

.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 280px;
  animation: toast-in 0.2s ease;
}

.toast--success {
  border-left: 3px solid var(--green);
  color: var(--green);
}

.toast--error {
  border-left: 3px solid var(--red);
  color: var(--red);
}

.toast--removing {
  animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(0.5rem); }
}

.toast--hiding {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}


/* ========================================================================
   Components — Modal
   ======================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
}

.modal__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.modal__body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}


/* ========================================================================
   Components — Filter Bar
   ======================================================================== */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-bar select {
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  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='%236b7280' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.filter-bar select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

.filter-bar input[type="search"],
.filter-bar input[type="text"] {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text);
}

.filter-bar input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  background: var(--green-light);
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid var(--green-border);
}

.filter-pill__remove {
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.6;
}

.filter-pill__remove:hover {
  opacity: 1;
}


/* ========================================================================
   Components — Pagination
   ======================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1rem;
  font-size: 0.82rem;
}

.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
}

.pagination__btn:hover {
  background: #f9fafb;
  border-color: var(--border-strong);
  color: var(--text);
}

.pagination__btn.active {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
}

.pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination__info {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 0 0.5rem;
}


/* ========================================================================
   Components — Empty State
   ======================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 1rem;
}

.empty-state__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.empty-state__message {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.5;
}


/* ========================================================================
   Components — Loading Spinner
   ======================================================================== */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ========================================================================
   Components — Status Flow
   ======================================================================== */
.status-flow {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.status-flow__pill {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.status-flow__pill:hover {
  border-color: var(--border-strong, #d1d5db);
  background: var(--bg-card);
}
.status-flow__pill--active {
  font-weight: 600;
  cursor: default;
}
.status-flow__pill--loading {
  opacity: 0.5;
  pointer-events: none;
}
/* Active state colors match status-pill colors */
.status-flow__pill--new.status-flow__pill--active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--blue);
}
.status-flow__pill--contacted.status-flow__pill--active {
  background: #fffbeb;
  border-color: #fcd34d;
  color: var(--gold);
}
.status-flow__pill--follow-up.status-flow__pill--active {
  background: #fff7ed;
  border-color: #fdba74;
  color: var(--orange);
}
.status-flow__pill--quoted.status-flow__pill--active {
  background: #f5f3ff;
  border-color: #c4b5fd;
  color: var(--purple);
}
.status-flow__pill--won.status-flow__pill--active {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: var(--green);
}
.status-flow__pill--lost.status-flow__pill--active {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: var(--text-muted);
}

/* ========================================================================
   Components — Badges
   ======================================================================== */

/* Channel badge */
.channel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.channel-badge--a {
  background: var(--blue-light);
  color: var(--blue);
}

.channel-badge--b {
  background: var(--purple-light);
  color: var(--purple);
}

/* ========================================================================
   Markets Grid
   ======================================================================== */
.markets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.market-card__header {
  padding: 1.25rem 1.25rem 0.75rem;
}
.market-card__name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.market-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.market-card__stat {
  background: var(--bg-card);
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.market-card__stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.market-card__stat-value--text {
  font-size: 0.85rem;
  font-weight: 600;
}
.market-card__stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.market-card__footer {
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.market-card__footer-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.market-card__badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: #f3f4f6;
  color: var(--text-muted);
}

/* Source badge */
.source-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 500;
  background: #f3f4f6;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Role badge */
.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.role-badge--admin {
  background: var(--red-light);
  color: var(--red);
}

.role-badge--manager {
  background: var(--blue-light);
  color: var(--blue);
}

.role-badge--salesperson {
  background: var(--green-light);
  color: var(--green);
}


/* ========================================================================
   Utilities
   ======================================================================== */

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-sm { font-size: 0.82rem; }

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }


/* ========================================================================
   Responsive — Tablet / Mobile
   ======================================================================== */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .hamburger {
    display: block;
  }

  .lead-detail {
    grid-template-columns: 1fr;
  }

  .topbar-user .user-name {
    display: none;
  }

  .modal {
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
  }
}

@media (max-width: 640px) {
  /* Tables become stacked cards */
  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
  }

  .data-table tbody tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
  }

  .data-table tbody tr:nth-child(even) {
    background: var(--bg-card);
  }

  .data-table td {
    padding: 0.2rem 0;
    border-bottom: none;
    font-size: 0.82rem;
  }

  .data-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
  }

  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }

  .content {
    padding: 1rem;
  }

  .lead-detail__meta {
    grid-template-columns: 1fr;
  }

  .pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 400px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }
}
