:root {
    --mud-shape-border-radius: 10px !important;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    /* Keep these — they make Inter look exceptionally crisp on high-res monitors */
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.pwa {
    user-select: none;
    -webkit-user-select: none;
}

body.pwa .allow-pwa-select, body.pwa .allow-pwa-select * {
    user-select: text;
    -webkit-user-select: text;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

/* =========================================
   #APP — stable positioning for initial loader & Blazor content
   ========================================= */
#app {
    position: relative;
    min-height: 100vh;
}

/* BootStrap Classes*/
.position-relative{
    position:relative !important;
}

/* =========================================
   CUSTOM LOADERS & UTILITIES
   ========================================= */
.min-height-loading{
    min-height: 60px;
}

/* Full-screen shell boot screen — replaces the different white flashes after login.
   Reuses the brand primary spinner so the transition stays a single, continuous
   loading experience (never "layout flash → loader → layout"). */
.app-shell-loading{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
}

.shell-spinner{
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(40, 37, 57, 0.2);
    border-top-color: var(--mud-palette-primary, #282539);
    animation: shell-spin 0.9s linear infinite;
}

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

/* Initial HTML loader (matches MudBlazor MudProgressCircular style) */
.loader{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.loader svg{
    animation: loader-rotate 1.4s linear infinite;
    width: 40px;
    height: 40px;
}

.loader svg circle{
    animation: loader-dash 1.4s ease-in-out infinite;
    stroke: var(--mud-palette-primary, #282539);
    stroke-dasharray: 1,200;
    stroke-dashoffset: 0;
    fill: none;
}

@keyframes loader-rotate{
    100%{ transform: rotate(360deg); }
}

@keyframes loader-dash{
    0%{ stroke-dasharray: 1,200; stroke-dashoffset: 0; }
    50%{ stroke-dasharray: 89,200; stroke-dashoffset: -35; }
    100%{ stroke-dasharray: 89,200; stroke-dashoffset: -124; }
}


.bg-primary {
    background-color: var(--mud-palette-primary) !important;
}

.bg-secondary{
    background-color: var(--mud-palette-secondary) !important;
}

.c-surface {
    color: var(--mud-palette-surface) !important;
}

.c-primary {
    color: var(--mud-palette-primary) !important;
}

.c-secondary {
    color: var(--mud-palette-secondary) !important;
}

.bg-surface {
    background-color: var(--mud-palette-surface) !important;
}

.bg-background {
    background-color: var(--mud-palette-background) !important;
}

.border-default {
    border: 1px solid var(--mud-palette-lines-default) !important;
}


/* =========================================
   CARD & ACCENT VARIANTS
   ========================================= */
.card-accent-primary-hover {
    background-color: var(--mud-palette-primary-hover) !important;
    cursor: pointer;
}

.card-accent-primary-filled {
    background: var(--mud-palette-primary) !important;
    cursor: pointer;
}


/* =========================================
   ICON & STAT UTILITIES
   ========================================= */
.stat-icon {
    background-color: var(--mud-palette-surface) !important;
    color: var(--mud-palette-primary) !important;
    pointer-events: none;
}

.icon-decorative {
    pointer-events: none;
}


/* =========================================
   CALENDAR / TOOLTIP COMPONENTS
   ========================================= */
.calendar-tooltip-card {
    padding: 12px;
}

.calendar-popup-card {
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
}


/* =========================================
   DATAGRID STYLING
   ========================================= */
.custom-datagrid {
    overflow: hidden;
}

.custom-datagrid .mud-table-head { background-color: var(--mud-palette-secondary) !important; }
.custom-datagrid .column-header { color: var(--mud-palette-primary) !important; }
.custom-datagrid .mud-table-pagination-toolbar { background-color: var(--mud-palette-secondary) !important; }
.custom-datagrid .mud-table-cell { padding: 5px 12px !important; }
.custom-datagrid .mud-table-toolbar { background-color: var(--mud-palette-secondary) !important; }
.custom-datagrid .mud-table-cell .input-rent-cell { min-width: 170px !important; }
.custom-datagrid .mud-table-cell .input-time-cell { min-width: 170px !important; }

@media (max-width: 600px) {
    .mud-xs-table td.mud-table-cell[colspan] {
        justify-content: flex-start !important;
    }
}

/* Sharp, dense typography specifically for data cells and headers */
.mud-table-root .mud-table-head .mud-table-cell {
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
}

.mud-table-root .mud-table-body .mud-table-cell {
    font-size: 0.8125rem !important;
}

tr.mud-table-row td.mud-table-child-content:empty {
    display: none;
}

td.mud-table-child-content[colspan="1000"]:empty {
    border-top: none;
    padding: 0 !important;
    height: 0;
}

td.mud-table-cell.mud-table-child-content {
    min-width: 100%;
    justify-content: center;
    border-left: 3px solid var(--mud-palette-secondary);
}


/* =========================================
   LAYOUT COMPONENTS (Cards, Panels, Nav)
   ========================================= */
.custom-paper {
    overflow: hidden;
}

.custom-expansion-panel {
    margin-bottom: 10px !important;
}

.custom-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.custom-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.custom-card-primary-border-radius { background-color: var(--mud-palette-primary) !important; }
.custom-card-secondary-border-radius { background-color: var(--mud-palette-secondary) !important; }
.custom-card-success-border-radius { background-color: rgb(0, 255, 0, 0.2) !important; }
.custom-card-error-border-radius { background-color: rgb(255, 0, 0, 0.2) !important; }
.custom-card-primary-hover-border-radius { background-color: var(--mud-palette-primary-hover) !important; }

/* =========================================
   NAVIGATION MENU
   ========================================= */
.active {
    background-color: var(--mud-palette-surface) !important;
    border-top-left-radius: var(--mud-shape-border-radius) !important;
    border-bottom-left-radius: var(--mud-shape-border-radius) !important;
    margin-left: 0.7vw;
}
.mud-nav-link{
    color: var(--mud-palette-primary) !important;
}
.mud-nav-link.active {
    color: var(--mud-palette-primary) !important;
    font-weight: 600;
}
.mud-nav-link.active .mud-nav-link-icon-default {
    color: var(--mud-palette-primary) !important;
}
.navbar-toggler {
    background-color: rgba(255, 255, 255, 0.1);
}
.top-row {
    height: 3.5rem;
    background-color: rgba(0,0,0,0.4);
}
.navbar-brand {
    font-size: 1.1rem;
}
.oi {
    width: 2rem;
    font-size: 1.1rem;
    vertical-align: text-top;
    top: -2px;
}
.nav-item {
    font-size: 0.9rem;
    padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
    padding-top: 1rem;
}
.nav-item:last-of-type {
    padding-bottom: 1rem;
}
.nav-item ::deep a {
    color: #d7d7d7;
    border-radius: 4px;
    height: 3rem;
    display: flex;
    align-items: center;
    line-height: 3rem;
}
.nav-item ::deep a.active {
    background-color: rgba(255,255,255,0.25);
    color: white;
}
.nav-item ::deep a:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}
@media (min-width: 641px) {
    .navbar-toggler {
        display: none;
    }

    .collapse {
        display: block;
    }

    .nav-scrollable {
        height: calc(100vh - 3.5rem);
        overflow-y: auto;
    }
}


/* =========================================
   MUDBLAZOR COMPONENT OVERRIDES
   ========================================= */
/* Timeline */
.mud-timeline-vertical::before{
    background-color: transparent;
    border-left: 3px dashed var(--mud-palette-primary) !important;
}

.mud-timeline-horizontal::before {
    background-color: transparent;
    border-top: 4px dashed var(--mud-palette-primary) !important;
}

/*Divider*/
.mud-divider{
    border-color:var(--mud-palette-primary) !important;
}

/* Chart tooltip text white */
.svg-tooltip text,
.svg-tooltip tspan {
    fill: white !important;
}

/*tabs*/
.mud-tab.mud-tab-active {
    background-color: var(--mud-palette-secondary) !important;
}

/* Button */
/* Ensure icons always follow the text color in filled buttons */
/*.mud-button-filled .mud-button-icon-start,*/
/*.mud-button-filled .mud-button-icon-end {*/
/*    color: inherit !important;*/
/*}*/

/* Force high-contrast text for Primary Filled buttons in Dark Mode */
/*[data-theme='dark'] .mud-button-filled-primary {*/
/*    color: var(--mud-palette-background) !important;*/
/*}*/

/* Button utility classes */
/*.btn-icon-secondary {*/
/*    color: var(--mud-palette-secondary-text, inherit) !important;*/
/*}*/

/* Dashboard stat card icon */
/*.stat-icon {*/
/*    background-color: var(--mud-palette-surface) !important;*/
/*    color: var(--mud-palette-primary) !important;*/
/*    pointer-events: none;*/
/*}*/

/* Toggle Group */
.custom-toggle-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr auto !important;
}

/* =========================================
   SIDE DRAWER & SCROLLBAR UX
   ========================================= */
.mud-drawer {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Drawer container scroll styles */
.mud-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Custom scrollbar styling for better UX */
.mud-drawer-container::-webkit-scrollbar {
    width: 8px;
}

.mud-drawer-container::-webkit-scrollbar-track {
    background: var(--mud-palette-background-grey) !important;
    border-radius: 4px;
}

.mud-drawer-container::-webkit-scrollbar-thumb {
    background: var(--mud-palette-text-disabled) !important;
    border-radius: 4px;
}

.mud-drawer-container::-webkit-scrollbar-thumb:hover {
    background: var(--mud-palette-text-secondary) !important;
}

/* Firefox scrollbar */
.mud-drawer-container {
    scrollbar-width: thin;
    scrollbar-color: var(--mud-palette-text-disabled) var(--mud-palette-background-grey) !important;
}

/* Prevent body scroll when drawer is open */
body.drawer-open {
    overflow: hidden;
}

/* Ensure proper touch scrolling on mobile */
.mud-drawer-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Prevent scroll chaining to parent */
.mud-drawer-container {
    overscroll-behavior-y: contain;
}

/* =========================================
   BUSINESS LOGIC & SPECIFIC STATES
   ========================================= */
.error-data-grid-row { background-color: rgba(255, 0, 0, 0.3) !important; }
.warning-data-grid-row { background-color: rgba(255, 255, 0, 0.3) !important; }

.cart-conflict-data-grid-row { background-color: rgba(33, 150, 243, 0.15) !important; }
.success-data-grid-row { background-color: rgba(0, 255, 0, 0.1) !important; }
.overdue-data-grid-cell { background-color: rgba(255, 0, 0, 0.3) !important; font-weight: 600; }

.has-bottom-nav {
    padding-top: 0px !important;
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
}

@media (max-width: 959.98px) {
    .mud-layout {
        padding-top: 0px !important;
    }
}

/*.no-data-container {*/
/*    display: flex;*/
/*    align-items: center;*/
/*    justify-content: center;*/
/*    min-height: 240px;*/
/*    width: 100%;*/
/*    background-color: var(--mud-palette-surface) !important;*/
/*    border-radius: 4px;*/
/*}*/

/*.no-data-content {*/
/*    text-align: center;*/
/*    padding: 24px;*/
/*    max-width: 300px;*/
/*}*/

/*.item-conflict{*/
/*    background: var(--mud-palette-surface) !important;*/
/*    border-left: 3px solid var(--mud-palette-primary) !important;*/
/*}*/
/*.item-check-availability{*/
/*    background: var(--mud-palette-secondary) !important;*/
/*    border-left: 3px solid var(--mud-palette-primary) !important;*/
/*}*/

/* Chip */
.custom-mud-chip{
    border-radius: var(--mud-shape-border-radius) !important;
}

.cart-item-selected {
    color: var(--mud-palette-primary-text) !important;
}
.cart-item-selected .mud-chip.mud-chip-outlined {
    color: var(--mud-palette-primary-text) !important;
    border-color: var(--mud-palette-primary-text) !important;
}
.cart-item-selected .mud-typography {
    color: var(--mud-palette-primary-text) !important;
}

/* No data content*/
.no-data-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1.25rem;
    gap: 0.25rem;
}

.no-data-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: var(--mud-shape-border-radius);
    background-color: var(--mud-palette-primary-hover, rgba(25, 118, 210, 0.08));
    margin-bottom: 0.75rem;
}

.no-data-icon ::deep svg {
    width: 28px;
    height: 28px;
    opacity: 0.9;
}

.no-data-title {
    color: var(--mud-palette-text-secondary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.no-data-action {
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .no-data-container {
        padding: 1.75rem 1rem;
    }

    .no-data-icon {
        width: 52px;
        height: 52px;
    }

    .no-data-icon ::deep svg {
        width: 24px;
        height: 24px;
    }
}

/* Header */
.sticky-page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--mud-palette-background);
    --header-px: 16px;
    width: calc(100% + (var(--header-px) * 2));
    margin-left: calc(var(--header-px) * -1);
    padding-left: var(--header-px);
    padding-right: var(--header-px);
}

/*!* The Fading Shade Zone *!*/
/*.sticky-page-header::after {*/
/*    content: '';*/
/*    position: absolute;*/
/*    left: 0;*/
/*    width: 100%;*/
/*    bottom: -15px;*/
/*    height: 15px;*/
/*    background: linear-gradient(to bottom, var(--mud-palette-background) 0%, transparent 100%);*/
/*    pointer-events: none;*/
/*}*/

@media (min-width: 960px) {
    .sticky-page-header {
        top: var(--mud-appbar-height, 64px);
        --header-px: 24px;
    }
}

/* =========================================
   ERROR DISPLAY (fallback shell)
   ========================================= */

/*
 * Full-screen fallback shown only when the app itself cannot run (fatal boot
 * error / failed download). Deliberately white and calm - no red, no alarming
 * color. Content is always centered both horizontally and vertically.
 */
#blazor-error-ui {
    position: fixed;
    inset: 0;
    z-index: 999999;
    margin: 0;
    box-sizing: border-box;
    background: #ffffff !important;
    color: #1f2937;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/*
 * The Blazor framework tries to show this overlay itself on ANY startup/unhandled
 * error by setting display:flex inline. While the app is starting it is suppressed
 * with `!important` (beats the framework's inline style) and is revealed ONLY
 * through `.show` (driven by our boot watchdog / fatal handlers).
 */
body:not(.blazor-booted) #blazor-error-ui {
    display: none !important;
}

/* Once the app has booted (body gets .blazor-booted), the suppression is lifted:
   the framework can still surface genuine runtime crashes with our branded card. */
body.blazor-booted #blazor-error-ui {
    display: none;
}

/* Our deliberate reveal: always flex, always dead-center. `!important` guarantees
   centering even if the framework flips the display value itself. */
#blazor-error-ui.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.app-fatal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 440px;
    margin: auto;
    padding: 2.75rem 2.25rem 2.25rem;
    background: #ffffff;
    border: 1px solid #eef1f6;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.10), 0 2px 8px rgba(15, 23, 42, 0.04);
    text-align: center;
    animation: fadeIn 0.3s ease-out;
    box-sizing: border-box;
}

.app-fatal-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 1.25rem;
    border-radius: 50%;
    background: #f3f6ff;
    color: #3849d8;
}

.app-fatal-logo svg {
    width: 34px;
    height: 34px;
}

.app-fatal-title {
    display: block;
    margin: 0 0 0.5rem;
    font-size: 1.375rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
}

.app-fatal-body {
    display: block;
    margin: 0;
    max-width: 370px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #6b7280;
}

.app-fatal-reload {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    margin-top: 1.5rem;
    padding: 0 2rem;
    border: none;
    border-radius: 12px;
    background: #3849d8;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(56, 73, 216, 0.28);
    transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.app-fatal-reload:hover {
    background: #2f3ec0;
    box-shadow: 0 10px 24px rgba(56, 73, 216, 0.34);
}

.app-fatal-reload:active {
    transform: scale(0.98);
}

.app-fatal-reload:focus-visible {
    outline: 3px solid rgba(56, 73, 216, 0.35);
    outline-offset: 2px;
}

.app-fatal-support {
    display: block;
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: #9ca3af;
}

.app-fatal-support a {
    color: #3849d8;
    font-weight: 500;
    text-decoration: none;
}

.app-fatal-support a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .app-fatal-card {
        padding: 2.25rem 1.5rem 1.75rem;
    }

    .app-fatal-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }

    .app-fatal-reload {
        width: 100%;
    }
}

.error-display {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    padding: 2rem 1rem;
    width: 100%;
}

.error-display-card {
    max-width: 480px;
    width: 100%;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background-color: transparent !important;
}

.error-display-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.08);
    margin-bottom: 0.5rem;
}

.error-display-title {
    font-weight: 600 !important;
    letter-spacing: -0.01em;
}

.error-display-message {
    color: var(--mud-palette-text-secondary) !important;
    max-width: 380px;
    line-height: 1.6;
}

.error-display-reference {
    font-size: 0.75rem;
    color: var(--mud-palette-text-disabled);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    letter-spacing: 0.02em;
    user-select: all;
}

.error-display-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.error-display-support {
    color: var(--mud-palette-text-disabled) !important;
    margin-top: 0.25rem;
}

.error-display-support a {
    color: var(--mud-palette-primary) !important;
    text-decoration: none;
}

.error-display-support a:hover {
    text-decoration: underline;
}

.error-display-details {
    white-space: pre-wrap;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    max-height: 300px;
    overflow: auto;
    padding: 0.75rem;
    background-color: var(--mud-palette-background-grey);
    border-radius: 6px;
}


/* =========================================
   OPERATION DASHBOARD V2 - PREMIUM DESIGN
   ========================================= */

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- Workflow / Card Icon Containers --- */
.workflow-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-bg { background: var(--mud-palette-info-hover); }
.warning-bg { background: var(--mud-palette-warning-hover); }
.success-bg { background: var(--mud-palette-success-hover); }
.primary-bg { background: var(--mud-palette-primary-hover); }

/* --- Responsive --- */
@media (max-width: 600px) {
    .date-range-picker {
        min-width: 100%;
        width: 100%;
    }

    .error-display {
        min-height: 280px;
        padding: 1.5rem 0.75rem;
    }

    .error-display-card {
        padding: 2rem 1.25rem;
    }

    .error-display-icon {
        width: 60px;
        height: 60px;
    }
}