/**
 * Pickleball Community Platform - App Styles
 * Apple-inspired, professional, brand-aligned
 */

/* ===== Theme Tokens (Brand) ===== */
:root {
  /* Neutral base - keep backgrounds soft */
  --color-bg: #F7F8FA;
  --color-bg-elevated: #FFFFFF;
  --color-bg-muted: #F2F4F7;
  --color-surface: #FFFFFF;
  --color-surface-2: #F2F4F7;
  --color-border: #E6EAF0;
  --color-border-strong: #D1D8E4;
  
  /* Text */
  --color-text: #0B1220;
  --color-text-secondary: #5B667A;
  --color-text-tertiary: #8B95A8;
  --color-muted: #5B667A;
  --color-text-inverse: #FFFFFF;
  
  /* Brand primary - Blue (from logo) */
  --color-primary: #0B63FF;
  --color-primary-600: #0A57E6;
  --color-primary-700: #0848C2;
  --color-primary-tint: rgba(11, 99, 255, 0.10);
  
  /* Brand accent - Gold (use sparingly) */
  --color-accent: #F4B400;
  --color-accent-700: #C89200;
  --color-accent-tint: rgba(244, 180, 0, 0.12);
  
  /* Semantic */
  --color-success: #059669;
  --color-success-bg: #d1fae5;
  --color-error: #dc2626;
  --color-error-bg: #fee2e2;
  --color-warning: #d97706;
  
  /* Focus */
  --focus-ring: 0 0 0 4px rgba(11, 99, 255, 0.18);
  
  /* Typography - San Francisco-like */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, monospace;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(11, 18, 32, 0.06), 0 2px 4px -2px rgba(11, 18, 32, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(11, 18, 32, 0.08), 0 4px 6px -4px rgba(11, 18, 32, 0.04);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  
  /* Layout */
  --nav-height: 56px;
  --nav-bottom-height: 64px;
  --content-max-width: 1200px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; vertical-align: middle; }

/* ===== Layout ===== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-main {
  flex: 1;
  padding: var(--space-4);
  padding-bottom: calc(var(--nav-bottom-height) + var(--space-4));
}
@media (min-width: 768px) {
  .app-main { padding-bottom: var(--space-4); }
}
.container { max-width: var(--content-max-width); margin: 0 auto; }

/* ===== Typography ===== */
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: var(--line-height-tight); }
h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; margin-bottom: var(--space-2); }
h2 { font-size: var(--text-xl); letter-spacing: -0.01em; margin-bottom: var(--space-2); }
h3 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
h4 { font-size: var(--text-base); margin-bottom: var(--space-2); }
p { margin: 0 0 var(--space-4); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-muted { color: var(--color-muted); }
.text-sm { font-size: var(--text-sm); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.5;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-600); }
.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.btn-secondary:hover:not(:disabled) { background: var(--color-border); }
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--color-bg-muted); }
.btn-destructive {
  background: var(--color-error);
  color: var(--color-text-inverse);
}
.btn-destructive:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-sm); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-lg); }
.btn-block { width: 100%; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn.active, .filter-cat.active, .filter-type.active {
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

/* ===== Inputs ===== */
.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
.form-input.is-invalid { border-color: var(--color-error); }
.form-error { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-error); }
.form-hint { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-text-tertiary); }

/* ===== Chips / Tags ===== */
.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
}
.chip-accent { background: var(--color-accent-tint); color: var(--color-accent-700); }
.badge {
  display: inline-flex;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--color-text-tertiary);
  color: var(--color-text-inverse);
}
.badge-success { background: var(--color-success); }
.badge-error { background: var(--color-error); }

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-normal);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: var(--space-4); }
.card-title { margin-bottom: var(--space-2); }
.card-image {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, var(--color-surface-2) 0%, var(--color-bg) 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}
.card-image .product-img,
.card-image .venue-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-image-venue {
  aspect-ratio: 16/9;
}
/* Product cards: 1:1, stronger contrast, overlay gradient */
.card-image-product {
  aspect-ratio: 1;
  position: relative;
  background: var(--color-text);
}
.card-image-product::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 18, 32, 0.35) 0%, transparent 50%);
  pointer-events: none;
}
.card-image-product .product-img {
  filter: contrast(1.05) brightness(0.98);
}

/* ===== List rows ===== */
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--color-surface-2); }

/* ===== Navigation ===== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.top-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  font-size: var(--text-base);
}
.top-nav-brand:hover { text-decoration: none; color: var(--color-primary); }
.brand-logo {
  height: 26px;
  width: auto;
  object-fit: contain;
}
.brand-name { white-space: nowrap; }
.top-nav-links {
  display: none;
  gap: var(--space-1);
}
@media (min-width: 768px) {
  .top-nav-links { display: flex; }
}
.top-nav-link {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast);
}
.top-nav-link:hover { color: var(--color-primary); }
.top-nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-tint);
}
.top-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--nav-bottom-height);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
@media (min-width: 768px) {
  .bottom-nav { display: none; }
}
.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2);
  font-size: 10px;
  color: var(--color-text-tertiary);
  text-decoration: none;
  border-radius: var(--radius-md);
  position: relative;
  transition: color var(--transition-fast);
}
.bottom-nav-link:hover { color: var(--color-primary); }
.bottom-nav-link.active {
  color: var(--color-primary);
}
.bottom-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
}
.bottom-nav-link svg { width: 24px; height: 24px; }

/* User menu */
.user-menu {
  position: relative;
}
.user-menu-trigger {
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
}
.user-menu-trigger:hover { color: var(--color-text); }
.user-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-2);
  min-width: 180px;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
}
.user-menu.open .user-menu-dropdown { display: block; }
.user-menu-dropdown a, .user-menu-dropdown button {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
}
.user-menu-dropdown a:hover, .user-menu-dropdown button:hover { background: var(--color-surface-2); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(11, 18, 32, 0.35);
  animation: fadeIn 0.2s ease;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}
.modal-popup {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.modal-title { font-size: var(--text-lg); margin: 0; }
.modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-tertiary);
  border-radius: var(--radius-md);
}
.modal-close:hover { color: var(--color-text); background: var(--color-surface-2); }
.modal-body { padding: var(--space-4); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-bottom-height) + var(--space-4));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}
@media (min-width: 768px) {
  .toast { bottom: var(--space-4); }
}
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--color-success); color: white; }
.toast-error { background: var(--color-error); color: white; }
.toast-info { background: var(--color-text); color: white; }

/* ===== Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-border) 50%, var(--color-surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 1em; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); }
.skeleton-card { height: 160px; }
.skeleton-list { height: 60px; }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Tabs ===== */
.tabs-header {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.tabs-header [role="tab"] {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
}
.tabs-header [role="tab"]:hover { color: var(--color-text); }
.tabs-header [role="tab"][aria-selected="true"] { color: var(--color-primary); }
.tabs-panel { padding: var(--space-4) 0; }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
}
.empty-state-icon {
  font-size: 3rem;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-4);
}
.empty-state-title { margin-bottom: var(--space-2); }
.empty-state-desc { color: var(--color-text-secondary); margin-bottom: var(--space-4); }

/* ===== Hero search ===== */
.hero-search {
  padding: var(--space-8) var(--space-4);
  background: linear-gradient(135deg, var(--color-primary-tint) 0%, var(--color-surface) 100%);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}
.hero-search h1 { margin-bottom: var(--space-4); }
.search-bar {
  display: flex;
  gap: var(--space-2);
  max-width: 480px;
}
.search-bar input { flex: 1; }

/* ===== Quick actions ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}
.quick-action:hover { border-color: var(--color-primary); background: var(--color-primary-tint); }
.quick-action-icon { font-size: 1.5rem; }

/* ===== Section ===== */
.section { margin-bottom: var(--space-8); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.section-title { margin: 0; }
.card-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Venue list table (desktop) ===== */
@media (min-width: 768px) {
  .venue-table {
    width: 100%;
    border-collapse: collapse;
  }
  .venue-table th, .venue-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
  }
  .venue-table th {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
  }
}

/* ===== Time slots ===== */
.time-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--space-2);
}
.time-slot {
  padding: var(--space-2);
  font-size: var(--text-sm);
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.time-slot:hover:not(.disabled) { border-color: var(--color-primary); background: var(--color-primary-tint); }
.time-slot.selected { border-color: var(--color-primary); background: var(--color-primary); color: white; }
.time-slot.disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Forms inline ===== */
.form-row { display: flex; gap: var(--space-4); }
.form-row .form-group { flex: 1; }

/* ===== Loading spinner ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn .spinner { margin-right: var(--space-2); }

/* ===== Login brand ===== */
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.login-brand .brand-logo {
  height: 48px;
  width: auto;
}

/* ===== Bottom nav brand mark (subtle) ===== */
.bottom-nav-brand {
  opacity: 0.5;
  pointer-events: none;
}
.bottom-nav-brand .brand-logo {
  height: 18px;
}

/* ===== Drawer ===== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  background: rgba(11, 18, 32, 0.35);
  animation: fadeIn 0.2s ease;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}
.drawer-panel {
  position: relative;
  height: 100%;
  background: var(--color-surface);
  box-shadow: -4px 0 20px rgba(11, 18, 32, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.drawer-overlay.drawer-open .drawer-panel {
  transform: translateX(0);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.drawer-title { font-size: var(--text-lg); margin: 0; }
.drawer-body { padding: var(--space-4); }

/* ===== Admin charts ===== */
.sparkline-svg { display: block; }
.line-chart { margin-top: var(--space-4); }
.chart-legend {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.chart-legend-item { display: flex; align-items: center; gap: var(--space-1); }
.chart-legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.donut-chart { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.donut-legend { font-size: var(--text-sm); color: var(--color-text-secondary); display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }
.donut-legend-item { display: flex; align-items: center; gap: var(--space-1); }
.donut-legend-dot { width: 6px; height: 6px; border-radius: 50%; }
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 14), 1fr);
  gap: 2px;
  margin-top: var(--space-2);
}
.heatmap-cell {
  aspect-ratio: 1;
  min-width: 12px;
  background: color-mix(in srgb, var(--color-primary) calc(var(--intensity, 0) * 40%), var(--color-surface-2));
  border-radius: 2px;
}

/* ===== Admin filter bar ===== */
.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}
.admin-filter-bar .form-group { margin-bottom: 0; }
.admin-filter-bar .form-select { min-width: 120px; }

/* ===== Admin KPI card with sparkline ===== */
.kpi-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}
.kpi-card-label { font-size: var(--text-sm); color: var(--color-text-secondary); }
.kpi-card-value { font-size: var(--text-2xl); font-weight: 600; }
.kpi-card-delta {
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.kpi-card-delta.positive { color: var(--color-success); }
.kpi-card-delta.negative { color: var(--color-error); }
.kpi-card-sparkline { margin-top: var(--space-1); }

/* ===== Admin table ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th, .admin-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.admin-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
}
.admin-table tbody tr { cursor: pointer; transition: background var(--transition-fast); }
.admin-table tbody tr:hover { background: var(--color-surface-2); }
.trend-up { color: var(--color-success); }
.trend-down { color: var(--color-error); }
.list-row.active, .segment-row.active { background: var(--color-primary-tint); }

/* ===== Modal wide (for Customer 360) ===== */
.modal-popup.modal-wide {
  max-width: 640px;
}

/* Admin dashboard responsive */
@media (max-width: 640px) {
  .admin-dashboard-grid-2 {
    grid-template-columns: 1fr !important;
  }
}

/* CRM layout - side by side on desktop */
@media (min-width: 768px) {
  .crm-layout {
    grid-template-columns: 260px 1fr !important;
  }
}
