/* ═══════════════════════════════════════════════════════════
   WebSmitherz CRM — High-Performance Sales Cockpit Design System
   Aesthetic: Dark Tech Minimalist · Linear-Inspired · High Density
   Typography: Plus Jakarta Sans + Syne + JetBrains Mono
   ══════════════════════════════════════════════════════════ */

/* ── Typography Import ───────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Syne:wght@600;700;800&display=swap');

/* ── Design Tokens & Obsidian Palette ────────────────────── */
:root {
  /* Surface Layers (Deep Obsidian & Slate Matrix) */
  --bg:          #070A0F;
  --surface-1:   #0D121B;
  --surface-2:   #131A26;
  --surface-3:   #1A2333;
  --surface-4:   #232F42;
  
  /* Hairline Borders */
  --border:      rgba(255, 255, 255, 0.06);
  --border-2:    rgba(255, 255, 255, 0.10);
  --border-hover:rgba(119, 30, 229, 0.40);
  --border-focus:rgba(147, 51, 234, 0.60);

  /* Primary Brand Accent (Electric Purple) */
  --purple:      #771EE5;
  --purple-hi:   #9333EA;
  --purple-lo:   rgba(119, 30, 229, 0.12);
  --purple-glow: rgba(119, 30, 229, 0.35);

  /* Precise Semantic Data Palette */
  --green:       #10B981;
  --green-lo:    rgba(16, 185, 129, 0.10);
  --amber:       #F59E0B;
  --amber-lo:    rgba(245, 158, 11, 0.10);
  --red:         #EF4444;
  --red-lo:      rgba(239, 68, 68, 0.10);
  --blue:        #0EA5E9;
  --blue-lo:     rgba(14, 165, 233, 0.10);
  --teal:        #14B8A6;
  --teal-lo:     rgba(20, 184, 166, 0.10);

  /* Text & Hierarchy */
  --text:        #F8FAFC;
  --text-2:      #94A3B8;
  --text-3:      #64748B;
  --text-muted:  #475569;

  /* Layout Dimensions */
  --sidebar-w:   248px;
  --topbar-h:    58px;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-pill: 9999px;
}

/* ── Global Reset & Base Setup ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11'; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 13px/1.5 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; transition: color 0.15s ease; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

/* Display & Tabular Font Scopes */
h1, h2, h3, h4, .brand { font-family: 'Syne', sans-serif; }
.mono, .tabular, code, pre { font-family: 'JetBrains Mono', monospace; }

/* Refined Dark Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ── Topbar (Cockpit Navigation Chrome) ─────────────────── */
.top {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: rgba(7, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand span { color: var(--purple-hi); }
.brand-icon {
  width: 28px;
  height: 28px;
  background: var(--purple-lo);
  border: 1px solid rgba(119, 30, 229, 0.35);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-user {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

/* ── Layout & Sidebar ───────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

.side {
  background: rgba(13, 18, 27, 0.50);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.side-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 14px 12px 6px;
  font-family: 'JetBrains Mono', monospace;
}
.side-label:first-child { padding-top: 2px; }

.side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.side a:hover {
  background: var(--surface-2);
  color: var(--text);
  transform: translateX(2px);
}
.side a.active {
  background: var(--purple-lo);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(119, 30, 229, 0.25);
  box-shadow: inset 0 0 12px rgba(119, 30, 229, 0.15);
}
.nav-icon { font-size: 14px; width: 18px; text-align: center; }

.side-backup {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* ── Main Content Area ──────────────────────────────────── */
.main {
  padding: 28px 32px;
  min-width: 0;
  background: radial-gradient(circle at 50% 0%, rgba(119, 30, 229, 0.04) 0%, transparent 60%);
}

/* ── Page Header ────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.2;
}
.page-header .subtitle {
  color: var(--text-3);
  font-size: 12.5px;
  margin-top: 4px;
}

/* ── Flash Notifications ────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--green-lo);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 12.5px;
  color: #86EFAC;
  animation: fadeIn 0.2s ease;
}
.flash::before { content: '✓'; color: var(--green); font-weight: 800; }
.flash.error { background: var(--red-lo); border-color: rgba(239, 68, 68, 0.25); color: #FCA5A5; }
.flash.error::before { content: '✗'; color: var(--red); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Buttons & Micro-Tactile Physics ────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: 600 11.5px/1 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.btn:active {
  transform: scale(0.97) translateY(1px);
}
.btn.primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.btn.primary:hover {
  background: var(--purple-hi);
  border-color: var(--purple-hi);
  box-shadow: 0 6px 20px -2px var(--purple-glow);
  transform: translateY(-1px);
}
.btn.success { background: var(--green-lo); border-color: rgba(16, 185, 129, 0.3); color: #86EFAC; }
.btn.success:hover { background: rgba(16, 185, 129, 0.2); }
.btn.danger  { background: var(--red-lo); border-color: rgba(239, 68, 68, 0.3); color: #FCA5A5; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn.ghost   { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: #fff; border-color: var(--border); }
.btn.small   { padding: 5px 10px; font-size: 10.5px; }
.btn.large   { padding: 11px 22px; font-size: 12.5px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Forms & Input Fields ───────────────────────────────── */
.input, .select, .textarea {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  font: 400 13px/1.5 'Plus Jakarta Sans', sans-serif;
  transition: all 0.2s ease;
  width: 100%;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--purple-hi);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(119, 30, 229, 0.15);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.textarea { min-height: 100px; resize: vertical; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}
.field-hint { font-size: 11px; color: var(--text-muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field.full { grid-column: 1 / -1; }

/* ── Toolbar ────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: rgba(13, 18, 27, 0.4);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.toolbar .input { min-width: 200px; max-width: 280px; }
.toolbar .select { min-width: 130px; }

/* ── Metric Cards Grid (Cockpit KPIs) ───────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 1024px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: block;
}
.card:hover { border-color: var(--border-2); background: var(--surface-2); }
a.card:hover {
  border-color: rgba(119, 30, 229, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px rgba(119, 30, 229, 0.25);
}

.card.accent-green  { border-top: 2px solid var(--green); }
.card.accent-purple { border-top: 2px solid var(--purple); }
.card.accent-amber  { border-top: 2px solid var(--amber); }
.card.accent-blue   { border-top: 2px solid var(--blue); }

.metric {
  font-size: 28px;
  font-weight: 800;
  font-family: 'Syne', sans-serif;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #fff;
}
.metric-label {
  color: var(--text-3);
  font-size: 10.5px;
  margin-top: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Data Tables ────────────────────────────────────────── */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font: 700 10px/1 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 12.5px;
}
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: rgba(19, 26, 38, 0.7); }

.company {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  transition: color 0.15s ease;
}
.company:hover { color: var(--purple-hi); }
.sub {
  color: var(--text-3);
  font-size: 11px;
  margin-top: 2px;
}

/* ── Status Pills & Badges ──────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font: 700 10px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border-2);
}
.pill.qual    { background: rgba(119, 30, 229, 0.12); color: #D8B4FE; border-color: rgba(119, 30, 229, 0.25); }
.pill.won     { background: var(--green-lo);           color: #86EFAC; border-color: rgba(16, 185, 129, 0.25); }
.pill.cold    { background: var(--blue-lo);            color: #7DD3FC; border-color: rgba(14, 165, 233, 0.25); }
.pill.warm    { background: var(--amber-lo);           color: #FDE68A; border-color: rgba(245, 158, 11, 0.25); }
.pill.hot     { background: var(--red-lo);             color: #FCA5A5; border-color: rgba(239, 68, 68, 0.25); }
.pill.danger  { background: var(--red-lo);             color: #FCA5A5; border-color: rgba(239, 68, 68, 0.25); }
.pill.success { background: var(--green-lo);           color: #86EFAC; border-color: rgba(16, 185, 129, 0.25); }
.pill.new     { background: var(--teal-lo);            color: #5EEAD4; border-color: rgba(20, 184, 166, 0.25); }

/* ── Score Badges ───────────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  font: 700 11px/1 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
}
.score-badge.high   { background: var(--green-lo); color: #86EFAC; border: 1px solid rgba(16, 185, 129, 0.3); }
.score-badge.medium { background: var(--amber-lo); color: #FDE68A; border: 1px solid rgba(245, 158, 11, 0.3); }
.score-badge.low    { background: var(--red-lo);   color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.3); }

/* ── Section Dividers & Headers ────────────────────────── */
.section {
  margin-top: 32px;
  margin-bottom: 24px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.section-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.section-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

/* ── Notices & Callouts ─────────────────────────────────── */
.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 12.5px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: var(--surface-1);
}
.notice-icon { font-size: 16px; }
.notice.info {
  background: var(--blue-lo);
  border-color: rgba(14, 165, 233, 0.25);
  color: #BAE6FD;
}
.notice.warn {
  background: var(--amber-lo);
  border-color: rgba(245, 158, 11, 0.25);
  color: #FDE68A;
}

/* ── Activity Timeline & List Items ─────────────────────── */
.item {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease;
}
.item:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.flex-between b {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.muted {
  color: var(--text-3);
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Empty States ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.empty-state-icon { font-size: 32px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.empty-state p { color: var(--text-3); font-size: 13px; max-width: 400px; margin: 0 auto 16px; }

/* ── Interactive Modals ─────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(7, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease;
}

