/* Enhanced style.css - Keeping current design + Zoho/Salesforce button improvements */
:root {
  --primary-color: #0070d2;
  --primary-hover: #005fb2;
  --secondary-color: #f4f6f9;
  --success-color: #04844B;
  --success-hover: #036639;
  --danger-color: #EA001E;
  --danger-hover: #c4001a;
  --warning-color: #FFB75D;
  --info-color: #0176D3;
  --border-color: #d2d6dc;
  --bg-light: #ffffff;
  --text-dark: #1a202c;
  --text-gray: #718096;
  --shadow: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --padding-sm: 8px;
  --padding-md: 16px;
  --padding-lg: 24px;
  /* funnel extra variables */
  --gray-50: #fafbfc;
  --gray-100: #f4f6f9;
  --gray-200: #e8ecef;
  --gray-600: #5a6c7d;
  --gray-800: #2b3640;
  --shadow-elevated: 0 12px 24px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: url('https://images.unsplash.com/photo-1557804506-669a67965ba0?w=800&q=80') center/cover no-repeat fixed;
  margin: 0;
  padding: 12px;
  color: var(--text-dark);
  min-height: 100vh;
  position: relative;
  line-height: 1.5;
  font-size: 14px;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  z-index: 0;
  pointer-events: none;
}

.container {
  max-width: 1200px;
  margin: auto;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary-color);
  gap: 12px;
  flex-wrap: wrap;
}

.header-left { flex: 1 1 auto; min-width: 0; }

#appTitle { font-weight: 700; color: var(--primary-color); margin: 0; font-size: clamp(18px, 4vw, 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; white-space: nowrap; }

.profile-pill { display: flex; align-items: center; gap: 10px; background: rgba(99, 102, 241, 0.04); border-radius: 12px; padding: 6px 12px; box-shadow: 0 2px 8px rgba(6, 8, 15, 0.04); }
.profile-left { display: flex; align-items: center; gap: 8px; padding-right: 10px; border-right: 1px solid rgba(99, 102, 241, 0.08); }
.profile-actions { display: flex; gap: 6px; align-items: center; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background-color: var(--primary-color); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
#userName { font-size: 14px; font-weight: 500; color: #334155; }

.pill-btn { background: #fff; border: 1px solid rgba(0, 0, 0, 0.06); padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; color: #0f172a; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s ease; min-height: 32px; }
.pill-btn:hover { background: #f3f4f6; border-color: #9ca3af; transform: translateY(-1px); }
.pill-outline { background: #eef2ff; border: 1px solid rgba(99, 102, 241, 0.24); color: #4c51bf; }

.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; display: inline-block; flex-shrink: 0; }
#statusIndicator { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px; background: #f8f9fa; border: 1px solid #e6e9ef; color: #334155; font-size: 13px; font-weight: 500; min-height: 32px; }
.status-online { background: #f0fdf4; color: #065f46; border-color: #86efac; }
.status-offline { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.status-syncing { background: #eff6ff; color: #2563eb; border-color: #93c5fd; }
#syncIcon { animation: spin 1.4s linear infinite; font-size: 14px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.last-sync { color: #6b7280; font-size: 12px; margin-left: 4px; }

#forceSyncBtn { background: var(--success-color); color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; min-height: 32px; transition: all 0.2s ease; }
#forceSyncBtn:hover { background: var(--success-hover); transform: translateY(-1px); }

/* Typography */
h1 { font-weight: 700; color: var(--primary-color); margin: 0; font-size: clamp(18px, 4vw, 24px); }
h2 { font-weight: 600; color: #1f2937; margin-bottom: 16px; font-size: clamp(16px, 3vw, 20px); }

/* KPI / Dashboard layout */
.dashboard-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { background: #fff; border: 1px solid var(--border-color); padding: 12px; border-radius: 8px; box-shadow: 0 2px 8px rgba(6,8,15,0.03); min-height: 78px; }
.summary-card h3 { font-size: 13px; font-weight: 600; color: var(--text-gray); margin: 0 0 8px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.summary-card p { font-size: 24px; font-weight: 700; margin: 0; color: var(--text-dark); }
.kpi-value { font-size: 20px; font-weight: 700; margin: 6px 0; }
.kpi-sub { font-size: 12px; color: var(--text-gray); }

/* Charts grid */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 16px; }
.chart-card { background: #fff; border: 1px solid var(--border-color); padding: 12px; border-radius: 8px; box-shadow: 0 2px 8px rgba(6,8,15,0.03); }

/* Tables grid */
.tables-grid { display: grid; grid-template-columns: 1fr 400px; gap: 12px; }

/* Forms */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; }
label { display: block; margin-bottom: 6px; font-weight: 600; color: #4b5563; font-size: 13px; }
input, select, textarea { width: 100%; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border-color); transition: all 0.2s; font-size: 14px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 112, 210, 0.1); }
.error-message { font-size: 12px; color: var(--danger-color); margin-top: 4px; }

/* ===== ENHANCED BUTTONS (Zoho/Salesforce Style) ===== */
button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.4;
}

/* Primary Button - Main actions */
.btn-primary, button:not([class*="btn-"]):not(.tab):not(.auth-tab):not(.close):not(.pill-btn):not([id*="logout"]):not([id*="Settings"]) {
  background: linear-gradient(to bottom, var(--primary-color), var(--primary-hover));
  color: white;
  border-color: var(--primary-hover);
  box-shadow: 0 1px 3px rgba(0, 112, 210, 0.2);
}

.btn-primary:hover:enabled, button:not([class*="btn-"]):not(.tab):not(.auth-tab):not(.close):not(.pill-btn):not([id*="logout"]):not([id*="Settings"]):hover:enabled {
  background: linear-gradient(to bottom, var(--primary-hover), #004a8f);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 112, 210, 0.3);
}

/* Success Button - Confirm/Save actions */
.btn-success {
  background: linear-gradient(to bottom, var(--success-color), var(--success-hover));
  color: white;
  border-color: var(--success-hover);
  box-shadow: 0 1px 3px rgba(4, 132, 75, 0.2);
}

.btn-success:hover:enabled {
  background: linear-gradient(to bottom, var(--success-hover), #025730);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(4, 132, 75, 0.3);
}

/* Danger Button - Delete/Destructive actions */
.btn-danger {
  background: linear-gradient(to bottom, var(--danger-color), var(--danger-hover));
  color: white;
  border-color: var(--danger-hover);
  box-shadow: 0 1px 3px rgba(234, 0, 30, 0.2);
}

.btn-danger:hover:enabled {
  background: linear-gradient(to bottom, var(--danger-hover), #a00016);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(234, 0, 30, 0.3);
}

/* Secondary Button - Cancel/Alternative actions */
.btn-secondary {
  background: white;
  color: #374151;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-secondary:hover:enabled {
  background: #f9fafb;
  border-color: #9ca3af;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Icon Button - Small action buttons */
.btn-icon {
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 4px;
  background: white;
  color: #6b7280;
  border: 1px solid var(--border-color);
  font-size: 16px;
}

.btn-icon:hover:enabled {
  background: #f3f4f6;
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

/* Button Groups */
.button-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.button-group button {
  margin: 0;
}

/* Disabled State */
button:disabled {
  background: #e5e7eb !important;
  color: #9ca3af !important;
  border-color: #d1d5db !important;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.6;
}

/* Loading State */
button.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

button.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

/* Quick Action Buttons */
.quick-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  min-height: auto;
  font-size: 16px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-btn:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 12px; display: block; overflow-x: auto; white-space: nowrap; font-size: 13px; }
th, td { padding: 10px 8px; border: 1px solid var(--border-color); text-align: center; }
th { background: #f9fafb; font-weight: 700; color: #374151; font-size: 13px; text-transform: uppercase; letter-spacing: 0.025em; cursor: pointer; user-select: none; position: relative; }
th:hover { background: #f3f4f6; }
th.sortable::after { content: '⇅'; position: absolute; right: 8px; opacity: 0.3; font-size: 10px; }
th.sort-asc::after { content: '↑'; opacity: 1; }
th.sort-desc::after { content: '↓'; opacity: 1; }
.right { text-align: right; }
td input { margin: 0; width: 100%; box-sizing: border-box; }
tr:hover { background: #f9fafb; }

/* Status Badges */
.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

.status-paid { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.status-partial { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.status-pending { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.status-overdue { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.status-quotation { background: #e0e7ff; color: #4338ca; border: 1px solid #a5b4fc; }
.status-ok { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.status-low-stock { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.status-out-of-stock { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.status-active { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.status-inactive { background: #f3f4f6; color: #4b5563; border: 1px solid #d1d5db; }
.status-vip { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* Priority Badges */
.priority-high { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; padding: 4px 8px; border-radius: 12px; font-weight: 600; font-size: 11px; }
.priority-medium { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; padding: 4px 8px; border-radius: 12px; font-weight: 600; font-size: 11px; }
.priority-low { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; padding: 4px 8px; border-radius: 12px; font-weight: 600; font-size: 11px; }

/* Tag Badges */
.tag-badge {
  background: #e5e7eb;
  color: #374151;
  padding: 3px 8px;
  border-radius: 12px;
  margin-right: 4px;
  font-size: 11px;
  font-weight: 500;
  display: inline-block;
}

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--border-color); flex-wrap: wrap; }
.tab { padding: 8px 16px; cursor: pointer; border: none; background: none; color: var(--text-gray); font-weight: 500; font-size: 14px; border-bottom: 3px solid transparent; transition: all 0.2s; margin: 0; min-height: auto; }
.tab:hover { color: var(--primary-color); background: rgba(0, 112, 210, 0.05); }
.tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); background: rgba(0, 112, 210, 0.08); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Modals */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.4); align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background-color: #fefefe; margin: auto; padding: 24px; border: 1px solid #888; width: 90%; max-width: 600px; border-radius: 8px; box-shadow: var(--shadow-elevated); max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--border-color); }
.modal-header h2 { margin: 0; font-size: 20px; }
.close { color: #aaa; font-size: 28px; font-weight: bold; cursor: pointer; line-height: 1; border: none; background: none; padding: 0; min-height: auto; transition: color 0.2s; }
.close:hover, .close:focus { color: #000; }

/* Auth */
.auth-container { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: url('https://images.unsplash.com/photo-1557804506-669a67965ba0?w=1920&q=80') center/cover no-repeat fixed; z-index: 10000; }
.auth-container::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.4); }
.auth-container.show { display: flex; align-items: center; justify-content: center; }
.auth-box { background: rgba(255,255,255,0.98); backdrop-filter: blur(10px); padding: 32px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 90%; max-width: 420px; text-align: center; position: relative; z-index: 1; animation: fadeInUp 0.3s ease-out; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px);} to { opacity: 1; transform: translateY(0);} }
.auth-box h2 { color: var(--primary-color); margin-bottom: 8px; font-size: 22px; }
.auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 2px solid var(--border-color); }
.auth-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; background: none; border: none; border-bottom: 3px solid transparent; color: var(--text-gray); font-weight: 500; transition: all 0.2s; }
.auth-tab.active { border-bottom-color: var(--primary-color); color: var(--primary-color); font-weight: 600; }
.auth-form { display: none; }
.auth-form.active { display: block; }
.input-group { position: relative; margin-bottom: 12px; }
.auth-input { width: 100%; padding: 12px; padding-right: 45px; border-radius: 6px; border: 1px solid var(--border-color); font-size: 14px; }
.password-toggle-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px 8px; opacity: 0.6; transition: opacity 0.2s; z-index: 10; }
.password-toggle-btn:hover { opacity: 1; }
.auth-btn { width: 100%; background: var(--primary-color); color: white; padding: 12px; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.auth-btn:hover { background: var(--primary-hover); }
.auth-link { color: var(--primary-color); cursor: pointer; text-decoration: none; font-size: 14px; }
.auth-link:hover { text-decoration: underline; }
.auth-message { min-height: 20px; padding: 8px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
.auth-error { background: #fee2e2; color: #991b1b; }
.auth-success { background: #d1fae5; color: #065f46; }
.checkbox-group { display: flex; align-items: center; gap: 8px; margin-bottom: 15px; justify-content: flex-start; }
.checkbox-group input[type="checkbox"] { width: auto; margin: 0; }
.checkbox-group label { font-size: 13px; margin: 0; font-weight: 400; }
.password-strength { height: 4px; background: #ddd; margin-bottom: 5px; border-radius: 2px; overflow: hidden; }
.password-strength-bar { height: 100%; width: 0; transition: width 0.3s, background 0.3s; background: #ef4444; }
.strength-text { font-size: 12px; margin-bottom: 12px; text-align: left; }

/* Preview Panel */
#previewPanel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100%;
  background: var(--bg-light);
  box-shadow: -4px 0 12px rgba(0,0,0,0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 100;
  overflow-y: auto;
  padding: var(--padding-md);
}

#previewPanel.open {
  transform: translateX(0);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

/* Timeline */
.timeline {
  max-width: 100%;
  margin: 20px 0;
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  width: 2px;
  background: var(--border-color);
  top: 0;
  bottom: 0;
  left: 6px;
}

.timeline-item {
  position: relative;
  padding-left: 20px;
  margin-bottom: 15px;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary-color);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-item p {
  margin: 0;
  font-size: 13px;
  color: var(--text-gray);
}

/* Loader */
#loader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: none; align-items: center; justify-content: center; z-index: 9999; }
.spinner { border: 4px solid rgba(0,0,0,0.1); border-top: 4px solid var(--primary-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 6px;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
  min-width: 250px;
  max-width: 400px;
}

@keyframes slideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid var(--success-color); }
.toast.error { border-left: 4px solid var(--danger-color); }
.toast.info { border-left: 4px solid var(--info-color); }
.toast.warning { border-left: 4px solid var(--warning-color); }

/* Responsive */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .tables-grid { grid-template-columns: 1fr; }
  #previewPanel { width: 100%; max-width: 400px; }
}

@media (max-width: 768px) {
  .container { padding: 12px; }
  .tabs { flex-direction: column; gap: 0; }
  .tab { border-bottom: 1px solid var(--border-color); }
  .form-row { grid-template-columns: 1fr; }
  .header { flex-direction: column; align-items: flex-start; }
  .header-right { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .profile-pill { width: 100%; justify-content: space-between; }
  #userName { display: none; }
  .last-sync { display: none; }
  .dashboard-summary { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 12px; }
  th, td { padding: 6px 4px; }
  button { font-size: 13px; padding: 7px 12px; min-height: 34px; }
  .button-group { width: 100%; }
  .button-group button { flex: 1; }
  #previewPanel { width: 100%; }
}

/* Funnel Board (CRM) */
.funnel-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 24px;
  min-height: 520px;
  background: var(--gray-50);
  border-radius: 8px;
}

.funnel-column {
  background: white;
  border-radius: 12px;
  padding: 0;
  min-width: 300px;
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  max-height: 700px;
}

.funnel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  background: linear-gradient(to bottom, #fafbfc, #ffffff);
  border-radius: 12px 12px 0 0;
}

.funnel-cards {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.case-card {
  background: white;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  cursor: grab;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}

.case-card.dragging { opacity: 0.6; transform: scale(0.995); cursor: grabbing; }
.case-card:hover { box-shadow: var(--shadow-md); }

.case-title { font-weight: 700; font-size: 14px; color: var(--text-dark); margin-bottom: 4px; }
.case-company { color: var(--text-gray); font-size: 13px; margin-top: 6px; }
.case-value { font-weight: 800; color: var(--success-color); margin-top: 8px; font-size: 15px; }

.funnel-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }

.funnel-stat-card { background: white; padding: 16px; border-radius: 10px; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.funnel-stat-label { font-size: 12px; color: var(--text-gray); font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.funnel-stat-value { font-size: 22px; font-weight: 800; color: var(--text-dark); }

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    --bg-light: #1a202c;
    --text-dark: #f7fafc;
    --secondary-color: #2d3748;
    --border-color: #4a5568;
  }
}

/* Print Styles */
@media print {
  .header, .tabs, button, .modal { display: none !important; }
  .container { box-shadow: none; padding: 0; }
  body { background: white; }
}
/* ===== SALESFORCE-STYLE SYSTEM BUTTONS ===== */
/* Inventory buttons - Match system standard (28px) */
#addInventoryBtn,
#addSupplierBtn,
#manageSuppliersBtn,
#addCustomerBtn,
#addCustomerBtnTop,
#addCustomerBtnService {
  height: 28px !important;
  padding: 0 12px !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 26px !important;
  border: 1px solid #c9c9c9 !important;
  border-radius: 4px !important;
  background: #ffffff !important;
  color: #080707 !important;
  cursor: pointer !important;
  transition: all 0.1s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: none !important;
}

#addInventoryBtn:hover,
#addSupplierBtn:hover,
#manageSuppliersBtn:hover {
  background: #f4f6f9 !important;
  border-color: #aeaeae !important;
}

#addInventoryBtn:active,
#addSupplierBtn:active,
#manageSuppliersBtn:active {
  background: #eef1f6 !important;
  border-color: #959595 !important;
}

/* ===== DRAG & DROP STYLES ===== */
.funnel-cards.drag-over {
  background: rgba(59, 130, 246, 0.1) !important;
  border: 2px dashed #3b82f6 !important;
  border-radius: 8px;
}

.case-card.dragging {
  opacity: 0.5 !important;
  transform: rotate(2deg) !important;
  cursor: grabbing !important;
}

.case-card {
  transition: all 0.2s ease !important;
  cursor: grab !important;
}

.case-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  transform: translateY(-2px) !important;
}

.case-card:active {
  cursor: grabbing !important;
}

.case-card .quick-btn {
  min-height: 28px !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  transition: all 0.2s ease !important;
}

.case-card .quick-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.case-edit-btn:hover {
  background: #2563eb !important;
}

.case-delete-btn:hover {
  background: #dc2626 !important;
}

.funnel-column {
  min-height: 400px !important;
  max-height: 650px !important;
}

.funnel-cards {
  min-height: 300px !important;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  z-index: 10000;
  animation: slideIn 0.3s ease;
  transition: opacity 0.3s ease;
}

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.warning { border-left: 4px solid #f59e0b; }
.toast.info { border-left: 4px solid #3b82f6; }

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Priority badges */
.priority-urgent { background: #fef2f2; color: #991b1b; }
.priority-high { background: #fff7ed; color: #9a3412; }
.priority-medium { background: #eff6ff; color: #1e40af; }
.priority-low { background: #f3f4f6; color: #4b5563; }

/* ============================================
   MODERN INVENTORY 2025 DESIGN
   Inspired by: NetSuite, Katana, Zoho, inFlow
   ============================================ */

/* Inventory Header */
.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.inventory-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Modern Primary Button */
.btn-primary-modern {
  height: 36px;
  padding: 0 16px;
  background: #0070d2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 112, 210, 0.3);
}

.btn-primary-modern:hover {
  background: #005fb2;
  box-shadow: 0 2px 6px rgba(0, 112, 210, 0.4);
  transform: translateY(-1px);
}

/* Icon Buttons */
.btn-icon-modern {
  width: 36px;
  height: 36px;
  padding: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #475569;
}

.btn-icon-modern:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* KPI Cards */
.inventory-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card-inventory {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  transition: all 0.2s;
}

.kpi-card-inventory:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-content {
  flex: 1;
}

.kpi-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 500;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

/* Toolbar */
.inventory-toolbar {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* Modern Search Box */
.search-box-modern {
  flex: 1;
  min-width: 300px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  height: 40px;
}

.search-box-modern svg {
  color: #94a3b8;
}

.search-box-modern input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: #0f172a;
}

.search-box-modern input::placeholder {
  color: #94a3b8;
}

/* Filter Group */
.filter-group-modern {
  display: flex;
  gap: 8px;
  align-items: center;
}

.select-modern {
  height: 40px;
  padding: 0 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  color: #0f172a;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.select-modern:hover {
  border-color: #cbd5e1;
}

.select-modern:focus {
  border-color: #0070d2;
  box-shadow: 0 0 0 3px rgba(0, 112, 210, 0.1);
}

.btn-text-modern {
  height: 40px;
  padding: 0 16px;
  background: none;
  border: none;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-text-modern:hover {
  color: #0f172a;
}

/* View Toggle */
.view-toggle-modern {
  display: flex;
  gap: 4px;
  background: #f8fafc;
  padding: 4px;
  border-radius: 6px;
}

.view-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.view-btn:hover {
  background: white;
  color: #0f172a;
}

.view-btn.active {
  background: white;
  color: #0070d2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Bulk Actions Bar */
.bulk-actions-bar {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bulk-selected {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: #1e40af;
}

.bulk-buttons {
  display: flex;
  gap: 8px;
}

.btn-bulk {
  height: 32px;
  padding: 0 12px;
  background: white;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #1e40af;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-bulk:hover {
  background: white;
  border-color: #60a5fa;
}

/* Product Grid */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.product-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s;
  cursor: pointer;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: #cbd5e1;
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.product-sku {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.product-name {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  margin: 4px 0 8px 0;
}

.product-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 500;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

/* Status Badge */
.status-badge-modern {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-in-stock {
  background: #dcfce7;
  color: #15803d;
}

.status-low-stock {
  background: #fef3c7;
  color: #b45309;
}

.status-out-of-stock {
  background: #fee2e2;
  color: #b91c1c;
}

/* Modern Table */
.inventory-list {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
}

.modern-table thead {
  background: #f8fafc;
}

.modern-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
}

.modern-table td {
  padding: 16px;
  font-size: 14px;
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
}

.modern-table tbody tr:hover {
  background: #f8fafc;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border: 2px dashed #e2e8f0;
  border-radius: 12px;
}

.empty-state svg {
  color: #cbd5e1;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.empty-state p {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 24px 0;
}

/* Quick Actions Panel */
.quick-actions-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.quick-action-btn {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quick-action-btn:hover {
  background: #0070d2;
  color: white;
  border-color: #0070d2;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 112, 210, 0.3);
}

.quick-action-btn svg {
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .inventory-kpis {
    grid-template-columns: 1fr;
  }
  
  .inventory-toolbar {
    flex-direction: column;
  }
  
  .search-box-modern {
    width: 100%;
  }
  
  .inventory-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-actions-panel {
    bottom: 12px;
    right: 12px;
  }
}

/* ==========================================
   PROFESSIONAL MOBILE-RESPONSIVE DESIGN
   ========================================== */

/* Mobile First: Phones (320px - 767px) */
@media (max-width: 767px) {
  body { font-size: 14px; }
  
  /* Touch-friendly buttons */
  button, .btn, .quick-btn { 
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
  }
  
  /* Prevent iOS zoom */
  input, select, textarea {
    font-size: 16px !important;
    padding: 10px !important;
  }
  
  /* Hide sidebar on mobile */
  nav { display: none; }
  
  /* Mobile tabs - scroll */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 5px;
    padding: 0 10px;
  }
  
  .tab {
    white-space: nowrap;
    padding: 10px 15px;
    font-size: 14px;
  }
  
  /* Single column layouts */
  .tab-content { padding: 15px; }
  
  .form-row { flex-direction: column; }
  .form-group { width: 100% !important; margin-bottom: 15px; }
  
  /* Mobile tables - horizontal scroll */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Mobile modals */
  .modal-content {
    width: 95% !important;
    margin: 20px auto !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Mobile KPI cards - 2 columns */
  .dashboard-kpis, .inventory-kpis {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  
  .kpi-card, .kpi-card-inventory {
    padding: 12px !important;
  }
  
  .kpi-value { font-size: 18px !important; }
  .kpi-label { font-size: 11px !important; }
  
  /* Mobile inventory grid - single column */
  .inventory-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  /* Mobile toolbar - stack */
  .inventory-toolbar {
    flex-direction: column !important;
    gap: 10px !important;
  }
  
  .search-box-modern {
    width: 100% !important;
  }
  
  /* Mobile sales funnel - stack */
  .funnel-columns {
    flex-direction: column !important;
  }
  
  .funnel-column {
    width: 100% !important;
    min-height: 200px;
  }
  
  /* Mobile charts */
  canvas {
    max-height: 250px !important;
  }
  
  /* Mobile quick actions - smaller */
  .quick-actions-panel {
    bottom: 10px;
    right: 10px;
    gap: 6px;
  }
  
  .quick-action-btn {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* Tablets: Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  nav { width: 200px; }
  main { margin-left: 200px; padding: 20px; }
  
  /* 2-3 column layouts */
  .inventory-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .dashboard-kpis, .inventory-kpis {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .funnel-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablets: Landscape & Desktop (1024px+) */
@media (min-width: 1024px) {
  /* 3-4 column layouts */
  .inventory-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .dashboard-kpis, .inventory-kpis {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* Large Desktop (1920px+) */
@media (min-width: 1920px) {
  main { max-width: 1800px; margin: 0 auto; }
  
  .inventory-grid {
    grid-template-columns: repeat(5, 1fr) !important;
  }
}

/* Acquisition Agency Pulse Animation */
@keyframes pulse {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); 
  }
  50% { 
    box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); 
  }
}

/* Print styles */
@media print {
  nav, .tabs, .action-buttons, .quick-actions-panel {
    display: none !important;
  }
  main { margin: 0; padding: 0; }
}
