/* Leo CRM — polished-v4 shared shell CSS */
@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

/* ===== VARIABLES ===== */
:root{
  --bg:#f2f0eb;
  --surface:#ffffff;
  --warm:#f5f0e8;
  --accent:#059669;
  --accent-light:#ecfdf5;
  --secondary:#b45309;
  --secondary-light:#fffbeb;
  --border:#e5e0d5;
  --border-light:#ece8e0;
  --text:#1a1a1a;
  --text-secondary:#6b6b6b;
  --text-muted:#a0a0a0;
  --text-dim:#b0b0b0;
  --dark:#1b1b1b;
  --radius-lg:20px;
  --radius-md:14px;
  --radius-sm:10px;
  --font-heading:'Newsreader',serif;
  --font-body:'Inter',sans-serif;
  --font-mono:'JetBrains Mono',monospace;
}

/* ===== BODY ===== */
body{
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer}

/* ===== TOPNAV ===== */
.topnav{
  position:sticky;
  top:0;
  z-index:100;
  height:64px;
  background:var(--surface);
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  padding:0 32px;
  gap:20px;
}
.topnav .brand{
  font-family:var(--font-heading);
  font-style:italic;
  font-size:20px;
  font-weight:600;
  color:var(--text);
  letter-spacing:-0.3px;
  white-space:nowrap;
  text-decoration:none;
}
.nav-pills{
  display:flex;
  gap:2px;
  align-items:center;
  flex:1;
  overflow-x:auto;
  scrollbar-width:none;
  -ms-overflow-style:none;
  min-width:0;
}
.nav-pills::-webkit-scrollbar{ display:none; }
.nav-pills a{
  padding:5px 10px;
  border-radius:var(--radius-sm);
  font-size:11.5px;
  font-weight:500;
  color:var(--text-secondary);
  text-decoration:none;
  transition:all 150ms;
  white-space:nowrap;
  flex-shrink:0;
}
.nav-pills a.active{
  background:var(--accent);
  color:#ffffff;
}
.nav-pills a:hover:not(.active){
  background:var(--warm);
  color:var(--text);
}
.nav-right{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
}
.nav-user-avatar{
  width:36px;
  height:36px;
  border-radius:50%;
  background:var(--accent);
  color:#ffffff;
  font-size:13px;
  font-weight:600;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  cursor:pointer;
  font-family:var(--font-body);
}
.nav-user-name{
  font-size:12px;
  font-weight:600;
  color:var(--text);
}
.nav-user-role{
  font-size:10px;
  color:var(--text-muted);
}
.nav-icon-btn{
  width:36px;
  height:36px;
  border-radius:50%;
  border:none;
  background:none;
  color:var(--text-muted);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:background 150ms;
  font-size:16px;
}
.nav-icon-btn:hover{
  background:var(--warm);
  color:var(--text);
}

/* ===== PAGE WRAPPER ===== */
.page{
  max-width:1400px;
  margin:0 auto;
  padding:24px 32px 80px;
}

/* ===== PAGE HEAD ===== */
.page-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:24px;
  flex-wrap:wrap;
  gap:12px;
}
.page-head h1{
  font-family:var(--font-heading);
  font-size:28px;
  font-weight:600;
  letter-spacing:-0.5px;
}
.page-head .subtitle{
  font-size:13px;
  color:var(--text-secondary);
  margin-top:2px;
}

/* ===== CARD ===== */
.card{
  background:var(--surface);
  border-radius:var(--radius-lg);
  border:1px solid var(--border);
  padding:28px;
}
.card-title{
  font-family:var(--font-heading);
  font-size:16px;
  font-weight:600;
  margin-bottom:16px;
}

/* ===== TABLE ===== */
.tbl-wrap{
  border-radius:var(--radius-lg);
  border:1px solid var(--border);
  overflow:hidden;
  background:var(--surface);
}
.tbl{
  width:100%;
  border-collapse:collapse;
}
.tbl thead th{
  background:var(--warm);
  padding:10px 16px;
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--text-secondary);
  text-align:left;
  border-bottom:1px solid var(--border);
  cursor:pointer;
  user-select:none;
  white-space:nowrap;
}
.tbl tbody tr{
  border-bottom:1px solid var(--border);
  cursor:pointer;
  transition:background 150ms;
}
.tbl tbody tr:last-child{border-bottom:none}
.tbl tbody tr:hover{background:var(--warm)}
.tbl td{
  padding:10px 16px;
  font-size:13px;
  vertical-align:middle;
}

/* ===== BUTTONS ===== */
.btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 16px;
  border-radius:var(--radius-sm);
  font-size:13px;
  font-weight:500;
  font-family:var(--font-body);
  cursor:pointer;
  border:1px solid var(--border);
  transition:all 150ms;
  white-space:nowrap;
  text-decoration:none;
}
.btn-primary{
  background:var(--accent);
  color:#ffffff;
  border-color:var(--accent);
}
.btn-primary:hover{
  background:#047857;
  border-color:#047857;
}
.btn-ghost{
  background:var(--surface);
  color:var(--text);
  border-color:var(--border);
}
.btn-ghost:hover{
  background:var(--warm);
}
.btn-danger{
  background:#fef2f2;
  color:#dc2626;
  border-color:#fecaca;
}
.btn-danger:hover{
  background:#fee2e2;
}

/* ===== STATS ROW ===== */
.stats-row{
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:12px;
  margin-bottom:24px;
}
.stat-card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  padding:16px 20px;
}
.sc-label{
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--text-muted);
  margin-bottom:6px;
}
.sc-value{
  font-family:var(--font-mono);
  font-size:24px;
  font-weight:700;
  color:var(--text);
}
.sc-sub{
  font-size:11px;
  color:var(--text-muted);
  margin-top:2px;
}

/* ===== FILTERS ===== */
.filters{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:16px;
}
.filter-search{
  flex:1;
  min-width:200px;
  max-width:320px;
  position:relative;
}
.filter-search input{
  width:100%;
  height:36px;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:0 12px 0 36px;
  font-size:13px;
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--text);
  outline:none;
  transition:border 150ms;
}
.filter-search input:focus{border-color:var(--accent)}
.filter-search svg,
.filter-search .search-icon{
  position:absolute;
  left:10px;
  top:50%;
  transform:translateY(-50%);
  color:var(--text-muted);
  pointer-events:none;
}
.filter-chip{
  padding:6px 14px;
  border-radius:20px;
  font-size:12px;
  font-weight:500;
  background:var(--surface);
  border:1px solid var(--border);
  color:var(--text-secondary);
  cursor:pointer;
  transition:all 150ms;
}
.filter-chip.active{
  background:var(--accent);
  color:#ffffff;
  border-color:var(--accent);
}
.filter-chip:hover:not(.active){
  background:var(--warm);
}
.filter-select{
  height:36px;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:0 12px;
  font-size:13px;
  font-family:var(--font-body);
  background:var(--surface);
  color:var(--text);
  outline:none;
  cursor:pointer;
}
.filter-select:focus{border-color:var(--accent)}

/* ===== SCORE PILLS ===== */
.score-pill{
  display:inline-block;
  font-family:var(--font-mono);
  font-size:12px;
  font-weight:600;
  padding:2px 8px;
  border-radius:4px;
}
.score-pill.high{background:#f0fdf4;color:#16a34a}
.score-pill.mid{background:#fffbeb;color:#b45309}
.score-pill.low{background:#fef2f2;color:#dc2626}

/* ===== STATUS BADGE ===== */
.status-badge{
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:3px 9px;
  border-radius:4px;
  font-size:11px;
  font-weight:600;
}
.status-badge .dot{
  width:6px;
  height:6px;
  border-radius:50%;
  flex-shrink:0;
}

/* ===== CHIP ===== */
.chip{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:3px 9px;
  border-radius:4px;
  font-size:11px;
  font-weight:500;
  background:var(--warm);
  border:1px solid var(--border);
  color:var(--text-secondary);
}
.chip.green{background:var(--accent-light);color:var(--accent);border-color:var(--accent-light)}
.chip.purple{background:#f5f3ff;color:#7c3aed;border-color:#ede9fe}
.chip.gray{background:var(--warm);color:var(--text-muted);border-color:var(--border)}

/* ===== TOAST ===== */
.toast{
  position:fixed;
  bottom:24px;
  right:24px;
  background:var(--dark);
  color:#ffffff;
  padding:10px 20px;
  border-radius:var(--radius-sm);
  font-size:13px;
  font-weight:500;
  z-index:9999;
  animation:fadeIn 200ms ease both;
  box-shadow:0 4px 16px rgba(0,0,0,0.15);
  pointer-events:none;
}
.toast.success{background:#059669}
.toast.error{background:#dc2626}

/* ===== EMPTY STATE ===== */
.empty-state{
  text-align:center;
  padding:60px 20px;
  color:var(--text-muted);
}
.empty-state svg{
  width:48px;
  height:48px;
  margin-bottom:16px;
  color:var(--text-muted);
}
.empty-state .t{
  font-size:15px;
  font-weight:600;
  color:var(--text-secondary);
  margin-bottom:6px;
}
.empty-state .s{
  font-size:13px;
}

/* ===== ROW AVATAR ===== */
.row-avatar{
  width:28px;
  height:28px;
  border-radius:50%;
  background:var(--accent);
  color:#ffffff;
  font-size:11px;
  font-weight:600;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  vertical-align:middle;
  margin-right:8px;
  font-family:var(--font-body);
}

/* ===== SPINNER ===== */
.spinner{
  width:14px;
  height:14px;
  display:inline-block;
  border:2px solid var(--border);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin .7s linear infinite;
  vertical-align:middle;
}

/* ===== PAGINATION ===== */
.pagination{
  display:flex;
  gap:8px;
  justify-content:center;
  margin-top:20px;
  flex-wrap:wrap;
}
.page-btn{
  min-width:32px;
  height:32px;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  font-size:13px;
  font-family:var(--font-body);
  background:var(--surface);
  color:var(--text-secondary);
  cursor:pointer;
  padding:0 8px;
  transition:all 150ms;
}
.page-btn:hover:not(.active){background:var(--warm)}
.page-btn.active{
  background:var(--accent);
  color:#ffffff;
  border-color:var(--accent);
}

/* ===== SORT ARROW ===== */
.sortarrow{
  margin-left:4px;
  font-size:10px;
  color:var(--text-muted);
}

/* ===== COL NAME ===== */
.col-name{
  display:flex;
  align-items:center;
  white-space:nowrap;
}
.col-name .sub{
  display:block;
  font-size:11px;
  color:var(--text-muted);
  font-weight:400;
}

/* ===== NUM ===== */
.num{
  font-family:var(--font-mono);
  font-size:12px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeUp{
  from{opacity:0;transform:translateY(12px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes spin{
  to{transform:rotate(360deg)}
}
@keyframes fadeIn{
  from{opacity:0}
  to{opacity:1}
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}

/* ===== ROW NUMBERS (tables) ===== */
.tbl tbody{counter-reset:rownum}
.tbl tbody tr td:first-child::before{
  counter-increment:rownum;
  content:counter(rownum);
  display:inline-block;
  min-width:20px;
  margin-right:8px;
  font-size:10px;
  font-family:var(--font-mono);
  font-weight:600;
  color:var(--text-dim);
  text-align:right;
  vertical-align:middle;
}
