:root {
    --app-bg: #f4f7fb;
    --app-surface-bg: #ffffff;
    --app-surface-border: #dbe4f0;
    --app-text: #172033;
    --app-muted: #66758f;
    --app-success: #2e7d32;
    --app-warning: #ed8f03;
    --app-danger: #d32f2f;
    --app-spacing-1: 8px;
    --app-spacing-2: 16px;
    --app-spacing-3: 24px;
    --app-spacing-4: 32px;
    --app-primary-soft: rgba(25, 118, 210, 0.1);
    --app-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --app-shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
    --app-list-head-bg: linear-gradient(180deg, #f8fbff, #eef4fb);
    --app-list-head-border: #d7e2ef;
    --app-list-row-hover: rgba(25, 118, 210, 0.06);
    --app-list-row-alt: rgba(15, 23, 42, 0.015);
    --app-default-zoom: 0.8;
}

/* Remove MudBlazor's default bottom padding on the main content area */
.mud-main-content {
    padding-bottom: 0 !important;
}

/* Login card: override MudBlazor's internal mud-card-content-padding */
.login-card .mud-card-content-padding {
    padding: 2.5rem !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Inter', 'Roboto', 'Helvetica', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: radial-gradient(circle at top, #fbfdff 0%, var(--app-bg) 30%, #eef3f9 100%);
    color: var(--app-text);
}

body {
    min-height: 100vh;
}

    body .mud-layout {
        min-height: 100vh;
    }

@media (min-width: 961px) {
    html {
        zoom: var(--app-default-zoom);
    }
}

@media (max-width: 960px) {
    html {
        zoom: 1;
    }
}

a {
    color: inherit;
}

.content {
    padding-top: var(--app-spacing-3);
    padding-inline: 4px;
}

body ::selection {
    background: rgba(25, 118, 210, 0.18);
}

h1:focus {
    outline: none;
}

body .mud-typography.mud-typography-h4,
body .mud-typography.mud-typography-h5,
body .mud-typography.mud-typography-h6 {
    line-height: 1.4;
}

body .mud-typography.mud-typography-h4 {
    font-size: 22px;
    font-weight: 600;
}

body .mud-typography.mud-typography-h5,
body .mud-typography.mud-typography-h6 {
    font-size: 20px;
    font-weight: 600;
}

body .mud-typography.mud-typography-subtitle1,
body .mud-typography.mud-typography-subtitle2,
body .mud-typography.mud-typography-body1 {
    font-size: 14px;
    line-height: 1.5;
}

.page-enter {
    animation: fade-slide-in 200ms ease-out forwards;
}

.app-surface {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 251, 255, 0.98));
    border: 1px solid var(--app-surface-border);
    border-radius: 18px;
    box-shadow: var(--app-shadow-sm), var(--app-shadow-md);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.app-filter-table-divider {
    height: 1px;
    margin: 0;
    background: #dbe4f0;
}

    .app-surface:hover {
        border-color: #c9d7ea;
        box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04), 0 14px 36px rgba(15, 23, 42, 0.08);
    }

.app-page-title {
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 22px;
    line-height: 1.4;
    letter-spacing: 0;
}

.app-page-subtitle {
    color: var(--app-muted);
    margin-bottom: var(--app-spacing-3);
    font-size: 16px;
    line-height: 1.5;
}

.app-page-header {
    gap: 1rem;
    flex-wrap: wrap;
}

.app-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

.app-page-loader {
    width: 100%;
}

.material-appbar {
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    border-bottom: 1px solid #e2e8f0;
    backdrop-filter: blur(14px);
}

.material-appbar-search {
    max-width: 280px;
}

.material-appbar-search .mud-input-slot {
        background: #f8fafc;
        border-radius: 999px;
    }

.material-avatar {
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12);
}

body .mud-button-root {
    border-radius: 999px;
    min-height: 40px;
    padding-inline: var(--app-spacing-2);
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

    body .mud-button-root:hover {
        transform: translateY(-1px);
    }

body .mud-button-filled {
    box-shadow: 0 8px 18px rgba(25, 118, 210, 0.18);
}

body .app-btn-primary,
body .mud-button-filled.mud-button-filled-primary {
    box-shadow: 0 8px 18px rgba(25, 118, 210, 0.18);
}

body .app-btn-primary,
body .mud-button-filled.mud-button-filled-primary {
    box-shadow: 0 8px 18px rgba(25, 118, 210, 0.18);
}

body .app-btn-secondary,
body .mud-button-outlined {
    box-shadow: none;
}

body .app-btn-danger,
body .mud-button-filled.mud-button-filled-error {
    box-shadow: 0 8px 18px rgba(211, 47, 47, 0.22);
}

body .mud-input-control > .mud-input-control-input-container > .mud-input-slot {
    border-radius: 12px;
    min-height: 42px;
    transition: box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

body .mud-input-label,
body .mud-input-control .mud-input-label,
body .mud-picker-input-control .mud-input-label {
    font-size: 14px;
    font-weight: 500;
}

body .mud-input-helper-text {
    font-size: 12px;
    line-height: 1.45;
}

body .mud-input-error,
body .mud-input-helper-text.mud-input-error {
    color: var(--app-danger) !important;
}

body .mud-input-control .mud-input-slot:focus-within,
body .mud-picker-input-control .mud-input-slot:focus-within {
    box-shadow: 0 0 0 4px var(--app-primary-soft);
}

/* Remove focus halo for searchable boxes (autocomplete/select search UI). */
body .mud-autocomplete .mud-input-slot:focus-within,
body .mud-select .mud-input-slot:focus-within,
body .mud-select-input .mud-input-slot:focus-within {
    box-shadow: none !important;
}

body .mud-paper {
    border-radius: 16px;
}

body .mud-table-root .mud-table-container table thead th,
body .mud-table-root .mud-table-container table tbody td {
    border-color: #e2e8f0;
}

body .mud-table-root .mud-table-container,
body .mud-datagrid .mud-table-container {
    border-radius: 14px;
}

/* Professional modern list header + sticky header while list scrolls */
body .mud-table-root .mud-table-container table thead th,
body .mud-table-root .mud-table-head .mud-table-cell,
body .mud-datagrid .mud-table-container table thead th,
body .mud-datagrid .mud-table-head .mud-table-cell {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--app-list-head-bg);
    color: #1f2a3d;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: inset 0 -1px 0 var(--app-list-head-border);
    font-size: 14px;
    line-height: 1.45;
}

/* Rich list rows */
body .mud-table-root .mud-table-container table tbody td,
body .mud-datagrid .mud-table-container table tbody td {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
    background: #fff;
    font-size: 13px;
    line-height: 1.5;
}

.list-table-shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.app-viewport-page {
    height: calc(100dvh - 112px);
    min-height: 0;
    overflow: hidden;
}

.app-viewport-page > .list-table-shell,
.app-viewport-page > .users-table-shell,
.app-viewport-page > .userlogs-table-shell {
    flex: 1 1 auto;
    min-height: 0;
}

.list-table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    border-radius: inherit;
}

    .list-table-scroll .mud-table-container,
    .list-table-scroll .mud-datagrid .mud-table-container {
        max-height: calc(100vh - 360px);
        overflow: auto;
    }

/* Compact pager row ("Rows per page") across table/list pages */
body .mud-table-pagination,
body .mud-data-grid-pager {
    padding: 4px 10px !important;
    min-height: 40px;
    overflow: visible;
    position: relative;
    contain: layout;
}

body .mud-table-pagination .mud-toolbar,
body .mud-data-grid-pager .mud-toolbar {
    min-height: 34px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

body .mud-table-root .mud-table-container table tbody tr:nth-child(even) td,
body .mud-datagrid .mud-table-container table tbody tr:nth-child(even) td {
    background: var(--app-list-row-alt);
}

body .mud-chip {
    border-radius: 999px;
}

.app-filter-row {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--app-spacing-2);
    align-items: stretch;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.app-filter-row-compact {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--app-spacing-1);
    align-items: end;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.app-filter-cell {
    min-width: 0;
    flex: 1 1 180px;
    display: flex;
    align-items: stretch;
}

.app-filter-cell-compact {
    min-width: 0;
    flex: 1 1 160px;
    display: flex;
    align-items: end;
}

.app-filter-cell > * {
    width: 100%;
}

.app-filter-cell-compact > * {
    width: 100%;
}

.app-filter-search {
    flex: 2.2 1 280px;
}

.app-filter-action {
    flex: 0 0 172px;
    display: flex;
    align-items: stretch;
}

.app-filter-action-compact {
    flex: 0 0 140px;
    display: flex;
    align-items: end;
}

.app-filter-action .mud-button-root {
    width: 100%;
    min-height: 56px;
}

.app-filter-action-compact .mud-button-root {
    width: 100%;
    min-height: 40px;
    height: 40px;
}

.workorder-filter-break {
    flex-basis: 100%;
    height: 0;
}

.workorder-filter-date {
    flex: 1 1 220px;
}

.workorder-filter-action {
    align-self: flex-end;
}

    .workorder-filter-action .mud-button-root {
        min-height: 56px;
        height: 56px;
    }

/* Work Orders filter row — also used by Dashboard Engineer field */
.wo-filter-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
}

.wo-filter-search { flex: 2 1 0;   min-width: 0; }
.wo-filter-cell   { flex: 1.5 1 0; min-width: 0; }
.wo-filter-date   { flex: 0.9 1 0; min-width: 0; }
.wo-filter-action { flex: 0 0 130px; }

body .mud-grid .mud-input-control,
body .mud-grid .mud-picker,
body .mud-grid .mud-select,
body .mud-grid .mud-autocomplete {
    width: 100%;
}

.app-form-actions {
    gap: var(--app-spacing-1);
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    padding-top: 0.75rem;
}

    .app-form-actions .mud-button-root {
        min-width: 132px;
    }

.app-section-header {
    gap: var(--app-spacing-2);
    flex-wrap: wrap;
}

body .mud-card-content > .mud-grid,
body .mud-card-content > .mud-stack > .mud-grid {
    align-items: stretch;
}

body .mud-alert {
    border-radius: 14px;
}

body .mud-dialog .mud-dialog-content {
    padding-top: 12px;
    padding-bottom: 12px;
}

body .mud-dialog-actions {
    padding: 12px 20px 16px;
    gap: 8px;
}

body .mud-table-root .mud-table-container table tbody tr,
body .mud-datagrid .mud-table-container table tbody tr {
    transition: background-color 150ms ease, transform 150ms ease;
}

body .mud-table-root .mud-table-container table tbody tr:hover,
body .mud-datagrid .mud-table-container table tbody tr:hover {
        background-color: var(--app-list-row-hover);
    }

body .mud-table-root .mud-table-container table tbody td.text-end,
body .mud-datagrid .mud-table-container table tbody td.text-end {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

body .mud-table-root .mud-table-container table tbody td.text-start,
body .mud-datagrid .mud-table-container table tbody td.text-start {
    text-align: left;
}

body .mud-button-filled.mud-button-filled-primary {
    background: linear-gradient(180deg, #2d86db 0%, #1f73c7 100%);
}

body .mud-button-filled.mud-button-filled-error {
    background: linear-gradient(180deg, #e24b4b 0%, #cf2f2f 100%);
}

body .mud-button-outlined {
    border-width: 1.5px;
}

body .mud-chip.mud-chip-color-success {
    background-color: var(--app-success) !important;
}

body .mud-chip.mud-chip-color-warning {
    background-color: var(--app-warning) !important;
    color: #1f2937 !important;
}

body .mud-chip.mud-chip-color-error {
    background-color: var(--app-danger) !important;
}

@media (max-width: 1279px) {
    .app-filter-row {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .app-filter-row-compact {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .app-filter-action {
        flex: 1 1 220px;
    }

    .app-filter-action-compact {
        flex: 1 1 180px;
    }
}

@media (max-width: 960px) {
    .app-filter-action {
        flex-basis: 100%;
    }

    .app-filter-action-compact {
        flex-basis: 100%;
    }

    .app-page-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .list-table-scroll .mud-table-container,
    .list-table-scroll .mud-datagrid .mud-table-container {
        max-height: calc(100vh - 330px);
    }

    .app-viewport-page {
        height: auto;
        overflow: visible;
    }
}

@media (max-width: 600px) {
    .content {
        padding-inline: 0;
    }

    .app-filter-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .app-filter-row-compact {
        flex-direction: column;
        gap: 0.5rem;
    }

    .app-filter-cell,
    .app-filter-search,
    .app-filter-action,
    .app-filter-cell-compact,
    .app-filter-action-compact,
    .workorder-filter-date {
        flex: 1 1 auto;
        width: 100%;
    }

    .app-form-actions {
        justify-content: stretch;
    }

        .app-form-actions .mud-button-root,
        .app-page-actions .mud-button-root {
            width: 100%;
        }
}

@keyframes fade-slide-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.mono {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 13px;
    letter-spacing: 0.02em;
}

/* ── Full-width page layout ─────────────────────────────────────── */

.app-full-width-page {
    margin: -1.5rem -1rem;
}

@media (min-width: 960px) {
    .app-full-width-page {
        margin: -2rem -1.5rem;
    }
}

.app-full-width-content {
    padding: 1rem;
    background: var(--mud-palette-background);
}

@media (min-width: 960px) {
    .app-full-width-content {
        padding: 1.5rem;
    }
}

/* ── Invoice list table ─────────────────────────────────────────── */

.invoice-filter-scroll {
    overflow-x: auto;
    scrollbar-width: thin;
}

.invoice-filter-minwidth {
    min-width: 720px;
}

/* ── End invoice list table ─────────────────────────────────────── */

/* ── Customers / SubCustomers grid ──────────────────────────────── */

body .customers-actions-header,
body .subcustomers-actions-header,
body .customers-grid .mud-table-head .mud-table-cell:last-child,
body .subcustomers-grid .mud-table-head .mud-table-cell:last-child {
    text-align: center !important;
}

/* MudDataGrid header cells use an inner flex div — target it directly */
body .customers-actions-header > span,
body .customers-actions-header > div,
body .subcustomers-actions-header > span,
body .subcustomers-actions-header > div,
body .customers-grid .mud-table-head .mud-table-cell:last-child > span,
body .customers-grid .mud-table-head .mud-table-cell:last-child > div,
body .subcustomers-grid .mud-table-head .mud-table-cell:last-child > span,
body .subcustomers-grid .mud-table-head .mud-table-cell:last-child > div {
    justify-content: center !important;
    text-align: center !important;
    width: 100%;
}

body .customers-grid .mud-table-body .mud-table-cell:last-child,
body .subcustomers-grid .mud-table-body .mud-table-cell:last-child {
    text-align: center !important;
}

/* ── End Customers grid ─────────────────────────────────────────── */

/* ── Repair Jobs list table ─────────────────────────────────────── */

.repair-jobs-table {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.repairjobs-table-scroll .mud-table-container {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    max-height: none;
    overflow: auto !important;
    scrollbar-width: thin;
}

.repair-jobs-table .mud-table-table {
    min-width: 1000px;
    width: max(100%, 1000px);
}

.repair-jobs-table .mud-table-container thead th,
.repair-jobs-table .mud-table-head .mud-table-cell {
    position: sticky !important;
    top: 0 !important;
    z-index: 6;
    background: linear-gradient(180deg, #f8fbff, #eef4fb) !important;
    box-shadow: inset 0 -1px #dbe4f0;
}

/* ── End Repair Jobs list table ─────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════════════
   LIST PAGE LAYOUT — viewport-fill flex chain for all list pages.
   These rules live here (app.css = static file, no rebuild needed).
   Page <style> blocks keep only cosmetic/filter-specific styles.
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Page shell: full viewport height, flex column ───────────── */
.repairjobs-page-shell,
.workorders-page-shell,
.inventory-page-shell,
.customers-page-shell,
.subcustomers-page-shell,
.ssr-page-shell,
.userlogs-page-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 112px);
    min-height: 0;
    overflow: hidden;
}

@media (min-width: 961px) {
    .repairjobs-page-shell,
    .workorders-page-shell,
    .inventory-page-shell,
    .customers-page-shell,
    .subcustomers-page-shell,
    .ssr-page-shell,
    .userlogs-page-shell {
        height: calc((100vh / var(--app-default-zoom, 1)) - 112px);
    }
}

/* ── 2. Invoice page: uses full-width wrapper instead of page-shell */
.invoice-full-width-page {
    margin: -1rem -0.75rem;
    height: calc(100vh - 112px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 961px) {
    .invoice-full-width-page {
        height: calc((100vh / var(--app-default-zoom, 1)) - 112px);
    }
}

.invoice-full-width-content {
    padding: 0.35rem;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.invoice-page-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ── 3. Top section: sticky filter bar ─────────────────────────── */
.repairjobs-top-section,
.workorders-top-section,
.inventory-top-section,
.customers-top-section,
.subcustomers-top-section,
.invoice-top-section,
.ssr-top-section,
.userlogs-top-section {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--mud-palette-background);
}

/* ── 4. Table shell: flex-grow to fill remaining height ─────────── */
.repairjobs-table-shell,
.workorders-table-shell,
.inventory-table-shell,
.customers-table-shell,
.subcustomers-table-shell,
.invoice-table-shell,
.ssr-table-shell,
.userlogs-table-shell {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ── 5. Table scroll wrapper: flex column, overflow hidden ──────── */
.repairjobs-table-scroll,
.workorders-table-scroll,
.inventory-table-scroll,
.customers-table-scroll,
.subcustomers-table-scroll,
.invoice-table-scroll,
.ssr-table-scroll,
.userlogs-table-scroll {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* ── 6. MudTable component root: flex column ────────────────────── */
.repair-jobs-table,
.workorders-list-table,
.inventory-list-table,
.customers-grid,
.subcustomers-grid,
.invoice-list-table,
.ssr-list-table,
.userlogs-list-table {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* ── 7. mud-table-container: scrollable, fills remaining height ─── */
.repairjobs-table-scroll .mud-table-container,
.workorders-table-scroll .mud-table-container,
.inventory-table-scroll .mud-table-container,
.customers-table-scroll .mud-table-container,
.subcustomers-table-scroll .mud-table-container,
.invoice-table-scroll .mud-table-container,
.ssr-table-scroll .mud-table-container,
.userlogs-table-scroll .mud-table-container {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-height: none;
    overflow: auto !important;
    scrollbar-width: thin;
}

/* ── 8. Table element: fill container width ─────────────────────── */
.repair-jobs-table .mud-table-table {
    min-width: 1000px;
    width: max(100%, 1000px);
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.workorders-list-table .mud-table-table {
    min-width: 1000px;
    width: max(100%, 1000px);
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.inventory-list-table .mud-table-table {
    min-width: 900px;
    width: max(100%, 900px);
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.invoice-list-table .mud-table-table {
    min-width: 1120px;
    width: max(100%, 1120px);
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.ssr-list-table .mud-table-table {
    min-width: 1080px;
    width: max(100%, 1080px);
    border-collapse: separate;
    border-spacing: 0;
}

/* ── 9. Sticky table header ─────────────────────────────────────── */
.repair-jobs-table .mud-table-container thead th,
.repair-jobs-table .mud-table-head .mud-table-cell,
.workorders-list-table .mud-table-container thead th,
.workorders-list-table .mud-table-head .mud-table-cell,
.inventory-list-table .mud-table-container thead th,
.inventory-list-table .mud-table-head .mud-table-cell,
.invoice-list-table .mud-table-container thead th,
.invoice-list-table .mud-table-head .mud-table-cell,
.ssr-list-table .mud-table-container thead th,
.ssr-list-table .mud-table-head .mud-table-cell,
.userlogs-list-table .mud-table-container thead th,
.userlogs-list-table .mud-table-head .mud-table-cell {
    position: sticky !important;
    top: 0 !important;
    z-index: 6;
    background: linear-gradient(180deg, #f8fbff, #eef4fb) !important;
    box-shadow: inset 0 -1px #dbe4f0;
}

/* customers uses MudDataGrid */
.customers-grid .mud-table-container thead th,
.customers-grid .mud-table-head .mud-table-cell,
.subcustomers-grid .mud-table-container thead th,
.subcustomers-grid .mud-table-head .mud-table-cell {
    position: sticky !important;
    top: 0 !important;
    z-index: 6;
    background: linear-gradient(180deg, #f8fbff, #eef4fb) !important;
    box-shadow: inset 0 -1px #dbe4f0;
}

/* ── 10. Mobile: revert to natural height ───────────────────────── */
@media (max-width: 960px) {
    .repairjobs-page-shell,
    .workorders-page-shell,
    .inventory-page-shell,
    .customers-page-shell,
    .subcustomers-page-shell,
    .ssr-page-shell,
    .userlogs-page-shell {
        height: auto;
        overflow: visible;
    }

    .invoice-full-width-page {
        height: auto;
        overflow: visible;
    }

    .invoice-page-shell {
        height: auto;
        overflow: visible;
    }

    .repairjobs-top-section,
    .workorders-top-section,
    .inventory-top-section,
    .customers-top-section,
    .subcustomers-top-section,
    .invoice-top-section,
    .ssr-top-section,
    .userlogs-top-section {
        position: static;
    }

    .repairjobs-table-scroll .mud-table-container,
    .workorders-table-scroll .mud-table-container,
    .inventory-table-scroll .mud-table-container,
    .customers-table-scroll .mud-table-container,
    .subcustomers-table-scroll .mud-table-container,
    .invoice-table-scroll .mud-table-container,
    .ssr-table-scroll .mud-table-container,
    .userlogs-table-scroll .mud-table-container {
        max-height: none;
        min-width: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   END LIST PAGE LAYOUT
   ═══════════════════════════════════════════════════════════════════ */

#blazor-error-ui {
    color-scheme: light only;
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgb(0 0 0 / 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }


/* ===== DASHBOARD FILTER ENHANCEMENTS ===== */

.dashboard-page-shell {
    overflow: visible;
}

.dashboard-top-section {
    overflow: visible;
    background: var(--mud-palette-background);
}

.dashboard-filter-shell {
    background: var(--app-surface-bg);
    border: 1px solid var(--app-surface-border);
    border-radius: var(--app-border-radius-lg);
    box-shadow: var(--app-shadow-xs);
}

.dashboard-filter-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
}

.dashboard-filter-date {
    flex: 0 0 180px;
    min-width: 0;
}

.dashboard-filter-date > * {
    width: 100%;
}

.dashboard-filter-action {
    flex: 0 0 130px;
}

/* ===== KPI BREAKDOWN TWO ROWS ===== */

.kpi-breakdown-list--two-rows {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--app-spacing-xs);
    margin-top: var(--app-spacing-xs);
}

/* ===== DASHBOARD DROPDOWN POSITIONING ===== */

/* Anchor wrapper for autocomplete dropdowns outside page-shell overflow:hidden context. */
.detail-autocomplete-anchor {
    position: relative;
}

/* ===== POPOVER / DROPDOWN Z-INDEX & POINTER EVENTS ===== */

/* MudBlazor popover provider — ensure the container doesn't block events */
#mudblazor-popover-provider {
    pointer-events: none;
}

/* Fix: dropdowns scroll with the page when html{zoom} is applied (Chromium bug).
 * Setting position:fixed on the cascading-value wrapper anchors each popover
 * to the viewport so it stays put regardless of page scroll.
 * Source: https://stackoverflow.com/a/79195740
 */
.mud-popover-cascading-value {
    position: fixed;
}

/* All popover content must be clickable and above everything */
#mudblazor-popover-provider .mud-popover-open,
#mudblazor-popover-provider .mud-popover {
    pointer-events: auto !important;
    z-index: 1500 !important;
}

/* Packing type select popover — must be above page content */
.packing-type-popover {
    z-index: 1500 !important;
    pointer-events: auto !important;
}

/* Override MudBlazor dialog z-index so popovers (dropdowns) appear above dialogs */
:root {
    --mud-zindex-dialog: 1200;
    --mud-zindex-popover: 1500;
}

/* Dialog overlay must NOT block popovers that are above it */
.mud-overlay-dialog {
    z-index: 1199 !important;
}

body .mud-list.mud-list-padding {
    padding: var(--app-spacing-xs) 0 !important;
}

/* Dropdown list padding */
body .mud-popover-open .mud-list {
    padding: 4px 0 !important;
}

body .mud-popover-open .mud-list-item-text {
    padding: 6px 14px !important;
}

body .mud-popover-open .mud-list-item {
    padding-left: 14px !important;
    padding-right: 14px !important;
    min-height: 38px !important;
}

/* ===== LATEST INVOICE CHIP ENHANCEMENTS ===== */

.latest-invoice-chip {
    font-size: 11px !important;
    height: 24px !important;
    padding: 0 var(--app-spacing-sm) !important;
    white-space: nowrap;
    background: transparent !important;
    border: none !important;
    color: var(--app-text-secondary) !important;
}

.latest-invoice-chip-green {
    color: var(--app-success) !important;
    border: none !important;
}

.latest-invoice-chip-green .mud-icon-root {
    color: var(--app-success) !important;
}

.latest-invoice-chip .mud-icon-root {
    color: var(--app-text-muted) !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.dashboard-panel {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* ===== INVOICE KPI GRID ENHANCEMENTS ===== */

.invoice-kpi-grid {
    width: 100%;
}

.invoice-kpi-grid > .mud-grid-item {
    display: flex;
}

.invoice-kpi-grid .dashboard-card-link {
    width: 100%;
    height: 100%;
}

.invoice-kpi-grid .dashboard-card-link .app-surface,
.invoice-kpi-grid .dashboard-card-link .mud-card {
    height: 100%;
    width: 100%;
}

/* ===== RESPONSIVE DASHBOARD ADJUSTMENTS ===== */

@media (max-width: 1200px) {
    .dashboard-filter-row {
        gap: var(--app-spacing-sm);
    }
    
    .dashboard-filter-action {
        margin-left: 0;
        flex: 1 1 auto;
    }
}

@media (max-width: 960px) {
    .dashboard-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .app-filter-cell {
        flex: 1 1 auto;
        width: 100%;
    }
    
    .dashboard-filter-action {
        width: 100%;
    }
    
    .dashboard-filter-action .mud-button-root {
        width: 100%;
    }
}

/* ===== DASHBOARD TITLE ROW ===== */

.dashboard-title-row {
    margin-bottom: 0 !important;
}

.dashboard-title-row .app-page-title {
    margin: 0 !important;
}

@media (max-width: 960px) {
    .dashboard-title-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: var(--app-spacing-md);
    }
    
    .dashboard-title-row .flex-wrap {
        width: 100%;
        justify-content: flex-start !important;
    }
}
