*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; }
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f5;
  --bg-tertiary: #f0ede8;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --border: rgba(0,0,0,0.12);
  --border-md: rgba(0,0,0,0.22);
  --accent: #185FA5;
  --accent-dark: #0C447C;
  --accent-light: #E6F1FB;
  --green: #3B6D11;
  --green-light: #EAF3DE;
  --amber: #854F0B;
  --amber-light: #FAEEDA;
  --red: #A32D2D;
  --red-light: #FCEBEB;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1e1e1c;
    --bg-secondary: #252523;
    --bg-tertiary: #2c2c2a;
    --text-primary: #e8e8e6;
    --text-secondary: #9a9a96;
    --border: rgba(255,255,255,0.1);
    --border-md: rgba(255,255,255,0.2);
    --accent-light: #0e2d4a;
    --green-light: #1a2e0a;
    --amber-light: #2e1f05;
    --red-light: #2e0f0f;
  }
}
html, body { height: 100%; font-family: var(--font); font-size: 14px; color: var(--text-primary); background: var(--bg-tertiary); overflow: hidden; }
.app { display: flex; height: 100vh; max-width: 1400px; margin: 0 auto; background: var(--bg-tertiary); position: relative; }

/* Sidebar */
.sidebar { width: 220px; background: var(--bg-secondary); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.logo { padding: 18px 16px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo i { font-size: 22px; color: var(--accent); }
.logo-name { font-size: 16px; font-weight: 600; letter-spacing: -0.4px; }
.logo-sub { font-size: 10px; color: var(--text-secondary); margin-top: 1px; }
nav { flex: 1; padding: 10px 0; }
.nav-item { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); border-radius: 0; transition: background 0.12s, color 0.12s; text-decoration: none; min-height: 44px; }
.nav-item:hover { background: var(--bg-primary); color: var(--text-primary); }
.nav-item.active { background: var(--bg-primary); color: var(--accent); font-weight: 500; border-right: 2px solid var(--accent); }
.nav-item i { font-size: 17px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; margin-left: auto; background: var(--accent-light); color: var(--accent); font-weight: 500; }
.badge-red { background: var(--red-light); color: var(--red); }
.team-section { padding: 14px 16px; border-top: 0.5px solid var(--border); }
.team-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; }
.avatars { display: flex; }
.av { width: 26px; height: 26px; border-radius: 50%; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg-secondary); margin-left: -5px; }
.av:first-child { margin-left: 0; }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-primary); position: relative; }
.topbar { padding: 14px 24px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 14px; flex-shrink: 0; background: var(--bg-primary); position: relative; }
.topbar h2 { font-size: 15px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn { padding: 8px 14px; border: 0.5px solid var(--border-md); border-radius: var(--radius-md); background: transparent; cursor: pointer; font-size: 13px; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; font-family: var(--font); transition: background 0.12s; min-height: 44px; text-decoration: none; }
.btn:hover { background: var(--bg-secondary); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: #27500A; border-color: #27500A; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #8B2020; border-color: #8B2020; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 18px; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* Revenue tracker */
.rev-card { background: var(--bg-secondary); border: 0.5px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin-bottom: 18px; }
.rev-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rev-title { font-size: 13px; font-weight: 500; }
.rev-edit { font-size: 12px; color: var(--accent); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.rev-nums { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.rev-big { font-size: 24px; font-weight: 600; color: var(--accent); }
.rev-of { font-size: 13px; color: var(--text-secondary); }
.rev-pct { font-size: 12px; font-weight: 500; background: var(--green-light); color: var(--green); padding: 2px 9px; border-radius: 10px; }
.progress-track { height: 7px; background: var(--bg-primary); border-radius: 4px; overflow: hidden; border: 0.5px solid var(--border); }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s ease; }
.rev-sub { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--text-secondary); }

/* Contacts / Leads table & bar */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-pills { display: flex; gap: 6px; background: var(--bg-secondary); padding: 4px; border-radius: var(--radius-md); border: 0.5px solid var(--border); }
.filter-pill { padding: 6px 12px; border: none; background: transparent; cursor: pointer; border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary); font-family: var(--font); font-weight: 500; transition: all 0.12s; text-decoration: none; }
.filter-pill:hover { color: var(--text-primary); }
.filter-pill.active { background: var(--bg-primary); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-size: 15px; }
.search-bar { width: 100%; padding: 10px 12px 10px 34px; border: 0.5px solid var(--border); border-radius: var(--radius-md); font-size: 13px; background: var(--bg-secondary); color: var(--text-primary); font-family: var(--font); outline: none; min-height: 44px; }
.search-bar:focus { border-color: var(--accent); }
.filter-select { padding: 10px 12px; border: 0.5px solid var(--border); border-radius: var(--radius-md); font-size: 13px; background: var(--bg-secondary); color: var(--text-primary); font-family: var(--font); outline: none; min-height: 44px; }
.filter-select:focus { border-color: var(--accent); }
.date-picker-input { padding: 10px 12px; border: 0.5px solid var(--border); border-radius: var(--radius-md); font-size: 13px; background: var(--bg-secondary); color: var(--text-primary); font-family: var(--font); outline: none; min-height: 44px; }

.table-wrap { border: 0.5px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-primary); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--text-secondary); font-weight: 500; padding: 12px; background: var(--bg-secondary); border-bottom: 0.5px solid var(--border); cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th i { font-size: 11px; margin-left: 4px; }
td { padding: 12px; border-bottom: 0.5px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-secondary); }
.c-name { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.c-name:hover { color: var(--accent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tag { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 10px; font-weight: 500; white-space: nowrap; text-transform: capitalize; }
.tag-hot { background: var(--red-light); color: var(--red); }
.tag-warm { background: var(--amber-light); color: var(--amber); }
.tag-cold { background: var(--accent-light); color: var(--accent); }
.tag-won { background: var(--green-light); color: var(--green); }
.tag-lost { background: var(--border-md); color: var(--text-secondary); }

.tag-instagram { background: #FDF2F8; color: #DB2777; }
.tag-facebook { background: #EFF6FF; color: #1D4ED8; }
.tag-whatsapp { background: #ECFDF5; color: #047857; }
.tag-referral { background: #F5F3FF; color: #6D28D9; }
.tag-exhibition { background: #FEF3C7; color: #D97706; }
.tag-cold_call { background: #FFF7ED; color: #C2410C; }
.tag-website { background: #ECFEFF; color: #0E7490; }
.tag-email { background: #F1F5F9; color: #475569; }
.tag-linkedin { background: #F0F9FF; color: #0369A1; }
.tag-other { background: #F9F8F6; color: #78716C; }

/* Reminders */
.rem-item { background: var(--bg-secondary); border: 0.5px solid var(--border); border-radius: var(--radius-md); padding: 13px 15px; display: flex; gap: 13px; margin-bottom: 11px; position: relative; }
.rem-item.high-priority { border-left: 3px solid var(--red); }
.rem-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 17px; }
.rem-body { flex: 1; }
.rem-title { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.rem-sub { font-size: 12px; color: var(--text-secondary); }
.rem-due { font-size: 12px; margin-top: 4px; }
.rem-actions { display: flex; gap: 7px; margin-top: 9px; }
.rem-btn { padding: 6px 11px; font-size: 12px; border: 0.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-primary); color: var(--text-primary); font-family: var(--font); display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }
.rem-btn:hover { background: var(--bg-secondary); }
.rem-group-header { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-secondary); margin: 20px 0 10px; letter-spacing: 0.5px; display: flex; align-items: center; gap: 6px; }
.rem-group-header.overdue { color: var(--red); }
.rem-lead-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.rem-lead-link:hover { text-decoration: underline; }

/* Activity */
.act-item { display: flex; gap: 14px; padding: 13px 0; border-bottom: 0.5px solid var(--border); }
.act-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.act-dot-blue { background: var(--accent); }
.act-dot-green { background: var(--green); }
.act-dot-amber { background: var(--amber); }
.act-dot-gray { background: var(--text-secondary); }
.act-body { flex: 1; }
.act-title { font-size: 13px; margin-bottom: 3px; }
.act-time { font-size: 11px; color: var(--text-secondary); }
.act-note { font-size: 12px; color: var(--text-secondary); margin-top: 5px; line-height: 1.5; }

/* In-app notifications Bell Dropdown */
.bell-container { position: relative; display: inline-block; }
.bell-badge { position: absolute; top: 0; right: 0; width: 8px; height: 8px; background: var(--red); border-radius: 50%; border: 1px solid var(--bg-primary); }
.bell-dropdown { position: absolute; top: calc(100% + 10px); right: 0; width: 320px; background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 1010; padding: 12px; display: none; }
.bell-dropdown.show { display: block; }
.bell-header { font-size: 13px; font-weight: 600; padding-bottom: 8px; border-bottom: 0.5px solid var(--border); margin-bottom: 8px; display: flex; justify-content: space-between; }
.bell-list { max-height: 240px; overflow-y: auto; }
.bell-item { padding: 8px; border-radius: var(--radius-sm); border-bottom: 0.5px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: var(--bg-secondary); }
.bell-title { font-size: 12px; font-weight: 500; }
.bell-time { font-size: 11px; color: var(--text-secondary); }
.bell-actions { display: flex; gap: 6px; margin-top: 4px; }

/* Slide-out detail panel */
.slide-panel { position: fixed; top: 0; right: -420px; width: 420px; height: 100%; background: var(--bg-primary); border-left: 0.5px solid var(--border); box-shadow: -8px 0 32px rgba(0,0,0,0.1); z-index: 999; display: flex; flex-direction: column; transition: right 0.3s ease; }
.slide-panel.show { right: 0; }
.slide-header { padding: 18px 20px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.slide-header h3 { font-size: 15px; font-weight: 600; }
.slide-body { flex: 1; overflow-y: auto; padding: 20px; }
.slide-section { margin-bottom: 20px; }
.slide-section h4 { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 8px; }
.notes-area { width: 100%; height: 120px; padding: 8px 10px; border: 0.5px solid var(--border); border-radius: var(--radius-md); font-family: var(--font); font-size: 13px; resize: none; background: var(--bg-secondary); color: var(--text-primary); outline: none; }
.notes-area:focus { border-color: var(--accent); }
.notes-status { font-size: 11px; color: var(--text-secondary); text-align: right; margin-top: 4px; }

/* User Profile Dropdown in Topbar */
.profile-container { position: relative; }
.profile-dropdown { position: absolute; top: calc(100% + 10px); right: 0; width: 160px; background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(0,0,0,0.08); z-index: 1010; overflow: hidden; display: none; }
.profile-dropdown.show { display: block; }
.profile-dropdown a, .profile-dropdown button { display: block; width: 100%; text-align: left; padding: 10px 14px; font-size: 13px; color: var(--text-primary); text-decoration: none; border: none; background: transparent; font-family: var(--font); cursor: pointer; transition: background 0.12s; }
.profile-dropdown a:hover, .profile-dropdown button:hover { background: var(--bg-secondary); }

/* Modals */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1020; padding: 20px; }
.modal { background: var(--bg-primary); border-radius: var(--radius-lg); border: 0.5px solid var(--border); padding: 22px; width: 100%; max-width: 440px; box-shadow: 0 8px 32px rgba(0,0,0,0.18); max-height: 90vh; overflow-y: auto; }
.modal-wide { max-width: 580px; }
.modal h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 0.5px solid var(--border); border-radius: var(--radius-md); font-size: 13px; background: var(--bg-secondary); color: var(--text-primary); font-family: var(--font); outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; display: block; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

.color-presets { display: flex; gap: 8px; margin-top: 6px; }
.color-preset-btn { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-preset-btn.selected { border-color: var(--text-primary); }

/* Import drop zone */
.drop-zone { border: 2px dashed var(--border-md); border-radius: var(--radius-md); padding: 30px 20px; text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s; margin-bottom: 14px; }
.drop-zone:hover, .drop-zone.drag-over { background: var(--bg-secondary); border-color: var(--accent); }
.drop-zone i { font-size: 32px; color: var(--accent); margin-bottom: 10px; display: block; }
.drop-zone p { font-size: 13px; color: var(--text-primary); margin-bottom: 4px; font-weight: 500; }
.drop-zone span { font-size: 12px; color: var(--text-secondary); }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 24px; background: #1a1a1a; color: #fff; padding: 10px 20px; border-radius: var(--radius-md); font-size: 13px; z-index: 2000; opacity: 0; transition: opacity 0.3s; pointer-events: none; white-space: nowrap; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.toast.show { opacity: 1; }

/* Empty state */
.empty { text-align: center; padding: 40px 0; color: var(--text-secondary); font-size: 13px; }
.empty i { font-size: 32px; display: block; margin-bottom: 10px; opacity: 0.4; }

/* Auth page styling */
.auth-layout { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-tertiary); padding: 20px; }
.auth-card { background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(0,0,0,0.06); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo i { font-size: 32px; color: var(--accent); margin-bottom: 8px; }
.auth-logo h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.4px; }
.auth-logo p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Responsive adjustments */
/* Desktop / Large Screens (1024px+) */
@media (min-width: 1024px) {
  .menu-toggle { display: none; }
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
  .sidebar { width: 68px; }
  .logo-name, .logo-sub, .nav-item span, .team-section, .badge { display: none !important; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item i { font-size: 20px; }
}

/* Mobile (<768px) */
@media (max-width: 768px) {
  .app { flex-direction: column; height: 100vh; }
  .sidebar { width: 100%; height: 56px; border-right: none; border-top: 0.5px solid var(--border); order: 3; flex-direction: row; align-items: center; justify-content: space-around; padding: 0; background: var(--bg-secondary); }
  .logo, .team-section { display: none !important; }
  nav { display: flex; width: 100%; height: 100%; padding: 0; justify-content: space-around; align-items: center; }
  .nav-item { flex: 1; height: 100%; justify-content: center; padding: 0; border-right: none !important; border-bottom: none !important; flex-direction: column; gap: 2px; }
  .nav-item.active { border-right: none !important; border-top: 2px solid var(--accent); color: var(--accent); }
  .nav-item span { font-size: 9px; }
  .nav-item i { font-size: 18px; }
  .badge { display: none !important; }

  .main { order: 1; flex: 1; height: calc(100vh - 56px); }
  .topbar { padding: 12px 16px; gap: 8px; }
  .topbar h2 { font-size: 14px; }
  .topbar-actions .btn span { display: none; } /* Hide button text on mobile */
  .content { padding: 14px; }
  
  /* Table Stack Layout */
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { position: absolute; top: -9999px; left: -9999px; }
  tr { border: 0.5px solid var(--border); border-radius: var(--radius-md); margin-bottom: 12px; padding: 8px; background: var(--bg-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
  td { border: none; border-bottom: 0.5px solid var(--bg-tertiary); position: relative; padding-left: 45%; text-align: right; padding-top: 8px; padding-bottom: 8px; font-size: 12px; }
  td:last-child { border-bottom: none; }
  td::before { content: attr(data-label); position: absolute; left: 8px; width: 40%; text-align: left; font-weight: 500; color: var(--text-secondary); font-size: 11px; text-transform: uppercase; }
  .c-name { justify-content: flex-end; }

  /* Modals on mobile: Fullscreen sheets */
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 85vh; }
  .slide-panel { width: 100%; right: -100%; }
  .slide-panel.show { right: 0; }
  
  /* Touch target rule */
  .btn, .nav-item, .rem-btn, .color-preset-btn, input, select, textarea { min-height: 44px; }
}
