﻿/* ------ Variables --------------------------------------------------------- */
:root {
    --font-family: Arial, sans-serif;

    /* Primary */
    --color-ironstone:    #303633;
    --color-emerald:      #03babd;

    /* Ironstone Tints */
    --color-ironstone-80: #595e5c;
    --color-ironstone-60: #838685;
    --color-ironstone-50: #8a8f8d;
    --color-ironstone-40: #acafad;
    --color-ironstone-20: #d6d7d6;
    --color-ironstone-10: #eaebeb;

    /* Ironstone Dark - dark mode derivatives */
    --color-ironstone-dark:  #1a1d1c;
    --color-ironstone-dark2: #1e2120;
    --color-ironstone-dark3: #3a3e3c;

    /* Black & White */
    --color-white: #ffffff;
    --color-black: #000000;

    /* Status */
    --color-amber: #f59e0b;

    /* Capability */
    --color-design:    #bd3b45;
    --color-service:   #e8914a;
    --color-machinery: #754a99;
    --color-process:   #82a347;
    --color-controls:  #335ea1;
    --color-robotics:  #03736e;

    --spacing-xs:  4px;
    --spacing-sm:  8px;
    --spacing-md:  16px;
    --spacing-lg:  24px;
    --spacing-xl:  32px;

    --border-color: var(--color-ironstone-20);
    --border:       1px solid var(--border-color);

    --nav-width:        60px;
    --nav-logo-size:    45px;
    --nav-padding:      16px 0;

    --mobile-topbar-height:    64px;
    --mobile-bottomnav-height: 84px;

    --avatar-size:            36px;
    --avatar-size-sm:         38px;
    --avatar-bg:              var(--color-emerald);
    --avatar-color:           var(--color-white);
    --avatar-font-size:       14px;
    --avatar-font-weight:     700;

    --tile-min-height:        120px;
    --icon-placeholder-size:  48px;
    --tile-shadow:            0 0 8px rgba(0, 0, 0, 0.12);
    --tile-hover-shadow:      0 0 14px rgba(3, 186, 189, 0.25);

    --mobile-breakpoint: 960px;

    /* Semantic - Light Mode */
    --bg-page:              var(--color-ironstone-10);
    --bg-nav-bottom:        var(--color-white);
    --text-heading:         var(--color-ironstone);
    --icon-color-nav:       var(--color-ironstone-40);
    --icon-color-bottomnav: var(--color-ironstone);
    --border-color:         var(--color-ironstone-20);
    --header-bg:            var(--color-ironstone);
    --header-color:         var(--color-white);
}

/* Dark Mode */
[data-theme="dark"] .mobile-topbar {
    background-color: var(--color-ironstone) !important;
}

[data-theme="dark"] {
    --bg-page:              var(--color-ironstone-dark);
    --bg-nav-bottom:        var(--color-ironstone-dark2);
    --text-heading:         var(--color-ironstone-20);
    --icon-color-nav:       var(--color-ironstone-50);
    --icon-color-bottomnav: var(--color-ironstone-40);
    --border-color:         var(--color-ironstone-dark3);
    --border:               1px solid var(--border-color);
    --tile-shadow:          0 0 10px rgba(0, 0, 0, 0.5);
    --tile-hover-shadow:    0 0 16px rgba(3, 186, 189, 0.4);
}

/* Reset */
html, body, #app {
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

/* App Shell */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Desktop Nav */
.app-nav {
    width: var(--nav-width);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: var(--nav-padding);
    background-color: var(--color-ironstone);
    border-right: none;
    flex-shrink: 0;
}

.app-nav-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    flex: 1;
}

.app-nav-version {
    margin-top: auto;
    padding-bottom: var(--spacing-sm);
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.03em;
}

.app-nav-logo {
    width: var(--nav-logo-size);
    height: var(--nav-logo-size);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-xs);
}

.app-nav-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-nav .mud-icon-root {
    color: var(--icon-color-nav);
}

.app-nav .mud-icon-button:hover .mud-icon-root {
    color: var(--color-white);
}

.app-nav .app-nav-active .mud-icon-root {
    color: var(--color-emerald) !important;
}

.user-avatar {
    width: var(--avatar-size) !important;
    height: var(--avatar-size) !important;
    min-width: var(--avatar-size) !important;
    background-color: var(--avatar-bg) !important;
    color: var(--avatar-color) !important;
    font-size: var(--avatar-font-size) !important;
    font-weight: var(--avatar-font-weight);
    cursor: pointer;
    flex-shrink: 0;
}

.user-avatar.sm {
    width: var(--avatar-size-sm) !important;
    height: var(--avatar-size-sm) !important;
    min-width: var(--avatar-size-sm) !important;
}

/* Content Area */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

/* Desktop header bar - replaces per-page dashboard-header on desktop */
.desktop-topbar {
    display: none;
}

.desktop-topbar-right {
    display: flex;
    align-items: center;
    gap: 0;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--header-color);
}

.topbar-bc-parent {
    opacity: 0.45;
    font-weight: 600;
}

.topbar-bc-sep {
    opacity: 0.3;
    font-weight: 400;
    font-size: 1.1rem;
}

.topbar-bc-leaf {
    font-weight: 700;
}

.desktop-topbar .mud-icon-root {
    color: var(--icon-color-nav);
}

.desktop-topbar .mud-icon-button:hover .mud-icon-root {
    color: var(--color-white);
}

.app-body {
    flex: 1;
    overflow: auto;
    background-color: var(--bg-page);
}

/* Mobile Top Bar */
.mobile-topbar {
    display: none;
    justify-content: space-between;
    align-items: center;
    height: var(--mobile-topbar-height);
    padding: 0 var(--spacing-lg);
    background-color: var(--header-bg) !important;
    border-bottom: none;
    flex-shrink: 0;
}

.mobile-topbar-title {
    color: var(--color-white);
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.mobile-topbar .mud-icon-root {
    color: var(--icon-color-nav);
    font-size: 26px;
}

.mobile-topbar .mud-icon-button:hover .mud-icon-root {
    color: var(--color-white);
}


/* Mobile Bottom Nav */
.mobile-bottomnav {
    display: none;
    height: var(--mobile-bottomnav-height);
    background-color: var(--bg-nav-bottom);
    border-top: var(--border);
    flex-shrink: 0;
}

.bottomnav-btn-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 18px;
    padding-right: 18px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--icon-color-bottomnav);
    text-decoration: none;
    transition: background 0.15s;
}

.bottomnav-btn-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 18px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--icon-color-bottomnav);
    text-decoration: none;
    transition: background 0.15s;
}

.bottomnav-btn-left:hover,
.bottomnav-btn-right:hover {
    background: rgba(128, 128, 128, 0.12);
}

.bottomnav-btn-left .mud-icon-root,
.bottomnav-btn-right .mud-icon-root {
    color: var(--icon-color-bottomnav);
    font-size: 28px;
}

/* Admin Page */
.admin-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.admin-tab-panel {
    overflow: auto;
    scrollbar-width: none;
}
.admin-tab-panel::-webkit-scrollbar {
    display: none;
}

.admin-user-row {
    background-color: var(--mud-palette-surface);
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.admin-user-row:not(:has(.admin-row-action)):hover {
    background-color: var(--mud-palette-primary-lighten);
}
.admin-user-row .mud-chip {
    margin-left: 0;
}

.admin-row-action {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    flex-shrink: 0;
    cursor: pointer;
}

.admin-row-action:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .admin-row-action:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.admin-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.admin-status-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--mud-palette-surface);
}

.admin-status-dot--active   { background-color: var(--color-emerald); }
.admin-status-dot--inactive { background-color: var(--color-ironstone-40); }

.admin-user-info {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.admin-user-name {
    font-weight: 700 !important;
    white-space: nowrap;
    color: var(--mud-palette-text-primary) !important;
}

.admin-user-name::after {
    content: " ·";
    color: var(--color-ironstone-60);
    font-weight: 400;
}

.admin-user-dept {
    color: var(--color-ironstone-60) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user-roles {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin-top: 2px;
    overflow: hidden;
    mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
}

.admin-search-bar {
    padding: 0;
    margin: var(--spacing-md) 0 var(--spacing-xs);
    background: var(--mud-palette-background);
    flex-shrink: 0;
}
.admin-search-bar .mud-input-control {
    margin: 0;
}
.admin-search-bar--direct {
    margin-bottom: var(--spacing-md);
}

@media (min-width: 961px) {
    .admin-segmented {
        width: fit-content !important;
        align-self: flex-start;
    }

    .admin-segmented .mud-toggle-item {
        padding-left: 32px !important;
        padding-right: 32px !important;
    }

    .admin-search-bar,
    .admin-search-bar--direct,
    .admin-panel-search {
        width: 280px;
        align-self: flex-start;
    }

    /* Grid layout so name / dept / email / phone / roles columns align across all rows - user rows only */
    .admin-user-row--user {
        display: grid !important;
        grid-template-columns: auto 200px 170px 240px 1fr auto;
        align-items: center;
        column-gap: 0 !important;
        min-height: 64px;
    }

    /* Flatten admin-user-info so its children become direct grid items */
    .admin-user-row--user .admin-user-info {
        display: contents;
    }

    /* Avatar -> name: 12px (same as MudStack Spacing="3" on mobile) */
    .admin-user-row--user .admin-user-name {
        margin-left: 12px;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .admin-user-row--user .admin-user-name::after {
        content: none;
    }

    /* name -> dept and dept -> email -> phone -> roles: equal gaps */
    .admin-user-row--user .admin-user-dept {
        margin-left: var(--spacing-md);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-user-row--user .admin-user-email {
        margin-left: var(--spacing-md);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.75rem;
        color: var(--mud-palette-text-secondary);
    }

    .admin-user-row--user .admin-user-roles {
        margin-left: var(--spacing-md);
        width: auto;
        margin-top: 0;
    }

    /* Search bar styling - border and text match Active/Inactive header colour */
    .admin-search-bar .mud-input-outlined-border {
        border-color: var(--mud-palette-text-secondary) !important;
    }
    .admin-search-bar .mud-input-label,
    .admin-search-bar .mud-input-adornment-start {
        color: var(--mud-palette-text-secondary) !important;
    }
    .admin-search-bar input::placeholder {
        color: var(--mud-palette-text-secondary) !important;
    }
}

.proj-search-field .mud-input-outlined-border {
    border-color: var(--mud-palette-text-secondary) !important;
}
.proj-search-field .mud-input-adornment-start {
    color: var(--mud-palette-text-secondary) !important;
}
.proj-search-field input::placeholder {
    color: var(--mud-palette-text-secondary) !important;
}

.admin-segmented {
    padding: 0 !important;
    gap: 0 !important;
    width: 100%;
    border-radius: var(--mud-default-borderradius);
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

.admin-segmented .mud-toggle-item {
    border-radius: 0 !important;
}

.admin-segmented .mud-toggle-item:first-child {
    border-radius: var(--mud-default-borderradius) 0 0 var(--mud-default-borderradius) !important;
}

.admin-segmented .mud-toggle-item:last-child {
    border-radius: 0 var(--mud-default-borderradius) var(--mud-default-borderradius) 0 !important;
}

.admin-segmented,
.admin-segmented .mud-toggle-item {
    color: var(--mud-palette-text-primary) !important;
    border-color: var(--mud-palette-text-primary) !important;
}
.admin-segmented .mud-toggle-item:not(.mud-toggle-item-selected) {
    background-color: var(--mud-palette-surface) !important;
}
.admin-segmented .mud-toggle-item-selected {
    background-color: var(--mud-palette-text-primary) !important;
    color: var(--mud-palette-background) !important;
}

/* Schedules */

.sch-filters .mud-input-outlined-border {
    border-color: var(--mud-palette-text-primary) !important;
}

.sch-filters .mud-input {
    background-color: var(--mud-palette-surface);
    border-radius: var(--mud-default-borderradius);
}


.sch-first-day .ts-section-header {
    padding-top: 0;
}

.sch-week-desktop  { display: flex; }
.sch-filter-spacer { display: none; }


/* --- Schedule Stat Bubble ----------------------------------------- */
.sch-stat-bubble {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: flex-start;
    padding: 14px 22px;
    border: 1px solid var(--color-ironstone-80);
    border-radius: 6px;
    background: var(--mud-palette-surface);
    min-width: 110px;
}

.sch-stat-bubble-value {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: var(--mud-palette-text-primary) !important;
}

.sch-stat-bubble-label {
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mud-palette-text-secondary) !important;
    margin-top: 3px;
}

.sch-stat-bubble--danger  { border-color: var(--color-design); }
.sch-stat-bubble--danger .sch-stat-bubble-value { color: var(--color-design) !important; }

.sch-stat-bubble--warning { border-color: var(--color-amber, #f59e0b); }
.sch-stat-bubble--warning .sch-stat-bubble-value { color: var(--color-amber, #f59e0b) !important; }

.sch-stat-bubble--success { border-color: var(--mud-palette-success); }
.sch-stat-bubble--success .sch-stat-bubble-value { color: var(--mud-palette-success) !important; }

.sch-board {
    display: flex !important;
    flex-direction: column;
}

.sch-board-col {
    display: flex !important;
    flex-direction: column;
    padding: 0 var(--spacing-xs);
}

.sch-top-row {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

@media (min-width: 961px) {
    .sch-top-row {
        flex-direction: row;
        align-items: flex-start;
    }

    .sch-filters-wrap {
        flex-shrink: 0;
        height: 88px;
        width: 400px;
        align-self: flex-start;
        margin-left: auto;
    }

    .sch-filters-wrap .tsd-add-selects > * {
        flex: 0 0 196px;
    }

    .tsadmin-find-filters {
        width: fit-content !important;
        height: auto !important;
        margin-left: auto;
        min-width: 500px;
    }

    .tsadmin-find-filters .tsd-add-selects > * {
        flex: 1 !important;
    }

    .tsadmin-find-filter-controls {
        margin-left: auto;
        min-width: 500px;
    }

    .tsadmin-find-filter-controls .tsd-add-selects > * {
        flex: 1 !important;
    }

.sch-filter-spacer { display: flex !important; height: 38px; }

    .sch-board {
        flex-direction: row !important;
        flex-wrap: wrap;
        align-items: stretch;
        gap: var(--spacing-xs);
        border-top: 1px solid var(--border-color);
        min-height: 100%;
    }

    .sch-board-col {
        flex: 1 1 120px;
        min-width: 0;
        max-width: 300px;
    }

    .sch-board-col--today {
        background: color-mix(in srgb, var(--mud-palette-primary) 7%, transparent);
    }

    .sch-board-col--today .ts-section-header {
        background: transparent;
    }

    .sch-board-col--today .ts-section-title {
        color: var(--mud-palette-primary) !important;
    }

    .sch-board-col .ts-section-header {
        padding-top: var(--spacing-sm);
        position: static;
    }
}

.sch-task-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border: var(--border);
    border-radius: var(--mud-default-borderradius);
    overflow: hidden;
    background-color: var(--mud-palette-surface);
}

.sch-task-card-strip {
    width: 4px;
    flex-shrink: 0;
}

/* Admin Member Panel */
.admin-panel {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: var(--mud-palette-background);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: admin-panel-in 0.22s ease;
}
@keyframes admin-panel-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.admin-panel--exit {
    animation: admin-panel-out 0.22s ease forwards;
}
@keyframes admin-panel-out {
    from { transform: translateX(0); }
    to   { transform: translateX(100%); }
}

.admin-panel-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md) var(--spacing-xs) var(--spacing-xs);
    background-color: var(--header-bg);
    box-shadow: var(--tile-shadow);
    flex-shrink: 0;
}

.admin-panel-body {
    flex: 1;
    overflow: auto;
    scrollbar-width: none;
}
.admin-panel-body::-webkit-scrollbar { display: none; }

.admin-panel-search {
    padding: var(--spacing-xs) 0 var(--spacing-md);
}
.admin-panel-search .mud-input-control { margin: 0; }
.admin-panel-search .mud-input-outlined-border { border-color: var(--mud-palette-text-secondary) !important; }
.admin-panel-search .mud-input-label,
.admin-panel-search .mud-input-adornment-start { color: var(--mud-palette-text-secondary) !important; }
.admin-panel-search input::placeholder { color: var(--mud-palette-text-secondary) !important; }

/* Admin User Popup */
.admin-popup-row {
    display: flex;
    gap: 12px;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--mud-palette-divider);
}
.admin-popup-row:last-child {
    border-bottom: none;
}
.admin-popup-label {
    color: var(--mud-palette-text-secondary);
    font-size: 0.8125rem;
    min-width: 88px;
    flex-shrink: 0;
}
.admin-popup-value {
    color: var(--mud-palette-text-primary);
    font-size: 0.8125rem;
}
.admin-popup-oid {
    font-family: monospace;
    font-size: 0.75rem;
}

/* Admin Card */

/* Dashboard */
.dashboard-wrapper {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    box-sizing: border-box;
}


@media (min-width: 961px) {
    .desktop-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) var(--spacing-md);
        background-color: var(--header-bg);
        flex-shrink: 0;
        box-shadow: var(--tile-shadow);
        margin: var(--spacing-md) var(--spacing-md) 0;
        border-radius: 10px;
    }
}

.home-page {
    flex: 1;
    min-height: 0;
    overflow: auto;
    scrollbar-width: none;
    /* Expand flush to the dashboard-wrapper boundary so shadows aren't clipped */
    margin: 0 calc(-1 * var(--spacing-md));
    padding: 0 var(--spacing-md);
}
.home-page::-webkit-scrollbar {
    display: none;
}

.dashboard-title {
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--text-heading);
}

.dashboard-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--tile-min-height);
    padding: var(--spacing-md);
    cursor: pointer;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    box-shadow: var(--tile-shadow);
    transition: box-shadow 0.2s ease;
}

.dashboard-tile-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    border-radius: 13px;
    background-color: var(--mud-palette-error);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 26px;
    box-sizing: border-box;
    pointer-events: none;
}

.dashboard-tile:hover {
    box-shadow: var(--tile-hover-shadow);
}

.dashboard-tile-item {
    display: flex;
}

.dashboard-tile-icon {
    font-size: var(--icon-placeholder-size) !important;
    color: var(--color-emerald) !important;
    margin-bottom: var(--spacing-md);
}

/* Responsive */
@media (max-width: 960px) {
    .tsadmin-find-filter-controls {
        flex: 1;
        width: 100%;
    }

    .tsadmin-find-filter-controls .sch-week-desktop {
        width: 100%;
    }

    .app-nav {
        display: none;
    }

    .mobile-topbar {
        display: flex;
    }

    .mobile-bottomnav {
        display: flex;
    }

}

@media (min-width: 961px) {
    :root {
        --tile-min-height: 144px;
    }
}

/* Page Transition */
.page-transition {
    animation: pageEnter 0.15s ease-out;
    transform-origin: center center;
}

@keyframes pageEnter {
    from {
        opacity: 0.5;
        transform: scale(0.97);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* User Menu */
.user-menu-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 12px 16px 10px;
}

.user-menu-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-menu-email {
    opacity: 0.6;
    display: block;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Mobile User Menu Modal */
.user-menu-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.user-menu-mobile-overlay.open {
    background: rgba(0, 0, 0, 0.55);
    opacity: 1;
    pointer-events: all;
}

.user-menu-mobile-card {
    min-width: 280px;
    border-radius: 10px !important;
    overflow: hidden;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.user-menu-mobile-overlay.open .user-menu-mobile-card {
    transform: scale(1);
    opacity: 1;
}

.user-menu-action {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 12px var(--spacing-md);
    cursor: pointer;
    transition: background 0.15s;
}

.user-menu-action:hover {
    background-color: var(--color-ironstone-10);
}

/* Login Page */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background-color: var(--color-ironstone);
    font-family: var(--font-family);
    padding-top: calc(50vh - 90px);
    box-sizing: border-box;
    gap: 24px;
}

.login-logo {
    width: 240px;
    height: auto;
}

.login-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 28px 32px;
    background: var(--color-ironstone-80);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    min-width: 280px;
    text-align: center;
}

.login-box-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.login-title {
    margin: 0;
    color: var(--color-ironstone-10);
    font-size: 1.25rem;
    font-weight: 700;
}

.login-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

.login-box .login-subtitle {
    color: var(--color-ironstone-40);
}

.btn-microsoft {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--color-white);
    color: var(--color-ironstone-80);
    border: 1px solid var(--color-ironstone-20);
    border-radius: 2px;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.15s, background 0.15s;
    white-space: nowrap;
}

.btn-microsoft:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    background: var(--color-ironstone-10);
}

.btn-microsoft:active {
    box-shadow: none;
    background: var(--color-ironstone-20);
}

/* Blazor Error UI */
#blazor-error-ui {
    color-scheme: light;
    background: var(--color-ironstone);
    color: var(--color-white);
    border: var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    display: none;
    left: 50%;
    bottom: 1rem;
    width: min(52rem, calc(100vw - 2rem));
    transform: translateX(-50%);
    padding: 0.85rem 4rem 0.85rem 1rem;
    position: fixed;
    z-index: 2000;
}

.blazor-error-boundary {
    padding: 1rem 1rem 1rem 3.7rem;
    color: var(--color-white);
    background: var(--color-design);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* App loading screen */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background: var(--color-ironstone);
    gap: 24px;
    padding-top: calc(50vh - 90px);
    box-sizing: border-box;
}

.app-loading-logo {
    width: 240px;
    height: auto;
}

.app-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(3, 186, 189, 0.2);
    border-top-color: var(--color-emerald);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.app-spinner-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.app-loading-message {
    margin-top: 8px;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    line-height: 1.6;
    opacity: 0;
    animation: fadeInMessage 0.6s ease forwards 4s,
               breathe 3s ease-in-out infinite 2.6s;
}

@keyframes fadeInMessage {
    to { opacity: 1; }
}

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

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


/* --- Timesheet Status Banner ---------------------------------------- */
.tsd-status-banner {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-radius: 4px;
    border: 1px solid var(--color-ironstone-20);
    background-color: var(--mud-palette-surface);
    flex-shrink: 0;
}

.tsd-status-banner-label,
.tsd-status-banner-date {
    margin: 0;
}

.tsd-status-banner-label {
    font-weight: 700;
    color: var(--text-heading);
}

.tsd-status-banner-date {
    color: var(--color-ironstone-60);
    font-size: 0.82rem;
}

/* --- Timesheet Detail ----------------------------------------------- */
.tsd-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: var(--spacing-md);
}

.tsd-add-section {
    flex-shrink: 0;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    --mud-palette-primary: #03babd;
    --mud-palette-primary-text: #ffffff;
    --mud-palette-primary-darken: #029ea0;
    --mud-palette-primary-lighten: #04d6da;
    --mud-palette-primary-hover: rgba(3, 186, 189, 0.08);
}

.app-desktop-only { display: none; }
.app-mobile-only  { display: block; }

.tsd-col-divider { display: none; }

.tsd-left-col {
    display: contents;
}

.tsd-add-section      { order: 1; }
.tsd-status-banner-wrap { order: 1; }
.tsd-right-col        { order: 2; }
.tsd-summary-wrap     { order: 3; }

.tsd-right-col {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: var(--spacing-md);
}

@media (min-width: 961px) {
    .app-desktop-only { display: block; }
    .app-mobile-only  { display: none; }

    .tsd-page {
        flex-direction: row;
    }

    .tsd-left-col {
        display: flex;
        flex-direction: column;
        width: 50%;
        flex-shrink: 0;
        min-height: 0;
        overflow: hidden;
    }

    .tsd-add-section        { order: 0; }
    .tsd-status-banner-wrap { order: 0; }
    .tsd-summary-wrap       { order: 0; margin-top: auto; flex-shrink: 0; }
    .tsd-right-col          { order: 0; }

    .tsd-add-actions {
        position: sticky;
        bottom: 0;
        background-color: var(--mud-palette-surface);
    }

    .tsd-col-divider {
        display: block;
        width: 1px;
        background-color: var(--border-color);
        align-self: stretch;
        flex-shrink: 0;
    }
}

.tsd-add-selects .mud-focused .mud-input-outlined-border {
    border-color: var(--color-emerald) !important;
}

.tsd-add-selects .mud-focused .mud-input-label {
    color: var(--color-emerald) !important;
}

.tsd-add-selects {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-sm);
}

.tsd-add-selects > * { flex: 1; min-width: 0; }

.tsd-day-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr);
}

.tsd-day-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tsd-day-input .mud-input-adornment-end {
    display: none;
}

.tsd-day-input .mud-input-slot {
    padding-right: 0 !important;
}

.tsd-day-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--color-ironstone-60);
    text-transform: uppercase;
}

.tsd-day-input {
    width: 100%;
    cursor: pointer;
}

.tsd-day-input .mud-input-control-input-slot,
.tsd-day-input .mud-input,
.tsd-day-input .mud-input-outlined {
    background: transparent !important;
}

.tsd-day-input .mud-input input {
    text-align: center;
}

.tsd-day-input--active .mud-input-outlined-border {
    border-color: var(--color-ironstone-40) !important;
}

.tsd-day-input--active .mud-input-control-input-slot,
.tsd-day-input--active .mud-input,
.tsd-day-input--active .mud-input-outlined {
    background: rgba(172, 175, 173, 0.1) !important;
    border-radius: 4px;
}

.tsd-day-grid .mud-disabled {
    opacity: 0.35 !important;
}

.tsd-day-popover {
    min-width: 60px !important;
}

.tsd-select--filled .mud-input-outlined-border {
    border-color: var(--color-ironstone-40) !important;
}

.tsd-select--filled .mud-input-control-input-slot,
.tsd-select--filled .mud-input,
.tsd-select--filled .mud-input-outlined {
    background: rgba(172, 175, 173, 0.1) !important;
    border-radius: 4px;
}

.tsd-select--filled .mud-input-label {
    color: var(--color-ironstone-60) !important;
}

.tsd-select--filled .mud-input-text,
.tsd-select--filled .mud-select-input,
.tsd-select--filled input {
    color: var(--mud-palette-text-primary) !important;
}

.tsd-add-selects .mud-disabled {
    opacity: 0.35 !important;
}

.tsd-add-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--spacing-xs);
}

.tsd-draft-total {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-heading);
}

.tsd-entries-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-ironstone-60) transparent;
}

.tsd-entries-section::-webkit-scrollbar { width: 6px; pointer-events: none; }
.tsd-entries-section::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.tsd-entries-section::-webkit-scrollbar-track { background: transparent; pointer-events: none; }
.tsd-entries-section::-webkit-scrollbar-thumb { background-color: var(--color-ironstone-60); border-radius: 3px; pointer-events: none; }
.tsd-entries-section::-webkit-scrollbar-button:start:decrement,
.tsd-entries-section::-webkit-scrollbar-button:end:increment { display: none; height: 0; }

.tsd-entries-list {
    flex: 1;
}

.tsd-empty {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--mud-palette-text-disabled);
    font-style: italic;
    margin: 0;
}

.tsd-entry-group {
    border: 1px solid var(--color-ironstone-80);
    border-radius: 8px;
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
}

.tsd-entry-group-header {
    padding: var(--spacing-xs) var(--spacing-md);
    border-bottom: var(--border);
    background: var(--mud-palette-primary-darken);
}

.tsd-entry-task-row {
    align-items: stretch !important;
}

.tsd-entry-task-row + .tsd-entry-task-row {
    border-top: 1px solid var(--color-ironstone-80);
}

.tsd-entry-task-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.tsd-entry-hours {
    display: flex;
    padding: 4px 0;
    border-top: var(--border);
}

@media (max-width: 960px) {
    .tsd-entry-hours > * { border-left: none !important; }
}

.tsd-entry-project {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: 0.03em;
}

.tsd-entry-task {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-heading);
}

button.tsd-entry-delete {
    flex-shrink: 0;
    align-self: stretch;
    width: 40px;
    height: auto !important;
    min-width: unset !important;
    border-left: var(--border);
    border-radius: 0 !important;
    opacity: 0.55;
    display: flex;
    align-items: center;
    justify-content: center;
}

button.tsd-entry-delete:hover { opacity: 1; }

.tsd-entry-task-content--editable:hover {
    background-color: rgba(150, 150, 150, 0.08);
    transition: background-color 0.15s ease;
}

/* Timesheet Overview */
.ts-color-overdue   { color: var(--color-design) !important; }
.ts-color-due       { color: #e8914a !important; }
.ts-color-submitted { color: #e8914a !important; }
.ts-color-approved  { color: var(--color-emerald) !important; }

.ts-overview {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: var(--spacing-md);
}

/* Desktop Stat Cards */
.ts-stat-cards {
    display: flex;
    gap: var(--spacing-md);
    flex-shrink: 0;
    padding: var(--spacing-md) 0 0;
}



/* Mobile Summary Bar */
.ts-mobile-summary {
    display: none !important;
    flex-shrink: 0;
    padding: var(--spacing-md) 0 0;
}

.ts-mobile-summary .sch-stat-bubble,
.ts-stat-cards .sch-stat-bubble {
    flex: 1;
    min-width: 0;
    border-color: var(--color-ironstone-80) !important;
}

@media (min-width: 961px) {
    .ts-stat-cards {
        align-self: flex-start;
    }

    .ts-stat-cards .sch-stat-bubble {
        flex: 0 0 220px;
    }
}


/* Week List */
.ts-list {
    flex: 1;
    overflow: auto;
    scrollbar-width: none;
}

.ts-list::-webkit-scrollbar {
    display: none;
}

.ts-section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 12.5px var(--spacing-md) 7.5px;
    position: sticky;
    top: 0;
    background: var(--mud-palette-background);
    z-index: 1;
}

.ts-list .ts-section-header {
    padding-left: 0;
    padding-right: 0;
}

.ts-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-ironstone-60);
}

.ts-section-count {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--color-ironstone-20);
    color: var(--color-ironstone-60);
}

[data-theme="dark"] .ts-section-count {
    background: var(--color-ironstone-dark3);
}

.ts-week-row {
    display: flex;
    align-items: center;
    padding: 13px var(--spacing-md);
    margin: 0;
    cursor: pointer;
    text-decoration: none;
    gap: var(--spacing-md);
    transition: background 0.12s;
}

.ts-week-row:hover {
    background: rgba(0, 0, 0, 0.035);
}

[data-theme="dark"] .ts-week-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.ts-admin-row {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.ts-admin-row-summary {
    display: flex;
    align-items: stretch;
    padding: 0 215px 0 var(--spacing-md);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 56px;
}

.tsar-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-end;
    background: inherit;
}

.ts-admin-row-summary--expanded {
    border-bottom: var(--border);
}

.tsar-col {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    align-self: center;
}

.tsar-col--name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.tsar-list-header {
    display: none;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

@media (min-width: 961px) {
    .tsar-list-header {
        display: grid;
        grid-template-columns: 160px 150px 100px 110px 90px 100px 120px 1fr;
        gap: var(--spacing-md);
        padding: 0 215px 4px var(--spacing-md);
    }
}

.tsar-col--approved { display: none; }

.tsar-col--status { margin-left: -8px; }

.tsar-mobile-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    padding: 13px 0;
}

@media (min-width: 961px) {
    .ts-admin-row-summary {
        display: grid;
        grid-template-columns: 160px 150px 100px 110px 90px 100px 120px 1fr;
        gap: var(--spacing-md);
        align-items: stretch;
        min-height: 60px;
    }

    .tsar-col--approved { display: block; }

    .tsar-mobile-info {
        display: none;
    }

    .tsar-col {
        align-self: center;
    }

    .tsar-actions {
        width: 215px;
    }

}

.ts-admin-row-detail {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding: 0 var(--spacing-md);
    transition: max-height 0.25s ease-out, opacity 0.2s ease-out, padding 0.25s ease-out;
}

.ts-admin-row-detail--expanded {
    max-height: 1200px;
    opacity: 1;
    padding: calc(var(--spacing-sm) * 1.5) var(--spacing-md) var(--spacing-md);
}

.ts-admin-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

@media (min-width: 961px) {
    .ts-admin-grid {
        width: auto;
    }

}

.ts-admin-grid-day {
    width: 36px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    padding: 0 2px 3px;
    border-bottom: var(--border);
}


.ts-admin-project-cell {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    padding: 10px 40px 4px 0;
    text-align: left;
    border-bottom: var(--border);
}

.ts-admin-grid tbody tr:first-child .ts-admin-project-cell {
    padding-top: 3px;
}

.ts-admin-grid-task-cell {
    text-align: left;
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
    padding: 3px 24px 3px 0;
    word-break: break-word;
}

@media (min-width: 961px) {
    .ts-admin-project-cell {
        width: 220px;
        max-width: 220px;
        padding-right: 70px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ts-admin-grid-task-cell {
        width: 220px;
        max-width: 220px;
        padding-right: 70px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: normal;
    }
}

.ts-admin-grid-cell {
    text-align: center;
    color: var(--mud-palette-text-secondary);
    font-size: 0.78rem;
    padding: 3px 2px;
}

.ts-admin-grid-cell--filled {
    color: var(--mud-palette-text-primary);
}

.ts-week-row--overdue { background: rgba(189, 59, 69, 0.07); }
.ts-week-row--due     { background: rgba(232, 145, 74, 0.07); }

.ts-myrow-mobile {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--spacing-md);
}

.ts-myrow-desktop { display: none; }

.ts-myrow-list-header { display: none; }

@media (min-width: 961px) {
    .ts-week-row--my {
        display: block;
        padding: 0;
    }

    .ts-myrow-mobile { display: none; }

    .ts-myrow-desktop {
        display: grid;
        grid-template-columns: 160px 100px 130px 80px 1fr 44px;
        gap: var(--spacing-md);
        align-items: center;
        min-height: 60px;
        padding: 0 var(--spacing-md);
    }

    .ts-myrow-list-header {
        display: grid;
        grid-template-columns: 160px 100px 130px 80px 1fr 44px;
        gap: var(--spacing-md);
        padding: 0 var(--spacing-md) 4px;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--mud-palette-text-secondary);
    }
}

.ts-week-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ts-week-date {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-heading);
}

.ts-status-badge {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-indent: 0.04em;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 3px;
}

.ts-badge--overdue,
.ts-badge--due,
.ts-badge--submitted,
.ts-badge--approved  { background: transparent; color: var(--color-ironstone-60); }

.ts-week-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ts-week-hours {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-ironstone-60);
    min-width: 36px;
    text-align: right;
    align-self: center;
}

.ts-chevron {
    color: var(--color-ironstone-40) !important;
}

/* Responsive */
@media (max-width: 960px) {
    .ts-stat-cards     { display: none !important; }
    .ts-mobile-summary { display: flex !important; }

    .ts-overview {
        gap: 0;
    }

    .ts-list {
        padding-bottom: var(--mobile-bottomnav-height);
    }
}

/* Projects Page */
.projects-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.proj-status {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
}

.proj-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px var(--spacing-md);
    gap: var(--spacing-sm);
}

.proj-status-badge {
    align-self: center;
    margin-top: 0 !important;
    flex-shrink: 0;
}


/* Responsive view switching */
.proj-row-header   { display: none;  }

/* Project row base styles (mobile) */
.proj-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.proj-row-code {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.proj-row-name {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.proj-row-end {
    display: flex;
    align-items: center;
    gap: 8px;
}

.proj-row-edit-wrap {
    display: none;
}

.proj-row-meta {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 961px) {

    /* Project row: Code | Name | Partner | Hours | Duration | Status (controls are absolute) */
    .proj-week-row,
    .proj-row-header {
        grid-template-columns: minmax(0,1fr) minmax(0,1.5fr) minmax(0,1fr) minmax(0,0.6fr) minmax(0,0.6fr) 110px;
        gap: var(--spacing-md);
    }

    .proj-week-row {
        display: grid;
        align-items: center;
        min-height: 60px;
        position: relative;
        overflow: hidden;
        padding-right: 90px;
    }

    .proj-row-header {
        display: grid;
        align-items: center;
        padding: 4px 90px 4px var(--spacing-md);
    }

    .proj-row-header span {
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--mud-palette-text-secondary);
        white-space: nowrap;
    }

    /* Unwrap the info div so code+name become individual grid columns */
    .proj-row-info {
        display: contents;
    }

    .proj-week-row .ts-status-badge {
        align-self: center;
        justify-self: start;
        margin-top: 0;
    }

    /* Controls: absolutely positioned so they fill the full card height */
    .proj-row-end {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 90px;
        display: flex;
        flex-direction: row;
        align-items: stretch;
        justify-content: flex-end;
        background-color: var(--mud-palette-surface);
    }

    .proj-week-row:hover .proj-row-end {
        background-color: var(--mud-palette-primary-lighten);
    }

    .proj-row-edit-wrap {
        display: contents;
    }
}

/* Gantt Chart */
.proj-gantt-outer {
    display: flex;
    align-items: stretch;
    overflow-y: auto;
    border: var(--border);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
    margin: 0 0 var(--spacing-md);
    max-height: calc(100vh - 220px);
}

.proj-gantt-info-panel {
    flex-shrink: 0;
    background-color: var(--mud-palette-surface);
    border-right: 2px solid var(--mud-palette-divider);
    box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}

/* overflow-y: clip lets sticky headers reference the outer scroll container
   while only allowing horizontal scroll here */
.proj-gantt-timeline-scroll {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: clip;
}

.proj-gantt-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: max-content;
}

/* All header cells - border-box so height is total rendered height */
.proj-gantt-th {
    position: sticky;
    z-index: 10;
    background-color: var(--mud-palette-surface);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    padding: 0 10px;
    height: 26px;
    box-sizing: border-box;
    border-bottom: var(--border);
    white-space: nowrap;
    text-align: left;
    vertical-align: middle;
}

/* hrow2 override - 22px total height */
.proj-gantt-hrow2 th { height: 22px; }

.proj-gantt-col-name  { width: 200px; min-width: 200px; }
.proj-gantt-col-dates { width: 172px; min-width: 172px; }
.proj-gantt-col-dur   { width: 64px;  min-width: 64px;  text-align: center; }
.proj-gantt-col-users { width: 52px;  min-width: 52px;  text-align: center; }
.proj-gantt-col-hours { width: 60px;  min-width: 60px;  text-align: center; }

/* Month group header */
.proj-gantt-month-hdr {
    text-align: left;
    border-right: var(--border);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    padding: 0 8px;
}

/* Period column header - width set inline per period */
.proj-gantt-week-hdr {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 400;
    padding: 0 6px;
    color: var(--mud-palette-text-secondary);
    border-right: var(--border);
}

.proj-gantt-today-col {
    color: var(--color-emerald) !important;
    font-weight: 700 !important;
}

.proj-gantt-today-col-bg {
    background-color: rgba(0, 229, 187, 0.04);
}

/* Data cells - border-box so height is total rendered height, matches timeline */
.proj-gantt-td {
    background-color: var(--mud-palette-surface);
    padding: 0 10px;
    height: 48px;
    box-sizing: border-box;
    border-bottom: var(--border);
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.82rem;
}

/* Task status row backgrounds - info side only */
.gantt-row-in-progress .proj-gantt-td { background-color: rgba(234,179,8,0.18); }
.gantt-row-completed   .proj-gantt-td { background-color: rgba(34,197,94,0.22); }
/* Task bar colours per status */
.gantt-row-in-progress .proj-gantt-bar { background-color: #eab308; box-shadow: 0 1px 4px rgba(234,179,8,0.45); }
.gantt-row-completed   .proj-gantt-bar { background-color: #22c55e; box-shadow: 0 1px 4px rgba(34,197,94,0.45); }

/* Yellow bars need dark label text for contrast */
.gantt-row-in-progress .proj-gantt-bar-label { color: #422006; }

.proj-gantt-row:hover .proj-gantt-td,
.proj-gantt-row:hover .proj-gantt-timeline-cell {
    background-color: var(--mud-palette-primary-lighten) !important;
}

.proj-gantt-name-text {
    display: block;
    font-weight: 600;
    font-size: 0.83rem;
    color: var(--mud-palette-text-primary);
    line-height: 1.2;
}

.proj-gantt-code-text {
    display: block;
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.2;
}

.proj-gantt-date-chip {
    display: inline-block;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    line-height: 1.4;
}

/* Timeline cell - individual per column, real borders */
.proj-gantt-timeline-cell {
    padding: 0;
    height: 48px;
    box-sizing: border-box;
    border-right: var(--border);
    border-bottom: var(--border);
}

/* First cell is the bar/today-line anchor */
.proj-gantt-timeline-cell.gantt-bar-anchor {
    position: relative;
    z-index: 1;
    overflow: visible;
}

/* Drop right border on the last column */
.proj-gantt-timeline-scroll th:last-child,
.proj-gantt-timeline-scroll td:last-child {
    border-right: none;
}

/* Task bar */
.proj-gantt-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    background-color: var(--color-emerald);
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    min-width: 8px;
}

.proj-gantt-bar-label {
    font-size: 0.68rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

/* Today vertical line */
.proj-gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-emerald);
    opacity: 0.4;
    pointer-events: none;
}

/* Module header rows */
.proj-gantt-module-hdr {
    height: 32px;
    padding: 0 10px;
    box-sizing: border-box;
    background-color: var(--mud-palette-background);
    border-bottom: var(--border);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    vertical-align: middle;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.proj-gantt-module-sep {
    margin: 0 6px;
    color: var(--mud-palette-text-disabled);
}

.proj-gantt-module-timeline-cell {
    height: 32px;
    box-sizing: border-box;
    background-color: var(--mud-palette-background);
    border-bottom: var(--border);
    padding: 0;
    position: relative;
}

/* Module due date marker - solid vertical line at DueOn position */
.proj-gantt-due-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-1px);
    pointer-events: none;
    background: var(--mud-palette-warning);
    z-index: 3;
}

/* Dark mode adjustments */
[data-theme="dark"] .proj-gantt-bar {
    box-shadow: 0 1px 3px rgba(0,0,0,0.45);
}

