/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Body - Sidebar + Main Content */
.app-body {
    display: flex;
    flex: 1;
}

/* App Body for Top Nav layout */
.app-body-top-nav {
    flex-direction: column;
}
.app-body-top-nav .main-content {
    margin-left: 0;
    width: 100%;
}

/* =============================================
   TOP HORIZONTAL NAVIGATION
   ============================================= */
.top-nav {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.top-nav-container {
    display: flex;
    align-items: center;
    max-width: 100%;
    padding: 0 1rem;
}

/* Top Nav Item (menu parent) */
.top-nav-item {
    position: relative;
}

.top-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    color: #ecf0f1;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.top-nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

.top-nav-item:hover .top-nav-link {
    background-color: rgba(255,255,255,0.15);
    color: #3498db;
}

.top-nav-icon {
    font-size: 1.1rem;
}

.top-nav-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.top-nav-item:hover .top-nav-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.top-nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
    z-index: 1001;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.top-nav-item:hover .top-nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Sections */
.dropdown-section {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.dropdown-section:last-child {
    border-bottom: none;
}

.dropdown-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-icon {
    font-size: 0.9rem;
}

/* Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem 0.65rem 1.5rem;
    color: #2c3e50;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, padding-left 0.15s;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: #f0f7ff;
    color: #2980b9;
    padding-left: 1.75rem;
}

.dropdown-item.active {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
}

.dropdown-item-icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

/* Top Nav Badge */
.top-nav-badge {
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: auto;
}

/* Right side user info */
.top-nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ecf0f1;
    font-size: 0.9rem;
}

.top-nav-user-icon {
    font-size: 1.1rem;
}

.top-nav-lang {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ecf0f1;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.top-nav-lang:hover {
    background: rgba(255,255,255,0.2);
}

.top-nav-lang option {
    background: #2c3e50;
    color: #ecf0f1;
}

.top-nav-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #ecf0f1;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.top-nav-logout:hover {
    background: rgba(231, 76, 60, 0.8);
    border-color: #e74c3c;
}

/* Multi-column dropdown for large menus */
.top-nav-dropdown.multi-column {
    display: flex;
    min-width: 500px;
}

.top-nav-dropdown.multi-column .dropdown-section {
    flex: 1;
    border-bottom: none;
    border-right: 1px solid #eee;
}

.top-nav-dropdown.multi-column .dropdown-section:last-child {
    border-right: none;
}

/* Custom scrollbar for dropdown */
.top-nav-dropdown::-webkit-scrollbar {
    width: 5px;
}
.top-nav-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.top-nav-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* END TOP HORIZONTAL NAVIGATION */

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: #2c3e50;
    height: calc(100vh - 80px);
    flex-shrink: 0;
    transition: width 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: #1a252f;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #5a6578;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    cursor: pointer;
    color: #ecf0f1;
    border-bottom: 1px solid #34495e;
    transition: background-color 0.2s;
}
.sidebar-toggle:hover { background-color: #34495e; }
.sidebar-toggle-icon { font-size: 1.25rem; transition: transform 0.3s; }

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

.sidebar.collapsed .menu-text,
.sidebar.collapsed .menu-arrow,
.sidebar.collapsed .submenu,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .submenu-header,
.sidebar.collapsed .nested-submenu {
    display: none;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 0.875rem 0;
    position: relative;
}
.sidebar.collapsed .menu-icon {
    margin-right: 0;
    font-size: 1.4rem;
}

/* Sidebar Collapsed Tooltip */
.sidebar.collapsed .menu-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 65px;
    top: 50%;
    transform: translateY(-50%);
    background: #34495e;
    color: #ecf0f1;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 0.85rem;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}

.sidebar-menu {
    padding: 1rem 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: #ecf0f1;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.menu-item:hover {
    background-color: #34495e;
}

.menu-item.active {
    background-color: #3498db;
}

.menu-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.menu-text {
    flex: 1;
}

.menu-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-arrow.expanded {
    transform: rotate(180deg);
}

/* Highlight when menu contains active item */
.menu-item.has-active {
    border-left: 3px solid #3498db;
}

.submenu {
    background-color: #1a252f;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.submenu.expanded {
    max-height: 1000px;
}

.submenu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem 0.75rem 2.5rem;
    color: #bdc3c7;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease,
                transform 0.3s ease,
                background-color 0.2s ease,
                color 0.2s ease;
}

/* Staggered animation for menu items */
.submenu.expanded .submenu-item,
.nested-submenu.expanded .submenu-item {
    opacity: 1;
    transform: translateX(0);
}

.submenu.expanded .submenu-item:nth-child(1),
.nested-submenu.expanded .submenu-item:nth-child(1) { transition-delay: 0.05s; }
.submenu.expanded .submenu-item:nth-child(2),
.nested-submenu.expanded .submenu-item:nth-child(2) { transition-delay: 0.1s; }
.submenu.expanded .submenu-item:nth-child(3),
.nested-submenu.expanded .submenu-item:nth-child(3) { transition-delay: 0.15s; }
.submenu.expanded .submenu-item:nth-child(4),
.nested-submenu.expanded .submenu-item:nth-child(4) { transition-delay: 0.2s; }
.submenu.expanded .submenu-item:nth-child(5),
.nested-submenu.expanded .submenu-item:nth-child(5) { transition-delay: 0.25s; }

.submenu-item:hover {
    background-color: #34495e;
    color: #ecf0f1;
    transform: translateX(4px);
}

.submenu-item.active {
    background-color: #2980b9;
    color: white;
}

.submenu-icon {
    margin-right: 0.625rem;
    font-size: 1rem;
}

/* Submenu Headers (for nested menus) */
.submenu-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem 0.75rem 1.5rem;
    color: #ecf0f1;
    cursor: pointer;
    transition: background-color 0.25s ease,
                padding-left 0.2s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.submenu-header:hover {
    background-color: #34495e;
    padding-left: 1.65rem;
}

.submenu-header.has-active {
    color: #3498db;
}

.submenu-header.has-active .submenu-header-icon {
    color: #3498db;
}

.submenu-header-icon {
    font-size: 1rem;
    margin-right: 0.625rem;
    transition: transform 0.3s ease;
}

.submenu-header:hover .submenu-header-icon {
    transform: scale(1.1);
}

.submenu-header-text {
    flex: 1;
}

.submenu-header-arrow {
    font-size: 0.65rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.submenu-header-arrow.expanded {
    transform: rotate(180deg);
}

/* Nested Submenu */
.nested-submenu {
    background-color: #151d24;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nested-submenu.expanded {
    max-height: 600px;
}

.nested-submenu .submenu-item {
    padding-left: 3.5rem;
}

.nested-submenu .nested-submenu .submenu-item {
    padding-left: 4.5rem;
}

/* Sidebar Footer */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: #1a252f;
    border-top: 1px solid #34495e;
}

.sidebar {
    position: relative;
    padding-bottom: 130px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ecf0f1;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.user-icon {
    font-size: 1.25rem;
}

.btn-logout {
    width: 100%;
    padding: 0.5rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #c0392b;
}

/* Language Selector in Sidebar */
.language-selector-sidebar {
    margin-bottom: 0.75rem;
}

.language-selector-sidebar select {
    width: 100%;
    padding: 0.4rem;
    border-radius: 4px;
    border: 1px solid #34495e;
    background: #2c3e50;
    color: #ecf0f1;
    font-size: 0.85rem;
    cursor: pointer;
}

.language-selector-sidebar select:hover {
    border-color: #3498db;
}

.language-selector-sidebar select:focus {
    outline: none;
    border-color: #3498db;
}

/* AI Classifier Section */
.ai-status-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    margin-bottom: 1.5rem;
}

.ai-status-info p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

.ai-status-info strong {
    min-width: 150px;
    display: inline-block;
}

.ai-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-actions .btn {
    min-width: 120px;
}

.ai-test-result {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.ai-test-result p {
    margin: 0.5rem 0;
}

.ai-test-result.success {
    border-left-color: #27ae60;
}

.ai-test-result.low-confidence {
    border-left-color: #f39c12;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
}

.role-badge.admin {
    background: #9b59b6;
    color: white;
}

.role-badge.user {
    background: #3498db;
    color: white;
}

/* Permissions Grid */
/* Permissions Modal */
#permissions-modal .modal-content {
    width: 95%;
    max-width: 700px;
    min-width: 400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

@media (max-width: 768px) {
    #permissions-modal .modal-content {
        min-width: 320px;
        width: 95%;
    }
}

#permissions-modal .modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

#permissions-modal .modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.permissions-sections {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.permissions-section {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: white;
}

.permissions-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.permissions-section-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.permissions-section-header h4 {
    margin: 0;
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

.permissions-section-icon {
    font-size: 1.25rem;
}

.permissions-section-toggle {
    font-size: 0.75rem;
    color: #6c757d;
    transition: transform 0.2s;
}

.permissions-section.expanded .permissions-section-toggle {
    transform: rotate(180deg);
}

.permissions-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 1rem;
}

.permissions-section.expanded .permissions-section-content {
    max-height: 500px;
    padding: 1rem;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.permission-item {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.permission-item:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.permission-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.permission-item input[type="checkbox"],
.permission-item input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color, #667eea);
}

#permissions-modal .modal-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    margin-top: 0;
}

/* Users Management - Grouped by Role */
.users-by-role-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
}

.user-role-group {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.user-role-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
}

.user-role-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.user-role-icon {
    font-size: 1.5rem;
}

.user-role-count {
    background: var(--primary-color, #667eea);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    min-width: 28px;
    text-align: center;
}

.user-role-list {
    padding: 0.5rem;
}

.user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-card:hover {
    background-color: #f8f9fa;
}

.user-card-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #667eea) 0%, var(--secondary-color, #764ba2) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.user-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.user-card-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.user-card-date {
    font-size: 0.8rem;
    color: #6c757d;
}

.user-card-actions {
    display: flex;
    gap: 0.5rem;
}

.user-card-actions .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.user-card-actions .btn-icon:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.user-card-actions .btn-icon.btn-danger:hover {
    background: #fff5f5;
    border-color: #f03e3e;
    color: #c92a2a;
}

.user-card-empty {
    padding: 1.5rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Catalogs Management */
.catalogs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.catalog-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    background: white;
    transition: all 0.2s;
}

.catalog-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #dee2e6;
}

.catalog-card-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.catalog-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.catalog-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.catalog-card-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-card-desc {
    font-size: 0.8rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-card-users {
    font-size: 0.8rem;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.catalog-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.catalog-card-actions .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.catalog-card-actions .btn-icon:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.catalog-card-actions .btn-icon.btn-danger:hover {
    background: #fff5f5;
    border-color: #f03e3e;
    color: #c92a2a;
}

.catalog-empty {
    grid-column: 1 / -1;
    padding: 2rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Catalog Assignment Modal - Checkbox Items */
.catalog-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.catalog-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.catalog-checkbox-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.catalog-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color, #667eea);
    flex-shrink: 0;
}

.catalog-checkbox-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.catalog-checkbox-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

.catalog-checkbox-desc {
    font-size: 0.8rem;
    color: #6c757d;
}

.catalogs-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 1rem;
    line-height: 1.4;
}

#catalog-modal .modal-content {
    width: 90%;
    max-width: 480px;
    min-width: 350px;
}

#user-catalogs-modal .modal-content {
    width: 90%;
    max-width: 500px;
    min-width: 350px;
}

/* User Modal */
#user-modal .modal-content {
    width: 90%;
    max-width: 480px;
    min-width: 350px;
}

#user-modal .modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

#user-modal .modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

#user-modal form {
    padding: 1.5rem;
}

#user-modal .form-group {
    margin-bottom: 1.25rem;
}

#user-modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

#user-modal .form-group input,
#user-modal .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95rem;
}

#user-modal .form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #6c757d;
    font-size: 0.8rem;
}

#user-modal .modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin: 0 -1.5rem -1.5rem -1.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* User copy info banner */
.user-copy-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #e8f4fd 0%, #d1ecf1 100%);
    border: 1px solid #bee5eb;
    border-radius: 8px;
    margin-bottom: 1rem;
    color: #0c5460;
    font-size: 0.9rem;
}

.user-copy-info .copy-icon {
    font-size: 1.1rem;
}

.user-copy-info strong {
    color: #0c5460;
}

@media (max-width: 480px) {
    #user-modal .modal-content {
        min-width: 300px;
        width: 95%;
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    cursor: pointer;
    min-width: 120px;
}

.header-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.header-software-logo {
    height: 75px;
    width: auto;
    object-fit: contain;
}

.header-version {
    font-size: 0.7rem;
    opacity: 0.8;
    padding: 0.15rem 0.4rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.header-center {
    text-align: center;
    cursor: pointer;
    flex: 1;
}

.header-title {
    font-size: 1.75rem;
    margin-bottom: 0;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.1rem;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 120px;
}

.profile-switcher {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.3);
    margin-right: 1rem;
}
.profile-btn {
    padding: 4px 12px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}
.profile-btn:hover { background: rgba(255,255,255,0.2); }
.profile-btn.active {
    background: rgba(255,255,255,0.3);
    font-weight: 600;
}

.header-company-logo {
    height: 60px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    width: 100%;
}

/* Sections */
.section {
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #333;
}

/* Home Groups */
.home-group {
    margin-bottom: 1.5rem;
}

.home-group-title {
    font-weight: 600;
    font-size: 1rem;
    color: #555;
    padding: 0.5rem 0.25rem;
}

.home-group-cards {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.home-app-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.home-app-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.home-app-card .app-icon {
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
}

.home-app-card .app-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.home-app-card .app-desc {
    font-size: 0.75rem;
    color: #888;
    line-height: 1.3;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5a6fd6;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-back {
    background-color: transparent;
    color: #667eea;
    font-weight: 500;
}

.btn-back:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Forms */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.form-container h3 {
    margin-bottom: 1rem;
    color: #333;
}

.form-help {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.readonly-field {
    background-color: #f0f0f0;
    color: #555;
    cursor: not-allowed;
}

.help-text {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Filters */
.filters-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filters-container h3 {
    margin-bottom: 1rem;
    color: #333;
}

.filters-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filters-row .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

/* Quick Period Filters */
.quick-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.quick-filters > label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.quick-filter-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-filter-option {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    background: #f5f7fa;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.quick-filter-option:hover {
    background: #e8ecf1;
}

.quick-filter-option input[type="radio"] {
    width: auto;
    margin: 0;
}

.quick-filter-option input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 500;
}

.quick-filter-option:has(input[type="radio"]:checked) {
    background: #e8ecff;
    border: 1px solid #667eea;
}

.year-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #667eea;
    border-radius: 20px;
    background: #e8ecff;
    color: #667eea;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.year-select:hover {
    background: #dde3ff;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

.table-container h3 {
    margin-bottom: 1rem;
    color: #333;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

.amount-positive {
    color: #27ae60;
    font-weight: 500;
}

.amount-negative {
    color: #e74c3c;
    font-weight: 500;
}

/* Patrimony Table */
.patrimony-table th {
    text-align: center;
}

.patrimony-table th:first-child {
    text-align: left;
}

.patrimony-table td {
    text-align: right;
}

.patrimony-table td:first-child {
    text-align: left;
}

.patrimony-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.patrimony-cell .patrimony-value {
    font-weight: 500;
}

.patrimony-cell .patrimony-pct {
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
}

.patrimony-cell.highlight {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4f8 100%);
    padding: 0.5rem;
    border-radius: 6px;
    margin: -0.25rem;
}

.patrimony-cell.highlight .patrimony-value {
    color: #2980b9;
    font-weight: 600;
}

.patrimony-cell.highlight .patrimony-pct {
    color: #3498db;
    font-weight: 500;
}

.patrimony-table tfoot .patrimony-cell.highlight {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
}

.patrimony-table tfoot .patrimony-cell.highlight .patrimony-value,
.patrimony-table tfoot .patrimony-cell.highlight .patrimony-pct {
    color: white;
}

/* Summary Cards Container */
.summary-cards-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.summary-cards-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.btn-toggle-visibility {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.btn-toggle-visibility:hover {
    background: #f5f5f5;
    border-color: #667eea;
}

.summary-cards.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.summary-cards {
    max-height: 500px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

/* Summary Cards (Dashboard) */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.summary-card h4 {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card p {
    font-size: 1.5rem;
    font-weight: 600;
}

.summary-card.income p {
    color: #27ae60;
}

.summary-card.expense p {
    color: #e74c3c;
}

.summary-card.net p {
    color: #667eea;
}

.summary-card.balance p {
    color: #333;
}

.summary-detail {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}

/* Liquidity Dashboard */
.liquidity-dashboard {
    margin-bottom: 2rem;
}

.liquidity-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.liquidity-row.secondary {
    grid-template-columns: repeat(4, 1fr);
}

.liquidity-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.liquidity-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

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

.liquidity-card.small {
    padding: 1.25rem;
}

.liquidity-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Help Icon with Tooltip */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    font-size: 10px;
    font-weight: 600;
    cursor: help;
    margin-left: auto;
    position: relative;
    transition: all 0.2s ease;
}

.help-icon:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #333;
}

.liquidity-card.primary .help-icon {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.liquidity-card.primary .help-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Tooltip */
.help-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 280px;
    padding: 0.75rem 1rem;
    background: #333;
    color: white;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.4;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: all 0.2s ease;
    z-index: 1000;
    text-transform: none;
    letter-spacing: normal;
}

.help-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    right: 4px;
    border: 6px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
}

.help-icon:hover::after,
.help-icon:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Adjust tooltip position for cards on the left */
.liquidity-row > .liquidity-card:first-child .help-icon::after {
    right: auto;
    left: 0;
}

.liquidity-row > .liquidity-card:first-child .help-icon::before {
    right: auto;
    left: 4px;
}

.liquidity-icon {
    font-size: 1.25rem;
}

.liquidity-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    font-weight: 500;
}

.liquidity-card.primary .liquidity-title {
    color: rgba(255, 255, 255, 0.85);
}

.liquidity-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.liquidity-card.primary .liquidity-value {
    color: white;
    font-size: 2rem;
}

.liquidity-card.small .liquidity-value {
    font-size: 1.4rem;
}

.liquidity-value.positive {
    color: #27ae60;
}

.liquidity-value.negative {
    color: #e74c3c;
}

.liquidity-card.primary .liquidity-value.positive,
.liquidity-card.primary .liquidity-value.negative {
    color: white;
}

/* Balance Change Indicator */
.liquidity-change {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.liquidity-card.primary .liquidity-change {
    color: rgba(255, 255, 255, 0.9);
}

.liquidity-change .change-icon {
    font-size: 0.75rem;
}

.liquidity-change.positive .change-icon,
.liquidity-change.positive .change-value,
.liquidity-change.positive .change-percent {
    color: #27ae60;
}

.liquidity-change.negative .change-icon,
.liquidity-change.negative .change-value,
.liquidity-change.negative .change-percent {
    color: #e74c3c;
}

.liquidity-card.primary .liquidity-change.positive .change-value,
.liquidity-card.primary .liquidity-change.positive .change-percent,
.liquidity-card.primary .liquidity-change.negative .change-value,
.liquidity-card.primary .liquidity-change.negative .change-percent {
    color: rgba(255, 255, 255, 0.95);
}

.liquidity-change .change-period {
    color: #888;
    font-size: 0.75rem;
}

.liquidity-card.primary .liquidity-change .change-period {
    color: rgba(255, 255, 255, 0.7);
}

/* Progress Bars */
.liquidity-progress {
    margin-top: 0.5rem;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

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

.progress-fill.good {
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
}

.progress-fill.warning {
    background: linear-gradient(90deg, #f39c12 0%, #e67e22 100%);
}

.progress-fill.danger {
    background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
}

.progress-label {
    font-size: 0.75rem;
    color: #888;
}

/* Hints */
.liquidity-hint {
    font-size: 0.75rem;
    color: #888;
    display: block;
}

/* Trend Indicator */
.liquidity-value.trend-up {
    color: #27ae60;
}

.liquidity-value.trend-down {
    color: #e74c3c;
}

.liquidity-value.trend-stable {
    color: #f39c12;
}

@media (max-width: 1024px) {
    .liquidity-row {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 640px) {
    .liquidity-row,
    .liquidity-row.secondary {
        grid-template-columns: 1fr;
    }
}

/* Treasury Section */
.treasury-section-group {
    margin-bottom: 2rem;
}

.treasury-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #667eea;
}

.treasury-group-title .period-label {
    font-size: 0.85rem;
    font-weight: 400;
    color: #667eea;
    margin-left: 0.5rem;
}

.treasury-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.treasury-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.treasury-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

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

.treasury-card.primary .treasury-card-label {
    color: rgba(255, 255, 255, 0.85);
}

.treasury-card.primary .treasury-card-value {
    color: white;
}

.treasury-card.income {
    border-left: 4px solid #27ae60;
}

.treasury-card.expense {
    border-left: 4px solid #e74c3c;
}

.treasury-card.warning {
    border-left: 4px solid #f39c12;
}

.treasury-card.highlight {
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
}

.treasury-card-icon {
    font-size: 2rem;
    line-height: 1;
    opacity: 0.8;
}

.treasury-card.primary .treasury-card-icon {
    opacity: 0.9;
}

.treasury-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.treasury-card-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.treasury-card-label-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.treasury-card-label-row .treasury-card-label {
    margin-bottom: 0;
}

.treasury-card .help-icon {
    width: 14px;
    height: 14px;
    font-size: 9px;
    flex-shrink: 0;
}

.treasury-card.primary .help-icon {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.treasury-card.primary .help-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.treasury-card.highlight .help-icon {
    background: rgba(155, 89, 182, 0.15);
    color: #9b59b6;
}

.treasury-card.highlight .help-icon:hover {
    background: rgba(155, 89, 182, 0.25);
}

.treasury-card-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
}

.treasury-card-value.positive {
    color: #27ae60;
}

.treasury-card-value.negative {
    color: #e74c3c;
}

.treasury-card-value.warning {
    color: #f39c12;
}

.treasury-card-hint {
    font-size: 0.7rem;
    color: #888;
    margin-top: 0.35rem;
    font-style: italic;
}

.treasury-card.primary .treasury-card-hint {
    color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 768px) {
    .treasury-cards {
        grid-template-columns: 1fr;
    }

    .treasury-card-value {
        font-size: 1.2rem;
    }
}

/* Result Messages */
.result-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 6px;
    white-space: pre-line;
}

.result-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.result-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal */
/* Settings Section */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.settings-grid .form-container {
    margin-bottom: 0;
}

.logo-preview-container {
    margin-bottom: 1rem;
}

.logo-preview {
    width: 100%;
    height: 120px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.logo-preview img {
    max-height: 100px;
    max-width: 100%;
    object-fit: contain;
}

.logo-preview span {
    color: #999;
    font-style: italic;
}

.form-actions-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    font-family: inherit;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 500px;
    min-width: 320px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

@keyframes slideIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Legacy support for modals without header/body/footer structure */
.modal-content > h3:first-child {
    margin-bottom: 1.5rem;
    padding: 1.5rem 1.5rem 0;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .home-group-cards {
        grid-template-columns: 1fr;
    }

    .filters-row {
        flex-direction: column;
    }

    .filters-row .form-group {
        min-width: 100%;
    }

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

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.5rem;
    }
}

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

    .header-title {
        font-size: 1.5rem;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Actions Cell */
.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 0.5rem;
}

.actions-cell .btn:last-child {
    margin-right: 0;
}

/* Clickable Rows */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-row:hover {
    background-color: #e8edf5 !important;
}

/* Parent Category Row */
.parent-category-row {
    background-color: #f0f4f8;
    border-top: 1px solid #d5dde5;
}

.parent-category-row td {
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 0.95em;
}

.sub-category-row td:first-child {
    font-size: 0.9em;
}

/* Total Row in Tables */
.total-row {
    background-color: #f0f4f8;
    border-top: 2px solid #3498db;
}

.total-row td {
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Category Select in Tables */
.category-select {
    padding: 0.375rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    background-color: white;
    min-width: 150px;
}

.category-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Table Container Spacing */
.table-container + .table-container {
    margin-top: 1.5rem;
}

/* Drilldown Container */
#category-movements-container {
    margin-top: 1.5rem;
    border: 2px solid #667eea;
}

#category-movements-container .section-header {
    margin-bottom: 1rem;
}

/* Bulk Update Container */
.bulk-update-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.bulk-update-container label {
    font-weight: 500;
    color: #555;
}

.bulk-update-container select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 200px;
    font-size: 0.9rem;
}

.bulk-update-container select:focus {
    outline: none;
    border-color: #667eea;
}

/* Rule Display */
.rule-match {
    background-color: #d4edda;
    color: #155724;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-rule {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Debit badge */
.debit-badge {
    background-color: #e74c3c;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* =============================================
   VACATION MANAGEMENT STYLES
   ============================================= */

/* Vacation Tabs */
.vacation-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.vacation-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.vacation-tab-btn:hover {
    color: #667eea;
}

.vacation-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.vacation-tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-approved,
.status-paid {
    background-color: #d4edda;
    color: #155724;
}

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

.status-cancelled {
    background-color: #e2e3e5;
    color: #6c757d;
}

.overlap-warning {
    background-color: #fff3cd;
    color: #856404;
    font-weight: 600;
}

.status-change-requested {
    background-color: #e7d4f3;
    color: #6f42c1;
}

.change-info {
    color: #6f42c1;
    font-style: italic;
}

.change-request-row {
    background-color: #f8f4fc;
}

.info-text {
    font-weight: 600;
    color: #333;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-row:hover {
    background-color: #e8f4fc;
}

.change-request-row.clickable-row:hover {
    background-color: #efe8f5;
}

/* Leave Type Badge */
.leave-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Textarea */
textarea {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #219a52 0%, #27ae60 100%);
}

/* Error Message */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

/* Section Header with Button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Color input */
input[type="color"] {
    width: 50px;
    height: 35px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

input[type="color"]:focus {
    outline: none;
    border-color: #667eea;
}

/* =============================================
   VACATION CALENDAR STYLES
   ============================================= */

.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.calendar-controls h3 {
    margin: 0;
    min-width: 200px;
    text-align: center;
}

.calendar-legend {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.holiday {
    background-color: #e74c3c;
}

.legend-color.vacation-approved {
    background-color: #27ae60;
}

.legend-color.vacation-pending {
    background-color: #f39c12;
}

.legend-color.weekend {
    background-color: #ecf0f1;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background-color: #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-header {
    background-color: #667eea;
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.calendar-day {
    background-color: white;
    min-height: 100px;
    padding: 0.5rem;
    position: relative;
}

.calendar-day.empty {
    background-color: #f8f9fa;
}

.calendar-day.weekend {
    background-color: #f5f5f5;
}

.calendar-day.holiday {
    background-color: #ffeaea;
}

.day-number {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.calendar-day.holiday .day-number {
    color: #e74c3c;
}

.calendar-day.weekend .day-number {
    color: #95a5a6;
}

.day-holiday {
    background-color: #e74c3c;
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-vacation {
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.day-vacation.vacation-approved {
    background-color: #27ae60;
}

.day-vacation.vacation-pending {
    background-color: #f39c12;
}

/* Holiday row highlighting */
.holiday-row {
    background-color: #fff5f5;
}

.holiday-row:hover {
    background-color: #ffe8e8 !important;
}

/* =============================================
   EMPLOYEE CALENDAR - CLICK TO SELECT
   ============================================= */

.calendar-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.calendar-instructions {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.legend-color.selected {
    background-color: #667eea;
}

/* Selectable days */
.calendar-day.selectable {
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day.selectable:hover {
    background-color: #e8ecff;
    transform: scale(1.02);
}

.calendar-day.not-selectable {
    cursor: not-allowed;
}

.calendar-day.past {
    opacity: 0.5;
}

.calendar-day.selected {
    background-color: #667eea !important;
    color: white;
}

.calendar-day.selected .day-number {
    color: white;
}

.calendar-day.selected .day-holiday {
    background-color: rgba(255, 255, 255, 0.3);
}

/* My vacation status on calendar */
.calendar-day.my-approved {
    background-color: #d4edda;
}

.calendar-day.my-pending {
    background-color: #fff3cd;
}

/* Selection info bar */
.selection-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.selection-dates {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.selection-days {
    opacity: 0.9;
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selection-actions select {
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 180px;
}

.selection-info .btn {
    padding: 0.5rem 1rem;
}

.selection-info .btn-primary {
    background: white;
    color: #667eea;
}

.selection-info .btn-primary:hover {
    background: #f0f0f0;
}

.selection-info .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.selection-info .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .selection-info {
        flex-direction: column;
        text-align: center;
    }

    .selection-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .calendar-day {
        min-height: 60px;
        font-size: 0.8rem;
    }

    .day-holiday,
    .day-vacation {
        font-size: 0.6rem;
    }
}

/* Review Categorization Section */
.review-stats-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 150px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: #667eea;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Confidence colors */
.confidence-high {
    color: #28a745;
    font-weight: 500;
}

.confidence-medium {
    color: #ffc107;
    font-weight: 500;
}

.confidence-low {
    color: #dc3545;
    font-weight: 500;
}

/* Method badges */
.method-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.method-rule {
    background: #d4edda;
    color: #155724;
}

.method-ai {
    background: #cce5ff;
    color: #004085;
}

.method-manual {
    background: #e2e3e5;
    color: #383d41;
}

.method-pending_review, .method-default {
    background: #fff3cd;
    color: #856404;
}

/* Pending review badge in sidebar */
.pending-badge {
    background: #dc3545;
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.5rem;
}

/* Description cell in review table */
.description-cell {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Category select in review table */
.category-select {
    padding: 0.375rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    width: 100%;
    max-width: 200px;
}

/* Small buttons */
.btn-small {
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
}

.btn-success {
    background: #28a745;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #218838;
}

/* Pagination container */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
}

/* Text center helper */
.text-center {
    text-align: center;
    color: #666;
    padding: 2rem;
}

/* Bulk actions container */
.bulk-actions-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.bulk-actions-container span {
    font-weight: 500;
    color: #004085;
}

.bulk-actions-container select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 200px;
}

/* Filter input styles */
#review-description-filter {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
}

/* Amount colors */
.amount-positive {
    color: #28a745;
    font-weight: 500;
}

.amount-negative {
    color: #dc3545;
    font-weight: 500;
}

/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 1rem;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 0;
    user-select: none;
}

.collapsible-header:hover {
    opacity: 0.8;
}

.collapsible-header h3 {
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.collapse-icon {
    font-size: 0.9rem;
    color: #666;
    transition: transform 0.2s;
}

.collapsible-content {
    overflow: hidden;
    max-height: 10000px;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 !important;
    margin: 0 !important;
}

/* Category Count Badge */
.category-count {
    background-color: #3498db;
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Type Badges */
.type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.type-badge.type-income {
    background-color: #d4edda;
    color: #155724;
}

.type-badge.type-expense {
    background-color: #f8d7da;
    color: #721c24;
}

.type-badge.type-financial {
    background-color: #fff3cd;
    color: #856404;
}

.type-badge.type-bank {
    background-color: #cce5ff;
    color: #004085;
}

.type-badge.type-both {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Filter actions group */
.filter-actions {
    display: flex;
    align-items: flex-end;
}

.filter-actions label {
    visibility: hidden;
}

/* Expandable rows in drill-down */
.expandable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.expandable-row:hover {
    background-color: #f0f7ff;
}

.expandable-row.expanded {
    background-color: #e8f4fd;
    font-weight: 500;
}

.expand-icon {
    display: inline-block;
    width: 16px;
    margin-right: 8px;
    color: #666;
    font-size: 0.8rem;
}

.expand-icon-placeholder {
    display: inline-block;
    width: 24px;
}

.detail-row {
    background-color: #f9f9f9;
}

.detail-row.hidden {
    display: none;
}

.detail-content {
    padding: 0.75rem 1rem 0.75rem 2rem;
    max-height: 300px;
    overflow-y: auto;
}

.detail-content .loading {
    color: #666;
    font-style: italic;
    padding: 0.5rem;
}

.detail-content .error {
    color: #dc3545;
    padding: 0.5rem;
}

/* Detail table inside expanded row */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.detail-table th,
.detail-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.detail-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
}

.detail-table tbody tr:hover {
    background-color: #fafafa;
}

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

/* Bank year actions (inline buttons in year rows) */
.bank-year-actions {
    white-space: nowrap;
}

.bank-year-actions .btn {
    margin-right: 0.25rem;
}

.bank-year-actions .btn:last-child {
    margin-right: 0;
}

/* Add year button at bottom of child table */
.add-year-btn {
    margin-top: 0.5rem;
}

/* Reclassify actions */
.reclassify-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reclassify-actions label {
    font-weight: 500;
    color: #555;
    margin-right: 0.5rem;
}

/* Warning button */
.btn-warning {
    background-color: #f0ad4e;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-warning:hover {
    background-color: #ec971f;
}

.btn-warning:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Bulk actions separator */
.bulk-separator {
    color: #ccc;
    margin: 0 0.75rem;
    font-weight: 300;
}

/* Side Panel for Category Drill-down */
.side-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.side-panel-overlay.visible {
    opacity: 1;
}

.side-panel-overlay.hidden {
    display: none;
}

.side-panel {
    position: fixed;
    top: 0;
    right: -50%;
    width: 50%;
    height: 100vh;
    background-color: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.side-panel.visible {
    right: 0;
}

.side-panel.hidden {
    right: -50%;
}

.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.side-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
}

.btn-close-panel {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close-panel:hover {
    color: #333;
}

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.side-panel .bulk-update-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    flex-wrap: wrap;
}

.side-panel .bulk-update-container label {
    font-size: 0.9rem;
    white-space: nowrap;
}

.side-panel .bulk-update-container select {
    flex: 1;
    min-width: 150px;
}

/* Side panel table adjustments */
.side-panel table {
    font-size: 0.9rem;
    table-layout: fixed;
    width: 100%;
}

.side-panel table th,
.side-panel table td {
    padding: 0.5rem 0.75rem;
}

/* Column widths for side panel table */
.side-panel table th:nth-child(1),
.side-panel table td:nth-child(1) {
    width: 45%;  /* Descrição */
}

.side-panel table th:nth-child(2),
.side-panel table td:nth-child(2) {
    width: 8%;  /* Qtd */
    text-align: center;
}

.side-panel table th:nth-child(3),
.side-panel table td:nth-child(3) {
    width: 15%;  /* Total */
    text-align: right;
}

.side-panel table th:nth-child(4),
.side-panel table td:nth-child(4) {
    width: 22%;  /* Categoria */
}

.side-panel table th:nth-child(5),
.side-panel table td:nth-child(5) {
    width: 10%;  /* Ações */
    text-align: center;
}

.side-panel .expandable-row td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsive side panel */
@media (max-width: 1200px) {
    .side-panel {
        width: 60%;
        right: -60%;
    }
    .side-panel.hidden {
        right: -60%;
    }
}

@media (max-width: 900px) {
    .side-panel {
        width: 80%;
        right: -80%;
    }
    .side-panel.hidden {
        right: -80%;
    }
}

@media (max-width: 600px) {
    .side-panel {
        width: 100%;
        right: -100%;
    }
    .side-panel.hidden {
        right: -100%;
    }
}

/* Rule indicator in side panel */
.rule-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: #3498db;
    color: white;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-right: 4px;
    cursor: help;
}

/* Smaller category select for side panel */
.category-select-sm {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    max-width: 140px;
}

/* AI auto-train note */
.ai-auto-train-note {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

/* =====================================================
   Financial Applications - Patrimony & Status Styles
   ===================================================== */

/* Patrimony Summary */
.patrimony-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #dee2e6;
}

.patrimony-totals {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.patrimony-card {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    flex: 1;
    min-width: 180px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.patrimony-label {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.patrimony-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.patrimony-pct {
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.patrimony-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.patrimony-item {
    background: white;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.patrimony-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.patrimony-type-name {
    font-weight: 500;
    color: #495057;
}

.patrimony-count {
    font-size: 0.8rem;
    color: #868e96;
}

.patrimony-item-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
}

.patrimony-item-profit {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Application Status Badges */
.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-matured {
    background-color: #fff3cd;
    color: #856404;
}

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

.status-closed {
    background-color: #e2e3e5;
    color: #6c757d;
}

/* Movement Type Badges */
.movement-type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.movement-type-badge.type-subscription {
    background-color: #d4edda;
    color: #155724;
}

.movement-type-badge.type-redemption {
    background-color: #f8d7da;
    color: #721c24;
}

.movement-type-badge.type-interest {
    background-color: #d1ecf1;
    color: #0c5460;
}

.movement-type-badge.type-dividend {
    background-color: #d4edda;
    color: #155724;
}

.movement-type-badge.type-fee {
    background-color: #f8d7da;
    color: #721c24;
}

.movement-type-badge.type-tax {
    background-color: #f8d7da;
    color: #721c24;
}

.movement-type-badge.type-transfer_in {
    background-color: #d4edda;
    color: #155724;
}

.movement-type-badge.type-transfer_out {
    background-color: #f8d7da;
    color: #721c24;
}

.movement-type-badge.type-bonus {
    background-color: #fff3cd;
    color: #856404;
}

.movement-type-badge.type-adjustment {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Detail Sections */
.detail-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.detail-section h4 {
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1rem;
}

.detail-summary {
    margin: 0.5rem 0 0 0;
    color: #666;
    font-size: 0.9rem;
}

/* Inline Form */
.inline-form {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Compact Table */
.table-compact {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
}

.table-compact th,
.table-compact td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
}

.table-compact th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
}

.table-compact tbody tr:hover {
    background-color: #f8f9fa;
}

/* Larger Modal */
.modal-lg {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-lg > h3,
.modal-lg > form > h3 {
    flex-shrink: 0;
}

.modal-lg form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.modal-lg .form-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

.modal-lg .form-grid::-webkit-scrollbar {
    width: 6px;
}

.modal-lg .form-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-lg .form-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-lg .form-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Simulation modal - form-grid is direct child */
.modal-lg > .form-grid {
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 200px);
    padding-right: 0.5rem;
}

.modal-lg > .form-grid::-webkit-scrollbar {
    width: 6px;
}

.modal-lg > .form-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-lg > .form-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#simulation-results {
    max-height: 300px;
    overflow-y: auto;
}

.modal-lg .modal-actions {
    flex-shrink: 0;
    background: white;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    margin-top: 1rem;
}

.modal-lg .modal-footer {
    flex-shrink: 0;
    background: white;
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Close Button */
.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.btn-close:hover {
    color: #333;
}

/* Small Button */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* Source Badge (PDF/Manual) */
.source-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.source-import {
    background-color: #d1ecf1;
    color: #0c5460;
}

.source-manual {
    background-color: #e2e3e5;
    color: #383d41;
}

/* ========== Executive Dashboard ========== */
.exec-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.exec-kpi-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

.exec-kpi-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.exec-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.exec-kpi-card.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
.exec-kpi-card.applications { border-left: 4px solid #3498db; }
.exec-kpi-card.income { border-left: 4px solid #27ae60; }
.exec-kpi-card.expense { border-left: 4px solid #e74c3c; }
.exec-kpi-card.highlight {
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
}

.exec-kpi-icon { font-size: 2rem; }
.exec-kpi-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    display: block;
}
.exec-kpi-card.primary .exec-kpi-label { color: rgba(255,255,255,0.8); }
.exec-kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}
.exec-kpi-change {
    font-size: 0.8rem;
    color: #888;
    display: block;
}
.exec-kpi-change.positive { color: #27ae60; }
.exec-kpi-change.negative { color: #e74c3c; }
.exec-kpi-card.primary .exec-kpi-change { color: rgba(255,255,255,0.7); }
.exec-kpi-card.primary .exec-kpi-change.positive { color: #a8f0c6; }
.exec-kpi-card.primary .exec-kpi-change.negative { color: #f0a8a8; }

.exec-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.exec-chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.exec-chart-container h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #333;
}

.exec-gauges-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.exec-gauge-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}
.exec-gauge-card h4 {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}
.exec-gauge-card canvas {
    max-height: 140px;
}
.exec-gauge-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: #333;
}

.exec-tables-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Responsive - Executive Dashboard */
@media (max-width: 1024px) {
    .exec-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .exec-kpi-row-3 { grid-template-columns: repeat(3, 1fr); }
    .exec-charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .exec-kpi-row { grid-template-columns: 1fr; }
    .exec-kpi-row-3 { grid-template-columns: 1fr; }
    .exec-gauges-container { grid-template-columns: 1fr; }
}

/* ==================== ONBOARDING ==================== */
.onboarding-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: center;
}

.onboarding-header {
    margin-bottom: 3rem;
}

.onboarding-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
}

.onboarding-header h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.75rem;
}

.onboarding-header p {
    font-size: 1.1rem;
    color: #666;
}

.onboarding-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.onboarding-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 2rem;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.onboarding-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

.onboarding-card.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.onboarding-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.onboarding-card h2 {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 0.75rem;
}

.onboarding-card-desc {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.onboarding-card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    flex-grow: 1;
}

.onboarding-card-features li {
    padding: 0.35rem 0;
    color: #555;
    font-size: 0.9rem;
}

.onboarding-card-features li::before {
    content: "\2713";
    color: #28a745;
    font-weight: bold;
    margin-right: 0.5rem;
}

.onboarding-card-action {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: opacity 0.2s;
}

.onboarding-card:hover .onboarding-card-action {
    opacity: 0.9;
}

.onboarding-result {
    font-size: 1.1rem;
    color: #28a745;
    font-weight: 600;
    padding: 1rem;
}

@media (max-width: 640px) {
    .onboarding-cards {
        grid-template-columns: 1fr;
    }
    .onboarding-container {
        padding: 2rem 1rem;
    }
}

/* ============================================
   DOCTOR ACCOUNTS - CLINICAL MANAGEMENT
   ============================================ */

/* Controls Bar */
.doctor-accounts-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.doctor-accounts-controls .control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doctor-accounts-controls label {
    font-weight: 500;
    color: #555;
}

.doctor-accounts-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 200px;
}

/* Summary Cards */
.doctor-summary-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.doctor-summary-cards .summary-card {
    flex: 1;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.doctor-summary-cards .card-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    border-left: 4px solid #ffc107;
}

.doctor-summary-cards .card-info {
    background: linear-gradient(135deg, #cce5ff, #b8daff);
    border-left: 4px solid #007bff;
}

.doctor-summary-cards .card-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border-left: 4px solid #28a745;
}

.doctor-summary-cards .card-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border-left: 4px solid #dc3545;
}

.doctor-summary-cards .help-icon {
    width: 14px;
    height: 14px;
    font-size: 9px;
    margin-left: 4px;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.12);
    color: #555;
}

/* Collaborator highlight columns */
.collab-col-gross {
    color: #0d6efd;
    font-weight: 600;
}
.collab-col-net {
    color: #198754;
    font-weight: 600;
}
.collab-col-cost {
    color: #6f42c1;
    font-weight: 600;
}

/* Doctor Grid Table */
.doctor-accounts-grid {
    overflow-x: auto;
}

.doctor-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.doctor-grid th,
.doctor-grid td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    text-align: center;
}

.doctor-grid thead th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Column group colors */
.col-group-fees {
    background: #fff3cd !important;
}

.col-fees {
    background: #fffaeb !important;
}

.col-group-invoices {
    background: #f8d7da !important;
}

.col-invoices {
    background: #fef0f1 !important;
}

.col-group-payments {
    background: #cce5ff !important;
}

.col-payments {
    background: #e7f3ff !important;
}

.col-balance {
    background: #d4edda !important;
}

.col-month {
    text-align: left !important;
    font-weight: 500;
}

/* Month rows */
.month-row {
    transition: background 0.2s;
}

.month-row:hover {
    background: #f5f5f5;
}

.month-row.expanded {
    background: #e8f4f8;
}

.expand-cell {
    cursor: pointer;
    text-align: left !important;
    white-space: nowrap;
}

.expand-icon {
    display: inline-block;
    width: 1.2rem;
    color: #666;
}

/* Grid input */
.grid-input {
    width: 100%;
    max-width: 100px;
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: right;
    font-size: 0.85rem;
}

.grid-input:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.grid-input[readonly] {
    background-color: #f0f0f0;
    color: #888;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

/* Balance styling */
.balance-credit {
    color: #28a745;
    font-weight: 600;
}

.balance-debit {
    color: #dc3545;
    font-weight: 600;
}

/* Details row */
.details-row td {
    padding: 0 !important;
    background: #f8f9fa;
}

.details-content {
    display: flex;
    gap: 2rem;
    padding: 1rem;
}

.details-section {
    flex: 1;
    background: #fff;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.invoices-section {
    border-left: 3px solid #dc3545;
}

.payments-section {
    border-left: 3px solid #007bff;
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.details-table {
    width: 100%;
    font-size: 0.85rem;
}

.details-table th,
.details-table td {
    padding: 0.4rem 0.6rem;
    border: none;
    border-bottom: 1px solid #eee;
}

.details-table th {
    background: transparent;
    font-weight: 500;
    color: #666;
}

.no-data {
    color: #999;
    font-style: italic;
    margin: 0.5rem 0;
}

/* Action buttons in grid */
.btn-add-invoice {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    border-radius: 3px;
    cursor: pointer;
}

.btn-add-payment {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    border-radius: 3px;
    cursor: pointer;
}

.btn-add-invoice:hover {
    background: #c82333;
}

.btn-add-payment:hover {
    background: #0056b3;
}

.btn-xs {
    padding: 0.15rem 0.35rem;
    font-size: 0.7rem;
}

/* Totals row */
.totals-row {
    background: #e9ecef !important;
    font-weight: 600;
}

.totals-row td {
    border-top: 2px solid #dee2e6;
}

/* Invoice/Payment count cells */
.invoice-count,
.payment-count {
    color: #666;
}

/* Responsive */
@media (max-width: 900px) {
    .doctor-accounts-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .doctor-summary-cards {
        flex-direction: column;
    }
    
    .details-content {
        flex-direction: column;
    }
}

/* Retention input styling */
.retention-cell {
    white-space: nowrap;
}

.retention-input {
    width: 50px !important;
    text-align: center;
}

/* Email button in grid */
.btn-send-email {
    background: #6f42c1;
    color: #fff;
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    border-radius: 3px;
    cursor: pointer;
}

.btn-send-email:hover {
    background: #5a32a3;
}

/* Email preview body */
.email-preview-body {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    background: #fff;
    max-height: 400px;
    overflow-y: auto;
}

/* Modal large */
.modal-large {
    max-width: 700px;
    width: 90%;
}

/* Info button */
.btn-info {
    background: #17a2b8;
    color: #fff;
    border: none;
}

.btn-info:hover {
    background: #138496;
}

/* Email settings sections */
#email-settings-form h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    color: #555;
}

#email-settings-form h4:first-of-type {
    margin-top: 0;
}

/* ========== Properties / Real Estate Module ========== */

/* Portfolio Summary Stats */
.portfolio-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.stat-card .stat-value.positive {
    color: #27ae60;
}

.stat-card .stat-value.negative {
    color: #e74c3c;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Property Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-simulation {
    background-color: #fff3cd;
    color: #856404;
}

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

.status-sold {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Form Grid for Property Modal */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

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

.form-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.form-section h4 {
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
    color: #495057;
    font-size: 0.95rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Checkbox Group */
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Calculation Display */
.calculation-display {
    margin-top: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 4px;
    font-size: 0.9rem;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.calc-row.subtotal {
    border-top: 1px dashed #dee2e6;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.calc-row.total {
    border-top: 2px solid #667eea;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    font-weight: 600;
}

/* Calculation Details (IMT/IS breakdown) */
.calc-details {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.calc-detail-header {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px dotted #dee2e6;
}

.calc-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
}

.detail-label {
    color: #6c757d;
}

.detail-value {
    font-weight: 500;
    color: #495057;
}

.calc-detail-row.formula {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dotted #dee2e6;
    justify-content: center;
}

.detail-formula {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #667eea;
    background: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Metrics Display */
.metrics-container {
    margin-top: 1rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

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

@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-card {
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid #dee2e6;
}

.metric-card .metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.metric-card .metric-value.positive {
    color: #27ae60;
}

.metric-card .metric-value.negative {
    color: #e74c3c;
}

.metric-card .metric-label {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.25rem;
}

.metrics-detail {
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

/* Comparison Table */
.comparison-container {
    margin-top: 1rem;
}

.comparison-container h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #495057;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid #dee2e6;
}

.comparison-table th {
    background: #f8f9fa;
    font-weight: 500;
}

.comparison-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.recommendation {
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #d4edda;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

/* Property Details Modal Content */
#property-details-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    max-height: calc(90vh - 120px);
    padding-right: 0.5rem;
}

#property-details-content::-webkit-scrollbar {
    width: 6px;
}

#property-details-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#property-details-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#property-details-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Property Details */
.property-details {
    padding: 1rem 0;
}

.details-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.details-header h2 {
    margin: 0;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

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

.detail-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.detail-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: #495057;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* Projection Section */
.projection-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

.projection-section h3 {
    margin: 0 0 1rem 0;
}

/* Simulation Form */
.simulation-form {
    margin-bottom: 1rem;
}

.simulation-results {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.simulation-results h3 {
    margin: 0 0 1rem 0;
    text-align: center;
}

.result-section {
    background: white;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.result-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: #495057;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.controls-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Large Button */
.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Table Positive/Negative Classes */
.data-table td.positive {
    color: #27ae60;
}

.data-table td.negative {
    color: #e74c3c;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.empty-state p {
    margin: 0 0 1rem 0;
    color: #666;
}

/* Small Data Table */
.data-table.small {
    font-size: 0.85rem;
}

.data-table.small th,
.data-table.small td {
    padding: 0.5rem;
}

/* ===== SPLIT ALLOCATION STYLES ===== */

/* Split Info Box */
.split-info-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.split-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid #e9ecef;
}

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

.split-label {
    color: #666;
    font-size: 0.9rem;
}

.split-amount {
    font-weight: 600;
    font-size: 1.1rem;
}

.split-available {
    font-weight: 600;
    color: #27ae60;
}

#split-mov-description {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toggle Buttons */
.toggle-buttons {
    display: flex;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.toggle-btn:first-child {
    border-right: 1px solid #ddd;
}

.toggle-btn.active {
    background: #667eea;
    color: white;
}

.toggle-btn:hover:not(.active) {
    background: #e9ecef;
}

/* Split Badges */
.split-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.split-badge.allocated {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.split-badge.has-splits {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #007bff;
}

/* Allocated Row Highlight */
.allocated-row {
    background: #fffbeb !important;
}

.allocated-row:hover {
    background: #fef3c7 !important;
}

/* Split Indicator in drilldown */
.split-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
    color: #6b7280;
    font-size: 0.8rem;
}

/* Split Actions Button */
.btn-split {
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-split:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-revert {
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: #92400e;
}

.btn-revert:hover {
    background: #fde68a;
}

/* Split Details Sub-table */
.splits-subtable {
    margin: 0.5rem 0 0.5rem 1.5rem;
    background: #f9fafb;
    border-radius: 4px;
    padding: 0.5rem;
}

.splits-subtable table {
    width: 100%;
    font-size: 0.85rem;
}

.splits-subtable th {
    font-weight: 500;
    color: #6b7280;
    padding: 0.3rem 0.5rem;
    text-align: left;
}

.splits-subtable td {
    padding: 0.3rem 0.5rem;
}

/* ==========================================
   Custom Dashboard Styles
   ========================================== */

/* Custom Dashboard Summary Cards */
.custom-dash-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.custom-dash-summary .summary-card {
    padding: 1.25rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.custom-dash-summary .summary-card h4 {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.custom-dash-summary .summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.custom-dash-summary .summary-value.positive {
    color: #27ae60;
}

.custom-dash-summary .summary-value.negative {
    color: #e74c3c;
}

/* Custom Dashboard Chart */
.custom-dash-chart-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.custom-dash-chart-container .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.custom-dash-chart-container .chart-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #2c3e50;
}

.custom-dash-chart-container .chart-wrapper {
    position: relative;
    height: 300px;
}

/* Custom Dashboard Table */
.custom-dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.custom-dashboard-table th {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.custom-dashboard-table th:nth-child(2),
.custom-dashboard-table th:nth-child(3),
.custom-dashboard-table th:nth-child(4) {
    text-align: right;
}

.custom-dashboard-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #eee;
}

.custom-dashboard-table .custom-dash-name {
    font-weight: 500;
}

.custom-dashboard-table .custom-dash-name.indent {
    padding-left: 2.5rem;
    font-weight: 400;
    color: #555;
}

.custom-dashboard-table .custom-dash-value,
.custom-dashboard-table .custom-dash-avg,
.custom-dashboard-table .custom-dash-pct {
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.custom-dashboard-table .custom-dash-pct {
    color: #666;
    width: 80px;
}

/* Category Row */
.custom-dash-category-row {
    background: #fafbfc;
}

.custom-dash-category-row:hover {
    background: #f5f7f9;
}

/* Subtotal Row */
.custom-dash-subtotal-row {
    background: #e8f4fc;
    font-weight: 600;
}

.custom-dash-subtotal-row td {
    border-top: 2px solid #b8d4e8;
    border-bottom: 2px solid #b8d4e8;
}

.custom-dash-subtotal-row .custom-dash-name {
    font-weight: 700;
}

.custom-dash-subtotal-row .group-icon {
    color: #3498db;
    margin-right: 0.5rem;
}

/* Calculated Row (RECEITA REAL, Fluxo Operacional) */
.custom-dash-calculated-row {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    font-weight: 700;
}

.custom-dash-calculated-row td {
    border-top: 3px solid #667eea;
    border-bottom: 3px solid #667eea;
    padding: 0.875rem 1rem;
}

.custom-dash-calculated-row .custom-dash-name {
    font-size: 1rem;
    color: #333;
}

.custom-dash-calculated-row .group-icon {
    color: #667eea;
    margin-right: 0.5rem;
}

/* Separator Row */
.custom-dash-separator td {
    height: 8px;
    background: transparent;
    border: none;
}

/* Table Header */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-header h3 {
    margin: 0;
}

.period-label {
    font-size: 0.9rem;
    color: #666;
    background: #f0f0f0;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

/* ==========================================
   Manage Dashboard Styles
   ========================================== */

#manage-dash-groups-table,
#manage-dash-mappings-table {
    width: 100%;
    border-collapse: collapse;
}

#manage-dash-groups-table th,
#manage-dash-groups-table td,
#manage-dash-mappings-table th,
#manage-dash-mappings-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#manage-dash-groups-table th,
#manage-dash-mappings-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.calculated-group {
    background: #f8f8f8;
    color: #888;
}

.calculated-group td {
    font-style: italic;
}

.subsection {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.subsection h4 {
    margin-bottom: 1rem;
    color: #333;
}

.mapping-icon {
    margin-right: 0.5rem;
}

.text-muted {
    color: #999;
    font-style: italic;
}

.btn-group {
    display: flex;
    flex-direction: column;
}

.btn-group label {
    visibility: hidden;
    height: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .custom-dash-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .custom-dashboard-table .custom-dash-avg {
        display: none;
    }

    .custom-dashboard-table th:nth-child(3) {
        display: none;
    }
}

/* ==========================================
   Administrative Control Styles
   ========================================== */

.admin-control-welcome {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 2rem;
}

.welcome-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 3rem;
    max-width: 600px;
    text-align: center;
}

.welcome-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1.5rem;
}

.welcome-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.welcome-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

.welcome-card ul {
    text-align: left;
    color: #555;
    padding-left: 2rem;
}

.welcome-card ul li {
    margin-bottom: 0.5rem;
    position: relative;
}

.welcome-card ul li::marker {
    color: #3498db;
}

/* Admin Control Summary Cards */
.admin-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.admin-card-icon {
    font-size: 2.5rem;
}

.admin-card-content {
    display: flex;
    flex-direction: column;
}

.admin-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50;
}

.admin-card-label {
    font-size: 0.85rem;
    color: #666;
}

/* Admin Alerts Section */
.admin-alerts-section {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.admin-alerts-section h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.admin-alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.alerts-card {
    background: #fafafa;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #e74c3c;
}

.alerts-card h4 {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.75rem;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

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

.alert-name {
    font-weight: 500;
}

.alert-date {
    color: #e74c3c;
    font-size: 0.8rem;
}

.admin-no-alerts {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 10px;
}

.no-alerts-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.admin-no-alerts p {
    color: #27ae60;
    font-size: 1.1rem;
}

/* Admin Section Header */
.admin-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-section-header h3 {
    flex: 1;
    margin: 0;
}

/* Admin Toolbar */
.admin-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

/* Admin Filters */
.admin-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th {
    background: #f8f9fa;
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eee;
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-cancelled {
    background: #e2e3e5;
    color: #383d41;
}

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

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

.status-suspended {
    background: #fff3cd;
    color: #856404;
}

.status-archived {
    background: #e2e3e5;
    color: #383d41;
}

/* Tax Type Badges */
.tax-type-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tax-IVA { background: #e3f2fd; color: #1565c0; }
.tax-IRC { background: #fce4ec; color: #c2185b; }
.tax-IRS { background: #f3e5f5; color: #7b1fa2; }
.tax-SS { background: #e8f5e9; color: #2e7d32; }
.tax-IMI { background: #fff8e1; color: #f57f17; }
.tax-IUC { background: #fbe9e7; color: #d84315; }
.tax-other { background: #eceff1; color: #546e7a; }

/* Form Styles for Admin Module */
#admin-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

#admin-modal .form-group {
    margin-bottom: 1rem;
}

#admin-modal .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #555;
}

#admin-modal .form-group input,
#admin-modal .form-group select,
#admin-modal .form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

#admin-modal .form-group textarea {
    resize: vertical;
}

#admin-modal .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

@media (max-width: 768px) {
    .admin-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    #admin-modal .form-row {
        grid-template-columns: 1fr;
    }

    .admin-section-header {
        flex-wrap: wrap;
    }
}

/* Utility Classes */
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.align-center { text-align: center !important; }

/* ================================================
   Current Account Summary (Resumo Conta Corrente)
   ================================================ */

/* Period Selector */
.cas-period-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.cas-period-selector .control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cas-period-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
}

.cas-cycle-label {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Summary Cards */
.cas-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.cas-summary-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    border: 1px solid #eee;
}

.cas-card-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cas-card-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Status Badges for CAS */
.cas-summary-card .status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cas-summary-card .status-open {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
}

.cas-summary-card .status-closed {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

/* Doctors Quick Summary */
.cas-doctors-summary {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

.cas-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.cas-summary-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.cas-summary-subtitle {
    font-size: 0.85rem;
    color: #666;
}

.cas-summary-totals {
    font-size: 0.9rem;
    font-weight: 600;
    color: #27ae60;
    background: #e8f5e9;
    padding: 0.3rem 0.75rem;
    border-radius: 15px;
}

.cas-summary-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px dashed #ddd;
}

.cas-summary-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cas-outside-period .cas-summary-totals {
    background: #ffebee;
    color: #c62828;
}

.cas-no-data {
    color: #999;
    font-style: italic;
    margin: 0.5rem 0 0 0;
}

.cas-doctors-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cas-doctor-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cas-doctor-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.cas-doctor-chip.chip-pending {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #f0c36d;
}

.cas-doctor-chip.chip-paid {
    background: linear-gradient(135deg, #d4edda, #a8e6cf);
    border: 1px solid #82c596;
}

.cas-doctor-chip.chip-outside {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border: 1px solid #ef9a9a;
}

.chip-outside .chip-value {
    color: #c62828;
}

.chip-name {
    font-weight: 600;
    color: #2c3e50;
}

.chip-value {
    font-weight: 700;
    color: #27ae60;
}

.chip-pending .chip-value {
    color: #d68910;
}

.chip-invoices {
    font-size: 0.8rem;
    color: #666;
    padding: 0.15rem 0.5rem;
    background: rgba(255,255,255,0.6);
    border-radius: 10px;
}

/* Action Buttons */
.cas-actions {
    margin-bottom: 1.5rem;
}

.cas-actions .btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

/* Doctors Table */
.cas-doctors-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cas-table {
    width: 100%;
    border-collapse: collapse;
}

.cas-table thead {
    background: #f8f9fa;
}

.cas-table th {
    padding: 1rem;
    font-weight: 600;
    color: #555;
    text-align: left;
    border-bottom: 2px solid #eee;
}

.cas-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.cas-table .doctor-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.cas-table .doctor-row:hover {
    background-color: #f8f9fa;
}

.cas-table .doctor-row.expanded {
    background-color: #e3f2fd;
}

.cas-table .expand-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cas-table .expand-icon {
    font-size: 0.8rem;
    color: #666;
    width: 1rem;
}

/* Invoice Detail Rows */
.invoices-detail-row {
    background-color: #fafafa;
}

.invoices-detail-content {
    padding: 0.5rem 1rem 1rem 2.5rem;
}

.invoices-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.invoices-detail-table th {
    padding: 0.5rem;
    background: #f0f0f0;
    text-align: left;
    font-weight: 500;
}

.invoices-detail-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
}

/* Badges for CAS */
.cas-table .badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.cas-table .badge-pending {
    background: #fff3cd;
    color: #856404;
}

.cas-table .badge-paid {
    background: #d4edda;
    color: #155724;
}

/* Close Period Modal */
.cpm-cycle-info {
    padding: 1rem;
    background: #e3f2fd;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.cpm-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cpm-summary-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.cpm-summary-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.cpm-summary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
}

.cpm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cpm-doctors-section {
    margin-bottom: 1rem;
}

.cpm-doctors-section > label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

.cpm-doctors-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.cpm-doctor-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    gap: 0.5rem;
}

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

.cpm-doctor-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cpm-doctor-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.cpm-doctor-amount {
    font-weight: 600;
    color: #27ae60;
}

.cpm-doctor-invoices {
    font-size: 0.85rem;
    color: #666;
}

.cpm-doctor-notes {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem !important;
}

.cpm-doctor-invoices.no-invoice {
    color: #e65100;
    font-weight: 500;
}

/* Doctors Table in Close Period Modal */
.cpm-doctors-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cpm-doctors-table thead {
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.cpm-doctors-table th {
    padding: 0.5rem 0.4rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
}

.cpm-doctors-table td {
    padding: 0.4rem;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.cpm-doctors-table tbody tr:hover {
    background: #f9f9f9;
}

.cpm-doctors-table tbody tr.excluded {
    opacity: 0.5;
    background: #fafafa;
}

.cpm-doctors-table tbody tr.excluded .cpm-col-name label {
    text-decoration: line-through;
    color: #999;
}

/* Column widths */
.cpm-col-select {
    width: 40px;
    text-align: center !important;
}

.cpm-col-name {
    min-width: 150px;
}

.cpm-col-name label {
    cursor: pointer;
    margin: 0;
    font-weight: 500;
}

.cpm-col-amount {
    width: 100px;
    text-align: right !important;
    font-weight: 500;
    color: #2e7d32;
}

.cpm-col-invoices {
    width: 70px;
    text-align: center !important;
}

.cpm-col-invoices.no-invoice {
    color: #e65100;
}

.cpm-col-notes {
    min-width: 120px;
}

.cpm-col-notes .form-control {
    font-size: 0.85rem;
    padding: 0.25rem 0.4rem;
    height: auto;
}

/* Checkbox styling */
.cpm-doctors-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1976d2;
}

#cpm-select-all {
    width: 18px;
    height: 18px;
}

/* Fee and Invoice Detail Sections */
.fee-detail-section,
.invoices-detail-section {
    margin-bottom: 1rem;
}

.fee-detail-section h5,
.invoices-detail-section h5 {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3rem;
}

.fee-detail-table {
    width: auto;
    font-size: 0.9rem;
}

.fee-detail-table td {
    padding: 0.2rem 0.5rem;
}

.fee-detail-table .fee-net-row {
    border-top: 1px solid #ddd;
    margin-top: 0.3rem;
}

.fee-detail-table .fee-net-row td {
    padding-top: 0.5rem;
}

.no-invoices-msg {
    color: #888;
    font-style: italic;
    font-size: 0.9rem;
}

/* Badge variations */
.badge-warning {
    background: #fff3e0;
    color: #e65100;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Email Section in Close Period Modal */
.cpm-email-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f0f7ff;
    border: 1px solid #b3d4fc;
    border-radius: 8px;
}

.cpm-email-toggle {
    margin-bottom: 0;
}

.cpm-email-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #1565c0;
}

.cpm-email-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.cpm-email-fields {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #b3d4fc;
}

.cpm-email-fields .form-group {
    margin-bottom: 0.75rem;
}

.cpm-email-fields .form-group:last-child {
    margin-bottom: 0;
}

.cpm-email-fields label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #555;
    font-size: 0.9rem;
}

.cpm-email-fields input,
.cpm-email-fields textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.cpm-email-fields textarea {
    resize: vertical;
    min-height: 80px;
}

.cpm-email-fields input[type="file"] {
    padding: 0.4rem;
    background: white;
}

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.cpm-warning {
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin-top: 1rem;
}

.cpm-warning ul {
    margin: 0.5rem 0 0 1.5rem;
    padding: 0;
}

.cpm-warning li {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* Notify Doctors Modal Styles */
.ndm-cycle-info {
    padding: 0.75rem;
    background: #e3f2fd;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.ndm-doctors-section {
    margin-bottom: 1.5rem;
}

.ndm-doctors-section > label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

.ndm-doctors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ndm-doctors-header label {
    font-weight: 500;
    color: #555;
    margin: 0;
}

.ndm-select-actions {
    display: flex;
    gap: 0.5rem;
}

.ndm-doctors-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.ndm-doctor-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    gap: 0.75rem;
}

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

.ndm-doctor-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ndm-doctor-item label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    font-weight: 500;
    color: #333;
}

.ndm-doctor-email {
    font-size: 0.85rem;
    color: #666;
}

.ndm-doctor-email.no-email {
    color: #e65100;
    font-style: italic;
}

.ndm-doctor-amount {
    font-weight: 600;
    color: #27ae60;
    min-width: 80px;
    text-align: right;
}

.ndm-cc-section {
    margin-bottom: 1rem;
}

.ndm-cc-section > label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

.ndm-cc-section input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.ndm-email-section {
    margin-top: 1rem;
}

.ndm-email-section > label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

.ndm-email-hint {
    background: #f5f5f5;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.ndm-email-hint code {
    background: #e0e0e0;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.ndm-email-section textarea {
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 200px;
}

/* Warning Button */
.btn-warning {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

/* History Section */
.cas-history-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 2px solid #eee;
}

.cas-history-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    color: #2c3e50;
    font-weight: 600;
}

.cas-history-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cas-table .cycle-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.cas-table .cycle-row:hover {
    background-color: #f8f9fa;
}

.cas-table .cycle-row.expanded {
    background-color: #fff3cd;
}

.cycle-detail-row {
    background-color: #fffbf0;
}

.cycle-detail-content {
    padding: 1rem 1.5rem;
}

.cycle-payments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.cycle-payments-table th {
    padding: 0.75rem;
    background: #f0f0f0;
    text-align: left;
    font-weight: 500;
}

.cycle-payments-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
}

.cycle-payments-table tfoot td {
    background: #f8f9fa;
    border-top: 2px solid #ddd;
}

.cycle-invoices-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #e3f2fd;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #1565c0;
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.loading-text {
    color: #666;
    font-style: italic;
    padding: 1rem;
}

.error-text {
    color: #e74c3c;
    padding: 1rem;
}

.no-data {
    color: #999;
    padding: 1rem;
    font-style: italic;
}

/* Responsive for CAS */
@media (max-width: 768px) {
    .cas-period-selector {
        flex-wrap: wrap;
    }

    .cas-cycle-label {
        margin-left: 0;
        width: 100%;
        text-align: center;
        margin-top: 0.5rem;
    }

    .cas-summary-cards {
        grid-template-columns: 1fr;
    }

    .cpm-summary {
        grid-template-columns: 1fr;
    }
}

/* ======================== */
/* Work Orders Module       */
/* ======================== */

/* Active Timer Banner */
.wo-timer-banner {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    animation: pulse-timer 2s infinite;
}

@keyframes pulse-timer {
    0%, 100% { box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(52, 152, 219, 0.5); }
}

.wo-timer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.wo-timer-icon {
    font-size: 1.5rem;
}

.wo-timer-order {
    font-weight: 600;
}

.wo-timer-elapsed {
    font-size: 1.5rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.wo-timer-actions {
    display: flex;
    gap: 0.5rem;
}

/* Statistics Cards */
.wo-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.wo-stat-card {
    background: white;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.wo-stat-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.wo-stat-content {
    display: flex;
    flex-direction: column;
}

.wo-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.wo-stat-label {
    font-size: 0.8rem;
    color: #666;
}

/* Toolbar */
.wo-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.wo-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.wo-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

/* Orders List */
.wo-orders-container {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wo-orders-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Order Card */
.wo-order-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #fafafa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    transition: background 0.2s;
    cursor: pointer;
}

.wo-order-card:hover {
    background: #f0f0f0;
}

.wo-order-card.priority-urgent {
    border-left-color: #e74c3c;
}

.wo-order-card.priority-high {
    border-left-color: #e67e22;
}

.wo-order-card.priority-normal {
    border-left-color: #3498db;
}

.wo-order-card.priority-low {
    border-left-color: #95a5a6;
}

.wo-order-card.status-completed {
    opacity: 0.7;
    border-left-color: #27ae60;
}

.wo-order-card.status-cancelled {
    opacity: 0.5;
    border-left-color: #95a5a6;
    text-decoration: line-through;
}

.wo-order-main {
    flex: 1;
    min-width: 0;
}

/* Card tags */
.wo-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.wo-subprocess {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: #f0f0f0;
    color: #555;
    font-size: 0.75rem;
    border-radius: 4px;
}

.wo-order-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.wo-order-number {
    font-size: 0.8rem;
    color: #666;
    font-family: monospace;
}

.wo-order-title {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wo-order-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #888;
}

.wo-order-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.wo-order-badges {
    display: flex;
    gap: 0.5rem;
    margin: 0 1rem;
}

.wo-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.wo-badge-status {
    background: #e8f4fd;
    color: #3498db;
}

.wo-badge-status.open {
    background: #fff3e0;
    color: #e67e22;
}

.wo-badge-status.in_progress {
    background: #e3f2fd;
    color: #2196f3;
}

.wo-badge-status.paused {
    background: #fce4ec;
    color: #e91e63;
}

.wo-badge-status.completed {
    background: #e8f5e9;
    color: #4caf50;
}

.wo-badge-status.cancelled {
    background: #f5f5f5;
    color: #9e9e9e;
}

.wo-badge-priority {
    background: #f5f5f5;
    color: #666;
}

.wo-badge-priority.urgent {
    background: #ffebee;
    color: #e74c3c;
}

.wo-badge-priority.high {
    background: #fff3e0;
    color: #e67e22;
}

.wo-badge-category {
    background: #f3e5f5;
    color: #9b59b6;
}

.wo-order-actions {
    display: flex;
    gap: 0.5rem;
}

.wo-order-actions .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Order Detail Modal */
.wo-detail-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 1rem;
}

.wo-detail-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wo-detail-number {
    font-family: monospace;
    color: #666;
}

.wo-detail-status, .wo-detail-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

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

.wo-detail-reassign {
    margin-left: auto;
}

.wo-reassign-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wo-reassign-section label {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
}

.wo-reassign-section select {
    padding: 0.4rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 150px;
}

.wo-detail-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
}

.wo-detail-main h4 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.wo-detail-main p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.wo-detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
}

.wo-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.wo-meta-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
}

.wo-meta-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Sidebar sections */
.wo-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.wo-time-section, .wo-comments-section {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
}

.wo-time-section h5, .wo-comments-section h5 {
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

#wo-time-logs, #wo-comments {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}

.wo-time-log {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}

.wo-time-log:last-child {
    border-bottom: none;
}

.wo-time-log-date {
    color: #666;
}

.wo-time-log-hours {
    font-weight: 600;
    color: #3498db;
}

.wo-comment {
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.wo-comment-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.wo-comment-user {
    font-weight: 600;
    color: #2c3e50;
}

.wo-comment-text {
    font-size: 0.9rem;
    color: #333;
}

.wo-add-comment {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wo-add-comment textarea {
    resize: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Empty state */
.wo-empty-state {
    text-align: center;
    padding: 3rem;
    color: #888;
}

.wo-empty-state .wo-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .wo-timer-banner {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

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

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

    .wo-filters {
        flex-direction: column;
    }

    .wo-filters select {
        width: 100%;
    }

    .wo-detail-content {
        grid-template-columns: 1fr;
    }

    .wo-order-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .wo-order-badges {
        margin: 0;
    }

    .wo-order-actions {
        justify-content: flex-end;
    }
}

/* ================================ */
/* Work Orders Management (Admin)  */
/* ================================ */

/* Tabs */
.wom-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
}

.wom-tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: #666;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.wom-tab-btn:hover {
    color: #3498db;
}

.wom-tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.wom-tab-content {
    animation: fadeIn 0.2s;
}

/* Period Selector */
.wom-period-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.wom-period-selector label {
    font-weight: 500;
    color: #555;
}

.wom-period-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

/* Global Stats */
.wom-global-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.wom-stat-card {
    background: white;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wom-stat-warning {
    border-left: 3px solid #e74c3c;
}

.wom-stat-icon {
    font-size: 1.75rem;
    opacity: 0.8;
}

.wom-stat-content {
    display: flex;
    flex-direction: column;
}

.wom-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.wom-stat-label {
    font-size: 0.75rem;
    color: #666;
}

/* Rates Container */
.wom-rates-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.wom-rate-card {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}

.wom-rate-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.wom-rate-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* KPI Sections */
.wom-kpi-section {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wom-kpi-section h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.wom-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.wom-kpi-card {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #3498db;
}

.wom-kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    border-left: 3px solid;
}

.wom-kpi-name {
    font-weight: 600;
    color: #2c3e50;
}

.wom-kpi-category {
    font-size: 0.75rem;
    color: #888;
}

.wom-kpi-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.wom-kpi-stat {
    text-align: center;
}

.wom-kpi-stat .wom-kpi-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.wom-kpi-stat .wom-kpi-label {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
}

/* Filters Toolbar */
.wom-filters-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.wom-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.wom-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    min-width: 140px;
}

/* Orders Table */
.wom-orders-table {
    width: 100%;
    border-collapse: collapse;
}

.wom-orders-table th,
.wom-orders-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.wom-orders-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #555;
}

.wom-orders-table tbody tr:hover {
    background: #f5f5f5;
}

.wom-order-number {
    font-family: monospace;
    color: #666;
}

.wom-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.wom-priority-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.wom-priority-badge.urgent {
    background: #ffebee;
    color: #e74c3c;
}

.wom-priority-badge.high {
    background: #fff3e0;
    color: #e67e22;
}

.wom-priority-badge.normal {
    background: #e3f2fd;
    color: #3498db;
}

.wom-priority-badge.low {
    background: #f5f5f5;
    color: #666;
}

.wom-status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.wom-status-badge.open {
    background: #fff3e0;
    color: #e67e22;
}

.wom-status-badge.in_progress {
    background: #e3f2fd;
    color: #2196f3;
}

.wom-status-badge.paused {
    background: #fce4ec;
    color: #e91e63;
}

.wom-status-badge.completed {
    background: #e8f5e9;
    color: #4caf50;
}

.wom-status-badge.cancelled {
    background: #f5f5f5;
    color: #9e9e9e;
}

/* Orders Table - Checkbox & Actions */
.wom-checkbox-header,
.wom-checkbox-cell {
    width: 40px;
    text-align: center !important;
}

.wom-checkbox-header input,
.wom-checkbox-cell input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.wom-actions-cell {
    white-space: nowrap;
}

.wom-actions-cell .btn {
    margin-right: 0.25rem;
}

.wom-actions-cell .btn:last-child {
    margin-right: 0;
}

.wom-actions-cell .btn-danger {
    padding: 0.25rem 0.5rem;
    min-width: unset;
}

#wom-bulk-delete-btn {
    margin-right: 0.5rem;
}

#wom-bulk-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Categories List */
.wom-categories-toolbar {
    margin-bottom: 1.5rem;
}

.wom-categories-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wom-category-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.wom-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f9f9f9;
    border-left: 4px solid #3498db;
}

.wom-category-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wom-category-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.wom-category-name {
    font-weight: 600;
    color: #2c3e50;
}

.wom-inactive-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: #f5f5f5;
    color: #999;
    border-radius: 4px;
}

.wom-category-actions {
    display: flex;
    gap: 0.5rem;
}

.wom-subprocesses-list {
    padding: 0.5rem 1rem 1rem 2.5rem;
}

.wom-subprocess-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

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

.wom-subprocess-item.inactive {
    opacity: 0.5;
}

.wom-subprocess-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wom-subprocess-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.wom-subprocess-name {
    color: #333;
}

.wom-subprocess-hours {
    font-size: 0.75rem;
    color: #888;
    background: #f0f0f0;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.wom-subprocess-actions {
    display: flex;
    gap: 0.5rem;
}

.wom-no-subprocesses {
    color: #999;
    font-style: italic;
    padding: 0.5rem 0;
}

/* Button sizes */
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .wom-global-stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

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

    .wom-filters {
        flex-direction: column;
    }

    .wom-filters select {
        width: 100%;
    }

    .wom-category-header {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ================================ */
/* Work Orders Configuration       */
/* ================================ */

.woc-container {
    padding: 1rem 0;
}

.woc-toolbar {
    margin-bottom: 1.5rem;
}

.woc-categories-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.woc-category-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.woc-category-card.inactive {
    opacity: 0.6;
}

.woc-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.woc-category-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.woc-category-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}

.woc-category-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
}

.woc-inactive-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: #f5f5f5;
    color: #999;
    border-radius: 4px;
}

.woc-subprocess-count {
    font-size: 0.8rem;
    color: #888;
    background: #eee;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.woc-category-actions {
    display: flex;
    gap: 0.5rem;
}

.woc-toggle-btn {
    background: #f0f0f0;
    color: #666;
    border: none;
}

.woc-toggle-btn:hover {
    background: #e0e0e0;
}

.woc-subprocesses-list {
    padding: 1rem 1.25rem;
}

.woc-subprocesses-table {
    width: 100%;
    border-collapse: collapse;
}

.woc-subprocesses-table th,
.woc-subprocesses-table td {
    padding: 0.6rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.woc-subprocesses-table th {
    font-weight: 600;
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.woc-subprocesses-table tbody tr:hover {
    background: #f9f9f9;
}

.woc-subprocesses-table tbody tr.inactive {
    opacity: 0.5;
}

.woc-subprocess-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.woc-description {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666;
    font-size: 0.9rem;
}

.woc-status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.woc-status-badge.active {
    background: #e8f5e9;
    color: #4caf50;
}

.woc-status-badge.inactive {
    background: #f5f5f5;
    color: #999;
}

.woc-no-subprocesses {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .woc-category-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .woc-category-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .woc-subprocesses-table {
        font-size: 0.85rem;
    }

    .woc-description {
        max-width: 120px;
    }
}

/* Work Orders Config - Tabs */
.woc-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e1e5e9;
}

.woc-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.woc-tab:hover {
    color: #3498db;
}

.woc-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.woc-tab-content {
    display: block;
}

.woc-tab-content.hidden {
    display: none;
}

.woc-info-text {
    background: #e8f4fc;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: #0c5460;
    font-size: 13px;
}

/* Work Groups */
.woc-workgroups-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.woc-workgroup-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 16px;
}

.woc-workgroup-card.inactive {
    opacity: 0.6;
    background: #f8f9fa;
}

.woc-workgroup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.woc-workgroup-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.woc-workgroup-name {
    font-weight: 600;
    font-size: 15px;
}

.woc-member-count {
    font-size: 12px;
    color: #666;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 10px;
}

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

.woc-workgroup-description {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px 0;
}

.woc-workgroup-members {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.woc-member-badge {
    background: #3498db;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.woc-no-members {
    color: #999;
    font-size: 13px;
    font-style: italic;
}

.woc-members-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 10px;
}

.woc-member-checkbox {
    display: block;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 13px;
}

.woc-member-checkbox:hover {
    background: #f5f5f5;
}

.woc-member-checkbox input {
    margin-right: 8px;
}

/* Work Group Members - Add/Remove style */
.woc-members-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 10px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    background: #f8f9fa;
    margin-bottom: 10px;
}

.woc-no-members-msg {
    color: #999;
    font-size: 13px;
    font-style: italic;
    margin: 0;
}

.woc-member-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #3498db;
    color: white;
    padding: 5px 10px;
    border-radius: 16px;
    font-size: 13px;
}

.woc-member-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
}

.woc-member-remove:hover {
    opacity: 1;
}

.woc-add-member-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.woc-member-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 13px;
}

/* Triggers */
.woc-triggers-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.woc-triggers-table {
    width: 100%;
    border-collapse: collapse;
}

.woc-triggers-table th,
.woc-triggers-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.woc-triggers-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
}

.woc-triggers-table tbody tr:hover {
    background: #f8f9fa;
}

.woc-triggers-table tbody tr.inactive {
    opacity: 0.6;
}

/* Trigger Items List */
.woc-trigger-items-list {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    max-height: 250px;
    overflow-y: auto;
}

.woc-trigger-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

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

.woc-trigger-item select {
    flex: 1;
    padding: 6px 8px;
    font-size: 13px;
}

.woc-trigger-item input[type="text"] {
    width: 120px;
    padding: 6px 8px;
    font-size: 13px;
}

.woc-trigger-item .btn-remove {
    padding: 4px 8px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.woc-trigger-item .btn-remove:hover {
    background: #c82333;
}

.woc-trigger-items-empty {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.woc-category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: white;
}

.woc-not-configured {
    color: #dc3545;
    font-size: 12px;
    font-style: italic;
}

.woc-priority-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.woc-priority-badge.low {
    background: #e9ecef;
    color: #495057;
}

.woc-priority-badge.normal {
    background: #cce5ff;
    color: #004085;
}

.woc-priority-badge.high {
    background: #fff3cd;
    color: #856404;
}

.woc-priority-badge.urgent {
    background: #f8d7da;
    color: #721c24;
}

.readonly-field {
    background: #f5f5f5;
    cursor: not-allowed;
}

.form-static-text {
    padding: 8px 0;
    color: #666;
    font-size: 13px;
    margin: 0;
}

@media (max-width: 768px) {
    .woc-tabs {
        flex-wrap: wrap;
    }

    .woc-tab {
        flex: 1;
        text-align: center;
        padding: 10px 12px;
        font-size: 12px;
    }

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

    .woc-triggers-table {
        font-size: 12px;
    }

    .woc-triggers-table th,
    .woc-triggers-table td {
        padding: 8px;
    }
}

/* Scheduled Triggers (Recurring work orders) */
.woc-schedules-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.woc-schedules-table {
    width: 100%;
    border-collapse: collapse;
}

.woc-schedules-table th,
.woc-schedules-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.woc-schedules-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
}

.woc-schedules-table tbody tr:hover {
    background: #f8f9fa;
}

.woc-schedules-table tbody tr.inactive {
    opacity: 0.6;
}

.woc-actions-cell {
    white-space: nowrap;
}

.woc-actions-cell .btn {
    margin-right: 4px;
}

.woc-actions-cell .btn:last-child {
    margin-right: 0;
}

/* Schedule Modal Sections */
.woc-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.woc-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.woc-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
    display: inline-block;
}

/* Weekday Checkboxes */
.woc-weekday-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.woc-weekday-checkboxes .checkbox-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.woc-weekday-checkboxes .checkbox-inline:hover {
    background: #e9ecef;
}

.woc-weekday-checkboxes .checkbox-inline input:checked + span,
.woc-weekday-checkboxes .checkbox-inline:has(input:checked) {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Schedule Preview */
.woc-schedule-preview {
    background: #e8f4fc;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 12px 16px;
    color: #0c5460;
    font-size: 13px;
}

.woc-schedule-preview strong {
    color: #0c5460;
}

/* Schedule Stats */
.woc-schedule-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}

.woc-schedule-stats .stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.woc-schedule-stats .stat-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
}

.woc-schedule-stats .stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
}

@media (max-width: 768px) {
    .woc-schedules-table {
        font-size: 12px;
    }

    .woc-schedules-table th,
    .woc-schedules-table td {
        padding: 8px;
    }

    .woc-weekday-checkboxes {
        gap: 4px;
    }

    .woc-weekday-checkboxes .checkbox-inline {
        padding: 4px 8px;
        font-size: 12px;
    }

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

/* ==================== COLLABORATOR ACCOUNTS ==================== */

.collab-name-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.collab-name-link:hover {
    text-decoration: underline;
}

.badge-new {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #d4edda;
    color: #155724;
}

.badge-existing {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e2e3e5;
    color: #383d41;
}

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

.text-success {
    color: #155724;
}

.text-error {
    color: #721c24;
}

.empty-row td {
    color: #999;
}

#collab-annual-view .table-container {
    overflow-x: auto;
}

#collab-annual-view table th,
#collab-annual-view table td {
    white-space: nowrap;
    padding: 6px 8px;
    font-size: 0.85rem;
}

.alert-error {
    padding: 10px 15px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 6px;
    margin: 10px 0;
}
