@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Colors */
  --primary: #0075de;
  --primary-active: #005bab;
  --secondary: #213183;
  --on-primary: #ffffff;
  --canvas: #ffffff;
  --canvas-soft: #f6f5f4;
  --surface: #ffffff;
  --ink: #000000;
  --ink-secondary: #31302e;
  --ink-muted: #615d59;
  --ink-faint: #a39e98;
  --hairline: #e6e6e6;
  
  /* Decorative Sticker Palette */
  --accent-sky: #62aef0;
  --accent-purple: #d6b6f6;
  --accent-purple-deep: #391c57;
  --accent-pink: #ff64c8;
  --accent-orange: #dd5b00;
  --accent-orange-deep: #793400;
  --accent-teal: #2a9d99;
  --accent-green: #1aae39;
  --accent-brown: #523410;
  
  /* Border Radius */
  --rounded-xs: 4px;
  --rounded-sm: 5px;
  --rounded-md: 8px;
  --rounded-lg: 12px;
  --rounded-xl: 16px;
  --rounded-full: 9999px;
  
  /* Spacing */
  --spacing-xxs: 4px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 28px;
  --spacing-xxl: 32px;

  /* Elevation Shadows */
  --shadow-flat: none;
  --shadow-soft: 0 0.175px 1.041px rgba(0,0,0,0.01), 0 0.8px 2.925px rgba(0,0,0,0.02), 0 2.025px 7.847px rgba(0,0,0,0.027), 0 4px 18px rgba(0,0,0,0.04);
  --shadow-elevated: 0 1px 3px rgba(0,0,0,0.02), 0 6px 16px rgba(0,0,0,0.03), 0 12px 28px rgba(0,0,0,0.04), 0 23px 52px rgba(0,0,0,0.05);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--canvas-soft);
  color: var(--ink-secondary);
  font-size: 15px;
  line-height: 1.5;
}

/* Typography Classes */
.display-1 {
  font-size: 64px;
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -2.125px;
  color: var(--ink);
}

.display-2 {
  font-size: 54px;
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -1.875px;
  color: var(--ink);
}

.heading-1 {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--ink);
}

.heading-2 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.23;
  letter-spacing: -0.625px;
  color: var(--ink);
}

.heading-3 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.27;
  letter-spacing: -0.25px;
  color: var(--ink);
}

.title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.125px;
  color: var(--ink);
}

.body-md {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}

.body-sm {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.33;
  letter-spacing: 0;
}

.button-text {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
}

.caption {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: 0;
  color: var(--ink-muted);
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.33;
  letter-spacing: 0.125px;
  text-transform: uppercase;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background-color: var(--surface);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--spacing-md) 0;
}

.sidebar-header {
  padding: 0 var(--spacing-md) var(--spacing-md);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--spacing-md);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.sidebar-brand svg {
  color: var(--primary);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--rounded-full);
  background-color: var(--canvas-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--primary);
  border: 1px solid var(--hairline);
}

.sidebar-profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-profile-name {
  font-weight: 600;
  color: var(--ink-secondary);
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-profile-role {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--spacing-xs);
  flex-grow: 1;
}

.sidebar-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 8px var(--spacing-sm);
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--rounded-sm);
  transition: background-color 0.1s ease;
}

.sidebar-row:hover {
  background-color: var(--canvas-soft);
}

.sidebar-row.active {
  background-color: var(--canvas-soft);
  color: var(--ink);
  font-weight: 600;
  position: relative;
}

.sidebar-row.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background-color: var(--primary);
  border-radius: 0 var(--rounded-xs) var(--rounded-xs) 0;
}

.sidebar-footer {
  padding: var(--spacing-md);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.main-content {
  flex-grow: 1;
  padding: var(--spacing-xxl);
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Page Header & Filtering */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
}

.page-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.page-title h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.filter-bar {
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-xl);
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

/* Card Components */
.feature-card {
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-lg);
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: transparent;
}

.feature-card.sticker-sky::before { background-color: var(--accent-sky); }
.feature-card.sticker-purple::before { background-color: var(--accent-purple); }
.feature-card.sticker-pink::before { background-color: var(--accent-pink); }
.feature-card.sticker-orange::before { background-color: var(--accent-orange); }
.feature-card.sticker-teal::before { background-color: var(--accent-teal); }
.feature-card.sticker-green::before { background-color: var(--accent-green); }

.feature-card-elevated {
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-soft);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--spacing-xs);
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
}

/* Grid Layouts */
.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
}

.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-lg);
}

@media (max-width: 900px) {
  .grid-cols-3, .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
}

/* Tables & Lists */
.data-table-container {
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-lg);
  overflow: hidden;
  margin-bottom: var(--spacing-xl);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background-color: var(--canvas-soft);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--hairline);
}

.data-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-secondary);
  font-size: 14px;
}

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

.data-table tr:hover td {
  background-color: var(--canvas-soft);
}

/* Form Primitives */
.form-group {
  margin-bottom: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xxs);
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.text-input {
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-xs);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

.text-input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-row label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
}

/* Button Variants */
.button-primary {
  background-color: var(--primary);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--rounded-full);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.button-primary:hover {
  background-color: var(--primary-active);
}

.button-primary:active {
  transform: scale(0.97);
}

.button-secondary {
  background-color: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--rounded-full);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  text-decoration: none;
  transition: background-color 0.1s ease, transform 0.1s ease;
}

.button-secondary:hover {
  background-color: var(--canvas-soft);
}

.button-secondary:active {
  transform: scale(0.97);
}

.button-utility {
  background-color: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--rounded-md);
  border: 1px solid var(--hairline);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xxs);
  text-decoration: none;
  transition: background-color 0.1s ease;
}

.button-utility:hover {
  background-color: var(--canvas-soft);
}

/* Badges & Status Pills */
.badge-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--rounded-full);
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

/* Lead Status Badges */
.badge-lead-new { background-color: #e3f2fd; color: #0d47a1; }
.badge-lead-contacted { background-color: #fff3e0; color: #e65100; }
.badge-lead-qualified { background-color: #e8f5e9; color: #1b5e20; }
.badge-lead-lost { background-color: #ffebee; color: #b71c1c; }

/* Contact Status Badges */
.badge-status-active { background-color: #e8f5e9; color: #2e7d32; }
.badge-status-inactive { background-color: #eceff1; color: #37474f; }

/* Bill Status Badges */
.badge-bill-draft { background-color: #eceff1; color: #455a64; }
.badge-bill-sent { background-color: #e3f2fd; color: #1565c0; }
.badge-bill-paid { background-color: #e8f5e9; color: #2e7d32; }
.badge-bill-overdue { background-color: #ffebee; color: #c62828; }
.badge-bill-cancelled { background-color: #f5f5f5; color: #757575; }

/* Project Status Badges */
.badge-project-planning { background-color: #f3e5f5; color: #4a148c; }
.badge-project-active { background-color: #e8f5e9; color: #1b5e20; }
.badge-project-completed { background-color: #e3f2fd; color: #0d47a1; }
.badge-project-paused { background-color: #fffde7; color: #f57f17; }
.badge-project-cancelled { background-color: #eceff1; color: #263238; }

/* Task Priority Badges */
.badge-priority-low { background-color: #f5f5f5; color: #616161; }
.badge-priority-medium { background-color: #e3f2fd; color: #1976d2; }
.badge-priority-high { background-color: #fff3e0; color: #e65100; }
.badge-priority-urgent { background-color: #ffebee; color: #c62828; }

/* Modal Cards */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  background-color: var(--surface);
  border-radius: var(--rounded-lg);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-elevated);
  width: 500px;
  max-width: 95%;
  overflow: hidden;
}

.modal-header {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: var(--spacing-lg);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
}

/* Kanban Board Layout (Tasks) */
.kanban-board {
  display: flex;
  gap: var(--spacing-lg);
  overflow-x: auto;
  padding-bottom: var(--spacing-md);
  align-items: flex-start;
}

.kanban-column {
  flex: 1;
  min-width: 280px;
  background-color: var(--canvas-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-lg);
  padding: var(--spacing-md);
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.kanban-column-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.kanban-column-count {
  background-color: var(--hairline);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--rounded-full);
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.kanban-card {
  background-color: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  padding: var(--spacing-md);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  cursor: grab;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.kanban-card:hover {
  box-shadow: var(--shadow-soft);
}

.kanban-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--spacing-xs);
}

.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--spacing-sm);
  font-size: 12px;
  color: var(--ink-muted);
}
