
:root {
  --bg: #070b12;
  --bg2: #0d1420;
  --bg3: #121a28;
  --bg4: #18223a;
  --bg5: #1e2a44;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent: #00e87a;
  --accent2: #00b85f;
  --t1: #edf2ff;
  --t2: #8b9cbd;
  --t3: #4e5f7a;
  --s-new: #4e5f7a;
  --s-called: #4b8cf0;
  --s-voicemail: #f0ab4b;
  --s-interested: #22c981;
  --s-callback: #a87ef0;
  --s-not: #f05555;
  --s-closed: #00e87a;
  --font-ui: 'DM Sans', system-ui, sans-serif;
  --font-head: 'Syne', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body { background: var(--bg); color: var(--t1); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; overflow: hidden; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 3px; }
button { cursor: pointer; font-family: var(--font-ui); border: none; background: none; color: inherit; }
input, textarea, select { font-family: var(--font-ui); font-size: 13px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; height: 100vh; }

/* SIDEBAR */
.sidebar { width: 220px; min-width: 220px; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid var(--border); }
.logo-mark { font-family: var(--font-head); font-size: 18px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.logo-sub { font-size: 10px; color: var(--t3); font-weight: 500; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--t2); cursor: pointer; transition: all 0.15s; }
.nav-item:hover { background: var(--bg3); color: var(--t1); }
.nav-item.active { background: var(--bg4); color: var(--t1); }
.nav-item .nav-icon { font-size: 16px; width: 18px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--bg5); color: var(--t2); font-size: 10px; font-family: var(--font-mono); padding: 1px 6px; border-radius: 10px; min-width: 22px; text-align: center; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 2px; }
.nav-label { font-size: 10px; color: var(--t3); font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; padding: 8px 12px 4px; }
.status-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: background 0.12s; font-size: 12px; color: var(--t2); }
.status-item:hover { background: var(--bg3); color: var(--t1); }
.status-item.active { background: var(--bg4); color: var(--t1); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-cnt { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--t3); }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }
.total-bar { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--t3); padding: 4px 12px; }
.total-val { font-family: var(--font-mono); color: var(--accent); font-size: 13px; font-weight: 500; }

/* MAIN */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--bg2); flex-shrink: 0; }
.topbar-title { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--t1); }
.topbar-spacer { flex: 1; }
.search-wrap { position: relative; }
.search-input { background: var(--bg3); border: 1px solid var(--border); color: var(--t1); padding: 7px 12px 7px 32px; border-radius: 8px; width: 240px; outline: none; transition: border-color 0.15s; }
.search-input::placeholder { color: var(--t3); }
.search-input:focus { border-color: var(--accent); }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--t3); font-size: 14px; pointer-events: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; border: 1px solid transparent; }
.btn-ghost { border-color: var(--border2); color: var(--t2); background: transparent; }
.btn-ghost:hover { background: var(--bg4); color: var(--t1); }
.btn-accent { background: var(--accent); color: #050a08; border-color: transparent; }
.btn-accent:hover { background: var(--accent2); }
.btn-danger { border-color: #f0555533; color: #f05555; background: transparent; }
.btn-danger:hover { background: #f0555511; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* CONTENT */
.content { flex: 1; display: flex; overflow: hidden; }
.view { flex: 1; overflow-y: auto; padding: 20px; }

/* STATS CARDS */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-label { font-size: 11px; color: var(--t3); font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: 8px; }
.stat-val { font-family: var(--font-mono); font-size: 28px; font-weight: 500; color: var(--t1); }
.stat-sub { font-size: 11px; color: var(--t2); margin-top: 4px; }
.stat-card.accent .stat-val { color: var(--accent); }

/* PIPELINE SECTION */
.section-title { font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--t1); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.pipeline { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
.pipe-bar { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 80px; }
.pipe-fill-wrap { width: 100%; background: var(--bg3); border-radius: 6px; height: 80px; position: relative; overflow: hidden; }
.pipe-fill { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 6px 6px 0 0; transition: height 0.4s ease; }
.pipe-label { font-size: 10px; color: var(--t2); text-align: center; font-weight: 500; }
.pipe-count { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }

/* TYPE BREAKDOWN */
.type-list { display: flex; flex-direction: column; gap: 6px; }
.type-row { display: flex; align-items: center; gap: 10px; background: var(--bg2); border-radius: 8px; padding: 8px 14px; border: 1px solid var(--border); }
.type-name { flex: 1; font-size: 13px; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.type-bar-wrap { width: 120px; height: 4px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.type-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }
.type-count { font-family: var(--font-mono); font-size: 11px; color: var(--t2); min-width: 24px; text-align: right; }

/* TABLE */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table-header { display: grid; grid-template-columns: 2fr 1.2fr 1fr 0.9fr 1fr 1.1fr 40px; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg3); font-size: 11px; color: var(--t3); font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase; }
.table-header span { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.table-header span:hover { color: var(--t1); }
.table-body { overflow-y: auto; max-height: calc(100vh - 280px); }
.table-row { display: grid; grid-template-columns: 2fr 1.2fr 1fr 0.9fr 1fr 1.1fr 40px; gap: 8px; padding: 11px 16px; border-bottom: 1px solid var(--border); align-items: center; cursor: pointer; transition: background 0.1s; }
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--bg3); }
.table-row.selected { background: var(--bg4); }
.cell-name { font-weight: 500; font-size: 13px; color: var(--t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-type { font-size: 11px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.cell-phone { font-family: var(--font-mono); font-size: 12px; color: var(--t2); }
.cell-rating { font-size: 12px; color: #f0ab4b; }
.cell-date { font-family: var(--font-mono); font-size: 11px; color: var(--t3); }
.cell-menu { display: flex; align-items: center; justify-content: center; }
.delete-btn { color: var(--t3); padding: 4px; border-radius: 4px; opacity: 0; transition: all 0.12s; font-size: 14px; }
.table-row:hover .delete-btn { opacity: 1; }
.delete-btn:hover { color: #f05555; background: #f0555515; }
.no-leads { text-align: center; padding: 60px 20px; color: var(--t3); }
.no-leads .big { font-size: 40px; margin-bottom: 8px; }
.no-leads p { font-size: 14px; color: var(--t2); }

/* STATUS SELECT */
.status-select { background: transparent; border: none; outline: none; font-family: var(--font-ui); font-size: 11px; font-weight: 500; cursor: pointer; padding: 2px 4px; border-radius: 4px; -webkit-appearance: none; appearance: none; text-align: center; }

.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 20px; font-size: 11px; font-weight: 500; cursor: pointer; white-space: nowrap; border: 1px solid transparent; transition: opacity 0.15s; }
.status-pill:hover { opacity: 0.8; }

/* DETAIL PANEL */
.detail-panel { width: 380px; min-width: 380px; background: var(--bg2); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; transition: width 0.2s; }
.detail-panel.hidden { width: 0; min-width: 0; }
.detail-top { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; }
.detail-name { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--t1); line-height: 1.3; }
.detail-type { font-size: 12px; color: var(--t2); margin-top: 3px; }
.close-btn { color: var(--t3); padding: 4px; border-radius: 4px; font-size: 18px; line-height: 1; }
.close-btn:hover { color: var(--t1); background: var(--bg4); }
.detail-body { flex: 1; overflow-y: auto; padding: 0; }
.detail-section { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.detail-sec-label { font-size: 10px; color: var(--t3); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.info-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.info-row:last-child { margin-bottom: 0; }
.info-icon { font-size: 13px; color: var(--t3); width: 16px; margin-top: 2px; flex-shrink: 0; }
.info-label { font-size: 11px; color: var(--t3); min-width: 70px; }
.info-val { font-size: 13px; color: var(--t1); flex: 1; word-break: break-word; }
.info-val.mono { font-family: var(--font-mono); font-size: 12px; }
.info-val.dim { color: var(--t3); font-style: italic; }

/* STATUS CHANGER */
.status-changer { display: flex; flex-wrap: wrap; gap: 6px; }
.status-btn { padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all 0.12s; }

/* NOTES */
.notes-area { width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--t1); border-radius: 8px; padding: 10px 12px; resize: vertical; min-height: 100px; font-size: 13px; line-height: 1.6; outline: none; transition: border-color 0.15s; }
.notes-area:focus { border-color: var(--accent); }
.notes-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }
.notes-display { font-size: 13px; color: var(--t2); line-height: 1.6; white-space: pre-wrap; padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; min-height: 60px; cursor: pointer; transition: border-color 0.15s; }
.notes-display:hover { border-color: var(--border2); }
.notes-display.empty { color: var(--t3); font-style: italic; }
.edit-hint { font-size: 10px; color: var(--t3); margin-top: 4px; }

/* CALL LOG */
.log-entry { display: flex; gap: 10px; margin-bottom: 10px; padding: 8px 10px; background: var(--bg3); border-radius: 8px; border: 1px solid var(--border); }
.log-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.log-content { flex: 1; }
.log-date { font-family: var(--font-mono); font-size: 10px; color: var(--t3); }
.log-text { font-size: 12px; color: var(--t1); margin-top: 2px; }

/* IMPORT VIEW */
.import-zone { border: 2px dashed var(--border2); border-radius: 12px; padding: 40px 24px; text-align: center; transition: all 0.2s; cursor: pointer; background: var(--bg2); }
.import-zone.drag { border-color: var(--accent); background: #00e87a0a; }
.import-zone .iz-icon { font-size: 32px; margin-bottom: 12px; color: var(--t3); }
.import-zone h3 { font-family: var(--font-head); font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.import-zone p { font-size: 13px; color: var(--t2); }
.import-msg { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.import-msg.ok { background: #00e87a15; color: var(--accent); border: 1px solid #00e87a30; }
.import-msg.err { background: #f0555515; color: #f05555; border: 1px solid #f0555530; }

.data-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.data-card-title { font-family: var(--font-head); font-size: 14px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.data-card-title .icon { font-size: 16px; }
.data-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.data-info { font-size: 12px; color: var(--t2); margin-top: 8px; }

/* SORT INDICATORS */
.sort-arrow { color: var(--accent); font-size: 10px; }

/* EMPTY STATE */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; text-align: center; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-family: var(--font-head); font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--t2); }
.empty-state p { font-size: 13px; color: var(--t3); max-width: 300px; line-height: 1.6; }

/* TOAST */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--border2); color: var(--t1); padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 500; z-index: 1000; animation: toastIn 0.2s ease; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* PROGRESS RING */
.ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring-val { position: absolute; font-family: var(--font-mono); font-weight: 500; font-size: 18px; color: var(--accent); }

/* TWO COL LAYOUT */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col.asym { grid-template-columns: 1.4fr 1fr; }

/* MODAL BACKDROP */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: 14px; padding: 24px; width: 440px; max-width: 90vw; }
.modal-title { font-family: var(--font-head); font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* FILTER TAGS */
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-tag { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1px solid var(--border); color: var(--t2); background: transparent; transition: all 0.12s; }
.filter-tag:hover { border-color: var(--border2); color: var(--t1); }
.filter-tag.active { border-color: var(--accent); color: var(--accent); background: #00e87a0f; }

/* ============ RESPONSIVE / MOBILE ============ */
.desktop-only { display: initial; }
.mobile-only { display: none; }

.hamburger-btn { display: none; font-size: 20px; color: var(--t1); padding: 4px 8px; border-radius: 6px; }
.hamburger-btn:hover { background: var(--bg4); }
.sidebar-close { display: none; position: absolute; top: 14px; right: 14px; font-size: 22px; color: var(--t2); padding: 2px 8px; border-radius: 6px; }
.sidebar-close:hover { background: var(--bg4); color: var(--t1); }
.sidebar-backdrop { display: none; }

.mobile-card-list { display: none; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1; padding-bottom: 20px; }
.mobile-lead-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; transition: background 0.1s; }
.mobile-lead-card.selected { background: var(--bg4); border-color: var(--border2); }
.mlc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mlc-name { font-weight: 600; font-size: 14.5px; color: var(--t1); }
.mlc-type { font-size: 12px; color: var(--t2); margin-top: 2px; margin-bottom: 10px; }
.mlc-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.mlc-phone { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.mlc-phone.dim { color: var(--t3); font-family: var(--font-ui); }
.mobile-card-list .delete-btn { opacity: 0.5; }

@media (max-width: 860px) {
  body { font-size: 15px; overflow: auto; }
  .desktop-only { display: none !important; }
  .mobile-only { display: initial !important; }
  .mobile-card-list { display: flex !important; }

  .layout { position: relative; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 300;
    width: 78vw; max-width: 300px; min-width: 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-logo { position: relative; }
  .sidebar-close { display: block; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    z-index: 250; animation: fadeIn 0.15s ease;
  }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .hamburger-btn { display: inline-flex; }

  .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding: 10px 14px; row-gap: 8px; }
  .topbar-title { font-size: 16px; }
  .search-wrap { order: 4; flex: 1 1 100%; }
  .search-input { width: 100%; box-sizing: border-box; }
  .btn { padding: 8px 14px; }

  .content { flex-direction: column; overflow: hidden; }
  .view { padding: 14px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .two-col.asym { grid-template-columns: 1fr; }

  .pipeline { gap: 8px; }
  .pipe-bar { min-width: 0; }

  .table-body { max-height: none; }

  /* Detail panel becomes a full-screen sheet on mobile */
  .detail-panel {
    position: fixed; inset: 0; width: 100%; min-width: 0; max-width: none;
    z-index: 260; animation: slideUp 0.2s ease;
  }
  @keyframes slideUp { from { transform: translateY(16px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }

  .modal { width: 92vw; padding: 20px; }

  .import-zone { padding: 28px 16px; }

  .data-actions { flex-direction: column; align-items: stretch; }
  .data-actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-val { font-size: 22px; }
}
