/* Alora Dashboard v2 — Shared Design Tokens
 * Warm-modern editorial direction
 * Preserves the 10-color gradient group identity, refines typography + density
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Fraunces:opsz,wght@9..144,300..700&family=Poppins:wght@500;600;700&display=swap');

:root {
  /* Surfaces - neutral cool system (matches production dashboard) */
  --bg: #F1F5F9;
  --bg-subtle: #E2E8F0;
  --surface: #FFFFFF;
  --surface-hover: #F8FAFC;
  --border: #CBD5E1;
  --border-subtle: #E2E8F0;
  --border-strong: #94A3B8;

  /* Text - cool slate */
  --text: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --text-on-color: #FFFFFF;

  /* Brand */
  --primary: #0F766E;
  --primary-hover: #0D5F58;
  --primary-strong: #115E59;
  --primary-light: #5EEAD4;
  --primary-tint: #F0FDFA;

  /* Functional */
  --success: #15803D;
  --success-tint: #F0FDF4;
  --warning: #B45309;
  --warning-tint: #FFFBEB;
  --error: #B91C1C;
  --error-tint: #FEF2F2;
  --info: #0369A1;
  --info-tint: #F0F9FF;

  /* Group identity colors (used in nav, badges, stat tints) */
  --g-home-from: #4F46E5;   --g-home-to: #3B82F6;
  --g-people-from: #E11D48; --g-people-to: #EC4899;
  --g-giving-from: #059669; --g-giving-to: #22C55E;
  --g-events-from: #EA580C; --g-events-to: #F59E0B;
  --g-channels-from: #D97706; --g-channels-to: #FB923C;
  --g-imports-from: #C026D3; --g-imports-to: #A855F7;
  --g-automation-from: #0284C7; --g-automation-to: #3B82F6;
  --g-communications-from: #0891B2; --g-communications-to: #3B82F6;
  --g-settings-from: #52525B; --g-settings-to: #71717A;
  --g-mygiving-from: #DB2777; --g-mygiving-to: #F43F5E;

  /* Radii - measured */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-card: 12px;
  --radius-xl: 14px;
  --radius-2xl: 18px;

  /* Shadows - neutral slate-cast */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-medium: 0 2px 8px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.09);
  --shadow-large: 0 8px 24px rgba(15, 23, 42, 0.10), 0 24px 64px rgba(15, 23, 42, 0.12);
  --shadow-pop: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 16px 48px rgba(15, 23, 42, 0.20);
  --shadow-card: 0 1px 0 rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-size: 14px;
  line-height: 1.5;
}

/* Display font — used sparingly for hero, AI voice, large numeric */
.font-display {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  letter-spacing: -0.025em;
}
.font-wordmark {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.tabular { font-variant-numeric: tabular-nums; }

/* Card primitive */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card-flat {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

/* === Group gradients === full saturation, used on small accents */
.grad-home { background-image: linear-gradient(135deg, var(--g-home-from), var(--g-home-to)); }
.grad-people { background-image: linear-gradient(135deg, var(--g-people-from), var(--g-people-to)); }
.grad-giving { background-image: linear-gradient(135deg, var(--g-giving-from), var(--g-giving-to)); }
.grad-events { background-image: linear-gradient(135deg, var(--g-events-from), var(--g-events-to)); }
.grad-channels { background-image: linear-gradient(135deg, var(--g-channels-from), var(--g-channels-to)); }
.grad-imports { background-image: linear-gradient(135deg, var(--g-imports-from), var(--g-imports-to)); }
.grad-automation { background-image: linear-gradient(135deg, var(--g-automation-from), var(--g-automation-to)); }
.grad-communications { background-image: linear-gradient(135deg, var(--g-communications-from), var(--g-communications-to)); }
.grad-settings { background-image: linear-gradient(135deg, var(--g-settings-from), var(--g-settings-to)); }
.grad-mygiving { background-image: linear-gradient(135deg, var(--g-mygiving-from), var(--g-mygiving-to)); }

/* === Soft tints for stat cards, hover backgrounds === */
.tint-home { background: linear-gradient(160deg, rgba(79,70,229,0.07), rgba(59,130,246,0.02) 60%, transparent); }
.tint-people { background: linear-gradient(160deg, rgba(225,29,72,0.07), rgba(236,72,153,0.02) 60%, transparent); }
.tint-giving { background: linear-gradient(160deg, rgba(5,150,105,0.08), rgba(34,197,94,0.02) 60%, transparent); }
.tint-events { background: linear-gradient(160deg, rgba(234,88,12,0.07), rgba(245,158,11,0.02) 60%, transparent); }
.tint-channels { background: linear-gradient(160deg, rgba(217,119,6,0.07), rgba(251,146,60,0.02) 60%, transparent); }
.tint-imports { background: linear-gradient(160deg, rgba(192,38,211,0.07), rgba(168,85,247,0.02) 60%, transparent); }
.tint-automation { background: linear-gradient(160deg, rgba(2,132,199,0.07), rgba(59,130,246,0.02) 60%, transparent); }
.tint-communications { background: linear-gradient(160deg, rgba(8,145,178,0.07), rgba(59,130,246,0.02) 60%, transparent); }
.tint-settings { background: linear-gradient(160deg, rgba(82,82,91,0.06), rgba(113,113,122,0.02) 60%, transparent); }
.tint-mygiving { background: linear-gradient(160deg, rgba(219,39,119,0.07), rgba(244,63,94,0.02) 60%, transparent); }

/* === Text colors per group === */
.text-home { color: var(--g-home-from); }
.text-people { color: var(--g-people-from); }
.text-giving { color: var(--g-giving-from); }
.text-events { color: var(--g-events-from); }
.text-channels { color: var(--g-channels-from); }
.text-imports { color: var(--g-imports-from); }
.text-automation { color: var(--g-automation-from); }
.text-communications { color: var(--g-communications-from); }
.text-settings { color: var(--g-settings-from); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 36px;
  padding: 0 0.875rem;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
}
.btn-primary {
  background: var(--text);
  color: white;
  border-color: var(--text);
}
.btn-primary:hover {
  background: #292524;
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }
.btn-sm { height: 30px; padding: 0 0.625rem; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 1.125rem; font-size: 14px; }
.btn-icon { width: 36px; padding: 0; }

/* Brand-tinted button */
.btn-brand {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-brand:hover { background: var(--primary-hover); }

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem;
  font-size: 11px;
  font-weight: 500;
  border-radius: 9999px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  height: 22px;
}
.badge-dot::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-success { background: var(--success-tint); color: var(--success); }
.badge-warning { background: var(--warning-tint); color: var(--warning); }
.badge-error { background: var(--error-tint); color: var(--error); }
.badge-info { background: var(--info-tint); color: var(--info); }
.badge-neutral { background: var(--bg-subtle); color: var(--text-secondary); }

/* === Inputs === */
.input {
  height: 36px;
  padding: 0 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  transition: all 0.12s;
  font-family: inherit;
  width: 100%;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.10);
}
.input::placeholder { color: var(--text-subtle); }

/* === Sidebar nav === */
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.nav-group-stripe {
  width: 12px;
  height: 3px;
  border-radius: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  margin: 0 0.375rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text);
}
.nav-item.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
}
.nav-item-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

/* === Page header pattern (shell-owned) === */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}
.page-title {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.022em;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
}
.page-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

/* === Table === */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  white-space: nowrap;
}
.data-table th:first-child { border-top-left-radius: var(--radius-md); }
.data-table th:last-child { border-top-right-radius: var(--radius-md); }
.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13.5px;
}
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-md); }
.data-table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-md); }

/* === Avatar === */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

/* === Stripe (decorative top accents for cards) === */
.stripe-top {
  position: relative;
}
.stripe-top::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-top-left-radius: var(--radius-card);
  border-top-right-radius: var(--radius-card);
}

/* === Scrollbars === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.14); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.28); background-clip: padding-box; border: 2px solid transparent; }

/* === Focus === */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeIn 0.4s ease-out backwards; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.4); }
}
.live-dot { animation: pulse-dot 2s ease-in-out infinite; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* === Decorative grain texture for hero areas === */
.grain {
  position: relative;
  isolation: isolate;
}
.grain::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: 0.04;
  mix-blend-mode: multiply;
  border-radius: inherit;
}

/* === AI / Intelligence callout styling === */
.ai-callout {
  position: relative;
  overflow: hidden;
}
.ai-callout::before {
  content: '';
  position: absolute;
  top: -50%; right: -10%;
  width: 60%; height: 200%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.10), transparent 60%);
  pointer-events: none;
}

/* === Sidebar shell === */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  background: rgba(241, 245, 249, 0.82);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--border-subtle);
  height: 56px;
}
.main {
  padding: 0 1.75rem 3rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* Avatar palette - subtle warm hues, not garish */
.av-1 { background: linear-gradient(135deg, #F59E0B, #EA580C); }
.av-2 { background: linear-gradient(135deg, #EC4899, #DB2777); }
.av-3 { background: linear-gradient(135deg, #14B8A6, #0F766E); }
.av-4 { background: linear-gradient(135deg, #6366F1, #4338CA); }
.av-5 { background: linear-gradient(135deg, #84CC16, #65A30D); }
.av-6 { background: linear-gradient(135deg, #A855F7, #7E22CE); }
.av-7 { background: linear-gradient(135deg, #06B6D4, #0E7490); }
.av-8 { background: linear-gradient(135deg, #F43F5E, #E11D48); }

/* Utility shorthands */
.text-xs { font-size: 11.5px; }
.text-sm { font-size: 12.5px; }
.text-md { font-size: 13.5px; }
.text-lg { font-size: 15px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }
.text-3xl { font-size: 28px; }
.text-4xl { font-size: 36px; }
.text-5xl { font-size: 48px; }
