/* =========================================================
   SalesPro CRM — Design System
   Single-color icon set, Inter typeface, blue/white palette
   ========================================================= */

:root{
  --page-bg: #e8edfb;
  --shell-bg: #f4f6fc;
  --card-bg: #ffffff;
  --sidebar-bg: #ffffff;

  --primary: #3b66f5;
  --primary-dark: #2b4fd6;
  --primary-light: #eaf0ff;

  --text-1: #111827;
  --text-2: #667085;
  --text-3: #98a2b3;

  --border: #eef1f6;
  --border-strong: #e3e7f0;

  --green: #12b76a;
  --green-bg: #e7f9f1;
  --red: #f04438;
  --red-bg: #fef1f0;
  --amber: #f79009;
  --amber-bg: #fff6e8;
  --purple: #7a5af8;
  --purple-bg: #f2effe;
  --blue-bg: #eaf0ff;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.04);
  --shadow-pop: 0 8px 24px rgba(16,24,40,0.12);

  --sidebar-w: 264px;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  background:var(--page-bg);
  color:var(--text-1);
  -webkit-font-smoothing:antialiased;
  font-size:14px;
  line-height:1.5;
}
a{ color:inherit; text-decoration:none; }
ul{ margin:0; padding:0; list-style:none; }
button{ font-family:inherit; cursor:pointer; }
input,select,textarea{ font-family:inherit; font-size:14px; }
img{ max-width:100%; display:block; }
svg.icon{ display:block; flex-shrink:0; }

::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background:#d3d9e6; border-radius:8px; }
::-webkit-scrollbar-track{ background:transparent; }

/* ---------------- App shell layout ---------------- */
.app{
  display:flex;
  min-height:100vh;
  padding:14px;
  gap:14px;
}

.sidebar{
  width:var(--sidebar-w);
  flex-shrink:0;
  background:var(--sidebar-bg);
  border-radius:var(--radius-lg);
  padding:22px 16px;
  display:flex;
  flex-direction:column;
  box-shadow:var(--shadow-card);
  position:sticky;
  top:14px;
  height:calc(100vh - 28px);
  overflow-y:auto;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:4px 10px 22px;
}
.brand-mark{
  width:38px; height:38px;
  border-radius:11px;
  background:var(--primary);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.brand-text strong{ display:block; font-size:15px; font-weight:700; color:var(--text-1); }
.brand-text span{ display:block; font-size:11.5px; color:var(--text-3); }

.nav-label{
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--text-3);
  padding:16px 12px 8px;
}
.nav-list{ display:flex; flex-direction:column; gap:2px; }
.nav-item{
  display:flex;
  align-items:center;
  gap:11px;
  padding:10px 12px;
  border-radius:12px;
  color:var(--text-2);
  font-weight:500;
  font-size:14px;
  transition:background .15s ease, color .15s ease;
  position:relative;
}
.nav-item svg{ color:var(--text-3); transition:color .15s ease; }
.nav-item:hover{ background:var(--primary-light); color:var(--primary-dark); }
.nav-item:hover svg{ color:var(--primary); }
.nav-item.active{ background:var(--primary); color:#fff; box-shadow:0 6px 16px rgba(59,102,245,.35); }
.nav-item.active svg{ color:#fff; }
.nav-count{
  margin-left:auto;
  font-size:11.5px;
  font-weight:700;
  background:var(--primary-light);
  color:var(--primary-dark);
  padding:1px 8px;
  border-radius:20px;
}
.nav-item.active .nav-count{ background:rgba(255,255,255,.25); color:#fff; }

.sidebar-promo{
  margin-top:auto;
  background:var(--shell-bg);
  border-radius:var(--radius-md);
  padding:16px;
  text-align:left;
}
.sidebar-promo h4{ margin:0 0 6px; font-size:13.5px; }
.sidebar-promo p{ margin:0 0 12px; font-size:12px; color:var(--text-2); line-height:1.5; }
.btn-upgrade{
  display:flex; align-items:center; justify-content:center; gap:6px;
  width:100%; padding:9px; border-radius:10px;
  background:var(--text-1); color:#fff; border:none; font-weight:600; font-size:13px;
}

/* ---------------- Main column ---------------- */
.main{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.topbar{
  background:var(--card-bg);
  border-radius:var(--radius-lg);
  padding:14px 20px;
  display:flex;
  align-items:center;
  gap:16px;
  box-shadow:var(--shadow-card);
}
.menu-toggle{
  display:none;
  background:var(--shell-bg);
  border:none; border-radius:10px; padding:9px; color:var(--text-2);
}
.search-box{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--shell-bg);
  border-radius:12px;
  padding:10px 14px;
  color:var(--text-3);
  max-width:420px;
}
.search-box input{
  border:none; background:transparent; outline:none; width:100%;
  color:var(--text-1); font-size:14px;
}
.topbar-right{ display:flex; align-items:center; gap:14px; margin-left:auto; }
.icon-btn{
  position:relative;
  width:40px; height:40px;
  border-radius:12px;
  border:1px solid var(--border-strong);
  background:#fff;
  display:flex; align-items:center; justify-content:center;
  color:var(--text-2);
}
.icon-btn .dot{
  position:absolute; top:8px; right:9px;
  width:7px; height:7px; border-radius:50%;
  background:var(--red); border:2px solid #fff;
}
.user-chip{ display:flex; align-items:center; gap:10px; padding:4px; border-radius:12px; position:relative; }
.avatar{
  width:38px; height:38px; border-radius:11px;
  background:var(--primary-light); color:var(--primary-dark);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px; overflow:hidden;
  flex-shrink:0;
}
.avatar img{ width:100%; height:100%; object-fit:cover; }
.user-chip .u-name{ font-weight:600; font-size:13.5px; line-height:1.2; }
.user-chip .u-role{ font-size:11.5px; color:var(--text-3); }
.user-chip-info{ display:none; }
@media (min-width:640px){ .user-chip-info{ display:block; } }

.dropdown-menu{
  position:absolute; top:calc(100% + 8px); right:0;
  background:#fff; border-radius:14px; box-shadow:var(--shadow-pop);
  border:1px solid var(--border); min-width:190px; padding:8px;
  display:none; z-index:40;
}
.dropdown-menu.open{ display:block; }
.dropdown-menu a, .dropdown-menu button{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:9px 10px; border-radius:9px; border:none; background:none;
  font-size:13.5px; color:var(--text-2); text-align:left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover{ background:var(--shell-bg); color:var(--text-1); }

.content{
  background:transparent;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.page-header{
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
}
.page-header h1{ font-size:22px; margin:0; font-weight:700; }
.page-header .sub{ color:var(--text-2); font-size:13.5px; margin-top:2px; }
.page-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

/* ---------------- Buttons ---------------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:11px; font-weight:600; font-size:13.5px;
  border:1px solid transparent; transition:all .15s ease; white-space:nowrap;
}
.btn-primary{ background:var(--primary); color:#fff; }
.btn-primary:hover{ background:var(--primary-dark); }
.btn-outline{ background:#fff; border-color:var(--border-strong); color:var(--text-1); }
.btn-outline:hover{ border-color:var(--primary); color:var(--primary); }
.btn-ghost{ background:var(--shell-bg); color:var(--text-2); }
.btn-ghost:hover{ background:var(--border-strong); }
.btn-danger{ background:var(--red-bg); color:var(--red); }
.btn-danger:hover{ background:var(--red); color:#fff; }
.btn-sm{ padding:7px 12px; font-size:12.5px; border-radius:9px; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:.55; cursor:not-allowed; }

/* ---------------- Cards ---------------- */
.card{
  background:var(--card-bg);
  border-radius:var(--radius-lg);
  padding:20px;
  box-shadow:var(--shadow-card);
}
.card-header{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.card-header h3{ margin:0; font-size:16px; font-weight:700; }
.card-header .sub{ font-size:12.5px; color:var(--text-3); margin-top:2px; }

/* ---------------- Stat cards ---------------- */
.stat-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.stat-card{
  background:var(--card-bg); border-radius:var(--radius-lg); padding:18px 20px;
  box-shadow:var(--shadow-card); position:relative; overflow:hidden;
}
.stat-top{ display:flex; align-items:center; gap:8px; color:var(--text-2); font-size:13px; font-weight:600; margin-bottom:14px; }
.stat-top .ic{ width:30px; height:30px; border-radius:9px; background:var(--shell-bg); display:flex; align-items:center; justify-content:center; color:var(--text-2); }
.stat-value{ font-size:26px; font-weight:800; letter-spacing:-.01em; }
.stat-foot{ display:flex; align-items:center; justify-content:space-between; margin-top:10px; }
.delta{ display:inline-flex; align-items:center; gap:4px; font-weight:700; font-size:12.5px; }
.delta.up{ color:var(--green); }
.delta.down{ color:var(--red); }
.delta-label{ color:var(--text-3); font-weight:500; }
.spark{ width:70px; height:26px; }

/* ---------------- Grid layouts ---------------- */
.grid-2{ display:grid; grid-template-columns:1.6fr 1fr; gap:14px; align-items:start; }
.grid-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; align-items:start; }

/* ---------------- Tabs / segmented control ---------------- */
.seg{ display:inline-flex; background:var(--shell-bg); border-radius:11px; padding:4px; gap:2px; }
.seg button{ border:none; background:transparent; padding:7px 14px; border-radius:8px; font-size:12.5px; font-weight:600; color:var(--text-2); }
.seg button.active{ background:var(--primary); color:#fff; }

/* ---------------- Tables ---------------- */
.table-wrap{ overflow-x:auto; }
table.data-table{ width:100%; border-collapse:collapse; min-width:640px; }
.data-table th{
  text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.03em;
  color:var(--text-3); font-weight:700; padding:10px 14px; border-bottom:1px solid var(--border);
  white-space:nowrap;
}
.data-table td{ padding:14px; border-bottom:1px solid var(--border); font-size:13.5px; vertical-align:middle; }
.data-table tr:last-child td{ border-bottom:none; }
.data-table tr:hover td{ background:var(--shell-bg); }
.cell-main{ display:flex; align-items:center; gap:10px; }
.cell-title{ font-weight:600; color:var(--text-1); }
.cell-sub{ font-size:12px; color:var(--text-3); }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; }
.icon-action{
  width:32px; height:32px; border-radius:9px; border:1px solid var(--border-strong);
  background:#fff; display:inline-flex; align-items:center; justify-content:center; color:var(--text-2);
}
.icon-action:hover{ color:var(--primary); border-color:var(--primary); }
.icon-action.danger:hover{ color:var(--red); border-color:var(--red); }

/* ---------------- Badges ---------------- */
.badge{ display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:20px; font-size:11.5px; font-weight:700; text-transform:capitalize; }
.badge::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-blue{ background:var(--blue-bg); color:var(--primary-dark); }
.badge-green{ background:var(--green-bg); color:var(--green); }
.badge-red{ background:var(--red-bg); color:var(--red); }
.badge-amber{ background:var(--amber-bg); color:var(--amber); }
.badge-purple{ background:var(--purple-bg); color:var(--purple); }
.badge-gray{ background:var(--shell-bg); color:var(--text-2); }

/* ---------------- Lists (top reps / deals) ---------------- */
.list-item{ display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.list-item:last-child{ border-bottom:none; padding-bottom:0; }
.list-thumb{ width:44px; height:44px; border-radius:12px; background:var(--shell-bg); display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; color:var(--text-2); font-weight:700; }
.list-thumb img{ width:100%; height:100%; object-fit:cover; }
.list-body{ flex:1; min-width:0; }
.list-title{ font-weight:600; font-size:13.5px; }
.list-sub{ font-size:12px; color:var(--text-3); margin-top:1px; }
.list-value{ text-align:right; font-weight:700; font-size:13.5px; flex-shrink:0; }
.list-value .list-sub{ text-align:right; }
.progress{ height:6px; border-radius:6px; background:var(--shell-bg); margin-top:8px; overflow:hidden; }
.progress > span{ display:block; height:100%; background:var(--primary); border-radius:6px; }

/* ---------------- Location rows (replaces map) ---------------- */
.loc-row{ display:flex; align-items:center; gap:12px; padding:13px 0; border-bottom:1px solid var(--border); }
.loc-row:last-child{ border-bottom:none; }
.loc-flag{ width:38px; height:38px; border-radius:10px; background:var(--blue-bg); color:var(--primary-dark); display:flex; align-items:center; justify-content:center; }
.loc-body{ flex:1; }
.loc-name{ font-weight:600; font-size:13.5px; }
.loc-value{ font-weight:700; font-size:13.5px; }

/* ---------------- Budget usage / donut legend ---------------- */
.legend-row{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text-2); margin-top:6px; }
.legend-dot{ width:9px; height:9px; border-radius:50%; }
.stat-mini{ text-align:center; }
.stat-mini .n{ font-size:18px; font-weight:800; }
.stat-mini .l{ font-size:12px; color:var(--text-3); display:flex; align-items:center; justify-content:center; gap:5px; margin-top:2px; }

/* ---------------- Forms ---------------- */
.form-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field.full{ grid-column:1 / -1; }
.field label{ font-size:12.5px; font-weight:600; color:var(--text-2); }
.field input, .field select, .field textarea{
  padding:11px 13px; border-radius:11px; border:1px solid var(--border-strong);
  background:#fff; outline:none; color:var(--text-1); transition:border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); }
.field textarea{ resize:vertical; min-height:90px; font-family:inherit; }
.field .hint{ font-size:11.5px; color:var(--text-3); }
.field .error{ font-size:11.5px; color:var(--red); }
.form-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:6px; }

/* ---------------- Alerts / flash ---------------- */
.alert{ display:flex; align-items:center; gap:10px; padding:13px 16px; border-radius:13px; font-size:13.5px; font-weight:500; }
.alert-success{ background:var(--green-bg); color:#0a7a4c; }
.alert-error{ background:var(--red-bg); color:#b3261e; }
.alert-info{ background:var(--blue-bg); color:var(--primary-dark); }

/* ---------------- Empty state ---------------- */
.empty-state{ text-align:center; padding:50px 20px; color:var(--text-3); }
.empty-state .ic{ width:56px; height:56px; border-radius:16px; background:var(--shell-bg); display:flex; align-items:center; justify-content:center; margin:0 auto 14px; color:var(--text-3); }
.empty-state h4{ color:var(--text-1); margin:0 0 6px; }
.empty-state p{ margin:0 0 16px; font-size:13px; }

/* ---------------- Pagination ---------------- */
.pagination{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:14px; flex-wrap:wrap; }
.pagination .info{ font-size:12.5px; color:var(--text-3); }
.pagination .pages{ display:flex; gap:6px; }
.pagination a, .pagination span{
  min-width:34px; height:34px; padding:0 8px; border-radius:9px; display:flex; align-items:center; justify-content:center;
  border:1px solid var(--border-strong); font-size:12.5px; font-weight:600; color:var(--text-2);
}
.pagination a:hover{ border-color:var(--primary); color:var(--primary); }
.pagination .current{ background:var(--primary); color:#fff; border-color:var(--primary); }

/* ---------------- Modal ---------------- */
.modal-overlay{
  position:fixed; inset:0; background:rgba(17,24,39,.45); display:none;
  align-items:center; justify-content:center; z-index:100; padding:16px;
}
.modal-overlay.open{ display:flex; }
.modal{ background:#fff; border-radius:18px; width:100%; max-width:420px; padding:22px; box-shadow:var(--shadow-pop); }
.modal h3{ margin:0 0 8px; font-size:16px; }
.modal p{ margin:0 0 18px; color:var(--text-2); font-size:13.5px; }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; }

/* ---------------- Login page ---------------- */
.auth-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; background:var(--page-bg); }
.auth-card{ width:100%; max-width:400px; background:#fff; border-radius:22px; padding:36px 32px; box-shadow:var(--shadow-pop); }
.auth-logo{ display:flex; align-items:center; gap:10px; margin-bottom:22px; justify-content:center; }
.auth-card h1{ text-align:center; font-size:20px; margin:0 0 4px; }
.auth-card .sub{ text-align:center; color:var(--text-3); font-size:13px; margin-bottom:26px; }
.auth-demo{ background:var(--blue-bg); color:var(--primary-dark); font-size:12px; border-radius:11px; padding:10px 12px; margin-top:16px; text-align:center; }

/* ---------------- Calendar ---------------- */
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-dow{ text-align:center; font-size:11px; font-weight:700; color:var(--text-3); text-transform:uppercase; padding-bottom:6px; }
.cal-cell{ min-height:86px; border-radius:12px; background:var(--shell-bg); padding:8px; font-size:12px; color:var(--text-2); position:relative; }
.cal-cell.today{ background:var(--blue-bg); border:1.5px solid var(--primary); }
.cal-cell .d-num{ font-weight:700; color:var(--text-1); font-size:12.5px; }
.cal-cell .evt{ margin-top:5px; font-size:10.5px; background:#fff; border-radius:6px; padding:3px 6px; color:var(--primary-dark); font-weight:600; }
.cal-cell.empty{ background:transparent; }

/* ---------------- Utility ---------------- */
.flex{ display:flex; }
.items-center{ align-items:center; }
.justify-between{ justify-content:space-between; }
.gap-8{ gap:8px; }
.gap-12{ gap:12px; }
.mt-8{ margin-top:8px; }
.mt-16{ margin-top:16px; }
.text-muted{ color:var(--text-3); }
.text-sm{ font-size:12.5px; }
.w-full{ width:100%; }
.hidden{ display:none !important; }

/* ---------------- Overlay for mobile sidebar ---------------- */
.sidebar-overlay{ display:none; position:fixed; inset:0; background:rgba(17,24,39,.4); z-index:59; }
.sidebar-overlay.open{ display:block; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px){
  .grid-2{ grid-template-columns:1fr; }
  .grid-3{ grid-template-columns:1fr; }
}

@media (max-width: 980px){
  .stat-grid{ grid-template-columns:1fr 1fr; }
}

@media (max-width: 860px){
  .app{ padding:10px; gap:0; }
  .sidebar{
    position:fixed; left:10px; top:10px; z-index:60;
    transform:translateX(-120%); transition:transform .25s ease;
    height:calc(100vh - 20px);
  }
  .sidebar.open{ transform:translateX(0); }
  .menu-toggle{ display:flex; }
  .main{ width:100%; gap:10px; }
  .form-grid{ grid-template-columns:1fr; }
}

@media (max-width: 640px){
  .stat-grid{ grid-template-columns:1fr; }
  .search-box{ display:none; }
  .page-header{ flex-direction:column; align-items:flex-start; }
  .page-actions{ width:100%; }
  .page-actions .btn{ flex:1; }
  .topbar{ padding:12px 14px; }
  .card{ padding:16px; }
  .auth-card{ padding:28px 20px; }
}
