:root {
    --primary: #2563eb;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f1f5f9;
}

/* Login Styles */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo i {
    font-size: 4rem;
    color: var(--primary);
}

.logo h1 {
    color: #1e293b;
    font-size: 2rem;
    font-weight: 700;
    margin-top: 1rem;
}

/* Impersonation Banner */
.impersonation-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.impersonation-banner .btn {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
}

/* Adjust navbar when impersonation banner is visible */
body.impersonating .navbar-custom {
    top: 40px;
}

body.impersonating .sidebar {
    top: 120px;
    height: calc(100vh - 120px);
}

body.impersonating .main-content {
    margin-top: 120px;
}

/* App Styles */
.navbar-custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 80px;
    z-index: 1030;
}

.navbar-logo {
    height: 70px;
    width: auto;
    transition: opacity 0.2s ease;
}

.navbar-logo:hover {
    opacity: 0.9;
}

.navbar-brand {
    padding: 0 !important;
    margin-right: 1rem;
}

.sidebar {
    width: 250px;
    background: white;
    height: calc(100vh - 80px);
    position: fixed;
    left: 0;
    top: 80px;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    padding: 1rem 0;
    z-index: 1020;
}

/* Desktop - sidebar always visible */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 250px;
    }
}

/* Tablet and Phone - hamburger menu mode */
@media (max-width: 991px) {
    .navbar-custom {
        padding: 0.75rem 1rem;
    }

    .navbar-custom .container-fluid {
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .navbar-custom .navbar-brand {
        font-size: 1rem;
        white-space: nowrap;
    }

    .navbar-logo {
        height: 56px;
    }

    #active-project-display {
        min-width: auto;
        max-width: 150px;
    }

    #active-project-display .badge {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Sidebar hidden by default, shown via hamburger */
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .navbar-logo {
        height: 50px;
    }

    #project-switcher {
        max-width: 150px !important;
    }
}

@media (max-width: 576px) {
    .navbar-logo {
        height: 42px;
    }

    #active-project-display {
        display: none;
    }
}

.nav-item {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #475569;
    border-left: 3px solid transparent;
}

.submenu {
    background: #f8f9fa;
    border-left: 3px solid #667eea;
}

.submenu .nav-item {
    padding-left: 3rem;
    font-size: 0.9rem;
}

.toggle-icon {
    transition: transform 0.2s;
    font-size: 0.75rem;
}

.toggle-icon.open {
    transform: rotate(90deg);
}

.nav-item:hover {
    background: #f8fafc;
    color: var(--primary);
}

.nav-item.active {
    background: #eff6ff;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

/* Nav divider */
.nav-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.5rem 1rem;
}

.main-content {
    margin-left: 250px;
    margin-top: 80px;
    padding: 2rem;
    min-height: calc(100vh - 80px);
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 12px;
}

.card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: #1e293b;
}

.btn-primary {
    background: var(--primary);
    border: none;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.badge {
    padding: 0.35rem 0.75rem;
    font-weight: 600;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.project-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.project-card .card-body {
    min-height: 150px;
}

#active-project-display {
    min-width: 200px;
}

/* Project Switcher Responsive */
#project-switcher {
    max-width: 300px;
}

@media (max-width: 992px) {
    #project-switcher {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    #project-switcher {
        max-width: 150px;
    }
}

@media (max-width: 576px) {
    #project-switcher {
        max-width: 110px;
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* ==========================================
   MOBILE SIDEBAR / HAMBURGER MENU
   ========================================== */

/* Sidebar toggle button (hamburger) */
.sidebar-toggle {
    display: none;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: white;
    font-size: 1.25rem;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
    background: rgba(255,255,255,0.1);
    text-decoration: none;
    color: white;
}

/* Show hamburger on tablet and phone */
@media (max-width: 991px) {
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Sidebar header for mobile */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.sidebar-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1e293b;
}

.sidebar-close {
    padding: 0.25rem;
    color: #64748b;
}

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

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

/* Prevent body scroll when sidebar open */
body.sidebar-open {
    overflow: hidden;
}

/* Mobile sidebar behavior - hidden by default on small screens */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        z-index: 1025;
        top: 0;
        height: 100vh;
        padding-top: 0;
    }

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

    /* Full width main content when sidebar hidden */
    .main-content {
        margin-left: 0;
    }
}

/* ==========================================
   MOBILE-FIRST RESPONSIVE STYLES
   ========================================== */

/* --------------------------------------------
   Login/Registration - Mobile Optimizations
   -------------------------------------------- */
@media (max-width: 576px) {
    .login-wrapper {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .login-container {
        padding: 1.5rem;
        max-width: 100%;
        border-radius: 12px;
        margin: 0;
    }

    .logo i {
        font-size: 3rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .logo {
        margin-bottom: 1.5rem;
    }

    .login-container .form-label {
        font-size: 0.875rem;
    }

    .login-container .form-control {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.75rem;
    }

    .login-container .btn {
        padding: 0.75rem;
        font-size: 1rem;
    }

    .login-container .mt-3.p-3 {
        padding: 0.75rem !important;
        font-size: 0.8rem;
    }
}

/* --------------------------------------------
   Avatar Component Styles
   -------------------------------------------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 16px;
}

.avatar-text {
    color: white;
    line-height: 1;
}

/* --------------------------------------------
   Avatar & Image Responsive Sizes
   -------------------------------------------- */
.avatar-img,
.profile-avatar,
img[style*="width: 120px"],
img[style*="width:120px"] {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .avatar-img,
    .profile-avatar {
        width: 100px !important;
        height: 100px !important;
    }
}

@media (max-width: 576px) {
    .avatar-img,
    .profile-avatar {
        width: 80px !important;
        height: 80px !important;
    }

    /* Company logos */
    img[style*="max-width: 120px"],
    img[style*="max-width:120px"] {
        max-width: 80px !important;
    }
}

/* --------------------------------------------
   Navbar - Enhanced Mobile Support
   -------------------------------------------- */
@media (max-width: 991px) {
    .navbar-custom {
        padding: 0.5rem 0.75rem;
        min-height: 56px;
    }

    .main-content {
        margin-top: 56px;
        margin-left: 0;
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .navbar-custom .container-fluid {
        padding: 0;
    }

    /* Keep logo visible but smaller */
    .navbar-custom .navbar-brand {
        margin-right: 0.5rem;
    }

    /* Keep project switcher but make it smaller */
    #project-switcher {
        max-width: 100px !important;
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .navbar-custom .dropdown-toggle {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }

    #user-display {
        display: none;
    }
}

/* Extra small phones in portrait (< 400px) */
@media (max-width: 400px) {
    .navbar-custom {
        padding: 0.4rem 0.5rem;
    }

    #project-switcher {
        max-width: 80px !important;
        font-size: 0.65rem;
    }

    .navbar-custom .dropdown-toggle {
        padding: 0.15rem 0.3rem;
    }

    .main-content {
        padding: 0.75rem;
    }

    /* Smaller cards on tiny screens */
    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Page titles */
    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Buttons */
    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* --------------------------------------------
   Cards & Grid - Mobile Layouts
   -------------------------------------------- */
@media (max-width: 768px) {
    .stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 2rem;
    }

    .card-header {
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Force 2-column layout for stat cards on tablets */
    .row > [class*="col-md-3"]:has(.stat-card),
    .row > [class*="col-md-4"]:has(.stat-card) {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 576px) {
    .stat-card {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    .stat-card p,
    .stat-card small {
        font-size: 0.75rem;
    }

    /* Stack all cards vertically on phones */
    .row > [class*="col-md-3"],
    .row > [class*="col-md-4"],
    .row > [class*="col-lg-3"],
    .row > [class*="col-lg-4"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Keep 2-column for very small stat cards */
    .row > [class*="col-"]:has(.stat-card) {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .project-card .card-body {
        min-height: 100px;
        padding: 1rem;
    }
}

/* --------------------------------------------
   Tables - Mobile Responsive
   -------------------------------------------- */

/* Force all table containers to respect max-width */
.card,
.card-body,
.table-responsive {
    max-width: 100%;
    box-sizing: border-box;
}

/* Make any container with a table scrollable */
.card-body:has(.table),
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive {
    border-radius: 8px;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
}

/* Base table improvements */
.table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.table td,
.table th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Text truncation helper */
.table .text-truncate,
.table td.truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Actions column - flexible width, allow wrap for multiple buttons */
.table th:last-child,
.table td:last-child {
    width: auto;
    min-width: 120px;
    white-space: normal;
    text-align: center;
}

@media (max-width: 992px) {
    .table {
        font-size: 0.9rem;
    }

    .table td,
    .table th {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    /* Force tables to scroll horizontally */
    .table {
        font-size: 0.8rem;
    }

    .table thead th {
        padding: 0.5rem 0.4rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .table tbody td {
        padding: 0.5rem 0.4rem;
        vertical-align: middle;
        white-space: nowrap;
    }

    /* Hide columns marked with hide-tablet */
    .table .hide-tablet {
        display: none;
    }
}

@media (max-width: 576px) {
    .table {
        font-size: 0.75rem;
    }

    .table thead th {
        padding: 0.4rem 0.3rem;
        font-size: 0.7rem;
    }

    .table tbody td {
        padding: 0.4rem 0.3rem;
    }

    /* Hide columns marked with hide-mobile */
    .table .hide-mobile {
        display: none;
    }

    /* Make action buttons smaller */
    .table .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    .table .btn-group .btn-sm {
        padding: 0.15rem 0.3rem;
    }

    /* Smaller badges in tables */
    .table .badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.65rem;
    }
}

/* Card-style table for very small screens - optional class */
@media (max-width: 480px) {
    .table-card-mobile {
        min-width: auto !important;
    }

    .table-card-mobile thead {
        display: none;
    }

    .table-card-mobile tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 0.5rem;
        background: white;
    }

    .table-card-mobile tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.4rem 0.5rem;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        max-width: none !important;
    }

    .table-card-mobile tbody td:last-child {
        border-bottom: none;
        justify-content: center;
    }

    .table-card-mobile tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.7rem;
        text-transform: uppercase;
    }

    .table-card-mobile tbody td:first-child {
        position: static;
        background: transparent;
    }
}

/* DataTables specific mobile fixes */
@media (max-width: 576px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-bottom: 0.5rem;
    }

    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin: 0.25rem 0;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 0.5rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3rem 0.6rem;
        margin: 0.1rem;
    }
}

/* --------------------------------------------
   Modals - Mobile Full Screen
   -------------------------------------------- */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

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

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-header .modal-title {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 45%;
    }

    /* Modal form inputs */
    .modal-body .form-control,
    .modal-body .form-select {
        font-size: 16px; /* Prevents iOS zoom */
    }

    .modal-body .row > [class*="col-md-6"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* --------------------------------------------
   Forms - Mobile Optimizations
   -------------------------------------------- */
@media (max-width: 576px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.6rem 0.75rem;
    }

    .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }

    .form-text {
        font-size: 0.75rem;
    }

    /* Stack form columns */
    .row > [class*="col-md-6"],
    .row > [class*="col-md-4"],
    .row > [class*="col-lg-6"],
    .row > [class*="col-lg-4"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .mb-3 {
        margin-bottom: 0.75rem !important;
    }

    /* File inputs */
    .form-control[type="file"] {
        font-size: 0.8rem;
    }
}

/* --------------------------------------------
   Buttons - Touch Friendly
   -------------------------------------------- */
@media (max-width: 576px) {
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-height: 44px; /* Apple's recommended touch target */
    }

    .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        min-height: 36px;
    }

    .btn-lg {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }

    /* Button groups stack on very small screens */
    .btn-group {
        flex-wrap: wrap;
    }

    /* Action button rows */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    .d-flex.gap-2 .btn {
        flex: 1;
        min-width: 45%;
    }
}

/* --------------------------------------------
   Badges - Mobile Sizing
   -------------------------------------------- */
@media (max-width: 576px) {
    .badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Status badges in tables */
    .table .badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.65rem;
    }
}

/* --------------------------------------------
   Dropdowns - Mobile Touch Friendly
   -------------------------------------------- */
@media (max-width: 576px) {
    .dropdown-menu {
        font-size: 0.9rem;
    }

    .dropdown-item {
        padding: 0.6rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* --------------------------------------------
   Alerts - Mobile Sizing
   -------------------------------------------- */
@media (max-width: 576px) {
    .alert {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .alert-dismissible .btn-close {
        padding: 1rem 0.75rem;
    }
}

/* --------------------------------------------
   Utility Classes for Mobile
   -------------------------------------------- */
@media (max-width: 576px) {
    .mobile-hidden {
        display: none !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-stack {
        flex-direction: column !important;
    }

    .mobile-p-1 {
        padding: 0.5rem !important;
    }

    .mobile-mb-1 {
        margin-bottom: 0.5rem !important;
    }
}

@media (max-width: 768px) {
    .tablet-hidden,
    .hide-tablet {
        display: none !important;
    }
}

@media (max-width: 576px) {
    .hide-mobile {
        display: none !important;
    }
}

/* --------------------------------------------
   Loading Spinner - Mobile
   -------------------------------------------- */
@media (max-width: 576px) {
    .loading-spinner {
        padding: 1.5rem;
        width: 80%;
        max-width: 200px;
    }
}

/* --------------------------------------------
   Touch Enhancements
   -------------------------------------------- */
@media (pointer: coarse) {
    /* Larger touch targets for touch devices */
    .nav-item {
        padding: 1rem 1.5rem;
    }

    .btn {
        min-height: 44px;
    }

    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
    }

    /* Prevent double-tap zoom on buttons */
    .btn,
    .nav-item,
    .dropdown-item {
        touch-action: manipulation;
    }

    /* Smooth scrolling for touch */
    .sidebar,
    .modal-body,
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* --------------------------------------------
   Landscape Phone Adjustments
   -------------------------------------------- */
@media (max-width: 896px) and (max-height: 450px) and (orientation: landscape) {
    .sidebar {
        width: 50px;
    }

    .sidebar .nav-item span {
        display: none;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 0.5rem;
    }

    .main-content {
        margin-left: 50px;
    }

    .modal-content {
        min-height: auto;
    }

    .modal-body {
        max-height: 60vh;
    }
}

/* --------------------------------------------
   Print Styles (hide nav on print)
   -------------------------------------------- */
@media print {
    .sidebar,
    .navbar-custom,
    .btn,
    .modal-footer {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
    }
}

/* --------------------------------------------
   Drawing Viewer Styles
   -------------------------------------------- */
.drawing-viewer-container {
    margin-left: -250px;
    margin-top: -20px;
    padding: 0 !important;
    width: calc(100% + 250px);
    position: relative;
}

@media (max-width: 991.98px) {
    .drawing-viewer-container {
        margin-left: 0;
        width: 100%;
    }
}

.drawing-toolbar {
    border-bottom: 1px solid #374151;
}

.drawing-tools {
    min-width: 60px;
    flex-shrink: 0;
}

.drawing-tools .tool-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawing-tools .tool-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.drawing-canvas-container {
    cursor: default;
}

.drawing-canvas-container.pan-mode {
    cursor: grab;
}

.drawing-canvas-container.pan-mode:active {
    cursor: grabbing;
}

.drawing-info {
    flex-shrink: 0;
}

.drawing-info h6 {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.drawing-info .table-sm th {
    font-weight: 500;
    color: #6c757d;
    width: 80px;
}

#pdf-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

#pdf-canvas {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: white;
}

#markup-canvas {
    pointer-events: auto;
}

/* Drawing Card Styles */
.drawing-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.drawing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.drawing-card .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
}

/* Discipline Badge Colors */
.badge-discipline-G { background-color: #6c757d !important; }
.badge-discipline-C { background-color: #795548 !important; }
.badge-discipline-A { background-color: #2196F3 !important; }
.badge-discipline-S { background-color: #F44336 !important; }
.badge-discipline-M { background-color: #4CAF50 !important; }
.badge-discipline-P { background-color: #00BCD4 !important; }
.badge-discipline-E { background-color: #FFC107 !important; color: #000 !important; }
.badge-discipline-FP { background-color: #FF5722 !important; }
.badge-discipline-L { background-color: #8BC34A !important; }
.badge-discipline-I { background-color: #9C27B0 !important; }
.badge-discipline-T { background-color: #607D8B !important; }

/* AI Status Badge Styles */
.badge-ai-pending { background-color: #6c757d; }
.badge-ai-processing { background-color: #17a2b8; }
.badge-ai-completed { background-color: #28a745; }
.badge-ai-failed { background-color: #dc3545; }

/* 3D Viewer Styles */
#3d-viewer-container {
    position: relative;
}

#3d-viewer-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Layer Toggle Styles */
.layer-toggle:checked + label {
    font-weight: 600;
}

/* Revision History Styles */
.revision-item {
    border-left: 3px solid #dee2e6;
    padding-left: 1rem;
    margin-bottom: 0.5rem;
}

.revision-item.current {
    border-left-color: var(--primary);
}

.revision-item.approved {
    border-left-color: var(--success);
}

.revision-item.rejected {
    border-left-color: var(--danger);
}

/* Drawing Set Styles */
.drawing-set-card {
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.drawing-set-card:hover {
    border-color: var(--primary);
}

/* Link Badge Styles */
.link-badge-rfi { background-color: #17a2b8; }
.link-badge-submittal { background-color: #6c757d; }
.link-badge-change_order { background-color: #ffc107; color: #000; }
.link-badge-asi { background-color: #28a745; }

/* Markup Tool Button States */
.tool-btn[data-tool="freehand"].active i,
.tool-btn[data-tool="line"].active i,
.tool-btn[data-tool="arrow"].active i,
.tool-btn[data-tool="rectangle"].active i,
.tool-btn[data-tool="circle"].active i,
.tool-btn[data-tool="cloud"].active i,
.tool-btn[data-tool="text"].active i {
    color: white;
}

/* Country Code Dropdown */
.country-code-dropdown {
    position: relative;
    flex-shrink: 0;
}

.country-code-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.375rem 0.5rem;
    font-size: 0.95rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-right: none;
    border-radius: 0.375rem 0 0 0.375rem;
    cursor: pointer;
    height: 38px;
    min-width: 75px;
}

.country-code-toggle:hover {
    background: #f8f9fa;
}

.country-code-toggle .country-flag {
    font-size: 1.2rem;
    line-height: 1;
}

.country-code-toggle .country-dial {
    font-size: 0.85rem;
    color: #495057;
}

.country-code-toggle i {
    font-size: 0.7rem;
    color: #6c757d;
    margin-left: 2px;
}

.country-code-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    min-width: 120px;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 2px;
}

.country-code-menu.show {
    display: block;
}

.country-code-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
}

.country-code-item:hover {
    background: #e9ecef;
}

/* Fix input group styling with custom dropdown */
.input-group .country-code-dropdown + .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* ========================================
 * Presence Indicators
 * ======================================== */

.presence-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.presence-avatar:hover {
    transform: scale(1.1);
    z-index: 100 !important;
}

.presence-count {
    background: #6c757d;
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    margin-left: -10px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.presence-label {
    font-style: italic;
}

#lock-indicator .badge {
    font-size: 0.8rem;
    padding: 0.5em 0.8em;
}

/* Drawing toolbar presence - white text */
.drawing-toolbar #presence-indicator .presence-label {
    color: rgba(255,255,255,0.7) !important;
}

.drawing-toolbar #presence-indicator .presence-avatar {
    border-color: rgba(255,255,255,0.8);
}

/* =====================================================
   Comments Section Styles
   ===================================================== */

.comments-section {
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    padding-right: 10px;
}

.comment-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    border-left: 3px solid #007bff;
}

.comment-item.reply-item {
    background: #fff;
    border-left-color: #6c757d;
    margin-left: 20px;
}

.comment-author {
    color: #333;
}

.comment-content {
    color: #555;
    line-height: 1.5;
    word-wrap: break-word;
}

.mention-tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.comment-actions .btn-link {
    padding: 0 4px;
}

.comment-footer .btn {
    padding: 2px 8px;
    font-size: 0.85rem;
}

.reaction-btn {
    padding: 2px 8px !important;
    font-size: 0.85rem;
    border-radius: 20px;
}

.reaction-btn:hover {
    background: #e9ecef;
}

.reaction-picker {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    gap: 4px;
    z-index: 1000;
}

.reaction-option {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.reaction-option:hover {
    background: #f0f0f0;
    transform: scale(1.2);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f4f8;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: #666;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mention Dropdown */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-bottom: 4px;
}

.mention-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.mention-option:last-child {
    border-bottom: none;
}

.mention-option:hover {
    background: #f8f9fa;
}

.mention-option strong {
    display: block;
}

.mention-option .text-muted {
    font-size: 0.85rem;
}

/* Comment Form */
.comment-form textarea {
    resize: none;
    border-radius: 8px;
}

.comment-form textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.comment-form .btn-primary {
    border-radius: 8px;
    padding: 8px 16px;
}

/* Comment Replies */
.comment-replies {
    border-left: 2px solid #e0e0e0;
    padding-left: 12px;
}

.comment-replies .btn-link {
    font-size: 0.85rem;
    padding: 0;
}

/* Scrollbar for comments */
.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ========================================
   NOTIFICATION CENTER STYLES
   ======================================== */

/* Bell icon button */
.notification-bell {
    border: none;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

.notification-bell:hover {
    background: white;
    transform: scale(1.05);
}

.notification-bell:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Badge animation for new notifications */
.notification-badge {
    animation: none;
    min-width: 16px;
    border-radius: 10px;
}

.notification-badge.pulse {
    animation: badge-pulse 1s ease-in-out 3;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Dropdown styling */
.notification-dropdown {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 0;
}

.notification-header {
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
}

.notification-header h6 {
    font-weight: 600;
    color: #1e293b;
}

/* Individual notification items */
.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.notification-item:hover {
    background-color: #f8fafc;
}

.notification-item.unread {
    background-color: #eff6ff;
}

.notification-item.unread:hover {
    background-color: #dbeafe;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
    font-size: 14px;
}

.notification-icon.approval {
    background: #dcfce7;
    color: #16a34a;
}

.notification-icon.comment {
    background: #dbeafe;
    color: #2563eb;
}

.notification-icon.assignment {
    background: #fef3c7;
    color: #d97706;
}

.notification-icon.status {
    background: #e0e7ff;
    color: #4f46e5;
}

.notification-icon.safety {
    background: #fee2e2;
    color: #dc2626;
}

.notification-icon.document {
    background: #f3e8ff;
    color: #9333ea;
}

.notification-icon.report {
    background: #ccfbf1;
    color: #0d9488;
}

.notification-icon.default {
    background: #f1f5f9;
    color: #64748b;
}

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

.notification-title {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 2px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-message {
    font-size: 12px;
    color: #64748b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.notification-actions {
    display: none;
    flex-shrink: 0;
    margin-left: 8px;
}

.notification-item:hover .notification-actions {
    display: flex;
}

.notification-item .mark-read-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #64748b;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.notification-item .mark-read-btn:hover {
    background: #2563eb;
    color: white;
}

/* Unread indicator dot */
.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    flex-shrink: 0;
    margin-left: 8px;
    margin-top: 4px;
}

/* Empty state */
.notification-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.notification-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.notification-empty p {
    margin: 0;
    font-size: 14px;
}

/* Footer */
.notification-footer {
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

.notification-footer a {
    color: #2563eb;
    font-weight: 500;
}

.notification-footer a:hover {
    color: #1d4ed8;
}

/* Priority indicators */
.notification-item.high-priority {
    border-left: 3px solid #f59e0b;
}

.notification-item.urgent-priority {
    border-left: 3px solid #dc2626;
}

/* Loading state */
#notification-loading {
    color: #94a3b8;
}

/* Full notifications page styles */
.notifications-page .notification-item {
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
}

.notifications-page .notification-item:hover {
    border-color: #cbd5e1;
}

/* Notification preferences modal */
.notification-pref-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.notification-pref-info {
    flex: 1;
}

.notification-pref-name {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 2px;
}

.notification-pref-desc {
    font-size: 12px;
    color: #64748b;
}

.notification-pref-controls {
    display: flex;
    gap: 16px;
}

.notification-pref-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #64748b;
}

.notification-pref-toggle label {
    margin-bottom: 4px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .notification-dropdown {
        width: 100vw !important;
        max-width: 100vw !important;
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
        max-height: 70vh !important;
    }

    .notification-list {
        max-height: 50vh !important;
    }
}

/* ========================================
   EMAIL MODULE STYLES
   ======================================== */

.email-module {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.email-sidebar {
    width: 200px;
    min-width: 200px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.email-folders {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.email-folder {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    color: #475569;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.email-folder:hover {
    background: #e2e8f0;
}

.email-folder.active {
    background: var(--primary);
    color: white;
}

.email-folder i {
    margin-right: 0.5rem;
    width: 18px;
}

.email-folder .unread-badge,
.email-folder .pending-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.email-folder.active .unread-badge,
.email-folder.active .pending-badge {
    background: rgba(255,255,255,0.3);
}

.email-account-info {
    font-size: 0.75rem;
}

.email-list-container {
    width: 350px;
    min-width: 300px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
}

.project-email-banner {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-bottom: 1px solid #bae6fd;
}

.project-email-banner .project-email-address {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0369a1;
    word-break: break-all;
}

.project-email-banner .btn-outline-secondary {
    border-color: #7dd3fc;
    color: #0284c7;
}

.project-email-banner .btn-outline-secondary:hover {
    background: #0284c7;
    border-color: #0284c7;
    color: white;
}

.email-list-header {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.email-search {
    flex: 1;
}

.email-search input {
    font-size: 0.875rem;
}

.email-list {
    flex: 1;
    overflow-y: auto;
}

.email-item {
    display: flex;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}

.email-item:hover {
    background: #f8fafc;
}

.email-item-star {
    flex-shrink: 0;
    width: 24px;
    margin-right: 0.5rem;
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
}

.email-item-star i {
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.15s;
}

.email-item-star i:hover {
    transform: scale(1.2);
}

.email-item-star .fa-star {
    color: #cbd5e1;
}

.email-item-star .far.fa-star:hover {
    color: #fbbf24;
}

.email-item-star .fas.fa-star {
    color: #fbbf24;
}

.email-item-content {
    flex: 1;
    min-width: 0;
}

.email-item.selected {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
}

.email-item.unread {
    background: #fefce8;
}

.email-item.unread .email-sender,
.email-item.unread .email-subject {
    font-weight: 600;
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.email-sender {
    font-size: 0.875rem;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.email-date {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
}

.email-subject {
    font-size: 0.875rem;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.email-snippet {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-pagination {
    padding: 0.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
}

.email-detail-container {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}

.email-detail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
}

.email-detail {
    padding: 1.5rem;
}

.email-detail-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.email-detail-actions {
    display: flex;
    gap: 0.5rem;
}

.email-detail-subject {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

.email-detail-meta {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.email-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.email-from-name {
    font-weight: 600;
    color: #1e293b;
}

.email-attachments {
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.attachment-item:hover {
    background: #f0f7ff;
    border-color: #3b82f6;
}

.attachment-item .bi-download {
    opacity: 0;
    transition: opacity 0.2s;
}

.attachment-item:hover .bi-download {
    opacity: 1;
}

.email-body-container {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.email-body-frame {
    width: 100%;
    min-height: 300px;
    border: none;
}

.email-body-text {
    padding: 1rem;
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    background: white;
}

.pending-approval-item {
    background: #fffbeb;
    border-left: 3px solid var(--warning);
}

.email-approval-actions {
    display: flex;
    gap: 0.5rem;
}

/* Email module responsive */
@media (max-width: 992px) {
    .email-module {
        flex-direction: column;
        height: auto;
    }

    .email-sidebar {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.5rem;
    }

    .email-folders {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .email-account-info {
        display: none;
    }

    .email-list-container {
        width: 100%;
        min-width: 100%;
        max-height: 300px;
    }

    .email-detail-container {
        min-height: 400px;
    }
}

/* ==========================================
   RIGHT SIDEBAR - Widget Panel
   ========================================== */

.right-sidebar {
    width: 280px;
    background: white;
    height: calc(100vh - 80px);
    position: fixed;
    right: 0;
    top: 80px;
    border-left: 1px solid #e2e8f0;
    overflow-y: auto;
    padding: 0;
    z-index: 1019;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: -2px 0 8px rgba(0,0,0,0.05);
}

.right-sidebar.collapsed {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.right-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    position: sticky;
    top: 0;
    z-index: 10;
}

.right-sidebar-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    background: white;
    border: 1px solid #e2e8f0;
    border-right: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    z-index: 1018;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
}

.right-sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--primary);
}

/* Sidebar Widgets */
.sidebar-widget {
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.widget-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.875rem;
    color: #334155;
    border-bottom: 1px solid #e2e8f0;
}

.widget-body {
    padding: 1rem 1.25rem;
}

/* Sidebar Activity Clickable Items */
.sidebar-activity-clickable:hover {
    background-color: #f1f5f9;
}

.sidebar-activity-item {
    transition: background-color 0.15s ease;
}

/* Dashboard Customization Modal Styles */
.customize-column {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    height: 100%;
}

.customize-column-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.customize-widget-list {
    min-height: 200px;
    padding: 0.5rem;
    background: #f8f9fa;
    transition: background-color 0.2s ease;
}

.customize-widget-list.drag-over {
    background-color: #e3f2fd;
}

.customize-widget-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.customize-widget-item:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.customize-widget-item:active {
    cursor: grabbing;
}

.customize-widget-item.dragging {
    opacity: 0.5;
    background: #e3f2fd;
    border-color: #0d6efd;
}

.customize-widget-item .drag-handle {
    cursor: grab;
}

.customize-widget-item:last-child {
    margin-bottom: 0;
}

.customize-empty-hint {
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    border: 2px dashed #dee2e6;
    border-radius: 0.375rem;
    margin: 0.5rem 0;
}

.sidebar-widget-placeholder {
    padding: 2rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

/* Weather Widget Specific Styles */
.weather-current {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.weather-icon {
    font-size: 3rem;
    color: #0ea5e9;
}

.weather-temp {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.weather-temp small {
    font-size: 1rem;
    font-weight: 400;
    color: #64748b;
}

.weather-condition {
    font-size: 0.875rem;
    color: #64748b;
    text-transform: capitalize;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
}

.weather-detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weather-detail-item i {
    width: 16px;
    text-align: center;
    color: #94a3b8;
}

.weather-location {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weather-updated {
    font-size: 0.7rem;
    color: #a1a1aa;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.weather-forecast {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.weather-forecast-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.forecast-days {
    display: flex;
    justify-content: space-between;
}

.forecast-day {
    text-align: center;
    flex: 1;
}

.forecast-day-name {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.forecast-day-icon {
    font-size: 1.25rem;
    color: #0ea5e9;
    margin: 0.25rem 0;
}

.forecast-day-temp {
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
}

.forecast-day-temp span {
    color: #94a3b8;
    font-weight: 400;
}

/* Weather condition icons mapping */
.weather-sunny { color: #f59e0b; }
.weather-cloudy { color: #64748b; }
.weather-rainy { color: #0ea5e9; }
.weather-stormy { color: #6366f1; }
.weather-snowy { color: #e2e8f0; }
.weather-foggy { color: #94a3b8; }

/* Main Dashboard Weather Widget (Extended Forecast) */
.main-weather-widget {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.current-weather-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.current-weather-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.current-weather-icon {
    font-size: 3rem;
    color: #0ea5e9;
}

.current-temp {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.current-temp small {
    font-size: 1rem;
    font-weight: 400;
    color: #64748b;
}

.current-condition {
    font-size: 0.95rem;
    color: #64748b;
    text-transform: capitalize;
}

.current-weather-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.current-weather-details .detail-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: #475569;
}

.weather-location-small {
    font-size: 0.85rem;
    color: #94a3b8;
}

.forecast-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.forecast-label {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
}

/* Main dashboard forecast grid */
.main-forecast-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.main-forecast-grid.extended {
    grid-template-columns: repeat(5, 1fr);
}

@media (min-width: 768px) {
    .main-forecast-grid.extended {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media (min-width: 1200px) {
    .main-forecast-grid.extended {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
}

.main-forecast-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.25rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.main-forecast-day:hover {
    background: #f1f5f9;
}

.main-forecast-day .forecast-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
}

.main-forecast-day .forecast-date-full {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.main-forecast-day .forecast-icon {
    font-size: 1.5rem;
    margin: 0.25rem 0;
}

.main-forecast-day .forecast-temps {
    font-size: 0.8rem;
    display: flex;
    gap: 0.25rem;
}

.main-forecast-day .forecast-temps .high {
    font-weight: 600;
    color: #ef4444;
}

.main-forecast-day .forecast-temps .low {
    color: #3b82f6;
}

.main-forecast-day .forecast-precip {
    font-size: 0.65rem;
    color: #0ea5e9;
    margin-top: 0.25rem;
}

.weather-updated-small {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
}

/* Extended Forecast Modal Styles */
.extended-forecast-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.extended-current-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.extended-current-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.extended-current-icon {
    font-size: 3.5rem;
    color: #0ea5e9;
}

.extended-current-temp {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.extended-current-condition {
    font-size: 1rem;
    color: #64748b;
    text-transform: capitalize;
}

.extended-current-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.extended-current-details .detail {
    font-size: 0.9rem;
    color: #475569;
}

.extended-location {
    font-size: 0.9rem;
    color: #94a3b8;
}

.extended-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.selector-label {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
}

/* Extended forecast grid */
.extended-forecast-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.75rem !important;
}

.extended-forecast-grid.days-5 {
    grid-template-columns: repeat(5, 1fr) !important;
}

.extended-forecast-grid.days-10 {
    grid-template-columns: repeat(5, 1fr) !important;
}

.extended-forecast-grid.days-15 {
    grid-template-columns: repeat(5, 1fr) !important;
}

@media (min-width: 768px) {
    .extended-forecast-grid.days-5 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .extended-forecast-grid.days-10 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .extended-forecast-grid.days-15 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@media (min-width: 992px) {
    .extended-forecast-grid.days-10 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .extended-forecast-grid.days-15 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@media (min-width: 1200px) {
    .extended-forecast-grid.days-10 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .extended-forecast-grid.days-15 {
        grid-template-columns: repeat(8, 1fr) !important;
    }
}

/* Main dashboard forecast grid - percentage based widths */
.main-forecast-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.5rem !important;
}

.main-forecast-grid.extended {
    grid-template-columns: repeat(5, 1fr) !important;
}

@media (min-width: 768px) {
    .main-forecast-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .main-forecast-grid.extended {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@media (min-width: 1200px) {
    .main-forecast-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    .main-forecast-grid.extended {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

.extended-forecast-day {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 1rem 0.5rem !important;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border-radius: 0.75rem !important;
    border: 1px solid #e2e8f0 !important;
    transition: all 0.2s ease !important;
    min-height: 180px !important;
}

.extended-forecast-day:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.extended-day-name {
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.extended-day-date {
    font-size: 0.75rem !important;
    color: #64748b !important;
    margin-bottom: 0.5rem !important;
}

.extended-day-icon {
    font-size: 2rem !important;
    margin: 0.5rem 0 !important;
}

.extended-day-condition {
    font-size: 0.7rem !important;
    color: #475569 !important;
    text-align: center !important;
    margin-bottom: 0.5rem !important;
    min-height: 1.2em !important;
    font-weight: 500 !important;
}

.extended-day-temps {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem !important;
    font-size: 0.9rem !important;
    margin: 0.25rem 0 !important;
}

.extended-day-temps .high {
    color: #dc2626 !important;
    font-weight: 700 !important;
}

.extended-day-temps .high i {
    color: #dc2626 !important;
    font-size: 0.7rem !important;
}

.extended-day-temps .low {
    color: #2563eb !important;
    font-weight: 600 !important;
}

.extended-day-temps .low i {
    color: #2563eb !important;
    font-size: 0.7rem !important;
}

.extended-day-precip {
    font-size: 0.75rem !important;
    color: #0ea5e9 !important;
    margin-top: 0.35rem !important;
    font-weight: 500 !important;
}

.extended-day-precip i {
    margin-right: 0.25rem !important;
}

.extended-day-wind {
    font-size: 0.7rem !important;
    color: #64748b !important;
    margin-top: 0.25rem !important;
}

.extended-day-wind i {
    margin-right: 0.25rem !important;
}

.extended-footer {
    text-align: center;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

/* Weather stat boxes in modal */
.weather-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    min-width: 70px;
}

.weather-stat i {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.weather-stat span {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.weather-stat small {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* Adjust main content when right sidebar is visible */
@media (min-width: 1200px) {
    .main-content.with-right-sidebar {
        margin-right: 280px;
    }
}

/* Responsive - hide right sidebar on smaller screens */
@media (max-width: 1199px) {
    .right-sidebar {
        display: none;
    }

    .right-sidebar-toggle {
        display: none !important;
    }
}

/* Impersonation mode adjustments for right sidebar */
body.impersonating .right-sidebar {
    top: 120px;
    height: calc(100vh - 120px);
}

/* ==========================================
   SUPERADMIN SIDEBAR NAVIGATION
   ========================================== */

.superadmin-sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    height: calc(100vh - 80px);
    position: fixed;
    right: 0;
    top: 80px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    box-shadow: -4px 0 15px rgba(0,0,0,0.2);
}

.superadmin-sidebar-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0,0,0,0.2);
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.superadmin-sidebar-nav {
    padding: 12px 0;
}

.superadmin-sidebar .nav-group {
    margin-bottom: 4px;
}

.superadmin-sidebar .nav-group-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.superadmin-sidebar .nav-group-header:hover {
    background: rgba(255,255,255,0.05);
    color: #e2e8f0;
}

.superadmin-sidebar .nav-group-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.superadmin-sidebar .nav-group-header[aria-expanded="false"] .nav-group-arrow,
.superadmin-sidebar .nav-group-header.collapsed .nav-group-arrow {
    transform: rotate(-90deg);
}

.superadmin-sidebar .nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 44px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.superadmin-sidebar .nav-item i {
    width: 20px;
    margin-right: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.superadmin-sidebar .nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: rgba(59, 130, 246, 0.5);
}

.superadmin-sidebar .nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-left-color: #3b82f6;
    font-weight: 500;
}

/* Group-specific accent colors */
.superadmin-sidebar .nav-group:nth-child(1) .nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-left-color: #3b82f6;
}

.superadmin-sidebar .nav-group:nth-child(2) .nav-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-left-color: #10b981;
}

.superadmin-sidebar .nav-group:nth-child(3) .nav-item.active {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border-left-color: #f97316;
}

.superadmin-sidebar .nav-group:nth-child(4) .nav-item.active {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border-left-color: #a855f7;
}

.superadmin-sidebar .nav-group:nth-child(5) .nav-item.active {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border-left-color: #ec4899;
}

/* Scrollbar styling for superadmin sidebar */
.superadmin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.superadmin-sidebar::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

.superadmin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.superadmin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Adjust main content when superadmin sidebar is visible */
@media (min-width: 1200px) {
    .main-content.with-superadmin-sidebar {
        margin-right: 280px;
    }
}

/* Responsive - hide superadmin sidebar on smaller screens */
@media (max-width: 1199px) {
    .superadmin-sidebar {
        display: none !important;
    }
}

/* Impersonation mode adjustments for superadmin sidebar */
body.impersonating .superadmin-sidebar {
    top: 120px;
    height: calc(100vh - 120px);
}

/* ============================================
   Company Admin Sidebar Styles
   (Matches superadmin-sidebar styling)
   ============================================ */
.company-admin-sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    height: calc(100vh - 80px);
    position: fixed;
    right: 0;
    top: 80px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    box-shadow: -4px 0 15px rgba(0,0,0,0.2);
}

.company-admin-sidebar-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0,0,0,0.2);
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.company-admin-sidebar-nav {
    padding: 12px 0;
}

.company-admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.company-admin-sidebar .nav-item i {
    width: 20px;
    margin-right: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.company-admin-sidebar .nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: rgba(59, 130, 246, 0.5);
}

.company-admin-sidebar .nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-left-color: #3b82f6;
    font-weight: 500;
}

/* Scrollbar for company admin sidebar */
.company-admin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.company-admin-sidebar::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

.company-admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.company-admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Adjust main content when company admin sidebar is visible */
@media (min-width: 1200px) {
    .main-content.with-company-admin-sidebar {
        margin-right: 280px;
    }
}

/* Responsive - hide company admin sidebar on smaller screens */
@media (max-width: 1199px) {
    .company-admin-sidebar {
        display: none !important;
    }
}

/* Impersonation mode adjustments for company admin sidebar */
body.impersonating .company-admin-sidebar {
    top: 120px;
    height: calc(100vh - 120px);
}

/* ============================================
   Profile Sidebar Styles
   (Matches header gradient theme #667eea to #764ba2)
   ============================================ */
.profile-sidebar {
    width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: calc(100vh - 80px);
    position: fixed;
    right: 0;
    top: 80px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    box-shadow: -4px 0 15px rgba(0,0,0,0.2);
}

.profile-sidebar-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #667eea;
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.profile-sidebar-nav {
    padding: 12px 0;
}

.profile-sidebar .nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.profile-sidebar .nav-item i {
    width: 20px;
    margin-right: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.profile-sidebar .nav-item:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left-color: rgba(255,255,255,0.5);
}

.profile-sidebar .nav-item.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-left-color: #fff;
    font-weight: 500;
}

/* Scrollbar for profile sidebar */
.profile-sidebar::-webkit-scrollbar {
    width: 6px;
}

.profile-sidebar::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.profile-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.profile-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.4);
}

/* Adjust main content when profile sidebar is visible */
@media (min-width: 1200px) {
    .main-content.with-profile-sidebar {
        margin-right: 280px;
    }
}

/* Responsive - hide profile sidebar on smaller screens */
@media (max-width: 1199px) {
    .profile-sidebar {
        display: none !important;
    }
}

/* Impersonation mode adjustments for profile sidebar */
body.impersonating .profile-sidebar {
    top: 120px;
    height: calc(100vh - 120px);
}


/* Change Order Card List Styles */
.co-card {
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.co-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.co-list .badge {
    font-size: 0.7rem;
}


/* COR Card List Styles */
.cor-card {
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.cor-card:hover {
    border-color: var(--info);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.15);
    transform: translateY(-1px);
}

.cor-list .badge {
    font-size: 0.7rem;
}


/* Submittal Card List Styles */
.submittal-card {
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.submittal-card:hover {
    border-color: var(--success);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
    transform: translateY(-1px);
}

.submittal-list .badge {
    font-size: 0.7rem;
}


/* Report Card List Styles */
.report-card {
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.report-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.report-list .badge {
    font-size: 0.7rem;
}


/* Team Member Card List Styles */
.team-member-card {
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.team-member-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

.team-members-list .badge {
    font-size: 0.7rem;
}

.team-members-list .avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-members-list .avatar-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.team-members-list .min-width-0 {
    min-width: 0;
}


/* Task Card List Styles */
.task-card {
    transition: all 0.15s ease;
}

.task-card:hover {
    border-color: #0d6efd !important;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.task-card.selected {
    background: #e7f1ff !important;
    border-color: #0d6efd !important;
}

/* Task Card Drag and Drop */
.task-card .drag-handle {
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.task-card:hover .drag-handle {
    opacity: 1;
}

.task-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.task-card.drag-over-top {
    border-top: 3px solid #0d6efd !important;
    margin-top: 3px;
}

.task-card.drag-over-bottom {
    border-bottom: 3px solid #0d6efd !important;
    margin-bottom: 3px;
}

/* Drag handle grab cursor */
.task-card[draggable="true"] {
    cursor: default;
}

.task-card[draggable="true"] .drag-handle:hover {
    cursor: grab;
}

.task-card[draggable="true"] .drag-handle:active {
    cursor: grabbing;
}

#task-list .badge {
    font-size: 0.7rem;
}

#task-list .btn-group .btn {
    padding: 2px 6px;
}

#task-list .progress {
    border-radius: 3px;
}

/* Task Progress Inline Editor */
.task-progress-container {
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

.task-progress-container:hover {
    background: #e9ecef;
}

.task-progress-container .progress-slider {
    height: 8px;
    padding: 0;
    margin: 0;
}

.task-progress-container .progress-slider::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.task-progress-container .progress-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Company Selection Cards (Superadmin) */
.company-select-card {
    transition: all 0.2s ease;
}

.company-select-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.company-select-card h6 {
    color: #1e293b;
    font-weight: 600;
}

/* Company Hierarchy Sections */
.company-hierarchy-section {
    position: relative;
    padding-left: 12px;
    border-left: 2px solid #e2e8f0;
}

.company-hierarchy-section[data-type="owner"] {
    border-left-color: var(--primary);
}

.company-hierarchy-section[data-type="gc"] {
    border-left-color: var(--success);
}

.company-hierarchy-section[data-type="consultant"] {
    border-left-color: var(--info);
}

.company-hierarchy-section[data-type="subcontractor"] {
    border-left-color: var(--warning);
}

.company-hierarchy-section[data-type="vendor"] {
    border-left-color: var(--secondary);
}

.hierarchy-connector {
    width: 12px;
    height: 2px;
    background-color: #e2e8f0;
    margin-left: -12px;
}

.min-width-0 {
    min-width: 0;
}

/* ============================
   Project Schedule / Gantt Chart
   ============================ */

#gantt-container {
    overflow: auto;
    background: #fff;
}

.gantt-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

.gantt-row:hover {
    background-color: #f8f9fa !important;
}

.gantt-bar {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.gantt-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* Critical path highlighting */
.table-danger .gantt-bar,
.gantt-row.critical .gantt-bar {
    animation: critical-pulse 2s infinite;
}

@keyframes critical-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Task status colors for table */
#task-table tr[data-task-id] {
    transition: background-color 0.15s ease;
}

#task-table tr[data-task-id]:hover {
    background-color: #e3f2fd !important;
}

/* Schedule stats cards */
#schedule-stats .card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#schedule-stats .card.stat-card-clickable {
    cursor: pointer;
}

#schedule-stats .card.stat-card-clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#schedule-stats .card:hover {
    transform: translateY(-2px);
}

/* Schedule tabs styling - compact tabbed folder look */
#scheduleTabs {
    border-bottom: 2px solid #dee2e6;
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0;
    margin: 0;
}

#scheduleTabs .nav-item {
    margin: 0;
}

#scheduleTabs .nav-link {
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: #6c757d;
    margin: 0;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s ease;
}

#scheduleTabs .nav-link i {
    font-size: 0.8rem;
}

#scheduleTabs .nav-link:hover {
    background: #f8f9fa;
    color: #495057;
    border-color: #dee2e6 #dee2e6 transparent;
}

#scheduleTabs .nav-link.active {
    background: #fff;
    color: #0d6efd;
    border-color: #dee2e6 #dee2e6 #fff;
    border-width: 1px;
    border-style: solid;
}

#scheduleTabContent > .tab-pane > .card {
    border-radius: 0 0 6px 6px;
    border-top: none;
}

/* Milestone icon styling */
.fa-diamond {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Today indicator in Gantt header */
.gantt-today-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 5;
}

/* Dependency lines */
.dependency-line {
    stroke: #666;
    stroke-width: 2;
    fill: none;
    transition: stroke-width 0.15s ease, stroke-opacity 0.15s ease;
}

.dependency-line:hover {
    stroke-width: 4 !important;
    stroke-opacity: 1 !important;
}

.dependency-line.critical {
    stroke: var(--danger);
    stroke-width: 2;
}

/* Dependency connection handles on task bars */
.gantt-bar:hover .dep-handle,
.gantt-summary-bar:hover .dep-handle {
    opacity: 1 !important;
}

.dep-handle:hover {
    transform: translateY(-50%) scale(1.3) !important;
}

/* Drop target highlighting during dependency drag */
.dep-drop-target {
    outline: 2px dashed #6c757d;
    outline-offset: 2px;
}

.dep-drop-highlight {
    outline: 3px solid #28a745 !important;
    outline-offset: 2px;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5) !important;
}

/* Dependency SVG layer */
.dependency-svg {
    pointer-events: none;
}

.dependency-svg .dependency-line {
    pointer-events: stroke;
}

/* Dependency popover */
.dependency-popover {
    animation: popoverFadeIn 0.15s ease;
}

@keyframes popoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TRAINING SYSTEM STYLES
   Interactive onboarding tours with tooltips
   ============================================ */

/* Training Overlay - dark background, NO blur */
.training-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    transition: opacity 0.3s ease;
    /* clip-path creates the cutout hole - set dynamically via JS */
}

/* Training Click Blocker - transparent overlay to prevent clicks outside tour elements */
.training-click-blocker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: transparent;
    cursor: not-allowed;
}

/* When training is active, block clicks on the main content */
body.training-active .main-content,
body.training-active .sidebar,
body.training-active .top-navbar {
    pointer-events: none;
}

/* But allow clicks on the highlighted target element */
body.training-active .training-target-active {
    pointer-events: auto !important;
    position: relative;
    z-index: 10001;
    cursor: pointer;
}

/* Training Highlight Box */
.training-highlight {
    position: absolute;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid var(--primary);
    border-radius: 8px;
    box-shadow:
        0 0 0 4px rgba(37, 99, 235, 0.2),
        0 4px 20px rgba(0, 0, 0, 0.3);
    animation: highlightPulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow:
            0 0 0 4px rgba(37, 99, 235, 0.2),
            0 4px 20px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow:
            0 0 0 8px rgba(37, 99, 235, 0.3),
            0 4px 30px rgba(0, 0, 0, 0.4);
    }
}

/* Training Tooltip */
.training-tooltip {
    position: fixed;
    z-index: 10002;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 340px;
    max-width: 90vw;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.training-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.training-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.training-tooltip-title {
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.training-tooltip-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.25rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.training-tooltip-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.training-tooltip-content {
    padding: 16px;
    color: #374151;
    line-height: 1.6;
    font-size: 0.9rem;
}

.training-tooltip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

.training-tooltip-progress {
    font-size: 0.8rem;
    color: #64748b;
}

.training-tooltip-actions {
    display: flex;
    gap: 8px;
}

.training-tooltip-actions .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

/* Tooltip Arrow */
.training-tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border: 10px solid transparent;
}

.training-tooltip-arrow.arrow-top {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: white;
    border-top: none;
}

.training-tooltip-arrow.arrow-bottom {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #f8fafc;
    border-bottom: none;
}

.training-tooltip-arrow.arrow-left {
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: white;
    border-left: none;
}

.training-tooltip-arrow.arrow-right {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: white;
    border-right: none;
}

/* Training Prompt (auto-start notification) */
.training-prompt {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1050;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.training-prompt.show {
    opacity: 1;
    transform: translateX(0);
}

.training-prompt-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.training-prompt-content h6 {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: #1e293b;
}

.training-prompt-content p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

.training-prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    margin-left: auto;
}

/* Tour Selection Modal Styles */
.tour-module-group h6 {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.tour-module-group .list-group-item {
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    border-left: 3px solid transparent;
}

.tour-module-group .list-group-item:hover {
    background: #f8fafc;
    border-left-color: var(--primary);
}

.tour-module-group .list-group-item.tour-completed {
    background: #f0fdf4;
    border-left-color: #22c55e;
}

.tour-module-group .list-group-item.tour-completed h6 {
    color: #166534;
}

.tour-status-icon {
    font-size: 1.25rem;
}

.tour-step-count {
    white-space: nowrap;
}

/* Training Tab in Profile */
.training-settings-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    background: #f8fafc;
}

.training-progress-overview {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.training-progress-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--progress, 0%), #e2e8f0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.training-progress-circle::before {
    content: '';
    position: absolute;
    width: 64px;
    height: 64px;
    background: white;
    border-radius: 50%;
}

.training-progress-circle span {
    position: relative;
    z-index: 1;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--primary);
}

.training-tours-list {
    max-height: 300px;
    overflow-y: auto;
}

.training-tour-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.training-tour-item .tour-icon {
    width: 32px;
    text-align: center;
}

.training-tour-item .tour-info {
    flex: 1;
}

.training-tour-item .tour-info small {
    display: block;
    color: #64748b;
}

.training-tour-item .tour-action {
    margin-left: 8px;
}

/* Spotlight Ring - pulsing circle/box around target element */
.training-spotlight {
    position: fixed;
    z-index: 10001;
    border: 4px solid #3b82f6;
    border-radius: 8px;
    background: transparent;
    box-shadow:
        0 0 0 4px rgba(59, 130, 246, 0.4),
        0 0 20px rgba(59, 130, 246, 0.6),
        0 0 40px rgba(59, 130, 246, 0.3),
        inset 0 0 20px rgba(59, 130, 246, 0.1);
    animation: spotlightPulse 1.5s ease-in-out infinite;
    pointer-events: none;
    transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;
}

@keyframes spotlightPulse {
    0%, 100% {
        border-color: #3b82f6;
        box-shadow:
            0 0 0 4px rgba(59, 130, 246, 0.4),
            0 0 20px rgba(59, 130, 246, 0.6),
            0 0 40px rgba(59, 130, 246, 0.3),
            inset 0 0 20px rgba(59, 130, 246, 0.1);
    }
    50% {
        border-color: #60a5fa;
        box-shadow:
            0 0 0 8px rgba(96, 165, 250, 0.5),
            0 0 30px rgba(59, 130, 246, 0.8),
            0 0 60px rgba(59, 130, 246, 0.4),
            inset 0 0 30px rgba(59, 130, 246, 0.2);
    }
}

/* SVG Connector Arrow from Tooltip to Target */
.training-connector {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10005;
    pointer-events: none;
    overflow: visible;
}

.training-connector .connector-line {
    fill: none;
    stroke: #f59e0b;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawConnector 0.5s ease-out forwards;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

@keyframes drawConnector {
    to {
        stroke-dashoffset: 0;
    }
}

.training-connector .connector-pulse {
    fill: #f59e0b;
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.8));
    animation: connectorPulse 1s ease-in-out infinite;
}

@keyframes connectorPulse {
    0%, 100% {
        r: 10;
        opacity: 1;
    }
    50% {
        r: 14;
        opacity: 0.7;
    }
}

/* Arrowhead styling via SVG marker */
#training-arrowhead path {
    fill: #f59e0b;
}

/* Step Badge in Tooltip Header */
.training-tooltip-step-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-right: 8px;
}

/* Progress Bar in Tooltip */
.training-progress-bar {
    width: 80px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.training-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Step Content Hints and Actions */
.training-hint {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #92400e;
}

.training-hint i {
    color: #f59e0b;
}

.training-action {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #1e40af;
}

.training-action i {
    color: #3b82f6;
}

/* Tooltip Actions Improvements */
.training-tooltip-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.training-btn-prev,
.training-btn-next,
.training-btn-finish {
    min-width: 80px;
    justify-content: center;
}

/* Tour Card (Selection Modal) */
.tour-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tour-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.tour-card.completed {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
}

.tour-card.skipped {
    background: #fffbeb;
    border-color: #fde68a;
}

.tour-card-status {
    font-size: 1.25rem;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.tour-card-content {
    flex: 1;
    min-width: 0;
}

.tour-card-content h6 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}

.tour-card-content p {
    margin: 0;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tour-card-meta {
    flex-shrink: 0;
}

.tour-card-action {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #cbd5e1;
    transition: all 0.2s ease;
    opacity: 0;
}

.tour-card:hover .tour-card-action {
    opacity: 1;
    color: var(--primary);
}

/* Completion Celebration Overlay */
.training-celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10010;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.training-celebration.show {
    opacity: 1;
}

.celebration-content {
    text-align: center;
    color: white;
    animation: celebrationPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-content i {
    font-size: 5rem;
    color: #fbbf24;
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.5));
    animation: trophyBounce 0.6s ease-in-out infinite;
}

.celebration-content h4 {
    font-size: 2rem;
    margin: 16px 0 8px;
    font-weight: 700;
}

.celebration-content p {
    font-size: 1rem;
    opacity: 0.8;
}

@keyframes celebrationPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

/* Body class when training is active */
body.training-active {
    overflow: hidden;
}

/* ==========================================
   Document Management Styles
   ========================================== */

.documents-page {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.documents-header {
    padding: 20px 24px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.documents-toolbar {
    padding-top: 15px;
}

.documents-container {
    flex: 1;
    overflow: hidden;
}

.documents-container .row {
    height: 100%;
}

.documents-container .row > [class*="col-"] {
    height: 100%;
}

/* Folder Tree Panel */
.folder-tree-panel {
    height: 100%;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.folder-tree-header {
    padding: 12px 16px;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.folder-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    min-height: 0;
}

.folder-tree-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.folder-tree-item {
    margin: 0;
}

.folder-tree-item.active > .folder-tree-link {
    background: #e0e7ff;
}

.folder-tree-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.folder-tree-link:hover {
    background: #f1f5f9;
}

.folder-link {
    display: flex;
    align-items: center;
    flex: 1;
    text-decoration: none;
    color: #334155;
    font-size: 13px;
}

.folder-link:hover {
    color: #1e40af;
}

.folder-toggle-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    cursor: pointer;
    color: #94a3b8;
    transition: transform 0.2s;
}

.folder-toggle-btn.expanded {
    transform: rotate(90deg);
}

.folder-toggle-btn:hover {
    color: #64748b;
}

/* Folder settings button - appears on hover */
.folder-settings-btn {
    opacity: 0;
    transition: opacity 0.15s;
}

.folder-tree-link:hover .folder-settings-btn {
    opacity: 1;
}

.folder-settings-btn:hover {
    color: #475569 !important;
}

/* Private folder indicators in tree */
.folder-tree-link .fa-user-lock,
.folder-tree-link .fa-key {
    font-size: 10px;
}

/* Private folder cards in grid view */
.document-card.private-folder-owned {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border-left: 3px solid #dc3545;
}

.document-card.private-folder-shared {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 3px solid #0ea5e9;
}

.document-card .shared-by-text {
    font-size: 11px;
    color: #0ea5e9;
    margin-top: -2px;
    margin-bottom: 2px;
}

.folder-toggle-spacer {
    width: 22px;
}

.folder-tree-children {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
}

.folder-tree-children.show {
    display: block;
}

/* Documents Area */
.documents-area {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
}

.documents-breadcrumb {
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.documents-breadcrumb .breadcrumb {
    font-size: 13px;
}

.documents-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Grid View */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.document-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.document-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.document-card.folder-card {
    background: #fffbeb;
    border-color: #fcd34d;
}

.document-card.folder-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.document-card-icon {
    margin-bottom: 12px;
}

.document-card-info {
    text-align: center;
}

.document-name {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.document-meta {
    font-size: 11px;
}

.document-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.document-card:hover .document-card-actions {
    opacity: 1;
}

.document-card-actions .btn-link {
    color: #64748b;
    padding: 4px 8px;
}

.document-card-actions .btn-link:hover {
    color: #334155;
}

/* Linked Documents */
.document-card.linked-document {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 3px solid #22c55e;
}

.document-card.linked-document:hover {
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.document-card-icon {
    position: relative;
}

.linked-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Document Thumbnails - Full card image */
.document-card.has-thumbnail {
    padding: 0;
    overflow: hidden;
    aspect-ratio: 1;
    min-height: 140px;
}

.document-card.has-thumbnail .document-card-icon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}

.document-card.has-thumbnail .document-card-icon.has-thumbnail {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.document-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.document-card.has-thumbnail .document-card-info {
    display: none;
}

.document-card.has-thumbnail .document-card-actions {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    padding: 2px;
}

.document-card.has-thumbnail .document-card-actions .btn-link {
    color: white;
}

.document-card.has-thumbnail .document-card-actions .btn-link:hover {
    color: #e2e8f0;
}

/* Filename overlay on hover for thumbnail cards */
.document-card.has-thumbnail .thumbnail-filename {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 20px 8px 8px 8px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
}

.document-card.has-thumbnail:hover .thumbnail-filename {
    opacity: 1;
}

/* Non-thumbnail cards keep original small icon style */
.document-card-icon.has-thumbnail {
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
}

/* List View Thumbnails */
.document-list-thumbnail {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
}

/* ==========================================
   Image Lightbox
   ========================================== */

#imageLightboxModal .modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 10;
}

.lightbox-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lightbox-filename {
    color: white;
    font-size: 14px;
    font-weight: 500;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
}

.lightbox-actions {
    display: flex;
    gap: 8px;
}

.lightbox-btn {
    color: white;
    font-size: 18px;
    padding: 8px 12px;
    transition: all 0.2s;
}

.lightbox-btn:hover {
    color: #60a5fa;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.lightbox-image-container {
    position: relative;
    max-width: 90%;
    max-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    cursor: default;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.lightbox-nav:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-prev {
    left: 0;
    border-radius: 0 8px 8px 0;
}

.lightbox-next {
    right: 0;
    border-radius: 8px 0 0 8px;
}

.lightbox-thumbnails {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.9);
    overflow-x: auto;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.lightbox-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.lightbox-thumb:hover {
    opacity: 0.8;
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: #3b82f6;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* List View */
.documents-table {
    font-size: 13px;
    table-layout: auto !important; /* Override fixed layout for proper column sizing */
}

.documents-table th {
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.documents-table td {
    vertical-align: middle;
    overflow: visible; /* Allow dropdowns to overflow */
}

/* Name column should take available space */
.documents-table th:nth-child(2),
.documents-table td:nth-child(2) {
    width: auto;
    min-width: 200px;
    max-width: none;
}

/* Actions column - allow dropdown to overflow */
.documents-table th:last-child,
.documents-table td:last-child {
    width: 60px !important;
    min-width: 60px;
    max-width: 60px;
    overflow: visible !important;
    position: relative;
}

/* Ensure dropdown menus are visible */
.documents-table .dropdown {
    position: static;
}

.documents-table .dropdown-menu {
    position: absolute;
    z-index: 1050;
}

/* Fix table-responsive clipping dropdowns in documents table */
.documents-table-wrapper {
    overflow: visible !important;
}

.documents-table-wrapper .table-responsive {
    overflow: visible !important;
}

.documents-table .folder-row {
    background: #fffbeb;
}

.documents-table .folder-row:hover {
    background: #fef3c7;
}

.documents-table a {
    color: #334155;
    text-decoration: none;
}

.documents-table a:hover {
    color: #2563eb;
}

/* Drag and Drop */
.documents-area.drag-over {
    background: #eff6ff;
    border: 2px dashed #2563eb;
}

.documents-area.drag-over::after {
    content: 'Drop files here to upload';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: #2563eb;
    font-weight: 500;
}

/* Document Detail Modal */
#document-detail-modal .modal-body dl {
    margin-bottom: 0;
}

#document-detail-modal dt {
    font-weight: 600;
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 2px;
}

#document-detail-modal dd {
    margin-bottom: 16px;
    color: #1e293b;
}


/* ==========================================
   Help Menu & Keyboard Shortcuts
   ========================================== */

/* Keyboard shortcuts display */
.keyboard-shortcuts kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, "Liberation Mono", "Courier New", monospace;
    color: #24292e;
    background-color: #fafbfc;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    box-shadow: inset 0 -1px 0 #d1d5da;
    min-width: 20px;
    text-align: center;
}

.shortcuts-keys {
    white-space: nowrap;
}

.shortcuts-list {
    font-size: 14px;
}

/* What's New modal */
.whats-new-content {
    max-height: 400px;
    overflow-y: auto;
}

.whats-new-release h5 {
    font-size: 1rem;
}

/* Contact Support cards */
.contact-support .card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.contact-support .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* About modal */
.about-content {
    padding: 10px;
}

/* Help dropdown icon color */
#helpDropdown i {
    color: #6c757d;
}

#helpDropdown:hover i {
    color: #495057;
}

/* Contact Support Modal */
.contact-support .list-group-item {
    border-left: none;
    border-right: none;
}

.contact-support .list-group-item:first-child {
    border-top: none;
}

.contact-support .list-group-item:last-child {
    border-bottom: none;
}

.contact-support .min-width-0 {
    min-width: 0;
}

.contact-support .list-group-item:hover {
    background-color: #f8f9fa;
}

/* ============================================
   AI SUPPORT WIDGET
   ============================================ */

/* Trigger Button */
.ai-support-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
}

.ai-support-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.5);
}

.ai-support-trigger.open {
    transform: rotate(90deg);
}

.ai-support-trigger i {
    font-size: 24px;
}

.ai-support-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

/* Chat Window */
.ai-support-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.ai-support-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-support-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-support-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-support-avatar i {
    font-size: 20px;
}

.ai-support-title {
    font-weight: 600;
    font-size: 16px;
}

.ai-support-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.online {
    background: #22c55e;
    animation: pulse 2s infinite;
}

.ai-support-header-actions {
    display: flex;
    gap: 8px;
}

.ai-support-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-support-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.ai-support-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

/* Message Styles */
.ai-message {
    display: flex;
    gap: 10px;
    max-width: 90%;
}

.ai-message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.ai-message.system {
    justify-content: center;
    max-width: 100%;
}

.ai-message .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.ai-message .message-avatar.user {
    background: #64748b;
}

.ai-message .message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    border-top-right-radius: 4px;
}

.ai-message.system .message-content {
    background: #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
}

.ai-message .message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.ai-message .message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message .message-content li {
    margin: 4px 0;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-action-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: #e2e8f0;
    border-color: #667eea;
    color: #667eea;
}

/* Message Feedback */
.message-feedback {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.feedback-prompt {
    font-size: 12px;
    color: #94a3b8;
}

.feedback-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #94a3b8;
}

.feedback-btn:hover {
    transform: scale(1.1);
}

.feedback-btn.helpful:hover {
    background: #dcfce7;
    border-color: #22c55e;
    color: #22c55e;
}

.feedback-btn.not-helpful:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

.feedback-btn i {
    font-size: 12px;
}

.feedback-thanks {
    font-size: 12px;
    display: flex;
    align-items: center;
}

.feedback-thanks.positive {
    color: #22c55e;
}

.feedback-thanks.negative {
    color: #94a3b8;
}

/* Typing Indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Input Area */
.ai-support-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.ai-support-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-support-action-btn {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-support-action-btn:hover {
    background: #e2e8f0;
    color: #667eea;
}

.ai-support-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#ai-support-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

#ai-support-input:focus {
    border-color: #667eea;
}

.ai-support-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-support-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-support-send-btn:not(:disabled):hover {
    transform: scale(1.05);
}

/* Panels (KB, Ticket) */
.ai-support-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.ai-panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.ai-panel-back {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
}

.ai-panel-back:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ai-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Knowledge Base Styles */
.kb-search {
    position: relative;
    margin-bottom: 16px;
}

.kb-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

.kb-search input:focus {
    border-color: #667eea;
}

.kb-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.kb-category-item,
.kb-article-item {
    display: flex;
    align-items: center;
    padding: 14px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.kb-category-item:hover,
.kb-article-item:hover {
    background: #e2e8f0;
}

.kb-category-item i:first-child {
    color: #667eea;
    width: 20px;
}

.kb-section-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    font-weight: 500;
    color: #475569;
}

.kb-article-title {
    font-weight: 500;
    flex: 1;
}

.kb-article-meta {
    margin-left: auto;
}

.kb-article-full h5 {
    color: #1e293b;
    margin-bottom: 16px;
}

.kb-article-body {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

.kb-article-body p {
    margin-bottom: 12px;
}

.kb-article-body ul {
    margin: 12px 0;
    padding-left: 20px;
}

.kb-article-feedback {
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

/* Ticket Form Styles */
#ai-ticket-form .form-group {
    margin-bottom: 16px;
}

#ai-ticket-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}

#ai-ticket-form input,
#ai-ticket-form select,
#ai-ticket-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#ai-ticket-form input:focus,
#ai-ticket-form select:focus,
#ai-ticket-form textarea:focus {
    border-color: #667eea;
}

/* Article Card in Chat */
.article-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
}

.article-card-header {
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 8px;
}

.article-card-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.article-card-excerpt {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-support-window,
    .ai-support-panel {
        width: calc(100% - 32px);
        right: 16px;
        left: 16px;
        bottom: 90px;
        height: calc(100vh - 120px);
        max-height: 600px;
    }

    .ai-support-trigger {
        right: 16px;
        bottom: 16px;
        width: 56px;
        height: 56px;
    }
}

/* =====================================================
   IMPLEMENTATION REPORT DASHBOARD WIDGETS
   ===================================================== */

.implementation-widgets-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.impl-widget {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.impl-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.impl-widget-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.impl-widget-header .btn-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.impl-widget-header .btn-link:hover {
    color: white;
}

.impl-widget-body {
    padding: 16px;
    min-height: 120px;
}

.impl-widget .loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    color: #64748b;
}

.impl-widget .empty-state {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.impl-widget .empty-state i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* Action Items List */
.action-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.action-items-list.compact .action-item {
    padding: 10px 0;
}

.action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

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

.action-item.completed {
    opacity: 0.5;
    transform: translateX(100%);
}

.action-item.skipped {
    opacity: 0.5;
    background: #fef3c7;
}

.action-item-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.action-type-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.action-type-badge.notify_subcontractor { background: #dbeafe; color: #1d4ed8; }
.action-type-badge.confirm_subcontractor { background: #dcfce7; color: #16a34a; }
.action-type-badge.schedule_precon { background: #fef3c7; color: #ca8a04; }
.action-type-badge.submit_submittal { background: #f3e8ff; color: #9333ea; }
.action-type-badge.follow_up_submittal { background: #fce7f3; color: #db2777; }
.action-type-badge.order_material { background: #ffedd5; color: #ea580c; }
.action-type-badge.track_delivery { background: #ecfeff; color: #0891b2; }
.action-type-badge.check_predecessor { background: #f1f5f9; color: #64748b; }
.action-type-badge.accelerate_predecessor { background: #fee2e2; color: #dc2626; }
.action-type-badge.review_critical_path { background: #fef2f2; color: #b91c1c; }

.action-title {
    font-weight: 500;
    color: #1e293b;
    font-size: 13px;
}

.due-date {
    font-size: 11px;
    color: #64748b;
    padding: 2px 6px;
    background: #f1f5f9;
    border-radius: 4px;
}

.due-date.overdue {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 600;
}

.action-item-actions {
    display: flex;
    gap: 6px;
}

.action-item-actions .btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.action-item.priority-critical { border-left: 3px solid #dc2626; }
.action-item.priority-high { border-left: 3px solid #f59e0b; }
.action-item.priority-normal { border-left: 3px solid #3b82f6; }
.action-item.priority-low { border-left: 3px solid #64748b; }

/* Action Items Summary Widget */
.action-items-summary {
    text-align: center;
}

.action-items-summary .summary-total {
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    margin-bottom: 12px;
    transition: transform 0.2s;
}

.action-items-summary .summary-total:hover {
    transform: scale(1.02);
}

.action-items-summary .total-count {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.action-items-summary .total-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.action-items-summary .summary-by-priority {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.action-items-summary .priority-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.action-items-summary .priority-badge.critical {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.action-items-summary .priority-badge.high {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.action-items-summary .priority-badge.normal {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.action-items-summary .summary-breakdown {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
}

.action-items-summary .breakdown-item {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 4px;
}

.action-items-summary .breakdown-item.overdue {
    background: #fef2f2;
    color: #dc2626;
}

.action-items-summary .breakdown-item i {
    font-size: 0.7rem;
}

/* Planning Score Display */
.planning-score-display {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.level-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
}

.level-badge i {
    font-size: 24px;
}

.level-badge .level-name {
    font-size: 18px;
}

.score-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-to-next {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-to-next small {
    color: #64748b;
    font-size: 11px;
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #64748b;
}

.streak-display i {
    font-size: 18px;
}

.today-points {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-radius: 8px;
}

.today-points .points-earned {
    font-size: 20px;
    font-weight: 700;
    color: #16a34a;
}

.today-points .points-label {
    font-size: 12px;
    color: #64748b;
}

/* Readiness Summary */
.readiness-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.readiness-bar {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
}

.readiness-bar .segment {
    transition: width 0.3s ease;
}

.readiness-bar .segment.green { background: #22c55e; }
.readiness-bar .segment.yellow { background: #f59e0b; }
.readiness-bar .segment.red { background: #ef4444; }

.readiness-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
}

.legend-item i {
    font-size: 8px;
}

.readiness-total {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

/* Report Type Selector */
.report-type-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-type-option {
    cursor: pointer;
    display: block;
}

.report-type-option input {
    display: none;
}

.report-type-card {
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.2s ease;
    text-align: center;
}

.report-type-card:hover {
    border-color: #667eea;
    background: #f8fafc;
}

.report-type-option.selected .report-type-card {
    border-color: #667eea;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
}

.report-type-card i {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 8px;
    display: block;
}

.report-type-card h6 {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: #1e293b;
}

.report-type-card small {
    color: #64748b;
    font-size: 12px;
}

/* Teaching Moment Popup */
.teaching-moment-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.teaching-moment-popup.show {
    transform: translateY(0);
    opacity: 1;
}

.tm-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-weight: 600;
    font-size: 13px;
}

.tm-header i:first-child {
    font-size: 18px;
    color: #f59e0b;
}

.tm-header .tm-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #92400e;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.teaching-moment-popup h6 {
    padding: 12px 16px 0;
    margin: 0;
    font-weight: 600;
    color: #1e293b;
}

.teaching-moment-popup p {
    padding: 8px 16px;
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.tm-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
}

/* Leaderboard */
.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: rank;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}

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

.leaderboard-item.top-three {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
}

.leaderboard-item .rank {
    font-size: 18px;
    min-width: 30px;
    text-align: center;
}

.leaderboard-item .name {
    flex: 1;
    font-weight: 500;
    color: #1e293b;
}

.leaderboard-item .points {
    font-weight: 700;
    color: #667eea;
}

.leaderboard-item .level {
    font-size: 11px;
}

/* Report Viewer */
.report-viewer-body {
    max-height: 70vh;
    overflow-y: auto;
}

.report-content {
    padding: 20px;
}

.report-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.report-header h4 {
    margin: 0 0 4px 0;
    color: #1e293b;
}

.report-section {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
}

.report-section h5 {
    margin: 0 0 12px 0;
    color: #475569;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-section h5 i {
    color: #667eea;
}

.report-section .sub-section {
    margin-top: 12px;
    padding-left: 12px;
    border-left: 2px solid #e2e8f0;
}

.report-section .sub-section h6 {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.report-section ul {
    padding-left: 18px;
    margin: 0;
}

.report-section li {
    font-size: 13px;
    color: #475569;
    margin-bottom: 4px;
}

.report-section table {
    font-size: 13px;
}

.week-group {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed #e2e8f0;
}

.week-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.week-group h6 {
    margin-bottom: 8px;
    font-size: 13px;
    color: #475569;
}

.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 4px;
}

.task-list li.critical {
    border-left: 3px solid #dc2626;
    background: #fef2f2;
}

.task-list .task-title {
    flex: 1;
    font-weight: 500;
}

.task-list .task-dates,
.task-list .task-duration {
    font-size: 11px;
    color: #64748b;
}

/* Action Items Filters */
.action-items-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-items-filters .btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Readiness Details */
.readiness-details {
    padding: 16px;
}

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

.phase-section {
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
}

.phase-section h6 {
    margin: 0;
    font-size: 13px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.phase-section .badge {
    font-size: 10px;
}

tr.readiness-ready { background: #f0fdf4; }
tr.readiness-at_risk { background: #fffbeb; }
tr.readiness-blocked { background: #fef2f2; }

/* Generate Report Button */
.btn-generate-report {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-generate-report:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

/* Modal Header Actions */
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Teaching Moment Content Styles */
.teaching-moment-content {
    line-height: 1.6;
}

.teaching-moment-content h4,
.teaching-moment-content h5,
.teaching-moment-content h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: #1e293b;
}

.teaching-moment-content ul {
    padding-left: 20px;
}

.teaching-moment-content li {
    margin-bottom: 6px;
}

.teaching-moment-content strong {
    color: #1e293b;
}

/* Company group toggle in Manage Users */
.company-group-chevron {
    transition: transform 0.2s ease;
}

.company-group-header:hover {
    background-color: #e9ecef !important;
}

/* Company Cards in Project Companies page */
.company-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.company-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.company-card .card-title {
    font-size: 1.1rem;
}

.company-card .company-details p {
    margin-bottom: 0.25rem;
}

/* ========================================
   Drawings Module - Discipline Groups
   ======================================== */

.discipline-accordion {
    /* Container for discipline groups */
}

.discipline-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.discipline-group .card-header {
    padding: 0;
    border: none;
    background: transparent;
}

.discipline-group .card-header button {
    text-decoration: none;
    border-radius: 0;
    font-size: 0.95rem;
}

.discipline-group .card-header button:hover {
    filter: brightness(0.97);
}

.discipline-group .card-header button:focus {
    box-shadow: none;
}

.discipline-table {
    font-size: 0.9rem;
}

.discipline-table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-top: none;
}

.discipline-table tbody tr {
    transition: background-color 0.15s ease;
}

.discipline-table tbody tr:hover {
    background-color: #f8f9fa;
}

.discipline-table .drawing-link {
    cursor: pointer;
    transition: color 0.15s ease;
}

.discipline-table .drawing-link:hover {
    text-decoration: underline;
}

.discipline-table .drawing-title-cell {
    cursor: pointer;
}

.discipline-table .drawing-title-cell:hover {
    color: #0d6efd;
}

/* Drawing viewer navigation */
.drawing-toolbar .vr {
    height: 24px;
    opacity: 0.3;
}

/* Discipline chevron animation */
.discipline-chevron {
    font-size: 0.8rem;
    color: #6c757d;
}

.discipline-group .card-header button.collapsed .discipline-chevron {
    transform: rotate(-90deg);
}

.discipline-group .card-header button:not(.collapsed) .discipline-chevron {
    transform: rotate(0deg);
}

/* Drawing card hover effects */
.drawing-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.drawing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Drawing viewer zoom display */
#zoom-level {
    font-family: monospace;
    font-size: 0.85rem;
}

/* ==========================================
   DRAWING SET FULLSCREEN VIEWER MODE
   ========================================== */

/* In drawing viewer mode, only hide the right sidebar */
body.drawing-viewer-mode .right-sidebar,
body.drawing-viewer-mode .right-sidebar-toggle {
    display: none !important;
}

/* Main sidebar in drawing viewer mode - collapsible */
body.drawing-viewer-mode .sidebar {
    z-index: 1020; /* Below navbar (1030) */
    transition: left 0.3s ease;
    left: 0;
    top: 80px; /* Ensure it starts below header */
}

/* When main sidebar is collapsed in drawing viewer mode */
body.drawing-viewer-mode.main-sidebar-collapsed .sidebar {
    left: -250px;
}

/* Drawing viewer expands when main sidebar is collapsed */
body.drawing-viewer-mode.main-sidebar-collapsed .drawing-set-viewer {
    left: 0;
}

/* Expand main content to full width */
body.drawing-viewer-mode .main-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
}

/* Drawing set viewer container - respects main sidebar */
.drawing-set-viewer {
    position: fixed;
    top: 80px; /* Height of navbar */
    left: 250px; /* Width of main sidebar on desktop */
    right: 0;
    bottom: 0;
    display: flex;
    z-index: 1000;
    background: #1a1a1a;
    transition: left 0.3s ease;
}

/* Thumbnail sidebar - visible by default, collapsible */
.drawing-set-sidebar {
    width: 300px;
    min-width: 300px;
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.3s ease, min-width 0.3s ease;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
}

.drawing-set-sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

/* Sidebar toggle button - positioned fixed relative to viewport */
/* Position is controlled by JavaScript to account for both sidebars */
.sidebar-toggle-btn {
    position: fixed;
    left: 550px; /* Default: main sidebar (250) + thumbnail sidebar (300) */
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 60px;
    background: #343a40;
    border: none;
    border-radius: 0 6px 6px 0;
    color: white;
    cursor: pointer;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, left 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background: #495057;
}

.sidebar-toggle-btn i {
    transition: transform 0.3s ease;
}

/* Sidebar header styling */
.drawing-set-sidebar .sidebar-header {
    padding: 12px 16px !important;
}

.drawing-set-sidebar .sidebar-header h6 {
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.drawing-set-sidebar .sidebar-header .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.drawing-set-sidebar .sidebar-header .d-flex {
    gap: 10px;
}

.drawing-set-sidebar .sidebar-header .input-group {
    margin-top: 8px;
}

.drawing-set-sidebar .sidebar-header .input-group-sm .form-control,
.drawing-set-sidebar .sidebar-header .input-group-sm .btn {
    font-size: 0.75rem;
}

/* PDF viewer container */
.drawing-set-pdf-viewer {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #2a2a2a;
    position: relative;
    overflow: hidden;
}

/* PDF container with constrained viewport */
#set-pdf-container {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    background: #1a1a1a;
    /* Enable smooth scrolling on touch */
    -webkit-overflow-scrolling: touch;
    /* Prevent browser zoom, we handle it manually */
    touch-action: pan-x pan-y;
}

/* Canvas wrapper for centering */
#set-pdf-container #set-pdf-canvas {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: block;
}

/* PDF wrapper for layered canvases */
#set-pdf-wrapper {
    position: relative;
    display: inline-block;
}

/* Fabric.js canvas container - must be transparent */
#set-pdf-wrapper .canvas-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    background: transparent !important;
}

/* Fabric.js canvases - must be transparent */
#set-pdf-wrapper .canvas-container canvas {
    background: transparent !important;
    box-shadow: none !important;
}

/* Markup canvas base styling */
#set-markup-canvas {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent !important;
    pointer-events: auto;
}

/* Toolbar styling */
.drawing-set-viewer .drawing-toolbar {
    background: #343a40 !important;
    padding: 8px 16px;
    flex-shrink: 0;
    border-bottom: 1px solid #495057;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
}

/* Ensure toolbar controls don't wrap or overflow */
.drawing-set-viewer .drawing-toolbar .d-flex {
    flex-shrink: 0;
}

.drawing-set-viewer .drawing-toolbar .btn-group {
    flex-shrink: 0;
}

/* Page input width fix */
.drawing-set-viewer .drawing-toolbar #set-page-input {
    width: 50px !important;
    min-width: 50px;
}

/* Thumbnail items */
.thumbnail-item {
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.thumbnail-item:hover {
    border-color: #0d6efd !important;
    transform: scale(1.02);
}

.thumbnail-item.active,
.thumbnail-item.border-primary {
    border-color: #0d6efd !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.thumbnail-item img {
    max-width: 100%;
    height: auto;
}

/* Search results in sidebar */
#set-search-results {
    background: #fff3cd;
}

#set-search-results-list .search-result-item {
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    background: white;
    border: 1px solid #e9ecef;
}

#set-search-results-list .search-result-item:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .drawing-set-sidebar {
        width: 150px;
        min-width: 150px;
    }

    .drawing-set-sidebar:not(.collapsed) + .drawing-set-pdf-viewer .sidebar-toggle-btn {
        left: 150px;
    }
}

/* Single column thumbnails */
.drawing-set-sidebar .row.g-2 {
    display: flex;
    flex-direction: column;
}

.drawing-set-sidebar .row.g-2 > .col-6 {
    width: 100%;
    max-width: 100%;
}

/* ========================================
   Specification Sidebar Tabs & Sections Tree
   ======================================== */

/* Tab buttons for switching between Sections and Pages */
.spec-sidebar-tabs {
    display: flex;
    background: #fff;
}

.spec-sidebar-tab {
    flex: 1;
    padding: 8px 4px;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.spec-sidebar-tab:hover {
    background: #e9ecef;
    color: #495057;
}

.spec-sidebar-tab.active {
    background: #fff;
    color: var(--success);
    border-bottom-color: var(--success);
}

.spec-sidebar-tab i {
    font-size: 0.7rem;
}

/* Sections tree container */
.spec-sections-tree {
    padding: 8px;
}

/* Division (collapsible group) */
.spec-division {
    margin-bottom: 4px;
}

.spec-division-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: #e9ecef;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.75rem;
}

.spec-division-header:hover {
    background: #dee2e6;
}

.spec-division-icon {
    font-size: 0.65rem;
    color: #6c757d;
    transition: transform 0.2s;
    width: 10px;
}

.spec-division-number {
    font-weight: 600;
    color: var(--success);
    min-width: 20px;
}

.spec-division-name {
    flex: 1;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spec-division-count {
    background: #6c757d;
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sections within a division */
.spec-division-sections {
    padding-left: 16px;
    margin-top: 4px;
}

.spec-section-item {
    display: flex;
    gap: 8px;
    padding: 6px 8px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.7rem;
}

.spec-section-item:hover {
    background: #d4edda;
}

.spec-section-number {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    min-width: 50px;
}

.spec-section-info {
    flex: 1;
    min-width: 0;
}

.spec-section-title {
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.spec-section-pages {
    color: #6c757d;
    font-size: 0.65rem;
}

/* Miscellaneous division styling */
.spec-division-misc .spec-division-header {
    background: #fff3cd;
}

.spec-division-misc .spec-division-header:hover {
    background: #ffeeba;
}

.spec-division-misc .spec-division-number {
    color: #856404;
}

.spec-misc-item {
    padding-left: 16px;
}

.spec-misc-item:hover {
    background: #fff3cd;
}

/* Summary footer */
.spec-sections-summary {
    padding: 8px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 0.65rem;
    color: #6c757d;
    text-align: center;
    position: sticky;
    bottom: 0;
}

/* Active section highlighting when on that page */
.spec-section-item.active {
    background: #28a745;
    color: #fff;
}

.spec-section-item.active .spec-section-number,
.spec-section-item.active .spec-section-title,
.spec-section-item.active .spec-section-pages {
    color: #fff;
}

/* ========================================
   DISCIPLINE NAVIGATION (Drawing Sets)
   ======================================== */

.discipline-nav {
    font-size: 0.8rem;
}

/* Discipline group (collapsible) */
.discipline-group {
    margin-bottom: 4px;
}

.discipline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 4px 10px;
    background: #f8f9fa;
    transition: background 0.2s;
    border-radius: 4px;
}

.discipline-header:hover {
    background: #e9ecef;
}

.discipline-header-main {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
    padding: 4px 0;
}

.discipline-edit-btn {
    padding: 2px 6px;
    font-size: 0.7rem;
    color: #6c757d;
    opacity: 0;
    transition: opacity 0.2s;
}

.discipline-header:hover .discipline-edit-btn {
    opacity: 1;
}

.discipline-edit-btn:hover {
    color: #0d6efd;
}

.discipline-icon {
    font-size: 0.65rem;
    color: #6c757d;
    transition: transform 0.2s;
    width: 10px;
}

.discipline-prefix {
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 28px;
}

.discipline-name {
    flex: 1;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discipline-count {
    font-size: 0.65rem;
    padding: 1px 6px;
}

/* Sheets within a discipline */
.discipline-sheets {
    padding-left: 8px;
    margin: 4px 0;
}

.discipline-sheet {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s;
    border-left: 2px solid transparent;
}

.discipline-sheet:hover {
    background: #e9ecef;
}

.discipline-sheet.active {
    background: #2196F3;
    color: #fff;
    border-left-color: #1976D2;
}

.discipline-sheet.active .sheet-page {
    color: rgba(255,255,255,0.8) !important;
}

.sheet-number {
    font-weight: 500;
    font-family: monospace;
    font-size: 0.85rem;
}

.sheet-page {
    font-size: 0.7rem;
}

/* "Other" discipline group */
.discipline-other .discipline-header {
    background: #fff3cd;
}

.discipline-other .discipline-header:hover {
    background: #ffeeba;
}

/* Summary footer */
.discipline-summary {
    padding: 8px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 0.65rem;
    color: #6c757d;
    text-align: center;
    position: sticky;
    bottom: 0;
}

/* View mode toggle buttons */
#view-mode-disciplines.active,
#view-mode-thumbnails.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* =========================================================================
   AI TRAINER STYLES
   ========================================================================= */

/* Floating trigger button */
.ai-trainer-trigger {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 9999;
}

.ai-trainer-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.ai-trainer-trigger:active {
    transform: scale(0.95);
}

/* Main panel */
.ai-trainer-panel {
    position: fixed;
    right: -420px;
    top: 80px;
    width: 400px;
    height: calc(100vh - 100px);
    max-height: 700px;
    background: #fff;
    border-radius: 12px 0 0 12px;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: right 0.3s ease;
}

.ai-trainer-panel.open {
    right: 0;
}

/* Panel header */
.ai-trainer-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 0 0 0;
    flex-shrink: 0;
}

.ai-trainer-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.ai-trainer-title {
    flex: 1;
    min-width: 0;
}

.ai-trainer-title span {
    display: block;
    font-weight: 600;
    font-size: 16px;
}

.ai-trainer-title small {
    opacity: 0.8;
    font-size: 12px;
}

.ai-trainer-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ai-trainer-controls .btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-trainer-controls .btn-icon:hover {
    background: rgba(255,255,255,0.3);
}

/* Messages container */
.ai-trainer-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.ai-trainer-message {
    margin-bottom: 12px;
    max-width: 85%;
    animation: ai-message-appear 0.3s ease;
}

@keyframes ai-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-trainer-message.user {
    margin-left: auto;
}

.ai-trainer-message.system {
    margin-left: auto;
    margin-right: auto;
    max-width: 90%;
    text-align: center;
}

.ai-trainer-message .message-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-trainer-message.assistant .message-content {
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ai-trainer-message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-trainer-message.system .message-content {
    background: #e9ecef;
    color: #6c757d;
    font-size: 13px;
}

.ai-trainer-message .message-time {
    font-size: 10px;
    color: #adb5bd;
    margin-top: 4px;
}

.ai-trainer-message.user .message-time {
    text-align: right;
}

/* Suggestions */
.ai-trainer-suggestions {
    padding: 0 16px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.suggestion-btn {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #495057;
}

.suggestion-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Input area */
.ai-trainer-input {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
    background: #fff;
    border-radius: 0 0 0 12px;
    flex-shrink: 0;
}

.ai-trainer-mic {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #f0f2f5;
    color: #667eea;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-trainer-mic:hover {
    background: #667eea;
    color: white;
}

.ai-trainer-mic.listening {
    background: #ef4444;
    color: white;
    animation: mic-pulse 1s infinite;
}

@keyframes mic-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.ai-trainer-continuous-mic {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    background: transparent;
    color: #6c757d;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: -4px;
}

.ai-trainer-continuous-mic:hover {
    border-color: #28a745;
    color: #28a745;
}

.ai-trainer-continuous-mic.active {
    background: #28a745;
    border-color: #28a745;
    color: white;
    animation: continuous-pulse 2s infinite;
}

@keyframes continuous-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(40, 167, 69, 0); }
}

.ai-trainer-input input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    min-width: 0;
}

.ai-trainer-input input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.ai-trainer-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.ai-trainer-send:hover {
    transform: scale(1.05);
}

.ai-trainer-send:active {
    transform: scale(0.95);
}

/* Status indicator */
.ai-trainer-status {
    text-align: center;
    padding: 8px;
    font-size: 12px;
    color: #667eea;
    background: #f8f9fa;
    display: none;
    flex-shrink: 0;
}

/* Highlight overlay */
.ai-trainer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    cursor: pointer;
}

/* Highlight box */
.ai-trainer-highlight {
    position: fixed;
    border: 3px solid #667eea;
    border-radius: 8px;
    z-index: 10001;
    pointer-events: none;
    animation: ai-trainer-pulse 1.5s infinite;
    background: rgba(102, 126, 234, 0.1);
}

@keyframes ai-trainer-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

/* Tooltip */
.ai-trainer-tooltip {
    position: fixed;
    background: #667eea;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10002;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: tooltip-appear 0.2s ease;
}

.ai-trainer-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #667eea;
}

.ai-trainer-tooltip.above::before {
    top: auto;
    bottom: -8px;
    border-bottom: none;
    border-top: 8px solid #667eea;
}

@keyframes tooltip-appear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Settings modal */
.ai-trainer-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10003;
}

.ai-trainer-settings-content {
    background: white;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modal-appear 0.2s ease;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ai-trainer-settings-content .settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

.ai-trainer-settings-content .settings-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1a1a1a;
}

.ai-trainer-settings-content .settings-header .btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    line-height: 1;
}

.ai-trainer-settings-content .settings-header .btn-close:hover {
    color: #1a1a1a;
}

.ai-trainer-settings-content .settings-body {
    padding: 20px;
}

.ai-trainer-settings-content .settings-group {
    margin-bottom: 20px;
}

.ai-trainer-settings-content .settings-group:last-child {
    margin-bottom: 0;
}

.ai-trainer-settings-content .settings-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #1a1a1a;
    cursor: pointer;
}

.ai-trainer-settings-content .settings-group small {
    display: block;
    margin-top: 4px;
    margin-left: 24px;
    font-size: 12px;
    color: #6c757d;
}

.ai-trainer-settings-content .settings-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.ai-trainer-settings-content .settings-group input[type="range"] {
    width: 100%;
    margin-top: 8px;
    accent-color: #667eea;
}

.ai-trainer-settings-content .settings-group #voice-speed-value {
    display: inline-block;
    margin-left: 8px;
    font-size: 13px;
    color: #667eea;
    font-weight: 500;
}

.ai-trainer-settings-content .settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #e9ecef;
}

.ai-trainer-settings-content .settings-footer .btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-trainer-settings-content .settings-footer .btn-secondary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
}

.ai-trainer-settings-content .settings-footer .btn-secondary:hover {
    background: #e9ecef;
}

.ai-trainer-settings-content .settings-footer .btn-primary {
    background: #667eea;
    border: 1px solid #667eea;
    color: white;
}

.ai-trainer-settings-content .settings-footer .btn-primary:hover {
    background: #5a6fd6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ai-trainer-panel {
        width: 100%;
        right: -100%;
        top: 0;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }

    .ai-trainer-panel.open {
        right: 0;
    }

    .ai-trainer-header {
        border-radius: 0;
    }

    .ai-trainer-input {
        border-radius: 0;
    }

    .ai-trainer-trigger {
        bottom: 80px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
}

/* =========================================================================
   SYSTEM TOUR STYLES
   ========================================================================= */

/* Tour Control Panel */
.system-tour-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    width: 500px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.system-tour-panel.visible {
    transform: translateX(-50%) translateY(0);
}

.tour-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tour-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
}

.tour-title i {
    font-size: 18px;
}

.tour-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.tour-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Progress Bar */
.tour-progress {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.tour-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.tour-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.tour-progress-text {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

/* Current Stop Info */
.tour-current-stop {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.stop-name {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.stop-description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

/* Tour Controls */
.tour-controls {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    justify-content: center;
}

.tour-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.tour-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tour-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tour-btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.tour-btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.tour-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tour Options */
.tour-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.tour-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
}

.tour-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.tour-skip-link {
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}

.tour-skip-link:hover {
    color: #764ba2;
}

/* Tour Overlay (spotlight effect) */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    pointer-events: none;
}

/* Tour Highlight Box */
.tour-highlight {
    position: fixed;
    border: 3px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    pointer-events: none;
    animation: tour-pulse 2s ease-in-out infinite;
}

@keyframes tour-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5), 0 0 20px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.5), 0 0 30px rgba(102, 126, 234, 0.8);
    }
}

/* Tour Tooltip */
.tour-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    max-width: 280px;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: tour-tooltip-in 0.3s ease;
}

.tour-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #667eea;
}

.tour-tooltip.above::before {
    top: auto;
    bottom: -8px;
    border-bottom: none;
    border-top: 8px solid #764ba2;
}

@keyframes tour-tooltip-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Stop Picker Modal */
.tour-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease;
}

.tour-picker-content {
    background: white;
    border-radius: 16px;
    width: 400px;
    max-width: calc(100vw - 40px);
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}

.tour-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.tour-picker-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.tour-picker-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
}

.tour-picker-close:hover {
    color: #1f2937;
}

.tour-picker-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}

.tour-picker-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
    gap: 12px;
}

.tour-picker-item:hover {
    background: #f3f4f6;
}

.tour-picker-item.current {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.tour-picker-item.completed .picker-number {
    background: #22c55e;
}

.picker-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.tour-picker-item.current .picker-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.picker-name {
    flex: 1;
    font-size: 14px;
    color: #1f2937;
}

.picker-badge {
    font-size: 11px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
}

.tour-picker-item i.fa-check {
    color: #22c55e;
}

/* Tour Button in AI Trainer */
#ai-trainer-tour {
    background: rgba(255, 255, 255, 0.15);
}

#ai-trainer-tour:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Mobile Responsive */
@media (max-width: 540px) {
    .system-tour-panel {
        width: calc(100vw - 20px);
        bottom: 10px;
    }

    .tour-controls {
        flex-wrap: wrap;
    }

    .tour-btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }

    .tour-options {
        flex-direction: column;
        gap: 10px;
    }
}

/* =========================================================================
   SYSTEM TOUR TASKBAR STYLES (Bottom Taskbar Layout)
   ========================================================================= */

.system-tour-taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    z-index: 10001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.system-tour-taskbar.visible {
    transform: translateY(0);
}

.tour-taskbar-content {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
    min-height: 52px;
}

/* Left section: Title and stop info */
.tour-taskbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.tour-taskbar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.tour-taskbar-title i {
    color: #a78bfa;
    font-size: 16px;
}

.tour-title-text {
    color: white;
}

.tour-taskbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
}

.tour-stop-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tour-stop-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.tour-stop-name {
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 500;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Center section: Description */
.tour-taskbar-center {
    flex: 1;
    min-width: 0;
    padding: 0 16px;
}

.tour-taskbar-center .tour-description {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Right section: Controls */
.tour-taskbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Inline options (Auto, Voice) */
.tour-options-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tour-option-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.tour-option-inline:hover {
    color: white;
}

.tour-option-inline input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #667eea;
    cursor: pointer;
}

.tour-option-inline i {
    font-size: 14px;
}

/* Inline control buttons */
.tour-controls-inline {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tour-btn-inline {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.tour-btn-inline:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

.tour-btn-inline.tour-btn-pause {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tour-btn-inline.tour-btn-pause:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.tour-btn-inline.tour-btn-sections {
    background: rgba(255, 255, 255, 0.08);
}

.tour-btn-inline.tour-btn-close {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.tour-btn-inline.tour-btn-close:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

/* Progress bar at bottom */
.tour-taskbar-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
}

.tour-taskbar-progress .tour-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 0;
}

/* Mobile Responsive for Taskbar */
@media (max-width: 768px) {
    .tour-taskbar-content {
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 8px;
    }

    .tour-taskbar-left {
        width: 100%;
        justify-content: space-between;
    }

    .tour-taskbar-center {
        width: 100%;
        padding: 0;
        order: 3;
    }

    .tour-taskbar-center .tour-description {
        -webkit-line-clamp: 1;
    }

    .tour-taskbar-right {
        width: 100%;
        justify-content: center;
        order: 2;
    }

    .tour-taskbar-title .tour-title-text {
        display: none;
    }

    .tour-stop-name {
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .tour-options-inline {
        display: none;
    }

    .tour-taskbar-right .tour-taskbar-divider:first-of-type {
        display: none;
    }

    .tour-stop-name {
        max-width: 80px;
    }
}

/* =========================================================================
   DEMO TOUR END MODAL (CTA after sales lead tour)
   ========================================================================= */

.demo-end-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.demo-end-modal.visible {
    opacity: 1;
}

.demo-end-content {
    background: white;
    border-radius: 20px;
    width: 500px;
    max-width: calc(100vw - 40px);
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    text-align: center;
    animation: slide-up 0.4s ease;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.demo-end-header {
    padding: 40px 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.demo-end-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.demo-end-header .fa-hard-hat {
    color: white !important;
}

.demo-end-body {
    padding: 30px;
}

.demo-end-body p {
    font-size: 18px;
    color: #374151;
    margin-bottom: 20px;
}

.demo-benefits {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.demo-benefits li {
    padding: 12px 0;
    font-size: 15px;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.demo-benefits li:last-child {
    border-bottom: none;
}

.demo-benefits li i {
    font-size: 18px;
}

.demo-end-actions {
    padding: 0 30px 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.demo-end-actions .btn {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
}

.demo-end-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.demo-end-actions .btn-primary:hover {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.demo-end-actions .btn-outline-primary {
    border: 2px solid #667eea;
    color: #667eea;
    background: transparent;
}

.demo-end-actions .btn-outline-primary:hover {
    background: rgba(102, 126, 234, 0.1);
}

.demo-end-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s;
}

.demo-end-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
    .demo-end-content {
        border-radius: 16px;
    }

    .demo-end-header {
        padding: 30px 20px 15px;
    }

    .demo-end-header h2 {
        font-size: 20px;
    }

    .demo-end-body {
        padding: 20px;
    }

    .demo-end-actions {
        padding: 0 20px 20px;
    }
}

/* ============================
   SUPERADMIN DASHBOARD CARDS
   ============================ */

.nav-card {
    transition: all 0.2s ease;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
}

.nav-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: rgba(0,0,0,0.12);
}

.nav-card .nav-card-icon {
    transition: transform 0.2s ease;
}

.nav-card:hover .nav-card-icon {
    transform: scale(1.1);
}

.nav-card .card-title {
    color: #333;
    font-weight: 600;
}

.nav-card small {
    font-size: 0.75rem;
    line-height: 1.3;
}

/* ============================
   EMAIL ENHANCEMENTS
   ============================ */

/* Custom folders styling */
.email-folder.custom-folder,
.email-folder.email-label-filter {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-folder.custom-folder:hover,
.email-folder.email-label-filter:hover {
    background: rgba(0,0,0,0.05);
}

.folder-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #6c757d;
    background: rgba(0,0,0,0.08);
    padding: 2px 6px;
    border-radius: 10px;
}

.label-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Email sidebar footer */
.email-sidebar-footer {
    margin-top: auto;
    padding-top: 10px;
}

.email-sidebar-footer button {
    text-decoration: none;
}

.email-sidebar-footer button:hover {
    color: #0d6efd !important;
}

/* Email context menu */
.email-context-menu {
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.email-context-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.email-context-menu .dropdown-item i {
    width: 16px;
    text-align: center;
}

/* Email settings modal */
.email-settings-container {
    min-height: 400px;
}

.email-settings-tabs .nav-link {
    color: #495057;
    border: none;
    padding: 10px 15px;
}

.email-settings-tabs .nav-link.active {
    color: #0d6efd;
    border-bottom: 2px solid #0d6efd;
    background: transparent;
}

.email-settings-tabs .nav-link i {
    margin-right: 6px;
}

/* Labels in email list */
.email-labels-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.email-label-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    color: white;
}

/* Email item actions */
.email-item-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.email-item:hover .email-item-actions {
    opacity: 1;
}

.email-item-actions button {
    padding: 4px 8px;
    font-size: 0.75rem;
}
