/* ============================================
   LEAD MONITORING - Mobile First CSS
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #1e8e3e;
  --warning: #f9ab00;
  --danger:  #d93025;
  --bg:      #f0f2f5;
  --card-bg: #ffffff;
  --text:    #202124;
  --muted:   #5f6368;
  --border:  #e0e0e0;
  --radius:  10px;
  --shadow:  0 1px 6px rgba(0,0,0,0.10);
  --nav-h:   56px;
  --bot-h:   60px;
}

body { font-family: 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }

/* ---- NAVBAR ---- */
.navbar { position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; z-index: 200; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.navbar-left { display: flex; align-items: center; gap: 12px; }
.navbar-brand { font-size: 17px; font-weight: 700; }
.navbar-right { display: flex; align-items: center; gap: 10px; }
.nav-user-info { font-size: 12px; opacity: 0.85; display: none; }
.hamburger { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.hamburger:hover { background: rgba(255,255,255,0.15); }

/* ---- SIDEBAR ---- */
.sidebar { position: fixed; top: var(--nav-h); left: -260px; width: 260px; height: calc(100vh - var(--nav-h)); background: #fff; z-index: 150; box-shadow: 2px 0 12px rgba(0,0,0,0.12); transition: left 0.3s ease; overflow-y: auto; padding-bottom: 80px; }
.sidebar.open { left: 0; }
.sidebar-header { padding: 16px 20px 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.sidebar-link { display: block; padding: 14px 20px; font-size: 15px; color: var(--text); cursor: pointer; transition: background 0.15s; border-left: 3px solid transparent; }
.sidebar-link:hover { background: #f0f4ff; }
.sidebar-link.active { background: #e8f0fe; color: var(--primary); font-weight: 600; border-left-color: var(--primary); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 140; }
.sidebar-overlay.visible { display: block; }

/* ---- MAIN CONTENT ---- */
.main-content { padding: calc(var(--nav-h) + 16px) 16px calc(var(--bot-h) + 16px); min-height: 100vh; }

/* ---- BOTTOM NAV (mobile) ---- */
.bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: var(--bot-h); background: #fff; border-top: 1px solid var(--border); z-index: 200; box-shadow: 0 -2px 8px rgba(0,0,0,0.08); }
.bottom-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--muted); cursor: pointer; padding: 4px; transition: color 0.15s; border: none; background: none; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-icon { font-size: 20px; }

/* ---- CARDS ---- */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.menu-card { background: var(--card-bg); border-radius: 14px; padding: 24px 16px; box-shadow: var(--shadow); cursor: pointer; text-align: center; transition: transform 0.2s, box-shadow 0.2s; border: 1px solid var(--border); }
.menu-card:active { transform: scale(0.97); }
.menu-icon { font-size: 36px; margin-bottom: 10px; }
.menu-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.menu-card p { color: var(--muted); font-size: 12px; line-height: 1.4; }

/* ---- PAGE HEADER ---- */
.page-header { margin-bottom: 16px; }
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---- SUMMARY CARDS ---- */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.summary-card { background: var(--card-bg); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.summary-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 6px; line-height: 1.3; }
.summary-value { font-size: 20px; font-weight: 700; color: var(--primary); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; color: #444; margin-bottom: 5px; }
.form-control { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s; background: #fff; color: var(--text); -webkit-appearance: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,0.12); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.15s, transform 0.1s; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary    { background: var(--primary); color: #fff; }
.btn-secondary  { background: #e8eaed; color: var(--text); }
.btn-danger     { background: var(--danger); color: #fff; }
.btn-success    { background: var(--success); color: #fff; }
.btn-outline-light { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.4); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
thead th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-weight: 700; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
tbody td { padding: 10px 12px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fbff; }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success   { background: #e6f4ea; color: #1e8e3e; }
.badge-warning   { background: #fef7e0; color: #a56200; }
.badge-secondary { background: #f1f3f4; color: #5f6368; }
.badge-primary   { background: #e8f0fe; color: #1557b0; }
.badge-danger    { background: #fce8e6; color: #c5221f; }

/* ---- TABS ---- */
.tabs { display: flex; gap: 4px; background: #f0f2f5; padding: 4px; border-radius: 10px; margin-bottom: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab { flex-shrink: 0; padding: 8px 16px; border: none; border-radius: 7px; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; transition: all 0.2s; white-space: nowrap; }
.tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ---- MODAL ---- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 300; padding: 16px; align-items: flex-end; justify-content: center; }
.modal-overlay.open { display: flex; }
@media (min-width: 480px) { .modal-overlay { align-items: center; } }
.modal-box { background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; box-shadow: 0 -4px 32px rgba(0,0,0,0.2); animation: slideUp 0.3s ease; }
@media (min-width: 480px) { .modal-box { border-radius: 16px; animation: fadeIn 0.2s ease; } }
.modal-lg { max-width: 760px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; border-radius: 16px 16px 0 0; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 16px 20px 20px; }
.btn-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.btn-close:hover { background: var(--bg); }

/* ---- LOGIN PAGE ---- */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #1a73e8, #0d47a1); display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: #fff; border-radius: 20px; padding: 36px 28px; width: 100%; max-width: 400px; box-shadow: 0 8px 40px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 52px; }
.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--primary); margin-top: 8px; }
.login-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---- ALERT ---- */
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-danger { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6c3; }
.alert-success { background: #e6f4ea; color: #1e8e3e; }

/* ---- TOAST ---- */
#toastContainer { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: 90%; max-width: 360px; }
.toast { background: #323232; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; opacity: 0; transform: translateY(12px); transition: all 0.3s; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-danger  { background: var(--danger); }

/* ---- MISC ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-small { font-size: 12px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.simple-list { list-style: none; }
.simple-list li { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.simple-list li:last-child { border: none; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar .form-group { flex: 1; min-width: 130px; margin-bottom: 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 10px; }

@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn  { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@keyframes spin    { to { transform: rotate(360deg); } }

/* ---- DESKTOP ---- */
@media (min-width: 768px) {
  .main-content { padding: calc(var(--nav-h) + 24px) 24px 24px 284px; }
  .sidebar { left: 0; display: block !important; }
  .hamburger { display: none; }
  .bottom-nav { display: none !important; }
  .nav-user-info { display: block; }
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .sidebar-overlay { display: none !important; }
}
@media (max-width: 767px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
}