/* =============================================
   Team Madura — Premium Dark Glassmorphism Theme
   ============================================= */

/* ---- CSS Variables ---- */
:root {
    --bg-primary: #070b13;
    /* Deep black-navy dark background */
    --bg-secondary: #0d121f;
    /* Dark blue card background */
    --bg-card: #0d121f;
    --bg-card-hover: #131a2b;
    --bg-glass: rgba(13, 20, 35, 0.45);
    --bg-input: rgba(255, 255, 255, 0.05);

    --accent-purple: #3b82f6;
    /* Royal Blue as the main brand accent */
    --accent-blue: #3b82f6;
    --accent-teal: #10b981;
    /* Premium Emerald/Teal */
    --accent-pink: #f472b6;
    --accent-amber: #f59e0b;
    --accent-green: #10b981;
    --accent-red: #ef4444;

    --gradient-main: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --gradient-card: linear-gradient(145deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.04) 100%);
    --gradient-sidebar: linear-gradient(180deg, #101726 0%, #070b13 100%);

    --bg-sidebar: #101726;
    /* Sleek dark blue-navy sidebar in dark mode */
    --bg-nav-active: #3b82f6;
    /* Solid blue active background */
    --color-nav-active: #ffffff;
    --bg-nav-active-icon: transparent;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: #3b82f6;

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.2);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Light Mode (White Mode) Overrides ---- */
body.light-mode {
    --bg-primary: #f8fafc;
    /* Slate 50 */
    --bg-secondary: #ffffff;
    /* White card background */
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    /* Slate 100 hover */
    --bg-glass: rgba(255, 255, 255, 0.65);
    --bg-input: #f1f5f9;
    /* Slate 100 */

    --bg-sidebar: #152d5b;
    /* Rich dark-blue menu sidebar preserved in light mode */
    --bg-nav-active: #3b82f6;
    --color-nav-active: #ffffff;
    --bg-nav-active-icon: transparent;

    --accent-purple: #2563eb;
    /* Royal Blue */
    --gradient-main: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --gradient-card: linear-gradient(145deg, rgba(37, 99, 235, 0.04) 0%, rgba(59, 130, 246, 0.02) 100%);

    --text-primary: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --text-white: #0f172a;
    /* Slate 900 */

    --border-color: #e2e8f0;
    /* Slate 200 */
    --border-active: #3b82f6;

    --gradient-sidebar: linear-gradient(180deg, #152d5b 0%, #102042 100%);

    --shadow-card: 0 10px 25px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

/* Sleek Dark Sidebar in Light Mode */
body.light-mode .sidebar {
    --bg-sidebar: #152d5b;
    /* Rich dark-blue menu sidebar */
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;
    --bg-input: rgba(255, 255, 255, 0.06);

    --bg-nav-active: #3b82f6;
    --color-nav-active: #ffffff;
    --bg-nav-active-icon: transparent;
}

body.light-mode .sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

body.light-mode .sidebar .nav-link:hover .nav-icon {
    background: transparent;
    color: #ffffff;
}

body.light-mode .sidebar .sidebar-logo {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.light-mode .sidebar .sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* Light Mode Specific Element Fixes */
body.light-mode .nav-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .nav-link:hover .nav-icon {
    background: transparent;
}

body.light-mode .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .quick-link-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

body.light-mode .btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

body.light-mode .data-table thead th {
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode .data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.015);
}

body.light-mode select.form-control option {
    background: #ffffff;
    color: #0f172a;
}

body.light-mode .modal {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

body.light-mode .detail-panel {
    background: #ffffff;
    border-left-color: #e2e8f0;
}

body.light-mode ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.2);
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.4);
}

body.light-mode .login-page {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(240, 242, 245, 0.45) 100%), url('../img/login_bg.png') no-repeat center center;
    background-size: cover;
}

body.light-mode .login-card {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.15);
}

body.light-mode .login-input {
    background: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    color: #0f172a !important;
}

body.light-mode .login-input:focus {
    background: #ffffff !important;
    border-color: var(--border-active) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

body.light-mode .login-input-icon {
    color: #475569 !important;
}

body.light-mode .login-logo-sub {
    color: #475569 !important;
}

/* Theme Toggle Pill Button Styling */
.theme-toggle-btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle-btn-pill:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
    transform: translateY(-1px);
}

body.light-mode .theme-toggle-btn-pill {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

body.light-mode .theme-toggle-btn-pill:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.theme-toggle-icon {
    font-size: 14px;
    transition: var(--transition);
}

.theme-toggle-btn-pill:hover .theme-toggle-icon {
    transform: rotate(15deg) scale(1.1);
}


/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--accent-purple);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-blue);
}

img {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: rgba(124, 92, 252, 0.4);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar.expanded {
    left: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

/* Sidebar toggle button */
.sidebar-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}

.sidebar-toggle:hover span {
    background: var(--text-primary);
}

/* Topbar Title Greeting styling */
.topbar-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

body.light-mode .topbar-title-wrapper {
    color: #475569;
}

.topbar-title {
    font-weight: 700;
    color: var(--text-white);
}

.topbar-divider {
    color: var(--border-color);
}

body.light-mode .topbar-divider {
    color: #cbd5e1;
}

.topbar-welcome {
    color: var(--text-secondary);
}

/* Brand */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: var(--gradient-main);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-logo svg {
    width: 22px;
    height: 22px;
    display: block;
    color: #ffffff;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    color: var(--text-white);
}

.brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Search */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 8px 16px;
    transition: var(--transition);
}

.topbar-search:focus-within {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.1);
}

.topbar-search i {
    color: var(--text-muted);
    font-size: 13px;
}

.topbar-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 220px;
}

.topbar-search input::placeholder {
    color: var(--text-muted);
}

/* Icon buttons */
.icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 15px;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.badge-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: #e53e3e;
    border-radius: 9px;
    border: 2px solid var(--bg-primary);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(229, 62, 62, 0.45);
    animation: badgePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes badgePop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* User menu */
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.topbar-user:hover {
    background: var(--bg-card-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--gradient-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-l1 {
    background: rgba(124, 92, 252, 0.2);
    color: var(--accent-purple);
}

.role-l2 {
    background: rgba(45, 212, 191, 0.2);
    color: var(--accent-teal);
}

.user-chevron {
    font-size: 11px;
    color: var(--text-muted);
    transition: var(--transition);
}

.topbar-user.open .user-chevron {
    transform: rotate(180deg);
}

/* User dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 180px;
    box-shadow: var(--shadow-card);
    display: none;
    z-index: 100;
    animation: fadeSlideDown 0.2s ease;
}

.topbar-user.open .user-dropdown {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dropdown-item.text-danger {
    color: var(--accent-red);
}

.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 900;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Sidebar logo area */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-color);
}

body.light-mode .sidebar-logo {
    border-bottom-color: #e2e8f0;
}

.sidebar-logo .brand-name {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    color: var(--text-white);
}

.sidebar-logo .brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.sidebar-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.sidebar-close:hover {
    background: var(--accent-red);
    color: #fff;
}



/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px 12px;
}

.sidebar-nav ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-nav-active);
    color: var(--color-nav-active);
    padding-left: 14px !important;
}

.nav-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 14px;
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-link.active .nav-icon {
    background: var(--bg-nav-active-icon);
    color: var(--color-nav-active);
}

.nav-link:hover .nav-icon {
    background: transparent;
}

.nav-active-dot {
    display: none !important;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
}

.user-avatar-sm {
    width: 34px;
    height: 34px;
    background: var(--gradient-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 850;
}

.sidebar-overlay.active {
    display: block;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    padding: 28px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
    margin-left: 0;
}

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.page-header-left {}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn i {
    font-size: 13px;
}

.btn-primary {
    background: var(--gradient-main);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 92, 252, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124, 92, 252, 0.5);
    color: #ffffff !important;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
    color: #ffffff !important;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    color: #ffffff !important;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
    color: #ffffff !important;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-card);
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.card:hover::before {
    opacity: 1;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-white);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =============================================
   STAT CARDS
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: rgba(124, 92, 252, 0.3);
}

.stat-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.stat-icon.teal {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.stat-icon.amber {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.stat-icon.pink {
    background: rgba(244, 114, 182, 0.15);
    color: #f472b6;
}

.stat-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-badge.today {
    background: rgba(45, 212, 191, 0.15);
    color: var(--accent-teal);
}

.stat-badge.total {
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-purple);
}

.stat-value {
    font-size: 34px;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-glow {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.06;
}

.stat-card-glow.purple {
    background: var(--accent-purple);
}

.stat-card-glow.blue {
    background: var(--accent-blue);
}

.stat-card-glow.teal {
    background: var(--accent-teal);
}

.stat-card-glow.amber {
    background: var(--accent-amber);
}

/* =============================================
   DATA TABLE
   ============================================= */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 1100px;
}

.data-table thead th {
    padding: 11px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table td {
    padding: 11px 10px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    transition: var(--transition);
}

.table-search:focus-within {
    border-color: var(--border-active);
}

.table-search i {
    color: var(--text-muted);
    font-size: 13px;
}

.table-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 240px;
}

.table-search input::placeholder {
    color: var(--text-muted);
}

/* =============================================
   STATUS BADGES
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-dot-sm {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.badge-success .badge-dot-sm {
    background: var(--accent-green);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.badge-warning .badge-dot-sm {
    background: var(--accent-amber);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.badge-danger .badge-dot-sm {
    background: var(--accent-red);
}

.badge-purple {
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-purple);
}

.badge-purple .badge-dot-sm {
    background: var(--accent-purple);
}

.badge-teal {
    background: rgba(45, 212, 191, 0.15);
    color: var(--accent-teal);
}

.badge-teal .badge-dot-sm {
    background: var(--accent-teal);
}

.badge-blue {
    background: rgba(79, 142, 247, 0.15);
    color: var(--accent-blue);
}

.badge-blue .badge-dot-sm {
    background: var(--accent-blue);
}

.badge-muted {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

/* =============================================
   FORMS
   ============================================= */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.form-control:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.1);
    background: rgba(124, 92, 252, 0.05);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--accent-red);
    margin-top: 4px;
}

/* Section headers in forms */
.form-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.form-section-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-section-header i {
    width: 28px;
    height: 28px;
    background: rgba(124, 92, 252, 0.15);
    color: var(--accent-purple);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Checkboxes */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-purple);
    cursor: pointer;
}

.form-check-label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* =============================================
   ALERTS & NOTIFICATIONS
   ============================================= */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert i {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
}

.alert-info {
    background: rgba(79, 142, 247, 0.1);
    border-color: rgba(79, 142, 247, 0.2);
    color: var(--accent-blue);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 300px;
    max-width: 400px;
    box-shadow: var(--shadow-card);
    animation: slideInRight 0.3s ease;
}

.toast.success {
    border-left: 3px solid var(--accent-green);
}

.toast.error {
    border-left: 3px solid var(--accent-red);
}

.toast.warning {
    border-left: 3px solid var(--accent-amber);
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--accent-green);
}

.toast.error .toast-icon {
    color: var(--accent-red);
}

.toast.warning .toast-icon {
    color: var(--accent-amber);
}

.toast-msg {
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
}

.toast-close {
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* =============================================
   MODALS
   ============================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    transform: scale(0.95) translateY(20px);
    transition: var(--transition);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
}

.modal-close {
    width: 34px;
    height: 34px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

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

/* =============================================
   CONTENT PANELS (Client Detail Slide-in)
   ============================================= */
.detail-panel {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    width: 520px;
    height: calc(100vh - var(--topbar-height));
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 800;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel.open {
    transform: translateX(0);
}

.detail-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.detail-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.detail-panel-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Client detail fields */
.detail-section {
    margin-bottom: 24px;
}

.detail-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.detail-item {}

.detail-item-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.detail-item-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-item-value:empty::before {
    content: '—';
    color: var(--text-muted);
    font-weight: 400;
}

/* =============================================
   DASHBOARD LAYOUT
   ============================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    margin-top: 8px;
}

.dashboard-grid-full {
    grid-column: 1 / -1;
}

/* Quick links */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

.quick-link-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateX(4px);
}

.quick-link-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.quick-link-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.quick-link-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
}

/* Activity feed */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.activity-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* =============================================
   SECTORS TABS
   ============================================= */
.sector-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 5px;
    width: fit-content;
    margin-bottom: 24px;
}

.sector-tab {
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.sector-tab.active {
    background: var(--gradient-main);
    color: #fff;
    box-shadow: 0 3px 12px rgba(124, 92, 252, 0.3);
}

.sector-tab:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 0;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-btns {
    display: flex;
    gap: 4px;
}

.page-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.page-btn.active {
    background: var(--gradient-main);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(124, 92, 252, 0.3);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(7, 11, 19, 0.4) 0%, rgba(13, 18, 31, 0.5) 100%), url('../img/login_bg.png') no-repeat center center;
    background-size: cover;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.login-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.login-bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
}

.login-bg-circle:nth-child(1) {
    width: 500px;
    height: 500px;
    background: var(--accent-purple);
    top: -150px;
    left: -150px;
    animation: floatAnim 8s ease-in-out infinite;
}

.login-bg-circle:nth-child(2) {
    width: 400px;
    height: 400px;
    background: var(--accent-blue);
    bottom: -100px;
    right: -100px;
    animation: floatAnim 10s ease-in-out infinite reverse;
}

.login-bg-circle:nth-child(3) {
    width: 250px;
    height: 250px;
    background: var(--accent-teal);
    top: 50%;
    left: 60%;
    animation: floatAnim 12s ease-in-out infinite;
}

.login-card {
    position: relative;
    z-index: 1;
    background: var(--bg-glass);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 48px 42px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    justify-content: center;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-main);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(124, 92, 252, 0.4);
}

.login-logo-icon svg {
    width: 32px;
    height: 32px;
    display: block;
    color: #ffffff;
}

.login-logo-text {}

.login-logo-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.1;
}

.login-logo-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-input-group {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    pointer-events: none;
}

.login-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 13px 14px 13px 42px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.login-input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.15);
    background: rgba(124, 92, 252, 0.05);
}

.login-input::placeholder {
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-main);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 6px 20px rgba(124, 92, 252, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(124, 92, 252, 0.5);
}

.login-btn:active {
    transform: translateY(0);
}

.login-footer-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}

/* =============================================
   REPORTS PAGE
   ============================================= */
.report-filter-bar {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    align-items: flex-end;
}

.report-filter-bar .form-group {
    min-width: 200px;
}

.points-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.points-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    transition: var(--transition);
}

.points-item:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.points-item-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-white);
}

.points-item-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* =============================================
   TEAM MEMBER CARDS
   ============================================= */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.team-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.team-card:hover {
    transform: translateY(-3px);
    border-color: rgba(124, 92, 252, 0.3);
    box-shadow: var(--shadow-card);
}

.team-avatar {
    width: 72px;
    height: 72px;
    background: var(--gradient-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
    box-shadow: var(--shadow-glow);
}

.team-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px;
}

.team-email {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.team-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    width: 72px;
    height: 72px;
    background: rgba(124, 92, 252, 0.1);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--accent-purple);
    margin-bottom: 20px;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 300px;
    margin-bottom: 24px;
}

.client-view-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-logo {
        display: flex;
    }

    .sidebar-close {
        display: flex;
    }

    .sidebar-nav {
        padding-top: 12px;
    }

    .topbar {
        left: 0 !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        width: 100%;
    }

    .client-view-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .topbar {
        padding: 0 12px;
    }

    .topbar-welcome,
    .topbar-divider {
        display: none !important;
    }

    .topbar-search {
        display: none;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .brand-text {
        display: none;
    }

    .user-info {
        display: none;
    }

    .login-card {
        padding: 32px 24px;
    }
}

@media (max-width: 576px) {

    /* Stacking report filters */
    .report-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .report-filter-bar .form-group {
        width: 100%;
        min-width: 0 !important;
    }

    .report-filter-bar .btn,
    .report-filter-bar button {
        width: 100%;
        justify-content: center;
    }

    /* Stacking appointment & other page search/clear filters */
    .main-content .card form {
        flex-direction: column;
        align-items: stretch !important;
    }

    .main-content .card form .form-group {
        width: 100%;
    }

    .main-content .card form .btn,
    .main-content .card form a.btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    /* .topbar-title { display: none !important; } */
    .client-card {
        padding: 16px;
    }

    .client-card-actions {
        flex-direction: column;
        gap: 8px;
    }

    .client-card-actions .btn {
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes floatAnim {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-30px) rotate(5deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Utility classes */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--accent-green);
}

.text-danger {
    color: var(--accent-red);
}

.text-purple {
    color: var(--accent-purple);
}

.font-bold {
    font-weight: 700;
}

.text-sm {
    font-size: 13px;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* =============================================
   VIEW LAYOUT TOGGLING & CLIENT CARDS
   ============================================= */

/* View Toggle Buttons */
.view-toggle-group {
    display: inline-flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 2px;
}

.view-toggle-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.view-toggle-btn.active {
    background: var(--gradient-main);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.3);
}

body.light-mode .view-toggle-btn.active {
    color: #ffffff !important;
}

body.light-mode .view-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Client Cards Grid */
.client-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 16px;
    margin-bottom: 24px;
    align-items: stretch;
}

/* Card Transparency in Grid Mode */
.card.card-grid-mode {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    transition: var(--transition);
}

.card.card-grid-mode::before {
    display: none !important;
}

.card.card-grid-mode .card-header {
    padding: 0 0 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

/* Client Card */
.client-card {
    background-color: var(--bg-card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Ccircle cx='95' cy='32' r='18' fill='%2364748b' opacity='0.03'%3E%3C/circle%3E%3Cpath d='M45%2C82 C45%2C62 65%2C52 95%2C52 C125%2C52 145%2C62 145%2C82 Z' fill='%2364748b' opacity='0.03'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: top -5px right -5px;
    background-size: 155px 155px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 28px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    height: 100%;
}

body.light-mode .client-card {
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Ccircle cx='95' cy='32' r='18' fill='%234f46e5' opacity='0.035'%3E%3C/circle%3E%3Cpath d='M45%2C82 C45%2C62 65%2C52 95%2C52 C125%2C52 145%2C62 145%2C82 Z' fill='%234f46e5' opacity='0.035'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: top -5px right -5px !important;
    background-size: 155px 155px !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03), 0 8px 10px -6px rgba(0, 0, 0, 0.03) !important;
}

.client-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    border-color: rgba(79, 70, 229, 0.2) !important;
}

.client-card a {
    text-decoration: none !important;
}

/* Client Card Header */
.client-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 16px;
    position: relative;
    z-index: 1;
}

body.light-mode .client-card-header {
    border-bottom-color: #f1f5f9;
}

.client-card-avatar {
    width: 56px;
    height: 56px;
    background: rgba(124, 92, 252, 0.1);
    color: var(--accent-purple);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    transition: var(--transition);
}

body.light-mode .client-card-avatar {
    background: #eef2ff;
    color: #4f46e5;
}

.client-card-meta {
    display: flex;
    flex-direction: column;
}

.client-card-no {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

body.light-mode .client-card-no {
    color: #4f46e5;
}

.client-card-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
}

body.light-mode .client-card-name {
    color: #0f172a;
}

.client-card-name a {
    color: inherit;
    transition: var(--transition);
}

.client-card-name a:hover {
    color: #4f46e5;
}

/* Client Card Body */
.client-card-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    z-index: 1;
    flex-grow: 1;
}

.client-card-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.08);
    padding: 12px 0;
}

body.light-mode .client-card-info-item {
    border-bottom-color: #e2e8f0;
    border-bottom-style: dotted;
}

.client-card-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.client-card-info-label {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

body.light-mode .client-card-info-label {
    color: #475569;
}

.client-card-info-label i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

body.light-mode .client-card-info-label i {
    color: #64748b;
}

.client-card-info-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    max-width: 210px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.light-mode .client-card-info-value {
    color: #1e293b;
    font-weight: 700;
}

.client-card-info-value a {
    color: inherit;
    transition: var(--transition);
}

body.light-mode .client-card-info-value a {
    color: #4f46e5;
}

body.light-mode .client-card-info-value a:hover {
    color: #312e81;
    text-decoration: underline !important;
}

/* Client Card Tags */
.client-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    position: relative;
    z-index: 1;
    margin-top: auto;
    min-height: 24px;
}

.client-card-tags .badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 99px;
    text-transform: uppercase;
}

body.light-mode .client-card-tags .badge-success {
    background: #ecfdf5;
    color: #059669;
}

body.light-mode .client-card-tags .badge-blue {
    background: #eff6ff;
    color: #2563eb;
}

body.light-mode .client-card-tags .badge-purple {
    background: #faf5ff;
    color: #7c3aed;
}

/* Client Card Actions */
.client-card-actions {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    position: relative;
    z-index: 1;
}

.client-card-actions .btn {
    flex: 1;
    justify-content: center;
    align-items: center;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none !important;
    border: none !important;
    transition: var(--transition);
}

.client-card-actions .btn i {
    font-size: 13px;
}

/* View Button */
.client-card-actions .btn-secondary {
    background: rgba(124, 92, 252, 0.1);
    color: var(--accent-purple);
}

body.light-mode .client-card-actions .btn-secondary {
    background: #eef2ff;
    color: #4f46e5;
}

body.light-mode .client-card-actions .btn-secondary:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
}

/* Edit Button */
.client-card-actions .btn-warning {
    background: rgba(79, 142, 247, 0.1);
    color: var(--accent-blue);
}

body.light-mode .client-card-actions .btn-warning {
    background: #eff6ff;
    color: #2563eb;
}

body.light-mode .client-card-actions .btn-warning:hover {
    background: #dbeafe;
    transform: translateY(-1px);
}

/* Delete Button */
.client-card-actions .btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

body.light-mode .client-card-actions .btn-danger {
    background: #fef2f2;
    color: #dc2626;
}

body.light-mode .client-card-actions .btn-danger:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

/* =============================================
   NEW ADDITIONS: MANAGER ROLE, NOTIFICATIONS, COMMENTS
   ============================================= */

/* Role Badges */
.role-l3 {
    background: rgba(79, 142, 247, 0.2);
    color: var(--accent-blue);
}

body.light-mode .role-l3 {
    background: #eff6ff;
    color: #2563eb;
}

.badge-blue {
    background: rgba(79, 142, 247, 0.15);
    color: var(--accent-blue);
}

body.light-mode .badge-blue {
    background: #eff6ff;
    color: #2563eb;
}

/* Notification Menu Dropdown */
.topbar-notifications {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    display: none;
    z-index: 1100;
    animation: fadeSlideDown 0.2s ease;
}

body.light-mode .notification-dropdown {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.topbar-notifications.open .notification-dropdown {
    display: block;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

body.light-mode .notification-header {
    border-bottom-color: #e2e8f0;
}

.notification-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
}

body.light-mode .notification-header h3 {
    color: #0f172a;
}

.mark-read-btn {
    font-size: 11px;
    color: var(--accent-purple);
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    transition: var(--transition);
}

.mark-read-btn:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.notification-list {
    max-height: 280px;
    overflow-y: auto;
}

.notification-empty {
    padding: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    text-decoration: none;
}

body.light-mode .notification-item {
    border-bottom-color: #e2e8f0;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--bg-card-hover);
}

body.light-mode .notification-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

.notification-item.unread {
    background: rgba(124, 92, 252, 0.04);
}

body.light-mode .notification-item.unread {
    background: rgba(37, 99, 235, 0.02);
}

.notification-content {
    flex: 1;
    padding-right: 8px;
}

.notification-msg {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
}

body.light-mode .notification-msg {
    color: #334155;
}

.notification-time {
    font-size: 10px;
    color: var(--text-muted);
}

.unread-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-purple);
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

/* =============================================
   PROFILE PAGE & GOOGLE INTEGRATION
   ============================================= */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

@media (min-width: 992px) {
    .profile-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.profile-details-list {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
    font-size: 14px;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
}

body.light-mode .detail-label {
    color: #475569;
}

body.light-mode .detail-value {
    color: #0f172a;
}

.btn-google-connect {
    background-color: #4285f4;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none;
}

.btn-google-connect:hover {
    background-color: #357ae8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.btn-google-connect:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loader-inline {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   COLLAPSED SIDEBAR & ACTIVE STATES OVERRIDES
   ============================================= */

/* Enforce active state style on hover to prevent default hover overrides */
.page-btn.active:hover {
    background: var(--gradient-main) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.nav-link.active:hover {
    background: var(--bg-nav-active) !important;
    color: var(--color-nav-active) !important;
}

/* Desktop Collapsed Sidebar overrides */
@media (min-width: 1025px) {

    /* Smoother sidebar width transition */
    .sidebar {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    body.sidebar-collapsed-state .sidebar {
        transform: none !important;
        /* Don't slide out of screen */
        width: 72px !important;
    }

    body.sidebar-collapsed-state .sidebar .sidebar-logo {
        padding: 16px 0 !important;
        justify-content: center !important;
        gap: 0 !important;
    }

    body.sidebar-collapsed-state .sidebar .sidebar-logo .brand-text {
        display: none !important;
    }

    body.sidebar-collapsed-state .sidebar .sidebar-logo .sidebar-close {
        display: none !important;
    }

    body.sidebar-collapsed-state .sidebar .sidebar-nav {
        padding: 16px 8px !important;
    }

    body.sidebar-collapsed-state .sidebar .nav-link {
        justify-content: center !important;
        padding: 11px 0 !important;
        border-radius: var(--radius-md) !important;
    }

    body.sidebar-collapsed-state .sidebar .nav-link.active {
        padding-left: 0 !important;
    }

    body.sidebar-collapsed-state .sidebar .nav-link .nav-label {
        display: none !important;
    }

    body.sidebar-collapsed-state .sidebar .nav-link .nav-active-dot {
        display: none !important;
        /* Hide dot in collapsed view */
    }

    /* Content and topbar adapt to collapsed sidebar width */
    .main-content {
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    body.sidebar-collapsed-state .main-content {
        margin-left: 72px !important;
    }

    .topbar {
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    body.sidebar-collapsed-state .topbar {
        left: 72px !important;
    }
}

/* Sidebar Nav Link overrides for legibility */
.sidebar .nav-link {
    color: #cbd5e1 !important;
    /* Extremely clear light slate gray for maximum legibility on deep navy background */
    font-weight: 600 !important;
    /* Enforced clear semi-bold weight */
}

.sidebar .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.sidebar .nav-link.active {
    background: #3b82f6 !important;
    color: #ffffff !important;
}

.sidebar .nav-link.active .nav-icon {
    background: transparent !important;
    color: #ffffff !important;
}

.sidebar .nav-link:hover .nav-icon {
    background: transparent !important;
    color: #ffffff !important;
}

.sidebar .nav-icon {
    color: #cbd5e1 !important;
}

.sidebar .brand-name {
    color: #ffffff !important;
    font-weight: 800;
}

.sidebar .brand-sub {
    color: #94a3b8 !important;
}

.sidebar-footer ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Ensure footer text and icons also hide when collapsed on desktop */
body.sidebar-collapsed-state .sidebar .sidebar-footer .nav-label {
    display: none !important;
}

body.sidebar-collapsed-state .sidebar .sidebar-footer .nav-link {
    justify-content: center !important;
    padding: 11px 0 !important;
}

body.sidebar-collapsed-state .sidebar .sidebar-footer .nav-link.active {
    padding-left: 0 !important;
}

/* Sidebar Danger/Logout link overrides for clear red color states */
.sidebar .nav-link.text-danger {
    color: #f87171 !important;
    /* Soft premium coral-red for dark backgrounds */
}

.sidebar .nav-link.text-danger .nav-icon {
    color: #f87171 !important;
}

.sidebar .nav-link.text-danger:hover {
    color: #ef4444 !important;
    /* Bright, bold red on hover */
    background: rgba(239, 68, 68, 0.12) !important;
}

.sidebar .nav-link.text-danger:hover .nav-icon {
    color: #ef4444 !important;
}

/* =============================================
   MOBILE UI/UX CRM OPTIMIZATIONS
   ============================================= */

/* 1. Prevent iOS Auto-Zoom on form input focus */
@media (max-width: 768px) {

    .form-control,
    .login-input,
    select.form-control,
    textarea.form-control {
        font-size: 16px !important;
    }
}

/* 2. Topbar Height and Spacing Adjustments for Mobile */
@media (max-width: 768px) {
    :root {
        --topbar-height: 56px;
    }

    .topbar {
        padding: 0 12px;
    }

    .topbar-theme {
        display: none !important;
        /* Hide theme toggle in header on mobile */
    }
}

/* Hide mobile-only elements on desktop */
.mobile-only-theme-toggle {
    display: none !important;
}

/* Show mobile-only elements on mobile viewports */
@media (max-width: 1024px) {
    .mobile-only-theme-toggle {
        display: block !important;
    }
}

/* 3. Floating Action Button (FAB) for primary Add actions on mobile screens */
@media (max-width: 768px) {

    /* Target primary action buttons in the page-header that are links to add pages */
    .page-actions a.btn-primary[href*="add"],
    .page-actions a.btn-primary[href*="_add"] {
        position: fixed;
        bottom: 24px;
        right: 24px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
        z-index: 1500;
        /* High enough to be on top of content and overlays */
        padding: 0;
        font-size: 0 !important;
        /* Hide text */
        border: none;
    }

    .page-actions a.btn-primary[href*="add"] i,
    .page-actions a.btn-primary[href*="_add"] i {
        font-size: 20px;
        margin: 0;
    }
}

/* 4. Bottom Sheet Modals on mobile for native app-like experience */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-end;
        /* Align modals to the bottom */
        padding: 0;
    }

    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: 24px 24px 0 0;
        /* Rounded top corners only */
        max-height: 85vh;
        /* Keep some gap at top to maintain context */
        transform: translateY(100%);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
        padding: 24px 16px 40px;
        /* Safe padding for bottom of viewport */
        position: relative;
    }

    /* Drag handle indicator for native look */
    .modal::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-color);
        border-radius: 99px;
        margin: -12px auto 20px;
    }

    .modal-overlay.active .modal {
        transform: translateY(0);
    }
}

/* 5. Compact Cards Padding & spacing on Mobile */
@media (max-width: 768px) {
    .card {
        padding: 16px !important;
    }
}

@media (max-width: 576px) {
    .client-card {
        padding: 16px !important;
        gap: 14px !important;
    }

    .client-card-header {
        padding-bottom: 12px !important;
        gap: 12px !important;
    }

    .client-card-avatar {
        width: 46px !important;
        height: 46px !important;
        font-size: 18px !important;
        border-radius: 10px !important;
    }

    .client-card-name {
        font-size: 16px !important;
    }

    .client-card-info-item {
        padding: 8px 0 !important;
        font-size: 13px !important;
    }

    .client-card-actions {
        margin-top: 4px !important;
        gap: 8px !important;
    }

    .client-card-actions .btn {
        padding: 8px 10px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
    }
}

/* 6. Smooth Momentum Touch Scrolling for Table Containers */
.table-container {
    -webkit-overflow-scrolling: touch;
}

/* 7. Dropdown alignments on narrow viewports */
@media (max-width: 576px) {
    .notification-dropdown {
        position: fixed !important;
        top: calc(var(--topbar-height) + 8px) !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
    }

    .user-dropdown {
        position: fixed !important;
        top: calc(var(--topbar-height) + 8px) !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
    }
}

/* 8. Full-screen Detail Slide-in Panel on mobile views */
@media (max-width: 768px) {
    .detail-panel {
        top: 0 !important;
        height: 100vh !important;
        width: 100% !important;
        z-index: 2200 !important;
        /* Stand above topbar & overlays */
        border-left: none !important;
    }

    .detail-panel-header {
        padding: 16px 20px !important;
    }

    .detail-panel-body {
        padding: 20px !important;
    }
}

/* 9. Per-page selector dropdown option styling for Light/Dark themes */
.per-page-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

body.light-mode .per-page-select option {
    background: #ffffff;
    color: #0f172a;
}

/* 10. Stack pagination on mobile views */
@media (max-width: 576px) {
    .pagination {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 16px !important;
    }

    .pagination-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 6px !important;
        margin-left: 0 !important;
    }

    .per-page-selector-wrapper {
        margin-left: 0 !important;
    }
}

/* =============================================
   MOBILE UI/UX OVERRIDES & FIXES
   ============================================= */
@media (max-width: 768px) {

    /* 1. Prevent global page horizontal overflow */
    html,
    body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* 2. Hide mobile utility class */
    .hide-mobile {
        display: none !important;
    }

    /* 3. Header navbar spacing & title optimization */
    .topbar-title-wrapper {
        gap: 6px !important;
        font-size: 13px !important;
    }

    .topbar-welcome,
    .topbar-divider {
        display: none !important;
    }

    .topbar-left {
        gap: 8px !important;
    }

    .topbar-title {
        display: block !important;
        font-size: 13px !important;
    }

    /* 4. Dashboard Metric Cards - Horizontal Row Layout to prevent text wrapping */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .stat-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 14px !important;
        padding: 12px 16px !important;
        height: auto !important;
        min-height: 64px !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border-color) !important;
    }

    .stat-card-top {
        margin-bottom: 0 !important;
        flex-shrink: 0 !important;
    }

    .stat-icon {
        width: 38px !important;
        height: 38px !important;
        font-size: 16px !important;
    }

    .stat-card .stat-value {
        font-size: 20px !important;
        font-weight: 700 !important;
        margin: 0 !important;
        order: 2 !important;
        margin-left: auto !important;
        /* Align value to the far right */
    }

    .stat-card .stat-label {
        font-size: 11px !important;
        font-weight: 500 !important;
        color: var(--text-secondary) !important;
        margin: 0 !important;
        text-align: left !important;
        order: 1 !important;
    }

    .stat-card-glow {
        display: none !important;
    }

    .stat-badge {
        display: none !important;
    }

    /* 5. Dashboard Column Layout & Grid Enforcements to Prevent Layout Stretching */
    .dashboard-grid,
    .client-view-grid {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        min-width: 0 !important;
        gap: 16px !important;
    }

    .dashboard-grid>*,
    .client-view-grid>*,
    .card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* 6. Horizontal Scrollable Status Tabs */
    .sector-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 8px !important;
        padding-bottom: 8px !important;
        margin-bottom: 16px !important;
        border-bottom: 1px solid var(--border-color) !important;
        scrollbar-width: none !important;
    }

    .sector-tabs::-webkit-scrollbar {
        display: none !important;
    }

    .sector-tab {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
    }

    /* 7. Clean Table containers scrollbar & min-widths */
    .table-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: var(--radius-md) !important;
        margin-top: 12px !important;
        display: block !important;
    }

    .data-table {
        min-width: 650px !important;
        /* Preserves column width from squeezing */
    }

    /* 8. Stack cramped client details key-values */
    .detail-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .detail-item[style*="grid-column"] {
        grid-column: span 1 !important;
    }

    /* 9. Stack page forms and search filters */
    .main-content .card form {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .main-content .card form .form-group {
        width: 100% !important;
        margin: 0 !important;
        min-width: 0 !important;
    }

    .main-content .card form .btn,
    .main-content .card form a.btn {
        width: 100% !important;
        justify-content: center !important;
        margin: 0 !important;
    }

    /* 10. Recreate mobile profile details and header layouts */
    .profile-header-container {
        flex-direction: column !important;
        text-align: center !important;
        align-items: center !important;
        gap: 12px !important;
    }

    .profile-header-container>div {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .profile-header-container .user-role-badge,
    .profile-header-container form {
        justify-content: center !important;
    }

    .profile-details-list {
        grid-template-columns: 1fr !important;
        gap: 4px !important;
    }

    .profile-details-list .detail-label:not(:first-of-type) {
        margin-top: 12px !important;
    }

    .profile-details-list .detail-value {
        word-break: break-all !important;
        overflow-wrap: break-word !important;
    }

    /* 11. Responsive Horizontal Chart Slider for Mobile */
    .dashboard-charts {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 16px !important;
        padding-bottom: 12px !important;
        scrollbar-width: none !important;
        width: 100% !important;
    }

    .dashboard-charts::-webkit-scrollbar {
        display: none !important;
    }

    .dashboard-charts .card {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Card Options Dropdown (3-Dot menu) */
.card-options-dropdown {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.options-dropdown-toggle {
    color: var(--text-muted);
    font-size: 16px;
    padding: 6px 10px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.options-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
}

body.light-mode .options-dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.options-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 140px;
    z-index: 100;
    overflow: hidden;
}

body.light-mode .options-dropdown-menu {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background: #ffffff;
}

.options-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
    text-align: left;
}

.options-dropdown-menu .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-white);
}

body.light-mode .options-dropdown-menu .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.options-dropdown-menu .dropdown-item.text-danger {
    color: #f87171 !important;
}

.options-dropdown-menu .dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #ef4444 !important;
}