/*
  Developed by Rameez Scripts
  WhatsApp: https://wa.me/923224083545 (For Custom Projects)
  YouTube: https://www.youtube.com/@rameezimdad (Subscribe for more!)
*/

/* ===== Color Scheme - Light Theme (Default) ===== */
:root {
    --navy-primary: #001f3f;
    --navy-dark: #001529;
    --navy-light: #003366;
    --navy-accent: #0074D9;
    --navy-hover: #002a52;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;

    /* Light Theme Colors */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #333333;
    --text-secondary: #555555;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --input-bg: #ffffff;
    --input-border: #d0d0d0;
    --table-hover: #f9f9f9;
    --skeleton-base: #f0f0f0;
    --skeleton-shine: #e0e0e0;
}

/* ===== Dark Theme ===== */
body.dark-mode {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e1e3f;
    --text-primary: #e8eaf6;
    --text-secondary: #b0b3c5;
    --text-muted: #8a8d9f;
    --border-color: #2d2d5a;
    --border-light: #252550;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --input-bg: #252550;
    --input-border: #3d3d7a;
    --table-hover: #252550;
    --skeleton-base: #252550;
    --skeleton-shine: #2d2d5a;

    --navy-primary: #0a1628;
    --navy-dark: #060d16;
    --navy-light: #1a3a5c;
}

/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.3s ease, color 0.3s ease;
}

input, select, textarea {
    font-size: 16px !important;
    touch-action: manipulation;
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--navy-primary) 0%, var(--navy-dark) 100%);
    color: white;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: width 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
}

.sidebar-title {
    color: white;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-title-text {
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar-toggle-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: rgba(255,255,255,0.2);
}

.sidebar-toggle-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.sidebar-logo-section {
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-logo {
    width: 55px;
    height: 55px;
    min-width: 55px;
    min-height: 55px;
    max-width: 55px;
    max-height: 55px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    display: block;
    overflow: hidden;
}

.sidebar-logo:hover {
    transform: scale(1.1);
    border-color: var(--navy-accent);
    box-shadow: 0 5px 15px rgba(0,116,217,0.6);
}

.sidebar-menu-section {
    flex: 1;
    padding: 20px 16px;
}

.sidebar-menu-title {
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    padding: 0 12px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 4px;
}

.sidebar-menu a,
.sidebar-menu button {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    border-radius: 3px;
    font-size: 15px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-menu a:hover,
.sidebar-menu button:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(4px);
}

.sidebar-menu a.active,
.sidebar-menu button.active {
    background: var(--navy-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(0,116,217,0.3);
}


/* switch back banner */
.switch-back-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; background: linear-gradient(135deg, #ff6b35 0%, #ea4335 100%); color: #fff; padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.switch-back-info { display: flex; align-items: center; gap: 8px; }
.switch-back-info i { font-size: 16px; }
.switch-back-btn { background: #fff; color: #ea4335; border: none; padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 5px; transition: all 0.2s; }
.switch-back-btn:hover { background: #ffe0d6; }
.switch-back-banner ~ .app-container { margin-top: 40px; }
.switch-back-banner ~ .app-container .sidebar { top: 40px; height: calc(100vh - 40px); }

.sidebar-menu i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.sidebar-logout {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.15);
}

.sidebar-logout button {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(234,67,53,0.2) 0%, rgba(234,67,53,0.3) 100%);
    border: 1px solid rgba(234,67,53,0.4);
    color: white;
    cursor: pointer;
    border-radius: 3px;
    font-size: 15px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
}

.sidebar-logout button:hover {
    background: linear-gradient(135deg, rgba(234,67,53,0.4) 0%, rgba(234,67,53,0.5) 100%);
    transform: translateY(-2px);
}

.sidebar-logout button i {
    font-size: 16px;
}

.sidebar-logout button span {
    font-size: 15px;
}

/* Sidebar User Info */
.sidebar-user-name {
    font-size: 15px;
    font-weight: 600;
    color: white;
    text-align: center;
    transition: all 0.3s ease;
}

.sidebar-user-role {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,116,217,0.3);
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: capitalize;
    transition: all 0.3s ease;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header {
    padding: 20px 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-title {
    justify-content: center;
}

.sidebar.collapsed .sidebar-title-text {
    display: none;
}

.sidebar.collapsed .sidebar-toggle-btn {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--navy-primary);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.sidebar.collapsed .sidebar-logo-section {
    padding: 10px;
}

.sidebar.collapsed .sidebar-logo {
    width: 45px;
    height: 45px;
    min-width: 45px;
    min-height: 45px;
    max-width: 45px;
    max-height: 45px;
}

.sidebar.collapsed .sidebar-menu-section {
    padding: 15px 8px;
}

.sidebar.collapsed .sidebar-menu-title {
    display: none;
}

.sidebar.collapsed .sidebar-menu a,
.sidebar.collapsed .sidebar-menu button {
    justify-content: center;
    padding: 14px 10px;
    gap: 0;
}

.sidebar.collapsed .sidebar-menu a span,
.sidebar.collapsed .sidebar-menu button span {
    display: none;
}

.sidebar.collapsed .sidebar-menu a i,
.sidebar.collapsed .sidebar-menu button i {
    font-size: 20px;
    width: auto;
}

.sidebar.collapsed .sidebar-menu a:hover,
.sidebar.collapsed .sidebar-menu button:hover {
    transform: scale(1.1);
}

/* Hide submenu arrow in collapsed state */
.sidebar.collapsed .submenu-arrow {
    display: none;
}

/* Submenu in collapsed state */
.sidebar.collapsed .sidebar-submenu {
    position: absolute;
    left: 70px;
    top: 0;
    width: 200px;
    background: var(--navy-dark);
    border-radius: 4px;
    box-shadow: 4px 4px 12px rgba(0,0,0,0.3);
    max-height: none;
    opacity: 0;
    visibility: hidden;
    z-index: 100;
}

.sidebar.collapsed .has-submenu:hover .sidebar-submenu {
    opacity: 1;
    visibility: visible;
}

.sidebar.collapsed .sidebar-submenu a {
    padding: 12px 16px;
    justify-content: flex-start;
    gap: 10px;
}

.sidebar.collapsed .sidebar-submenu a span {
    display: inline;
}

.sidebar.collapsed .sidebar-submenu a i {
    font-size: 14px;
    width: 20px;
}

/* Theme toggle in collapsed state */
.sidebar.collapsed .sidebar-theme {
    padding: 12px 8px;
}

.sidebar.collapsed .sidebar-theme button {
    padding: 14px 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-theme button span {
    display: none;
}

.sidebar.collapsed .sidebar-theme button i {
    font-size: 20px;
}

/* Logout button in collapsed state */
.sidebar.collapsed .sidebar-logout {
    padding: 12px 8px;
}

.sidebar.collapsed .sidebar-logout button {
    padding: 14px 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logout button span {
    display: none;
}

.sidebar.collapsed .sidebar-logout button i {
    font-size: 20px;
}

/* Tooltip for collapsed sidebar items */
.sidebar.collapsed .sidebar-menu li {
    position: relative;
}

.sidebar.collapsed .sidebar-menu li::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--navy-dark);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 100;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
}

.sidebar.collapsed .sidebar-menu li:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Mobile Menu Button - DEPRECATED (Now using bottom navigation bar) */
/* Old top hamburger button - kept for backwards compatibility but hidden */
.mobile-menu-btn-old {
    display: none !important;
}

/* Bottom nav menu button is now in mobile-menu.php inline styles */

/* ===== Mobile Bottom Navigation Bar ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--navy-primary);
    z-index: 1001;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    justify-content: space-around;
    align-items: center;
    padding: 0 5px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    min-width: 60px;
}

.mobile-nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.mobile-nav-item span {
    white-space: nowrap;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
    color: white;
    background: rgba(255,255,255,0.1);
}

.mobile-nav-item.active {
    color: white;
    background: var(--navy-accent);
    box-shadow: 0 2px 8px rgba(0,116,217,0.4);
}

.mobile-nav-item.active i {
    transform: scale(1.1);
}

.mobile-nav-more {
    color: rgba(255,255,255,0.9);
}

/* Sidebar Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Mobile Sidebar */
@media (max-width: 768px) {
    /* Show bottom navigation */
    .mobile-bottom-nav {
        display: flex;
    }

    /* Add padding to main content for bottom nav */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding-bottom: 80px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px !important;
        z-index: 1000;
        transition: left 0.3s ease;
        height: 100vh;
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    /* Disable collapsed state on mobile */
    .sidebar.collapsed {
        width: 280px !important;
        left: -280px;
    }

    .sidebar.collapsed.mobile-open {
        left: 0;
    }

    .sidebar.collapsed .sidebar-title-text,
    .sidebar.collapsed .sidebar-menu-title,
    .sidebar.collapsed .sidebar-menu a span,
    .sidebar.collapsed .sidebar-menu button span,
    .sidebar.collapsed .sidebar-theme button span,
    .sidebar.collapsed .sidebar-logout button span {
        display: inline !important;
    }

    .sidebar.collapsed .sidebar-menu a,
    .sidebar.collapsed .sidebar-menu button,
    .sidebar.collapsed .sidebar-theme button,
    .sidebar.collapsed .sidebar-logout button {
        justify-content: flex-start !important;
        padding: 14px 16px !important;
        gap: 14px !important;
    }

    .sidebar.collapsed .sidebar-menu a i,
    .sidebar.collapsed .sidebar-menu button i {
        font-size: 18px !important;
    }

    .sidebar.collapsed .sidebar-logo {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        min-height: 55px !important;
        max-width: 55px !important;
        max-height: 55px !important;
    }

    .sidebar.collapsed .submenu-arrow {
        display: inline !important;
    }

    .sidebar.collapsed .sidebar-submenu {
        position: static !important;
        width: 100% !important;
        background: transparent !important;
        box-shadow: none !important;
        opacity: 0;
        visibility: hidden;
    }

    .sidebar.collapsed .sidebar-submenu.open {
        opacity: 1;
        visibility: visible;
    }

    /* Hide sidebar toggle button on mobile */
    .sidebar-toggle-btn {
        display: none !important;
    }

    .app-container {
        flex-direction: column;
    }

    /* Adjust header for mobile */
    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 18px;
    }

    /* Data section padding adjustment */
    .data-section {
        padding: 15px;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .section-header > div {
        width: 100%;
        display: flex;
        gap: 10px;
    }

    .section-header .btn {
        flex: 1;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    .mobile-nav-item {
        padding: 8px 8px;
        min-width: 50px;
    }

    .mobile-nav-item i {
        font-size: 18px;
    }

    .mobile-nav-item span {
        font-size: 9px;
    }
}

/* Dark mode for mobile navigation */
body.dark-mode .mobile-bottom-nav {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

body.dark-mode .mobile-nav-item {
    color: var(--text-muted);
}

body.dark-mode .mobile-nav-item:hover,
body.dark-mode .mobile-nav-item:focus {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

body.dark-mode .mobile-nav-item.active {
    color: white;
    background: var(--navy-accent);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-primary);
    transition: background-color 0.3s ease, margin-left 0.3s ease;
}

.header {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 3px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.header h1 {
    font-size: 24px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 3px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

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

.section-header h2 {
    font-size: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== Skeleton Loaders ===== */
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 3px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-table {
    width: 100%;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.skeleton-table-row {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.skeleton-table-cell {
    height: 20px;
    border-radius: 3px;
}

.skeleton-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--navy-primary);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.skeleton-icon {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 12px;
    border-radius: 3px;
}

.skeleton-text-large {
    height: 32px;
    margin-bottom: 8px;
    border-radius: 3px;
}

.skeleton-chart {
    width: 100%;
    height: 300px;
    border-radius: 3px;
}

/* ===== Dashboard Stats ===== */
.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Fox-style colorful stat cards */
.stat-card {
    padding: 24px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 100px;
    color: #fff;
    background: var(--navy-primary);
}

.stat-card-content {
    position: relative;
    z-index: 1;
}

.stat-card-icon {
    font-size: 48px;
    opacity: 0.3;
    position: relative;
    z-index: 1;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-bottom: 6px;
}

body.dark-mode .stat-card-value {
    color: #fff;
}

.stat-card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    color: #fff;
}

/* Fox-style card colors */
.stat-card-red { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
.stat-card-orange { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); }
.stat-card-green { background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%); }
.stat-card-purple { background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%); }
.stat-card-blue { background: linear-gradient(135deg, #2980b9 0%, #3498db 100%); }
.stat-card-cyan { background: linear-gradient(135deg, #16a085 0%, #1abc9c 100%); }
.stat-card-navy { background: linear-gradient(135deg, #001f3f 0%, #003366 100%); }
.stat-card-pink { background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%); }

.stat-card-urgent { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); }
.stat-card-danger { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }

.dashboard-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 6px;
    border-left: 4px solid var(--navy-accent);
}

.dashboard-list-item:nth-child(odd) {
    background: var(--bg-secondary);
}

.dashboard-list-item:nth-child(even) {
    background: var(--bg-card);
}

.dashboard-list-item:last-child {
    margin-bottom: 0;
}

/* Alternate left border colors */
.dashboard-list-item:nth-child(4n+1) { border-left-color: #0074D9; }
.dashboard-list-item:nth-child(4n+2) { border-left-color: #28a745; }
.dashboard-list-item:nth-child(4n+3) { border-left-color: #fd7e14; }
.dashboard-list-item:nth-child(4n+4) { border-left-color: #6f42c1; }

.dashboard-list-time {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    background: var(--navy-accent);
    padding: 4px 10px;
    border-radius: 4px;
    min-width: 52px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1.3;
}

.dashboard-list-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    color: #fff;
}

.dashboard-list-icon-hearing {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.dashboard-list-icon-appointment {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.dashboard-list-icon-case {
    background: linear-gradient(135deg, #2980b9, #3498db);
}

.dashboard-list-icon-overdue {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.dashboard-list-content {
    flex: 1;
    min-width: 0;
}

.dashboard-list-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-list-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.dashboard-list-meta i {
    margin-right: 2px;
    font-size: 11px;
}

.dashboard-list-meta .status-badge {
    font-size: 10px;
    padding: 2px 8px;
}

.dashboard-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.dashboard-empty i {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
    color: var(--success);
    opacity: 0.6;
}

@media (max-width: 768px) {

    .dashboard-list-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .dashboard-list-time {
        font-size: 11px;
        min-width: 44px;
        padding: 3px 6px;
    }

    .dashboard-list-icon {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .dashboard-list-title {
        font-size: 12px;
    }
}

/* ===== SweetAlert Cases Table ===== */
.swal-cases-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.swal-cases-table th {
    background: var(--navy-primary);
    color: #fff;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.swal-cases-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
    color: #333;
}

.swal-cases-table tr:last-child td {
    border-bottom: none;
}

.swal-cases-table tr:hover td {
    background: #f8f9fa;
}

.swal-wide-popup {
    max-width: 90vw !important;
}

/* ===== Client Contact Card ===== */
.contact-card {
    text-align: center;
    padding: 20px 0;
}

.contact-avatar {
    font-size: 60px;
    color: var(--navy-accent);
    margin-bottom: 10px;
}

.contact-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.contact-company {
    font-size: 14px;
    color: var(--navy-accent);
    font-weight: 600;
    margin-top: 2px;
}

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

.contact-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 15px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin: 10px 0 15px;
}

.contact-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: all 0.2s;
}

.contact-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.contact-btn-call {
    background: #28a745;
}

.contact-btn-whatsapp {
    background: #25D366;
}

.contact-btn-sms {
    background: #17a2b8;
}

.contact-btn-email {
    background: #0074D9;
}

.contact-details {
    padding-top: 5px;
}

.contact-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.contact-detail-row:last-child {
    border-bottom: none;
}

.contact-detail-label {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 110px;
}

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

.contact-detail-value a {
    color: var(--navy-accent);
    text-decoration: none;
}

.contact-detail-value a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .contact-actions {
        gap: 8px;
    }

    .contact-action-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .contact-avatar {
        font-size: 48px;
    }

    .contact-name {
        font-size: 18px;
    }
}

/* ===== Appointment Time Slots ===== */
.time-slots-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--navy-accent);
    border-radius: 0 6px 6px 0;
    overflow: hidden;
}

.time-slots-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
    padding: 12px;
    max-height: 220px;
    overflow-y: auto;
}

.time-slot {
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.time-slot-time {
    font-weight: 700;
    min-width: 58px;
    flex-shrink: 0;
}

.time-slot-info {
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-available {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
    cursor: pointer;
}

.slot-available:hover {
    background: #b1dfbb;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.slot-booked {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
    cursor: not-allowed;
}

.slot-completed {
    background: #e2e3e5;
    color: #6c757d;
    border-color: #d6d8db;
    cursor: not-allowed;
}

.slot-past {
    background: #f5f5f5;
    color: #adb5bd;
    border-color: #e9ecef;
    cursor: not-allowed;
}

.slot-selected {
    background: var(--navy-primary);
    color: #fff;
    border-color: var(--navy-primary);
}

.slot-selected .time-slot-info {
    color: rgba(255,255,255,0.8);
}

@media (max-width: 768px) {
    .time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        max-height: 180px;
    }

    .time-slot {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* ===== Case Fee Info Panel (Payments Modal) ===== */
.case-fee-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--navy-accent);
    border-radius: 0 6px 6px 0;
    padding: 16px;
}

.case-fee-row {
    display: flex;
    gap: 20px;
}

.case-fee-item {
    flex: 1;
    text-align: center;
}

.case-fee-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.case-fee-value {
    font-size: 20px;
    font-weight: 800;
}

.case-fee-total {
    color: var(--navy-accent);
}

.case-fee-paid {
    color: var(--success);
}

.case-fee-balance {
    color: var(--text-primary);
}

.case-fee-due {
    color: var(--danger);
}

.case-fee-clear {
    color: var(--success);
}

.case-fee-history-title {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.case-fee-history {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.case-fee-history-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-light);
}

.case-fee-history-row:last-child {
    border-bottom: none;
}

.case-fee-history-row:nth-child(even) {
    background: var(--bg-primary);
}

.case-fee-history-row.case-fee-editing {
    background: rgba(0, 116, 217, 0.08);
    border-left: 3px solid var(--navy-accent);
}

.case-fee-history-num {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 24px;
}

.case-fee-history-date {
    min-width: 90px;
    color: var(--text-secondary);
}

.case-fee-history-method {
    min-width: 90px;
    color: var(--text-muted);
}

.case-fee-history-receipt {
    flex: 1;
    color: var(--text-muted);
}

.case-fee-history-amount {
    font-weight: 700;
    color: var(--success);
    text-align: right;
    min-width: 80px;
}

@media (max-width: 768px) {
    .case-fee-row {
        flex-direction: column;
        gap: 10px;
    }

    .case-fee-value {
        font-size: 16px;
    }

    .case-fee-history-row {
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* ===== Branding Preview ===== */
.settings-branding-section {
    margin-bottom: 25px;
}

.branding-preview {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.branding-logo-preview {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    margin-top: 8px;
    background: var(--bg-secondary);
}

.logo-upload-area {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.logo-upload-preview {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.logo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

/* ===== Case Report Modal & Print ===== */
.report-modal {
    max-width: 80%;
    width: 80%;
}

.case-report {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1a1a1a;
    line-height: 1.6;
    max-width: 210mm;
    margin: 0 auto;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 15px;
}

.report-logo-block {
    display: flex;
    align-items: center;
    gap: 15px;
}

.report-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 6px;
}

.report-firm-name {
    font-size: 22px;
    font-weight: 800;
    color: #001f3f;
    letter-spacing: 0.5px;
}

.report-subtitle {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.report-meta {
    text-align: right;
    font-size: 13px;
    color: #555;
    line-height: 1.8;
}

.report-divider {
    height: 3px;
    background: linear-gradient(to right, #001f3f, #0074D9, #001f3f);
    margin: 15px 0 20px;
    border-radius: 2px;
}

.report-title-banner {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-left: 4px solid #001f3f;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 0 4px 4px 0;
}

.report-case-title {
    font-size: 20px;
    font-weight: 700;
    color: #001f3f;
    margin: 0 0 8px 0;
}

.report-case-badges {
    display: flex;
    gap: 10px;
    align-items: center;
}

.report-status-badge {
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid currentColor;
    display: inline-block;
}

.report-priority-badge {
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.report-priority-low {
    background: #d4edda;
    color: #155724;
}

.report-priority-medium {
    background: #cce5ff;
    color: #004085;
}

.report-priority-high {
    background: #f8d7da;
    color: #721c24;
}

.report-priority-urgent {
    background: #721c24;
    color: #fff;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.report-section {
    background: #fff;
    border: 1px solid #bbb;
    border-radius: 3px;
    overflow: hidden;
}

.report-section-full {
    grid-column: 1 / -1;
}

.report-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #001f3f;
    padding: 8px 12px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-section-title i {
    color: #5dade2;
}

.report-row {
    display: flex;
    font-size: 13px;
    border-bottom: 1px solid #dee2e6;
}

.report-row:last-child {
    border-bottom: none;
}

.report-row:nth-child(even) {
    background: #f8f9fa;
}

.report-label {
    font-weight: 600;
    color: #555;
    min-width: 140px;
    padding: 7px 12px;
    background: #f0f4f8;
    border-right: 1px solid #dee2e6;
    flex-shrink: 0;
}

.report-value {
    padding: 7px 12px;
    color: #1a1a1a;
    font-weight: 500;
    flex: 1;
    text-align: right;
}

.report-description {
    font-size: 13px;
    color: #333;
    line-height: 1.7;
    margin: 0;
    padding: 12px 14px;
    white-space: pre-wrap;
}

.report-footer {
    margin-top: 30px;
}

.report-footer-line {
    height: 2px;
    background: linear-gradient(to right, #001f3f, #0074D9, #001f3f);
    margin-bottom: 12px;
}

.report-footer-text {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #888;
}

/* Print styles */
.print-body {
    background: #fff;
    padding: 20px 30px;
}

.print-body .case-report {
    max-width: 100%;
}

@media print {
    .report-section {
        break-inside: avoid;
    }

    .report-title-banner,
    .report-divider,
    .report-footer-line,
    .report-section-title,
    .report-priority-badge,
    .report-status-badge,
    .report-label,
    .report-row:nth-child(even) {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

@media (max-width: 768px) {
    .report-modal {
        max-width: 95%;
        width: 95%;
    }

    .report-header {
        flex-direction: column;
        gap: 10px;
    }

    .report-meta {
        text-align: left;
    }

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

    .report-footer-text {
        flex-direction: column;
        gap: 4px;
    }
}

.chart-container-fixed {
    height: 260px;
    max-height: 260px;
}

.dashboard-section-margin {
    margin-bottom: 30px;
}

/* ===== KPI Cards (Fox-style compact colored) ===== */
.kpi-card {
    border-radius: 6px;
    overflow: hidden;
    padding: 14px 12px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-card-bar {
    display: none;
}

.kpi-card-body {
    min-width: 0;
}

.kpi-card-pct {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 2px;
    color: #fff !important;
}

.kpi-card-count {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 600;
}

.kpi-card-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.kpi-card-icon {
    font-size: 28px;
    opacity: 0.3;
}

/* Nested grid inside data-section needs tighter gap */
.data-section .dashboard-grid-4 {
    gap: 10px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .kpi-card-pct {
        font-size: 18px;
    }

    .kpi-card {
        padding: 10px 10px;
    }

    .kpi-card-label {
        font-size: 9px;
    }
}

/* Custom Chart Legend */
.chart-custom-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    margin-top: 12px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 12px;
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chart-legend-name {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-legend-count {
    font-weight: 700;
    color: var(--text-primary);
    min-width: 16px;
    text-align: right;
}

.chart-legend-pct {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}

@media (max-width: 768px) {
    .chart-custom-legend {
        grid-template-columns: 1fr;
    }
}

.fox-mini-cards-grid .stat-card {
    min-height: 70px;
    padding: 14px 16px;
    border-radius: 6px;
}

.fox-mini-cards-grid .stat-card-value {
    font-size: 22px;
}

.fox-mini-cards-grid .stat-card-icon {
    font-size: 30px;
}

/* Last card spans full width if odd count */
.fox-mini-cards-grid .stat-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
}

/* ===== Hearing Urgent (Next Hearing within 3 days) ===== */
.hearing-urgent {
    color: #fff !important;
    font-weight: 700;
    background: var(--danger) !important;
}

/* ===== View Toggle Bar ===== */
.view-toggle-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.view-toggle-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.view-toggle-btn.active {
    background: var(--navy-primary);
    color: #fff;
}

body.dark-mode .view-toggle-btn.active {
    background: var(--navy-light);
}

/* ===== Calendar Grid ===== */
.calendar-grid {
    width: 100%;
}

.cal-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 1px;
}

.cal-day-header {
    padding: 10px 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: var(--navy-primary);
}

.cal-day-header:first-child {
    border-radius: 4px 0 0 0;
}

.cal-day-header:last-child {
    border-radius: 0 4px 0 0;
}

body.dark-mode .cal-day-header {
    background: var(--navy-light);
}

.cal-body {
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.cal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 90px;
}

.cal-week + .cal-week {
    border-top: 1px solid var(--border-color);
}

.cal-cell {
    padding: 4px 6px;
    min-height: 90px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    transition: background 0.2s;
    overflow: hidden;
}

.cal-cell:last-child {
    border-right: none;
}

.cal-cell:hover {
    background: var(--bg-secondary);
}

.cal-cell.cal-empty {
    background: var(--bg-secondary);
    opacity: 0.5;
}

.cal-cell.cal-today {
    background: rgba(0, 116, 217, 0.08);
}

.cal-cell.cal-today .cal-date-num {
    background: var(--navy-accent);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-date-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.cal-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cal-event {
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: filter 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cal-event:hover {
    filter: brightness(0.9);
}

.cal-event-scheduled {
    background: #cce5ff;
    color: #004085;
}

.cal-event-completed {
    background: #d4edda;
    color: #155724;
}

.cal-event-adjourned {
    background: #f8d7da;
    color: #721c24;
}

.cal-event-cancelled {
    background: #e2e3e5;
    color: #6c757d;
    text-decoration: line-through;
}

.cal-event-time {
    font-weight: 700;
}

.cal-event-case {
    font-weight: 600;
}

@media (max-width: 768px) {
    .cal-week {
        min-height: 70px;
    }

    .cal-cell {
        min-height: 70px;
        padding: 3px 4px;
    }

    .cal-date-num {
        font-size: 11px;
    }

    .cal-event {
        font-size: 9px;
        padding: 2px 4px;
    }

    .cal-day-header {
        font-size: 10px;
        padding: 8px 2px;
    }

    .view-toggle-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ===== Pipeline Chevron Tabs ===== */
.pipeline-stages {
    display: flex;
    width: 100%;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pipeline-stages::-webkit-scrollbar {
    display: none;
}

.pipeline-stage {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 20px 14px 28px;
    cursor: pointer;
    transition: filter 0.2s, opacity 0.2s;
    color: #fff;
    text-decoration: none;
    -webkit-clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 18px 50%);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 18px 50%);
}

.pipeline-stage:first-child {
    -webkit-clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%);
    padding-left: 16px;
    border-radius: 4px 0 0 4px;
}

.pipeline-stage:last-child {
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 18px 50%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 18px 50%);
    border-radius: 0 4px 4px 0;
}

.pipeline-stage:hover {
    filter: brightness(1.15);
}

.pipeline-stage.active {
    filter: brightness(1.25);
    box-shadow: inset 0 0 0 100px rgba(255,255,255,0.15);
}

.pipeline-stage-name {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: inherit;
}

.pipeline-stage-count {
    font-size: 14px;
    font-weight: 800;
    color: inherit;
    white-space: nowrap;
}

/* Inactive stages (0 count) are slightly transparent */
.pipeline-stage.pipeline-empty {
    opacity: 0.6;
}

.pipeline-stage.pipeline-empty:hover {
    opacity: 0.85;
}

@media (max-width: 992px) {
    .pipeline-stage {
        padding: 10px 16px 10px 24px;
    }

    .pipeline-stage-name {
        font-size: 10px;
    }

    .pipeline-stage-count {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .pipeline-stages {
        overflow-x: auto;
    }

    .pipeline-stage {
        min-width: 100px;
        flex-shrink: 0;
        flex-grow: 0;
        padding: 10px 14px 10px 22px;
    }

    .pipeline-stage-name {
        font-size: 9px;
    }
}

/* ===== Charts ===== */
.chart-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.chart-card h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 2px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--navy-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--navy-hover);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #2d8e47;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c8392b;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ===== DataTables ===== */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse;
    background: var(--bg-card);
}

table.dataTable thead th {
    background: var(--navy-primary) !important;
    color: white !important;
    padding: 14px !important;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

table.dataTable tbody td {
    padding: 12px 14px !important;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

table.dataTable tbody tr:hover {
    background: var(--table-hover) !important;
}

body.dark-mode table.dataTable thead th {
    background: var(--navy-light) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_length,
body.dark-mode .dataTables_wrapper .dataTables_filter,
body.dark-mode .dataTables_wrapper .dataTables_info,
body.dark-mode .dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_filter input,
body.dark-mode .dataTables_wrapper .dataTables_length select {
    background: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--navy-accent) !important;
    color: white !important;
    border-color: var(--navy-accent) !important;
}

body.dark-mode .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--navy-light) !important;
    color: white !important;
}

.dt-buttons {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dt-button {
    background: var(--navy-primary) !important;
    color: white !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    margin-right: 0 !important;
    cursor: pointer !important;
    min-height: 44px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dt-button:hover {
    background: var(--navy-hover) !important;
}

/* DataTable wrapper for mobile scroll */
.dataTables_wrapper {
    position: relative;
}

.dataTables_scroll,
.dataTables_scrollBody {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* DataTable responsive hint for mobile */
.table-scroll-hint {
    display: none;
    text-align: center;
    padding: 10px;
    background: rgba(0, 116, 217, 0.1);
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--navy-accent);
}

.table-scroll-hint i {
    margin-right: 6px;
}

@media (max-width: 768px) {
    .table-scroll-hint {
        display: block;
    }
}

/* ===== Action Icons ===== */
.action-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 10px;
    margin: 0 4px;
    border-radius: 2px;
    transition: all 0.3s;
}

.action-icon.edit-icon {
    color: var(--warning);
}

.action-icon.edit-icon:hover {
    background: rgba(251,188,4,0.1);
    transform: scale(1.15);
}

.action-icon.delete-icon {
    color: var(--danger);
}

.action-icon.delete-icon:hover {
    background: rgba(234,67,53,0.1);
    transform: scale(1.15);
}

.action-icon.view-icon {
    color: var(--navy-accent);
}

.action-icon.view-icon:hover {
    background: rgba(0,116,217,0.1);
    transform: scale(1.15);
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 6px 14px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-admin {
    background: #d4edda;
    color: #155724;
}

.status-user {
    background: #cce5ff;
    color: #004085;
}

.status-super-admin {
    background: #f8d7da;
    color: #721c24;
}

.status-senior-advocate {
    background: #d4edda;
    color: #155724;
}

.status-junior-advocate {
    background: #cce5ff;
    color: #004085;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

/* ===== Utility Classes ===== */
.section-header-actions {
    display: flex;
    gap: 10px;
}

.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== Color Picker ===== */
.color-picker-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker-input {
    width: 60px;
    height: 45px;
    padding: 2px;
    cursor: pointer;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
}

.color-picker-hex {
    flex: 1;
    text-transform: uppercase;
}

/* ===== Color Swatch (DataTable) ===== */
.color-swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    vertical-align: middle;
    margin-right: 8px;
}

body.dark-mode .color-swatch {
    border-color: var(--border-light);
}

/* ===== Dynamic Status Badge (color from DB) ===== */
.status-badge-dynamic {
    padding: 6px 14px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
    border: 1px solid currentColor;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.form-group label i {
    margin-right: 8px;
    color: var(--navy-accent);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 2px rgba(0,116,217,0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

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

.error {
    margin-top: 15px;
    margin-bottom: 15px;
    color: var(--danger);
    font-size: 14px;
    background: #fef2f2;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #fecaca;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

body.dark-mode .modal-overlay {
    background: rgba(0,0,0,0.8);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 4px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 24px var(--shadow-hover);
    transition: background-color 0.3s ease;
}

.modal-header {
    padding: 24px 30px;
    background: var(--navy-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px 4px 0 0;
}

body.dark-mode .modal-header {
    background: var(--navy-light);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    color: var(--text-primary);
}

/* ===== Filters Section ===== */
.filters-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 25px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--navy-accent);
}

.filters-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--input-border);
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}

.filter-input:focus {
    outline: none;
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 3px rgba(0,116,217,0.15);
}

/* ===== Account Info Card ===== */
.account-info-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border-left: 4px solid var(--navy-accent);
    margin-bottom: 30px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.account-info-card h3 {
    color: var(--text-primary);
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-row {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--text-secondary);
    width: 180px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-value {
    color: var(--text-primary);
    flex: 1;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 220px;
    }

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

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

    .modal {
        width: 95%;
    }

    .filters-section {
        padding: 15px;
    }

    .filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filters-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .filters-header .btn-sm {
        width: 100%;
    }

    .info-row {
        flex-direction: column;
        gap: 5px;
    }

    .info-label {
        width: 100%;
    }

    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ===== Login Page Specific ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
}

.login-box {
    background: white;
    padding: 50px 40px;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 25px;
    border: 3px solid var(--navy-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.login-box h2 {
    margin-bottom: 35px;
    color: var(--navy-primary);
    font-size: 26px;
    font-weight: 600;
}

.login-footer {
    margin-top: 24px;
    font-size: 13px;
    color: #666;
}

@media (max-width: 480px) {
    .login-box {
        padding: 32px 24px;
    }
}

/* ===== Settings Page - 2x2 Grid Layout ===== */

/* Main Grid */
.settings-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 30px;
}

/* Mega Cards */
.settings-mega-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: all 0.3s;
}

.settings-mega-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    border-color: var(--navy-accent);
}

/* Card Header */
.settings-card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 24px;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy-primary);
    margin: 0 0 4px 0;
}

.settings-card-subtitle {
    font-size: 13px;
    color: #666;
    margin: 0;
    font-weight: 500;
}

/* Card Body */
.settings-card-body {
    padding: 24px;
}

/* Stat Items (inline) */
.stat-item-inline {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.stat-item-inline:last-child {
    margin-bottom: 0;
}

.stat-item-inline:hover {
    background: #fff;
    border-color: var(--navy-accent);
    box-shadow: 0 2px 8px rgba(0, 116, 217, 0.1);
}

.stat-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-item-content {
    flex: 1;
}

.stat-item-label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item-value {
    font-size: 16px;
    color: var(--navy-primary);
    font-weight: 700;
}

/* Control Group */
.control-group {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.control-group-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.control-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 31, 63, 0.2);
}

.control-info {
    flex: 1;
}

.control-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--navy-primary);
    margin-bottom: 4px;
}

.control-desc {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.control-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

/* Large Toggle Switch */
.toggle-switch-large {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-input-large {
    display: none;
}

.toggle-label-large {
    display: block;
    width: 80px;
    height: 40px;
    background: #ccc;
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider-large {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.toggle-input-large:checked + .toggle-label-large {
    background: var(--success);
}

.toggle-input-large:checked + .toggle-label-large .toggle-slider-large {
    transform: translateX(40px);
}

.toggle-label-large:hover {
    opacity: 0.9;
}

/* Toggle Status */
.toggle-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-enabled {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.2);
}

.status-disabled {
    background: #ccc;
    box-shadow: none;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.2);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(52, 168, 83, 0.1);
    }
}

.status-text {
    font-size: 14px;
    font-weight: 600;
}

/* Info Banner */
.info-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 116, 217, 0.05);
    border: 1px solid rgba(0, 116, 217, 0.2);
    border-left: 4px solid var(--navy-accent);
    padding: 14px 16px;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.info-banner i {
    color: var(--navy-accent);
    font-size: 18px;
    flex-shrink: 0;
}

/* Security Features */
.security-feature {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.security-feature:last-child {
    margin-bottom: 0;
}

.security-feature:hover {
    background: white;
    border-color: var(--success);
    box-shadow: 0 2px 8px rgba(52, 168, 83, 0.1);
}

.security-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--success) 0%, #2d9148 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.2);
}

.security-feature-content {
    flex: 1;
}

.security-feature-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--navy-primary);
    margin-bottom: 4px;
}

.security-feature-desc {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.security-feature-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.security-feature-badge.active {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
    border: 2px solid rgba(52, 168, 83, 0.3);
}

/* Server Info Items */
.server-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f1f3f5;
}

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

.server-info-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.server-info-label i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--navy-accent);
    font-size: 16px;
}

.server-info-value {
    font-size: 14px;
    color: var(--navy-primary);
    font-weight: 700;
}

.version-badge,
.upload-badge {
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 31, 63, 0.2);
}

.upload-badge {
    background: linear-gradient(135deg, var(--success) 0%, #2d9148 100%);
}

.time-value {
    font-family: 'Courier New', monospace;
    background: rgba(0, 116, 217, 0.05);
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--navy-accent);
    font-size: 13px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-input {
    display: none;
}

.toggle-label {
    display: block;
    width: 60px;
    height: 32px;
    background: #ccc;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s;
}

.toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-label {
    background: var(--success);
}

.toggle-input:checked + .toggle-label .toggle-slider {
    transform: translateX(28px);
}

.toggle-label:hover {
    opacity: 0.9;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 24px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #dee2e6;
    transition: all 0.3s;
}

.info-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--navy-accent);
}

.info-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.info-value {
    font-size: 18px;
    color: var(--navy-primary);
    font-weight: 700;
}

/* Dashboard Grid 4 */
.dashboard-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Security Cards */
.security-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.security-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    gap: 16px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.security-card:hover {
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.15);
    transform: translateY(-2px);
}

.security-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.security-card-content {
    flex: 1;
}

.security-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy-primary);
    margin-bottom: 6px;
}

.security-card-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.4;
}

.security-card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(52, 168, 83, 0.2);
}

/* Info Table */
.info-table {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.info-table-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f5;
    transition: all 0.3s;
}

.info-table-row:last-child {
    border-bottom: none;
}

.info-table-row:hover {
    background: #f8f9fa;
}

.info-table-label {
    font-size: 14px;
    color: #666;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-table-label i {
    color: var(--navy-accent);
    width: 20px;
    text-align: center;
}

.info-table-value {
    font-size: 14px;
    color: var(--navy-primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
    background: rgba(0, 31, 63, 0.05);
    padding: 6px 12px;
    border-radius: 4px;
}

/* Mobile Responsive */
@media (max-width: 968px) {
    .settings-grid-2x2 {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .settings-card-header {
        padding: 20px;
    }

    .settings-card-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .settings-card-title {
        font-size: 18px;
    }

    .settings-card-body {
        padding: 20px;
    }

    .control-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .control-toggle-wrapper {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .toggle-status {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .setting-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-switch {
        align-self: flex-start;
    }

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

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

    .security-info-grid {
        grid-template-columns: 1fr;
    }

    .info-table-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .info-table-value {
        width: 100%;
        text-align: left;
    }

    .server-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .server-info-value {
        width: 100%;
    }
}

/* ===== Sidebar Submenu Styles ===== */
.sidebar-menu .has-submenu {
    position: relative;
}

.submenu-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.submenu-arrow {
    font-size: 12px;
    margin-left: auto;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.submenu-toggle.open .submenu-arrow {
    transform: rotate(180deg);
    color: white;
}

.sidebar-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    margin-top: 4px;
}

.sidebar-submenu.open {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 8px;
}

.sidebar-submenu li {
    margin-bottom: 0;
}

.sidebar-submenu a {
    width: 100%;
    text-align: left;
    padding: 12px 16px 12px 48px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 400;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-submenu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-left-color: var(--navy-accent);
    padding-left: 52px;
}

.sidebar-submenu a.active {
    background: rgba(0, 116, 217, 0.25);
    color: white;
    border-left-color: var(--navy-accent);
    font-weight: 500;
}

.sidebar-submenu a i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.submenu-toggle.active {
    background: var(--navy-accent);
    color: white;
}

@media (max-width: 768px) {
    .sidebar-submenu a {
        padding: 12px 16px 12px 40px;
        font-size: 13px;
    }

    .sidebar-submenu a:hover {
        padding-left: 44px;
    }
}

/* ===== Setup Page Styles ===== */
.setup-wrapper {
    min-height: 100vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-light) 100%);
}

.setup-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.setup-container h2 {
    color: var(--navy-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setup-container .subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.setup-container hr {
    border: none;
    border-top: 2px solid var(--navy-primary);
    margin-bottom: 30px;
}

.log-item {
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-success {
    background: #d4edda;
    border-left-color: var(--success);
    color: #155724;
}

.log-error {
    background: #f8d7da;
    border-left-color: var(--danger);
    color: #721c24;
}

.log-info {
    background: #d1ecf1;
    border-left-color: var(--navy-accent);
    color: #0c5460;
}

.credentials-box {
    background: #fff3cd;
    padding: 20px;
    border-radius: 4px;
    margin: 20px 0;
    border-left: 4px solid #ffc107;
}

.credentials-box strong {
    color: var(--navy-primary);
}

/* ===== Theme Toggle ===== */
.sidebar .sidebar-theme {
    padding: 16px 20px;
    background: rgba(0,0,0,0.15);
}

.sidebar .sidebar-theme button {
    width: 100% !important;
    padding: 14px 16px !important;
    background: linear-gradient(135deg, rgba(251,188,4,0.2) 0%, rgba(251,188,4,0.3) 100%) !important;
    border: 1px solid rgba(251,188,4,0.4) !important;
    color: white !important;
    cursor: pointer !important;
    border-radius: 3px !important;
    font-size: 15px !important;
    transition: all 0.3s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    font-weight: 600 !important;
    font-family: inherit;
    text-align: center;
    box-sizing: border-box;
}

.sidebar .sidebar-theme button:hover {
    background: linear-gradient(135deg, rgba(251,188,4,0.4) 0%, rgba(251,188,4,0.5) 100%) !important;
    transform: translateY(-2px);
}

.sidebar .sidebar-theme button i {
    font-size: 16px;
    width: auto;
}

.sidebar .sidebar-theme button span {
    font-size: 15px;
}

/* Dark mode specific overrides */
body.dark-mode .login-container {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

body.dark-mode .login-box {
    background: var(--bg-card);
    box-shadow: 0 4px 20px var(--shadow-hover);
}

body.dark-mode .login-box h2 {
    color: var(--text-primary);
}

/* Login Page Theme Toggle */
.login-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s ease;
    z-index: 1000;
}

.login-theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow-hover);
}

body.dark-mode .login-theme-toggle {
    background: var(--bg-card);
    border-color: var(--navy-accent);
    color: #ffd700;
}

body.dark-mode .setup-wrapper {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

body.dark-mode .setup-container {
    background: var(--bg-card);
    box-shadow: 0 4px 20px var(--shadow-hover);
}

body.dark-mode .setup-container h2 {
    color: var(--text-primary);
}

body.dark-mode .setup-container .subtitle {
    color: var(--text-muted);
}

body.dark-mode .setup-container hr {
    border-top-color: var(--border-color);
}

body.dark-mode .log-item {
    border-left-width: 4px;
}

body.dark-mode .log-success {
    background: rgba(52, 168, 83, 0.15);
    color: #6fcf97;
}

body.dark-mode .log-error {
    background: rgba(234, 67, 53, 0.15);
    color: #f5857a;
}

body.dark-mode .log-info {
    background: rgba(0, 116, 217, 0.15);
    color: #5dade2;
}

body.dark-mode .credentials-box {
    background: rgba(251, 188, 4, 0.1);
    border-color: rgba(251, 188, 4, 0.4);
    color: var(--text-secondary);
}

body.dark-mode .credentials-box strong {
    color: var(--text-primary);
}

/* Settings Page Dark Mode */
body.dark-mode .settings-mega-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.dark-mode .settings-card-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom-color: var(--border-color);
}

body.dark-mode .settings-card-title {
    color: var(--text-primary);
}

body.dark-mode .settings-card-subtitle {
    color: var(--text-muted);
}

body.dark-mode .stat-item-inline {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .stat-item-label {
    color: var(--text-muted);
}

body.dark-mode .stat-item-value {
    color: var(--text-primary);
}

body.dark-mode .control-group {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border-color: var(--border-color);
}

body.dark-mode .control-title {
    color: var(--text-primary);
}

body.dark-mode .control-desc {
    color: var(--text-muted);
}

body.dark-mode .control-toggle-wrapper {
    background: var(--bg-card);
    border-color: var(--border-color);
}

body.dark-mode .info-banner {
    background: rgba(0, 116, 217, 0.1);
    border-color: rgba(0, 116, 217, 0.3);
    color: var(--text-secondary);
}

body.dark-mode .security-feature {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .security-feature-name {
    color: var(--text-primary);
}

body.dark-mode .security-feature-desc {
    color: var(--text-muted);
}

body.dark-mode .server-info-item {
    border-bottom-color: var(--border-light);
}

body.dark-mode .server-info-label {
    color: var(--text-muted);
}

body.dark-mode .server-info-value {
    color: var(--text-primary);
}

body.dark-mode .time-value {
    background: rgba(0, 116, 217, 0.1);
    color: var(--navy-accent);
}

/* Dashboard Page Dark Mode */
body.dark-mode .data-section p {
    color: var(--text-secondary);
}

body.dark-mode .data-section strong {
    color: var(--text-primary);
}

/* Logs Page Dark Mode - Empty Details */
body.dark-mode em.text-muted,
body.dark-mode .text-muted em {
    color: var(--text-muted) !important;
}

/* Version/Upload Badges in Dark Mode */
body.dark-mode .version-badge,
body.dark-mode .upload-badge {
    color: white !important;
}

/* Ensure form inputs text is visible in dark mode */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: var(--text-muted);
}

/* Filter labels in dark mode */
body.dark-mode .filter-group label {
    color: var(--text-secondary);
}

/* Settings page stat items dark mode */
body.dark-mode .stat-item-inline:hover {
    background: var(--bg-card);
    border-color: var(--navy-accent);
}

body.dark-mode .security-feature:hover {
    background: var(--bg-card);
    border-color: var(--success);
}

/* Ensure all header welcome text is visible */
body.dark-mode .header > div {
    color: var(--text-secondary) !important;
}

/* ===== UI Customization / Theme Section ===== */
.theme-preview {
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

body.dark-mode .theme-preview {
    background: var(--bg-card);
    border-color: var(--border-color) !important;
}

.theme-preview h4 {
    color: var(--text-primary);
}

/* Color picker styling */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Preset buttons */
.preset-btn {
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.preset-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Theme mode options */
.theme-mode-option {
    transition: all 0.3s ease;
}

.theme-mode-option:hover {
    border-color: var(--navy-accent) !important;
    background: var(--bg-secondary);
}

.theme-mode-option:has(input:checked) {
    border-color: var(--navy-accent) !important;
    background: rgba(0, 116, 217, 0.1);
}

body.dark-mode .theme-mode-option {
    border-color: var(--border-color) !important;
}

body.dark-mode .theme-mode-option:hover {
    border-color: var(--navy-accent) !important;
    background: var(--bg-secondary);
}

body.dark-mode .theme-mode-option:has(input:checked) {
    border-color: var(--navy-accent) !important;
    background: rgba(0, 116, 217, 0.2);
}

/* Responsive theme form */
@media (max-width: 768px) {
    #themeForm .form-grid {
        grid-template-columns: 1fr !important;
    }

    .preset-btn {
        width: 35px !important;
        height: 35px !important;
    }

    .theme-mode-option {
        flex: 1;
        justify-content: center;
    }
}

/* SweetAlert2 Dark Mode */
body.dark-mode .swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .swal2-title {
    color: var(--text-primary) !important;
}

body.dark-mode .swal2-html-container {
    color: var(--text-secondary) !important;
}

body.dark-mode .swal2-input,
body.dark-mode .swal2-textarea {
    background: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
}

/* ===== Text Utility Classes ===== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--text-primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* ===== COMPREHENSIVE MOBILE RESPONSIVE STYLES ===== */

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Prevent horizontal overflow */
body {
    overflow-x: hidden;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--navy-accent);
    border-radius: 3px;
}

/* Safe area padding for iOS devices with notch */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(env(safe-area-inset-bottom), 8px);
        height: calc(65px + env(safe-area-inset-bottom, 0px));
    }

    .main-content {
        padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    }
}

/* ===== Mobile Responsive (max-width: 768px) ===== */
@media (max-width: 768px) {
    /* Main content adjustments */
    .main-content {
        padding: 15px;
        padding-bottom: 90px;
    }

    /* Header mobile optimization */
    .header {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .header h1 {
        font-size: 18px;
        width: 100%;
    }

    .header > div {
        font-size: 13px;
        width: 100%;
        text-align: right;
    }

    /* Data section mobile */
    .data-section {
        padding: 15px;
        border-radius: 6px;
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .section-header h2 {
        font-size: 18px;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }

    /* Stat cards mobile */
    .stat-card {
        padding: 18px;
        min-height: 80px;
    }

    .stat-card-icon {
        font-size: 36px;
    }

    .stat-card-value {
        font-size: 24px;
    }

    .stat-card-label {
        font-size: 11px;
    }

    /* Charts mobile */
    .chart-card {
        padding: 15px;
    }

    .chart-container {
        height: 250px;
    }

    /* Buttons mobile - larger touch targets */
    .btn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px;
    }

    .btn-sm {
        padding: 12px 16px;
        min-height: 44px;
    }

    /* Form inputs mobile - larger touch targets */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 16px;
        font-size: 16px !important;
        min-height: 52px;
        border-radius: 6px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Filter inputs mobile */
    .filter-input {
        padding: 14px 12px;
        font-size: 16px !important;
        min-height: 50px;
    }

    /* Modal mobile full screen */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }

    .modal-header {
        padding: 20px;
        border-radius: 16px 16px 0 0;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .modal-body {
        padding: 20px;
        max-height: calc(95vh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Account info cards mobile */
    .account-info-card {
        padding: 20px;
        margin-bottom: 20px;
    }

    .account-info-card h3 {
        font-size: 18px;
    }

    .info-row {
        flex-direction: column;
        gap: 8px;
        padding: 12px 0;
    }

    .info-label {
        width: 100%;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .info-value {
        font-size: 15px;
        font-weight: 500;
    }

    /* DataTables mobile */
    .dataTables_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.dataTable {
        min-width: 600px;
    }

    table.dataTable thead th {
        padding: 12px 10px !important;
        font-size: 12px !important;
        white-space: nowrap;
    }

    table.dataTable tbody td {
        padding: 14px 10px !important;
        font-size: 13px !important;
    }

    /* Action icons mobile - larger touch targets */
    .action-icon {
        padding: 10px 12px;
        font-size: 18px;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* DataTables buttons mobile */
    .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }

    .dt-button {
        flex: 1;
        min-width: calc(33.33% - 6px);
        padding: 12px 10px !important;
        font-size: 12px !important;
        text-align: center;
        margin-right: 0 !important;
    }

    /* DataTables search and length mobile */
    .dataTables_length,
    .dataTables_filter {
        width: 100%;
        margin-bottom: 15px;
        text-align: left !important;
    }

    .dataTables_length select,
    .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 8px;
        padding: 12px !important;
        font-size: 16px !important;
    }

    .dataTables_info {
        font-size: 12px;
        padding: 10px 0;
    }

    .dataTables_paginate {
        padding-top: 15px;
    }

    .dataTables_paginate .paginate_button {
        padding: 10px 14px !important;
        min-width: 44px;
        min-height: 44px;
    }

    /* Login page mobile */
    .login-container {
        padding: 15px;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .login-box {
        padding: 30px 20px;
        border-radius: 12px;
        width: 100%;
        max-width: 100%;
    }

    .login-logo {
        width: 90px;
        height: 90px;
        margin-bottom: 20px;
    }

    .login-box h2 {
        font-size: 22px;
        margin-bottom: 25px;
    }

    .login-box .form-group input {
        padding: 16px;
    }

    .login-box .btn {
        padding: 16px;
        font-size: 16px;
    }

    /* Settings page mobile */
    .settings-grid-2x2 {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .settings-mega-card {
        border-radius: 8px;
    }

    .settings-card-header {
        padding: 16px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .settings-card-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .settings-card-title {
        font-size: 16px;
    }

    .settings-card-body {
        padding: 16px;
    }

    .control-group {
        padding: 15px;
        margin-bottom: 12px;
    }

    .control-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .control-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .control-title {
        font-size: 15px;
    }

    .control-toggle-wrapper {
        flex-direction: column;
        gap: 12px;
        padding: 14px;
    }

    /* Security features mobile */
    .security-feature {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 14px;
    }

    .security-feature-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* Server info mobile */
    .server-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 0;
    }

    /* Stat items inline mobile */
    .stat-item-inline {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 14px;
    }

    .stat-item-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    /* Status badges mobile */
    .status-badge {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Filters mobile */
    .filters-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .filters-header {
        padding-bottom: 12px;
        margin-bottom: 15px;
    }

    .filters-header h3 {
        font-size: 16px;
    }

    .filters-grid {
        gap: 12px;
    }

    .filter-group label {
        font-size: 12px;
    }

    /* Profile image section mobile */
    .profile-image-container {
        max-width: 100%;
    }

    /* Theme customization mobile */
    #themeForm .form-grid {
        grid-template-columns: 1fr !important;
    }

    .preset-btn {
        width: 40px !important;
        height: 40px !important;
    }

    .theme-mode-option {
        padding: 12px !important;
    }

    .theme-preview {
        padding: 15px !important;
    }
}

/* ===== Extra Small Devices (max-width: 480px) ===== */
@media (max-width: 480px) {
    .main-content {
        padding: 10px;
        padding-bottom: 85px;
    }

    .header {
        padding: 12px;
    }

    .header h1 {
        font-size: 16px;
    }

    .data-section {
        padding: 12px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    .stat-card {
        padding: 14px;
        min-height: 70px;
    }

    .stat-card-icon {
        font-size: 30px;
    }

    .stat-card-value {
        font-size: 22px;
    }

    .stat-card-label {
        font-size: 10px;
    }

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

    .dashboard-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container,
    .chart-container-fixed {
        height: 200px;
        max-height: 200px;
    }

    .modal-body {
        padding: 15px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px;
    }

    table.dataTable thead th {
        padding: 10px 8px !important;
        font-size: 11px !important;
    }

    table.dataTable tbody td {
        padding: 12px 8px !important;
        font-size: 12px !important;
    }

    .dt-button {
        min-width: calc(50% - 4px);
        padding: 10px 8px !important;
        font-size: 11px !important;
    }

    .login-box {
        padding: 25px 15px;
    }

    .login-logo {
        width: 80px;
        height: 80px;
    }

    .login-box h2 {
        font-size: 20px;
    }

    .account-info-card {
        padding: 15px;
    }

    .info-label {
        font-size: 11px;
    }

    .info-value {
        font-size: 14px;
    }

    /* Mobile bottom nav extra small */
    .mobile-nav-item {
        padding: 6px 8px;
        min-width: 50px;
    }

    .mobile-nav-item i {
        font-size: 18px;
    }

    .mobile-nav-item span {
        font-size: 9px;
    }
}

/* ===== Landscape Mobile Orientation ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-bottom-nav {
        height: 55px;
    }

    .mobile-nav-item {
        padding: 5px 10px;
    }

    .mobile-nav-item i {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .mobile-nav-item span {
        font-size: 9px;
    }

    .main-content {
        padding-bottom: 70px;
    }

    .modal {
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-body {
        max-height: calc(100vh - 70px);
    }
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for touch devices */
    .btn {
        min-height: 48px;
    }

    .action-icon {
        min-width: 48px;
        min-height: 48px;
    }

    .sidebar-menu a,
    .sidebar-menu button {
        min-height: 50px;
    }

    .mobile-nav-item {
        min-height: 56px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }

    .stat-card:hover {
        transform: none;
    }

    .action-icon:hover {
        transform: none;
    }

    /* Add active states for touch feedback */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .action-icon:active {
        transform: scale(0.95);
        opacity: 0.8;
    }

    .mobile-nav-item:active {
        transform: scale(0.95);
        opacity: 0.9;
    }

    .sidebar-menu a:active,
    .sidebar-menu button:active {
        transform: scale(0.98);
    }
}

/* ===== iOS Specific Fixes ===== */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS 100vh issue */
    .login-container {
        min-height: -webkit-fill-available;
    }

    .app-container {
        min-height: -webkit-fill-available;
    }

    /* Fix for iOS input zoom */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Fix for iOS momentum scrolling */
    .modal-body,
    .main-content,
    .sidebar {
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Pull to Refresh Prevention ===== */
body {
    overscroll-behavior-y: contain;
}

/* ===== Tablet Responsive (768px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .dashboard-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-grid-2x2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal {
        width: 85%;
        max-width: 700px;
    }
}

/* ===== Print Styles ===== */
@media print {
    .sidebar,
    .mobile-bottom-nav,
    .sidebar-overlay,
    .btn,
    .action-icon,
    .dt-buttons {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 20px;
    }

    .app-container {
        display: block;
    }
}

/* ===== Dark Mode Global Text Colors ===== */
body.dark-mode {
    color: var(--text-primary);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: var(--text-primary) !important;
}

body.dark-mode p,
body.dark-mode span:not(.status-badge):not(.role-badge):not(.version-badge):not(.upload-badge),
body.dark-mode div:not(.sidebar):not(.modal-header):not(.stat-card-icon):not(.settings-card-icon),
body.dark-mode label {
    color: var(--text-secondary);
}

body.dark-mode .text-muted,
body.dark-mode .info-text,
body.dark-mode .help-text,
body.dark-mode em.text-muted {
    color: var(--text-muted) !important;
}

/* Account Page Dark Mode */
body.dark-mode .account-info-card {
    background: var(--bg-card);
    border-left-color: var(--navy-accent);
}

body.dark-mode .account-info-card h3 {
    color: var(--text-primary);
}

body.dark-mode .info-row {
    border-bottom-color: var(--border-light);
}

body.dark-mode .info-label {
    color: var(--text-secondary);
}

body.dark-mode .info-value {
    color: var(--text-primary);
}

/* Profile Image Section Dark Mode */
body.dark-mode .profile-image-container {
    background: var(--bg-secondary);
    border-color: var(--navy-accent);
}

body.dark-mode .profile-image-label {
    color: var(--text-muted) !important;
}

body.dark-mode #defaultProfileIcon {
    color: var(--navy-accent) !important;
}

/* Form Labels and Text Dark Mode */
body.dark-mode .form-group label {
    color: var(--text-secondary);
}

body.dark-mode .form-group label i {
    color: var(--navy-accent);
}

/* Section Headers Dark Mode */
body.dark-mode .section-header h2 {
    color: var(--text-primary);
}

body.dark-mode .data-section {
    background: var(--bg-card);
}

/* Info/Help Text Dark Mode */
body.dark-mode [style*="color: #666"],
body.dark-mode [style*="color:#666"] {
    color: var(--text-muted) !important;
}

/* Warning/Disabled Messages Dark Mode */
body.dark-mode #uploadDisabledMessage {
    background: rgba(251, 188, 4, 0.1) !important;
    border-color: rgba(251, 188, 4, 0.4) !important;
    color: #ffd54f !important;
}

/* File Input Dark Mode */
body.dark-mode input[type="file"] {
    background: var(--bg-secondary) !important;
    border-color: var(--navy-accent) !important;
    color: var(--text-primary) !important;
}

/* Header Welcome Text Dark Mode */
body.dark-mode .header {
    background: var(--bg-card);
    color: var(--text-primary);
}

body.dark-mode .header div {
    color: var(--text-secondary);
}

/* ===== Profile Image Section ===== */
.profile-section-grid {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.profile-image-display {
    text-align: center;
    flex-shrink: 0;
}

.profile-image-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--navy-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 0 auto 15px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-image-container #defaultProfileIcon {
    font-size: 50px;
    color: var(--navy-accent);
}

.profile-image-label {
    font-size: 13px;
    color: var(--text-muted);
}

.profile-upload-form {
    flex: 1;
    min-width: 280px;
}

.file-input-styled {
    width: 100%;
    padding: 14px;
    border: 2px dashed var(--navy-accent);
    border-radius: 6px;
    background: var(--bg-secondary);
    font-size: 16px !important;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-styled:hover {
    border-color: var(--navy-primary);
    background: var(--bg-primary);
}

.help-text {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.warning-message {
    padding: 15px;
    background: rgba(251, 188, 4, 0.15);
    border: 1px solid rgba(251, 188, 4, 0.5);
    border-radius: 6px;
    color: var(--warning);
    margin-top: 15px;
    font-size: 14px;
}

@media (max-width: 768px) {
    .profile-section-grid {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .profile-image-display {
        width: 100%;
    }

    .profile-image-container {
        width: 100px;
        height: 100px;
    }

    .profile-image-container #defaultProfileIcon {
        font-size: 40px;
    }

    .profile-upload-form {
        width: 100%;
        min-width: unset;
    }

    .file-input-styled {
        padding: 16px;
    }
}

/* ===== Theme Customization Section Mobile ===== */
@media (max-width: 768px) {
    .theme-preview {
        padding: 15px !important;
    }

    .theme-preview > div {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    #previewPrimary,
    #previewSecondary,
    #previewAccent {
        width: 100% !important;
        height: 40px !important;
    }

    #previewButton {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 10px !important;
    }

    .theme-mode-option {
        flex: 1;
        justify-content: center;
        padding: 14px 16px !important;
    }

    .preset-btn {
        width: 45px !important;
        height: 45px !important;
    }
}

/* ===== Documents Management ===== */
.docs-upload-section {
    background: var(--bg-primary);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
}

.docs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.doc-item:hover {
    border-color: var(--navy-accent);
    box-shadow: 0 2px 8px rgba(0, 116, 217, 0.1);
}

.doc-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e8f4fd;
    color: var(--navy-accent);
    font-size: 18px;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: 4px;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.doc-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.doc-type-badge {
    background: var(--navy-primary);
    color: #fff !important;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.doc-desc {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
    font-style: italic;
}

.doc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.doc-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.doc-badge-original {
    background: #d4edda;
    color: #155724;
}

.doc-badge-confidential {
    background: #f8d7da;
    color: #721c24;
}

.doc-badge-expiry {
    background: #fff3cd;
    color: #856404;
}

.doc-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .doc-item {
        flex-direction: column;
        gap: 8px;
    }

    .doc-actions {
        align-self: flex-end;
    }

    .doc-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 15px;
    }
}

/* ===== Notification Bell (Header) ===== */
.header-notif-wrap {
    position: relative;
    display: inline-flex;
}

.header-notif-btn {
    background: none;
    border: 1px solid #d0d5dd;
    color: var(--navy-primary);
    font-size: 18px;
    cursor: pointer;
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-notif-btn:hover {
    background: var(--navy-primary);
    color: #fff;
    border-color: var(--navy-primary);
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ea4335;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: notifPulse 2s infinite;
}

@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.notif-panel {
    position: absolute;
    top: 48px;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    z-index: 1000;
    max-height: 420px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    width: 360px;
}

.notif-panel.open {
    display: flex;
}

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--navy-primary);
    border-bottom: 1px solid #e8e8e8;
}

.notif-dismiss-all {
    background: none;
    border: none;
    color: var(--navy-accent);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.notif-dismiss-all:hover {
    color: var(--navy-primary);
}

.notif-panel-body {
    overflow-y: auto;
    max-height: 340px;
    padding: 4px 0;
}

.notif-empty {
    padding: 30px 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.notif-empty i {
    color: #28a745;
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    cursor: default;
}

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

.notif-item:hover {
    background: #f8f9fa;
}

.notif-urgent {
    background: #fff5f5;
}

.notif-urgent:hover {
    background: #ffeded;
}

.notif-item-icon {
    font-size: 16px;
    min-width: 22px;
    text-align: center;
    margin-top: 2px;
}

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-item-sub {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-time {
    font-size: 10px;
    color: #aaa;
    margin-top: 2px;
}

.notif-item-dismiss {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 12px;
    padding: 2px;
    flex-shrink: 0;
}

.notif-item-dismiss:hover {
    color: #ea4335;
}

/* dark mode */
.dark-mode .header-notif-btn {
    color: #ccc;
    border-color: #444;
}

.dark-mode .header-notif-btn:hover {
    background: var(--navy-accent);
    color: #fff;
    border-color: var(--navy-accent);
}

.dark-mode .notif-panel {
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.dark-mode .notif-panel-header {
    border-color: #333;
}

.dark-mode .notif-item {
    border-color: #2a2a2a;
}

.dark-mode .notif-item:hover {
    background: #1a1a2e;
}

.dark-mode .notif-urgent {
    background: #2a1515;
}

@media (max-width: 480px) {
    .notif-panel {
        width: 300px;
        right: -40px;
    }
}

/* ===== Calendar Page ===== */
.calendar-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.calendar-stat-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 6px var(--shadow-color);
    border-left: 4px solid var(--navy-accent);
    transition: transform 0.2s, box-shadow 0.2s;
}

.calendar-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.calendar-stat-card:nth-child(1) { border-left-color: #dc3545; }
.calendar-stat-card:nth-child(2) { border-left-color: #0074D9; }
.calendar-stat-card:nth-child(3) { border-left-color: #fd7e14; }
.calendar-stat-card:nth-child(4) { border-left-color: #28a745; }

.calendar-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.calendar-stat-icon-hearings { background: linear-gradient(135deg, #dc3545, #c0392b); }
.calendar-stat-icon-appointments { background: linear-gradient(135deg, #0074D9, #005fa3); }
.calendar-stat-icon-week { background: linear-gradient(135deg, #fd7e14, #e06600); }
.calendar-stat-icon-month { background: linear-gradient(135deg, #28a745, #1e7e34); }

.calendar-stat-info {
    flex: 1;
    min-width: 0;
}

.calendar-stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

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

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px var(--shadow-color);
}

.legend-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    width: 100%;
    margin-bottom: -6px;
}

.legend-section-title:not(:first-child) {
    margin-top: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-dot-hearing-scheduled { background: #dc3545; }
.legend-dot-completed { background: #28a745; }
.legend-dot-adjourned { background: #ffc107; }
.legend-dot-cancelled { background: #6c757d; }
.legend-dot-appt-scheduled { background: #0074D9; }
.legend-dot-confirmed { background: #17a2b8; }
.legend-dot-no-show { background: #fd7e14; }

.calendar-wrapper {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

/* FullCalendar theme overrides */
.fc { font-family: inherit; }
.fc .fc-toolbar-title { color: var(--text-primary); font-size: 1.3em; }
.fc .fc-button-primary { background: var(--navy-primary); border-color: var(--navy-primary); }
.fc .fc-button-primary:hover { background: var(--navy-accent); border-color: var(--navy-accent); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--navy-accent); border-color: var(--navy-accent); }
.fc .fc-button-primary:disabled { background: var(--navy-primary); border-color: var(--navy-primary); opacity: 0.65; }
.fc .fc-daygrid-day-number { color: var(--text-primary); }
.fc .fc-event { border-radius: 4px; padding: 2px 4px; font-size: 11px; cursor: pointer; }
.fc .fc-day-today { background: rgba(0, 116, 217, 0.05) !important; }
.fc .fc-col-header-cell-cushion { color: var(--text-primary); }
.fc .fc-list-event:hover td { background: rgba(0, 116, 217, 0.08); }
.fc .fc-list-day-cushion { background: var(--bg-secondary); }
.fc th { border-color: var(--border-color); }
.fc td { border-color: var(--border-color); }
.fc .fc-scrollgrid { border-color: var(--border-color); }

/* Calendar skeleton */
.calendar-skeleton {
    padding: 20px;
}

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

.calendar-skeleton .skeleton-bar {
    height: 16px;
    border-radius: 4px;
}

.calendar-skeleton .skeleton-bar.w-200 { width: 200px; height: 24px; }
.calendar-skeleton .skeleton-bar.w-120 { width: 120px; height: 24px; }

.calendar-skeleton .skeleton-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-skeleton .skeleton-cell {
    height: 80px;
    border-radius: 4px;
}

/* Calendar event detail modal */
.cal-event-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.cal-event-badge-hearing {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.cal-event-badge-appointment {
    background: rgba(0, 116, 217, 0.1);
    color: #0074D9;
}

.cal-detail-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.cal-detail-row:last-child {
    border-bottom: none;
}

.cal-detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 130px;
    font-size: 13px;
}

.cal-detail-value {
    color: var(--text-primary);
    font-size: 13px;
    flex: 1;
    word-break: break-word;
}

/* Calendar status badges */
.cal-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.cal-status-scheduled { background: rgba(220, 53, 69, 0.12); color: #dc3545; }
.cal-status-completed { background: rgba(40, 167, 69, 0.12); color: #28a745; }
.cal-status-adjourned { background: rgba(255, 193, 7, 0.12); color: #b8860b; }
.cal-status-cancelled { background: rgba(108, 117, 125, 0.12); color: #6c757d; }
.cal-status-confirmed { background: rgba(23, 162, 184, 0.12); color: #17a2b8; }
.cal-status-no_show { background: rgba(253, 126, 20, 0.12); color: #fd7e14; }

/* Dark mode calendar */
.dark-mode .fc .fc-toolbar-title { color: #e0e0e0; }
.dark-mode .fc .fc-daygrid-day-number { color: #ccc; }
.dark-mode .fc .fc-col-header-cell-cushion { color: #ccc; }
.dark-mode .fc .fc-day-today { background: rgba(0, 116, 217, 0.12) !important; }
.dark-mode .fc th,
.dark-mode .fc td,
.dark-mode .fc .fc-scrollgrid { border-color: var(--border-color); }
.dark-mode .fc .fc-list-day-cushion { background: var(--bg-secondary); }
.dark-mode .fc .fc-list-event:hover td { background: rgba(0, 116, 217, 0.15); }

@media (max-width: 992px) {
    .calendar-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .calendar-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .calendar-stat-card {
        padding: 14px;
        gap: 10px;
    }

    .calendar-stat-icon {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .calendar-stat-value {
        font-size: 20px;
    }

    .calendar-legend {
        gap: 10px;
        padding: 10px 12px;
    }

    .legend-item {
        font-size: 11px;
    }

    .legend-dot {
        width: 10px;
        height: 10px;
    }

    .calendar-wrapper {
        padding: 10px;
        border-radius: 6px;
    }

    .fc .fc-toolbar {
        flex-direction: column;
        gap: 8px;
    }

    .fc .fc-toolbar-title {
        font-size: 1.1em;
    }

    .fc .fc-button {
        padding: 4px 8px;
        font-size: 12px;
    }

    .cal-detail-row {
        flex-direction: column;
        gap: 4px;
    }

    .cal-detail-label {
        min-width: auto;
    }
}

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

    .calendar-stat-card {
        padding: 12px;
        gap: 8px;
    }

    .calendar-stat-value {
        font-size: 18px;
    }

    .calendar-stat-label {
        font-size: 10px;
    }
}

/* ===== Case Notes Cards ===== */
.notes-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.notes-search-bar .filter-input {
    flex: 1;
}

.notes-search-bar select.filter-input {
    flex: 0 0 160px;
}

.notes-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.note-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--navy-accent);
    border-radius: 0 8px 8px 0;
    padding: 14px 16px;
    transition: box-shadow 0.2s, transform 0.15s;
}

.note-card:hover {
    box-shadow: 0 3px 12px var(--shadow-color);
    transform: translateY(-1px);
}

.note-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.note-card-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #fff;
}

.note-card-title-row {
    flex: 1;
    min-width: 0;
}

.note-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.note-card-title i {
    font-size: 12px;
}

.note-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    align-items: center;
}

.note-card-meta i {
    margin-right: 3px;
    font-size: 10px;
}

.note-card-cat {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: capitalize;
}

.note-card-actions {
    flex-shrink: 0;
}

.note-card-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-light);
    max-height: 120px;
    overflow-y: auto;
}

.note-card-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.note-card-empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.4;
}

.note-card-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .notes-search-bar {
        flex-direction: column;
    }

    .notes-search-bar select.filter-input {
        flex: 1;
    }

    .note-card {
        padding: 12px;
    }

    .note-card-content {
        max-height: 80px;
    }
}

/* ===== AI Chat Styles ===== */

/* chat layout */
.chat-container {
    display: flex;
    height: 100%;
    min-height: 0;
    background: var(--bg-primary);
    overflow: hidden;
    flex: 1;
}

.main-content.chat-page {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* new chat btn */
.conv-new-wrap {
    padding: 10px 12px;
    flex-shrink: 0;
}

.conv-new-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--navy-accent);
    color: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.conv-new-btn:hover {
    background: var(--navy-primary);
    box-shadow: 0 2px 8px rgba(0, 116, 217, 0.3);
}

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

.conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.conv-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    margin-bottom: 2px;
}

.conv-item:hover {
    background: var(--bg-secondary);
}

.conv-item.active {
    background: rgba(0, 116, 217, 0.12);
    border-left: 3px solid var(--navy-accent);
}

.conv-item-body {
    flex: 1;
    min-width: 0;
}

.conv-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.conv-item-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: opacity 0.15s, color 0.15s;
}

.conv-item:hover .conv-item-delete {
    opacity: 1;
}

.conv-item-delete:hover {
    color: #e74c3c;
}

/* chat header */
.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    min-height: 52px;
    flex-shrink: 0;
}

.chat-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* model/provider badges */
.chat-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-gemini {
    background: rgba(66, 133, 244, 0.12);
    color: #4285f4;
}

.badge-openai {
    background: rgba(16, 163, 127, 0.12);
    color: #10a37f;
}

/* messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.chat-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg-assistant {
    align-self: flex-start;
    align-items: flex-start;
    max-width: 85%;
}

/* msg bubbles */
.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.chat-msg-user .msg-bubble {
    background: var(--navy-accent);
    color: #fff;
    border-top-right-radius: 4px;
}

.chat-msg-assistant .msg-bubble {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-top-left-radius: 4px;
    padding: 14px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.msg-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.msg-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
}

/* markdown in messages */
.msg-content h1 {
    font-size: 1.35em;
    font-weight: 700;
    color: var(--navy-accent);
    margin: 18px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--navy-accent);
    line-height: 1.3;
}

.msg-content h2 {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.3;
}

.msg-content h3 {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--navy-accent);
    margin: 14px 0 6px;
    line-height: 1.3;
}

.msg-content h4 {
    font-size: 1em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 12px 0 4px;
    line-height: 1.3;
}

.msg-content p {
    margin: 0 0 10px;
}

.msg-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.msg-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.msg-content ul,
.msg-content ol {
    margin: 8px 0 12px;
    padding-left: 6px;
    list-style: none;
}

.msg-content ul li {
    position: relative;
    padding: 5px 0 5px 22px;
    margin-bottom: 2px;
    line-height: 1.5;
}

.msg-content ul li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 12px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--navy-accent);
}

.msg-content ol {
    counter-reset: msg-ol;
}

.msg-content ol li {
    position: relative;
    padding: 5px 0 5px 28px;
    margin-bottom: 2px;
    line-height: 1.5;
    counter-increment: msg-ol;
}

.msg-content ol li::before {
    content: counter(msg-ol);
    position: absolute;
    left: 0;
    top: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--navy-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-content a {
    color: var(--navy-accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--navy-accent);
    transition: border-color 0.15s;
}

.msg-content a:hover {
    border-bottom-style: solid;
}

/* code blocks */
.msg-content pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    font-size: 13px;
    line-height: 1.5;
    border-left: 3px solid var(--navy-accent);
}

.msg-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.msg-content :not(pre) > code {
    background: rgba(0, 116, 217, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--navy-accent);
    font-weight: 500;
}

.msg-content blockquote {
    border-left: 3px solid var(--navy-accent);
    padding: 8px 14px;
    margin: 10px 0;
    color: var(--text-secondary);
    background: rgba(0, 116, 217, 0.04);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.msg-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

/* user bubble overrides — keep it clean white */
.chat-msg-user .msg-content h1,
.chat-msg-user .msg-content h2,
.chat-msg-user .msg-content h3,
.chat-msg-user .msg-content h4,
.chat-msg-user .msg-content strong {
    color: #fff;
}

.chat-msg-user .msg-content ul li::before {
    background: #fff;
}

.chat-msg-user .msg-content ol li::before {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.msg-table-wrap {
    overflow-x: auto;
    margin: 12px 0;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    -webkit-overflow-scrolling: touch;
}

.msg-content table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    width: 100%;
    min-width: 300px;
}

.msg-content th,
.msg-content td {
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid rgba(0,0,0,0.04);
    padding: 10px 14px;
    text-align: left;
}

.msg-content th:last-child,
.msg-content td:last-child {
    border-right: none;
}

.msg-content th {
    background: linear-gradient(135deg, var(--navy-primary), var(--navy-light, #003366));
    color: #fff;
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 11px 14px;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.msg-content thead tr:first-child th:first-child {
    border-top-left-radius: 9px;
}

.msg-content thead tr:first-child th:last-child {
    border-top-right-radius: 9px;
}

.msg-content tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

.msg-content tbody tr:hover {
    background: rgba(0, 116, 217, 0.07);
    transition: background 0.15s;
}

.msg-content tbody tr:last-child td:first-child {
    border-bottom-left-radius: 9px;
}

.msg-content tbody tr:last-child td:last-child {
    border-bottom-right-radius: 9px;
}

.msg-content tbody tr:last-child td {
    border-bottom: none;
}

.msg-content td {
    font-size: 13px;
    color: var(--text-primary);
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
}

/* chat input area */
.chat-input-area {
    flex-shrink: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
}

.chat-input-wrap {
    display: flex;
    align-items: flex-end;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.chat-input-wrap textarea {
    flex: 1;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    border-radius: 24px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 12px 48px 12px 16px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow-y: auto;
}

.chat-input-wrap textarea:focus {
    border-color: var(--navy-accent);
    box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.15);
}

.chat-input-wrap textarea::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--navy-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background 0.2s, transform 0.15s;
}

.chat-send-btn:hover {
    background: var(--navy-primary);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ai thinking indicator */
.ai-thinking {
    align-self: flex-start;
    padding: 8px 0;
    animation: thinkingFadeIn 0.3s ease;
}

@keyframes thinkingFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-thinking-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ai-thinking-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-accent), #6c5ce7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    animation: thinkingPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes thinkingPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0,116,217,0.3); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(0,116,217,0); }
}

.ai-thinking-text {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.ai-thinking-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

.ai-thinking-dots span {
    font-size: 18px;
    font-weight: 700;
    color: var(--navy-accent);
    animation: thinkingDot 1.4s ease-in-out infinite;
}

.ai-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingDot {
    0%, 60%, 100% { opacity: 0.2; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

.msg-content > *:first-child {
    margin-top: 0;
}

.msg-content > *:last-child {
    margin-bottom: 0;
}

/* msg row — avatar + bubble */
.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-accent), #6c5ce7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 2px 6px rgba(0,116,217,0.2);
}

.chat-msg-assistant .msg-time {
    margin-left: 42px;
}

/* quick prompt buttons */
.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
    margin-top: 8px;
}

.qp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.qp-btn:hover {
    border-color: var(--navy-accent);
    background: rgba(0,116,217,0.06);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,116,217,0.12);
}

.qp-btn i {
    color: var(--navy-accent);
    font-size: 14px;
}

/* msg action buttons (copy, regenerate) */
.msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.05);
    opacity: 0;
    transition: opacity 0.2s;
}

.msg-bubble:hover .msg-actions {
    opacity: 1;
}

.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s;
}

.msg-action-btn:hover {
    color: var(--navy-accent);
    border-color: var(--navy-accent);
    background: rgba(0,116,217,0.05);
}

.msg-action-btn i {
    font-size: 12px;
}

/* suggested follow-ups */
.msg-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-left: 42px;
    animation: suggestFadeIn 0.4s ease;
}

@keyframes suggestFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.suggest-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px dashed var(--navy-accent);
    border-radius: 20px;
    color: var(--navy-accent);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggest-btn:hover {
    background: var(--navy-accent);
    color: #fff;
    border-style: solid;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,116,217,0.2);
}

/* empty state */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    padding: 40px 20px;
    text-align: center;
}

.chat-empty i {
    font-size: 48px;
    opacity: 0.3;
}

.chat-empty p {
    font-size: 15px;
    font-weight: 500;
}

/* chat sidebar header/footer */
.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    min-height: 54px;
}

.chat-sidebar-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}


.chat-sidebar-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
}

/* chat sidebar toggle (mobile) */
.chat-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.chat-sidebar-toggle:hover {
    background: var(--bg-secondary);
}

/* header badges row */
.chat-header-badges {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

/* header actions */
.chat-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.chat-header-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 14px;
    transition: color 0.15s, background 0.15s;
}

.chat-header-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* conv skeleton */
.conv-skel-item {
    padding: 12px;
    margin-bottom: 4px;
}

/* textarea 16px min for mobile */
.chat-input-wrap textarea {
    font-size: 16px;
}

/* mobile chat responsive */
@media (max-width: 768px) {
    .chat-sidebar-toggle {
        display: block;
    }

    .chat-msg {
        max-width: 90%;
    }

    .chat-msg-assistant {
        max-width: 95%;
    }

    .msg-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .chat-msg-assistant .msg-time {
        margin-left: 38px;
    }

    .ai-thinking-bubble {
        padding: 10px 14px;
        gap: 8px;
    }

    .ai-thinking-icon {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .chat-input-wrap {
        max-width: 100%;
    }

    .chat-input-area {
        padding: 10px 12px;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-messages {
        padding: 12px;
    }

    .quick-prompts {
        gap: 6px;
    }

    .qp-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .msg-actions {
        opacity: 1;
    }

    .msg-suggestions {
        margin-left: 38px;
        gap: 6px;
    }

    .suggest-btn {
        font-size: 11.5px;
        padding: 6px 10px;
    }
}

/* AI instruction cards */
.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.instruction-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 0.2s;
}

.instruction-card:hover {
    box-shadow: 0 2px 12px var(--shadow-color);
}

.instruction-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.instruction-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.instruction-card-order {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.instruction-card-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.instruction-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.instruction-card-actions {
    display: flex;
    gap: 6px;
}

.instruction-card-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    transition: color 0.15s, background 0.15s;
}

.instruction-card-actions button:hover {
    color: var(--navy-accent);
    background: var(--bg-secondary);
}

/* AI settings card */
.ai-settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 6px var(--shadow-color);
}

.ai-settings-card .settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.ai-settings-card .settings-row:last-child {
    border-bottom: none;
}

.ai-settings-card .settings-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-settings-card .settings-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.ai-settings-card .settings-control {
    min-width: 180px;
    text-align: right;
}

/* mobile AI pages */
@media (max-width: 768px) {
    .main-content.chat-page {
        padding-bottom: 0;
        height: calc(100dvh - 65px);
    }

    .chat-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        bottom: 65px;
        z-index: 1002;
        width: 280px;
        min-width: 280px;
        transition: left 0.25s ease;
        box-shadow: none;
    }

    .chat-sidebar.open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    }

    .chat-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        bottom: 65px;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1001;
    }

    .chat-sidebar-overlay.open {
        display: block;
    }

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

    .ai-settings-card .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ai-settings-card .settings-control {
        width: 100%;
        text-align: left;
    }
}

/* ===== WhatsApp-Style Chat ===== */

:root {
    --wc-sent-bg: #d9fdd3;
    --wc-recv-bg: var(--bg-card);
    --wc-wallpaper: var(--bg-primary);
    --wc-read: #53bdeb;
}
body.dark-mode {
    --wc-sent-bg: #005c4b;
    --wc-recv-bg: var(--bg-card);
    --wc-wallpaper: var(--bg-primary);
}

/* Layout */
.chat-page-main { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: 100vh; }
.wc-container { display: flex; flex: 1; min-height: 0; overflow: hidden; background: var(--bg-primary); }
.wc-sidebar { width: 350px; min-width: 350px; background: var(--bg-card); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; overflow: hidden; }
.wc-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--wc-wallpaper); }

/* Sidebar Header */
.wc-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border-color); min-height: 56px; }
.wc-user-info { display: flex; align-items: center; gap: 10px; }
.wc-user-info .wc-avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.wc-user-info span { font-weight: 600; font-size: 15px; color: var(--text-primary); }
.wc-sidebar-actions { display: flex; gap: 4px; }
.wc-sidebar-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 16px; transition: color 0.2s, background 0.2s; }
.wc-sidebar-actions button:hover { color: var(--navy-accent); background: var(--bg-secondary); }
.wc-req-btn { position: relative; }
.wc-req-badge { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; line-height: 1; }

/* Search Bar */
.wc-search { padding: 8px 12px; position: relative; }
.wc-search i { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; pointer-events: none; }
.wc-search input { width: 100%; background: var(--bg-secondary); border: none; border-radius: 20px; padding: 8px 12px 8px 36px; font-size: 14px; color: var(--text-primary); outline: none; transition: box-shadow 0.2s; }
.wc-search input::placeholder { color: var(--text-muted); }
.wc-search input:focus { box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.2); }

/* Contact List */
.wc-contact-list { flex: 1; overflow-y: auto; }
.wc-contact-item { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--border-color); }
.wc-contact-item:hover { background: var(--bg-secondary); }
.wc-contact-item.active { background: rgba(0, 116, 217, 0.08); }
.wc-contact-avatar-wrap { position: relative; flex-shrink: 0; }
.wc-avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.wc-avatar-md { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.wc-online-dot { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--success); border: 2px solid var(--bg-card); }
.wc-contact-info { flex: 1; min-width: 0; margin-left: 12px; }
.wc-contact-top { display: flex; justify-content: space-between; align-items: baseline; }
.wc-contact-name { font-weight: 600; font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-contact-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; margin-left: 8px; }
.wc-contact-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.wc-contact-last-msg { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.wc-contact-unread { min-width: 20px; height: 20px; border-radius: 50%; background: var(--navy-accent); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: 8px; padding: 0 5px; }

/* Chat Header */
.wc-chat-header { display: flex; align-items: center; padding: 10px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border-color); min-height: 56px; gap: 12px; flex-shrink: 0; }
.wc-back-btn { display: none; background: none; border: none; color: var(--text-primary); cursor: pointer; font-size: 18px; padding: 4px; }
.wc-chat-header-info { flex: 1; min-width: 0; cursor: pointer; }
.wc-chat-name { font-weight: 600; font-size: 15px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-chat-status { font-size: 12px; color: var(--text-muted); }
.wc-chat-status.online { color: var(--success); }
.wc-chat-actions { display: flex; gap: 4px; }
.wc-chat-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 16px; transition: color 0.2s, background 0.2s; }
.wc-chat-actions button:hover { color: var(--navy-accent); background: var(--bg-secondary); }

/* Messages Area */
.wc-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 2px; min-height: 0; scroll-behavior: smooth; background: var(--wc-wallpaper); background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }

/* Message Bubbles */
.wc-msg { max-width: 65%; padding: 0; margin-bottom: 2px; position: relative; }
.wc-msg-sent { align-self: flex-end; }
.wc-msg-received { align-self: flex-start; }
.wc-msg-bubble { padding: 6px 8px 4px 8px; border-radius: 8px; position: relative; min-width: 120px; box-shadow: 0 1px 1px var(--shadow-color); }
.wc-msg-sent .wc-msg-bubble { background: var(--wc-sent-bg); border-top-right-radius: 0; }
.wc-msg-received .wc-msg-bubble { background: var(--wc-recv-bg); border-top-left-radius: 0; border: 1px solid var(--border-color); }

/* Bubble tails */
.wc-msg-sent .wc-msg-bubble::before { content: ""; position: absolute; top: 0; right: -8px; width: 0; height: 0; border-left: 8px solid var(--wc-sent-bg); border-bottom: 8px solid transparent; }
.wc-msg-received .wc-msg-bubble::before { content: ""; position: absolute; top: 0; left: -8px; width: 0; height: 0; border-right: 8px solid var(--wc-recv-bg); border-bottom: 8px solid transparent; }

/* Message Content */
.wc-msg-content { font-size: 14px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap; color: var(--text-primary); }
.wc-msg-meta { display: flex; justify-content: flex-end; gap: 4px; font-size: 11px; color: var(--text-muted); margin-top: 2px; float: right; margin-left: 12px; line-height: 1; padding-top: 2px; }
.wc-msg-time { color: inherit; }
.wc-msg-status i { font-size: 12px; }
.wc-msg-status .wc-read { color: var(--wc-read); }

/* Reply Preview (inside message) */
.wc-msg-reply-preview { border-left: 3px solid var(--navy-accent); background: rgba(0, 116, 217, 0.06); padding: 4px 8px; margin-bottom: 4px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.wc-msg-reply-name { font-weight: 600; color: var(--navy-accent); font-size: 12px; }
.wc-msg-reply-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }

/* Reply Bar (above input) */
.wc-reply-bar { display: flex; align-items: center; padding: 8px 16px; background: var(--bg-card); border-top: 1px solid var(--border-color); border-left: 3px solid var(--navy-accent); }
.wc-reply-bar .wc-reply-preview { flex: 1; min-width: 0; }
.wc-reply-bar .wc-reply-name { font-weight: 600; font-size: 13px; color: var(--navy-accent); }
.wc-reply-bar .wc-reply-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-reply-bar .wc-reply-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 50%; transition: color 0.2s; }
.wc-reply-bar .wc-reply-close:hover { color: var(--danger); }

/* File Messages */
.wc-msg-image img { max-width: 280px; max-height: 300px; border-radius: 6px; cursor: pointer; display: block; }
.wc-msg-file { display: flex; align-items: center; padding: 8px 10px; background: rgba(0, 0, 0, 0.05); border-radius: 8px; gap: 10px; text-decoration: none; color: inherit; min-width: 240px; }
body.dark-mode .wc-msg-file { background: rgba(255, 255, 255, 0.06); }
.wc-msg-file-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; flex-shrink: 0; }
.wc-msg-file-icon.pdf { background: #ea4335; color: #fff; }
.wc-msg-file-icon.doc { background: #4285f4; color: #fff; }
.wc-msg-file-icon.xls { background: #34a853; color: #fff; }
.wc-msg-file-icon.generic { background: var(--text-muted); color: #fff; }
.wc-msg-file-icon i { font-size: 20px; }
.wc-msg-file-info { flex: 1; min-width: 0; }
.wc-msg-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.wc-msg-file-size { font-size: 11px; color: var(--text-muted); }
.wc-msg-file-dl { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 18px; padding: 4px; transition: color 0.2s; }
.wc-msg-file-dl:hover { color: var(--navy-accent); }

/* Input Area */
.wc-input-area { display: flex; align-items: flex-end; padding: 8px 12px; background: var(--bg-card); border-top: 1px solid var(--border-color); gap: 8px; flex-shrink: 0; }
.wc-attach-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--text-muted); cursor: pointer; border-radius: 50%; font-size: 20px; transition: color 0.2s, background 0.2s; flex-shrink: 0; }
.wc-attach-btn:hover { color: var(--navy-accent); background: var(--bg-secondary); }
.wc-input-area textarea { flex: 1; resize: none; max-height: 120px; min-height: 40px; border-radius: 20px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-primary); padding: 10px 16px; font-size: 16px !important; line-height: 1.4; overflow-y: auto; font-family: inherit; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.wc-input-area textarea:focus { border-color: var(--navy-accent); box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.15); }
.wc-input-area textarea::placeholder { color: var(--text-muted); }
.wc-send-btn { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--navy-accent); color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 16px; transition: background 0.2s; flex-shrink: 0; }
.wc-send-btn:hover { background: var(--navy-primary); }

/* Empty State */
.wc-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-muted); text-align: center; padding: 40px; }
.wc-empty i { font-size: 64px; opacity: 0.2; }
.wc-empty h3 { font-size: 20px; font-weight: 600; color: var(--text-primary); margin: 0; }
.wc-empty p { font-size: 14px; max-width: 300px; }

/* Blocked State */
.wc-blocked { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 10px; text-align: center; color: var(--text-muted); }

/* Modal Overlays */
.wc-modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 1002; display: flex; align-items: center; justify-content: center; }
.wc-modal { background: var(--bg-card); border-radius: 12px; width: 420px; max-width: 90vw; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); overflow: hidden; }
.wc-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border-color); }
.wc-modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-primary); }
.wc-modal-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 50%; transition: color 0.2s; }
.wc-modal-header button:hover { color: var(--danger); }
.wc-modal-search { padding: 12px 16px; }
.wc-modal-search input { width: 100%; background: var(--bg-secondary); border: none; border-radius: 20px; padding: 8px 12px 8px 36px; font-size: 14px; color: var(--text-primary); outline: none; }
.wc-modal-search input::placeholder { color: var(--text-muted); }
.wc-modal-results { flex: 1; overflow-y: auto; max-height: 50vh; }

/* Search / Request Items */
.wc-search-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-color); gap: 12px; }
.wc-search-item-info { flex: 1; min-width: 0; }
.wc-search-item-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.wc-search-item-role { font-size: 12px; color: var(--text-muted); }
.wc-search-item-actions { display: flex; gap: 6px; }
.wc-search-item-actions .btn { padding: 5px 12px; font-size: 12px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; transition: opacity 0.2s; }
.wc-search-item-actions .btn:hover { opacity: 0.85; }
.wc-search-item-actions .btn-accept { background: var(--success); color: #fff; }
.wc-search-item-actions .btn-reject { background: var(--danger); color: #fff; }
.wc-search-item-actions .btn-add { background: var(--navy-accent); color: #fff; }

/* Date Separator */
.wc-date-sep { text-align: center; margin: 16px 0 8px; font-size: 12px; }
.wc-date-sep span { background: var(--bg-card); padding: 4px 12px; border-radius: 8px; color: var(--text-muted); box-shadow: 0 1px 2px var(--shadow-color); display: inline-block; }

/* Context Menu */
.wc-ctx-menu { position: fixed; background: var(--bg-card); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); z-index: 1003; min-width: 160px; overflow: hidden; }
.wc-ctx-menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; font-size: 14px; color: var(--text-primary); transition: background 0.15s; }
.wc-ctx-menu-item:hover { background: var(--bg-secondary); }
.wc-ctx-menu-item.danger { color: var(--danger); }
.wc-ctx-menu-item i { width: 16px; text-align: center; font-size: 14px; }

/* Typing Indicator */
.wc-typing { align-self: flex-start; padding: 0; margin-bottom: 2px; }
.wc-typing .wc-msg-bubble { display: flex; align-items: center; gap: 4px; padding: 10px 14px; background: var(--wc-recv-bg); border: 1px solid var(--border-color); border-radius: 8px; border-top-left-radius: 0; }
.wc-typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); animation: wcTypingBounce 1.4s infinite ease-in-out; }
.wc-typing-dot:nth-child(1) { animation-delay: 0s; }
.wc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.wc-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes wcTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-page-main { height: calc(100dvh - 65px); }
    .wc-sidebar { width: 100%; min-width: 100%; position: absolute; top: 0; bottom: 65px; left: 0; z-index: 2; }
    .wc-sidebar.wc-hidden { display: none; }
    .wc-chat { width: 100%; }
    .wc-back-btn { display: flex; }
    .wc-msg { max-width: 85%; }
    .wc-msg-image img { max-width: 220px; }
    .wc-contact-item { padding: 10px 12px; }
    .wc-modal { width: 100%; max-width: 100%; border-radius: 0; max-height: 100vh; }
}

/* ============================================================
   Dashboard — AdminLTE kit (navbar / small-box / info-box / lte-card)
   ============================================================ */

/* ---- DaisyUI-style top navbar: title + breadcrumb + user in ONE bar ---- */
.navbar { display:flex; align-items:center; gap:8px; background:var(--bg-card); box-shadow:0 2px 6px var(--shadow-color); border-radius:3px; padding:8px 14px; margin-bottom:14px; position:relative; z-index:200; }
.navbar-start { display:flex; align-items:center; gap:10px; flex:1; min-width:0; }
.navbar-end { display:flex; align-items:center; gap:4px; }
.nav-page { display:flex; flex-direction:column; gap:2px; min-width:0; padding-left:4px; }
.nav-page-title { font-size:18px; font-weight:700; color:var(--navy-primary); display:flex; align-items:center; gap:9px; line-height:1.15; white-space:nowrap; }
.nav-page-title i { color:var(--navy-accent); font-size:16px; }
.nav-crumb { font-size:11.5px; color:var(--text-muted); display:flex; align-items:center; gap:6px; }
.nav-crumb i { font-size:10px; color:var(--navy-accent); }
.nav-crumb a { color:var(--navy-accent); text-decoration:none; }
.nav-crumb a:hover { text-decoration:underline; }
.nav-crumb-sep { color:var(--border-color); }
.nav-welcome { display:flex; flex-direction:column; align-items:flex-end; line-height:1.2; margin-right:6px; }
.nav-welcome-hi { font-size:10px; text-transform:uppercase; letter-spacing:1.2px; color:var(--text-muted); font-weight:600; }
.nav-welcome strong { font-size:14px; color:var(--navy-primary); font-weight:600; }
.nav-btn { width:40px; height:40px; border:none; background:transparent; border-radius:6px; color:var(--text-secondary); font-size:17px; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; position:relative; transition:background .2s; }
.nav-btn:hover { background:var(--bg-primary); color:var(--navy-primary); }
.nav-badge { position:absolute; top:3px; right:3px; min-width:17px; height:17px; padding:0 4px; border-radius:9px; background:var(--danger); color:#fff; font-size:10.5px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.nav-avatar { width:38px; height:38px; border-radius:50%; border:2px solid var(--navy-accent); object-fit:cover; cursor:pointer; display:block; }
.nav-dd { position:relative; }
.nav-dd-menu { position:absolute; right:0; top:calc(100% + 10px); min-width:250px; background:var(--bg-card); border:1px solid var(--border-color); border-radius:3px; box-shadow:0 8px 24px var(--shadow-hover); padding:8px; display:none; z-index:300; }
.nav-dd.open .nav-dd-menu { display:block; }
.nav-dd-menu a, .nav-dd-menu button { display:flex; align-items:center; gap:10px; width:100%; padding:10px 12px; border:none; background:none; border-radius:6px; font-size:14px; color:var(--text-primary); cursor:pointer; text-align:left; text-decoration:none; }
.nav-dd-menu a:hover, .nav-dd-menu button:hover { background:var(--bg-primary); color:var(--navy-primary); }
.nav-dd-head { padding:10px 12px; border-bottom:1px solid var(--border-light); margin-bottom:6px; }
.nav-dd-head .dd-title { font-size:15px; font-weight:700; color:var(--navy-primary); }
.nav-dd-head .dd-sub { font-size:12.5px; color:var(--navy-accent); margin-top:2px; }
.nav-notif { display:flex; gap:10px; padding:9px 10px; border-radius:6px; font-size:13px; color:var(--text-primary); text-decoration:none; }
.nav-notif:hover { background:var(--bg-primary); }
.nav-notif i { color:var(--navy-accent); margin-top:3px; }
.nav-notif .notif-time { display:block; font-size:11px; color:var(--text-muted); margin-top:2px; }
.nav-dd-foot { padding:8px 4px 2px; border-top:1px solid var(--border-light); margin-top:6px; }
.nav-dd-empty { padding:18px 12px; text-align:center; font-size:13px; color:var(--text-muted); }

/* ---- control bar: period + scope + sync/export ---- */
.dash-control { display:flex; align-items:center; gap:10px; flex-wrap:wrap; background:var(--bg-card); box-shadow:0 2px 6px var(--shadow-color); border-radius:3px; padding:10px 14px; margin-bottom:14px; }
.dash-select { position:relative; display:flex; align-items:center; }
.dash-select > i { position:absolute; left:12px; color:var(--navy-accent); font-size:13px; pointer-events:none; }
.dash-select select { appearance:none; -webkit-appearance:none; padding:9px 34px 9px 32px; border:1px solid var(--input-border); background:var(--input-bg); color:var(--text-primary); border-radius:3px; font-size:14px; font-weight:600; cursor:pointer; min-width:190px; }
.dash-select::after { content:"\f078"; font-family:"Font Awesome 6 Free"; font-weight:900; position:absolute; right:12px; font-size:11px; color:var(--text-muted); pointer-events:none; }
.dash-control-spacer { flex:1; }
.dash-sync { font-size:13px; color:var(--warning); font-weight:600; white-space:nowrap; }
.dash-tool { display:inline-flex; align-items:center; gap:7px; padding:9px 14px; border:1px solid var(--navy-accent); background:transparent; color:var(--navy-accent); border-radius:3px; font-size:14px; font-weight:600; cursor:pointer; text-decoration:none; }
.dash-tool:hover { background:var(--navy-accent); color:#fff; }
.dash-tool.icon-only { padding:9px 12px; border-color:var(--border-color); color:var(--text-secondary); }
.dash-tool.icon-only:hover { background:var(--navy-primary); border-color:var(--navy-primary); color:#fff; }

/* ---- alert ribbon (renders only when something is wrong) ---- */
.alert-ribbon { display:flex; align-items:center; gap:12px; background:#fff8e6; border:1px solid #f5dda3; border-radius:3px; padding:12px 16px; margin-bottom:14px; font-size:14px; color:#6b5215; }
.alert-ribbon > i { color:var(--warning); font-size:18px; }
.alert-ribbon-items { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; }
.alert-ribbon a { color:#6b5215; text-decoration:none; }
.alert-ribbon a:hover { text-decoration:underline; }
.alert-ribbon b { color:#8a6414; font-weight:700; }
.alert-sep { color:#d9c48a; }

/* ---- small-box KPI (white card variant, navy icon disc + drill-through footer) ---- */
.dashboard-kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:14px; }
.small-box { display:flex; flex-direction:column; background:var(--bg-card); border-radius:3px; box-shadow:0 2px 6px var(--shadow-color); overflow:hidden; transition:transform .2s, box-shadow .2s; }
.small-box:hover { transform:translateY(-3px); box-shadow:0 6px 16px var(--shadow-hover); }
.small-box .inner { display:flex; align-items:flex-start; gap:16px; padding:18px 18px 12px; flex:1; }
.small-box .icon { width:52px; height:52px; flex-shrink:0; border-radius:50%; background:var(--navy-primary); color:#fff; display:flex; align-items:center; justify-content:center; font-size:22px; }
.small-box .icon.icon-gold { background:var(--warning); color:var(--navy-primary); }
.small-box .icon.icon-accent { background:var(--navy-accent); }
.small-box .icon.icon-success { background:var(--success); }
.small-box .kpi-body { min-width:0; }
.small-box h3 { font-size:clamp(22px,3.4vw,30px); font-weight:700; color:var(--text-primary); margin:0 0 2px; line-height:1.1; white-space:nowrap; }
.small-box p { font-size:14px; color:var(--text-secondary); margin:0 0 7px; }
.kpi-delta { font-size:12.5px; font-weight:600; display:flex; align-items:center; gap:5px; }
.kpi-delta.up { color:var(--success); }
.kpi-delta.down { color:var(--danger); }
.kpi-delta.flat { color:var(--text-muted); }
.kpi-delta span { color:var(--text-muted); font-weight:500; }
.small-box-footer { display:block; padding:9px 18px; border-top:1px solid var(--border-light); color:var(--navy-accent); font-size:13px; font-weight:600; text-decoration:none; }
.small-box-footer:hover { background:var(--bg-primary); }

/* ---- info-box strip ---- */
.dashboard-infoboxes { display:grid; grid-template-columns:repeat(6,1fr); gap:12px; margin-bottom:14px; }
.info-box { display:flex; align-items:center; gap:12px; background:var(--bg-card); border-radius:3px; box-shadow:0 2px 6px var(--shadow-color); padding:14px 16px; min-height:74px; }
.info-box-icon { width:34px; height:34px; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:22px; color:var(--navy-accent); }
.info-box-icon.ib-gold { color:var(--warning); }
.info-box-icon.ib-success { color:var(--success); }
.info-box-icon.ib-danger { color:var(--danger); }
.info-box-content { min-width:0; }
.info-box-number { font-size:20px; font-weight:700; color:var(--text-primary); line-height:1.15; white-space:nowrap; }
.info-box-text { font-size:12.5px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ---- lte-card wrapper ---- */
.lte-card { background:var(--bg-card); border-radius:3px; box-shadow:0 2px 6px var(--shadow-color); margin-bottom:14px; display:flex; flex-direction:column; }
.lte-card-header { display:flex; justify-content:space-between; align-items:center; padding:13px 18px; border-bottom:1px solid var(--border-light); }
.lte-card-title { font-size:15.5px; font-weight:700; color:var(--navy-primary); margin:0; display:flex; align-items:center; gap:8px; }
.lte-card-title i { color:var(--navy-accent); font-size:14px; }
.lte-card-tools button { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:2px 8px; font-size:15px; line-height:1; }
.lte-card-tools button:hover { color:var(--navy-accent); }
.lte-card-body { padding:16px 18px; flex:1; }
.lte-card.collapsed .lte-card-body { display:none; }
.lte-card-foot { padding:10px; text-align:center; border-top:1px solid var(--border-light); }
.lte-card-foot a { color:var(--navy-accent); font-size:13px; font-weight:600; text-decoration:none; }
.lte-card-foot a:hover { text-decoration:underline; }
.dashboard-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.dashboard-row-chart { display:grid; grid-template-columns:1.35fr 1fr; gap:14px; }

/* ---- compact table used inside dashboard cards ---- */
.dash-table { width:100%; border-collapse:collapse; font-size:13.5px; }
.dash-table th { text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.4px; color:var(--text-muted); font-weight:700; padding:0 10px 8px 0; border-bottom:1px solid var(--border-light); }
.dash-table td { padding:9px 10px 9px 0; border-bottom:1px solid var(--border-light); color:var(--text-primary); vertical-align:middle; }
.dash-table tr:last-child td { border-bottom:none; }
.dash-table tbody tr:hover td { background:var(--table-hover); }
.dash-table .t-time { color:var(--navy-accent); font-weight:700; white-space:nowrap; }
.dash-table .t-muted { color:var(--text-muted); }
.dash-table .t-danger { color:var(--danger); font-weight:700; }
.dash-table .t-gold { color:var(--warning); font-weight:600; }
.dash-empty { padding:24px 10px; text-align:center; color:var(--text-muted); font-size:13.5px; }
.dash-empty i { display:block; font-size:26px; margin-bottom:8px; color:var(--border-color); }

/* ---- donut + legend ---- */
.donut-wrap { display:flex; align-items:center; gap:18px; flex-wrap:wrap; }
.donut-canvas { position:relative; width:190px; height:190px; flex-shrink:0; }
.donut-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; pointer-events:none; }
.donut-center strong { font-size:26px; font-weight:700; color:var(--text-primary); line-height:1; }
.donut-center span { font-size:12px; color:var(--text-muted); }
.donut-legend { flex:1; min-width:190px; }
.donut-legend li { display:flex; align-items:center; gap:9px; font-size:13.5px; padding:5px 0; list-style:none; }
.donut-legend .dot { width:11px; height:11px; border-radius:50%; flex-shrink:0; }
.donut-legend .lg-name { flex:1; color:var(--text-primary); }
.donut-legend .lg-val { color:var(--text-secondary); font-weight:600; white-space:nowrap; }

/* ---- client funnel chevrons ---- */
.funnel { display:flex; align-items:stretch; gap:3px; overflow-x:auto; padding-bottom:4px; }
.funnel-stage { flex:1; min-width:130px; padding:14px 26px; color:#fff; text-align:center; text-decoration:none; display:block; clip-path:polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 18px 50%); }
.funnel-stage:first-child { clip-path:polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%); }
.funnel-stage:last-child { clip-path:polygon(0 0, 100% 0, 100% 100%, 0 100%, 18px 50%); }
.funnel-name { font-size:13.5px; font-weight:600; }
.funnel-count { font-size:19px; font-weight:700; margin-top:2px; }
.fn-1 { background:var(--navy-primary); }
.fn-2 { background:var(--warning); color:var(--navy-primary); }
.fn-3 { background:var(--success); }
.fn-4 { background:var(--navy-accent); }
.fn-5 { background:var(--border-color); color:var(--text-muted); }

/* ---- workload bars ---- */
.workload-row { display:flex; align-items:center; gap:14px; padding:10px 0; border-bottom:1px solid var(--border-light); font-size:13.5px; }
.workload-row:last-child { border-bottom:none; }
.workload-name { width:150px; flex-shrink:0; color:var(--text-primary); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.workload-val { width:88px; flex-shrink:0; color:var(--text-secondary); white-space:nowrap; }
.workload-track { flex:1; height:11px; border-radius:6px; background:var(--border-light); overflow:hidden; }
.workload-fill { height:100%; border-radius:6px; background:var(--navy-primary); }
.workload-fill.wl-gold { background:var(--warning); }

/* ---- responsive ---- */
@media (max-width:1200px) {
    .dashboard-kpis { grid-template-columns:repeat(2,1fr); }
    .dashboard-infoboxes { grid-template-columns:repeat(3,1fr); }
    .dashboard-row-chart { grid-template-columns:1fr; }
}
@media (max-width:768px) {
    .dashboard-kpis, .dashboard-infoboxes, .dashboard-row-2 { grid-template-columns:1fr; }
    .nav-crumb, .nav-welcome { display:none; }
    .nav-page-title { font-size:16px; }
    .dash-control { gap:8px; }
    .dash-select select { min-width:0; width:100%; }
    .dash-control-spacer { display:none; }
    .dash-sync { width:100%; order:5; }
}

/* ---- dark mode tweaks (vars cover the rest) ---- */
body.dark-mode .alert-ribbon { background:rgba(251,188,4,.10); border-color:rgba(251,188,4,.35); color:#e6cf9a; }
body.dark-mode .alert-ribbon b { color:var(--warning); }
body.dark-mode .small-box h3, body.dark-mode .info-box-number, body.dark-mode .donut-center strong { color:var(--text-primary); }
body.dark-mode .nav-page-title, body.dark-mode .lte-card-title, body.dark-mode .nav-welcome strong { color:var(--navy-accent); }

/* ---- print: dashboard only ---- */
@media print {
    .sidebar, .mobile-menu, .navbar, .dash-control, .alert-ribbon, .lte-card-tools, .small-box-footer, .top-loadbar { display:none !important; }
    .main-content { margin:0 !important; padding:0 !important; }
    .lte-card, .small-box, .info-box { box-shadow:none; border:1px solid #ddd; break-inside:avoid; }
    .dashboard-kpis { grid-template-columns:repeat(4,1fr); }
}

/* ---- Top Loading Bar — thin indeterminate, fixed top, non-blocking ---- */
.top-loadbar { position:fixed; top:0; left:0; right:0; height:3px; z-index:10001; overflow:hidden; pointer-events:none; }
.top-loadbar > span { display:block; height:100%; width:38%; border-radius:0 3px 3px 0; background:linear-gradient(90deg, rgba(0,116,217,0), var(--navy-accent), var(--navy-primary)); box-shadow:0 0 8px rgba(0,116,217,.5); animation:topLoadSlide 1.05s ease-in-out infinite; }
@keyframes topLoadSlide { 0% { transform:translateX(-105%); } 100% { transform:translateX(320%); } }
body.dark-mode .top-loadbar > span { background:linear-gradient(90deg, rgba(74,163,255,0), #4aa3ff, #9fd0ff); }
@media (prefers-reduced-motion:reduce) { .top-loadbar > span { animation:none; width:100%; } }

/* ============================================================
   Split modal — case info (left 60%) + document preview (right 40%)
   ============================================================ */
.modal.modal-split { width:90%; max-width:1500px; height:90vh; max-height:90vh; display:flex; flex-direction:column; overflow:hidden; }
.modal-split .modal-header { flex-shrink:0; padding:18px 26px; }
.modal-split .modal-body { padding:0; display:flex; flex:1; min-height:0; overflow:hidden; }
.case-form-pane { flex:1 1 60%; min-width:0; overflow-y:auto; padding:22px 26px; }
.case-doc-pane { flex:0 0 40%; min-width:0; display:flex; flex-direction:column; border-left:1px solid var(--border-color); background:var(--bg-primary); }

.case-doc-head { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:13px 18px; border-bottom:1px solid var(--border-color); background:var(--bg-card); flex-shrink:0; }
.case-doc-head h4 { margin:0; font-size:14.5px; font-weight:700; color:var(--navy-primary); display:flex; align-items:center; gap:8px; }
.case-doc-head h4 i { color:var(--navy-accent); }
.case-doc-count { font-size:11.5px; font-weight:700; color:var(--navy-accent); background:rgba(0,116,217,.10); border-radius:3px; padding:3px 8px; }

.doc-preview { flex:1; min-height:0; position:relative; display:flex; align-items:center; justify-content:center; padding:12px; overflow:auto; }
.doc-preview iframe { width:100%; height:100%; border:none; background:#fff; border-radius:3px; box-shadow:0 2px 10px var(--shadow-color); }
.doc-preview img { max-width:100%; max-height:100%; object-fit:contain; border-radius:3px; box-shadow:0 2px 10px var(--shadow-color); }
.doc-preview-empty, .doc-preview-file { text-align:center; color:var(--text-muted); font-size:13.5px; padding:20px; }
.doc-preview-empty i { font-size:46px; color:var(--border-color); display:block; margin-bottom:12px; }
.doc-preview-file i { font-size:56px; color:var(--navy-accent); display:block; margin-bottom:12px; }
.doc-preview-file strong { display:block; color:var(--text-primary); font-size:14px; margin-bottom:4px; word-break:break-all; }
.doc-preview-file a { color:var(--navy-accent); font-size:13px; font-weight:600; text-decoration:none; display:inline-block; margin-top:10px; }

.doc-dropzone { margin:0 18px 12px; border:2px dashed var(--input-border); border-radius:4px; padding:14px; text-align:center; color:var(--text-muted); font-size:13px; cursor:pointer; background:var(--bg-card); transition:border-color .2s, color .2s; flex-shrink:0; }
.doc-dropzone:hover, .doc-dropzone.dragover { border-color:var(--navy-accent); color:var(--navy-accent); background:rgba(0,116,217,.05); }
.doc-dropzone i { font-size:20px; display:block; margin-bottom:6px; }
.doc-dropzone b { color:var(--navy-accent); }

.doc-list { max-height:240px; overflow-y:auto; padding:0 18px 14px; flex-shrink:0; }
.doc-item { display:flex; align-items:center; gap:10px; padding:9px 10px; border:1px solid var(--border-color); border-radius:3px; background:var(--bg-card); margin-bottom:8px; cursor:pointer; }
.doc-item:hover { border-color:var(--navy-accent); }
.doc-item.active { border-color:var(--navy-accent); box-shadow:0 0 0 2px rgba(0,116,217,.15); }
.doc-item > i.doc-ico { color:var(--navy-accent); font-size:17px; flex-shrink:0; }
.doc-item-body { flex:1; min-width:0; }
.doc-item-name { font-size:13px; font-weight:600; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.doc-item-meta { font-size:11.5px; color:var(--text-muted); display:flex; align-items:center; gap:6px; margin-top:2px; }
.doc-item select { font-size:11.5px; padding:3px 6px; border:1px solid var(--input-border); border-radius:3px; background:var(--input-bg); color:var(--text-primary); max-width:130px; flex-shrink:0; }
.doc-item-del { background:none; border:none; color:var(--danger); cursor:pointer; font-size:14px; padding:4px 6px; flex-shrink:0; }
.doc-item-del:hover { color:#b3251a; }
.doc-badge-new { font-size:9.5px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; background:var(--warning); color:var(--navy-primary); border-radius:3px; padding:2px 6px; }

.modal-foot { display:flex; justify-content:flex-end; align-items:center; gap:10px; padding:13px 24px; border-top:1px solid var(--border-color); background:var(--bg-card); flex-shrink:0; }
.modal-foot .foot-note { margin-right:auto; font-size:12.5px; color:var(--text-muted); }

@media (max-width:1100px) {
    .modal.modal-split { width:96%; height:94vh; max-height:94vh; }
    .modal-split .modal-body { flex-direction:column; }
    .case-form-pane { flex:1 1 auto; padding:16px 18px; }
    .case-doc-pane { flex:0 0 46%; border-left:none; border-top:1px solid var(--border-color); }
    .doc-list { max-height:190px; }
}

/* ---- modal header tools: demo-seed button sits beside the close icon ---- */
.modal-head-tools { display:flex; align-items:center; gap:2px; }
.demo-seed-btn { font-size:19px; opacity:.7; }
.demo-seed-btn:hover { opacity:1; color:var(--warning); }

/* ============================================================
   Client 360 modal — profile rail (left) + tabbed history (right)
   ============================================================ */
.client-profile-pane, .detail-rail { flex:0 0 330px; min-width:0; overflow-y:auto; padding:20px 18px; border-right:1px solid var(--border-color); background:var(--bg-primary); }
.c360-avatar { width:74px; height:74px; margin:0 auto 12px; border-radius:50%; background:var(--navy-primary); color:#fff; font-size:26px; font-weight:700; display:flex; align-items:center; justify-content:center; letter-spacing:1px; }
.c360-name { text-align:center; font-size:18px; font-weight:700; color:var(--navy-primary); margin-bottom:4px; word-break:break-word; }
.c360-sub { text-align:center; font-size:12.5px; color:var(--text-muted); margin-bottom:12px; }
.c360-badges { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; margin-bottom:16px; }
.c360-badge { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; padding:4px 9px; border-radius:3px; background:var(--bg-card); border:1px solid var(--border-color); color:var(--text-secondary); }
.c360-badge.b-navy { background:var(--navy-primary); border-color:var(--navy-primary); color:#fff; }
.c360-badge.b-gold { background:var(--warning); border-color:var(--warning); color:var(--navy-primary); }
.c360-badge.b-ok { background:var(--success); border-color:var(--success); color:#fff; }
.c360-badge.b-off { background:var(--text-muted); border-color:var(--text-muted); color:#fff; }

.c360-kpi { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:16px; }
.c360-kpi > div { background:var(--bg-card); border:1px solid var(--border-color); border-radius:3px; padding:9px 11px; }
.c360-kpi strong { display:block; font-size:16px; font-weight:700; color:var(--navy-primary); line-height:1.2; }
.c360-kpi span { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.3px; }
.c360-kpi .k-wide { grid-column:1 / -1; }
.c360-kpi .k-danger strong { color:var(--danger); }
.c360-kpi .k-ok strong { color:var(--success); }

.c360-sec { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--text-muted); margin:16px 0 6px; }
.c360-field { display:flex; gap:10px; padding:7px 0; border-bottom:1px dashed var(--border-light); font-size:13px; }
.c360-field:last-child { border-bottom:none; }
.c360-field i { width:15px; color:var(--navy-accent); font-size:12px; margin-top:2px; }
.c360-field .fk { color:var(--text-muted); min-width:74px; }
.c360-field .fv { color:var(--text-primary); flex:1; word-break:break-word; }

.c360-pane { flex:1; min-width:0; display:flex; flex-direction:column; }
.c360-tabs { display:flex; gap:2px; padding:0 16px; border-bottom:1px solid var(--border-color); background:var(--bg-card); overflow-x:auto; flex-shrink:0; }
.c360-tabs::-webkit-scrollbar { height:0; }
.c360-tab { padding:13px 14px; border:none; background:none; font-size:13.5px; font-weight:600; color:var(--text-muted); border-bottom:3px solid transparent; cursor:pointer; white-space:nowrap; display:flex; align-items:center; gap:7px; }
.c360-tab:hover { color:var(--navy-primary); }
.c360-tab.active { color:var(--navy-accent); border-bottom-color:var(--navy-accent); }
.c360-tab i { font-size:12.5px; }
.c360-tab .cnt { font-size:10.5px; font-weight:700; background:var(--border-light); color:var(--text-secondary); border-radius:9px; padding:1px 7px; }
.c360-tab.active .cnt { background:var(--navy-accent); color:#fff; }
.c360-body { flex:1; overflow-y:auto; padding:16px 18px; }
.c360-body .dash-table th { position:sticky; top:-16px; background:var(--bg-card); z-index:1; }

.c360-money { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px; }
.c360-money > div { background:var(--bg-primary); border:1px solid var(--border-color); border-radius:3px; padding:12px 14px; }
.c360-money strong { display:block; font-size:19px; font-weight:700; color:var(--navy-primary); }
.c360-money span { font-size:11.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.3px; }

.c360-chip { display:inline-block; font-size:11px; font-weight:600; padding:2px 8px; border-radius:3px; background:var(--border-light); color:var(--text-secondary); }
.c360-note { background:var(--bg-primary); border-left:3px solid var(--navy-accent); border-radius:0 3px 3px 0; padding:10px 12px; font-size:13px; color:var(--text-secondary); }

@media (max-width:1100px) {
    .client-profile-pane, .detail-rail { flex:0 0 auto; max-height:38%; border-right:none; border-bottom:1px solid var(--border-color); }
    .c360-kpi { grid-template-columns:repeat(3,1fr); }
    .c360-money { grid-template-columns:1fr; }
}

/* ---- case report: detail rail (left) + the report document (right) ---- */
.report-doc-pane { flex:1; min-width:0; overflow-y:auto; padding:18px; background:var(--bg-primary); }
.report-paper { background:#fff; color:#1a1a1a; max-width:920px; margin:0 auto; padding:26px 30px; border-radius:3px; box-shadow:0 2px 14px rgba(0,0,0,.14); }
.report-paper .case-report { max-height:none; overflow:visible; }
body.dark-mode .report-paper { background:#f4f6f8; }
.modal-split.report-modal { max-width:1500px; }
@media (max-width:1100px) { .report-doc-pane { padding:12px; } .report-paper { padding:18px; } }

/* ---- sidebar data indicators ---- */
.nav-count { margin-left:auto; min-width:22px; padding:1px 7px; border-radius:10px; background:rgba(255,255,255,.16); color:#fff; font-size:11px; font-weight:700; text-align:center; line-height:18px; }
.nav-count:empty { display:none; }
.nav-count.nc-alert { background:var(--danger); }
.sidebar-menu a.active .nav-count, .sidebar-submenu a.active .nav-count { background:rgba(255,255,255,.30); }

.badge-claude { background: rgba(204, 120, 92, 0.14); color: #cc785c; }

/* ============================================================
   AI Chat — WhatsApp skin (reuses the --wc-* palette from the team chat)
   ============================================================ */
.chat-container { background: var(--bg-primary); }

/* ---- left rail: WhatsApp chat list ---- */
.chat-sidebar { background: var(--bg-card); border-right: 1px solid var(--border-color); }
.chat-sidebar-header { background: var(--bg-primary); border-bottom: 1px solid var(--border-color); min-height: 56px; display: flex; align-items: center; padding: 10px 16px; }
.chat-sidebar-header h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; color: var(--navy-primary); margin: 0; }
.chat-sidebar-header h3 i { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }

.conv-search { position: relative; padding: 8px 12px; background: var(--bg-card); border-bottom: 1px solid var(--border-light); }
.conv-search i { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
.conv-search input { width: 100%; padding: 9px 12px 9px 36px; border: none; border-radius: 8px; background: var(--bg-primary); color: var(--text-primary); font-size: 14px; outline: none; }
.conv-search input::placeholder { color: var(--text-muted); }

.conv-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); cursor: pointer; position: relative; }
.conv-item:hover { background: var(--bg-primary); }
.conv-item.active { background: var(--bg-primary); }
.conv-avatar { width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; background: var(--navy-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.conv-item-body { flex: 1; min-width: 0; }
.conv-item-top { display: flex; align-items: baseline; gap: 8px; }
.conv-item-title { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.conv-item.active .conv-item-time { color: var(--navy-accent); }
.conv-item-preview { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-item-preview em { opacity: .7; }
.conv-tick { color: var(--wc-read); font-size: 11px; }
.conv-item-delete { opacity: 0; background: none; border: none; color: var(--danger); cursor: pointer; padding: 6px; font-size: 13px; flex-shrink: 0; transition: opacity .2s; }
.conv-item:hover .conv-item-delete { opacity: 1; }
.conv-new-wrap { padding: 10px 12px 6px; background: var(--bg-card); }
.conv-new-btn { width: 100%; border-radius: 8px; }

/* ---- right pane: header, wallpaper, bubbles ---- */
.chat-main { background: var(--wc-wallpaper); }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 9px 16px; background: var(--bg-primary); border-bottom: 1px solid var(--border-color); min-height: 60px; }
.chat-header-title { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
/* avatar is a flex child, so it sits correctly whether or not the toggle is visible */
.chat-header::before { content: "\f544"; font-family: "Font Awesome 6 Free"; font-weight: 900; order: 1; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--navy-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.chat-header .chat-sidebar-toggle { order: 0; }
.chat-header .chat-header-title { order: 2; }
.chat-header .chat-header-actions { order: 3; }
.chat-header-title h2, .chat-header-title h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0; }
.chat-header-badges { display: flex; align-items: center; gap: 6px; }
.chat-badge { font-size: 11.5px; padding: 1px 0; background: none !important; color: var(--text-muted) !important; font-weight: 500; }
.chat-badge + .chat-badge::before { content: "· "; }
.badge-claude, .badge-openai, .badge-gemini { font-weight: 600 !important; }

.chat-messages { background: var(--wc-wallpaper); background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); padding: 18px 6%; gap: 4px; }
.chat-msg { max-width: 76%; margin: 0 0 6px; }
.chat-msg-user { align-self: flex-end; margin-left: auto; }
.chat-msg-assistant { align-self: flex-start; margin-right: auto; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; }
.msg-avatar { width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; background: var(--navy-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }

.msg-bubble { position: relative; padding: 7px 10px 6px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.12); font-size: 14.2px; line-height: 1.5; word-break: break-word; }
.chat-msg-user .msg-bubble { background: var(--wc-sent-bg); color: #111b21; border-top-right-radius: 0; }
.chat-msg-assistant .msg-bubble { background: var(--wc-recv-bg); color: var(--text-primary); border-top-left-radius: 0; }
.chat-msg-user .msg-bubble::before { content: ""; position: absolute; top: 0; right: -8px; width: 0; height: 0; border-left: 8px solid var(--wc-sent-bg); border-bottom: 8px solid transparent; }
.chat-msg-assistant .msg-bubble::before { content: ""; position: absolute; top: 0; left: -8px; width: 0; height: 0; border-right: 8px solid var(--wc-recv-bg); border-bottom: 8px solid transparent; }
body.dark-mode .chat-msg-user .msg-bubble { color: #e9edef; }

.msg-time { display: block; text-align: right; font-size: 11px; color: rgba(0,0,0,.45); margin-top: 2px; white-space: nowrap; }
body.dark-mode .msg-time { color: rgba(255,255,255,.5); }
.msg-tick { color: var(--wc-read); font-size: 11px; margin-left: 2px; }
.msg-actions { display: flex; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border-light); }
.msg-action-btn { font-size: 11.5px; padding: 3px 8px; border-radius: 10px; }
.msg-suggestions { margin-top: 8px; }

.chat-empty { background: var(--wc-wallpaper); }

/* ---- composer: pill input + round send button ---- */
.chat-input-area { background: var(--bg-primary); border-top: 1px solid var(--border-color); padding: 9px 14px; }
.chat-input-wrap { display: flex; align-items: flex-end; gap: 9px; background: transparent; border: none; padding: 0; }
.chat-input-wrap textarea { flex: 1; border: none; border-radius: 22px; background: var(--input-bg); color: var(--text-primary); padding: 11px 16px; font-size: 15px; resize: none; max-height: 120px; outline: none; box-shadow: 0 1px 2px var(--shadow-color); }
.chat-send-btn { width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; background: var(--navy-primary); color: #fff; border: none; font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.chat-send-btn:hover { background: var(--navy-hover); }
.chat-send-btn:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 768px) {
    .chat-messages { padding: 14px 10px; }
    .chat-msg { max-width: 88%; }
    .chat-header { padding-left: 96px; }
    .chat-header-title::before { left: 50px; }
}

/* ai config — hide the providers you're not using */
.form-group.is-hidden { display: none; }

/* ===== Language switcher (navbar + header injection) ===== */
.nav-lang { display: inline-flex; align-items: center; }
.nav-lang-select { height: 34px; max-width: 165px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); color: var(--text-primary); padding: 0 8px; font-size: 13px; cursor: pointer; }
.nav-lang-select:focus { outline: none; border-color: var(--navy-accent); }

/* ===== AI chat — assistant profile / prompt selector ===== */
.chat-profile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border-color); background: var(--bg-card); }
.chat-profile label { font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.chat-profile select { flex: 0 0 auto; min-width: 220px; height: 34px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); color: var(--text-primary); padding: 0 8px; font-size: 13px; cursor: pointer; }
.chat-profile-desc { width: 100%; font-size: 12px; color: var(--text-muted); }
.instr-card-desc { font-size: 12.5px; color: var(--text-muted); margin: 6px 14px 0; padding-top: 6px; border-top: 1px dashed var(--border-color); }

/* ===== Roles & permissions matrix ===== */
.perm-table th, .perm-table td { border: 1px solid #e3e8ee; padding: 6px 8px; }
.perm-table thead th { background: var(--bg-secondary, #f4f6f9); font-size: 12.5px; }
.perm-table tbody td:first-child { white-space: nowrap; }
.perm-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.status-secretary { background: #e6f6ee; color: #1e7e34; }

/* ===== Knowledge Base cards ===== */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.kb-card { position: relative; display: flex; gap: 12px; background: var(--bg-card, #fff); border: 1px solid var(--border-color, #e3e8ee); border-radius: 10px; padding: 16px; cursor: pointer; transition: box-shadow .18s, transform .1s; }
.kb-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,.10); transform: translateY(-2px); }
.kb-card-icon { flex: 0 0 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; }
.kb-card-body { flex: 1; min-width: 0; }
.kb-card-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--text-primary, #1a1a1a); }
.kb-card-desc { margin: 0 0 8px; font-size: 13px; color: var(--text-muted, #666); line-height: 1.45; }
.kb-type-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: rgba(0,116,217,.10); color: #0056a8; }
.kb-card-open { align-self: center; color: var(--text-muted, #888); font-size: 15px; }
.kb-card:hover .kb-card-open { color: var(--navy-accent, #0074D9); }
.kb-card-actions { position: absolute; top: 8px; right: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.kb-card:hover .kb-card-actions { opacity: 1; }
.kb-act { width: 26px; height: 26px; border: none; border-radius: 5px; background: rgba(0,116,217,.10); color: #0056a8; cursor: pointer; }
.kb-act.kb-del { background: rgba(234,67,53,.10); color: #b3261e; }
.swal2-select { display: block; width: 100%; padding: 9px 12px; border: 1px solid #d9dee7; border-radius: 8px; font-size: 14px; background: #fff; color: #1a1a1a; }

/* ===== Knowledge Base toolbar / filters ===== */
.kb-toolbar { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 6px; }
.kb-search { max-width: 380px; }
.kb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-chip { border: 1px solid var(--border-color, #d9dee7); background: var(--bg-card, #fff); color: var(--text-secondary, #333); border-radius: 20px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.kb-chip.active { background: var(--navy-primary, #001f3f); border-color: var(--navy-primary, #001f3f); color: #fff; }
.kb-card.kb-inactive { opacity: .62; filter: grayscale(.3); }
.kb-badge-off { background: rgba(108,117,125,.12); color: #6c757d; }
