/* =====================================================================
   SELLERPAD SERVICES — PREMIUM SAAS LAYER  (loaded last)
   navy #172B45 · sky #86B6E2 · refined neutrals
   ===================================================================== */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface2: #eef3f9;
  --border: #e1e8f1;
  --text: #0f1f36;
  --muted: #62748e;
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px;
  --sh-xs: 0 1px 2px rgba(15,29,48,.05);
  --sh-sm: 0 1px 3px rgba(15,29,48,.06), 0 4px 12px -4px rgba(15,29,48,.06);
  --sh-md: 0 4px 6px -2px rgba(15,29,48,.05), 0 12px 28px -8px rgba(15,29,48,.12);
  --sh-lg: 0 24px 48px -12px rgba(15,29,48,.28);
  --ring: 0 0 0 3px rgba(134,182,226,.45);
}
body.dark-theme {
  --bg: #0b1524; --surface: #112038; --surface2: #172b48; --border: #223a5c;
  --text: #e6eef9; --muted: #8fa6c4; --accent: #86B6E2; --accent-rgb: 134,182,226;
  --sh-xs: 0 1px 2px rgba(0,0,0,.4); --sh-sm: 0 1px 3px rgba(0,0,0,.45); --sh-md: 0 12px 28px -8px rgba(0,0,0,.55);
}
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; letter-spacing: -0.005em; background: var(--bg); }
h1,h2,h3,h4,.page-title { letter-spacing: -0.02em; }

/* ---------- Icons ---------- */
svg.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.nav-icon { display: inline-flex; width: 20px; justify-content: center; margin-right: 4px !important; }
.nav-icon svg.ic { width: 18px; height: 18px; opacity: .92; }

/* ---------- Sidebar ---------- */
.sidebar { width: 264px; }
.sidebar-logo { padding: 22px 24px 20px !important; }
.nav-item { font-size: 13.5px; letter-spacing: 0; border-radius: 10px !important; }
.nav-item.active { box-shadow: inset 0 0 0 1px rgba(134,182,226,.18); }
.nav-group-header { font-size: 11px !important; letter-spacing: .09em !important; text-transform: uppercase; font-weight: 700 !important; }
.sidebar-user { padding: 16px 20px; margin: 12px 12px 4px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08) !important; }
.sidebar-footer { padding: 14px 16px !important; }
.main-content { margin-left: 264px; padding: 0 36px 48px !important; background: var(--bg); }

/* ---------- Top bar (desktop + mobile) ---------- */
.topbar {
  display: flex !important; align-items: center; gap: 16px; justify-content: flex-start;
  height: 66px; padding: 0 36px !important; margin: 0 -36px 28px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar > div:first-of-type { font-weight: 700; font-size: 14px; color: var(--muted); letter-spacing: 0; }
.topbar .hamburger { display: none; }
.topbar-search-container { flex: 1; max-width: 460px; margin: 0 auto 0 12px; position: relative; }
.topbar-search-input {
  width: 100%; height: 40px; padding: 0 14px 0 40px !important; border-radius: 12px !important;
  background: var(--surface2) !important; border: 1px solid transparent !important; font-size: 13.5px; color: var(--text);
  transition: all .2s;
}
.topbar-search-input:focus { background: var(--surface) !important; border-color: var(--sky-700) !important; box-shadow: var(--ring) !important; }
.topbar-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.topbar-search-icon svg { width: 16px; height: 16px; }
.btn-theme-toggle {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .2s;
}
.btn-theme-toggle:hover { border-color: var(--sky-700); background: var(--sky-50); }
body.dark-theme .btn-theme-toggle:hover { background: var(--surface2); }
#adminTopTime, #empTopTime { font-weight: 600; font-variant-numeric: tabular-nums; padding: 8px 12px; background: var(--surface2); border-radius: 10px; color: var(--text) !important; }
@media (max-width: 1024px) {
  .main-content { margin-left: 0; padding: 0 16px 90px !important; }
  .topbar { padding: 0 16px !important; margin: 0 -16px 18px; height: 60px; }
  .topbar .hamburger { display: inline-flex; }
  .topbar-search-container { display: none; }
  .topbar > div:first-of-type { color: var(--text); }
}

/* ---------- Page header ---------- */
.page-header { margin-bottom: 26px !important; align-items: flex-end !important; }
.page-title { font-size: 26px !important; font-weight: 800 !important; color: var(--text); }
.page-sub { font-size: 14px !important; color: var(--muted); margin-top: 6px !important; }

/* ---------- Cards ---------- */
.card, .stat-card, .quick-actions, .metric-card, .qa-card {
  background: var(--surface); border: 1px solid var(--border) !important; border-radius: var(--r-lg) !important; box-shadow: var(--sh-sm) !important;
}
.stat-card { transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md) !important; }
.stat-value { letter-spacing: -0.03em; font-feature-settings: 'tnum'; }
.welcome-card {
  border-radius: 22px !important; border: none !important; padding: 30px 34px !important;
  background: linear-gradient(120deg, #0F1D30 0%, #172B45 45%, #2a5a8c 100%) !important;
  box-shadow: 0 20px 40px -18px rgba(23,43,69,.55) !important; color: #fff;
}
.welcome-card h2 { font-size: 28px !important; letter-spacing: -0.03em !important; }
.welcome-card .btn { background: rgba(255,255,255,.12) !important; border: 1px solid rgba(255,255,255,.28) !important; color: #fff !important; backdrop-filter: blur(6px); }
.welcome-card .btn:hover { background: rgba(255,255,255,.22) !important; }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--r-sm) !important; font-weight: 600; font-size: 14px; padding: 11px 20px; letter-spacing: 0; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: 9px !important; }
.btn-primary { background: linear-gradient(180deg, #1f3a5f, #172B45) !important; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 16px -6px rgba(23,43,69,.6); }
.btn-primary:hover { background: linear-gradient(180deg, #274771, #1b3250) !important; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--sh-xs); }
.btn-ghost:hover { border-color: var(--sky-700); color: var(--sky-700); background: var(--surface); }
.btn-success { background: linear-gradient(180deg, #14b886, #0e9f72) !important; }

/* ---------- Forms ---------- */
.form-input, select.form-input, textarea.form-input, .month-select {
  border-radius: var(--r-sm) !important; border: 1px solid var(--border) !important; background: var(--surface) !important;
  font-size: 14px; color: var(--text); padding: 11px 14px; box-shadow: var(--sh-xs);
}
.form-input::placeholder { color: #98a8bf; }
.form-input:focus { border-color: var(--sky-700) !important; box-shadow: var(--ring) !important; transform: none !important; background: var(--surface) !important; }
.form-label { font-size: 11px; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

/* ---------- Tables ---------- */
table { border-collapse: separate; border-spacing: 0; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface2); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--sky-50); }
body.dark-theme tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }
.card > table, .table-wrap table { width: 100%; }
.card { overflow: hidden; }
.table-wrap, .card > div[style*="overflow"] { overflow-x: auto; }

/* ---------- Status chips ---------- */
.lead-status, .chip, .status-chip, .badge { border-radius: 999px !important; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; }

/* ---------- Tabs ---------- */
.tabs { background: var(--surface2); border-radius: 12px; padding: 4px; }
.tab { border-radius: 9px; font-weight: 600; font-size: 13px; }
.tab.active { box-shadow: var(--sh-sm); }

/* ---------- Modals / toasts ---------- */
.modal-overlay { background: rgba(10,20,34,.55) !important; backdrop-filter: blur(8px) !important; }
.modal { border-radius: 22px !important; box-shadow: var(--sh-lg) !important; border: 1px solid var(--border); }
.modal-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.toast { border-radius: 14px; box-shadow: var(--sh-md); background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::selection { background: rgba(134,182,226,.4); }

/* ---------- Empty / loading ---------- */
.empty-state { color: var(--muted); padding: 48px 20px; text-align: center; }
@keyframes spShimmer { 100% { transform: translateX(100%); } }
.sp-skel { position: relative; overflow: hidden; background: var(--surface2); border-radius: 10px; min-height: 16px; }
.sp-skel::after { content:''; position:absolute; inset:0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: spShimmer 1.3s infinite; }

/* ---------- Landing / login ---------- */
#landing::before {
  content:''; position:absolute; inset:0; z-index:-1; opacity:.5; pointer-events:none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
}
#landing .landing-sub { font-size: 17px !important; line-height: 1.55; max-width: 520px; }
#landing .login-card .card-icon {
  width: 60px; height: 60px; border-radius: 18px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
  background: linear-gradient(135deg, #172B45, #2a5a8c); color: #fff; box-shadow: 0 10px 22px -8px rgba(23,43,69,.55);
}
#landing .login-card .card-icon svg.ic { width: 28px; height: 28px; stroke-width: 1.6; }
#landing .login-card.employee .card-icon { background: linear-gradient(135deg, #3E7CB1, #86B6E2); }
#landing .login-card .card-title { font-size: 20px; }
#landing .login-card .badge { margin-bottom: 14px; }
#landing .badge.green { background: rgba(134,182,226,.2) !important; color: #2c6a9e !important; border-color: rgba(134,182,226,.5) !important; }

@media (max-width: 640px) { .page-title { font-size: 22px !important; } .welcome-card { padding: 22px !important; } }

/* ---------- Stat cards: compact, solid accent ---------- */
.stat-card { padding: 20px 22px !important; min-height: 0 !important; }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex !important; align-items: center; justify-content: center; font-size: 18px !important; margin-bottom: 12px !important; background: var(--surface2) !important; color: var(--navy); }
body.dark-theme .stat-card .stat-icon { color: var(--sky); }
.stat-card .stat-icon svg.ic { width: 20px; height: 20px; }
.stat-card::before { width: 4px !important; background: #3E7CB1 !important; border-radius: 4px 0 0 4px; opacity: .95; }
.stat-card.blue::before  { background: #3E7CB1 !important; }
.stat-card.green::before { background: #10b981 !important; }
.stat-card.red::before   { background: #ef4444 !important; }
.stat-card.gold::before  { background: #f59e0b !important; }
.stat-card.gold .stat-icon  { color: #b7791f; background: rgba(245,158,11,.12) !important; }
.stat-card.green .stat-icon { color: #0e9f72; background: rgba(16,185,129,.12) !important; }
.stat-card.red .stat-icon   { color: #dc2626; background: rgba(239,68,68,.10) !important; }
.stat-card.gold .stat-value { color: #b7791f !important; }
.stat-card .stat-label { font-size: 11.5px; letter-spacing: .06em; }
.quick-action-card .icon { width: 40px; height: 40px; margin: 0 auto 8px; border-radius: 12px; background: var(--sky-50); color: var(--navy); display:flex; align-items:center; justify-content:center; }
body.dark-theme .quick-action-card .icon { background: var(--surface2); color: var(--sky); }
.quick-action-card { border-radius: 14px !important; }
.nav-group-header > span:first-child { display: inline-flex; align-items: center; gap: 2px; }
.nav-group-header svg.ic { width: 15px; height: 15px; }

.finance-summary-card { border-radius: 16px !important; border: 1px solid var(--border) !important; box-shadow: var(--sh-sm) !important; }
.finance-summary-card .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--sky-50) !important; color: var(--navy); display:flex; align-items:center; justify-content:center; font-size: 18px; }
.finance-summary-card .icon svg.ic { width: 22px; height: 22px; }
body.dark-theme .finance-summary-card .icon { background: var(--surface2) !important; color: var(--sky); }
.quick-action-btn svg.ic { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; }
.topbar { width: calc(100% + 72px); box-sizing: border-box; }
@media (max-width: 1024px) { .topbar { width: calc(100% + 32px); } }

@media (min-width: 769px) {
  .page-header { flex-wrap: nowrap !important; }
  .page-header > .btn, .page-header > button { align-self: flex-end; flex-shrink: 0; width: auto !important; }
}

/* ---------- Dashboard analytics ---------- */
.sp-analytics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 4px 0 24px; }
.sp-span2 { grid-column: span 2; }
.sp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 22px 22px 16px; min-width: 0; }
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sp-title { font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: -0.01em; }
.sp-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sp-kpi { text-align: right; }
.sp-kpi > div { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); font-feature-settings: 'tnum'; }
.sp-delta { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.sp-delta.up { color: #0e9f72; } .sp-delta.down { color: #dc2626; }
.sp-grid { stroke: var(--border); stroke-dasharray: 3 4; }
.sp-axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.sp-bar { fill: #86B6E2; transition: opacity .15s; } .sp-bar-cur { fill: #172B45; }
body.dark-theme .sp-bar-cur { fill: #86B6E2; } body.dark-theme .sp-bar { fill: #2f5a86; }
.sp-bar:hover { opacity: .8; }
.sp-area { fill: rgba(62,124,177,.14); }
.sp-line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sp-line-a { stroke: #3E7CB1; } .sp-line-b { stroke: #10b981; stroke-dasharray: 5 4; }
.sp-dot { stroke: var(--surface); stroke-width: 2; } .sp-dot-a { fill: #3E7CB1; } .sp-dot-b { fill: #10b981; }
.sp-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.sp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sp-legend .a { background: #3E7CB1; } .sp-legend .b { background: #10b981; }
.sp-rate { margin-bottom: 14px; } .sp-rate span { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; color: var(--text); }
.sp-rate small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sp-frow { display: grid; grid-template-columns: 96px 1fr 32px; gap: 10px; align-items: center; margin: 11px 0; font-size: 12.5px; }
.sp-flab { color: var(--muted); font-weight: 500; } .sp-fval { text-align: right; font-weight: 700; font-feature-settings: 'tnum'; }
.sp-ftrack, .sp-ltrack { height: 8px; background: var(--surface2); border-radius: 8px; overflow: hidden; }
.sp-fbar { height: 100%; border-radius: 8px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.sp-f1 { background: #86B6E2; } .sp-f2 { background: #3E7CB1; } .sp-f3 { background: #10b981; } .sp-f4 { background: #cbd5e1; }
.sp-lrow { display: flex; align-items: center; gap: 12px; margin: 13px 0; }
.sp-lav { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #172B45, #3E7CB1); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.sp-lmid { flex: 1; min-width: 0; } .sp-lname { font-size: 13px; font-weight: 600; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-ltrack div { height: 100%; background: #3E7CB1; border-radius: 8px; }
.sp-lnum { text-align: right; line-height: 1.2; } .sp-lnum b { font-size: 15px; } .sp-lnum small { display: block; font-size: 10.5px; color: var(--muted); }
.sp-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 50px 10px; }
.sp-tip { position: fixed; z-index: 5000; display: none; pointer-events: none; background: #0F1D30; color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5; box-shadow: var(--sh-md); border: 1px solid rgba(134,182,226,.3); }
@media (max-width: 1100px) { .sp-analytics { grid-template-columns: 1fr 1fr; } .sp-span2 { grid-column: span 2; } }
@media (max-width: 720px) { .sp-analytics { grid-template-columns: 1fr; } .sp-span2 { grid-column: auto; } }
body.dark-theme .sp-bar.sp-bar-cur { fill: #86B6E2; }

/* ---------- Phase 4: data pages ---------- */
.search-input, .month-select, select.month-select {
  height: 40px; border-radius: 10px !important; border: 1px solid var(--border) !important; background: var(--surface) !important;
  padding: 0 14px; font-size: 13.5px; color: var(--text); box-shadow: var(--sh-xs); outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-input:focus, .month-select:focus { border-color: var(--sky-700) !important; box-shadow: var(--ring); }
.search-input { background-image: none; min-width: 220px; }
input[type="checkbox"] { accent-color: #172B45; width: 16px; height: 16px; cursor: pointer; }
body.dark-theme input[type="checkbox"] { accent-color: #86B6E2; }

.btn svg.ic { width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; }
.btn svg.ic:only-child { margin: 0; }
.btn-sm svg.ic { width: 14px; height: 14px; }
.lead-status, .priority-badge, .badge { display: inline-flex !important; align-items: center; gap: 5px; padding: 4px 10px; white-space: nowrap; }
.lead-status svg.ic, .badge svg.ic { width: 12px; height: 12px; margin: 0; }
.priority-badge { border-radius: 999px !important; text-transform: none !important; font-size: 11.5px !important; }
.priority-badge .pdot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
td .btn { white-space: nowrap; }
td a[href^="tel"] { font-feature-settings: 'tnum'; }

.empty-state { padding: 56px 20px !important; }
.empty-state-icon { width: 64px; height: 64px; margin: 0 auto 16px !important; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 28px !important; background: var(--sky-50); color: var(--sky-700); }
body.dark-theme .empty-state-icon { background: var(--surface2); color: var(--sky); }
.empty-state-icon svg.ic { width: 28px; height: 28px; stroke-width: 1.5; }
.empty-state-text { font-weight: 600; color: var(--text); }

.sp-skel-row td { padding: 18px 16px !important; }
.sp-skel-row:hover { background: transparent !important; }

.pagination-wrapper { border-top: 1px solid var(--border); background: var(--surface); }
.pagination-buttons .btn { min-width: 34px; height: 34px; padding: 0 10px !important; border-radius: 9px !important; }
.pagination-buttons .btn.btn-primary { box-shadow: none; }

#leadsStatsGrid { gap: 14px !important; margin-bottom: 22px !important; }
#leadsStatsGrid .stat-card { padding: 14px 16px !important; cursor: pointer; }
#leadsStatsGrid .stat-icon { width: 30px; height: 30px; margin-bottom: 8px !important; border-radius: 9px; }
#leadsStatsGrid .stat-icon svg.ic { width: 16px; height: 16px; }
#leadsStatsGrid .stat-value { font-size: 24px !important; }
#leadsStatsGrid .stat-label { font-size: 10.5px; }

/* filter toolbars sit in a soft panel */
.page > div[style*="flex-wrap:wrap"][style*="margin-bottom:16px"] { padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--sh-xs); }
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); overflow: hidden; }
.table-header { padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.table-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.overflow-x { overflow-x: auto; max-width: 100%; }

/* layout fixes */
#leadsStatsGrid { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)) !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; }
td .btn, .page-header .btn, .table-header .btn { width: auto !important; }
.page-header > div:last-child:not(:first-child) { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; align-items: center; width: auto !important; }
td > div[style*="flex-wrap"] { flex-wrap: wrap; }

/* ---------- Status & priority chips (explicit, readable in both themes) ---------- */
.lead-status, .priority-badge { border: 1px solid transparent; }
.lead-status.new            { background: rgba(62,124,177,.12);  color: #2c6a9e; border-color: rgba(62,124,177,.25); }
.lead-status.contacted      { background: rgba(99,102,241,.10);  color: #4f56c9; border-color: rgba(99,102,241,.22); }
.lead-status.interested     { background: rgba(16,185,129,.12);  color: #0b8a62; border-color: rgba(16,185,129,.28); }
.lead-status.converted      { background: #10b981;               color: #fff;    border-color: #10b981; }
.lead-status.not_interested { background: rgba(239,68,68,.10);   color: #c92a2a; border-color: rgba(239,68,68,.25); }
.lead-status.call_not_pick, .lead-status.invalid, .lead-status.lost { background: rgba(100,116,139,.12); color: #526075; border-color: rgba(100,116,139,.25); }
.lead-status.callback       { background: rgba(245,158,11,.14);  color: #9a6208; border-color: rgba(245,158,11,.30); }
.priority-badge.high   { background: rgba(239,68,68,.10);  color: #c92a2a; }
.priority-badge.medium { background: rgba(245,158,11,.14); color: #9a6208; }
.priority-badge.low    { background: rgba(16,185,129,.12); color: #0b8a62; }
body.dark-theme .lead-status.new            { color: #8cc0ee; background: rgba(134,182,226,.14); border-color: rgba(134,182,226,.3); }
body.dark-theme .lead-status.contacted      { color: #aab0ff; }
body.dark-theme .lead-status.interested     { color: #4fe0b0; }
body.dark-theme .lead-status.not_interested { color: #ff8e8e; }
body.dark-theme .lead-status.call_not_pick, body.dark-theme .lead-status.invalid, body.dark-theme .lead-status.lost { color: #a9b8cc; }
body.dark-theme .lead-status.callback, body.dark-theme .priority-badge.medium { color: #fbbf24; }
body.dark-theme .priority-badge.high { color: #ff8e8e; } body.dark-theme .priority-badge.low { color: #4fe0b0; }

input[type="date"], input[type="month"], input[type="time"], input[type="datetime-local"], input[type="number"] { font-family: inherit; }
tbody tr:has(.empty-state):hover { background: transparent; }

/* ---------- Phase 5: mobile & employee portal ---------- */
.empty-state svg.ic, .toast svg.ic { vertical-align: -3px; }
@media (max-width: 768px) {
  .page-header { align-items: flex-start !important; flex-direction: column; }
  .page-header > div:last-child:not(:first-child) { justify-content: flex-start; width: 100% !important; }
  .stat-card { padding: 14px 16px !important; }
  .stat-card .stat-icon { width: 32px; height: 32px; margin-bottom: 8px !important; border-radius: 10px; }
  .stat-card .stat-icon svg.ic { width: 16px; height: 16px; }
  .stat-card .stat-value { font-size: 24px !important; }
  .stats-grid { gap: 12px !important; }
  .card, .table-card { border-radius: 16px !important; }
  .modal { border-radius: 20px 20px 0 0 !important; }
  .mobile-bottom-nav { backdrop-filter: blur(14px); background: color-mix(in srgb, var(--surface) 90%, transparent) !important; border-top: 1px solid var(--border) !important; box-shadow: 0 -6px 24px -10px rgba(15,29,48,.18); }
  .mobile-bottom-nav .bn-item.active, .mobile-bottom-nav .active { color: var(--sky-700) !important; }
  .mobile-bottom-nav svg.ic { width: 22px; height: 22px; }
  td, th { padding: 12px 12px; }
  .search-input { min-width: 0; width: 100% !important; }
}
.attendance-card, #page-mark .card { border-radius: 24px !important; }
#page-mark .clock, .att-clock { color: var(--navy); letter-spacing: -0.04em; }
body.dark-theme #page-mark .clock, body.dark-theme .att-clock { color: var(--sky); }

/* ===== Login (split screen) ===== */
#landing { padding: 0 !important; background: #fff !important; }
#landing::before { display: none !important; }
.lg { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; font-family: Inter, system-ui, sans-serif; z-index: 5; }
.lg-brand { position: relative; overflow: hidden; color: #fff; padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 110% -10%, rgba(134,182,226,.35), transparent 60%), radial-gradient(700px 500px at -20% 110%, rgba(134,182,226,.18), transparent 60%), linear-gradient(160deg, #172B45 0%, #0f1e32 100%); }
.lg-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 1px solid rgba(134,182,226,.22); box-shadow: 0 0 0 60px rgba(134,182,226,.05), 0 0 0 130px rgba(134,182,226,.035); }
#landing .lg-brand img { max-width: 210px !important; width: 210px !important; margin: 0 !important; transform: none !important; filter: none !important; display: block; }
.lg-brand-mid h1 { font-size: 36px; line-height: 1.15; font-weight: 800; letter-spacing: -.8px; margin: 0 0 14px; color: #fff; }
.lg-brand-mid p { font-size: 16px; color: rgba(255,255,255,.72); margin: 0 0 30px; max-width: 420px; line-height: 1.55; }
.lg-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.lg-points li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: rgba(255,255,255,.9); }
.lg-points li span { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(134,182,226,.16); color: #86B6E2; flex: none; }
.lg-points svg { width: 18px; height: 18px; }
.lg-brand-foot { font-size: 12px; color: rgba(255,255,255,.5); position: relative; z-index: 1; }
.lg-main { display: grid; place-items: center; padding: 32px 24px; background: linear-gradient(180deg, #f7f9fc, #eef3f9); overflow-y: auto; }
.lg-card { width: 100%; max-width: 410px; background: #fff; border-radius: 20px; padding: 36px 34px 28px; box-shadow: 0 24px 60px rgba(23,43,69,.12), 0 2px 6px rgba(23,43,69,.05); border: 1px solid rgba(23,43,69,.06); }
.lg-card h2 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: #172B45; }
.lg-sub { margin: 0 0 22px; color: #6b7a90; font-size: 14px; }
.lg-mobile-logo { display: none; height: 40px; margin-bottom: 18px; }
.lg-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #eef2f8; border-radius: 12px; margin-bottom: 20px; }
.lg-tab { border: 0; background: transparent; padding: 10px; border-radius: 9px; font: 600 14px Inter, sans-serif; color: #5b6b82; cursor: pointer; transition: .2s; }
.lg-tab.active { background: #fff; color: #172B45; box-shadow: 0 2px 8px rgba(23,43,69,.12); }
.lg-field { margin-bottom: 16px; }
.lg-field label { display: block; font-size: 12.5px; font-weight: 600; color: #3b4b63; margin-bottom: 6px; }
.lg-field input[type=text], .lg-field input[type=password] { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1.5px solid #dbe3ee; border-radius: 11px; font: 15px Inter, sans-serif; color: #172B45; background: #fff; outline: none; transition: .2s; }
.lg-field input:focus { border-color: #86B6E2; box-shadow: 0 0 0 4px rgba(134,182,226,.25); }
.lg-pass { position: relative; }
.lg-pass input { padding-right: 46px !important; }
.lg-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: transparent; color: #7b8aa0; cursor: pointer; border-radius: 8px; }
.lg-eye:hover { background: #eef2f8; color: #172B45; }
.lg-eye svg { width: 18px; height: 18px; }
.lg-caps { display: none; margin-top: 6px; font-size: 12px; color: #b7791f; }
.lg-caps.show { display: block; }
.lg-row { display: flex; justify-content: space-between; align-items: center; margin: -2px 0 18px; font-size: 13px; }
.lg-check { display: flex; align-items: center; gap: 7px; color: #4a5a72; cursor: pointer; }
.lg-check input { accent-color: #172B45; width: 15px; height: 15px; }
.lg-link { color: #2c6a9e; text-decoration: none; font-weight: 600; }
.lg-link:hover { text-decoration: underline; }
.lg .error-msg { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #fdecec; color: #b42318; font-size: 13px; border: 1px solid #f7caca; display: none; }
.lg .error-msg.show { display: block; }
.lg-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 16px; border: 0; border-radius: 12px; cursor: pointer; font: 700 15px Inter, sans-serif; color: #fff; background: linear-gradient(135deg, #172B45, #24466f); box-shadow: 0 10px 24px rgba(23,43,69,.28); transition: .2s; position: relative; }
.lg-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(23,43,69,.34); }
.lg-btn:disabled { opacity: .85; cursor: wait; transform: none; }
.lg-btn svg { width: 19px; height: 19px; }
.lg-btn-alt { background: #fff; color: #172B45; border: 1.5px solid #dbe3ee; box-shadow: none; }
.lg-btn-alt:hover { border-color: #86B6E2; background: #f5f9fd; box-shadow: none; }
.lg-spin { display: none; width: 17px; height: 17px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: lgspin .7s linear infinite; }
.lg-btn.loading .lg-spin { display: block; }
@keyframes lgspin { to { transform: rotate(360deg); } }
.lg-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: #94a3b8; font-size: 12px; }
.lg-or::before, .lg-or::after { content: ""; flex: 1; height: 1px; background: #e3e9f1; }
.lg-secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; font-size: 12px; color: #8a98ad; }
.lg-secure svg { width: 14px; height: 14px; }
@media (max-width: 860px) {
  .lg { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .lg-brand { padding: 22px 24px; flex-direction: row; align-items: center; }
  .lg-brand-mid, .lg-brand-foot, .lg-brand::after { display: none; }
  #landing .lg-brand img { max-width: 150px !important; width: 150px !important; }
  .lg-main { padding: 20px 16px 32px; align-items: start; }
  .lg-card { padding: 26px 20px 22px; }
}

/* ===== Phase 2: shell ===== */
.nav-group-header { padding: 8px 14px !important; margin-top: 10px !important; font-size: 10.5px !important; opacity: .8; }
.nav-group.open .nav-group-content { max-height: 600px; }
.nav-group-header .chevron { font-size: 7px; opacity: .6; }
.tb-title { font-weight: 700; font-size: 15px; color: var(--text); flex-shrink: 0; white-space: nowrap; letter-spacing: -.2px; }
.tb-crumb { color: var(--muted); font-weight: 500; font-size: 13px; margin-right: 2px; }
.sp-new { position: relative; display: inline-flex; }
.sp-new-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 10px; cursor: pointer; font: 600 13px Inter, sans-serif; color: #fff; background: linear-gradient(135deg, #172B45, #24466f); box-shadow: 0 6px 16px rgba(23,43,69,.25); }
.sp-new-btn:hover { transform: translateY(-1px); }
.sp-new-btn svg { width: 15px; height: 15px; }
.sp-new-menu { display: none; position: absolute; right: 0; top: 44px; min-width: 190px; padding: 6px; background: var(--card, #fff); border: 1px solid rgba(23,43,69,.12); border-radius: 12px; box-shadow: 0 18px 50px rgba(23,43,69,.22); z-index: 999; }
.sp-new-menu.open { display: block; }
.sp-new-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: transparent; border-radius: 8px; font: 500 13.5px Inter, sans-serif; color: var(--text); cursor: pointer; }
.sp-new-menu button:hover { background: rgba(134,182,226,.18); }
.sp-rec-h { padding: 8px 14px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-top: 1px solid rgba(23,43,69,.08); }
.sp-tag { display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; background: rgba(134,182,226,.25); color: #2c6a9e; }
@media (max-width: 760px) { .sp-new-btn span { display: none; } .sp-new-btn { padding: 9px 10px; } .tb-crumb { display: none; } }

/* ===== Phase 3: admin home ===== */
.hm-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.hm-count { display: inline-block; min-width: 20px; padding: 1px 7px; margin-left: 6px; border-radius: 10px; font-size: 11px; font-weight: 700; background: #e5484d; color: #fff; vertical-align: middle; }
.hm-count:empty { display: none; }
.hm-list { max-height: 360px; overflow-y: auto; }
.hm-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid rgba(23,43,69,.06); }
.hm-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.hm-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hm-txt b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-txt span { font-size: 12px; color: var(--muted); }
.hm-empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.hm-pipe-row { display: flex; align-items: stretch; gap: 8px; padding: 6px 18px 18px; flex-wrap: wrap; }
.hm-stage { flex: 1; min-width: 130px; padding: 14px 16px; border-radius: 14px; cursor: pointer; background: var(--bg, #f4f7fb); border: 1px solid rgba(23,43,69,.08); transition: .2s; }
.hm-stage:hover { border-color: #86B6E2; transform: translateY(-2px); }
.hm-stage-n { font-size: 26px; font-weight: 800; color: #172B45; line-height: 1.1; }
.hm-stage-l { font-size: 13px; font-weight: 600; margin-top: 2px; }
.hm-stage-s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.hm-arrow { align-self: center; color: #86B6E2; font-size: 22px; }
body.dark-theme .hm-stage-n { color: #cfe3f7; }
@media (max-width: 980px) { .hm-grid { grid-template-columns: 1fr; } .hm-arrow { display: none; } }
#spToday { padding: 18px 20px !important; }

/* ===== Phase 4: attendance insights ===== */
.ai-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ai-tile { background: var(--card, #fff); border: 1px solid rgba(23,43,69,.08); border-radius: 14px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(23,43,69,.04); }
.ai-n { font-size: 26px; font-weight: 800; line-height: 1.1; }
.ai-l { font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.ai-s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ai-note { padding: 11px 14px; border-radius: 11px; font-size: 13px; margin-bottom: 10px; border: 1px solid; }
.ai-note.warn { background: #fff7e8; border-color: #f4dcae; color: #8a5a0b; }
.ai-note.bad { background: #fdecec; border-color: #f7caca; color: #b42318; }
.ai-note.good { background: #e9f8f0; border-color: #bfe8d2; color: #14703f; }
.ai-cal { max-width: 460px; }
.ai-dow, .ai-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.ai-dow b { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.ai-day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; font-size: 13px; font-weight: 700; position: relative; cursor: default; }
.ai-day.miss::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #e5484d; }
.ai-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.ai-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ai-legend i.dot { border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #e5484d; width: 6px; height: 6px; }
.ai-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-chip { border: 1px solid rgba(23,43,69,.14); background: transparent; border-radius: 999px; padding: 5px 12px; font: 600 12px Inter, sans-serif; color: var(--muted); cursor: pointer; }
.ai-chip.on { background: #172B45; color: #fff; border-color: #172B45; }
.ai-pill { display: inline-block; min-width: 24px; text-align: center; padding: 2px 8px; border-radius: 8px; font-weight: 700; font-size: 12.5px; }
.ai-row { cursor: pointer; }
.ai-row:hover { background: rgba(134,182,226,.12); }
#spMyPay { padding: 18px 20px !important; }

/* ===== Phase 5: billing lists ===== */
.bl-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.bl-chip { border: 1px solid rgba(23,43,69,.14); background: var(--card, #fff); color: var(--muted); border-radius: 999px; padding: 7px 14px; font: 600 13px Inter, sans-serif; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.bl-chip i { font-style: normal; font-size: 11.5px; padding: 1px 7px; border-radius: 9px; background: rgba(23,43,69,.08); }
.bl-chip.on { background: #172B45; border-color: #172B45; color: #fff; }
.bl-chip.on i { background: rgba(255,255,255,.2); }
.bl-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.sp-more { position: absolute; z-index: 9999; min-width: 170px; padding: 6px; background: var(--card, #fff); border: 1px solid rgba(23,43,69,.12); border-radius: 12px; box-shadow: 0 18px 50px rgba(23,43,69,.22); }
.sp-more button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: transparent; border-radius: 8px; font: 500 13.5px Inter, sans-serif; color: var(--text); cursor: pointer; }
.sp-more button:hover { background: rgba(134,182,226,.18); }
.sp-more button.danger { color: #e5484d; }
.quot-badge.draft { background: rgba(23,43,69,.08); color: var(--muted); }
#page-invoices .stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
#page-invoices .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; gap: 14px; }
#page-invoices .stat-card { padding: 14px 16px !important; }
#page-invoices .stat-icon { display: none !important; }
#page-invoices .stat-value { font-size: 24px !important; }
#page-invoices > div[style*="margin-bottom:16px"] { margin-bottom: 10px !important; }
#page-invoices > div[style*="margin-bottom:16px"] .month-select { background: var(--card, #fff); }

/* ===== Phase 6: Client 360 ===== */
.c360-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.c360-why{font-size:12px;color:var(--muted);margin-top:6px}
.c360-actions{display:flex;gap:8px;flex-wrap:wrap}
.c360-actions .btn{text-decoration:none}
.c360-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;margin-bottom:12px}
.c360-stat{background:var(--surface2);border:1px solid var(--border);border-radius:12px;padding:12px}
.c360-n{font-size:20px;font-weight:800;color:var(--text)}
.c360-l{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:700;margin-top:2px}
.c360-stat.ok .c360-n{color:#16a34a}.c360-stat.warn .c360-n{color:#d97706}.c360-stat.bad .c360-n{color:#dc2626}
.c360-meta{display:flex;gap:16px;flex-wrap:wrap;font-size:12px;color:var(--muted);margin-bottom:6px}
.c360-meta b{color:var(--text)}
.c360-h{font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin:18px 0 8px}
.c360-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--border);font-size:13px}
.c360-row small{display:block;color:var(--muted);font-size:11px}
.c360-amt{display:flex;align-items:center;gap:8px;font-weight:700}
.c360-tl{border-left:2px solid var(--border);margin-left:10px;padding-left:14px}
.c360-ev{display:flex;gap:10px;padding:7px 0;font-size:13px}
.c360-ev small{color:var(--muted);font-size:11px}
.c360-ic{margin-left:-27px;background:var(--surface);border:1px solid var(--border);border-radius:50%;width:24px;height:24px;display:inline-flex;align-items:center;justify-content:center;font-size:12px;flex:none}
.c360-empty{padding:14px;text-align:center;color:var(--muted);font-size:13px}
.c360-actions{flex:1 1 100%}
.c360-actions .btn,.c360-actions a.btn{width:auto!important;display:inline-flex!important;align-items:center;justify-content:center;padding:8px 14px!important;border:1px solid var(--border)!important;background:var(--surface2)!important;color:var(--text)!important;border-radius:10px;font-weight:600;font-size:13px}
.c360-actions .btn-primary{background:#172B45!important;color:#fff!important;border-color:#172B45!important}

/* ===== Phase 7: Employee home ===== */
.md{margin:0 0 18px}
.md-hero{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;background:linear-gradient(135deg,#172B45,#25476f);color:#fff;border-radius:16px;padding:20px 22px;margin-bottom:14px}
.md-hi{font-size:22px;font-weight:800}.md-sub{font-size:13px;opacity:.85;margin-top:4px}
.md-hero .btn{background:#86B6E2!important;color:#172B45!important;border:0!important;font-weight:700;width:auto!important}
.md-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:14px;margin-bottom:14px}
.md-card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px}
.md-h{font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--muted);margin-bottom:10px}
.md-item{padding:9px 10px;border-left:3px solid #86B6E2;background:var(--surface2);border-radius:8px;margin-bottom:8px;font-size:13px;cursor:default}
.md-item[onclick]{cursor:pointer}.md-item.high{border-left-color:#dc2626}.md-item.med{border-left-color:#d97706}
.md-item small{display:block;color:var(--muted);font-size:11px;margin-top:2px}
.md-empty{color:var(--muted);font-size:13px;padding:10px 0}
.md-bar{height:8px;background:var(--surface2);border-radius:99px;overflow:hidden}.md-bar i{display:block;height:100%;background:#172B45}
.md-acts{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.md-acts .btn{width:auto!important}
body.dark-theme .md-bar i{background:#86B6E2}

/* ===== Phase 7: shared page template ===== */
#leadsStatsGrid{grid-template-columns:repeat(auto-fit,minmax(104px,1fr))!important;gap:10px!important}
#leadsStatsGrid .stat-card{padding:12px!important}
#leadsStatsGrid .stat-value{font-size:22px!important}
#leadsStatsGrid .stat-label{font-size:10px!important;white-space:normal}
#page-budget .page-header,#page-services .page-header,#page-worklog .page-header,#page-leaves .page-header,#page-salary .page-header,#page-leads .page-header,#page-todos .page-header,#page-holidays .page-header,
#emp-page-worklog .page-header,#emp-page-leaves .page-header,#emp-page-todos .page-header,#emp-page-myleads .page-header{padding-bottom:14px;margin-bottom:16px;border-bottom:1px solid var(--border)}
#page-budget .table-card,#page-services .table-card,#page-worklog .table-card,#page-leaves .table-card,#page-salary .table-card,#page-leads .table-card,
#emp-page-worklog .table-card,#emp-page-leaves .table-card,#emp-page-myleads .table-card{border-radius:14px;border:1px solid var(--border);overflow:hidden}
.page .month-select,.page .search-input{border-radius:10px}
.page table thead th{font-size:11px;letter-spacing:.05em;text-transform:uppercase}
.page table tbody tr:hover{background:var(--surface2)}

/* ===== Phase 8: Automations + polish ===== */
.au-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:14px}
.au-card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px}
.au-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.au-ic{font-size:20px;background:var(--surface2);border-radius:10px;width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center}
.au-t{font-weight:800;font-size:14px;margin-bottom:6px}
.au-how{font-size:12.5px;color:var(--muted);line-height:1.5;margin-bottom:10px}
.au-stat{font-size:12px;font-weight:700;color:#172B45;background:rgba(134,182,226,.25);display:inline-block;padding:4px 10px;border-radius:99px}
.au-det{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px;font-size:11px;color:var(--muted)}
.au-det span{background:var(--surface2);border-radius:8px;padding:3px 8px}.au-det b{color:var(--text)}
/* dark mode for phase 6-8 components */
body.dark-theme .au-stat{color:#86B6E2;background:rgba(134,182,226,.15)}
body.dark-theme .md-hero{background:linear-gradient(135deg,#0f1c2e,#1b3556)}
body.dark-theme .c360-actions .btn-primary{background:#86B6E2!important;color:#172B45!important;border-color:#86B6E2!important}
body.dark-theme .c360-stat.ok .c360-n{color:#4ade80}body.dark-theme .c360-stat.warn .c360-n{color:#fbbf24}body.dark-theme .c360-stat.bad .c360-n{color:#f87171}
/* friendlier empty states */
.c360-empty,.md-empty,.empty-state{padding:22px 14px!important;text-align:center;color:var(--muted);font-size:13px}
@media(max-width:768px){.md-hero{padding:16px}.md-hi{font-size:18px}.c360-actions .btn{flex:1 1 auto}.au-grid{grid-template-columns:1fr}}

/* ===== Phase 9 ===== */
.bt-form{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.bt-form .form-input{flex:1 1 150px;min-width:120px;width:auto}
.bt-form .btn{width:auto!important}
.sp-ann{margin:0 0 14px;display:grid;gap:8px}
.sp-ann-i{display:flex;gap:10px;align-items:flex-start;background:rgba(134,182,226,.18);border:1px solid rgba(134,182,226,.5);border-radius:12px;padding:10px 12px;font-size:13px}
.sp-ann-i>div{flex:1}.sp-ann-i .btn{width:auto!important}
.sp-lb{margin:0 0 14px;padding:10px 14px;background:var(--surface);border:1px solid var(--border);border-radius:12px;font-size:13px}
.sp-lb span{color:var(--muted)}
.ls{display:inline-block;margin-left:8px;font-size:10px;font-weight:800;padding:2px 7px;border-radius:99px;vertical-align:middle}
.ls-hot{background:#fee2e2;color:#b91c1c}.ls-warm{background:#fef3c7;color:#b45309}.ls-cold{background:#e0e7ff;color:#4338ca}
body.dark-theme .ls-hot{background:rgba(248,113,113,.18);color:#f87171}body.dark-theme .ls-warm{background:rgba(251,191,36,.18);color:#fbbf24}body.dark-theme .ls-cold{background:rgba(129,140,248,.18);color:#a5b4fc}
body.dark-theme .au-det b{color:#e6edf6}

/* ===== Quotation services (Services page) ===== */
.tpl-h2{font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--text);margin:0 0 12px}
.tpl-h2 small{font-weight:500;text-transform:none;letter-spacing:0;color:var(--muted);margin-left:8px;font-size:12px}
.tpl-top{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}
.tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}
.tpl-card{display:flex;gap:12px;align-items:flex-start;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px}
.tpl-ic{font-size:22px;width:44px;height:44px;border-radius:12px;background:var(--surface2);display:flex;align-items:center;justify-content:center;flex:none}
.tpl-body{flex:1;min-width:140px}.tpl-name{font-weight:800;font-size:14px}.tpl-meta{font-size:12px;color:var(--muted);margin-top:2px}
.tpl-price{font-size:12px;font-weight:700;color:#16a34a;margin-top:6px}
.tpl-act{display:flex;gap:6px;width:100%}.tpl-act .btn{width:auto!important}
.tpl-prices{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.tpl-prices small{display:block;color:var(--muted);font-size:11px;margin-bottom:3px}
.tpl-sec{border:1px solid var(--border);border-radius:12px;padding:10px;margin-bottom:10px;background:var(--surface2)}
.tpl-sec-top{display:flex;gap:8px;margin-bottom:8px}.tpl-sec-top .btn{width:auto!important}
@media(max-width:600px){.tpl-prices{grid-template-columns:repeat(2,1fr)}}
.tpl-top .btn{width:auto!important;flex:none}

/* ===== Leads page redesign ===== */
#page-leads .page-header{border-bottom:0;margin-bottom:12px;padding-bottom:0}
/* stat cards: one even row, icon beside number */
#leadsStatsGrid{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(150px,1fr))!important;gap:12px!important;margin-bottom:16px}
#leadsStatsGrid .stat-card{display:grid!important;grid-template-columns:40px 1fr;grid-template-areas:"i l" "i v";column-gap:12px;align-items:center;padding:14px 16px!important;min-height:0!important;transform:none!important;border-radius:14px}
#leadsStatsGrid .stat-card:hover{transform:none!important;box-shadow:var(--sh-md)!important}
#leadsStatsGrid .stat-icon{grid-area:i;margin:0!important;width:40px!important;height:40px!important}
#leadsStatsGrid .stat-label{grid-area:l;font-size:10.5px!important;letter-spacing:.06em;margin:0!important;align-self:end}
#leadsStatsGrid .stat-value{grid-area:v;font-size:24px!important;line-height:1.1;margin:0!important;align-self:start}
/* filter bar as a single card row */
.lead-filters{display:flex;gap:10px;flex-wrap:wrap;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:10px 12px;margin-bottom:14px}
.lead-filters .search-input{flex:1 1 240px;min-width:200px;width:auto!important}
.lead-filters .month-select{min-width:140px}
.lead-filters label{white-space:nowrap}
/* table */
#page-leads .table-card .table-header{padding:14px 18px}
#leadsTable td,#leadsTable th{padding:14px 14px!important;vertical-align:middle}
#leadsTable tr{border-bottom:1px solid var(--border)}
#leadsTable td:nth-child(3){min-width:170px}
#leadsTable td div[style*="word-break"]{word-break:normal!important;overflow-wrap:anywhere;max-width:200px}
#leadsTable td:nth-child(4){max-width:220px}
#leadsTable td:nth-child(4) div[style*="font-size:11px"]{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
#leadsTable td:nth-last-child(1)>div{flex-wrap:nowrap!important;gap:6px!important}
#leadsTable td:nth-last-child(1) .btn{white-space:nowrap;width:auto!important}
#leadsTable td:nth-last-child(1) .btn-ghost{border:1px solid var(--border)!important;background:var(--surface)!important}
#leadsTable select.month-select{width:128px!important;border-radius:10px!important;background-color:var(--surface2);font-weight:600}
#leadsTable tr:hover td{background:var(--surface2)}
.ls{margin-left:6px}
/* bulk-action bar floats at the bottom only when leads are ticked */
#bulkActionBar{position:sticky;bottom:14px;z-index:20;margin-top:12px;padding:12px 16px;background:#172B45;color:#fff;border-radius:14px;box-shadow:0 10px 30px rgba(23,43,69,.35);gap:10px;align-items:center;flex-wrap:wrap}
#bulkActionBar #selectedCount{color:#cfe3f6!important;font-weight:700}
#bulkActionBar .month-select{min-width:160px}
#bulkActionBar .btn-primary{background:#86B6E2!important;color:#172B45!important;border:0!important}
@media(max-width:768px){#leadsTable td:nth-last-child(1)>div{flex-wrap:wrap!important}.lead-filters .month-select{flex:1 1 140px}}
/* leads: fit everything in one view */
#leadsStatsGrid{grid-template-columns:repeat(7,minmax(0,1fr))!important;gap:10px!important}
#leadsStatsGrid .stat-card{grid-template-columns:34px 1fr;column-gap:10px;padding:12px 12px!important}
#leadsStatsGrid .stat-icon{width:34px!important;height:34px!important;border-radius:10px!important}
#leadsStatsGrid .stat-icon svg.ic{width:17px!important;height:17px!important}
#leadsStatsGrid .stat-value{font-size:22px!important}
#leadsStatsGrid .stat-label{font-size:9.5px!important;letter-spacing:.04em}
@media(max-width:1180px){#leadsStatsGrid{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))!important}}
#leadsTable td,#leadsTable th{padding:12px 9px!important}
#leadsTable th:first-child,#leadsTable td:first-child{padding-left:16px!important;width:34px}
#leadsTable td:nth-child(2){min-width:130px}
#leadsTable td:nth-child(2)>div:first-child{white-space:nowrap}
#leadsTable td:nth-child(2) .ls{display:inline-block;margin:4px 0 0 0}
#leadsTable td:nth-child(2)>div:first-child .ls{display:inline-block;margin:0 0 0 6px}
#leadsTable td:nth-child(3){min-width:0}
#leadsTable td:nth-child(4){max-width:150px}
#leadsTable td:nth-child(4) div[style*="font-size:11px"]{-webkit-line-clamp:1}
#leadsTable td:nth-child(5){width:1%}
#leadsTable select.month-select{width:112px!important;padding:6px 8px!important;font-size:12px!important}
#leadsTable td:nth-last-child(1) .btn{padding:6px 9px!important;font-size:11.5px!important}
#leadsTable td:nth-last-child(1) .btn-ghost[onclick*="openEditLead"],#leadsTable td:nth-last-child(1) .btn-ghost[onclick*="deleteLead"]{padding:6px 7px!important}
#leadsTable td:nth-child(7){white-space:nowrap}
#leadsTable td:nth-last-child(1)>div{flex-wrap:wrap!important;max-width:200px}
#leadsTable td:nth-child(3) a{white-space:nowrap}
#leadsTable td:nth-child(3) div[style*="word-break"]{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal}
#leadsTable td:nth-last-child(1)>div{max-width:250px}
#bulkActionBar .btn{width:auto!important}#bulkActionBar{display:none}#bulkActionBar[style*="flex"]{display:flex!important}

/* ===== Mobile: sidebar fully visible incl. Logout ===== */
@media (max-width: 1024px) {
  body.sb-open #adminBottomNav, body.sb-open #empBottomNav { display: none !important; }
  .sidebar { height: 100vh; height: 100dvh; max-height: 100dvh; }
  .sidebar .sidebar-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important; position: sticky; bottom: 0; background: inherit; z-index: 2; }
}
