/* iOS PWA Touch Event Fixes */
button, a, input, textarea, select, [role="button"], .clickable {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    cursor: pointer;
}

/*
 * iPadOS/Safari shows a heavy blue focus outline on buttons/links/etc. after they are tapped
 * (since tapping focuses the element). Suppress the outline for mouse/touch interaction while
 * still showing it for keyboard navigation via :focus-visible, so accessibility isn't lost.
 */
button:focus, a:focus, input:focus, textarea:focus, select:focus, [role="button"]:focus, .clickable:focus {
    outline: none;
}

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [role="button"]:focus-visible, .clickable:focus-visible {
    outline: 2px solid var(--primary-color, #3b82f6);
    outline-offset: 2px;
}

/*
 * Standard App Tabs
 * -----------------
 * Canonical tab styling used across the app (e.g. Schedule, Employees, Work Order screen).
 * Apply ".app-tabs" to the tab-row container and ".app-tab" to each tab button, adding
 * ".active" when selected. New tab UIs should reuse these classes (or replicate this exact
 * pattern in component-scoped CSS) so tabs look/behave consistently everywhere.
 */
.app-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    user-select: none;
}

.app-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    white-space: nowrap;
    position: relative;
    top: 1px;
    margin-bottom: -1px;
}

.app-tab:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.app-tab.active {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    border-bottom-color: var(--bg-secondary);
    font-weight: 600;
}

/* Ensure buttons are touchable in PWA mode */
button {
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

/* Prevent 300ms delay on touch devices */
a, button, input, textarea, select {
    touch-action: manipulation;
}

/* Root Variables - Light Theme */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --shop-task-color: #8b5cf6;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;

    --bg-primary: #f1f5f9;
    --bg-primary-rgb: 241, 245, 249;
    --bg-secondary: #e2e8f0;
    --bg-secondary-rgb: 226, 232, 240;
    --bg-tertiary: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --border-color: #cbd5e1;
    --border-radius: 8px;
    --box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.12), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
    --box-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.12), 0 4px 6px -4px rgba(15, 23, 42, 0.08);

    --navbar-height: 52px;
    --transition: all 0.3s ease;
}

/* When running as an installed PWA (standalone display mode), the OS status bar
   (clock, battery, etc.) can overlap the fixed top nav bar on tablets. Grow the
   navbar height to account for the device's safe-area inset so nothing overlaps.
   All layout math that references --navbar-height (content offsets, min-heights)
   picks this up automatically via the CSS variable. */
@media (display-mode: standalone) {
    :root {
        --navbar-height: calc(52px + env(safe-area-inset-top, 0px));
    }
}

/* Dark Theme */
.dark {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #94a3b8;
    --success-color: #34d399;
    --shop-task-color: #a78bfa;
    --danger-color: #dc2626;
    --warning-color: #fbbf24;

    --bg-primary: #0f172a;
    --bg-primary-rgb: 15, 23, 42;
    --bg-secondary: #1e293b;
    --bg-secondary-rgb: 30, 41, 59;
    --bg-tertiary: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #e2e8f0;

    --border-color: #334155;
    --box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100vh;
}

/* Global scrollbar theming - only shows when content actually overflows,
   and matches the current light/dark theme. */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    transition: var(--transition);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* Touch active state for PWA */
.touch-active {
    opacity: 0.7;
    transform: scale(0.98);
    transition: opacity 0.1s ease, transform 0.1s ease !important;
}
    transform: scale(0.98);
    transition: all 0.1s ease;
}

.app-container {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.main-content {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    transition: opacity 0.6s ease;
}

.main-content.bg-loading {
    opacity: 0;
}

.main-content .completed-jobs-page {
    position: fixed !important;
    top: var(--navbar-height) !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 2rem 1.5rem 1.5rem !important;
    box-sizing: border-box !important;
}

.main-content .completed-jobs-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Navbar Styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1.5rem;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.nav-brand {
    margin-right: -1rem;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.logo-menu-compact {
    position: relative;
}

.brand-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.35rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.brand-button:hover {
    background-color: var(--bg-tertiary);
}

.logo-dropdown {
    left: 0;
    right: auto;
    min-width: 180px;
}

.brand-icon {
    font-size: 1.25rem;
}

.brand-text {
    padding-right: 0;
}

.nav-search {
    flex: 1;
    max-width: 250px;
    position: relative;
    margin-right: 1rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.625rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.8125rem;
    border: 1px solid transparent;
}

.nav-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1);
}

.dark .nav-link.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-icon {
    font-size: 1rem;
    line-height: 1;
}

.nav-separator {
    width: 1px;
    background-color: var(--border-color);
    margin: 0.25rem 0.125rem;
    opacity: 0.5;
}

.nav-links-primary {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link.icon-only {
    padding: 0.35rem 0.5rem;
}

.nav-link.icon-only span:not(.nav-icon) {
    display: none;
}

.clocked-in-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Subtle pulsing blue glow shown on the RingCentral toolbar button while a call is ringing. */
.ringcentral-ringing {
    /* .nav-link sets "transition: all 0.3s ease", which includes box-shadow and fights with the
       keyframe animation below (causing it to appear to pulse once and then freeze), so override
       the transitioned properties here to exclude box-shadow while ringing. */
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    animation: ringcentral-glow-pulse 1.4s ease-in-out infinite;
}

@keyframes ringcentral-glow-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45);
    }
    50% {
        box-shadow: 0 0 6px 4px rgba(37, 99, 235, 0.45);
    }
}

.dark .ringcentral-ringing {
    animation-name: ringcentral-glow-pulse-dark;
}

@keyframes ringcentral-glow-pulse-dark {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.5);
    }
    50% {
        box-shadow: 0 0 6px 4px rgba(96, 165, 250, 0.5);
    }
}

/* Recent Work Orders Dropdown */
.nav-link-dropdown {
    position: relative;
}

.nav-link-dropdown > .nav-link {
    cursor: pointer;
}

/* Inventory split button */
.nav-split-button {
    display: flex;
    align-items: stretch;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.nav-split-button:hover {
    background-color: var(--bg-secondary);
}

.nav-split-button .nav-link-split-main,
.nav-split-button .nav-link-split-arrow {
    background-color: transparent;
}

.nav-split-button:hover .nav-link-split-main:hover,
.nav-split-button:hover .nav-link-split-arrow:hover {
    background-color: var(--bg-tertiary);
}

.nav-link-split-main {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.nav-link-split-arrow {
    display: flex;
    align-items: center;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 0.35rem 0.5rem;
    background: none;
    font: inherit;
    cursor: pointer;
}

@keyframes recentDropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes recentDropdownOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-6px); }
}

.recent-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 380px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0.25rem;
    z-index: 1001;
    animation: recentDropdownIn 180ms ease-out both;
}

.recent-dropdown.leaving {
    animation: recentDropdownOut 180ms ease-in both;
}

.recent-dropdown-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.recent-dropdown-item {
    display: grid;
    grid-template-columns: 3rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.recent-dropdown-item:last-child {
    border-bottom: none;
}

.recent-dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.recent-col-number {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary-color);
    white-space: nowrap;
}

.recent-col-secondary {
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-col-badge {
    font-size: 0.65rem;
    font-weight: 400;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.recent-dropdown-item .badge {
    font-size: 0.65rem;
    font-weight: 400;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    border: 1px solid currentColor;
}

.recent-dropdown-item .badge-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.recent-dropdown-item .badge-success {
    color: var(--success-color);
    border-color: var(--success-color);
}

.recent-dropdown-item .badge-warning {
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.recent-dropdown-item .badge-danger {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.recent-dropdown-item .badge-info {
    color: var(--info-color, #6f42c1);
    border-color: var(--info-color, #6f42c1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.organization-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
}

.org-menu-compact {
    position: relative;
    margin-right: 0.35rem;
    padding-right: 0.35rem;
    border-right: 1px solid var(--border-color);
}

.organization-name-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid transparent;
    padding: 0.35rem 0.625rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    transition: var(--transition);
    color: var(--text-secondary);
}

.organization-name-button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.organization-name-button:hover .organization-name {
    color: var(--text-primary);
}

.org-dropdown {
    min-width: 200px;
}

.inventory-dropdown {
    left: 0;
    right: auto;
    min-width: 220px;
}

.nav-quick-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: -14px;
    margin-right: -14px;
}

.split-toolbar-button {
    position: relative;
    display: flex;
    align-items: stretch;
    height: 32px;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.split-toolbar-main,
.split-toolbar-arrow {
    background: none;
    border: none;
    height: 100%;
    box-sizing: border-box;
    padding: 0 0.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.split-toolbar-main {
    border-radius: calc(var(--border-radius) - 1px) 0 0 calc(var(--border-radius) - 1px);
}

.split-toolbar-arrow {
    border-left: 1px solid var(--border-color);
    padding: 0 0.25rem;
    border-radius: 0 calc(var(--border-radius) - 1px) calc(var(--border-radius) - 1px) 0;
}

.split-toolbar-main:hover,
.split-toolbar-arrow:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.new-work-order-dropdown {
    left: 0;
    right: auto;
    min-width: 200px;
}

.nav-toolbar-button {
    background: none;
    border: 1px solid var(--border-color);
    height: 32px;
    box-sizing: border-box;
    padding: 0 0.35rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.nav-toolbar-button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-toggle-compact {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.theme-toggle-compact:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.settings-button-compact {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.settings-button-compact:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.user-menu-compact {
    position: relative;
}

.user-button-compact {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    padding: 0.4rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
}

.user-button-compact:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.user-avatar-compact {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.6rem;
}

.dropdown-arrow-compact {
    font-size: 0.5rem;
    color: var(--text-muted);
    line-height: 1;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
}

.settings-button {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.settings-button:hover {
    background-color: var(--bg-tertiary);
}

.help-tips-toggle-compact {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: var(--transition);
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.help-tips-toggle-compact:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.help-tips-toggle-compact.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.help-tips-toggle-compact.active:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.user-menu {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.625rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition);
}

.user-button:hover {
    background-color: var(--bg-tertiary);
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.8125rem;
}

.dropdown-arrow {
    font-size: 0.625rem;
    color: var(--text-muted);
    line-height: 1;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 200px;
    width: max-content;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    padding: 0.25rem 0;
    font-size: 0.8125rem;
}

.user-info {
    padding: 0.5rem 0.75rem;
}

.ringcentral-dropdown {
    min-width: 260px;
}

.user-name-full {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.25rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1.2;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
}

.dropdown-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    flex: 0 0 16px;
}

.dropdown-item-label {
    flex: 0 0 auto;
    white-space: nowrap;
}

.dropdown-item-shortcut {
    flex: 0 0 auto;
    margin-left: auto;
    padding-left: 2rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.po-menu-badge {
    flex: 0 0 auto;
    padding: 0.05rem 0.5rem;
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-color);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.dropdown-item-muted {
    padding: 0.4rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.dropdown-item.logout {
    color: var(--danger-color);
}

.recent-call-item {
    display: grid;
    grid-template-columns: 3.25rem 1fr auto auto;
    align-items: center;
    gap: 0.6rem;
    cursor: default;
}

.recent-call-item:hover {
    background: none;
}

.recent-call-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.recent-call-name-link {
    text-decoration: none;
    cursor: pointer;
}

.recent-call-name-link:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

.recent-call-number {
    color: var(--text-muted);
    white-space: nowrap;
    justify-self: end;
}

.recent-call-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    justify-self: end;
}

.call-badge {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.call-badge-incoming {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success-color);
}

.call-badge-outgoing {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--primary-color);
}

.call-badge-missed {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger-color);
}

.call-badge-text {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
    color: #a855f7;
}

.recent-call-text-preview {
    grid-column: 2 / -1;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-calls-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0;
}

.dropdown-submenu-container {
    position: relative;
}

.dropdown-submenu-toggle {
    justify-content: space-between;
}

.dropdown-submenu-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 0.975rem;
    overflow: hidden;
}

.dropdown-submenu {
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 200px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    padding: 0.25rem 0;
    font-size: 0.8125rem;
    z-index: 1;
}

/* Auth Pages */
.auth-container {
    height: 100vh;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    margin: auto;
}

.auth-card.register-card {
    max-width: 800px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.btn-primary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.dark .btn-primary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark .btn-primary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.dark .btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark .btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spinner */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner.spinner-small {
    width: 16px;
    height: 16px;
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: rgba(0, 0, 0, 0.65);
}

html.dark .spinner.spinner-small {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.75);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.dark .alert-danger {
    background-color: rgba(220, 38, 38, 0.2);
    color: #dc2626;
    border: 1px solid #dc2626;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.alert-success h3 {
    margin-bottom: 0.5rem;
}

/* Validation Messages */
.validation-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.dark .validation-message {
    color: #dc2626;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard-container {
    padding: 2rem 0;
}

.welcome-section {
    margin-bottom: 2rem;
}

.welcome-section h1 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.text-muted {
    color: var(--text-muted) !important;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.dashboard-card h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.quick-actions {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
}

.quick-actions h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Error Page */
.error-container {
    min-height: calc(100vh - var(--navbar-height));
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-content h1 {
    font-size: 6rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-content h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
    font-size: 1.125rem;
}

.loading-small {
    padding: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

/* Blazor Error UI */
#blazor-error-ui {
    background: var(--danger-color);
    color: white;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    color: white;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
    }

    .desktop-main-content {
        margin: 2px;
        margin-top: calc(var(--navbar-height) + 2px);
        padding: 0;
        width: calc(100% - 4px);
    }

    .auth-card {
        padding: 1.5rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Page Layouts */
.page-container {
    min-height: calc(100vh - var(--navbar-height));
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    color: var(--text-primary);
    font-size: 2rem;
    margin: 0;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Autocomplete Styles */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    margin-top: 0.5rem;
}

.autocomplete-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.autocomplete-item:first-child {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.autocomplete-item:hover {
    background: linear-gradient(to right, var(--bg-tertiary), var(--bg-secondary));
}

.autocomplete-item:active {
    background-color: var(--primary-color);
}

.autocomplete-item:active .autocomplete-item-text,
.autocomplete-item:active .autocomplete-item-subtext {
    color: white;
}

.autocomplete-item-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.autocomplete-item-subtext {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.autocomplete-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

/* User Management Page */
.search-container {
    position: relative;
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    pointer-events: none;
}

.users-table-container {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background-color: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.users-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.users-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.users-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar-small {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-username {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.email-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background-color: var(--success-color);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.role-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.status-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-active {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-inactive {
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Button variants */
.btn-danger {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--danger-color);
}

.btn-success {
    background-color: var(--bg-secondary);
    color: var(--success-color);
    border-color: var(--border-color);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--success-color);
}

/* Icon buttons */
.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.btn-icon:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.btn-icon.btn-primary {
    color: var(--text-primary);
}

.btn-icon.btn-primary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.btn-icon.btn-success {
    color: var(--success-color);
}

.btn-icon.btn-success:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--success-color);
    color: var(--success-color);
}

.btn-icon.btn-danger {
    color: var(--danger-color);
}

.btn-icon.btn-danger:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-icon.btn-secondary {
    color: var(--text-primary);
}

.btn-icon.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Small button variant */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-small {
    max-width: 350px;
}

.modal-header {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    background: var(--bg-secondary);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
}

.tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.tab-header .search-container {
    flex: 1;
    margin-bottom: 0;
}

/* Roles Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.role-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.role-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.role-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.role-card-header h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.role-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.role-actions {
    display: flex;
    gap: 0.5rem;
}

.role-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.role-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.role-stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.role-stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

/* User Assignment Modal */
.modal-large {
    max-width: 700px;
}

.user-assignment-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
}

.user-assignment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.user-assignment-item:last-child {
    border-bottom: none;
}

.user-assignment-item:hover {
    background-color: var(--bg-secondary);
}

/* Global List Styles */
.list {
    background: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.list-header {
    display: grid;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    border-radius: 10px 10px 0 0;
}

.list-row {
    display: grid;
    gap: 1.5rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    align-items: center;
    font-size: 0.875rem;
}

.list-row:hover:not(.editing):not(.new-row) {
    background-color: var(--bg-tertiary);
    transform: translateX(2px);
}

.list-row:last-child {
    border-bottom: none;
}

.list-row.editing {
    background: var(--bg-selected, #eff6ff);
    border-color: var(--primary-color);
    cursor: default;
}

.list-row.new-row {
    background: var(--bg-success, #f0fdf4);
    border-color: var(--success-color);
    cursor: default;
}

.col-name {
    font-weight: 500;
    color: var(--text-primary);
}

.col-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* MoneyEditor Calculator Popup - Dark Mode Override */
.dark .calc-popup-content {
    background: var(--bg-secondary) !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

/* Dark mode support for lists */
.dark .list-row.editing,
.dark .list-row.selected {
    background: rgba(59, 130, 246, 0.15) !important;
    border-color: var(--primary-color);
}

/* Responsive Styles */
@media (max-width: 968px) {
    .navbar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .nav-search {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin-top: 0.75rem;
        margin-right: 0;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.8125rem;
        padding: 0.35rem 0.625rem;
    }

    .nav-icon {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .nav-brand a {
        font-size: 1rem;
    }

    .brand-icon {
        font-size: 1.125rem;
    }

    .nav-search .search-input::placeholder {
        font-size: 0.75rem;
    }

    .nav-actions {
        gap: 0.5rem;
    }

    .user-name {
        display: none;
    }
}

.user-assignment-item .checkbox-label {
    flex: 1;
}

.user-info-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-tiny {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-name-compact {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.user-email-compact {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.current-role-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Alert Styles */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
}

.autocomplete-no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9375rem;
}

.autocomplete-highlight {
    font-weight: 600;
    color: var(--primary-color);
}

/* Dark theme adjustments */
.dark .autocomplete-suggestions {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Profile Page */
.profile-container {
    max-width: 800px;
}

.profile-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow);
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
}

.profile-info {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-info h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.profile-details {
    margin-bottom: 2rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-primary);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-primary {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.profile-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Settings Page */
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.settings-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.settings-card:hover {
    box-shadow: var(--box-shadow-lg);
}

.settings-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    font-size: 1.1rem;
}

.settings-card p {
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Page Description - Global Style */
.page-description {
    background: var(--bg-secondary, #f8fafc);
    border-left: 4px solid var(--primary-color, #3b82f6);
    padding: 1rem 1.5rem;
    margin: 0 auto 1.5rem auto;
    border-radius: var(--border-radius, 8px);
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 900px;
}

.page-description p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-secondary, #334155);
}

/* Dark Mode - Page Description */
html.dark .page-description {
    background: var(--bg-secondary, #1e293b);
    border-left-color: var(--primary-color, #60a5fa);
}

html.dark .page-description p {
    color: var(--text-secondary, #94a3b8);
}

/* Dark mode: dashboard list items use a subtle tint border against the dark background */
html.dark .compact-item {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Dark mode: no-background dashboard gap is lighter than the panels */
html.dark .home-dashboard-new.no-background {
    background-color: var(--bg-tertiary);
}

/* Dialog close (X) buttons - light in dark mode */
html.dark .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}

html.dark .btn-close:hover {
    opacity: 1;
}

html.dark .close-button,
html.dark .dialog-close-btn,
html.dark .modal-close {
    color: var(--text-secondary, #cbd5e1);
}

html.dark .close-button:hover,
html.dark .dialog-close-btn:hover,
html.dark .modal-close:hover {
    color: var(--text-primary, #f1f5f9);
}

/* Theme-aware icon pair (light/dark) */
.icon-dark-only { display: none !important; }
html.dark .icon-light-only { display: none !important; }
html.dark .icon-dark-only { display: inline-block !important; }
.square-nav-link { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; }
