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

:root {
    /* Apple Color Palette (from Apple.com) */
    --color-text-primary: #1D1D1F;
    /* Apple's off-black */
    --color-text-secondary: #86868B;
    /* Gray 500 */
    --color-text-tertiary: #AEAEB2;
    /* Gray 400 */

    --color-bg-primary: #FFFFFF;
    /* Pure white */
    --color-bg-secondary: #F5F5F7;
    /* Apple's off-white */
    --color-bg-tertiary: #FAFAFA;
    /* Gray 50 */

    --color-border: #D2D2D7;
    /* Gray 300 */
    --color-border-light: #E8E8ED;
    /* Gray 200 */

    --color-blue: #487393;
    /* Primary blue - used for buttons and accents app-wide */
    --color-blue-hover: #3d6280;
    --color-blue-light: #E8EEF3;

    --color-success: #34C759;
    /* iOS green */
    --color-warning: #FF9500;
    /* iOS orange */
    --color-danger: #FF3B30;
    /* iOS red */

    /* 8px Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Typography Scale (SF Pro inspired) */
    --text-xs: 11px;
    /* Caption */
    --text-sm: 13px;
    /* Small body, labels */
    --text-base: 15px;
    /* Body text */
    --text-lg: 17px;
    /* Large body */
    --text-xl: 20px;
    /* Title 3 */
    --text-2xl: 24px;
    /* Title 2 */
    --text-3xl: 28px;
    /* Title 1 */
    --text-4xl: 34px;
    /* Large title */

    /* Font Weights */
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Line Heights */
    --leading-tight: 1.2;
    --leading-snug: 1.3;
    --leading-normal: 1.5;
    --leading-relaxed: 1.6;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows (minimal) */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);

    /* Transitions */
    --transition-fast: 150ms ease-out;
    --transition-base: 200ms ease-out;
    --transition-slow: 300ms ease-out;
}

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

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    height: 100vh;
    overflow: hidden;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: grid;
    grid-template-columns: 120px 28px 1fr;
    grid-template-rows: minmax(0, 1fr);
    height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: var(--space-2) 0 var(--space-2) var(--space-2);
    box-sizing: border-box;
    background-color: #fff;
}

/* Health Check Bar - Desktop (vertical, left side) */
#health-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 0 16px;
    background: transparent;
    border-right: none;
    z-index: 50;
    overflow: hidden;
}

#health-refresh {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: #86868B;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}
#health-refresh:hover,
#health-backup-btn:hover {
    color: var(--color-blue);
    background: var(--color-blue-light);
}
#health-refresh .material-icons-round,
#health-backup-btn .material-icons-round {
    font-size: 16px;
}

#health-backup-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    color: #86868B;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}
#health-refresh.spinning .material-icons-round {
    animation: health-spin 0.8s linear infinite;
}

.health-dots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.health-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.health-dot .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D2D2D7;
    transition: background 0.3s;
}
.health-dot .dot.ok {
    background: #34C759;
}
.health-dot .dot.fail {
    background: #FF3B30;
}
.health-dot .dot.checking {
    background: #86868B;
}

.health-label {
    font-size: 8px;
    color: #AEAEB2;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
    line-height: 1;
}

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

/* Sidebar - modern theme (red, white text) - narrow for more content space */
.sidebar {
    width: 120px;
    min-height: 0;
    background-color: rgba(156, 53, 64, 1);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3) 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-base);
}

.sidebar .logo-icon {
    color: #fff;
}

.logo-area {
    flex-shrink: 0;
    padding: var(--space-2) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.sidebar .logo-area .logo-icon {
    color: #fff;
    font-size: 24px;
}

.sidebar .logo-text {
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
    display: block;
    padding: 0 var(--space-2);
}

.sidebar .nav-item {
    color: rgba(255, 255, 255, 0.9);
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding-left: var(--space-3);
    padding-right: var(--space-2);
}

.sidebar .nav-item .material-icons-round {
    color: #fff;
    margin-bottom: 0;
    margin-right: var(--space-2);
    font-size: 24px;
}

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

.sidebar .nav-item.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.sidebar .nav-item[data-target="production"] {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar .add-trigger {
    color: #fff;
}

.sidebar .add-trigger:hover {
    color: rgba(255, 255, 255, 0.95);
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar .nav-divider {
    background-color: rgba(255, 255, 255, 0.3);
}

.sidebar .user-profile #user-display-name {
    color: #fff;
}

.sidebar #login-logout-text,
.sidebar #login-logout-icon {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    width: 100%;
    height: 68px;
    padding: var(--space-1) 0;
    flex-shrink: 0;
    margin-top: var(--space-2);
}

.sidebar-footer .user-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.sidebar-footer .user-profile .avatar {
    width: 26px;
    height: 26px;
    margin: 0 0 2px 0;
}

.sidebar-footer #user-display-name {
    font-size: 9px;
}

.sidebar #login-logout-button {
    padding: 2px var(--space-2);
    font-size: 9px;
    min-height: auto;
    text-align: center;
    justify-content: center;
}

.sidebar #login-logout-button .material-icons-round {
    font-size: 14px;
    margin-right: var(--space-1);
}

.sidebar .nav-item:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.logo-icon {
    font-size: 32px;
    color: var(--color-blue);
    margin-bottom: var(--space-4);
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-secondary);
    padding: var(--space-2) 0;
    width: 100%;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    transition: all var(--transition-base);
    min-height: auto;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--color-text-primary);
    background-color: var(--color-bg-tertiary);
    transform: scale(1.02);
}

.nav-item.active {
    color: var(--color-blue);
    background-color: var(--color-blue-light);
}

.nav-item .material-icons-round {
    font-size: 20px;
    margin-bottom: 2px;
}

.add-trigger {
    color: var(--color-success);
}

.add-trigger:hover {
    color: #218838;
}

.nav-divider {
    height: 1px;
    background-color: var(--color-border-light);
    width: 60%;
    margin: var(--space-1) 0;
    flex-shrink: 0;
}

.bottom-nav {
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
}

.main-nav {
    flex: 1;
    width: 100%;
    height: 500px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.user-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2) 0;
    width: 100%;
    flex-shrink: 0;
    margin-top: var(--space-2);
}

.user-profile .avatar {
    width: 28px;
    height: 28px;
    background-color: var(--color-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    margin: 0 auto var(--space-1);
    flex-shrink: 0;
}

#user-avatar {
    background-color: rgba(223, 129, 138, 1);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: var(--weight-semibold);
}

.user-profile > div:last-child {
    width: 100%;
    text-align: center;
}

.user-profile #user-display-name {
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.top-bar {
    background-color: #fff;
    border-bottom: 0 none transparent;
    border-image: none;
    color: rgba(18, 18, 18, 1);
    text-align: center;
    padding: 0 var(--space-10);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-4);
    height: 52px;
    min-height: 52px;
    position: relative;
    z-index: 200;
}

.top-bar .mobile-menu-toggle {
    justify-self: start;
}

/* Search bar centered in the middle of the top bar */
.top-bar-search {
    justify-self: center;
    width: 1248px;
    max-width: 1248px;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 var(--space-3);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-full);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.top-bar .top-actions {
    justify-self: end;
}

.top-bar-search:focus-within {
    border-color: var(--color-border);
    box-shadow: 0 0 0 3px rgba(72, 115, 147, 0.08);
}

.top-bar-search .material-icons-round {
    font-size: 20px;
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.top-bar-search input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
    outline: none;
}

.top-bar-search input::placeholder {
    color: var(--color-text-tertiary);
}

.top-bar-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-tertiary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    min-width: 44px;
    min-height: 44px;
    z-index: 201;
    position: relative;
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:active {
    background: var(--color-bg-tertiary);
}

.mobile-menu-toggle .material-icons-round {
    font-size: 24px;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-sidebar-close {
    display: none;
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    z-index: 201;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.mobile-sidebar-close:hover {
    background: var(--color-bg-tertiary);
}

.mobile-sidebar-close .material-icons-round {
    font-size: 24px;
}


.top-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.trial-info {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.btn {
    height: 44px;
    padding: 0 var(--space-5);
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    font-weight: var(--weight-medium);
    font-size: var(--text-base);
    transition: all var(--transition-base);
}

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

.btn-primary:hover {
    background-color: var(--color-blue-hover);
    transform: scale(1.02);
}

#login-form .btn-primary {
    background-color: #c62828;
    color: white;
}

#login-form .btn-primary:hover {
    background-color: #b71c1c;
    transform: scale(1.02);
}

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

.btn-primary-outline:hover {
    background: var(--color-bg-tertiary);
}

.btn-text {
    background: transparent;
    color: var(--color-blue);
}

.btn-text:hover {
    opacity: 0.7;
}

.btn-small {
    height: 36px;
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
}

/* Round pagination page number buttons (projects & production) */
.btn-pagination-page {
    box-sizing: border-box;
    flex-shrink: 0;
}
.btn-pagination-page:hover:not(:disabled) {
    transform: scale(1.05);
}

/* Clear Filters Button Responsive */
.clear-filters-text {
    display: inline;
    color: rgba(105, 105, 105, 1);
}

@media (max-width: 768px) {
    .clear-filters-text {
        display: none;
    }
    
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 4px !important;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 2px 4px !important;
    }
}

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

.btn-outline:hover {
    background: var(--color-bg-tertiary);
}

.btn-small.btn-outline {
    width: 200px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-small.btn-outline .material-icons-round {
    margin-right: 0;
    margin-left: 0;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--color-blue);
    padding: 0;
    height: auto;
}

.btn-link:hover {
    opacity: 0.7;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-10);
    position: relative;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    background-color: rgba(255, 255, 255, 1);
}

/* Allow horizontal scroll when calendar is visible so full week and events are visible */
.content-area:has(#view-calendar:not(.hidden)) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.content-area:has(#view-stock:not(.hidden)) {
    padding: 0 !important;
    overflow: hidden;
}

.content-area #view-stock {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 !important;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Dashboard */
.welcome-banner {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFE0B2 100%);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    display: flex;
    align-items: center;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
    position: relative;
}

.welcome-icon {
    font-size: 40px;
}

.welcome-text h2 {
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
}

.welcome-text p {
    color: var(--color-text-secondary);
}

.welcome-video {
    margin-left: auto;
    background: white;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.close-banner {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
}

/* Dashboard Header - Modern Japanese Style */
.dashboard-header {
    background: linear-gradient(135deg, rgba(156, 53, 64, 1) 0%, rgba(156, 53, 64, 1) 100%);
    padding: var(--space-10) var(--space-8);
    margin-bottom: var(--space-8);
    color: var(--color-text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(156, 53, 64, 0.08);
    border-radius: var(--radius-xl);
    min-height: 200px;
    display: flex;
    align-items: center;
}

.dashboard-header-content {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 900;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-8);
    width: 100%;
}

.dashboard-time-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.dashboard-clock {
    font-size: 96px;
    font-weight: 900;
    line-height: 1;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -6px;
    color: rgba(255, 255, 255, 1);
}

.dashboard-date {
    font-size: var(--text-base);
    opacity: 0.6;
    font-weight: var(--weight-regular);
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 1);
}

.dashboard-user-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
}

.dashboard-greeting {
    font-size: var(--text-sm);
    opacity: 0.5;
    color: rgba(255, 255, 255, 1);
    font-weight: var(--weight-regular);
}

.dashboard-username {
    font-size: var(--text-xl);
    font-weight: var(--weight-medium);
    color: rgba(255, 255, 255, 1);
    letter-spacing: 0.3px;
}

.dashboard-search-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.dashboard-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    transition: background 0.2s, border-color 0.2s;
}

.dashboard-search-bar:focus-within {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.dashboard-search-bar .material-icons-round {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.dashboard-search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    font-weight: 400;
    color: #fff;
    font-family: inherit;
    min-width: 0;
}

.dashboard-search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.dashboard-search-section {
    position: relative;
}

.dashboard-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 420px;
    max-height: 360px;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 100;
    padding: 6px;
}

.dashboard-search-results.active {
    display: block;
}

.dashboard-search-results .dsr-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.dashboard-search-results .dsr-item:hover,
.dashboard-search-results .dsr-item.dsr-active {
    background: #f3f4f6;
}

.dashboard-search-results .dsr-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: #fff;
}

.dashboard-search-results .dsr-text {
    flex: 1;
    min-width: 0;
}

.dashboard-search-results .dsr-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-search-results .dsr-detail {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-search-results .dsr-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.dashboard-search-results .dsr-empty {
    padding: 24px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

.dashboard-search-results .dsr-footer {
    padding: 8px 14px;
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    border-top: 1px solid #f3f4f6;
    cursor: pointer;
    border-radius: 0 0 10px 10px;
}

.dashboard-search-results .dsr-footer:hover {
    background: #f9fafb;
    color: #2563eb;
}

.dashboard-search-results .dsr-hint {
    padding: 6px 14px 8px;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
}

/* Reserve space to reduce CLS when dashboard widgets load */
#view-dashboard {
    min-height: 60vh;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-6);
    width: 100%;
    min-height: 400px;
}

.widget {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 600px;
}

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

.widget-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(600px - 80px);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.widget-header h3 {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
}

.widget-header .material-icons-round {
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 18px;
}

/* Modern colored widget action icons */
.widget-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.widget-action-icon .material-icons-round {
    font-size: 18px !important;
    color: white !important;
}
.widget-action-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.widget-action-icon.calendar-icon {
    background: linear-gradient(135deg, rgba(72, 115, 147, 1) 0%, rgba(72, 115, 147, 1) 100%);
    box-shadow: 0 2px 8px rgba(72, 115, 147, 0.35);
}
.widget-action-icon.calendar-icon:hover {
    box-shadow: 0 4px 14px rgba(72, 115, 147, 0.45);
}

/* Widget Tables */
.widget-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.widget-table thead th {
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border-light);
}

.widget-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--text-sm);
    color: var(--color-text-primary);
}

.widget-table tbody tr:hover {
    background-color: var(--color-bg-tertiary);
}

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

/* Dashboard Calendar Widget */
.dashboard-calendar-container {
    display: flex;
    flex-direction: column;
}

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

.calendar-day-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-align: center;
    padding: 4px;
}

.calendar-day-cell {
    position: relative;
    padding: 6px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    aspect-ratio: 1;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.calendar-day-cell:hover {
    background: rgba(232, 232, 232, 1);
}

.calendar-day-cell.today:hover {
    background: transparent !important;
}

.calendar-day-cell.today {
    background-color: transparent !important;
    color: var(--color-text-primary);
    font-weight: 700;
}

.calendar-day-cell.today::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 25px;
    height: 25px;
    background-color: rgba(255, 149, 0, 0.5);
    border-radius: 6px;
    z-index: 0;
}

.calendar-day-cell.today:hover::before {
    background-color: rgba(255, 149, 0, 0.65);
}

.calendar-day-cell.today .calendar-day-number {
    color: var(--color-warning);
    position: relative;
    z-index: 1;
}


.calendar-day-cell.has-events {
    font-weight: 600;
}

.calendar-upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-upcoming-item {
    cursor: pointer;
    border-left: 3px solid;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.calendar-upcoming-item:hover {
    transform: translateX(2px);
}

/* Responsive calendar */
@media (max-width: 768px) {
    .calendar-month-grid {
        gap: 2px;
    }
    
    .calendar-day-cell {
        padding: 4px;
        font-size: 11px;
    }
}

/* Cards */
.card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}

.card h3 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-4);
}

/* Helpers */
.hidden {
    display: none !important;
}

.mt-4 {
    margin-top: var(--space-4);
}

.full-width {
    width: 100%;
}

.text-muted {
    color: var(--color-text-secondary);
}

.small {
    font-size: var(--text-sm);
}

/* Popover */
.popover, .add-popover {
    position: absolute;
    left: 100px;
    top: 100px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 250px;
    z-index: 1000;
    border: 1px solid var(--color-border-light);
}

.popover-header {
    padding: var(--space-4);
    font-weight: var(--weight-semibold);
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.popover-content, .popover-item {
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.popover-item:hover {
    background-color: var(--color-bg-tertiary);
}

.popover-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border-light);
}

.add-section {
    padding: var(--space-2) 0;
}

.add-item {
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.add-item:hover {
    background-color: var(--color-bg-tertiary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    width: 560px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
}

.close-modal {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
}

.modal-body {
    padding: var(--space-8);
    overflow-y: auto;
}

/* Export item modal: wider for packaging list table (Nr, Type, L, W, H, KG) */
#modal-export-item {
    width: 1000px;
    max-width: min(100%, calc(100vw - 32px));
}

/* Packaging list table: roomier dimension columns and responsive */
#export-item-packaging-list-container .form-control.packing-list-table,
#export-item-packaging-list-container table.form-control {
    table-layout: fixed;
    width: 100%;
}
#export-item-packaging-list-container table.form-control th:nth-child(1) { width: 40px; min-width: 40px; }
#export-item-packaging-list-container table.form-control th:nth-child(2) { min-width: 180px; }
#export-item-packaging-list-container table.form-control th:nth-child(3),
#export-item-packaging-list-container table.form-control th:nth-child(4),
#export-item-packaging-list-container table.form-control th:nth-child(5),
#export-item-packaging-list-container table.form-control th:nth-child(6) {
    width: 100px;
    min-width: 90px;
}
#export-item-packaging-list-container table.form-control th:nth-child(7) { width: 48px; min-width: 48px; }
#export-item-packaging-list-container table.form-control td:nth-child(3) input,
#export-item-packaging-list-container table.form-control td:nth-child(4) input,
#export-item-packaging-list-container table.form-control td:nth-child(5) input,
#export-item-packaging-list-container table.form-control td:nth-child(6) input {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    #modal-export-item {
        width: 100%;
        max-width: calc(100vw - 24px);
    }
}

@media (max-width: 768px) {
    #modal-export-item {
        width: 100%;
        max-width: 100%;
    }
    #export-item-packaging-list-container table.form-control th:nth-child(3),
    #export-item-packaging-list-container table.form-control th:nth-child(4),
    #export-item-packaging-list-container table.form-control th:nth-child(5),
    #export-item-packaging-list-container table.form-control th:nth-child(6) {
        min-width: 72px;
    }
}

.modal-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* Forms */
.form-group {
    margin-bottom: var(--space-6);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row > .form-group {
    flex: 1;
}

label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
    display: block;
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    color: rgba(0, 0, 0, 1);
    transition: all var(--transition-base);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-blue-light);
}

textarea.form-control {
    height: auto;
    padding: var(--space-3);
    line-height: var(--leading-normal);
}

select.form-control {
    cursor: pointer;
}

/* Contacts */
/* Projects Layout - narrow sidebar for more table space */
.projects-layout {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: var(--space-6);
}

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

.projects-sidebar .card {
    font-size: 11px;
    padding: var(--space-3);
}

.projects-sidebar .card h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px;
    font-weight: 600;
}

.projects-sidebar .card label {
    font-size: 11px;
    font-weight: 400;
}

.projects-sidebar .card [style*="font-size: 12px"] {
    font-size: 10px !important;
}

.projects-sidebar .card .btn {
    font-size: 11px;
    padding: 6px 8px;
}

/* Status Filter - Facilities-style list (checkbox + label + count) */
.status-filter-card .status-filter-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text, #111);
    margin: 0 0 12px 0;
    padding: 0;
}
.status-filter-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.status-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text, #111);
    border: none;
    margin: 0;
}
.status-filter-row:hover {
    background: transparent;
}
.status-filter-input {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    margin: 0;
    accent-color: rgba(61, 98, 128, 1);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #d1d5db;
    border-radius: 2px;
    background: #fff;
    vertical-align: middle;
}
.status-filter-input:checked {
    background: rgba(61, 98, 128, 1);
    border-color: rgba(61, 98, 128, 1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 6l3 3 5-6'/%3E%3C/svg%3E");
    background-size: 6px 6px;
    background-position: center;
    background-repeat: no-repeat;
}
.status-filter-label {
    flex: 1;
    min-width: 0;
}
.status-filter-count {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--color-text-secondary, #6b7280);
    font-weight: 500;
}
.status-filter-group-label {
    font-size: 10px;
    font-weight: 800;
    color: rgba(29, 29, 31, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 12px;
    margin-bottom: 4px;
    padding: 0;
}
.status-filter-list .status-filter-group-label:first-of-type {
    margin-top: 4px;
}

.projects-toolbar {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    align-items: center;
}

/* Sales/Quotes Layout - narrow sidebar */
.sales-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-6);
}

.sales-sidebar .card h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.sales-toolbar {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    align-items: center;
}

.contacts-layout {
    display: grid;
    grid-template-columns: minmax(120px, max-content) 1fr;
    gap: var(--space-8);
    align-items: start;
}

.contacts-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
}

.contacts-main {
    min-height: 500px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    /* Always show scrollbar for better UX */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

/* Make table containers always scrollable (not just on hover) */
.projects-main,
.sales-main {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    /* Always show scrollbar for better UX */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

/* Custom scrollbar styling for table containers - always visible */
.contacts-main::-webkit-scrollbar,
.projects-main::-webkit-scrollbar,
.sales-main::-webkit-scrollbar {
    height: 4px;
    display: block;
}

.contacts-main::-webkit-scrollbar-track,
.projects-main::-webkit-scrollbar-track,
.sales-main::-webkit-scrollbar-track {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
}

.contacts-main::-webkit-scrollbar-thumb,
.projects-main::-webkit-scrollbar-thumb,
.sales-main::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

.contacts-main::-webkit-scrollbar-thumb:hover,
.projects-main::-webkit-scrollbar-thumb:hover,
.sales-main::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

.contacts-toolbar {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    padding: 0 var(--space-4);
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    height: 44px;
    font-size: var(--text-base);
}

.search-bar input:focus {
    outline: none;
}

#projects-search {
    color: rgba(0, 0, 0, 1);
}

#contacts-search-input {
    color: rgba(0, 0, 0, 1);
}

/* Tables */
.data-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    table-layout: fixed; /* Fixed layout to prevent column resizing */
}

/* Table wrapper for horizontal scroll on mobile */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper .data-table {
    min-width: 600px; /* Minimum width for table readability */
}

.data-table thead {
    background: var(--color-bg-tertiary);
}

.data-table th {
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Reset text-transform for dropdown menus inside table headers */
#status-header-dropdown,
#type-header-dropdown {
    text-transform: none;
    letter-spacing: normal;
}

/* Filter Bar Row */
.filter-bar-header {
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
}

.filter-bar-row {
    background: var(--color-bg-secondary);
}

.filter-bar-row th {
    padding: var(--space-3) var(--space-4);
    text-transform: none;
    letter-spacing: normal;
    vertical-align: middle;
    width: inherit; /* Ensure filter bar cells match header column widths */
    box-sizing: border-box;
}

.filter-bar-select {
    width: 100%;
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-regular);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868B' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
    box-sizing: border-box;
}

.filter-bar-select:hover {
    border-color: var(--color-blue);
    background-color: var(--color-bg-primary);
}

.filter-bar-select:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-blue-light);
}

.filter-bar-select option {
    padding: 4px 8px;
    font-size: var(--text-sm);
}

#clear-filters-btn,
#production-clear-filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
    font-size: 12px;
    padding: 4px 8px;
    transition: all var(--transition-base);
    gap: 4px;
    text-align: left;
}

#clear-filters-btn .material-icons-round,
#production-clear-filters-btn .material-icons-round {
    font-size: 16px;
    flex-shrink: 0;
}


/* Responsive styles for Clear Filters button - Updated */
@media (max-width: 1024px) {
    #clear-filters-btn,
    #production-clear-filters-btn {
        font-size: 11px;
        padding: 4px 6px;
    }
    
    #clear-filters-btn .material-icons-round,
    #production-clear-filters-btn .material-icons-round {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .clear-filters-text {
        display: none;
    }
    
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 4px !important;
        min-width: auto;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 2px 4px !important;
    }
}

@media (max-width: 768px) {
    #clear-filters-btn {
        font-size: 10px;
        padding: 3px 4px;
    }
    
    #clear-filters-btn .material-icons-round {
        font-size: 14px;
        margin-right: 2px;
    }
    
    /* Hide text on very small screens, show only icon */
    #clear-filters-btn span:not(.material-icons-round) {
        display: none;
    }
    
    #clear-filters-btn .material-icons-round {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    #clear-filters-btn {
        padding: 2px 4px;
        min-width: 32px;
    }
    
    #clear-filters-btn .material-icons-round {
        font-size: 16px;
    }
}

#status-header-dropdown .status-dropdown-item,
#type-header-dropdown .type-dropdown-item {
    text-transform: none;
}

/* Keep category headers uppercase in dropdowns */
#status-header-dropdown > div[style*="text-transform: uppercase"],
#type-header-dropdown > div[style*="text-transform: uppercase"] {
    text-transform: uppercase !important;
}

.data-table td {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border-light);
    font-size: var(--text-base);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fixed column widths for projects table - apply to ALL rows (header, filter bar, and body) */
.projects-main .data-table thead:first-of-type th:nth-child(1),
.projects-main .data-table thead.filter-bar-header th:nth-child(1),
.projects-main .data-table tbody td:nth-child(1) {
    width: 18%; /* Customer */
}

.projects-main .data-table thead:first-of-type th:nth-child(2),
.projects-main .data-table thead.filter-bar-header th:nth-child(2),
.projects-main .data-table tbody td:nth-child(2) {
    width: 18%; /* Address */
}

.projects-main .data-table thead:first-of-type th:nth-child(3),
.projects-main .data-table thead.filter-bar-header th:nth-child(3),
.projects-main .data-table tbody td:nth-child(3) {
    width: 14%; /* Created Date - enough for DD.MM.YYYY */
    text-align: center;
}

.projects-main .data-table thead:first-of-type th:nth-child(4),
.projects-main .data-table thead.filter-bar-header th:nth-child(4),
.projects-main .data-table tbody td:nth-child(4) {
    width: 10%; /* All Types */
    min-width: 80px; /* Kitchen, Wardrobe, etc. */
}

/* Projects table: Type column cells (Kitchen, Wardrobe, etc.) – vertical text, same white background as other columns */
.projects-main .data-table:has(#projects-table-body) tbody td:nth-child(4) {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    padding: var(--space-2) var(--space-3);
    vertical-align: middle;
    text-align: center;
    font-size: 10px;
}

.projects-main .data-table thead:first-of-type th:nth-child(5),
.projects-main .data-table thead.filter-bar-header th:nth-child(5),
.projects-main .data-table tbody td:nth-child(5) {
    width: 12%; /* Expected Delivery */
}

/* Projects table: Expected Delivery cell 50px min-height, date + relative text (e.g. "in 3 days") - centered like Created Date */
.projects-main .data-table:has(#projects-table-body) tbody td.projects-expected-delivery-cell,
.projects-main .data-table:has(#projects-table-body) tbody td:nth-child(5) {
    min-height: 50px;
    vertical-align: middle;
    text-align: center;
}
.projects-main .data-table:has(#projects-table-body) tbody td.projects-expected-delivery-cell > div,
.projects-main .data-table:has(#projects-table-body) tbody td.projects-expected-delivery-cell .projects-expected-delivery-relative {
    text-align: center;
}
/* Expected Delivery date (e.g. 18.05.2026) - semibold */
.projects-main .data-table:has(#projects-table-body) tbody td.projects-expected-delivery-cell > div:not(.projects-expected-delivery-relative) {
    font-weight: 600;
}
.projects-main .data-table:has(#projects-table-body) tbody td.projects-expected-delivery-cell .projects-expected-delivery-relative {
    font-size: 10px;
    color: rgba(140, 140, 140, 1);
    margin-top: 2px;
}

.projects-main .data-table thead:first-of-type th:nth-child(6),
.projects-main .data-table thead.filter-bar-header th:nth-child(6),
.projects-main .data-table tbody td:nth-child(6) {
    width: 26%; /* All Status - room for full status text */
    min-width: 200px; /* Room for full status text (e.g. Pending Order Created) in select */
}

.projects-main .data-table thead:first-of-type th:nth-child(7),
.projects-main .data-table thead.filter-bar-header th:nth-child(7),
.projects-main .data-table tbody td:nth-child(7) {
    width: 50px !important; /* Actions - w50 (overridden below for Projects table) */
    min-width: 50px !important;
    max-width: 50px !important;
}
/* Projects table: same slim actions column (16px) */
.projects-main .data-table:has(#projects-table-body) thead:first-of-type th:nth-child(7),
.projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:nth-child(7),
.projects-main .data-table:has(#projects-table-body) tbody td:nth-child(7),
.projects-main .data-table:has(#projects-table-body) td.projects-actions-cell {
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
}
/* Filter bar row: consistent 50px height for all th cells (including Created Date and Actions) */
.projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th {
    height: 50px;
    min-height: 50px;
}
.projects-main .data-table:has(#projects-table-body) thead:first-of-type th:nth-child(7),
.projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:nth-child(7) {
    height: 50px;
    min-height: 50px;
}

/* Production table: filter bar row 50px height */
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th {
    height: 50px;
    min-height: 50px;
}

/* Projects table only: actions column (16px) */
.projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:last-child,
#view-projects .projects-main .data-table thead:first-of-type th:nth-child(7),
#view-projects .projects-main .data-table thead:first-of-type th.actions-col-header,
#view-projects .projects-main .data-table thead.filter-bar-header th:nth-child(7),
#view-projects .projects-main .data-table thead.filter-bar-header th:last-child {
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    overflow: hidden;
}

/* Actions column: 16px (Projects table) */
.projects-main .data-table:has(#projects-table-body) tbody td:nth-child(7),
.projects-main .data-table:has(#projects-table-body) tbody td:last-child,
.projects-main .data-table:has(#projects-table-body) td.projects-actions-cell,
#view-projects .projects-main .data-table tbody td:nth-child(7),
#view-projects .projects-main .data-table tbody td:last-child {
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    height: 25px !important;
    min-height: 25px !important;
    max-height: 25px !important;
    overflow: hidden !important;
    box-sizing: border-box;
    padding: 2px !important;
    vertical-align: middle;
}
.projects-main .data-table .projects-actions-cell > div,
.projects-main .data-table:has(#projects-table-body) .projects-actions-cell > div {
    width: 16px !important;
    max-width: 16px !important;
    min-width: 0 !important;
    box-sizing: border-box;
    overflow: hidden;
}
.projects-main .data-table:has(#projects-table-body) .projects-actions-cell .material-icons-round,
#view-projects .projects-main .data-table .projects-actions-cell .material-icons-round {
    font-size: 12px !important;
    display: block;
}
/* Force Projects actions column to 16px - override any layout expansion */
#view-projects .data-table:has(#projects-table-body) thead th:nth-child(7),
#view-projects .data-table:has(#projects-table-body) thead th:last-child,
#view-projects .data-table:has(#projects-table-body) tbody td:nth-child(7),
#view-projects .data-table:has(#projects-table-body) tbody td.projects-actions-cell {
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    overflow: hidden !important;
    box-sizing: border-box;
}
#view-projects .data-table:has(#projects-table-body) .projects-actions-cell > div {
    width: 16px !important;
    min-width: 0 !important;
    max-width: 16px !important;
    overflow: hidden;
}

/* Created Date column: ensure full date visible (e.g. 19.02.2026); no truncation; centered */
#view-projects .projects-main .data-table th:nth-child(3),
#view-projects .projects-main .data-table td:nth-child(3) {
    min-width: 140px;
    width: 14%;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    text-align: center;
}
/* Status column in Projects: full room for status text (e.g. Accepted for Production) */
#view-projects .projects-main .data-table th:nth-child(6),
#view-projects .projects-main .data-table td:nth-child(6) {
    min-width: 240px;
    width: 26%;
    overflow: visible;
    text-overflow: clip;
}
#view-projects .projects-main .data-table td:nth-child(6) select {
    min-width: 100%;
    max-width: 100%;
}

/* Allow wrapping for specific columns that need it */
.projects-main .data-table td:nth-child(1) {
    white-space: normal; /* Customer name can wrap */
    word-break: break-word;
}

.projects-main .data-table td:nth-child(2) {
    white-space: normal; /* Address can wrap fully */
    word-break: break-word;
}

.projects-main .data-table td:nth-child(4) {
    white-space: normal; /* All Types can wrap if needed */
}

/* Make status dropdown selects responsive - allow inline background/text color for status badge look */
.projects-main .data-table td select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    height: 36px !important;
    min-height: 36px !important;
    box-sizing: border-box !important;
    padding: 4px 14px !important;
    font-size: var(--text-sm);
    border-radius: 9999px !important;
    text-align: center !important;
    text-align-last: center !important;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none !important;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.projects-main .data-table td select:focus {
    outline: none !important;
    border-color: var(--color-blue) !important;
    box-shadow: 0 0 0 2px var(--color-blue-light) !important;
}

.projects-main .data-table td select:hover {
    border-color: var(--color-blue) !important;
}

.projects-main .data-table td select option {
    padding: 6px 8px;
    white-space: normal;
    word-wrap: break-word;
}

/* Production view: same layout as Check out (Installation) - full width, no blank space */
#view-production,
#view-production .projects-layout {
    width: 100%;
    min-width: 0;
}
#view-production .projects-main,
#view-production .projects-main .data-table,
#view-production .projects-main #production-data-table {
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

/* Production table: auto-size columns like Check out table */
.projects-main .data-table:has(#production-table-body) tbody td.production-expected-delivery-cell .production-expected-delivery-relative {
    font-size: 10px;
    color: rgba(140, 140, 140, 1);
    margin-left: 2px;
}

/* Projects, Installation, Services: use full width so no empty space on the right */
#view-projects,
#view-installation,
#view-services,
#view-projects .projects-layout,
#view-installation .projects-layout,
#view-services .projects-layout {
    width: 100%;
    min-width: 0;
}
#view-projects .projects-main,
#view-installation .projects-main,
#view-services .projects-main,
#view-projects .projects-main .data-table,
#view-installation .projects-main .data-table,
#view-services .projects-main .data-table {
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

/* Contacts: full width so no empty space on the right */
#view-contacts,
#view-contacts .contacts-layout,
#view-contacts .contacts-main,
#view-contacts .contacts-main .data-table {
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

/* Ensure Clear Filters button has consistent format and width across all pages */
#clear-filters-btn,
#production-clear-filters-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    height: 32px !important;
    font-size: var(--text-sm) !important;
    font-weight: var(--weight-medium) !important;
    white-space: nowrap !important;
    border: none !important;
    background: transparent !important;
    color: var(--color-blue) !important;
    cursor: pointer !important;
    transition: all var(--transition-base) !important;
    border-radius: var(--radius-md) !important;
    width: auto !important;
    min-width: auto !important;
    max-width: fit-content !important;
    box-sizing: content-box !important; /* prevent forced squeeze from border-box */
}

#clear-filters-btn:hover,
#production-clear-filters-btn:hover {
    background: var(--color-blue-light) !important;
    opacity: 1 !important;
    color: var(--color-blue) !important;
}

#clear-filters-btn .material-icons-round,
#production-clear-filters-btn .material-icons-round {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

#clear-filters-btn span:not(.material-icons-round),
#production-clear-filters-btn span:not(.material-icons-round) {
    line-height: 1.2 !important;
    flex-shrink: 0 !important;
    font-size: var(--text-sm) !important;
}

/* Production table: last column (Status + Clear Filters) – auto width like Check out table */
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:last-child {
    text-align: left !important;
    padding: var(--space-2) var(--space-3) !important;
    overflow: visible !important;
}
/* Projects table: filter-bar last th (actions) - 16px */
.projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:last-child,
#view-projects .projects-main .data-table thead.filter-bar-header th:last-child {
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    padding: 2px !important;
    overflow: hidden !important;
}

/* Responsive design for Clear Filters button - Tablet */
@media (max-width: 1024px) {
    .projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:last-child {
        min-width: 16px !important;
        max-width: 16px !important;
    }
    
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 6px 9px !important;
        height: 30px !important;
    }
}

/* Responsive design for Clear Filters button - Mobile */
@media (max-width: 768px) {
    .projects-main .data-table thead.filter-bar-header th:last-child,
    .projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:last-child {
        min-width: 95px !important;
        padding: var(--space-1) var(--space-2) !important;
    }
    .projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:last-child {
        max-width: none !important;
        width: 28% !important;
    }
    .projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:last-child {
        min-width: 16px !important;
        max-width: 16px !important;
    }
    
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 5px 8px !important;
        height: 28px !important;
        font-size: 11px !important;
        gap: 4px !important;
    }
    
    #clear-filters-btn .material-icons-round,
    #production-clear-filters-btn .material-icons-round {
        font-size: 14px !important;
        width: 14px !important;
        height: 14px !important;
    }
    
    #clear-filters-btn span:not(.material-icons-round),
    #production-clear-filters-btn span:not(.material-icons-round) {
        font-size: 11px !important;
    }
}

/* Responsive design for Clear Filters button - Small Mobile */
@media (max-width: 480px) {
    .projects-main .data-table thead.filter-bar-header th:last-child,
    .projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:last-child {
        min-width: 90px !important;
        padding: var(--space-1) !important;
    }
    .projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:last-child {
        max-width: none !important;
        width: 28% !important;
    }
    .projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:last-child {
        min-width: 16px !important;
        max-width: 16px !important;
    }
    
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 4px 6px !important;
        height: 26px !important;
        font-size: 10px !important;
        gap: 3px !important;
    }
    
    #clear-filters-btn .material-icons-round,
    #production-clear-filters-btn .material-icons-round {
        font-size: 13px !important;
        width: 13px !important;
        height: 13px !important;
    }
    
    #clear-filters-btn span:not(.material-icons-round),
    #production-clear-filters-btn span:not(.material-icons-round) {
        font-size: 10px !important;
    }
}

/* Extra small screens - compact button */
@media (max-width: 360px) {
    .projects-main .data-table thead.filter-bar-header th:last-child,
    .projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:last-child {
        min-width: 80px !important;
        padding: var(--space-1) !important;
    }
    .projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:last-child {
        max-width: none !important;
        width: 28% !important;
    }
    .projects-main .data-table:has(#projects-table-body) thead.filter-bar-header th:last-child {
        min-width: 16px !important;
        max-width: 16px !important;
    }
    
    #clear-filters-btn,
    #production-clear-filters-btn {
        padding: 4px 5px !important;
        height: 24px !important;
        font-size: 9px !important;
        gap: 2px !important;
        min-width: 32px !important;
    }
    
    #clear-filters-btn .material-icons-round,
    #production-clear-filters-btn .material-icons-round {
        font-size: 12px !important;
        width: 12px !important;
        height: 12px !important;
    }
    
    #clear-filters-btn span:not(.material-icons-round),
    #production-clear-filters-btn span:not(.material-icons-round) {
        font-size: 9px !important;
        display: none !important; /* icon-only on very small screens */
    }
}

/* Production table address column - allow wrapping */
.projects-main #production-table-body td:nth-child(2) {
    white-space: normal;
    word-break: break-word;
}

/* Projects table: explicit fixed layout; colgroup forces column 7 to 16px */
#view-projects .projects-main .data-table:has(#projects-table-body),
#view-projects .projects-main #projects-data-table {
    table-layout: fixed;
    width: 100%;
    min-width: 800px; /* Prevent column squish; card has overflow-x: auto */
}
/* Projects main card: horizontal scroll when table is wide (responsive) */
#view-projects .projects-main.card {
    overflow-x: auto;
    min-width: 0;
}
/* Installation and Services tables - responsive columns: use full width, narrow actions */
.projects-main .data-table:has(#installation-table-body),
.projects-main .data-table:has(#services-table-body),
.projects-main .data-table:has(#production-table-body) {
    table-layout: fixed;
    width: 100%;
}
/* Production table - column widths so table fills full width (no empty space on right) */
.projects-main .data-table:has(#production-table-body) thead th:nth-child(1),
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:nth-child(1),
.projects-main .data-table:has(#production-table-body) tbody td:nth-child(1) {
    width: 12%;
    min-width: 0;
}
.projects-main .data-table:has(#production-table-body) thead th:nth-child(2),
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:nth-child(2),
.projects-main .data-table:has(#production-table-body) tbody td:nth-child(2) {
    width: 38%;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}
.projects-main .data-table:has(#production-table-body) thead th:nth-child(3),
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:nth-child(3),
.projects-main .data-table:has(#production-table-body) tbody td:nth-child(3) {
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}
.projects-main .data-table:has(#production-table-body) thead th:nth-child(4),
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:nth-child(4),
.projects-main .data-table:has(#production-table-body) tbody td:nth-child(4) {
    width: 12%;
    min-width: 0;
}
.projects-main .data-table:has(#production-table-body) thead th:nth-child(5),
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:nth-child(5),
.projects-main .data-table:has(#production-table-body) tbody td:nth-child(5) {
    width: 15%;
    min-width: 0;
}
.projects-main .data-table:has(#production-table-body) thead th:nth-child(6),
.projects-main .data-table:has(#production-table-body) thead.filter-bar-header th:nth-child(6),
.projects-main .data-table:has(#production-table-body) tbody td:nth-child(6) {
    width: 23%;
    min-width: 0;
}
/* Column 1: Project ID - compact */
.projects-main .data-table:has(#installation-table-body) thead th:nth-child(1),
.projects-main .data-table:has(#installation-table-body) tbody td:nth-child(1),
.projects-main .data-table:has(#services-table-body) thead th:nth-child(1),
.projects-main .data-table:has(#services-table-body) tbody td:nth-child(1) {
    width: 12%;
    min-width: 0;
}
/* Column 2: Address - give most space for text */
.projects-main .data-table:has(#installation-table-body) thead th:nth-child(2),
.projects-main .data-table:has(#installation-table-body) tbody td:nth-child(2),
.projects-main .data-table:has(#services-table-body) thead th:nth-child(2),
.projects-main .data-table:has(#services-table-body) tbody td:nth-child(2) {
    width: 40%;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}
/* Column 3: Type */
.projects-main .data-table:has(#installation-table-body) thead th:nth-child(3),
.projects-main .data-table:has(#installation-table-body) tbody td:nth-child(3),
.projects-main .data-table:has(#services-table-body) thead th:nth-child(3),
.projects-main .data-table:has(#services-table-body) tbody td:nth-child(3) {
    width: 15%;
    min-width: 0;
}
/* Column 4: Status - room for dropdown */
.projects-main .data-table:has(#installation-table-body) thead th:nth-child(4),
.projects-main .data-table:has(#installation-table-body) tbody td:nth-child(4),
.projects-main .data-table:has(#services-table-body) thead th:nth-child(4),
.projects-main .data-table:has(#services-table-body) tbody td:nth-child(4) {
    width: 33%;
    min-width: 0;
}
/* Column 5: Actions - narrow fixed width, no extra white space */
.projects-main .data-table:has(#installation-table-body) thead th:nth-child(5),
.projects-main .data-table:has(#installation-table-body) thead th.actions-col-header,
.projects-main .data-table:has(#installation-table-body) tbody td:nth-child(5),
.projects-main .data-table:has(#services-table-body) thead th:nth-child(5),
.projects-main .data-table:has(#services-table-body) thead th.actions-col-header,
.projects-main .data-table:has(#services-table-body) tbody td:nth-child(5) {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    box-sizing: border-box;
}
.projects-main .data-table:has(#installation-table-body) tbody td:nth-child(5) > div,
.projects-main .data-table:has(#services-table-body) tbody td:nth-child(5) > div {
    max-width: 36px;
    min-width: 0;
}

/* Searchable Customer Dropdown Styles */
.searchable-select-wrapper {
    position: relative;
    flex: 1;
}

.searchable-select-input {
    width: 100%;
    cursor: pointer;
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    background-color: var(--color-bg-primary);
    transition: all var(--transition-base);
}

.searchable-select-input:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-blue-light);
}

.searchable-select-input:disabled {
    cursor: not-allowed;
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 4px;
}

.searchable-select-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition-fast);
    font-size: var(--text-base);
    color: var(--color-text-primary);
}

.searchable-select-option:hover {
    background-color: var(--color-bg-tertiary);
}

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

/* Scrollbar styling for dropdown */
.searchable-select-dropdown::-webkit-scrollbar {
    width: 4px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

.searchable-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--color-bg-tertiary);
}

/* Calendar - full width, filters in main card */
.calendar-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.calendar-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
}

.mini-calendar {
    padding: var(--space-4);
}

.calendar-filters {
    padding: var(--space-4);
}

.calendar-filters h4 {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-3);
}

.calendar-filters label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-weight: var(--weight-regular);
}

.calendar-main {
    min-height: 600px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.cal-nav h3 {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.cal-view-toggle {
    display: flex;
    gap: var(--space-2);
}

.cal-view-toggle button {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--color-border);
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
}

.cal-view-toggle button.active {
    background: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
}

.cal-view-toggle button:not(.active):hover {
    background: var(--color-bg-tertiary);
}

/* Responsive: 7 equal day columns so all days visible without horizontal scroll */
.calendar-grid {
    display: grid;
    grid-template-columns: 50px repeat(7, minmax(0, 1fr));
    grid-auto-rows: 60px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    height: 500px;
    min-height: 400px;
    min-width: 0;
    width: 100%;
    position: relative;
    flex: 1;
}

.cal-day-header {
    border-right: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2);
    text-align: center;
    background: var(--color-bg-secondary);
    height: 50px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(10px, 1.5vw, 14px);
}

.cal-time-label {
    border-right: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-align: right;
    padding: var(--space-1) var(--space-2);
}

.cal-slot {
    border-right: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background-color 0.1s;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    padding: 1px;
    height: auto;
    min-height: 60px;
    min-width: 0;
}

.cal-slot:hover {
    background-color: var(--color-bg-tertiary);
}

.cal-event {
    background-color: var(--color-blue);
    color: white;
    border-radius: var(--radius-sm);
    padding: var(--space-1);
    font-size: var(--text-xs);
    margin: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 50px;
    min-width: 50px;
    max-width: 50px;
    box-sizing: border-box;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.cal-month-day {
    position: relative;
    overflow: hidden;
    min-height: 150px;
    min-width: 0;
}

.cal-month-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

/* Calendar event cards: keep colors (delivered and others) – no grayscale */
.cal-month-event {
    filter: none;
}
.cal-month-event-delivered {
    filter: none;
}

/* Reports */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-8);
}

.report-item {
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.report-item:hover {
    background: var(--color-bg-tertiary);
}

.icon-box {
    width: 32px;
    height: 32px;
    background: var(--color-blue-light);
    color: var(--color-blue);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--weight-semibold);
}

/* Settings */
/* Settings - narrow sidebar for consistency */
.settings-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: var(--space-8);
}

.settings-sidebar {
    padding: var(--space-6);
}

.settings-sidebar h4 {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-3);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: var(--text-xs);
}

.settings-sidebar a {
    display: block;
    padding: var(--space-2) var(--space-3);
    color: var(--color-text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-1);
    transition: background var(--transition-fast);
}

.settings-sidebar a:hover {
    background: var(--color-bg-tertiary);
}

.settings-sidebar a.active {
    background: var(--color-blue-light);
    color: var(--color-blue);
}

.settings-content {
    padding: var(--space-8);
}

.settings-content h3 {
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-8);
}

/* Pipeline Chart */
.pipeline-group h4 {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.pipeline-section {
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-light);
}

.pipeline-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.pipeline-section-header {
    font-size: 9px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-2);
    padding: 0;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    min-width: 0;
    margin-bottom: var(--space-2);
    padding: 0;
}

.chart-row:last-child {
    margin-bottom: 0;
}

.chart-label {
    width: 120px;
    min-width: 120px;
    flex-shrink: 0;
    text-align: left;
    color: var(--color-text-primary);
    font-size: 11px;
    height: 16px;
    display: flex;
    align-items: center;
    font-weight: var(--weight-medium);
}

.chart-bar-container {
    flex: 1;
    min-width: 50px;
    max-width: 100%;
    background-color: rgba(255, 255, 255, 1);
    height: 10px;
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.chart-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    background: linear-gradient(90deg, rgba(156, 53, 64, 1) 0%, rgba(255, 255, 255, 1) 100%);
    color: rgba(56, 56, 67, 1);
}

.chart-value {
    min-width: 28px;
    width: 28px;
    font-weight: var(--weight-semibold);
    flex-shrink: 0;
    text-align: right;
    font-size: 11px;
    color: var(--color-text-primary);
}

/* Notifications Table */
.notifications-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-xs);
}

.notifications-table thead {
    position: sticky;
    top: 0;
    background: var(--color-bg-primary);
    z-index: 1;
}

.notifications-table th {
    text-align: left;
    padding: 8px 4px;
    font-size: 10px;
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--color-border-light);
}

.notifications-table tbody tr {
    transition: background-color 0.2s;
}

.notifications-table tbody tr:hover {
    background-color: var(--color-bg-secondary);
}

.notifications-table tbody td {
    padding: 8px 4px;
    vertical-align: top;
}

/* Tasks */
.task-list {
    list-style: none;
}

.task-group-title {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot.primary {
    background: var(--color-blue);
}

/* Activity */
.activity-today h4 {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
}

.activity-item {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) 0;
}

.check-circle {
    width: 20px;
    height: 20px;
    background: var(--color-success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.check-circle .material-icons-round {
    font-size: 14px;
}

.activity-details p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Video Placeholder */
.video-placeholder {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.video-placeholder .material-icons-round {
    font-size: 32px;
    color: var(--color-blue);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 3000;
}

.toast {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--color-border-light);
}

.toast.show {
    transform: translateX(0);
}

.toast .material-icons-round {
    font-size: 20px;
}

.toast-success .material-icons-round {
    color: var(--color-success);
}

.toast-error .material-icons-round {
    color: var(--color-danger);
}

.toast-warning .material-icons-round {
    color: var(--color-warning);
}

.toast-info .material-icons-round {
    color: var(--color-blue);
}

/* Loading States */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-outline.loading::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: var(--primary-color);
}

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

/* Required field indicator */
.required {
    color: #dc3545;
    margin-left: 2px;
}

/* Search View */
.search-view-container {
    max-width: 1200px;
    margin: 0 auto;
}

.search-header {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.search-input-large {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0 20px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    overflow: hidden;
    min-height: 0;
}

.search-input-large:focus-within {
    border-color: var(--color-blue);
}

.search-input-large input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    height: 56px;
    font-size: 18px;
    outline: none;
    border-radius: 0;
    box-shadow: none;
}

.search-input-large input::placeholder {
    color: var(--color-text-secondary);
}

.search-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-blue);
}

.filter-btn.active {
    background: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
}

.filter-btn .material-icons-round {
    font-size: 18px;
    color: inherit;
}

.search-results-container {
    min-height: 400px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-secondary);
}

.empty-state h3 {
    margin: 16px 0 8px;
    color: var(--color-text-primary);
}

.search-result-item {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.search-result-item:hover {
    border-color: var(--color-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.search-result-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    flex-shrink: 0;
}

.search-result-icon .material-icons-round {
    font-size: 24px;
    color: var(--color-blue);
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.search-result-details {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.search-result-type {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--color-bg-tertiary);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-results-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.search-results-header h3 {
    font-size: var(--text-xl);
    color: var(--color-text-primary);
}

.search-results-count {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: 4px;
}

/* ========================================
   PROFESSIONAL ENHANCEMENTS
   ======================================== */

/* Custom Scrollbar (WebKit) */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

/* Improved Widget Hover States */
.widget {
    transition: all var(--transition-base);
}

.widget:hover {
    border-color: var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Comments widget: maroon glow to draw attention, wider for Project/User/Comment columns */
.widget.comments-widget {
    min-width: 320px;
    border: 1px solid rgba(156, 53, 64, 0.4);
    box-shadow: 0 0 0 1px rgba(156, 53, 64, 0.25),
                0 0 16px rgba(156, 53, 64, 0.22),
                0 0 32px rgba(156, 53, 64, 0.14);
}

.widget.comments-widget:hover {
    border-color: rgba(156, 53, 64, 0.55);
    box-shadow: 0 0 0 2px rgba(156, 53, 64, 0.3),
                0 0 24px rgba(156, 53, 64, 0.25),
                0 0 48px rgba(156, 53, 64, 0.15),
                0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Production Comments table: rounded corners, green highlight for latest rows (like calendar-upcoming-item) */
.widget.comments-widget .widget-content {
    border-radius: var(--radius-md);
    overflow-y: auto;
    overflow-x: hidden;
}

.widget.comments-widget .widget-table {
    border-collapse: separate;
    border-spacing: 0 6px;
}

.widget.comments-widget .comment-row-new td {
    background-color: rgba(52, 199, 89, 0.125);
    border-radius: 4px;
    border-bottom: none;
    padding: 8px 12px;
    transition: all 0.2s;
}

.widget.comments-widget .comment-row-new td:first-child {
    border-left: 3px solid rgb(52, 199, 89);
    border-radius: 4px 0 0 4px;
}

.widget.comments-widget .comment-row-new td:last-child {
    border-radius: 0 4px 4px 0;
}

.widget.comments-widget .comment-row-new {
    transition: transform 0.2s;
}

.widget.comments-widget .comment-row-new:hover {
    transform: translateX(2px);
}

.widget.comments-widget .comment-row-new:hover td {
    background-color: rgba(52, 199, 89, 0.2);
}

/* Production Comments notification icon: burgundy (matches dashboard header) at 80% opacity */
.comments-notification-icon {
    color: rgba(156, 53, 64, 0.8) !important;
    animation: notification-pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(156, 53, 64, 0.6));
}

@keyframes notification-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(156, 53, 64, 0.6));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(156, 53, 64, 0.9));
        transform: scale(1.1);
    }
}

.widget-header .material-icons-round:hover {
    color: var(--color-text-secondary);
}

/* Empty State Styling */
.widget-content:empty::before,
.card:empty::before {
    content: 'No data available';
    display: block;
    text-align: center;
    padding: var(--space-10) var(--space-6);
    color: var(--color-text-tertiary);
    font-size: var(--text-sm);
    font-style: italic;
}

/* Enhanced Focus States for Accessibility */
a:focus-visible,
button:focus-visible,
.nav-item:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px var(--color-blue-light);
}

/* Improved Card Shadows on Hover */
.card {
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Better Button Active States */
.btn:active {
    transform: scale(0.98);
}

.btn-primary:active {
    background-color: var(--color-blue-hover);
}

/* Refined Top Bar - no border/shadow */
.top-bar {
    box-shadow: none;
}

/* Improved Welcome Banner */
.welcome-banner {
    box-shadow: 0 1px 3px rgba(255, 152, 0, 0.1);
}

.close-banner:hover {
    color: var(--color-text-primary);
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
}

/* Better Table Row Hover */
.data-table tbody tr {
    cursor: pointer;
}

.data-table tbody tr:hover {
    background-color: var(--color-bg-tertiary);
    box-shadow: inset 0 0 0 1px var(--color-border-light);
}

/* Improved Modal Backdrop */
.modal-overlay {
    animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal {
    animation: slideUp var(--transition-base);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Popover */
.popover {
    animation: scaleIn var(--transition-fast);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Better Icon Alignment */
.material-icons-round {
    vertical-align: middle;
}

/* Improved Search Bar */
.search-bar {
    transition: all var(--transition-base);
}

.search-bar:focus-within {
    background: white;
    box-shadow: 0 0 0 3px var(--color-blue-light);
}

/* Enhanced Calendar View Toggle */
.cal-view-toggle button {
    font-weight: var(--weight-medium);
}

.cal-view-toggle button:not(.active):hover {
    border-color: var(--color-text-tertiary);
}

/* Better Form Group Spacing */
.form-group label {
    cursor: default;
}

/* Improved Checkbox and Radio Styling */
input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-blue);
}

/* Enhanced Settings Sidebar */
.settings-sidebar a {
    font-size: var(--text-base);
}

.settings-sidebar a.active {
    font-weight: var(--weight-medium);
}

/* Better Report Items */
.report-item {
    font-size: var(--text-base);
}

.icon-box {
    font-size: var(--text-sm);
}

/* Improved Activity Items */
.activity-item {
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.activity-item:hover {
    background: var(--color-bg-tertiary);
}

/* Enhanced Video Placeholder */
.video-placeholder {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.video-placeholder:hover {
    background: rgba(0, 122, 255, 0.05);
}

.video-placeholder span:last-child {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

/* Better Task List */
.task-list {
    padding: 0;
}

.task-list li {
    padding: var(--space-2) 0;
}

/* Improved Pipeline Group */
.pipeline-group {
    padding: var(--space-4) 0;
}

/* Enhanced Mini Calendar */
.mini-calendar h4 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-4);
}

.mini-cal-grid {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* Better Contacts Sidebar */
.contacts-sidebar .card h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Contacts sidebar: narrow, responsive buttons (no full-width) */
.contacts-sidebar-card .btn.btn-outline,
.contacts-sidebar-actions .btn {
    width: auto;
    min-width: 0;
    max-width: min(100%, 160px);
    white-space: nowrap;
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}
.contacts-sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    align-items: flex-start;
}
.contacts-sidebar-card {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
}

/* Improved User Avatar */
.user-profile .avatar {
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
}

.user-profile .avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

/* Enhanced Add Item Icons */
.add-item .material-icons-round {
    color: var(--color-text-secondary);
}

/* Better Close Button */
.close-modal {
    transition: all var(--transition-fast);
}

.close-modal:hover {
    color: var(--color-text-primary);
    transform: scale(1.1);
}

/* Improved Button Icon Spacing */
.btn .material-icons-round {
    margin-right: var(--space-1);
}

/* Enhanced Divider */
.nav-divider {
    opacity: 0.5;
}

/* Better Text Utilities */
.text-muted {
    font-size: var(--text-sm);
}

/* Improved View Sections */
.view-section {
    animation: fadeIn var(--transition-base);
    width: 100%;
}

#view-stock {
    padding: 0 !important;
    margin: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

#view-stock #stock-content {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Financial view: scrollable table so all projects are visible */
.financial-view-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.financial-table-wrapper {
    overflow-y: auto;
    overflow-x: auto;
    max-height: calc(100vh - 280px);
    -webkit-overflow-scrolling: touch;
}
.financial-table-wrapper .data-table {
    min-width: 800px;
}
.financial-filter-row th {
    padding: 4px 8px;
    vertical-align: middle;
    background: var(--color-bg-secondary, #f8fafc);
    font-weight: normal;
}
.financial-filter-row .form-control {
    border: 1px solid var(--color-border-light, #e2e8f0);
    border-radius: 4px;
}

/* Contact info column: wrap text instead of truncating */
.financial-table-wrapper .financial-contact-cell {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 200px;
}

/* Compact payment summary: inline, right of toolbar, admin-only */
.financial-summary-inline {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    font-size: 13px;
}
.financial-summary-inline .financial-summary-item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 4px 10px;
    background: var(--color-bg-secondary, #f1f5f9);
    border-radius: 6px;
    white-space: nowrap;
}
.financial-summary-inline .financial-summary-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.financial-summary-inline .financial-summary-paid {
    color: #16a34a;
}

#view-stock .stock-app {
    width: 100%;
    min-height: 100vh;
}

.view-section.hidden {
    display: none !important;
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

/* Enhanced Dashboard Grid Responsiveness */
@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: var(--space-6);
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    
    .widget {
        padding: var(--space-4);
    }
    
    .widget-header {
        margin-bottom: var(--space-4);
    }
    }

@media (max-width: 1200px) {
    .contacts-layout,
    .calendar-layout,
    .settings-layout,
    .sales-layout,
    .projects-layout,
    .project-detail-grid {
        grid-template-columns: 1fr;
    }

    /* Calendar: full width on tablet, grid stays responsive (all 7 days visible) */
    .calendar-main {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .calendar-main {
        min-height: 480px;
    }
    .calendar-grid {
        height: 420px;
        min-height: 360px;
    }
}

@media (max-width: 768px) {
    .project-detail-grid .card > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* Tablet and small desktop: stack sidebars above main content */
@media (max-width: 992px) {
    .projects-layout,
    .sales-layout {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .contacts-layout {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .projects-sidebar,
    .sales-sidebar {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: var(--space-4);
        align-items: start;
    }

    .projects-sidebar .card:first-child,
    .sales-sidebar .card:first-child {
        max-width: 160px;
    }
}

@media (max-width: 768px) {
    .projects-sidebar,
    .sales-sidebar {
        grid-template-columns: 1fr;
    }

    .projects-sidebar .card:first-child,
    .sales-sidebar .card:first-child {
        max-width: none;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        position: relative;
    }

    #health-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 4px 8px;
        background: transparent;
        z-index: 999;
        border-top: none;
    }
    .health-dots {
        flex-direction: row;
        gap: 6px;
    }
    .health-label { font-size: 7px; }
    #health-refresh .material-icons-round { font-size: 14px; }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .top-bar {
        padding: 0 var(--space-4);
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .top-bar-search {
        max-width: none;
    }

    .top-bar-title {
        font-size: var(--text-xs);
        max-width: 80px;
    }

    .content-area {
        padding: var(--space-4);
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Table wrapper for mobile - allows horizontal scroll within container */
    .table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 calc(-1 * var(--space-4)); /* Negative margin to extend to edges */
        padding: 0 var(--space-4); /* Padding to maintain spacing */
    }

    .table-wrapper .data-table {
        min-width: 600px;
        width: 100%;
    }

    /* Make tables more compact on mobile */
    .data-table th,
    .data-table td {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
    }

    /* Ensure all cards and containers fit */
    .card {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Fix toolbar buttons to prevent overflow */
    .contacts-toolbar,
    .projects-toolbar,
    .sales-toolbar {
        flex-wrap: wrap;
        gap: var(--space-2);
        width: 100%;
        max-width: 100%;
    }

    .contacts-toolbar .btn,
    .projects-toolbar .btn,
    .sales-toolbar .btn {
        flex-shrink: 1;
        min-width: 0;
        white-space: nowrap;
        font-size: var(--text-sm);
        padding: 0 var(--space-3);
    }

    .search-bar {
        min-width: 0;
        flex: 1 1 auto;
        max-width: 100%;
    }

    /* Make table containers scrollable on mobile */
    .contacts-main,
    .projects-main,
    .sales-main {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tables need minimum width but can scroll horizontally */
    .data-table {
        min-width: 600px;
        width: 100%;
    }

    /* Fix any fixed-width elements */
    .contacts-toolbar,
    .projects-toolbar,
    .sales-toolbar {
        flex-wrap: wrap;
        gap: var(--space-2);
        width: 100%;
        max-width: 100%;
    }

    .search-bar {
        min-width: 0;
        flex: 1 1 auto;
    }

    /* Ensure buttons in toolbars don't cause overflow */
    .contacts-toolbar .btn,
    .projects-toolbar .btn,
    .sales-toolbar .btn {
        flex-shrink: 1;
        min-width: 0;
        white-space: nowrap;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 63px;
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
        transition: transform var(--transition-base);
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

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

    .mobile-sidebar-close {
        display: flex;
    }

    .mobile-overlay {
        display: block;
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    }

    /* Touch-friendly nav items on mobile */
    .sidebar .nav-item {
        min-height: 48px; /* iOS recommended touch target size */
        padding: var(--space-2) 0;
        width: 63px;
        -webkit-tap-highlight-color: rgba(0, 122, 255, 0.1);
    }

    /* Hide text labels on mobile - icons only */
    .sidebar .nav-item span:not(.material-icons-round) {
        display: none;
    }

    /* Adjust icon size for mobile */
    .sidebar .nav-item .material-icons-round {
        font-size: 24px;
        margin-bottom: 0;
    }

    /* Adjust logo icon for mobile */
    .sidebar .logo-icon {
        font-size: 28px;
        margin-bottom: var(--space-2);
    }

    /* Adjust sidebar padding for narrow width */
    .sidebar {
        padding: var(--space-2) 0;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* Hide user profile text on mobile */
    .sidebar .user-profile #user-display-name {
        display: none;
    }

    /* Adjust nav dividers for narrow sidebar */
    .sidebar .nav-divider {
        width: 40px;
        margin: var(--space-1) auto;
    }

    /* Adjust close button position for narrow sidebar */
    .mobile-sidebar-close {
        top: var(--space-2);
        right: var(--space-2);
        width: 32px;
        height: 32px;
    }

    /* Ensure all sidebar content fits 63px width */
    .sidebar > * {
        max-width: 63px;
        width: 63px;
    }

    /* Prevent horizontal scroll in all containers - make tables scrollable instead */
    .contacts-main,
    .projects-main,
    .sales-main {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        /* Always show scrollbar for better UX */
        scrollbar-width: thin;
        scrollbar-color: var(--color-border) transparent;
    }

    /* Tables need minimum width but can scroll horizontally within container */
    .contacts-main .data-table,
    .projects-main .data-table,
    .sales-main .data-table {
        min-width: 800px;
        width: 100%;
        table-layout: fixed; /* Maintain fixed layout on mobile too */
    }

    /* Responsive column widths for smaller screens */
    @media (max-width: 768px) {
        .projects-main .data-table thead:first-of-type th:nth-child(1),
        .projects-main .data-table thead.filter-bar-header th:nth-child(1),
        .projects-main .data-table tbody td:nth-child(1) {
            width: 16%;
        }

        .projects-main .data-table thead:first-of-type th:nth-child(2),
        .projects-main .data-table thead.filter-bar-header th:nth-child(2),
        .projects-main .data-table tbody td:nth-child(2) {
            width: 18%;
        }

        .projects-main .data-table thead:first-of-type th:nth-child(3),
        .projects-main .data-table thead.filter-bar-header th:nth-child(3),
        .projects-main .data-table tbody td:nth-child(3) {
            width: 10%;
        }
        /* Projects: Created Date gets more space on small viewports */
        #view-projects .projects-main .data-table th:nth-child(3),
        #view-projects .projects-main .data-table td:nth-child(3) {
            min-width: 120px;
            width: 13%;
        }

        .projects-main .data-table thead:first-of-type th:nth-child(4),
        .projects-main .data-table thead.filter-bar-header th:nth-child(4),
        .projects-main .data-table tbody td:nth-child(4) {
            width: 10%;
        }

        .projects-main .data-table thead:first-of-type th:nth-child(5),
        .projects-main .data-table thead.filter-bar-header th:nth-child(5),
        .projects-main .data-table tbody td:nth-child(5) {
            width: 12%; /* Expected Delivery */
        }

        .projects-main .data-table thead:first-of-type th:nth-child(6),
        .projects-main .data-table thead.filter-bar-header th:nth-child(6),
        .projects-main .data-table tbody td:nth-child(6) {
            width: 12%;
        }

        .projects-main .data-table thead:first-of-type th:nth-child(7),
        .projects-main .data-table thead.filter-bar-header th:nth-child(7),
        .projects-main .data-table tbody td:nth-child(7) {
            width: 10%;
        }
        /* Projects table Actions column: 16px on all viewports */
        #view-projects .projects-main .data-table thead:first-of-type th:nth-child(7),
        #view-projects .projects-main .data-table thead.filter-bar-header th:nth-child(7),
        #view-projects .projects-main .data-table thead.filter-bar-header th:last-child,
        #view-projects .projects-main .data-table tbody td:nth-child(7) {
            width: 16px !important;
            min-width: 16px !important;
            max-width: 16px !important;
        }

        /* Make status dropdowns more compact on mobile */
        .projects-main .data-table td select {
            font-size: 11px;
            padding: 3px 20px 3px 6px;
        }
    }

    /* Ensure scrollbar is visible on iOS/WebKit */
    .contacts-main::-webkit-scrollbar,
    .projects-main::-webkit-scrollbar,
    .sales-main::-webkit-scrollbar {
        height: 4px;
        display: block;
    }

    .contacts-main::-webkit-scrollbar-track,
    .projects-main::-webkit-scrollbar-track,
    .sales-main::-webkit-scrollbar-track {
        background: var(--color-bg-tertiary);
        border-radius: var(--radius-full);
    }

    .contacts-main::-webkit-scrollbar-thumb,
    .projects-main::-webkit-scrollbar-thumb,
    .sales-main::-webkit-scrollbar-thumb {
        background: var(--color-border);
        border-radius: var(--radius-full);
    }

    .contacts-main::-webkit-scrollbar-thumb:hover,
    .projects-main::-webkit-scrollbar-thumb:hover,
    .sales-main::-webkit-scrollbar-thumb:hover {
        background: var(--color-text-tertiary);
    }

    /* Ensure view sections don't overflow */
    .view-section {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Co-pilot FAB: safe area and spacing on mobile */
    .copilot-fab {
        bottom: max(16px, env(safe-area-inset-bottom, 16px));
        right: max(16px, env(safe-area-inset-right, 16px));
    }

    .copilot-panel {
        bottom: max(80px, calc(56px + env(safe-area-inset-bottom, 16px)));
        right: max(16px, env(safe-area-inset-right, 16px));
        max-width: min(380px, calc(100vw - 32px));
    }

    /* Fix any elements with fixed widths */
    .widget,
    .dashboard-grid {
        width: 100%;
        max-width: 100%;
    }

    .modal {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        max-width: 100% !important;
    }

    .modal-body {
        padding: var(--space-4);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .add-menu-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Dashboard responsive */
    .dashboard-header {
        padding: var(--space-6) var(--space-4);
        margin-bottom: var(--space-6);
        min-height: 160px;
    }
    
    .dashboard-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }
    
    .dashboard-clock {
        font-size: 64px;
        letter-spacing: -3px;
    }
    
    .dashboard-date {
        font-size: var(--text-sm);
    }
    
    .dashboard-search-section {
        width: 100%;
        order: 3;
    }

    .dashboard-search-bar {
        max-width: 100%;
    }

    .dashboard-user-section {
        align-items: flex-start;
    }
    
    .dashboard-username {
        font-size: var(--text-lg);
    }
    
    .dashboard-grid {
        gap: var(--space-4);
    }
    
    .widget.comments-widget {
        min-width: 0;
    }
    
    .widget {
        padding: var(--space-4);
    }
    
    .widget-header {
        margin-bottom: var(--space-3);
    }
    
    .widget-header h3 {
        font-size: var(--text-base);
    }
    
    /* Chart responsive */
    .chart-row {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .chart-label {
        width: 120px;
        min-width: 120px;
        font-size: 11px;
    }
    
    .chart-bar-container {
        flex: 1 1 100%;
        max-width: 100%;
        order: 3;
    }
    
    .chart-value {
        margin-left: auto;
        order: 2;
    }
    
    /* Task list responsive */
    .task-list li {
        padding: var(--space-2) 0;
    }
    
    /* Activity responsive */
    .activity-item {
        padding: var(--space-2) 0;
    }
}

/* Extra small screens: tighter padding, keep touch targets */
@media (max-width: 480px) {
    .content-area {
        padding: var(--space-3);
    }

    .top-bar {
        padding: 0 var(--space-3);
    }

    .data-table th,
    .data-table td {
        padding: var(--space-2);
        font-size: 12px;
    }

    .projects-toolbar,
    .contacts-toolbar,
    .sales-toolbar {
        min-height: 44px;
    }
}

/* Better Print Styles */
@media print {

    .sidebar,
    .top-bar,
    .btn,
    .close-banner,
    #health-bar {
        display: none !important;
    }

    .app-container {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 0;
    }
}

/* Smooth Transitions for All Interactive Elements */
a,
button,
input,
textarea,
select {
    transition: all var(--transition-base);
}

/* Prevent Text Selection on UI Elements */
.sidebar,
.top-bar,
.btn,
.nav-item,
.widget-header {
    user-select: none;
    -webkit-user-select: none;
}

/* Better Focus Management */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}

/* Project ID Badge - Always Bold; prefix/suffix (K-, -26) much smaller */
.id-badge {
    font-weight: var(--weight-bold);
    font-weight: 700;
}
.id-badge span {
    font-size: 0.65em;
    vertical-align: middle;
}
.id-badge strong {
    font-size: 1em;
}

/* Hide Notifications Widget */
.widget.tasks-widget {
    display: none !important;
}

/* Hide Activity Report Widget */
.widget.activity-widget {
    display: none !important;
}

/* Material Edit Button */
.material-edit-button:hover {
    opacity: 0.7 !important;
    background: rgba(255, 255, 255, 0.2) !important;
}

/* ==================== CRM Co-pilot ==================== */
.copilot-fab {
    display: none !important; /* Hidden for now – remove this line to show again */
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #487393 0%, #5856D6 100%);
    box-shadow: 0 4px 16px rgba(72, 115, 147, 0.4);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* When showing again, add: display: flex; and remove the display: none line above */
.copilot-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(72, 115, 147, 0.5);
}
.copilot-fab .material-icons-round {
    font-size: 28px;
    color: white;
}

.copilot-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    max-height: 480px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.copilot-panel.hidden {
    display: none !important;
}

.copilot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, #487393 0%, #5856D6 100%);
    color: white;
}
.copilot-header h3 {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
}
.copilot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.copilot-close:hover {
    opacity: 0.9;
}

.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
}

.copilot-message {
    display: flex;
    max-width: 90%;
}
.copilot-message.user {
    align-self: flex-end;
}
.copilot-message.assistant {
    align-self: flex-start;
}
.copilot-message.loading .copilot-typing {
    color: var(--color-text-tertiary);
    font-style: italic;
}
.copilot-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: var(--text-sm);
    line-height: 1.5;
}
.copilot-message.user .copilot-bubble {
    background: linear-gradient(135deg, #487393 0%, #5856D6 100%);
    color: white;
}
.copilot-message.assistant .copilot-bubble {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.copilot-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--color-border-light);
    background: var(--color-bg-primary);
}
.copilot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: var(--text-sm);
    outline: none;
}
.copilot-input:focus {
    border-color: var(--color-blue);
}
.copilot-send {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #487393 0%, #5856D6 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.copilot-send:hover {
    opacity: 0.95;
}
.copilot-send .material-icons-round {
    font-size: 20px;
}

/* ── Smoothness & Interaction Polish ── */

.close-modal,
.close-banner,
#health-refresh,
#health-backup-btn,
.copilot-send,
.widget-header .material-icons-round,
select.form-control {
    transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}

.close-modal:hover,
#health-refresh:hover,
#health-backup-btn:hover {
    color: var(--color-text-primary);
    transform: scale(1.1);
}

.copilot-send:hover {
    transform: scale(1.04);
}

.btn-outline:hover {
    transform: scale(1.02);
}

.btn-primary:active,
.btn-outline:active,
.btn-text:active,
.filter-btn:active,
.copilot-send:active,
.close-modal:active {
    transform: scale(0.96);
}

.searchable-select-option:hover {
    transform: translateX(2px);
}

.calendar-upcoming-item:hover,
.report-item:hover {
    transform: translateX(2px);
}

.btn,
.btn-icon,
.filter-btn,
.card,
.nav-item,
.searchable-select-option,
.calendar-upcoming-item,
.report-item,
.widget-action-icon {
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Custom Status Dropdown ── */

.status-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.status-dropdown-trigger {
    padding: 6px 14px;
    border-radius: 9999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-weight: 500;
    font-size: var(--text-sm);
    text-align: center;
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.status-dropdown-trigger:hover {
    opacity: 0.85;
}

.status-dropdown-trigger:active {
    transform: scale(0.96);
}

.status-dropdown-panel {
    display: none;
    position: fixed;
    min-width: 210px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    padding: 6px 0;
    animation: fadeIn var(--transition-fast);
}

.status-dropdown-panel.open {
    display: block;
}

.status-dropdown-group-label {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.04em;
    pointer-events: none;
}

.status-dropdown-item {
    padding: 8px 16px;
    font-size: var(--text-sm);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background var(--transition-fast);
    color: var(--color-text-primary);
}

.status-dropdown-item:hover {
    background: var(--color-bg-secondary);
}

.status-dropdown-item.active {
    background: var(--color-blue-light);
    color: var(--color-blue);
}

.status-dropdown-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: 4px 12px;
}

/* Screen-reader only: visually hidden but read by assistive tech */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
