@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   Lemnora CRM Design System & Theme Tokens
   Dominant: Light Green & Mint Palette (#059669 / #10b981 / #ecfdf5)
   Minimalist, high legibility, mobile-first responsive architecture
   ========================================================================== */

:root {
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-300: #6ee7b7;
  --primary-400: #34d399;
  --primary-500: #10b981;
  --primary-600: #059669;
  --primary-700: #047857;
  --primary-800: #065f46;
  --primary-900: #064e3b;
  
  --surface-bg: #f8fafc;
  --surface-card: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
}

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

html {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  color: var(--text-main);
  background-color: var(--surface-bg);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f8fafc;
}

/* Typography Utilities */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

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

/* Layout Utilities */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease-in-out;
  z-index: 40;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.top-bar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.content-wrapper {
  padding: 1.5rem;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* Navigation Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  transition: all 0.15s ease;
  margin-bottom: 0.25rem;
}

.nav-link:hover {
  background-color: #f1f5f9;
  color: #059669;
}

.nav-link.active {
  background-color: #ecfdf5;
  color: #059669;
  font-weight: 600;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Card Components */
.card {
  background: #ffffff;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 1.25rem;
}

/* KPI Stats Card */
.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  line-height: 1.25rem;
  text-decoration: none;
}

.btn-primary {
  background-color: #059669;
  color: #ffffff;
  border-color: #059669;
}

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

.btn-secondary {
  background-color: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

.btn-light-green {
  background-color: #ecfdf5;
  color: #059669;
  border-color: #d1fae5;
}

.btn-light-green:hover {
  background-color: #d1fae5;
}

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

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

.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  border-radius: 0.375rem;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.375rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background-color: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1;
}

.badge-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-warning { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-info { background-color: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-purple { background-color: #faf5ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.badge-danger { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-neutral { background-color: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

/* Responsive Grid System */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.custom-table th {
  padding: 0.75rem 1rem;
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
}

.custom-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background-color: #fbfdfe;
}

/* Kanban Board Columns */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-col {
  flex: 0 0 280px;
  background: #f8fafc;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}

.kanban-cards {
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.kanban-card {
  background: #ffffff;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  padding: 0.875rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
  cursor: pointer;
}

.kanban-card:hover {
  border-color: #10b981;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
}

/* Stage Progression Bar */
.progression-steps {
  display: flex;
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.progression-step {
  flex: 1;
  min-width: 140px;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.progression-step:last-child {
  border-right: none;
}

.progression-step.completed {
  background: #ecfdf5;
  color: #059669;
}

.progression-step.active {
  background: #059669;
  color: #ffffff;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: #ffffff;
  border-radius: 0.75rem;
  max-width: 540px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Mobile Sidebar Drawer */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 35;
    display: none;
  }
  
  .sidebar-overlay.active {
    display: block;
  }
}

/* Responsive Breakpoints */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Print Invoice & Quotation Formatting */
@media print {
  body {
    background: #ffffff !important;
  }
  .sidebar, .top-bar, .no-print, .btn {
    display: none !important;
  }
  .main-content, .content-wrapper {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
  .print-page {
    padding: 1.5cm !important;
  }
}
