/* ═══════════════════════════════════════════════════
   OneLab Growth Platform — Main Stylesheet
   ═══════════════════════════════════════════════════ */

:root {
  --navy:    #0A2342;
  --navy2:   #0d2d56;
  --teal:    #00897B;
  --teal2:   #00BFA5;
  --mint:    #E0F2F1;
  --gold:    #FFB300;
  --accent:  #FF6F61;
  --green:   #2E7D32;
  --purple:  #6C3DB5;
  --border:  #E2E8F0;
  --gray:    #64748B;
  --lgray:   #F8FAFC;
  --text:    #1E293B;
  --white:   #FFFFFF;
  --danger:  #DC2626;
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md: 0 4px 24px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #F1F5F9;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.logo-mark {
  width: 36px; height: 36px;
  background: var(--teal);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: var(--white);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-main { font-size: 15px; font-weight: 700; color: var(--white); line-height: 1.2; }
.logo-sub  { font-size: 10px; color: rgba(255,255,255,.5); letter-spacing: .04em; }

.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  letter-spacing: .1em;
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  margin-bottom: 2px;
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,.08); color: var(--white); }
.nav-item.active { background: var(--teal); color: var(--white); }
.nav-item.active .nav-icon { filter: none; }

.nav-icon  { font-size: 16px; flex-shrink: 0; }
.nav-label { flex: 1; }

.nav-badge {
  background: var(--gold);
  color: #1a1a1a;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.conn-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,.5);
}

.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray);
  flex-shrink: 0;
  transition: background .3s;
}
.conn-dot.ok    { background: var(--teal2); box-shadow: 0 0 6px var(--teal2); }
.conn-dot.error { background: var(--accent); }

/* ── TOPBAR ───────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  z-index: 90;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.topbar-btn {
  padding: 7px 16px;
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.topbar-btn:hover { background: #00695C; }

.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── MAIN CONTENT ─────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── PAGE HEADER ──────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
}

.page-header p {
  font-size: 13px;
  color: var(--gray);
  margin-top: 2px;
}

/* ── CARDS ────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

/* ── STAT CARDS ───────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-info {}
.stat-num  { font-size: 24px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-lbl  { font-size: 12px; color: var(--gray); margin-top: 3px; }

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary  { background: var(--navy);   color: var(--white); }
.btn-primary:hover:not(:disabled)  { background: var(--navy2); }

.btn-teal     { background: var(--teal);   color: var(--white); }
.btn-teal:hover:not(:disabled)     { background: #00695C; }

.btn-outline  { background: var(--white);  color: var(--navy);  border: 2px solid var(--navy); }
.btn-outline:hover:not(:disabled)  { background: var(--navy); color: var(--white); }

.btn-danger   { background: var(--white);  color: var(--danger); border: 2px solid var(--danger); }
.btn-danger:hover:not(:disabled)   { background: var(--danger); color: var(--white); }

.btn-ghost    { background: transparent;   color: var(--gray);   border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled)    { background: var(--lgray); }

.btn-gold     { background: var(--gold);   color: #1a1a1a; }
.btn-gold:hover:not(:disabled)     { filter: brightness(.92); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── FORM ─────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border .15s;
  width: 100%;
  background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--teal);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── TABLE ────────────────────────────────────────── */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.table-search {
  flex: 1;
  min-width: 180px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border .15s;
}
.table-search:focus { border-color: var(--teal); }

.table-filter {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  background: var(--white);
  outline: none;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--navy);
  color: var(--white);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .03em;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
tbody tr:hover { background: #F8FFFE; }
tbody tr:last-child { border-bottom: none; }

td { padding: 11px 14px; vertical-align: middle; }

.td-name   { font-weight: 600; color: var(--navy); }
.td-sub    { font-size: 12px; color: var(--gray); margin-top: 2px; }
.td-phone  { color: var(--teal); font-size: 12px; }

/* ── BADGES ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-teal   { background: var(--mint);    color: #085041; }
.badge-navy   { background: #E8EAF6;        color: #283593; }
.badge-gold   { background: #FFF8E1;        color: #5D4037; }
.badge-red    { background: #FFEBEE;        color: #C62828; }
.badge-green  { background: #E8F5E9;        color: #1B5E20; }
.badge-purple { background: #F3E5F5;        color: #4A148C; }
.badge-gray   { background: var(--lgray);   color: var(--gray); }

/* ── ACTION BUTTONS IN TABLE ──────────────────────── */
.act-row { display: flex; gap: 5px; }

.act-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
  color: var(--gray);
}
.act-btn:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }
.act-btn.edit:hover  { background: var(--teal); border-color: var(--teal); }
.act-btn.del:hover   { background: var(--danger); border-color: var(--danger); }
.act-btn.wa:hover    { background: #25D366; border-color: #25D366; }
.act-btn.maps:hover  { background: var(--teal); border-color: var(--teal); }

/* ── MODAL ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--white);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

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

.modal-title { font-size: 17px; font-weight: 800; color: var(--navy); }
.modal-close {
  width: 30px; height: 30px;
  background: var(--lgray);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
}
.modal-close:hover { background: var(--border); }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── TOAST ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  max-width: 300px;
  animation: slideIn .25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

@keyframes slideIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast-ok   { background: #1B5E20; color: var(--white); }
.toast-err  { background: var(--danger); color: var(--white); }
.toast-info { background: var(--navy);   color: var(--white); }
.toast-warn { background: var(--gold);   color: #1a1a1a; }

/* ── STATUS BOX ───────────────────────────────────── */
.status-box {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
  line-height: 1.5;
}
.status-ok   { background: #E8F5E9; color: #1B5E20; }
.status-err  { background: #FFEBEE; color: var(--danger); }
.status-info { background: #E3F2FD; color: #0D47A1; }
.status-warn { background: #FFF8E1; color: #5D4037; }

/* ── EMPTY STATE ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}
.empty-state .ico { font-size: 48px; margin-bottom: 12px; }
.empty-state h3   { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.empty-state p    { font-size: 13px; line-height: 1.6; max-width: 320px; margin: 0 auto; }

/* ── LOADING ──────────────────────────────────────── */
.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: var(--gray);
  font-size: 13px;
}

.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PAGINATION ───────────────────────────────────── */
.pagination {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding: 14px;
  flex-wrap: wrap;
}
.pg-btn {
  padding: 6px 12px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
}
.pg-btn.active { background: var(--navy); color: var(--white); border-color: var(--navy); }
.pg-btn:hover:not(.active) { border-color: var(--teal); color: var(--teal); }

/* ── TABS ─────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 9px 18px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .topbar {
    left: 0;
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .table-wrap { overflow-x: auto; }
  thead th:nth-child(n+5) { display: none; }
  td:nth-child(n+5) { display: none; }
}

/* ── CHIP (category selector) ─────────────────────── */
.chip {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray);
  user-select: none;
  transition: all .15s;
  display: inline-block;
}
.chip.on {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}
