/* MODAL */
.modal {
    display:none;
    position:fixed;
    z-index:999;
    left:0;
    top:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.6);
}

.modal-content {
    background:var(--card);
    margin:5% auto;
    padding:30px;
    width:500px;
    border-radius:16px;
    position:relative;
}

.modal-content h2 {
    margin-top:0;
}

.modal-content input,
.modal-content textarea {
    width:100%;
    padding:8px;
    margin-top:5px;
    margin-bottom:15px;
    border-radius:8px;
    border:none;
}

.close {
    position:absolute;
    right:20px;
    top:15px;
    font-size:22px;
    cursor:pointer;
}
:root {
    --bg1:#1e1e2f;
    --bg2:#2b2b45;
    --card:#2f314d;
    --accent:#5c5fe0;
    --text:#ffffff;
}

body.light {
    --bg1:#f4f6fb;
    --bg2:#e9ecf5;
    --card:#ffffff;
    --accent:#4b6cff;
    --text:#1e1e2f;
}

body {
    margin:0;
    font-family:"Segoe UI",sans-serif;
    background:linear-gradient(135deg,var(--bg1),var(--bg2));
    color:var(--text);
    transition:0.3s ease;
}

.container {
    width:min(1600px, 95vw);
    margin:40px auto;
    background:var(--card);
    border-radius:20px;
    padding:30px;
    box-shadow:0 25px 60px rgba(0,0,0,0.4);
}

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

.header h1 {
    margin:0;
    font-size:28px;
}

.logged-user {
    font-size:14px;
    opacity:0.75;
}

/* KPI */
.topbar {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:15px;
}

.kpis {
    display:flex;
    gap:20px;
}

.kpi {
    background:rgba(92,95,224,0.15);
    padding:15px 20px;
    border-radius:14px;
    min-width:130px;
}

.kpi h3 {
    margin:0;
    font-size:22px;
}

.kpi p {
    margin:5px 0 0;
    font-size:12px;
    opacity:0.7;
}

.toggle {
    cursor:pointer;
    background:var(--accent);
    padding:8px 14px;
    border-radius:10px;
    font-size:13px;
}

/* Filters */
.filters {
    margin:15px 0 10px 0;
}

.filters button {
    background:#3b3d63;
    border:none;
    color:white;
    padding:8px 14px;
    margin-right:10px;
    border-radius:8px;
    cursor:pointer;
}

.filters button.active,
.filters button:hover {
    background:var(--accent);
}

/* Legend */
.legend {
    font-size:13px;
    margin-bottom:15px;
    opacity:0.85;
}

.legend-item{
    cursor:pointer;
    padding:4px 10px;
    border-radius:10px;
    display:inline-block;
}
.legend-item:hover{
    background:rgba(92,95,224,0.18);
}
.legend-item.active{
    background:var(--accent);
}

/* Search */
.search {
    margin-bottom:15px;
}

.search input {
    padding:8px 14px;
    border-radius:8px;
    border:none;
    width:250px;
}

/* Table */
table {
    width:100%;
    border-collapse:collapse;
}

.table-wrapper{
    max-height:500px;     /* adjust as needed */
    overflow-y:auto;
    border-radius:14px;
}

/* Keep header fixed */
.table-wrapper table{
    border-collapse:collapse;
    width:100%;
}

.table-wrapper thead th{
    position:sticky;
    top:0;
    background:var(--card);
    z-index:2;
}

.table-wrapper{
    max-height:500px;
    overflow:auto;
}

.search-bar{
    display:flex;
    align-items:center;
    gap:10px;
    margin-bottom:15px;
}

.search-bar input{
    padding:8px 14px;
    border-radius:8px;
    border:none;
    width:250px;
}

.upload-btn{
    background:var(--accent);
    border:none;
    padding:8px 16px;
    border-radius:10px;
    color:white;
    cursor:pointer;
    font-size:13px;
    transition:0.2s ease;
}

.upload-btn:hover{
    opacity:0.85;
}

th, td {
    padding:12px;
    text-align:left;
    vertical-align:top;
}

th {
    font-size:12px;
    text-transform:uppercase;
    opacity:0.6;
    border-bottom:1px solid rgba(255,255,255,0.1);
}

tbody tr:hover {
    background:rgba(92,95,224,0.08);
}

.overdue {
    background:rgba(231,76,60,0.08);
}

.priority {
    font-weight:bold;
    font-size:14px;
}

/* Lead compact */
.name-age {
    font-weight:600;
}
.phone {
    font-size:12px;
    opacity:0.7;
}

/* Buttons */
.action-btn {
    background:var(--accent);
    border:none;
    padding:6px 14px;
    border-radius:8px;
    color:#fff;
    cursor:pointer;
}

.whatsapp-btn {
    background:#25D366;
    border:none;
    padding:6px 10px;
    border-radius:6px;
    color:white;
    cursor:pointer;
    font-size:12px;
}

.small {
    font-size:12px;
    opacity:0.85;
}

.notes {
    font-size:12px;
    opacity:0.75;
}

/* Status badges */
.badge {
    padding:4px 8px;
    border-radius:12px;
    font-size:11px;
    font-weight:600;
    color:white;
    display:inline-block;
}

.top-actions{
    display:flex;
    align-items:center;
    gap:14px;
}

.page-size{
    display:flex;
    align-items:center;
    gap:10px;
    font-size:13px;
    opacity:0.9;
}

.page-size select{
    border:none;
    border-radius:10px;
    padding:8px 10px;
    background:rgba(255,255,255,0.08);
    color:var(--text);
    cursor:pointer;
}

body.light .page-size select{
    background:#f4f6fb;
    color:var(--text);
}

/* Lead Pool badges */
.available { background:#28a745; }
.locked { background:#dc3545; }

/* Lead Pool row coloring */
.available-row { background:rgba(0,255,0,0.05); }
.locked-row { background:rgba(255,0,0,0.08); }

.pagination{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:10px;
    margin-top:18px;
}

.pagination button{
    background:#3b3d63;
    border:none;
    color:white;
    padding:8px 12px;
    border-radius:10px;
    cursor:pointer;
    font-size:13px;
    min-width:40px;
}

.pagination button:hover,
.pagination button.active{
    background:var(--accent);
}

.pagination button:disabled{
    opacity:0.45;
    cursor:not-allowed;
}

.sortable{
    cursor:pointer;
    user-select:none;
}

.sortable span{
    font-size:11px;
    margin-left:4px;
    opacity:0.6;
}

.delete-btn{
    background:#dc3545;
    border:none;
    padding:8px 14px;
    border-radius:10px;
    color:white;
    cursor:pointer;
    font-size:13px;
    transition:0.2s ease;
}

.delete-btn:hover{
    opacity:0.85;
}

table th input[type="checkbox"],
table td input[type="checkbox"]{
    transform:scale(1.2);
    cursor:pointer;
}

.green { background:#28a745; }
.yellow { background:#ffc107; color:#222; }
.blue { background:#007bff; }
.black { background:#6c757d; }
.red { background:#dc3545; }

    .sortable{
      cursor:pointer;
      user-select:none;
    }
    .sortable span{
      font-size:11px;
      margin-left:4px;
      opacity:0.6;
    }
    .page-btn.active{
      font-weight:bold;
      background:#ddd;
    }

/* Header separator */
th {
  font-size:12px;
  text-transform:uppercase;
  opacity:0.6;
  border-bottom:1px solid rgba(255,255,255,0.1);
}

/* Dark mode row separators */
tbody tr td {
  border-bottom:1px solid rgba(255,255,255,0.08);
}

/* Light mode row separators (dark grey so visible) */
body.light tbody tr td {
  border-bottom:1px solid #d0d3dc;
}

/* Light mode header separator */
body.light th {
  border-bottom:1px solid #c5c9d6;
}

/* Keep header on top while scrolling, and prevent rows from showing through */
.table-wrapper{
  max-height: 520px;      /* adjust if you want */
  overflow: auto;
}

thead th{
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
}

/* Optional: keep the checkbox header cell aligned too */
thead th input{
  position: relative;
  z-index: 6;
}

/* ===== HARD OVERRIDE: FIX TABLE HEADER OVERLAP (PASTE AT BOTTOM) ===== */

/* Make sure the scroll container is the wrapper */
.table-wrapper{
  position: relative;
  max-height: 520px;
  overflow: auto;
}

/* Sticky headers work reliably with separate + spacing 0 */
.table-wrapper table{
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

/* Make header cells sticky and fully opaque */
.table-wrapper thead th{
  position: sticky !important;
  top: 0 !important;
  z-index: 999 !important;
  background: var(--card) !important;
  opacity: 1 !important;              /* critical: no transparency */
}

/* Keep the “faded header text” look without making the header itself transparent */
.table-wrapper thead th *{
  opacity: 0.6;
}

/* Optional: adds a clean separation line while scrolling */
.table-wrapper thead th{
  box-shadow: 0 1px 0 rgba(255,255,255,0.1);
}
body.light .table-wrapper thead th{
  box-shadow: 0 1px 0 #c5c9d6;
}