:root {
    /* Material Design 3 Generated Theme */
    /* Source Color: #2C638B */

    /* Primary */
    --md-sys-color-primary: #2C638B;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #CDE5FF;
    --md-sys-color-on-primary-container: #001D32;

    /* Secondary (Generated) */
    --md-sys-color-secondary: #51606F;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #D5E4F7;
    --md-sys-color-on-secondary-container: #0E1D2A;

    /* Tertiary (Generated) */
    --md-sys-color-tertiary: #68587A;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #EFDBFF;
    --md-sys-color-on-tertiary-container: #231533;

    /* Surface */
    --md-sys-color-surface: #F8FDFF;
    --md-sys-color-on-surface: #1A1C1E;
    --md-sys-color-surface-variant: #DEE3EB;
    --md-sys-color-on-surface-variant: #42474E;
    --md-sys-color-surface-dim: #DED8E1;
    --md-sys-color-outline-variant: #CAC4D0;

    /* Error */
    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #F9DEDC;
    --md-sys-color-on-error-container: #410E0B;

    /* Normalize MDC Theme Variables to Project System Colors */
    --mdc-theme-primary: var(--md-sys-color-primary);
    --mdc-theme-on-primary: var(--md-sys-color-on-primary);
    --mdc-theme-secondary: var(--md-sys-color-secondary);
    --mdc-theme-on-secondary: var(--md-sys-color-on-secondary);
    --mdc-theme-surface: var(--md-sys-color-surface);
    --mdc-theme-on-surface: var(--md-sys-color-on-surface);
}

/* Material Symbols Outlined */
.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    font-family: Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Set background to secondary-container for the 'frame' */
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

/* Enforce constant height for the top app bar */
.app-bar {
    position: fixed;
    z-index: 10;
    /* Reset to Surface Color */
    background-color: var(--md-sys-color-surface) !important;
    color: var(--md-sys-color-on-surface) !important;
}

/* Override MDC responsive height */
.mdc-top-app-bar__row {
    height: 64px !important;
}

.mdc-top-app-bar__section {
    padding-left: 16px;
}

/* Material Design Typography - Title Large for App Bar */
.mdc-top-app-bar__title {
    font-size: 22px;
    line-height: 28px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--md-sys-color-on-surface);
}

.mdc-top-app-bar__navigation-icon {
    color: var(--md-sys-color-on-surface) !important;
}

.app-content {
    display: flex;
    flex: 1;
    margin-top: 64px;
    overflow: hidden;
    /* Card background overrides removed to show charts on white */

    /* Badge Styles */
    .mdc-badge {
        background-color: transparent;
        color: var(--md-sys-color-on-surface-variant);
        border-radius: 0;
        padding: 0 6px;
        font-size: 12px;
        line-height: 20px;
        height: 20px;
        min-width: 20px;
        text-align: center;
        font-weight: 500;
        margin-left: auto;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mdc-list-item__meta.mdc-badge {
        margin-left: auto;
        margin-right: 0;
    }

    /* Truncate Title Column */
    .col-title {
        max-width: 400px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    @media (min-width: 1400px) {
        .col-title {
            max-width: 600px;
        }
    }

    /* Site Column Width - Automatic/Average "2 parts" width */
    .col-site {
        max-width: 15ch;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    @media (min-width: 1400px) {
        .col-site {
            max-width: 26ch;
        }
    }

    background-color: var(--md-sys-color-surface);
    position: relative;
}

.mdc-drawer {
    height: 100%;
    /* Remove the border of the navigation drawer Set to 0px*/
    border-right: 0px solid var(--md-sys-color-surface-variant);
    width: 360px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Reset to Surface Color */
    background-color: var(--md-sys-color-surface);
}

/* Responsive Table: Hide columns based on browser width to correctly trigger when space becomes constrained */
@container main (max-width: 1096px) {

    .mdc-data-table__header-row th:nth-child(4),
    .mdc-data-table__header-row th:nth-child(5),
    .mdc-data-table__content tr td:nth-child(4),
    .mdc-data-table__content tr td:nth-child(5) {
        display: none !important;
    }
}

/* Mobile Table Styling: Show only Title (3) and Date (6) when Navigation Rail disappears (720px) */
@media (max-width: 720px) {

    /* Hide Checkbox (1), ID (2), Type (4), Status (5), Site (7), Name (8) */
    .mdc-data-table__header-row th:nth-child(1),
    .mdc-data-table__content tr td:nth-child(1),
    .mdc-data-table__header-row th:nth-child(2),
    .mdc-data-table__content tr td:nth-child(2),
    .mdc-data-table__header-row th:nth-child(4),
    .mdc-data-table__content tr td:nth-child(4),
    .mdc-data-table__header-row th:nth-child(5),
    .mdc-data-table__content tr td:nth-child(5),
    .mdc-data-table__header-row th:nth-child(7),
    .mdc-data-table__content tr td:nth-child(7),
    .mdc-data-table__header-row th:nth-child(8),
    .mdc-data-table__content tr td:nth-child(8) {
        display: none;
    }

    /* Dynamic layout for mobile to distribute space between Title and Date */
    .mdc-data-table__table {
        table-layout: fixed !important;
        width: 100% !important;
    }

    /* Title Column: Take remaining space */
    .mdc-data-table__header-row th:nth-child(3),
    .mdc-data-table__content tr td:nth-child(3),
    .col-title {
        width: 100% !important;
        max-width: none !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Date Column: Keep fixed reasonable width */
    .mdc-data-table__header-row th:nth-child(6),
    .mdc-data-table__content tr td:nth-child(6) {
        width: 90px !important;
        white-space: nowrap !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        overflow: visible !important;
    }
}

.mdc-drawer__content {
    /* Reset to Surface Color */
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent body scroll */
}

.main-content {
    flex: 1;
    overflow: hidden;
    /* Adjust height: 100% - bottom margin (16px) */
    height: calc(100% - 16px);
    padding: 16px;
    background-color: var(--md-sys-color-on-primary);

    /* Requested changes */
    border-radius: 16px;


    /* Margins: Top 0, Right 0, Bottom 16px, Left 0 */
    margin: 0 16px 16px 0;
    max-width: 1400px;
    box-sizing: border-box;
    container-type: inline-size;
    container-name: main;
    position: relative;
    /* Restore smooth transition for max-width */
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mdc-card--outlined {
    background-color: var(--md-sys-color-on-primary);
}

.mdc-drawer--rail+.main-content {
    max-width: 1680px;
}

/* Data Table with Primary Colors */
.mdc-data-table {
    width: 100%;
    border: none;
    background-color: var(--md-sys-color-on-primary);
}

.mdc-data-table__header-row {
    background-color: var(--md-sys-color-on-primary);
}

@media (hover: hover) {
    .mdc-data-table__row:hover {
        background-color: var(--md-sys-color-surface-variant);
    }
}

/* Ensure selected rows have a visible background color */
/* Also apply color directly if checkbox is checked (robust fallback) */
.mdc-data-table__row--selected,
.mdc-data-table__row:has(.mdc-checkbox__native-control:checked) {
    background-color: var(--md-sys-color-surface-variant) !important;
}

/* Material Design Typography - Headline Small for Page Title */
.selected-item-title {
    font-size: 24px;
    line-height: 32px;
    font-weight: 400;
    letter-spacing: 0;
    margin: 0 0 24px 0;
    color: var(--md-sys-color-primary);
}

/* Material Design Typography - Label Large for List Items */
.mdc-list-item {
    height: 56px;
    display: flex;
    align-items: center;
    border-radius: 28px;
    margin: 0 12px;
    color: var(--md-sys-color-on-surface);
    /* Set Ripple Color */
    --mdc-ripple-color: var(--md-sys-color-on-surface);
    overflow: hidden;
    /* Ensure content doesn't spill during transition */
    box-sizing: border-box;
    transition: background-color 0.2s, padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mdc-list-item--activated {
    background-color: var(--md-sys-color-primary-container) !important;
    color: var(--md-sys-color-on-primary-container) !important;
    /* Set Ripple Color for Activated */
    --mdc-ripple-color: var(--md-sys-color-on-primary-container);
}

.mdc-list-item--activated .mdc-list-item__text,
.mdc-list-item--activated .mdc-list-item__graphic,
.mdc-list-item--activated .expand-icon {
    color: var(--md-sys-color-on-primary-container) !important;
}

.mdc-list-item__text {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0.1px;
    color: var(--md-sys-color-on-surface);
    /* Transition for smooth rail toggle */
    transition: opacity 0.2s linear, max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    opacity: 1;
    max-width: 200px;
    /* Arbitrary large width */
    overflow: hidden;
}

.mdc-list-item__graphic {
    margin-right: 12px;
    color: var(--md-sys-color-on-surface);
    transition: margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.expand-icon {
    margin-left: auto;
    margin-right: 8px;
    transition: transform 0.2s ease-in-out, opacity 0.15s linear, max-width 0.2s;
    color: var(--md-sys-color-on-surface);
    opacity: 1;
    max-width: 24px;
    white-space: nowrap;
    overflow: hidden;
}

/* Sub-list styling with Tertiary Colors */
.mdc-sub-list {
    display: none;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.mdc-sub-list--expanded {
    display: block;
}

.mdc-drawer .mdc-sub-list .mdc-list-item--activated {
    /* Inherit Primary colors from .mdc-list-item--activated */
    margin-left: 28px !important;
}

.mdc-list-item--parent-active {
    /* Simulate Focus Ripple */
    background-color: var(--md-sys-color-surface-variant);
}

.mdc-drawer .mdc-sub-list .mdc-list-item {
    padding-left: 48px !important;
    margin-left: 28px !important;
    padding-top: 0;
    padding-bottom: 0;
    height: 56px;
    /* Set Ripple Color for Sub-list Items */
    --mdc-ripple-color: var(--md-sys-color-on-surface);
}

.mdc-drawer--modal .mdc-sub-list .mdc-list-item {
    padding-left: 48px;
    margin-left: 28px;
}

/* Modal Drawer Specifics for Animation */
.mdc-drawer--modal {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 10.0s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    display: flex;
}

.mdc-drawer--modal.mdc-drawer--open {
    transform: translateX(0);
    display: flex !important;
}

/* Scrim for Modal Drawer - ensure it acts as overlay below top app bar */
.mdc-drawer-scrim {
    display: none;
    position: fixed;
    top: 64px !important;
    /* Force below top app bar */
    left: 0;
    width: 100%;
    height: calc(100% - 64px) !important;
    background-color: rgba(255, 255, 255, 0.5) !important;
    z-index: 20;
    /* Between content and drawer, but adjust if app bar needs to be higher */
}

/* Ensure App Bar is above Scrim if using a fixed header that might overlap */
.mdc-top-app-bar {
    z-index: 25 !important;
    /* Ensure generic app bar is above scrim */
}

.mdc-drawer--open+.mdc-drawer-scrim {
    display: block;
}

/* Hide Sub-items in Rail */
.mdc-drawer--rail .mdc-sub-list {
    display: none !important;
}

/* Hide Section Headers & Dividers in Rail */
.mdc-drawer--rail .mdc-list-group__subheader,
.mdc-drawer--rail .mdc-list-divider {
    display: none;
}

/* Custom Divider Margin */
.mdc-list-divider {
    margin-left: 28px;
    margin-right: 28px;
    border-bottom-color: var(--md-sys-color-outline-variant);
}



/* Menu List Item Overrides */
.mdc-menu .mdc-list-item {
    border-radius: 0;
    margin: 0;
    /* Ensure ripple color is correct for menu items */
    --mdc-ripple-color: var(--md-sys-color-on-surface);
}

/* Material Design Typography - Title Medium for Table Headers */
.mdc-data-table__header-cell {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0.1px;
    color: var(--md-sys-color-on-primary-container);
}

/* Material Design Typography - Body Medium for Table Cells */
.mdc-data-table__cell {
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    letter-spacing: 0.25px;
    color: var(--md-sys-color-on-surface);
}

/* Rail variant styles */
.mdc-drawer--rail {
    width: 80px;
}

.mdc-drawer--rail .mdc-list-item__text {
    opacity: 0;
    max-width: 0;
    margin: 0;
    transform: translateX(-20px);
    transition: opacity 0.2s, transform 0.2s;
}

.mdc-drawer--rail .mdc-list-item {
    /* justify-content: center;  <-- REMOVED to avoid jump */
    /* Use padding to center the icon: 
       Item width (available) = 80px - 24px (margins) = 56px.
       Icon width = 24px.
       Padding needed = (56 - 24) / 2 = 16px.
    */
    padding: 0 16px;
    margin: 0 12px;
}

.mdc-drawer--rail .mdc-list-item__graphic {
    margin-right: 0;
}

.mdc-drawer--rail .mdc-sub-list {
    max-height: 0 !important;
    opacity: 0;
    /* transition handled by .mdc-sub-list base class, 
       but we ensure it stays hidden/collapsed */
}

.mdc-drawer--rail .expand-icon {
    opacity: 0;
    max-width: 0;
    margin: 0;
    transform: translateX(-20px);
    transition: opacity 0.2s, transform 0.2s;
}

.mdc-drawer--rail .mdc-badge {
    opacity: 0;
    max-width: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
    transform: translateX(-20px);
    transition: opacity 0.2s, transform 0.2s, max-width 0.2s, margin 0.2s, padding 0.2s, min-width 0.2s;
}

.mdc-top-app-bar--fixed-adjust {
    padding-top: 0;
}

.mdc-data-table__header-cell {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--md-sys-color-on-primary);
}

.mdc-data-table__table-container {
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

/* M3 Filter Chips Overrides */
.mdc-chip-set {
    padding-left: 0;
    padding-right: 0;
    gap: 8px;
}

.mdc-chip-set .mdc-chip {
    height: 32px;
    border-radius: 8px;
    /* M3 Corner Radius */
    background-color: transparent;
    border: 1px solid var(--md-sys-color-on-surface-variant);
    margin: 4px 0;
    position: relative;
    overflow: hidden;
}

.mdc-chip-set .mdc-chip .mdc-chip__ripple,
.mdc-chip-set .mdc-chip::before,
.mdc-chip-set .mdc-chip::after {
    display: none !important;
}

.mdc-chip-set .mdc-chip,
.mdc-chip-set .mdc-chip:hover,
.mdc-chip-set .mdc-chip.mdc-chip--selected,
.mdc-chip-set .mdc-chip.mdc-chip--selected:hover {
    background-color: transparent !important;
    border: 1px solid var(--md-sys-color-on-surface-variant) !important;
    color: var(--md-sys-color-on-surface) !important;
    box-shadow: none !important;
}

.mdc-chip-set .mdc-chip .mdc-chip__text,
.mdc-chip-set .mdc-chip.mdc-chip--selected .mdc-chip__text,
.mdc-chip-set .mdc-chip .custom-chip-icon,
.mdc-chip-set .mdc-chip.mdc-chip--selected .custom-chip-icon,
.mdc-chip-set .mdc-chip .mdc-chip__icon--trailing {
    color: var(--md-sys-color-on-surface) !important;
    font-weight: 500;
}


.mdc-text-field--outlined {
    background-color: var(--md-sys-color-on-primary);
    max-width: 400px;
}

@container main (max-width: 1128px) {
    .hide-on-small {
        display: none;
    }
}



.mdc-data-table {
    width: 100%;
    border: none;
    background-color: var(--md-sys-color-on-primary);
}

.mdc-data-table__table {
    width: 100%;
    table-layout: auto;
}

.mdc-data-table__cell,
.mdc-data-table__header-cell {
    white-space: nowrap;
}

/* Explicit truncation for Title (col 3) and Site (col 7) */
.mdc-data-table__header-row th:nth-child(3),
.mdc-data-table__content tr td:nth-child(3) {
    width: 100%;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mdc-data-table__header-row th:nth-child(7),
.mdc-data-table__content tr td:nth-child(7) {
    width: 28ch;
    max-width: 28ch;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Checkbox (col 1) */
.mdc-data-table__header-row th:nth-child(1),
.mdc-data-table__content tr td:nth-child(1) {
    width: 1%;
    padding: 0 0 0 16px;
    overflow: visible;
}

/* ID, Type, Status, Date, Name shrink-fit to longest data */
.mdc-data-table__header-row th:nth-child(2),
.mdc-data-table__content tr td:nth-child(2),
.mdc-data-table__header-row th:nth-child(4),
.mdc-data-table__content tr td:nth-child(4),
.mdc-data-table__header-row th:nth-child(5),
.mdc-data-table__content tr td:nth-child(5),
.mdc-data-table__header-row th:nth-child(6),
.mdc-data-table__content tr td:nth-child(6),
.mdc-data-table__header-row th:nth-child(8),
.mdc-data-table__content tr td:nth-child(8) {
    width: 1%;
    overflow: visible;
}

/* Ensure no horizontal scroll */
.mdc-data-table__table-container {
    overflow-x: hidden;
}

/* Table Actions Toolbar Toggling */
#table-actions-container #filter-chips-container {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    /* Ensure scrollbar doesn't look too ugly or take up too much space if visible */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

/* Hide scrollbar for Chrome/Safari/Opera */
#table-actions-container #filter-chips-container::-webkit-scrollbar {
    display: none;
}

/* Prevent chips from shrinking */
#table-actions-container #filter-chips-container .mdc-chip {
    flex-shrink: 0;
}

#table-actions-container #selection-toolbar {
    display: none;
}

/* When items are selected, hide chips and show toolbar */
#table-actions-container.items-selected #filter-chips-container {
    display: none;
}


#table-actions-container.items-selected #selection-toolbar {
    display: flex;
}

/* Hover effect for toolbar icon buttons */
#selection-toolbar .mdc-icon-button:hover,
#view-toolbar .mdc-icon-button:hover {
    background-color: rgba(0, 0, 0, 0.04);
    border-radius: 50%;
}

/* Tabs Styling */
.mdc-tab-bar {
    background-color: var(--md-sys-color-on-primary);
}

.mdc-tab {
    color: var(--md-sys-color-on-surface-variant);
    --mdc-tab-text-label-color-default: var(--md-sys-color-on-surface-variant);
    --mdc-tab-indicator-active-indicator-color: var(--md-sys-color-primary);
    --mdc-ripple-color: var(--md-sys-color-primary);
    letter-spacing: normal;
}

.mdc-tab--active .mdc-tab__text-label {
    color: var(--md-sys-color-primary) !important;
}

.mdc-tab-indicator .mdc-tab-indicator__content--underline {
    border-color: var(--md-sys-color-primary) !important;
}

/* Standard Dialog Styles */
.mdc-dialog {
    z-index: 30 !important;
    /* Higher than top-app-bar (25) */
}

/* Fullscreen Dialog Styles */
.mdc-dialog--fullscreen {
    z-index: 50 !important;
    /* Higher than top-app-bar (25) */
    padding: 0 !important;
    /* Override potential default padding */
}

.mdc-dialog--fullscreen .mdc-dialog__container {
    width: 100% !important;
    height: 100% !important;
    opacity: 1;
    padding: 0 !important;
    box-sizing: border-box;
    overflow: hidden;
}

.mdc-dialog--fullscreen .mdc-dialog__surface {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    border-radius: 0;
    padding: 0;
    background-color: #000000;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.mdc-dialog--fullscreen .mdc-dialog__content {
    flex: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    overflow: auto;
    /* Enable scrolling */
    /* Prevent default image drag behavior and text selection */
    user-select: none;
    -webkit-user-drag: none;
    /* Hide scrollbars */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.mdc-dialog--fullscreen .mdc-dialog__content::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.mdc-dialog--fullscreen .mdc-dialog__content.enable-pan {
    cursor: grab;
}

.mdc-dialog--fullscreen .mdc-dialog__content.is-dragging {
    cursor: grabbing;
}

.mdc-dialog--fullscreen #dialog-image-preview {
    /* Use Layout-based sizing for scroll support */
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: auto;
    /* Center in container */
    object-fit: contain;
    /* Smooth zoom animation */
    transition: width 1s ease-out, height 1s ease-out;
}

/* Dialog Header */
.dialog-header {
    display: flex;
    align-items: center;
    padding: 8px 4px;
    background-color: rgba(0, 0, 0, 0.5);
    /* Semi-transparent over black */
    color: white;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2;
}

.dialog-header .mdc-icon-button {
    color: white;
}

.dialog-header-title {
    margin-left: 16px;
    font-size: 20px;
    font-weight: 500;
}

/* Right Pane (view.html specific) */
.right-pane {
    width: 0;
    background-color: var(--md-sys-color-on-primary);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.right-pane--open {
    width: 338px;
}

/* Apply gap to the parent main-content directly when pane is present */
.main-content:has(.right-pane) {
    gap: 0;
    transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--md-sys-color-surface);
}

.main-content:has(.right-pane)>.mdc-top-app-bar--fixed-adjust {
    background-color: var(--md-sys-color-on-primary);
}

.main-content:has(.right-pane--open) {
    gap: 16px;
}

.right-pane__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.right-pane__content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Loading Indicator Overlay */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
    /* High elevation to ensure visibility */
    background-color: var(--md-sys-color-surface);
    border-radius: 50%;
    padding: 8px !important;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
}


/* Ensure Circular Progress visibility and color */
.mdc-circular-progress {
    width: 32px;
    height: 32px;
    z-index: 1000;
    /* As requested, ensuring indicator is 'elevated' */
    --mdc-circular-progress-active-indicator-color: var(--md-sys-color-primary);
    --mdc-theme-primary: var(--md-sys-color-primary);
}

/* Dashboard Header Layout */
.dashboard-header-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}

.dashboard-header-container .selected-item-title {
    margin-bottom: 0;
}

#date-range-trigger-wrapper {
    align-self: flex-end;
}

/* Date Range Picker Button Customization */
.date-range-picker-btn {
    height: auto !important;
    /* Allow height to grow */
    padding: 8px 12px 8px 16px !important;
    /* Custom padding */
    border-radius: 8px !important;
    /* M3 small shape */
    text-transform: none !important;
    /* Disable uppercase */
    letter-spacing: normal !important;
}

.date-range-picker-btn .date-range-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    text-align: left;
}

.primary-date-range-key {
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.primary-date-range-key::after {
    content: ":";
    margin-right: 4px;
}

.primary-date-range-text {
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.date-range-picker-btn .dropdown-icon {
    margin-left: 0 !important;
    margin-right: 0 !important;
    color: var(--md-sys-color-on-surface-variant);
}

/* Ensure touch target wrapper doesn't collapse */
.mdc-touch-target-wrapper {
    display: inline-block;
}

/* Date Picker Card Positioning */
.dashboard-header-container {
    position: relative;
    /* Anchor for absolute positioning */
}

.datepicker-card {
    position: absolute !important;
    top: 90px !important;
    /* Below the button (32px title + 16px gap + ~40px button) */
    left: auto;
    right: 0 !important;
    z-index: 100;
    width: 480px;
    /* Wide enough for presets + calendar */
    max-width: 90vw;
    display: none;
    /* Hidden by default */
    background-color: var(--md-sys-color-on-primary);
    border-radius: 16px;
    overflow: hidden;
}

.datepicker-card.open {
    display: flex;
    flex-direction: column;
}

.datepicker-content {
    display: flex;
    flex: 1;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
}

/* Presets Sidebar */
.calendar-preset-menu-items {
    width: 160px;
    border-right: 1px solid var(--md-sys-color-surface-variant);
    padding: 8px 0;
    flex-shrink: 0;
}

.calendar-preset-menu-items .mdc-list-item {
    height: 48px;
    border-radius: 0;
    margin: 0;
}

/* Calendar Main Area */
.calendar-main {
    flex: 1;
    padding: 24px 16px 16px 16px;
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.calendar-header .mdc-text-field {
    flex: 1;
    height: 56px;
}

/* Mock Calendar View */
.calendar-month-view {
    flex: 0 0 auto;
    /* Do not grow, do not shrink */
    min-height: 250px;
    background-color: transparent;
    /* Removed placeholder bg */
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: var(--md-sys-color-on-surface);
    height: 460px !important;
    max-height: 460px;
    /* Double assurance */
    overflow-y: auto;
    padding-right: 8px;
    /* Space for scrollbar */
    scrollbar-width: thin;
}

.calendar-month-view::-webkit-scrollbar {
    width: 6px;
}

.calendar-month-view::-webkit-scrollbar-thumb {
    background-color: var(--md-sys-color-outline-variant, #ccc);
    border-radius: 3px;
}

.calendar-widget {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    flex-shrink: 0;
}

.month-container {
    flex: none;
    display: flex;
    flex-direction: column;
}

.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.month-title {
    font-size: 14px;
    font-weight: 500;
}

.small-icon {
    font-size: 20px;
    padding: 4px;
    width: 28px;
    height: 28px;
}

.days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 8px;
}

.days-header span {
    font-size: 12px;
    color: var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.6));
    width: 32px;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    row-gap: 4px;
}

.day {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: 50%;
    cursor: pointer;
}

.day:hover:not(.empty):not(.disabled) {
    background-color: var(--md-sys-color-surface-variant);
}

.day.empty,
.day.disabled {
    cursor: default;
}

.day.disabled {
    color: var(--md-sys-color-outline);
    pointer-events: none;
}


.day.selected,
.day.start-date,
.day.end-date {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.day.in-range:not(.start-date):not(.end-date) {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: 0;
}

/* Adjust radius for start/end of range for visual continuity */
.day.in-range.start-date {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.day.in-range.end-date {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Footer */
.card-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 16px;
    gap: 8px;
}

/* Force Primary Color for Text Buttons specifically */
/* Force Primary Color for Text & Outlined Buttons specifically */
.mdc-button:not(:disabled) {
    color: var(--md-sys-color-primary);
    border-radius: 20px;
    height: 40px;
}

/* Ensure Filled Buttons have correct On-Primary color */
.mdc-button--raised:not(:disabled),
.mdc-button--unelevated:not(:disabled) {
    color: var(--md-sys-color-on-primary) !important;
}

.mdc-text-field:not(.mdc-text-field--disabled) .mdc-floating-label--float-above {
    color: var(--md-sys-color-primary) !important;
}

.mdc-text-field:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__leading,
.mdc-text-field:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__notch,
.mdc-text-field:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__trailing {
    border-color: var(--md-sys-color-primary) !important;
}

/* Dashboard Specific Layout Overrides */
.main-content.dashboard-content {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dashboard-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dashboard-header-frame {
    flex-shrink: 0;
    z-index: 5;
    position: relative;
}

/* Adjust grid padding to maintain visual consistency */
.dashboard-header-frame .mdc-layout-grid {
    padding-bottom: 0;
    padding-top: 8px;
    padding-left: 0;
    padding-right: 0;
}

.dashboard-scroll-frame {
    flex: 1;
    overflow-y: auto;
    /* Aesthetic scrollbar matching other scrollbars */
    scrollbar-width: auto;
    scrollbar-color: #999999 transparent;
}

.dashboard-scroll-frame .mdc-layout-grid {
    padding-top: 20px;
    padding-left: 0;
    padding-right: 0;
}

.dashboard-scroll-frame::-webkit-scrollbar {
    width: 12px;
}

.dashboard-scroll-frame::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-scroll-frame::-webkit-scrollbar-thumb {
    background-color: #999999;
    border-radius: 3px;
}

/* Remove card-like styling from saved replies list */
#saved-replies-list {
    padding: 0;
}

#saved-replies-list .mdc-list-item {
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    height: auto;
}

#saved-replies-list .mdc-list-item:last-child {
    border-bottom: none;
}

/* Saved Reply Actions Visibility */
.saved-reply-actions {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

#saved-replies-list .mdc-list-item:hover .saved-reply-actions {
    opacity: 1;
}

/* Material Design 3 Typography - Title Small for List Group Subheaders */
.mdc-list-group__subheader {
    font-family: Roboto, sans-serif;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0.1px;
    color: var(--md-sys-color-on-surface-variant);
    margin: 16px 16px 8px 28px;
}

/* Drawer Header for FAB */
.mdc-drawer__header {
    padding: 16px 12px;
    /* Standard margin */
    display: flex;
    align-items: center;
    flex-shrink: 0;
    /* Keep header fixed */
}

/* Scrollable Note List Area */
/* Scrollable Note List Area */
#drawer-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    /* Changed from 100vh to ensure it fits within parent and scrolls properly */
    padding-bottom: 80px;
    /* Increased for mobile system bars */
}

/* FAB Styling in Drawer */
.mdc-drawer .mdc-fab {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: none;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s, background-color 0.2s, padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    border-radius: 16px;
    height: 56px;
    padding-left: 12px;
    /* Reduced from 16px */
    padding-right: 20px;
    /* Reduced from 24px */
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
}



.mdc-drawer .mdc-fab .mdc-fab__ripple {
    border-radius: 16px;
}

.mdc-drawer .mdc-fab:hover {
    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
}

.mdc-drawer .mdc-fab__label {
    transition: opacity 0.2s linear, max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    opacity: 1;
    max-width: 200px;
    overflow: hidden;
    margin-left: 0;
    font-family: Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-primary-container) !important;
    text-transform: none !important;
}

.mdc-drawer .mdc-fab .material-icons {
    color: var(--md-sys-color-on-primary-container);
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 12px;
    margin-left: 4px;
}

/* Rail State logic for FAB */
.mdc-drawer--rail .mdc-drawer__header {
    padding: 16px 12px !important;
    justify-content: flex-start;
    /* Keep aligned to the left */
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mdc-drawer--rail .mdc-fab,
.mdc-drawer--rail .mdc-fab--extended {
    max-width: 56px !important;
    width: 56px !important;
    height: 56px !important;
    padding: 0 16px !important;
    border-radius: 16px;
    justify-content: flex-start;
}

.mdc-drawer--rail .mdc-fab__label {
    opacity: 0;
    max-width: 0;
    margin-left: 0;
}

.mdc-drawer--rail .mdc-fab .mdc-fab__icon,
.mdc-drawer--rail .mdc-fab .material-icons {
    margin: 0 !important;
}

/* Hide scrollbar in rail mode */
/* Hide scrollbar in rail mode */
.mdc-drawer--rail #drawer-list {
    overflow-y: hidden;
}

/* Closing state to prevent layout shift */
.mdc-drawer--rail.mdc-drawer--closing {
    position: absolute;
    z-index: 20;
    height: 100%;
    overflow: hidden;
    box-shadow: none;
    /* Width animates back to 80px naturally via .mdc-drawer--rail */
}

/* Maintain spacing during closing animation */
.mdc-drawer--rail.mdc-drawer--closing+.main-content {
    margin-left: 80px;
}


/* Hover interaction for Rail */
.mdc-drawer--rail.mdc-drawer--hover-open {
    width: 360px !important;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 20;
    /* Add Shadow for Modal-like appearance */
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    height: 100%;
    background-color: var(--md-sys-color-surface);
    /* Ensure opaque */
}

/* Ensure list is scrollable when expanded */
/* Ensure list is scrollable when expanded */
.mdc-drawer--rail.mdc-drawer--hover-open #drawer-list {
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: var(--md-sys-color-outline-variant) transparent;
}

/* Push content to preserve layout when rail becomes absolute */
.mdc-drawer--rail.mdc-drawer--hover-open+.main-content {
    margin-left: 80px;
    /* Match rail width */
}

/* Reveal Text and Icons on Hover */
.mdc-drawer--rail.mdc-drawer--hover-open .mdc-list-item__text {
    opacity: 1;
    max-width: 200px;
    transform: translateX(0);
    transition: opacity 0.3s 0.1s, transform 0.3s 0.1s;
}

.mdc-drawer--rail.mdc-drawer--hover-open .expand-icon {
    opacity: 1;
    max-width: 24px;
    transform: translateX(0);
    transition: opacity 0.3s 0.1s, transform 0.3s 0.1s;
}

/* Allow sub-lists to show if they are expanded */
.mdc-drawer--rail.mdc-drawer--hover-open .mdc-sub-list.mdc-sub-list--expanded {
    display: block !important;
    opacity: 1;
    max-height: 1000px !important;
}

.mdc-drawer--rail.mdc-drawer--hover-open .mdc-list-group__subheader,
.mdc-drawer--rail.mdc-drawer--hover-open .mdc-list-divider {
    display: block;
    /* Show dividers/headers */
}

/* Adjust item padding back to normal on hover */
.mdc-drawer--rail.mdc-drawer--hover-open .mdc-list-item {
    padding: 0 12px;
    /* Restore standard padding */
}

.mdc-drawer--rail.mdc-drawer--hover-open .mdc-list-item__graphic {
    margin-right: 12px;
    /* Restore graphic margin */
}

/* Ensure FAB expands correctly if needed, or stays compact? 
   Currently FAB is in .mdc-drawer__header. 
   If we want the "Compose" button to expand, we need to handle that too. 
*/
.mdc-drawer--rail.mdc-drawer--hover-open .mdc-fab--extended {
    width: auto !important;
    max-width: none !important;
    padding: 0 20px 0 12px !important;

    /* Adjust padding to match extended state */
}

.mdc-drawer--rail.mdc-drawer--hover-open .mdc-fab__label {
    display: inline-block;
    opacity: 1;
    max-width: 200px;
    /* Restore max-width */
    width: auto;
    transition: width 0.3s, opacity 0.2s;
}

.mdc-drawer--rail.mdc-drawer--hover-open .mdc-fab .material-icons {
    margin-right: 12px !important;
    margin-left: 0 !important;
    /* Restore margin */
}

@media (max-width: 720px) {

    /* Responsive Drawer: Absolute positioning (Modal-like) on small screens */
    .mdc-drawer {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 20;
        height: 100%;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);

        /* Force full width on mobile to match open state */
        width: 360px !important;

        /* Animation Configuration */
        /* Ensure transition applies to transform */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        transform: translateX(0);
        /* Default Open Position */
        will-change: transform;
    }

    /* "Rail" class on mobile now signifies "Closed/Hidden" state */
    .mdc-drawer.mdc-drawer--rail {
        display: flex !important;
        /* Keep in DOM for animation */
        transform: translateX(-100%);
        /* Move out to left */
        box-shadow: none;

        /* Ensure explicit transition here too just in case */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* --- OVERRIDES: Prevent "Rail" styling (shrinking/hiding content) on mobile --- */
    /* This ensures distinct "Rail" styles don't snap in during the slide animation */

    /* 1. Restore Text & Icons */
    .mdc-drawer.mdc-drawer--rail .mdc-list-item__text {
        opacity: 1 !important;
        max-width: 200px !important;
        display: block !important;
    }

    .mdc-drawer.mdc-drawer--rail .expand-icon {
        opacity: 1 !important;
        max-width: 24px !important;
    }

    .mdc-drawer.mdc-drawer--rail .mdc-list-item__graphic {
        margin-right: 12px !important;
    }

    /* 2. Restore FAB (Combine/Compose Button) */
    .mdc-drawer.mdc-drawer--rail .mdc-fab {
        width: auto !important;
        max-width: none !important;
        padding-right: 20px !important;
    }

    .mdc-drawer.mdc-drawer--rail .mdc-fab__label {
        opacity: 1 !important;
        max-width: 200px !important;
    }

    .mdc-drawer.mdc-drawer--rail .mdc-fab .material-icons {
        margin-right: 12px !important;
        margin-left: 4px !important;
    }

    /* 3. Restore Sub-lists (if expanded) */
    .mdc-drawer.mdc-drawer--rail .mdc-sub-list {
        /* Revert 'display: none' from desktop rail */
        display: none;
        max-height: none !important;
        opacity: 1 !important;
    }

    .mdc-drawer.mdc-drawer--rail .mdc-sub-list.mdc-sub-list--expanded {
        display: block !important;
    }

    /* 4. Layout Fixes */
    .app-content {
        position: relative;
    }

    /* Ensure content doesn't shift */
    .mdc-drawer+.main-content,
    .mdc-drawer--rail+.main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
    }
}

.no-transition {
    transition: none !important;
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--md-sys-color-surface);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

#splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.m3-headline-large {
    font-family: var(--m3-font-family);
    font-size: 32px;
    line-height: 40px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
}

.m3-body-medium {
    font-family: var(--m3-font-family);
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    letter-spacing: 0.25px;
    color: var(--md-sys-color-on-surface-variant);
}

/* Button Ripple Fix */
.mdc-button {
    border-radius: 24px !important;
    /* M3 rounded */
    position: relative;
    overflow: hidden;
}

.mdc-button .mdc-button__ripple {
    border-radius: 24px !important;
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.help-icon {
    font-size: 20px !important;
    width: 20px;
    height: 20px;
    cursor: help;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.help-icon:hover {
    opacity: 1;
}

.m3-tooltip {
    visibility: hidden;
    width: 240px;
    background-color: var(--md-sys-color-on-surface-variant);
    color: var(--md-sys-color-surface);
    text-align: left;
    border-radius: 4px;
    padding: 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    font-weight: 400;
}

.m3-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--md-sys-color-on-surface-variant) transparent transparent transparent;
}

.tooltip-container:hover .m3-tooltip {
    visibility: visible;
    opacity: 1;
}


/* Disable View Transitions to prevent slide-in effects on navigation */
@view-transition {
    navigation: none;
}

/* Optimize layout when navigation rail disappears (Mobile) */
@media (max-width: 720px) {
    .main-content {
        margin-right: 0;
        margin-bottom: 0;
    }

    /* Right Pane Full Screen Overlay on Mobile */
    .right-pane {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 100% !important;
        height: 100vh !important;
        max-width: 100% !important;
        z-index: 100 !important;
        /* Above top app bar (typically z-index: 4) */
        border-left: none !important;
        box-shadow: none !important;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        /* Disable the width transition inherited from desktop */
    }

    .right-pane--open {
        right: 0 !important;
        width: 100% !important;
    }

    .main-content:has(.right-pane--open) {
        gap: 0 !important;
    }

    /* Mobile Table: Show only Title and Date */
    .mdc-data-table__header-row th:nth-child(1),
    /* Checkbox */
    .mdc-data-table__content tr td:nth-child(1),
    .mdc-data-table__header-row th:nth-child(2),
    /* ID */
    .mdc-data-table__content tr td:nth-child(2),
    .mdc-data-table__header-row th:nth-child(4),
    /* Type */
    .mdc-data-table__content tr td:nth-child(4),
    .mdc-data-table__header-row th:nth-child(5),
    /* Status */
    .mdc-data-table__content tr td:nth-child(5),
    .mdc-data-table__header-row th:nth-child(7),
    /* Site */
    .mdc-data-table__content tr td:nth-child(7),
    .mdc-data-table__header-row th:nth-child(8),
    /* Name */
    .mdc-data-table__content tr td:nth-child(8) {
        display: none !important;
    }

    /* Date Column: Show fully, minimum width */
    .mdc-data-table__header-row th:nth-child(6),
    .mdc-data-table__content tr td:nth-child(6) {
        width: 1%;
        white-space: nowrap;
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Title takes remaining space and wraps */
    .mdc-data-table__header-row th:nth-child(3),
    .mdc-data-table__content tr td:nth-child(3) {
        width: auto;
        white-space: normal;
        word-wrap: break-word;
    }

    /* Mobile Row Spacing & Alignment */
    .mdc-data-table__row {
        height: auto !important;
    }

    .mdc-data-table__cell {
        padding-top: 16px !important;
        padding-bottom: 16px !important;
        vertical-align: top !important;
    }

    /* Force No Data Row to be visible and span correctly */
    .mdc-data-table__content tr.no-data-row {
        display: table-row !important;
    }

    .mdc-data-table__content tr.no-data-row td {
        display: table-cell !important;
        /* Reset any specific column hiding or width constraints */
        width: auto !important;
        /* Center text and add padding for better mobile appearance */
        text-align: center !important;
        padding: 32px 16px !important;
        white-space: normal !important;
        border-bottom: none !important;
        color: var(--md-sys-color-on-surface-variant) !important;
        font-weight: 400;
        font-size: 14px;
    }
}

/* Ensure no-data-row is always visible regardless of column hiding (Tablet/Small Desktop) */
@container main (max-width: 1000px) and (min-width: 601px) {
    .mdc-data-table__content tr.no-data-row td {
        display: table-cell !important;
    }

    .mdc-data-table__content tr.no-data-row {
        display: table-row !important;
    }
}

/* Ensure Main Content is Relative for Absolute Scrim */
.main-content {
    position: relative;
}

/* Scrim (Overlay) for Modal Drawer */
.mdc-drawer-scrim {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6);
    /* White Tone */
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s linear;
}

.mdc-drawer-scrim--active {
    display: block !important;
    opacity: 1 !important;
}

@media (max-width: 600px) {

    /* Mobile Dropdown Style Override (Replaces Bottom Sheet) */
    .datepicker-card {
        position: absolute !important;
        /* Dropdown behavior */
        top: 100% !important;
        left: auto !important;
        bottom: auto !important;
        right: 0 !important;

        width: auto !important;
        max-width: 90vw !important;
        max-height: none !important;

        border-radius: 4px !important;
        /* Standard Card Radius */
        box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2),
            0px 8px 10px 1px rgba(0, 0, 0, 0.14),
            0px 3px 14px 2px rgba(0, 0, 0, 0.12) !important;

        transform: none !important;
        animation: none !important;
        z-index: 100 !important;
        display: none;
        /* Controlled by JS inline style */
    }

    .datepicker-content {
        flex-direction: column;
        overflow: visible !important;
        width: 100%;
        padding: 0;
    }

    /* Preset Menu: Standard Vertical List */
    .calendar-preset-menu-items {
        width: 100% !important;
        border: none !important;
        padding: 8px 0 !important;
        display: block !important;
    }

    .calendar-preset-menu-items .mdc-list {
        display: block !important;
        flex-direction: column !important;
        overflow: visible !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    .calendar-preset-menu-items .mdc-list-item {
        border-radius: 0 !important;
        margin: 0 !important;
        height: 48px !important;
        padding: 0 16px !important;
        border: none !important;
        width: 100%;
    }

    .calendar-preset-menu-items .mdc-list-item--activated {
        background-color: var(--md-sys-color-secondary-container) !important;
        color: var(--md-sys-color-on-secondary-container) !important;
    }



    /* Hide Complex Components on Mobile */
    .calendar-main,
    .calendar-month-view,
    .card-footer,
    .datepicker-card.open::before {
        display: none !important;
    }
}.popup-downward {
    margin-bottom: -50px !important;
}
.popup-downward .leaflet-popup-tip-container {
    top: -20px;
    bottom: auto;
    transform: rotate(180deg);
}

/* Lower chips so Map Popups can overlay them */
.chips-container {
    z-index: 650 !important;
}
.m3-layer-control {
    z-index: 650 !important;
}

/* Overrides for Drafted Tables (6 columns) */
.drafted-table .mdc-data-table__header-row th:nth-child(4),
.drafted-table .mdc-data-table__content tr td:nth-child(4) {
    display: table-cell !important;
}

@media (min-width: 721px) {
    .drafted-table .mdc-data-table__header-row th:nth-child(5),
    .drafted-table .mdc-data-table__content tr td:nth-child(5) {
        display: table-cell !important;
    }
}
