/* Generated base styles. Tabulator must load after this file. */
/* public/css/main.css */
:root {
    --primary-dark: #003366;
    --primary-cyan: #00B2CC;
    --primary-silver: #F5F7FA;
    --accent-orange: #FF9900;
    --text-dark: #1a1a1a;
    --text-gray: #6b7280;
    --border-color: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info-color: #0ea5e9;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-light: #e0f2fe;
    --success-light: #d1fae5;
    --warning-light: #fef3c7;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --sidebar-width: 300px;
    --sidebar-collapsed-width: 72px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--primary-silver);
    color: var(--text-dark);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.2s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex: 0 0 auto;
}

.logo-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    width: 132px;
    max-width: 100%;
    line-height: 0;
}

.logo-text img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: left center;
}

.logo-text-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.1;
}

.logo-subtext {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.02em;
}

.logo-partner {
    height: 20px;
    width: auto;
    display: block;
    object-fit: contain;
}

.sidebar .logo-partner {
    background: #fff;
    padding: 2px 6px;
    border-radius: 6px;
}

/* Company logo image (when provided) */
.logo img.company-logo {
    max-height: 40px;
    width: auto;
    display: block;
}

/* Department Selector - Removed as non-functional
.department-selector {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.department-chips {
    display: flex;
    gap: 0.5rem;
} */

.chip {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.chip:hover, .chip.active {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
    color: white;
}

/* Navigation */
.nav-menu {
    padding: 1rem 0;
}

/* Keep the static navigation fail-closed until authenticated role gates run. */
body:not(.nav-role-ready) .nav-menu {
    visibility: hidden;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0 1.5rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: rgba(0, 178, 204, 0.1);
    border-left-color: var(--primary-cyan);
    color: white;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Collapsed sidebar state */
.app-container.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.app-container.sidebar-collapsed .logo-text,
.app-container.sidebar-collapsed .logo-text-block,
.app-container.sidebar-collapsed .logo-subtext,
.app-container.sidebar-collapsed .logo-partner,
.app-container.sidebar-collapsed .nav-label,
.app-container.sidebar-collapsed .nav-section-title {
    display: none;
}

.app-container.sidebar-collapsed .nav-item {
    justify-content: center;
    gap: 0;
    padding: 0.75rem 0.5rem;
}

.app-container.sidebar-collapsed .nav-icon {
    width: auto;
}

/* Ensure the collapse/expand button remains visible when collapsed */
.app-container.sidebar-collapsed .sidebar-header {
    padding: 1rem 0.5rem;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* Navigation Groups and Submenus */
.nav-group .nav-item {
    justify-content: space-between;
}

.nav-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

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

.nav-submenu {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    padding-left: 2rem;
}

.nav-group.expanded .nav-submenu {
    display: block;
}

.nav-subitem {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.nav-subitem:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.nav-subitem.active {
    background: rgba(0, 178, 204, 0.15);
    color: var(--primary-cyan);
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.breadcrumb-item {
    background: none;
    border: none;
    color: var(--primary-cyan);
    cursor: pointer;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.breadcrumb-item:hover {
    background: rgba(0, 178, 204, 0.1);
}

.breadcrumb-separator {
    color: var(--text-gray);
}

.breadcrumb-current {
    color: var(--text-gray);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-cyan);
    cursor: pointer;
    text-decoration: underline;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    /* Use fixed viewport height and hide outer scroll to avoid double scrollbars */
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-container.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Header */
.main-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: inline-flex;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-gray);
}

/* Improve toggle appearance when placed in sidebar */
.sidebar .sidebar-toggle {
    color: rgba(255, 255, 255, 0.85);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

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

/* Chevron icon animation */
.sidebar .sidebar-toggle svg {
    transition: transform 0.2s ease;
}

/* Header toggle chevron animation + collapsed flip */
#headerSidebarToggle svg { transition: transform 0.2s ease; }
.app-container.sidebar-collapsed #headerSidebarToggle svg { transform: rotate(180deg); }

/* When collapsed, flip chevron to point right (expand) */
.app-container.sidebar-collapsed .sidebar .sidebar-toggle svg {
    transform: rotate(180deg);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--primary-silver);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    min-width: 300px;
    position: relative;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    flex: 1;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-gray);
}

/* Clear (x) button inside global search */
.search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-gray);
    display: none; /* shown when input has value */
    font-size: 16px;
    line-height: 1;
}
.search-clear:hover { color: var(--primary-dark); }

.search-results {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.search-section {
    border-bottom: 1px solid var(--border-color);
}

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

.search-title {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-gray);
}

.search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.search-item-icon {
    width: 18px;
    color: var(--text-gray);
}

.search-item-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.1rem;
}

.search-item-label {
    font-weight: 500;
}

.search-item-subtitle,
.search-item-meta {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.search-item-meta {
    margin-left: auto;
}

.search-item:hover {
    background: var(--primary-silver);
}

.search-item.active {
    background: var(--primary-silver);
}

.search-empty {
    padding: 0.5rem 1rem;
    color: var(--text-gray);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

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

.header-actions-cluster {
    margin-left: 0.25rem;
}

.header-company-cluster .company-context,
.header-company-cluster .company-switcher {
    margin-right: 0;
}

/* Spacing for quick log time button moved from inline */
#quickLogTimeBtn { margin-right: 0; }

.main-header .design-toggle-btn {
    border: 1px solid transparent;
    color: var(--text-gray);
    background: transparent;
    box-shadow: none;
}

.main-header .design-toggle-btn:hover {
    background: var(--primary-silver);
    color: var(--primary-dark);
    transform: none;
}

.main-header .design-toggle-btn .btn-icon-shell {
    font-size: 16px;
    line-height: 1;
}

.header-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-gray);
    position: relative;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.header-btn:hover {
    background: var(--primary-silver);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    z-index: 1;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-cyan);
    color: white !important;
    border: 2px solid white;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
}

.user-avatar:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Page Container */
.page-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Footer */
.app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50; /* Below sidebar (z-index: 100) */
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 1.25rem;
    color: var(--text-gray);
    font-size: 0.75rem; /* Smaller text */
}

.app-footer .footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 0.5rem 0.75rem;
        font-size: 0.7rem;
        text-align: center;
    }
}

/* Ensure page content isn't hidden behind fixed footer */
.page-container {
    padding-bottom: 3.25rem; /* Space for footer */
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at top left, rgba(15, 23, 42, 0.08), transparent 28%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.08), transparent 24%),
        #f3f5f8;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    display: flex;
    opacity: 0;
    pointer-events: none;
}

.loading-panel {
    min-width: min(420px, calc(100vw - 48px));
    padding: 28px 30px;
    border-radius: 22px;
    border: 1px solid rgba(203, 213, 225, 0.88);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(18px);
}

.loading-brand {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
}

.loading-logo-mark {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.loading-logo-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.loading-logo-text {
    width: 156px;
    max-width: 100%;
    line-height: 0;
}

.loading-logo-text img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: left center;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(17, 24, 39, 0.08);
    border-top: 3px solid var(--primary-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex: 0 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-screen p {
    color: #374151;
    font-size: 1rem;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar-toggle { display: inline-flex; }
    .search-bar { min-width: 200px; }
    .header-right { gap: 0.75rem; }
}

@media (max-width: 768px) {
    .main-header {
        padding: 1rem;
    }
    
    .page-container {
        padding: 1rem;
    }
    
    .search-bar {
        min-width: 150px;
    }
    
    .header-left {
        gap: 0.5rem;
    }

    .header-company-cluster,
    .header-actions-cluster {
        width: 100%;
        justify-content: flex-start;
    }

    .loading-panel {
        min-width: min(360px, calc(100vw - 24px));
        padding: 22px 20px;
        border-radius: 18px;
    }

    .loading-indicator {
        gap: 12px;
    }

    .loading-spinner {
        width: 42px;
        height: 42px;
    }
}

/* Hide sidebar's toggle on tablet/mobile (we use floating mobile button) */
@media (max-width: 1024px) {
    .sidebar .sidebar-toggle { display: none !important; }
}

/* Hide header sidebar toggle on mobile/tablet (use mobile hamburger) */
@media (max-width: 1024px) {
    #headerSidebarToggle { display: none !important; }
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-cyan) 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
}

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

.login-header .logo {
    justify-content: center;
    margin-bottom: 1rem;
}

.login-header p {
    color: var(--text-gray);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* public/css/components.css */
/* Utility helpers */
.hidden {
    display: none;
}

[data-kionov-icon],
.kionov-inline-icon,
.kionov-icon-host {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    line-height: 0;
}

[data-kionov-icon] svg,
.kionov-inline-icon svg,
.kionov-icon-host svg {
    width: 1.05rem;
    height: 1.05rem;
}

.section-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
}

.section-toggle .chevron {
    transition: transform 0.2s ease;
}

.section-toggle[data-collapsed="1"] .chevron {
    transform: rotate(-90deg);
}

.client-extra-details summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--hover-color, #f5f5f5);
    cursor: pointer;
    user-select: none;
}

.client-extra-details summary::-webkit-details-marker {
    display: none;
}

.client-extra-details summary::marker {
    content: '';
}

.client-extra-details summary::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
}

.client-extra-details[open] summary::before {
    transform: rotate(90deg);
}

.client-extra-details summary:focus-visible {
    outline: 2px solid var(--primary, #0aa);
    outline-offset: 2px;
}

/* Language Selector */
.language-selector {
    position: relative;
    padding: 0.45rem 0.875rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
    user-select: none;
}

.language-selector:hover {
    background-color: var(--hover-color, #f5f5f5);
}

.current-language {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
}

.current-language:after {
    content: '';
    width: 7px;
    height: 7px;
    margin-left: 0.5rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-1px);
    transition: transform 0.2s ease;
}

.language-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.language-selector.active .language-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-selector.active .current-language:after {
    transform: rotate(225deg) translateY(0);
}

/* Smooth fade-out on close */
.language-selector.active.closing .language-options {
    opacity: 0;
    transform: translateY(-10px);
    visibility: visible; /* keep visible during transition */
}

.language-options a {
    display: block;
    padding: 0.5rem 0.875rem;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.language-options a:last-child {
    border-bottom: none;
}

.language-options a:hover {
    background-color: var(--primary-silver, #f8f9fa);
}

.language-options a.active {
    background-color: var(--primary-cyan, #00B2CC);
    color: white;
}

/* Visual cue for active language option */
.language-options a.active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 0.5rem;
    border-radius: 999px;
    background: currentColor;
    vertical-align: middle;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 2rem;
}

.card-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--primary-silver);
    border-radius: 0 0 12px 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    justify-content: center;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.55);
    box-shadow: none;
    transform: none;
}

.btn:disabled:hover,
.btn[disabled]:hover {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.55);
    box-shadow: none;
    transform: none;
}

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

.btn-primary:hover {
    background: #009BB3;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Busy state spinner for buttons */
.btn[aria-busy="true"] {
    opacity: 0.9;
    cursor: progress;
}
.btn[aria-busy="true"]::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: kionov-spin .6s linear infinite;
}

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

.btn-secondary {
    background: var(--text-gray);
    color: white;
}

.btn-secondary:hover {
    background: #374151;
}

.btn-outline {
    background: transparent;
    color: var(--primary-cyan);
    border: 1px solid var(--primary-cyan);
}

.btn-outline:hover {
    background: var(--primary-cyan);
    color: white;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* Ghost/Icon buttons for toolbars and toggles */
.btn-ghost {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0.5rem; /* override .btn padding for compact controls */
    border-radius: 8px;
}

.btn-ghost:hover {
    background: var(--primary-silver);
}

/* Ensure avatar button stays visible when no image is present */
.user-avatar.btn-ghost {
    /* Use background-color so inline background-image (when present) still shows */
    background-color: var(--primary-cyan);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* size driven by container-specific CSS */
}

.design-toggle-btn {
    width: auto;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0 0.7rem;
    gap: 0.4rem;
    border-radius: 10px;
}

.design-toggle-btn .btn-icon-shell {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.design-toggle-label {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

/* Utilities (minimal set for inline-style cleanup) */
.ml-2 { margin-left: 0.5rem; }
.mr-2 { margin-right: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.w-full { width: 100%; }
.abs-tr-6 { position: absolute; right: 6px; top: 6px; }

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

/* Compact card variant: reduces paddings and table density for tighter UIs */
.card.compact .card-header { padding: 0.75rem 1rem; }
.card.compact .card-body { padding: 1rem 1.25rem; }
.card.compact .table th,
.card.compact .table td { padding: 0.5rem 0.5rem; }
.card.compact .btn.btn-sm { padding: 0.35rem 0.6rem; }

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(0, 178, 204, 0.1);
}

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

.form-textarea-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    white-space: pre;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

/* Validation states */
.form-input.error, .form-select.error, .form-textarea.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.validation-error {
    color: var(--danger-color);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
}

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

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(0, 178, 204, 0.1); color: var(--primary-cyan); }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.red { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: var(--text-dark);
    line-height: 1;
}

/* Ensure numbers in tiles align right when used in card layouts */
.stat-card .stat-value { text-align: right; }

.stat-label {
    color: var(--text-gray);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th {
    background: var(--primary-silver);
    color: var(--text-dark);
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: rgba(0, 178, 204, 0.05);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-info { background: rgba(0, 178, 204, 0.1); color: var(--primary-cyan); }
.badge-gray { background: rgba(107, 114, 128, 0.1); color: var(--text-gray); }

/* Progress Bars */
.progress {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-cyan);
    transition: width 0.3s ease;
}

/* Dropdowns */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 50;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.dropdown-menu a:hover {
    background: var(--primary-silver);
}

.dropdown-menu hr {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.profile-flyout {
    min-width: 282px;
    padding: 0.625rem;
}

.profile-flyout-summary {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.125rem 0.125rem 0.625rem;
}

.profile-flyout-summary-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-dark);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    flex: 0 0 auto;
}

.profile-flyout-summary-copy {
    min-width: 0;
    flex: 1;
}

.profile-flyout-name {
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
    font-size: 0.875rem;
}

.profile-flyout-email {
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: var(--text-gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-flyout-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.4rem;
    margin-top: 0.35rem;
}

.profile-flyout-role,
.profile-flyout-company {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--primary-silver);
    font-size: 0.625rem;
    line-height: 1;
    color: var(--text-gray);
}

.profile-flyout-section {
    padding-top: 0.125rem;
}

.profile-flyout-section--divider {
    margin-top: 0.25rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-color);
}

.profile-flyout-link {
    display: flex !important;
    align-items: center;
    gap: 0.625rem;
    min-height: 34px;
    padding: 0.5rem 0.625rem !important;
    border-radius: 8px;
    font-size: 0.8125rem;
}

.profile-flyout-link-icon {
    width: 15px;
    height: 15px;
    color: var(--text-gray);
    flex: 0 0 auto;
}

.profile-flyout-link-icon svg {
    width: 15px;
    height: 15px;
}

.profile-flyout-link--danger {
    color: var(--danger) !important;
}

.profile-flyout-link--danger .profile-flyout-link-icon {
    color: var(--danger);
}

.profile-flyout-language {
    width: 100%;
    margin-left: 0;
    margin-top: 0.125rem;
}

/* Notifications Dropdown */
.notifications-menu {
    width: 360px;
    max-width: 90vw;
    padding: 0;
}

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

.notifications-title {
    font-weight: 600;
}

.notifications-list {
    max-height: 320px;
    overflow: auto;
}

.notification-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.notification-item:hover { background: var(--primary-silver); }
.notification-item.unread { background: #fffdf7; }

.notification-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,178,204,0.1);
    color: var(--primary-cyan);
    font-size: 14px;
}

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

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-text {
    font-size: 0.85rem;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Utility: single-line text truncation */
.truncate {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-meta {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-align: right;
}

.notifications-footer {
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination .page-item { list-style: none; }

.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
}

.pagination .page-item.active .page-link {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
    color: #fff;
    font-weight: 600;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
    color: var(--text-gray);
}

.pagination .page-link:hover {
    border-color: var(--primary-cyan);
    background: var(--primary-silver);
}

/* Keyboard focus visibility */
.pagination .page-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 178, 204, 0.15);
}

.pagination .page-info { font-size: 0.85rem; color: var(--text-gray); }

/* Modals */
.modal,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1600;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

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

.modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--hover-color);
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal .modal-content.modal-lg,
.modal-overlay .modal-content.modal-lg {
    max-width: 920px;
    width: 95%;
}

.modal .modal-content.modal-lg .modal-body,
.modal-overlay .modal-content.modal-lg .modal-body {
    max-height: calc(90vh - 140px);
}

.modal-list {
    max-height: 45vh;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    background: #fbfcfd;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    /* Ensure toasts appear above any modal/overlay */
    z-index: 20000;
}

.toast {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    animation: toastSlideIn 0.3s ease forwards;
    position: relative;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-message {
    color: var(--text-gray);
    font-size: 0.875rem;
}

/* Toast close button */
.toast-close {
    margin-left: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px 4px;
}
.toast-close:hover {
    color: var(--text);
}

/* Generic Tabs */
.tab-content { min-height: 200px; }
.tab-pane { display: none; padding-top: 0.75rem; }
.tab-pane.active { display: block; }

