/* ============================================
   CRM Pro Admin Panel - Ultra Advanced Stylesheet
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ===================== CSS VARIABLES ===================== */
:root, [data-theme="light"] {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;
    --primary-50: #eef2ff;
    --secondary: #64748b;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #4f46e5;
    --bg-topbar: #ffffff;
    --bg-input: #ffffff;
    --bg-table-header: #f8fafc;
    --bg-hover: #f8fafc;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-color: #e2e8f0;

    --bg-secondary: #f8fafc;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08);

    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --sidebar-width: 270px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;
    --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* DARK THEME */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0b1120;
    --bg-sidebar-hover: #162032;
    --bg-topbar: #1e293b;
    --bg-input: #1e293b;
    --bg-table-header: #162032;
    --bg-hover: #162032;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --border-color: #334155;
    --bg-secondary: #162032;
    --primary-bg: rgba(79,70,229,0.15);
    --success-bg: rgba(34,197,94,0.1);
    --warning-bg: rgba(245,158,11,0.1);
    --danger-bg: rgba(239,68,68,0.1);
    --info-bg: rgba(59,130,246,0.1);
}

/* ===================== RESET ===================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg-body); color: var(--text-primary); line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ===================== LAYOUT ===================== */
.admin-container { display: flex; min-height: 100vh; }

/* SIDEBAR */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; left: 0; height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    border-right: 1px solid rgba(255,255,255,0.05);
}
.admin-sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.admin-sidebar.collapsed .sidebar-logo span,
.admin-sidebar.collapsed .nav-section-title,
.admin-sidebar.collapsed .sidebar-nav span,
.admin-sidebar.collapsed .sidebar-badge,
.admin-sidebar.collapsed .sidebar-search,
.admin-sidebar.collapsed .sidebar-footer span { display: none; }
.admin-sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 12px; }
.admin-sidebar.collapsed .sidebar-nav a i { margin: 0; font-size: 1.15rem; }
.admin-sidebar.collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 64px;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.35rem; font-weight: 800; color: white;
}
.sidebar-logo i { color: var(--primary-light); font-size: 1.5rem; }
.sidebar-logo small { font-size: 0.5rem; font-weight: 700; background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%); padding: 1px 6px; border-radius: 3px; vertical-align: super; letter-spacing: 1px; }
.sidebar-collapse-btn {
    background: none; border: none; color: var(--text-sidebar); cursor: pointer; padding: 6px;
    border-radius: 6px; transition: var(--transition); font-size: 0.9rem;
}
.sidebar-collapse-btn:hover { background: var(--bg-sidebar-hover); color: white; }
.sidebar-collapse-btn i { transition: transform 0.3s ease; }

.sidebar-search {
    padding: 12px 16px; position: relative;
}
.sidebar-search i {
    position: absolute; left: 28px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.85rem;
}
.sidebar-search input {
    width: 100%; padding: 8px 12px 8px 36px;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius); color: white; outline: none; font-size: 0.85rem;
    transition: var(--transition);
}
.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search input:focus { background: rgba(255,255,255,0.1); border-color: var(--primary); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px; }
.nav-section { margin-bottom: 8px; }
.nav-section-title {
    display: block; padding: 8px 12px 4px; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted);
}
.sidebar-nav ul li { margin-bottom: 2px; }
.sidebar-nav ul li a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 14px; border-radius: var(--radius);
    color: var(--text-sidebar); font-weight: 500; font-size: 0.9rem;
    transition: var(--transition);
}
.sidebar-nav ul li a i { width: 18px; text-align: center; font-size: 0.95rem; flex-shrink: 0; }
.sidebar-nav ul li a:hover { background: var(--bg-sidebar-hover); color: white; }
.sidebar-nav ul li.active a { background: var(--bg-sidebar-active); color: white; font-weight: 600; }

.sidebar-badge {
    margin-left: auto; background: var(--danger); color: white;
    font-size: 0.68rem; font-weight: 700; padding: 2px 7px;
    border-radius: 10px; min-width: 20px; text-align: center;
}
.sidebar-badge.yellow { background: var(--warning); }

.sidebar-footer {
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; border-radius: var(--radius);
    color: var(--text-sidebar); font-size: 0.85rem; font-weight: 500;
    transition: var(--transition);
}
.sidebar-footer-link:hover { background: var(--bg-sidebar-hover); color: white; }

/* MAIN */
.admin-main {
    flex: 1; margin-left: var(--sidebar-width);
    transition: var(--transition); min-height: 100vh;
}
.admin-sidebar.collapsed ~ .admin-main { margin-left: var(--sidebar-collapsed-width); }

/* TOPBAR */
.admin-topbar {
    height: var(--topbar-height); background: var(--bg-topbar);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-xs);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-menu-btn {
    display: none; background: none; border: none; font-size: 1.2rem;
    cursor: pointer; color: var(--text-secondary); padding: 6px;
}
.topbar-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); }
.topbar-breadcrumb .current { color: var(--text-primary); font-weight: 600; }
.topbar-breadcrumb i { font-size: 0.6rem; }

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

.topbar-search {
    position: relative; display: flex; align-items: center;
}
.topbar-search i { position: absolute; left: 12px; color: var(--text-muted); font-size: 0.85rem; }
.topbar-search input {
    padding: 8px 60px 8px 36px; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--bg-body); color: var(--text-primary);
    width: 260px; outline: none; transition: var(--transition); font-size: 0.85rem;
}
.topbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); width: 320px; }
.topbar-search kbd {
    position: absolute; right: 8px;
    background: var(--bg-body); border: 1px solid var(--border);
    padding: 1px 6px; border-radius: 4px; font-size: 0.7rem;
    color: var(--text-muted); font-family: inherit;
}

.topbar-icon-btn {
    width: 38px; height: 38px; border-radius: var(--radius);
    background: none; border: 1px solid var(--border);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); transition: var(--transition); font-size: 0.95rem; position: relative;
}
.topbar-icon-btn:hover { background: var(--bg-hover); color: var(--primary); border-color: var(--primary-bg); }
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--danger); color: white; font-size: 0.6rem; font-weight: 700;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-topbar);
}

/* TOPBAR DROPDOWNS */
.topbar-dropdown { position: relative; }
.topbar-dropdown-menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
    min-width: 320px; display: none; z-index: 200;
    overflow: hidden;
}
.topbar-dropdown-menu.show { display: block; animation: dropIn 0.2s ease; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.dropdown-header {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.dropdown-header h4 { font-size: 0.95rem; font-weight: 700; }
.dropdown-header a { font-size: 0.8rem; color: var(--primary); font-weight: 600; }
.dropdown-body { max-height: 360px; overflow-y: auto; }
.dropdown-body a { display: flex; align-items: center; gap: 12px; padding: 10px 18px; transition: var(--transition); color: var(--text-primary); font-size: 0.9rem; }
.dropdown-body a:hover { background: var(--bg-hover); }
.dropdown-body a i { width: 16px; color: var(--text-muted); }
.dropdown-body hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.dropdown-empty { text-align: center; padding: 30px; color: var(--text-muted); }
.dropdown-empty i { font-size: 2rem; margin-bottom: 8px; display: block; }

/* Notification items */
.notification-item { border-bottom: 1px solid var(--border-light); }
.notification-item .notif-icon {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; flex-shrink: 0;
}
.notification-item.info .notif-icon { background: var(--info-bg); color: var(--info); }
.notification-item.success .notif-icon { background: var(--success-bg); color: var(--success); }
.notification-item.warning .notif-icon { background: var(--warning-bg); color: var(--warning); }
.notification-item.danger .notif-icon { background: var(--danger-bg); color: var(--danger); }
.notif-content { flex: 1; }
.notif-content strong { font-size: 0.85rem; display: block; }
.notif-content p { font-size: 0.8rem; color: var(--text-muted); margin: 2px 0; }
.notif-time { font-size: 0.72rem; color: var(--text-muted); }

/* User button */
.topbar-user-btn {
    display: flex; align-items: center; gap: 10px;
    background: none; border: 1px solid var(--border); cursor: pointer;
    padding: 4px 12px 4px 4px; border-radius: var(--radius); transition: var(--transition);
    color: var(--text-primary);
}
.topbar-user-btn:hover { background: var(--bg-hover); }
.topbar-avatar {
    width: 34px; height: 34px; border-radius: var(--radius);
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.topbar-avatar.lg { width: 44px; height: 44px; font-size: 1rem; border-radius: var(--radius-lg); }
.topbar-user-info { text-align: left; }
.topbar-user-info .name { display: block; font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
.topbar-user-info .role { font-size: 0.72rem; color: var(--text-muted); }
.topbar-user-btn .fa-chevron-down { font-size: 0.6rem; color: var(--text-muted); }
.user-panel { min-width: 280px; }

/* ADMIN CONTENT */
.admin-content { padding: 24px; }

/* ===================== ALERTS ===================== */
.admin-alert {
    padding: 12px 18px; border-radius: var(--radius);
    margin: 12px 24px 0; display: flex; align-items: center; gap: 10px;
    font-weight: 500; font-size: 0.9rem; animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
.alert-success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-bg); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-dismiss { margin-left: auto; background:none; border:none; cursor:pointer; color:inherit; opacity:0.6; transition:var(--transition); }
.alert-dismiss:hover { opacity: 1; }

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg-hover); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* STAT CARDS */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px;
    border: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
    transition: var(--transition); box-shadow: var(--shadow-xs);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 48px; height: 48px; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: var(--primary-bg); color: var(--primary); }
.stat-info h4 { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.3; }

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border: none; border-radius: var(--radius);
    cursor: pointer; font-weight: 600; font-size: 0.85rem;
    transition: var(--transition); white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-body); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-group { display: flex; gap: 6px; }

/* ===================== TABLES ===================== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table th { background: var(--bg-table-header); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); white-space: nowrap; }
table tbody tr { transition: var(--transition); }
table tbody tr:hover { background: var(--bg-hover); }
table tbody tr:last-child td { border-bottom: none; }

/* ===================== BADGES ===================== */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: #166534; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger { background: var(--danger-bg); color: #991b1b; }
.badge-info { background: var(--info-bg); color: #1e40af; }
.badge-secondary { background: var(--border-light); color: var(--text-secondary); }

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--text-primary); font-size: 0.85rem; }
.form-control {
    width: 100%; padding: 9px 13px; border: 1px solid var(--border);
    border-radius: var(--radius); background: var(--bg-input); color: var(--text-primary);
    transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ===================== MODAL ===================== */
.modal-overlay { position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.5); z-index: 2000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.show { display: flex; }
.modal { background: var(--bg-card); border-radius: var(--radius-xl); width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-xl); animation: modalIn 0.25s ease; }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 800px; }
@keyframes modalIn { from { opacity:0; transform: scale(0.95) translateY(-10px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--text-muted); padding: 4px; border-radius: 4px; transition: var(--transition); }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.delete-confirm-icon { text-align: center; font-size: 2.5rem; color: var(--danger); margin-bottom: 12px; }

/* ===================== PAGE HELPERS ===================== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header p { color: var(--text-secondary); font-size: 0.9rem; }
.filters-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters-bar .form-control { width: auto; min-width: 140px; font-size: 0.85rem; padding: 8px 12px; }
.filters-bar .search-input { position: relative; }
.filters-bar .search-input i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.filters-bar .search-input input { padding-left: 36px; min-width: 240px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; color: var(--border); display: block; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 6px; font-size: 1rem; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--radius); font-weight: 600; font-size: 0.82rem; transition: var(--transition); border: 1px solid var(--border); color: var(--text-secondary); background: var(--bg-card); }
.pagination a:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* TABS */
.tabs { display: flex; border-bottom: 2px solid var(--border); gap: 0; }
.tab-btn { padding: 10px 18px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; font-weight: 600; color: var(--text-muted); transition: var(--transition); font-size: 0.85rem; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===================== DASHBOARD SPECIFIC ===================== */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.pipeline { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-stage { min-width: 200px; flex: 1; }
.pipeline-stage-header { padding: 10px 14px; border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; font-size: 0.8rem; display: flex; justify-content: space-between; align-items: center; color: white; }
.pipeline-stage-header .count { background: rgba(255,255,255,0.25); padding: 1px 7px; border-radius: 8px; font-size: 0.72rem; }
.stage-qualification .pipeline-stage-header { background: var(--info); }
.stage-proposal .pipeline-stage-header { background: var(--warning); }
.stage-negotiation .pipeline-stage-header { background: var(--primary); }
.stage-closed_won .pipeline-stage-header { background: var(--success); }
.stage-closed_lost .pipeline-stage-header { background: var(--danger); }
.pipeline-stage-body { background: var(--bg-body); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); padding: 8px; min-height: 120px; }
.pipeline-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 6px; cursor: pointer; transition: var(--transition); }
.pipeline-card:hover { box-shadow: var(--shadow-sm); border-color: var(--primary-light); }
.pipeline-card h4 { font-size: 0.85rem; margin-bottom: 4px; }
.pipeline-card .deal-value { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.pipeline-card .deal-company { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Activity */
.activity-feed { max-height: 380px; overflow-y: auto; }
.activity-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; }
.activity-icon.created { background: var(--success-bg); color: var(--success); }
.activity-icon.updated { background: var(--info-bg); color: var(--info); }
.activity-icon.deleted { background: var(--danger-bg); color: var(--danger); }
.activity-content p { font-size: 0.85rem; }
.activity-time { font-size: 0.72rem; color: var(--text-muted); }

/* CHART BARS */
.chart-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chart-bar-label { width: 100px; font-size: 0.8rem; color: var(--text-secondary); text-align: right; flex-shrink: 0; }
.chart-bar-track { flex: 1; height: 26px; background: var(--bg-body); border-radius: 13px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 13px; display: flex; align-items: center; padding: 0 10px; font-size: 0.72rem; font-weight: 700; color: white; transition: width 1s ease; min-width: fit-content; }
.chart-bar-fill.blue { background: var(--info); }
.chart-bar-fill.green { background: var(--success); }
.chart-bar-fill.yellow { background: var(--warning); }
.chart-bar-fill.red { background: var(--danger); }
.chart-bar-fill.purple { background: var(--primary); }

/* Reports */
.reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.summary-item { text-align: center; padding: 18px; background: var(--bg-body); border-radius: var(--radius); }
.summary-item .value { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.summary-item .label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* Detail Views */
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.detail-title { display: flex; align-items: center; gap: 14px; }
.detail-title .icon { width: 48px; height: 48px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.detail-field label { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.detail-field p { font-size: 0.9rem; color: var(--text-primary); }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.settings-menu li a { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--radius); color: var(--text-secondary); font-weight: 500; transition: var(--transition); font-size: 0.9rem; }
.settings-menu li a:hover { background: var(--bg-body); color: var(--primary); }
.settings-menu li.active a { background: var(--primary-bg); color: var(--primary); font-weight: 600; }

/* CALENDAR */
.calendar-grid { display: grid; grid-template-columns: 7fr; gap: 0; }
.calendar-header-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-header-cell { padding: 10px; text-align: center; font-weight: 700; font-size: 0.78rem; text-transform: uppercase; color: var(--text-muted); background: var(--bg-table-header); border: 1px solid var(--border); }
.calendar-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-cell { min-height: 100px; padding: 8px; border: 1px solid var(--border); background: var(--bg-card); transition: var(--transition); }
.calendar-cell:hover { background: var(--bg-hover); }
.calendar-cell.other-month { background: var(--bg-body); opacity: 0.5; }
.calendar-cell.today { background: var(--primary-bg); border-color: var(--primary); }
.calendar-date { font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; }
.calendar-event { padding: 2px 6px; border-radius: 4px; font-size: 0.68rem; font-weight: 600; margin-bottom: 2px; cursor: pointer; color: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================== UTILITIES ===================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-small { font-size: 0.82rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.mobile-open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .topbar-menu-btn { display: block; }
    .topbar-search { display: none; }
    .topbar-user-info { display: none; }
    .admin-content { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .form-row { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filters-bar .form-control, .filters-bar .search-input input { width: 100%; min-width: auto; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .pipeline { flex-direction: column; }
    .calendar-cell { min-height: 60px; }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 380px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-left: 4px solid;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.toast-exit { opacity: 0; transform: translateX(100%); }
.toast-success { border-left-color: #22c55e; }
.toast-success i { color: #22c55e; }
.toast-error { border-left-color: #ef4444; }
.toast-error i { color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-warning i { color: #f59e0b; }
.toast-info { border-left-color: #3b82f6; }
.toast-info i { color: #3b82f6; }
.toast i { font-size: 1.1rem; flex-shrink: 0; }
.toast-message { flex: 1; color: var(--text-primary); }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; font-size: 0.8rem; }
.toast-close:hover { color: var(--text-primary); }

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}
[data-theme="dark"] .loading-overlay { background: rgba(15,23,42,0.8); }
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   KANBAN BOARD
   ============================================ */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 500px;
}
.kanban-column {
    flex: 0 0 280px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}
.kanban-column-header {
    padding: 16px;
    border-bottom: 3px solid;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.kanban-column-header h4 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kanban-column-header .kanban-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}
.kanban-column-body.drag-over {
    background: rgba(79, 70, 229, 0.05);
    border: 2px dashed var(--primary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.kanban-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kanban-card.dragging { opacity: 0.5; cursor: grabbing; }
.kanban-card.health-high { border-left-color: #22c55e; }
.kanban-card.health-medium { border-left-color: #f59e0b; }
.kanban-card.health-low { border-left-color: #ef4444; }
.kanban-card-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.kanban-card-customer { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.kanban-card-customer i { margin-right: 4px; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; }
.kanban-card-value { font-size: 0.85rem; font-weight: 700; color: var(--primary); }
.kanban-card-prob { font-size: 0.7rem; padding: 2px 8px; border-radius: 12px; background: var(--bg-secondary); color: var(--text-muted); }
.kanban-card-date { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; }
.kanban-card-date i { margin-right: 4px; }

/* ============================================
   BULK ACTION BAR
   ============================================ */
.bulk-action-bar {
    display: none;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 2px solid var(--primary);
    padding: 12px 20px;
    align-items: center;
    gap: 16px;
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.bulk-action-bar .bulk-count {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}
.bulk-action-bar .bulk-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ============================================
   KEYBOARD SHORTCUTS
   ============================================ */
.shortcuts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.shortcut-group h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.85rem;
}
.shortcut-item kbd {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Inter', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.shortcut-item span {
    color: var(--text-secondary);
}

/* ============================================
   ATTACHMENTS
   ============================================ */
.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    transition: background 0.2s;
}
.attachment-item:hover { background: var(--bg-hover); }
.attachment-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.attachment-icon.pdf { background: rgba(239,68,68,0.1); color: #ef4444; }
.attachment-icon.doc { background: rgba(59,130,246,0.1); color: #3b82f6; }
.attachment-icon.img { background: rgba(34,197,94,0.1); color: #22c55e; }
.attachment-icon.default { background: rgba(107,114,128,0.1); color: #6b7280; }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-meta { font-size: 0.75rem; color: var(--text-muted); }
.attachment-actions { display: flex; gap: 4px; }

/* ============================================
   PROFILE PAGE
   ============================================ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}
.profile-avatar-container {
    position: relative;
}
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-upload {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    border: 2px solid var(--bg-card);
}
.profile-info h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.profile-info .profile-role { color: var(--text-muted); font-size: 0.9rem; }
.profile-info .profile-email { color: var(--text-secondary); font-size: 0.85rem; }

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .admin-sidebar,
    .admin-topbar,
    .filters-bar,
    .pagination,
    .modal-overlay,
    .toast-container,
    .bulk-action-bar,
    .quick-actions,
    .btn-group,
    .page-header .btn,
    #flashMessage { display: none !important; }
    .admin-main { margin-left: 0 !important; padding-top: 0 !important; }
    .admin-content { padding: 0 !important; }
    .card, .chart-card, .dash-card, .kpi-card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
    }
    body { background: white !important; color: black !important; }
    table { border-collapse: collapse; }
    table th, table td { border: 1px solid #ccc !important; padding: 6px 10px !important; }
    a { color: inherit !important; text-decoration: none !important; }
}
