:root {
    --sidebar-main-width: 96px;
    --sidebar-main-expanded: 96px;
    --sidebar-sub-width: 248px;
    --content-max-width: 1800px;
    --content-horizontal-padding: clamp(0.77rem, 1.68vw, 1.52rem);
    --surface-1: #ffffff;
    --surface-2: #f4f7fb;
    --surface-3: #dde7fb;
    --hover-bg: rgba(37, 99, 235, 0.10);
    --menu-main-bg: linear-gradient(180deg, #1e3a8a 0%, #2563eb 100%);
    --menu-sub-bg: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
    --menu-column-bg: var(--menu-sub-bg);
    --menu-column-border: transparent;
    --menu-column-text: #ffffff;
    --menu-column-muted: #ffffff;
    --menu-column-hover: rgba(255, 255, 255, 0.12);
    --menu-column-active: rgba(255, 255, 255, 0.20);
    --menu-column-accent: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
}

body,
button,
input,
select,
textarea {
    font-family: 'Manrope', 'Inter', sans-serif;
}

html.dark {
    --bg: #08131f;
    --bg-light: #0d1c2c;
    --card: #112133;
    --surface-1: #0f1d2d;
    --surface-2: #15263b;
    --surface-3: #1c3350;
    --text: #f5f9ff;
    --text-light: #b7c7da;
    --border: rgba(148, 163, 184, 0.22);
    --primary: #7cc4ff;
    --primary-light: #9fd4ff;
    --secondary: #34d399;
    --shadow: 0 12px 32px rgba(2, 8, 23, 0.36);
    --shadow-lg: 0 28px 60px rgba(2, 8, 23, 0.54);
    --hover-bg: rgba(96, 165, 250, 0.18);
}

body.dark {
    --bg: #08131f;
    --bg-light: #0d1c2c;
    --card: #112133;
    --surface-1: #0f1d2d;
    --surface-2: #15263b;
    --surface-3: #1c3350;
    --text: #f5f9ff;
    --text-light: #b7c7da;
    --border: rgba(148, 163, 184, 0.22);
    --primary: #7cc4ff;
    --primary-light: #9fd4ff;
    --secondary: #34d399;
    --shadow: 0 12px 32px rgba(2, 8, 23, 0.36);
    --shadow-lg: 0 28px 60px rgba(2, 8, 23, 0.54);
    --hover-bg: rgba(96, 165, 250, 0.18);
}

body.dark,
body.dark .app-container,
body.dark .main-content {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 0, transparent 34%),
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.10), transparent 0, transparent 28%),
        linear-gradient(180deg, #07111d 0%, #0a1625 100%);
    color: var(--text);
}

html.dark body,
html.dark body .app-container,
html.dark body .main-content {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 0, transparent 34%),
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.10), transparent 0, transparent 28%),
        linear-gradient(180deg, #07111d 0%, #0a1625 100%);
    color: var(--text);
}

body.dark .bg-light,
html.dark body .bg-light,
body.dark .bg-white,
html.dark body .bg-white,
body.dark .table-light,
html.dark body .table-light,
body.dark .modal-content,
html.dark body .modal-content,
body.dark .dropdown-menu,
html.dark body .dropdown-menu {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark .text-dark,
html.dark body .text-dark,
body.dark .text-body,
html.dark body .text-body {
    color: var(--text) !important;
}

body.dark .text-muted,
html.dark body .text-muted {
    color: var(--text-light) !important;
}

body.dark .dark-failsafe-surface,
html.dark body .dark-failsafe-surface {
    background: var(--surface-2) !important;
}

body.dark .dark-failsafe-text,
html.dark body .dark-failsafe-text {
    color: var(--text) !important;
}

body.dark .dark-failsafe-muted,
html.dark body .dark-failsafe-muted {
    color: var(--text-light) !important;
}

body.dark .dark-failsafe-border,
html.dark body .dark-failsafe-border {
    border-color: var(--border) !important;
}

body.dark .dark-failsafe-control,
html.dark body .dark-failsafe-control {
    background: var(--surface-1) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

body.dark .sidebar-shell .sidebar,
body.dark .sub-sidebar,
body.dark .card,
body.dark .stat-card,
body.dark .committee-card,
body.dark .training-card,
body.dark .document-card,
body.dark .calendar-container,
body.dark .notification-panel,
body.dark .user-dropdown-menu,
body.dark .modal,
body.dark .meeting-tabs,
body.dark .committee-stat,
body.dark .task-item,
body.dark .checklist-item,
body.dark .conversation-item,
body.dark .received,
body.dark table thead th,
body.dark table tbody td {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

body.dark .notification-btn,
body.dark .menu-toggle,
body.dark .calendar-nav button,
body.dark .meeting-tab.active,
body.dark .search-box input,
body.dark .form-group input,
body.dark .form-group select,
body.dark .form-group textarea,
body.dark .user-dropdown-btn,
body.dark .full-menu-toggle,
body.dark .sub-menu-toggle,
body.dark .icon-btn {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

body.dark .top-bar,
body.dark .sidebar-header,
body.dark .sub-sidebar-header,
body.dark .sidebar-footer,
body.dark .card-header,
body.dark .notification-item,
body.dark .list-header,
body.dark .chat-header,
body.dark .chat-input {
    border-color: var(--border);
}

body.dark .nav-item:hover,
body.dark .nav-item.active,
body.dark .notification-item:hover,
body.dark .calendar-day:hover,
body.dark .role-option:hover,
body.dark .role-option.active,
body.dark .dropdown-item:hover,
body.dark .main-menu .nav-item.active,
body.dark .sub-menu .nav-item.active {
    background: var(--hover-bg);
}

body.dark .calendar-day.today,
body.dark .message.sent,
body.dark .btn-primary {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
}

body.dark .stat-icon.blue,
body.dark .stat-icon.orange,
body.dark .stat-icon.green,
body.dark .stat-icon.red,
body.dark .stat-icon.purple {
    background: var(--surface-3);
}

body.dark .page-title h1,
body.dark .card-header h3,
body.dark .sidebar-brand h2,
body.dark .sub-sidebar-header h3 {
    color: #f8fbff;
}

#navShell.sidebar-shell {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    z-index: 200;
    width: var(--sidebar-main-width);
    background: var(--menu-sub-bg);
    transition: width 0.25s ease;
}

body:not(.submenu-hidden) #navShell.sidebar-shell {
    width: calc(var(--sidebar-main-width) + var(--sidebar-sub-width));
}

#navShell {
    background: var(--menu-sub-bg) !important;
}

#navShell .sidebar.main-sidebar,
#navShell .sidebar-header,
#navShell .main-menu {
    background: var(--menu-main-bg) !important;
}

#navShell .sub-sidebar,
#navShell .sub-sidebar-header,
#navShell .sub-menu {
    background: var(--menu-sub-bg) !important;
}

#navShell .sidebar.main-sidebar,
#navShell .sub-sidebar,
#navShell .sidebar-header,
#navShell .sub-sidebar-header,
#navShell .main-menu,
#navShell .sub-menu,
#navShell .main-menu .nav-item,
#navShell .sub-menu .nav-item {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

#navShell,
#navShell .sidebar.main-sidebar,
#navShell .main-menu,
#navShell .sub-sidebar,
#navShell .sub-menu {
    overflow-x: hidden;
    scrollbar-width: none;
}

#navShell::-webkit-scrollbar,
#navShell .sidebar.main-sidebar::-webkit-scrollbar,
#navShell .main-menu::-webkit-scrollbar,
#navShell .sub-sidebar::-webkit-scrollbar,
#navShell .sub-menu::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.main-sidebar-footer,
.sidebar-global-toggle,
#subMenuToggle,
.sub-menu-toggle {
    display: none !important;
}

.sidebar-global-toggle {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
}

.full-menu-toggle,
.sub-menu-toggle,
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.full-menu-toggle {
    padding: 0.55rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.sub-menu-toggle,
.icon-btn {
    width: 40px;
    height: 40px;
}

#navShell .sidebar.main-sidebar {
    position: relative;
    left: auto;
    top: auto;
    transform: none !important;
    width: var(--sidebar-main-width) !important;
    min-width: var(--sidebar-main-width) !important;
    max-width: var(--sidebar-main-width) !important;
    flex: 0 0 var(--sidebar-main-width) !important;
    height: 100vh;
    padding: 0.85rem 0.45rem 0.75rem;
    overflow-x: hidden;
    background: var(--menu-main-bg);
    border-right: none;
    box-shadow: none;
}

.sidebar-shell.full-open .sidebar {
    width: var(--sidebar-main-width);
    min-width: var(--sidebar-main-width);
}

#navShell .sidebar-header {
    padding: 0.2rem 0.15rem 0.85rem;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 0.55rem;
    border-bottom: none;
}

.sidebar-shell .sidebar-brand {
    display: block;
    text-align: center;
}

.sidebar-shell .sidebar-brand h2 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.sidebar-shell .sidebar-brand span {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffffff;
}

.sidebar-shell .sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

#navShell .main-menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.75rem 0 0.9rem;
}

#navShell .main-menu .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 58px;
    height: auto;
    gap: 0.33rem;
    margin: 0;
    padding: 0.6rem 0.4rem !important;
    border: none !important;
    border-left: none !important;
    border-radius: 14px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
    background: transparent;
    color: var(--menu-column-text);
    box-shadow: none !important;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

#navShell .main-menu .nav-item i,
#navShell .main-menu .nav-item .nav-label,
#navShell .sub-menu .nav-item,
#navShell .sub-menu .nav-item .nav-label,
#navShell .sidebar-brand span {
    color: #ffffff !important;
}

#navShell .main-menu .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateY(-1px);
}

#navShell .main-menu .nav-item.active {
    background: var(--menu-column-accent);
    color: #ffffff;
    box-shadow: none !important;
}

#navShell .main-menu .nav-item i {
    width: auto;
    font-size: 1rem;
}

.main-menu .nav-label {
    display: block;
    font-size: 0.64rem;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.main-menu .nav-item .nav-badge {
    display: none;
}

#navShell .sub-sidebar {
    width: var(--sidebar-sub-width);
    min-width: var(--sidebar-sub-width);
    background: var(--menu-sub-bg);
    border-right: none;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: none;
    backdrop-filter: none;
}

body.dark #navShell .sub-sidebar {
    background: var(--menu-sub-bg);
    border-right: none;
    box-shadow: none;
}

.sub-sidebar.hidden {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-right: 0;
}

#navShell .sub-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 1.15rem 1rem 0.85rem;
    border-bottom: none;
}

#navShell .sub-sidebar-header h3 {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

#navShell .sub-sidebar-header span {
    color: #ffffff;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sub-sidebar-header h3 {
    margin: 0;
}

.sub-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.75rem 1rem;
}

.sub-menu .nav-item {
    position: relative;
    border-left: 0 !important;
    border-radius: 12px;
    padding: 0.78rem 0.9rem 0.78rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    background: transparent;
    color: var(--menu-column-text);
    border: none !important;
    box-shadow: none !important;
    transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.sub-menu .nav-item .nav-label {
    display: block;
    width: 100%;
    text-align: left;
}

.sub-menu .nav-item::before {
    display: none;
}

.sub-menu .nav-item:hover {
    background: var(--menu-column-hover);
    color: #ffffff;
    transform: translateX(2px);
}

.sub-menu .nav-item.active {
    background: var(--menu-column-active);
    color: #ffffff;
}

.sub-menu .nav-item.active::before {
    background: #93c5fd;
}

body.dark .sub-menu .nav-item {
    color: var(--menu-column-text);
}

body.dark .sub-menu .nav-item:hover {
    background: var(--menu-column-hover);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.16);
}

body.dark .sub-menu .nav-item.active {
    background: var(--menu-column-active);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.20);
}

.main-sidebar-footer {
    margin-top: auto;
    padding: 0.5rem 0 0.25rem;
    display: flex;
    justify-content: center;
}

.main-sidebar-footer .icon-btn,
.top-actions .icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

body .main-content {
    margin-left: calc(var(--sidebar-main-width) + var(--sidebar-sub-width));
    width: calc(100vw - (var(--sidebar-main-width) + var(--sidebar-sub-width)));
    padding: 1.4rem var(--content-horizontal-padding) 2rem;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.25s ease;
}

body.submenu-hidden .main-content {
    margin-left: var(--sidebar-main-width);
    width: calc(100vw - var(--sidebar-main-width));
}


body .main-content > * {
    width: min(100%, var(--content-max-width));
    margin-left: auto;
    margin-right: auto;
}

body .top-bar {
    width: min(100%, var(--content-max-width));
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1.35rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    position: relative;
    z-index: 99;
    backdrop-filter: blur(12px);
}

.page-title h1 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 0.12rem;
    letter-spacing: -0.02em;
}

.page-title p {
    color: var(--text-light);
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}

.top-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    position: relative;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    flex: 1;
    max-width: 540px;
    min-width: 220px;
}

.search-box input {
    width: 100%;
    min-width: 220px;
    padding: 0.72rem 1rem 0.72rem 2.7rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    /* Prevent password manager icons */
    background-image: none !important;
    -webkit-text-security: none !important;
}

/* Hide password manager extension icons */
.search-box input::-webkit-credentials-auto-fill-button,
.search-box input::-webkit-contacts-auto-fill-button {
    visibility: hidden !important;
    display: none !important;
    pointer-events: none !important;
}

/* Disable 1Password icon */
.search-box input[data-1p-ignore] {
    background-image: none !important;
}

/* Disable LastPass icon */
.search-box input[data-lpignore="true"] {
    background-image: none !important;
}

.search-box i {
    left: 0.95rem;
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 380px;
    max-width: 480px;
    max-height: 500px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15), 0 8px 16px rgba(15, 23, 42, 0.1);
    z-index: 10001;
    animation: searchDropdownFadeIn 0.2s ease-out;
}

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

.search-loading,
.search-no-results {
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.search-loading i,
.search-no-results i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.search-category {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    background: rgba(248, 250, 252, 0.8);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.search-category i {
    margin-right: 0.5rem;
    color: var(--primary);
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.search-result-item:hover {
    background: rgba(37, 99, 235, 0.04);
}

.search-result-item:last-of-type {
    border-bottom: none;
}

.search-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.search-result-icon.task {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.search-result-icon.policy {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.search-result-icon.meeting {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.search-result-icon.committee {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.search-result-icon.person {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

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

.search-result-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title mark {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary);
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-light);
}

.search-result-meta .badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: capitalize;
}

.search-result-meta .badge-high,
.search-result-meta .badge-urgent {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.search-result-meta .badge-medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.search-result-meta .badge-low {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.search-result-meta .badge-active,
.search-result-meta .badge-published,
.search-result-meta .badge-scheduled {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.search-result-meta .badge-pending,
.search-result-meta .badge-draft {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.search-result-meta .badge-completed,
.search-result-meta .badge-archived {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.search-footer {
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-light);
    background: rgba(248, 250, 252, 0.8);
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

/* Dark mode styles for search */
body.dark .search-results-dropdown {
    background: rgba(15, 27, 45, 0.98);
    border-color: rgba(96, 165, 250, 0.14);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(0, 0, 0, 0.3);
}

body.dark .search-category {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(96, 165, 250, 0.1);
    color: #8aa0b8;
}

body.dark .search-result-item {
    border-color: rgba(96, 165, 250, 0.08);
}

body.dark .search-result-item:hover {
    background: rgba(37, 99, 235, 0.08);
}

body.dark .search-result-title {
    color: #e2e8f0;
}

body.dark .search-result-title mark {
    background: rgba(96, 165, 250, 0.25);
    color: #60a5fa;
}

body.dark .search-footer {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(96, 165, 250, 0.1);
}

body.dark .search-loading i,
body.dark .search-no-results i {
    color: #60a5fa;
}

/* Mobile responsive search */
@media (max-width: 768px) {
    .search-results-dropdown {
        position: fixed;
        top: 70px;
        left: 1rem;
        right: 1rem;
        min-width: auto;
        max-width: none;
        max-height: calc(100vh - 100px);
        z-index: 10001;
    }
}

.notification-btn,
.menu-toggle,
.top-actions .icon-btn {
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.menu-toggle {
    z-index: 201;
}

.sidebar-overlay.active {
    z-index: 150;
}

.notification-btn {
    border-radius: 12px;
}

.user-dropdown-btn {
    padding: 0.35rem 0.7rem 0.35rem 0.35rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.user-dropdown-btn:hover {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.10);
}

.user-dropdown-btn .user-avatar-placeholder {
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
}

.notification-panel,
.user-dropdown-menu {
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

body.dark .top-bar {
    background: rgba(10, 20, 35, 0.88);
    border-color: var(--border);
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.28);
}

body.dark .notification-btn,
body.dark .menu-toggle,
body.dark .top-actions .icon-btn,
body.dark .user-dropdown-btn,
body.dark .search-box input {
    background: rgba(15, 27, 45, 0.96);
    border-color: rgba(96, 165, 250, 0.14);
}

.table-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.table-tools .search-box {
    flex: 1 1 240px;
}

.table-tools .search-box input {
    width: 100%;
}

.advanced-filters {
    display: none;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}

.advanced-filters.active {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.enhanced-table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.enhanced-table-pagination .pagination-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.enhanced-table-pagination .pagination-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.enhanced-table-pagination .showing-text {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
}

.enhanced-table-pagination .rows-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.enhanced-table-pagination .rows-selector select {
    width: auto;
    min-width: 60px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
}

.enhanced-table-pagination .page-info {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
    padding: 0 0.5rem;
}

.enhanced-table-pagination .btn {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
    min-width: 70px;
}

.enhanced-table-pagination .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable::after {
    content: ' ↕';
    font-size: 0.72rem;
    color: var(--text-light);
}

th.sortable.sorted-asc::after {
    content: ' ↑';
}

th.sortable.sorted-desc::after {
    content: ' ↓';
}

.empty-table-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

@media (max-width: 1024px) {
    .sidebar-shell {
        transform: translateX(-110%);
        transition: transform 0.25s ease;
        box-shadow: var(--shadow-lg);
        background: var(--menu-column-bg);
    }

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

    .sidebar-global-toggle {
        display: none;
    }

    .sidebar-shell .sidebar {
        padding-top: 1rem;
    }

    .sub-sidebar-header {
        padding-top: 1rem;
    }

    .main-content,
    body.submenu-hidden .main-content {
        margin-left: 0;
        width: 100%;
        padding: 4.5rem max(1rem, var(--content-horizontal-padding)) 1.5rem;
    }

    .main-content > * {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .sub-sidebar {
        width: min(78vw, 280px);
        min-width: min(78vw, 280px);
    }

    /* Keep the shell wide enough for the widened sub column so it is not clipped */
    body:not(.submenu-hidden) #navShell.sidebar-shell {
        width: calc(var(--sidebar-main-width) + min(78vw, 280px));
    }

    .full-menu-toggle span {
        display: none;
    }

    .table-tools,
    .enhanced-table-pagination {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem 0.5rem;
    }
    
    .enhanced-table-pagination .pagination-left,
    .enhanced-table-pagination .pagination-right {
        justify-content: center;
        width: 100%;
    }

    body .main-content {
        padding: 4.5rem max(1rem, var(--content-horizontal-padding)) 1.5rem !important;
    }
}

#navShell .sidebar-logo {
    background: rgba(255, 255, 255, 0.16);
}

body.dark #navShell .sidebar.main-sidebar {
    background: var(--menu-column-bg);
}

body.dark #navShell .main-menu .nav-item {
    background: transparent;
    border: none !important;
    color: var(--menu-column-text);
}

body.dark #navShell .main-menu .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

body.dark #navShell .main-menu .nav-item.active {
    background: var(--menu-column-accent);
    color: #ffffff;
    border: none !important;
}

body.dark .search-box input::placeholder,
body.dark input::placeholder,
body.dark textarea::placeholder {
    color: #8aa0b8;
}

body.dark .finance-tabs,
body.dark .invoice-tabs,
body.dark .meeting-tabs {
    background: rgba(148, 163, 184, 0.04);
    border-radius: 10px;
}

body.dark .finance-tab,
body.dark .invoice-tab,
body.dark .meeting-tab {
    color: var(--text-light);
}

body.dark .finance-tab.active,
body.dark .invoice-tab.active,
body.dark .meeting-tab.active {
    background: var(--surface-3);
    color: var(--primary-light);
    box-shadow: none;
}

body.dark .meeting-detail-tab {
    color: #9fb3c8;
}

body.dark .meeting-detail-tab.active {
    color: #bfdbfe;
    border-bottom-color: #60a5fa;
}

body.dark .meeting-category-panel,
body.dark .meeting-card {
    background: linear-gradient(180deg, rgba(16, 30, 48, 0.96) 0%, rgba(10, 20, 34, 0.96) 100%);
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.24);
}

body.dark .meeting-category-header {
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

body.dark .meeting-category-icon,
body.dark .meeting-board-count,
body.dark .meeting-card-type {
    background: rgba(96, 165, 250, 0.14);
    color: #bfdbfe;
}

body.dark .meeting-card-date {
    color: #dce8f5;
}

/* Dark mode urgency states */
body.dark .meeting-card-urgent {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(16, 30, 48, 0.96) 100%);
}

body.dark .meeting-card-soon {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.1) 0%, rgba(16, 30, 48, 0.96) 100%);
}

body.dark .meeting-card-upcoming {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1) 0%, rgba(16, 30, 48, 0.96) 100%);
}

body.dark .meeting-card-past {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.08) 0%, rgba(16, 30, 48, 0.96) 100%);
}

body.dark .meeting-action-menu {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: 0 16px 32px rgba(2, 6, 23, 0.55);
}

body.dark .meeting-action-menu-item {
    color: #dbe7f4;
}

body.dark .meeting-action-menu-item:hover {
    background: rgba(51, 65, 85, 0.45);
    color: #bfdbfe;
}

body.dark .quick-action-btn,
body.dark .type-label,
body.dark .transaction-item,
body.dark .finance-summary-divider {
    background: transparent;
    border-color: var(--border);
}

body.dark .table-responsive,
body.dark .data-table {
    background: transparent;
}

body.dark .card,
body.dark .stat-card,
body.dark .calendar-container,
body.dark .document-card,
body.dark .training-card,
body.dark .committee-card,
body.dark .modal,
body.dark .notification-panel,
body.dark .user-dropdown-menu {
    background: linear-gradient(180deg, rgba(16, 30, 48, 0.96) 0%, rgba(10, 20, 34, 0.96) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.30);
}

body.dark .stat-card {
    border-color: rgba(148, 163, 184, 0.18);
}

body.dark .stat-card.primary { background: linear-gradient(135deg, rgba(25, 55, 95, 0.98) 0%, rgba(13, 31, 53, 0.98) 100%); }
body.dark .stat-card.success { background: linear-gradient(135deg, rgba(11, 60, 52, 0.98) 0%, rgba(8, 38, 33, 0.98) 100%); }
body.dark .stat-card.warning { background: linear-gradient(135deg, rgba(73, 46, 14, 0.98) 0%, rgba(47, 30, 9, 0.98) 100%); }
body.dark .stat-card.danger { background: linear-gradient(135deg, rgba(77, 24, 34, 0.98) 0%, rgba(51, 14, 23, 0.98) 100%); }
body.dark .stat-card.info { background: linear-gradient(135deg, rgba(13, 54, 73, 0.98) 0%, rgba(8, 35, 48, 0.98) 100%); }
body.dark .stat-card.purple { background: linear-gradient(135deg, rgba(54, 31, 87, 0.98) 0%, rgba(32, 18, 54, 0.98) 100%); }

body.dark .stat-value,
body.dark .data-table td,
body.dark .table-standard td {
    color: var(--text);
}

body.dark .data-table th {
    background: rgba(148, 163, 184, 0.10);
    color: #dce8f5;
    border-bottom-color: rgba(148, 163, 184, 0.16);
}

body.dark .data-table td,
body.dark .table-standard td {
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

body.dark .data-table tbody tr:hover,
body.dark .transaction-item:hover,
body.dark .quick-action-btn:hover {
    background: rgba(96, 165, 250, 0.10);
}

body.dark .btn-secondary {
    background: rgba(17, 33, 51, 0.88);
    color: var(--text-light);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: none;
}

body.dark .btn-secondary:hover {
    background: rgba(26, 47, 72, 0.96);
    color: var(--text);
}

/* Dark mode — action icon buttons */
body.dark .btn-action {
    background: rgba(10, 20, 34, 0.88);
    color: var(--text-light);
    border-color: rgba(148, 163, 184, 0.2);
}
body.dark .btn-action:hover {
    background: rgba(23, 35, 54, 0.95);
    color: var(--text);
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.35);
}

body.dark .btn-action-view {
    background: rgba(14, 165, 233, 0.18);
    color: #7dd3fc;
    border-color: rgba(125, 211, 252, 0.36);
}
body.dark .btn-action-view:hover {
    background: rgba(14, 165, 233, 0.3);
    color: #bae6fd;
}

body.dark .btn-action-edit {
    background: rgba(37, 99, 235, 0.18);
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.36);
}
body.dark .btn-action-edit:hover {
    background: rgba(37, 99, 235, 0.3);
    color: #bfdbfe;
}

body.dark .btn-action-pause {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
    border-color: rgba(252, 211, 77, 0.34);
}
body.dark .btn-action-pause:hover {
    background: rgba(245, 158, 11, 0.3);
    color: #fde68a;
}

body.dark .btn-action-play {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
    border-color: rgba(110, 231, 183, 0.34);
}
body.dark .btn-action-play:hover {
    background: rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}

body.dark .btn-action-delete {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.34);
}
body.dark .btn-action-delete:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

body.dark .btn-outline {
    background: transparent;
    color: var(--text-light);
    border-color: rgba(148, 163, 184, 0.22);
}
body.dark .btn-outline:hover {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text);
    border-color: rgba(96, 165, 250, 0.35);
}

body.dark .btn-outline-primary {
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}
body.dark .btn-outline-primary:hover {
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
    border-color: #60a5fa;
}

body.dark .btn-outline-secondary {
    color: var(--text-light);
    border-color: rgba(148, 163, 184, 0.22);
}
body.dark .btn-outline-secondary:hover {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text);
    border-color: rgba(96, 165, 250, 0.35);
}

body.dark .btn-outline-danger {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
}
body.dark .btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    border-color: #f87171;
}

body.dark .btn-icon {
    background: rgba(15, 27, 45, 0.7);
    color: var(--text-light);
    border-color: rgba(148, 163, 184, 0.14);
}
body.dark .btn-icon:hover {
    background: rgba(30, 41, 59, 0.9);
    color: var(--text);
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.35);
}

body.dark .btn-secondary.active {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.24), rgba(59, 130, 246, 0.18));
    color: #f8fbff;
    border-color: rgba(96, 165, 250, 0.34);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

body.dark .page-subtitle,
body.dark .stat-label,
body.dark .transaction-meta,
body.dark .finance-summary-item .label {
    color: var(--text-light);
}

body.dark #tasks [style*="background: white"] {
    background: var(--card) !important;
}

body.dark #tasks [style*="background: #f8fafc"],
body.dark #tasks [style*="background: #f1f5f9"],
body.dark #tasks [style*="background: #f3f4f6"] {
    background: rgba(148, 163, 184, 0.08) !important;
}

body.dark #tasks [style*="color: #1e293b"],
body.dark #tasks [style*="color: #475569"] {
    color: var(--text) !important;
}

body.dark #tasks [style*="color: #64748b"],
body.dark #tasks [style*="color: #94a3b8"],
body.dark #tasks [style*="color: #9ca3af"],
body.dark #tasks [style*="color: #cbd5e1"] {
    color: var(--text-light) !important;
}

body.dark #tasks [style*="border: 1px solid #e2e8f0"],
body.dark #tasks [style*="border-bottom: 1px solid #e2e8f0"],
body.dark #tasks [style*="border-bottom: 1px solid #f1f5f9"],
body.dark #tasks [style*="border: 1px solid #d1d5db"],
body.dark #tasks [style*="border: 2px dashed #d1d5db"] {
    border-color: rgba(148, 163, 184, 0.16) !important;
}

body.dark #tasks [style*="border: 2px solid white"] {
    border-color: rgba(8, 19, 31, 0.96) !important;
}

body.dark #tasks textarea,
body.dark #tasks input,
body.dark #tasks select {
    background: rgba(15, 29, 45, 0.94) !important;
    color: var(--text) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
}

body.dark #tasks textarea::placeholder,
body.dark #tasks input::placeholder {
    color: #8fa5bd !important;
}

body.dark #navShell .sub-sidebar-header,
body.dark #navShell .sub-menu .nav-item {
    color: #d8e4f2;
}

body.dark #navShell .sub-menu .nav-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
}

body.dark #navShell .sub-menu .nav-item:hover {
    background: rgba(96, 165, 250, 0.10);
    border-color: rgba(96, 165, 250, 0.18);
}

body.dark #navShell .sub-menu .nav-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.24), rgba(37, 99, 235, 0.18));
    color: #ffffff;
    border-color: rgba(96, 165, 250, 0.22);
}

/* ==========================================
   Dark Mode - Modern Calendar System
   ========================================== */

body.dark .calendar-main,
body.dark .mini-calendar-card,
body.dark .upcoming-events-card,
body.dark .bento-stat-card {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark .calendar-header-modern h2 {
    color: #f1f5f9;
}

body.dark .btn-today {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

body.dark .btn-today:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

body.dark .view-switcher {
    background: rgba(255, 255, 255, 0.05);
}

body.dark .view-switcher button:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark .view-switcher button.active {
    background: rgba(30, 41, 59, 0.9);
    color: #60a5fa;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

body.dark .calendar-nav-modern button {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.dark .calendar-nav-modern button:hover {
    background: #3b82f6;
    border-color: #3b82f6;
}

body.dark .calendar-day {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark .calendar-day:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.2);
}

body.dark .calendar-day.other-month {
    background: rgba(15, 23, 42, 0.4);
    opacity: 0.4;
}

body.dark .calendar-day.today {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #3b82f6;
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.4);
}

body.dark .calendar-day.today .day-number {
    background: rgba(255,255,255,0.15);
    color: white;
}

body.dark .calendar-day .day-number {
    color: #e2e8f0;
}

body.dark .calendar-day-header {
    color: #94a3b8;
}

body.dark .calendar-day .day-event-pill {
    border-left-color: rgba(255,255,255,0.4);
}

body.dark .mini-calendar-day {
    color: #e2e8f0;
}

body.dark .mini-calendar-day.other-month {
    color: #64748b;
    opacity: 0.5;
}

body.dark .mini-calendar-day.today {
    background: #3b82f6;
    color: white;
}

body.dark .mini-calendar-day.selected {
    color: #60a5fa;
    box-shadow: inset 0 0 0 1.5px #60a5fa;
}

body.dark .mini-calendar-day.today.selected {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.7), 0 0 0 1px #93c5fd;
}

body.dark .mini-nav-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #60a5fa;
}

body.dark .upcoming-events-header {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
}

body.dark .upcoming-event-item:hover {
    background: rgba(255,255,255,0.04);
}

body.dark .quick-action-btn {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

body.dark .quick-action-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.2);
}

body.dark .quick-action-btn:hover i {
    background: #3b82f6;
    color: white;
}

body.dark .quick-action-btn i {
    background: rgba(255,255,255,0.06);
}

body.dark .calendar-legend {
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark .calendar-week-view,
body.dark .calendar-day-view {
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark .calendar-week-header,
body.dark .calendar-day-view-header {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark .calendar-week-header-cell {
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark .calendar-week-header-cell.today {
    background: rgba(59, 130, 246, 0.08);
    color: #60a5fa;
}

body.dark .calendar-week-header-cell .day-number {
    color: #e2e8f0;
}

body.dark .calendar-week-time-label {
    background: rgba(255,255,255,0.02);
    border-color: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

body.dark .calendar-week-cell {
    background: rgba(30, 41, 59, 0.3);
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark .calendar-week-cell.today {
    background: rgba(59, 130, 246, 0.05);
}

body.dark .calendar-day-view-header .day-number {
    color: #f1f5f9;
}

body.dark .calendar-day-time-slot {
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark .calendar-day-event-card,
body.dark .calendar-agenda-event {
    background: rgba(255,255,255,0.04);
}

body.dark .calendar-day-event-card:hover,
body.dark .calendar-agenda-event:hover {
    background: rgba(255,255,255,0.08);
}

body.dark .calendar-agenda-date-header {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(30, 41, 59, 0.95);
}

body.dark .calendar-agenda-date-header .day-number {
    color: #f1f5f9;
}

body.dark .calendar-agenda-date-header.today .day-number {
    color: #60a5fa;
}

body.dark .calendar-agenda-empty {
    color: #94a3b8;
}
