/* Lead CRM — UI styles (Bootstrap 5 base) */
:root {
  --primary: #2563eb; --primary-600: #1d4ed8; --primary-50: #eff6ff;
  --bg: #f5f7fb; --card: #ffffff; --border: #e7eaf0; --text: #0f172a; --muted: #64748b;
  --sidebar: #0f172a; --sidebar-2: #1e293b; --sidebar-text: #cbd5e1;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --bs-primary: #2563eb; --bs-primary-rgb: 37, 99, 235; --bs-link-color: #2563eb; --bs-link-hover-color: #1d4ed8;
}
* { -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: .925rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-600); --bs-btn-hover-border-color: var(--primary-600); --bs-btn-active-bg: var(--primary-600); --bs-btn-disabled-bg: #93b4f5; --bs-btn-disabled-border-color: #93b4f5; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--border); --bs-btn-hover-bg: #f1f5f9; --bs-btn-hover-border-color: #dbe1ea; }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--muted); font-size: 1.15rem; }
.btn-icon:hover { background: #f1f5f9; color: var(--text); }
.form-control, .form-select { border-radius: 10px; border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: #93b4f5; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12); }
.form-label { font-weight: 500; color: #334155; }
.min-w-0 { min-width: 0; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 1040; transition: transform .2s ease; }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; padding: 1.25rem 1.25rem 1rem; color: #fff; font-weight: 700; font-size: 1.05rem; }
.sidebar-brand:hover { color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; box-shadow: 0 4px 12px rgba(37, 99, 235, .4); }
.sidebar-site { margin: 0 1rem .75rem; padding: .7rem .85rem; border-radius: 10px; background: var(--sidebar-2); color: #e2e8f0; }
.sidebar-nav { padding: .25rem .75rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; }
.sidebar-link i { font-size: 1.05rem; opacity: .85; }
.sidebar-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-link.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .35); }
.sidebar-footer { padding: 1rem 1.25rem; color: #64748b; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar-backdrop { display: none; }
.main { flex: 1; margin-left: 252px; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; height: 64px; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-search { position: relative; align-items: center; width: min(460px, 50vw); }
.topbar-search i { position: absolute; left: .85rem; color: var(--muted); }
.topbar-search .form-control { padding-left: 2.3rem; background: #f8fafc; }
.profile-btn { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--border); padding: .25rem .6rem .25rem .25rem; border-radius: 999px; background: #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: .75rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.25rem; }
.notif-dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.notif-menu { width: 340px; border-radius: 12px; border-color: var(--border); box-shadow: 0 12px 32px rgba(15, 23, 42, .12); overflow: hidden; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-list a { display: block; padding: .7rem 1rem; border-bottom: 1px solid #f1f5f9; color: var(--text); }
.notif-list a:hover { background: #f8fafc; }
.notif-unread { background: #f8fbff; border-left: 3px solid var(--primary) !important; }
.support-banner { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .6rem 1.5rem; background: #fef3c7; color: #92400e; border-bottom: 1px solid #fde68a; font-size: .875rem; }
.content { padding: 1.5rem; max-width: 1600px; width: 100%; }

/* Page */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin: .25rem 0 0; font-size: .875rem; }
.breadcrumb { --bs-breadcrumb-divider-color: #94a3b8; }
.breadcrumb a { color: var(--muted); }

/* Cards */
.card-soft { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header-soft { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-title-sm { font-size: .95rem; font-weight: 600; margin: 0; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); height: 100%; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: .6rem; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat-hint { color: var(--muted); font-size: .75rem; margin-top: .15rem; }
.secret-card { border: 1px solid #fcd34d; background: #fffbeb; border-radius: var(--radius); }

/* Soft colors */
.bg-primary-soft { background: #e0ecff; } .text-primary { color: var(--primary) !important; }
.bg-success-soft { background: #dcfce7; } .bg-info-soft { background: #cffafe; } .bg-warning-soft { background: #fef3c7; }
.bg-danger-soft { background: #fee2e2; } .bg-secondary-soft { background: #eef2f6; } .bg-purple-soft { background: #ede9fe; } .bg-teal-soft { background: #ccfbf1; }
.text-purple { color: #7c3aed !important; } .text-teal { color: #0d9488 !important; } .text-info { color: #0891b2 !important; }
.badge-soft { display: inline-flex; align-items: center; padding: .25rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.badge-soft-primary { background: #e0ecff; color: #1d4ed8; } .badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-info { background: #cffafe; color: #0e7490; } .badge-soft-warning { background: #fef3c7; color: #b45309; }
.badge-soft-danger { background: #fee2e2; color: #b91c1c; } .badge-soft-secondary { background: #eef2f6; color: #475569; }
.badge-soft-purple { background: #ede9fe; color: #6d28d9; } .badge-soft-teal { background: #ccfbf1; color: #0f766e; }
.chip { display: inline-block; padding: .15rem .5rem; margin: 0 .25rem .25rem 0; border-radius: 6px; background: #f1f5f9; font-size: .72rem; }

/* Tables */
.table-modern { --bs-table-bg: transparent; margin: 0; }
.table-modern thead th { background: #f8fafc; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); padding: .7rem 1rem; white-space: nowrap; }
.table-modern td, .table-modern tbody th { padding: .75rem 1rem; vertical-align: middle; border-color: #f1f5f9; }
.table-modern tbody tr:hover { background: #fafcff; }

/* Empty */
.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto .75rem; border-radius: 16px; background: #f1f5f9; color: #94a3b8; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }

/* Activity */
.activity-list { list-style: none; margin: 0; padding: .5rem 0; }
.activity-list li { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.1rem; }
.activity-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.timeline { list-style: none; margin: 0; padding: 1rem 1.1rem 1rem 2rem; position: relative; }
.timeline::before { content: ''; position: absolute; left: 1.2rem; top: 1rem; bottom: 1rem; width: 2px; background: #e2e8f0; }
.timeline li { position: relative; padding-bottom: .9rem; }
.timeline li::before { content: ''; position: absolute; left: -.98rem; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }

/* Status pills */
.status-strip { display: flex; flex-wrap: wrap; gap: .4rem; }
.status-pill { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: .35rem .85rem; font-size: .8rem; font-weight: 500; color: #334155; }
.status-pill:hover { border-color: var(--primary); color: var(--primary); }
.status-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Code / copy */
.code-block { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 1rem; font-size: .78rem; white-space: pre-wrap; word-break: break-all; max-height: 420px; overflow: auto; }
.copy-field { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px dashed #cbd5e1; border-radius: 10px; padding: .35rem .35rem .35rem .75rem; }
.copy-field code { flex: 1; word-break: break-all; color: #0f172a; font-size: .8rem; }
.copy-corner { position: absolute; top: .5rem; right: .5rem; }
.key-mask { background: #f1f5f9; padding: .3rem .6rem; border-radius: 8px; color: #334155; }
.steps { padding-left: 1.2rem; } .steps li { margin-bottom: .45rem; }
.nav-pills-sm .nav-link { padding: .35rem .8rem; font-size: .82rem; border-radius: 8px; color: var(--muted); }
.nav-pills-sm .nav-link.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }

/* Charts */
.chart-box { position: relative; height: 290px; }
.chart-box-lg { height: 440px; }

/* Toasts */
.toast { border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .15); color: #fff; }
.toast-success { background: #16a34a; } .toast-danger { background: #dc2626; } .toast-warning { background: #d97706; } .toast-info { background: #2563eb; }
.toast .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Auth */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; }
.auth-side { flex: 1; background: radial-gradient(1200px 600px at 0% 0%, #1d4ed8 0%, #0f172a 60%); color: #fff; align-items: center; padding: 4rem; }
.auth-side > div { max-width: 520px; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 2.25rem; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }

/* Loading state */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 1rem; height: 1rem; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-light.is-loading::after { border-color: var(--primary) var(--primary) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1030; }
  .main { margin-left: 0; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}
