:root {
    --wash-blue: #1e5a8a;
    --wash-blue-mid: #2f74a8;
    --wash-blue-soft: #5c87b2;
    --wash-yellow: #f0c400;
    --wash-ink: #1a2330;
    --wash-muted: #5c6b7a;
    --wash-line: #d7e0e8;
    --wash-card: rgba(255, 255, 255, 0.94);
}

html, body {
    font-family: 'Barlow', 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    color: var(--wash-muted);
    height: 100%;
    overflow: hidden;
    background-color: #f4f7fa;
    background-image: url('../images/background.jpg');
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
}

#app {
    height: 100%;
    overflow: hidden;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--wash-blue-mid);
}

.btn-primary {
    color: #fff;
    background-color: var(--wash-blue-mid);
    border-color: var(--wash-blue);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--wash-blue);
    border-color: var(--wash-blue);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(47, 116, 168, 0.25);
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* —— Login —— */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-header {
    width: 100%;
    background: linear-gradient(90deg, #2a6fa3 0%, #7eb0d4 55%, #e8f2f8 100%);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.login-header-inner {
    width: min(1280px, 100%);
    height: clamp(88px, 14vw, 140px);
    margin: 0 auto;
    background-image: url('../images/wash-top-logo.png');
    background-repeat: no-repeat;
    background-position: left center;
    background-size: auto 100%;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.25rem 3rem;
}

.login-card {
    width: min(26rem, 100%);
    padding: 2rem 2rem 1.75rem;
    background: var(--wash-card);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1rem;
    box-shadow:
        0 1px 2px rgba(26, 35, 48, 0.04),
        0 18px 40px rgba(26, 35, 48, 0.12);
    backdrop-filter: blur(8px);
    animation: login-rise 0.45s ease-out;
}

@keyframes login-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card-mark {
    width: 3.25rem;
    height: 3.25rem;
    display: grid;
    place-items: center;
    margin-bottom: 1.25rem;
    border-radius: 0.85rem;
    color: var(--wash-blue);
    background: linear-gradient(145deg, #e8f3fb 0%, #f7fbfe 100%);
    border: 1px solid #d5e6f3;
}

.login-card h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--wash-ink);
}

.login-lead {
    margin: 0.35rem 0 1.5rem;
    color: var(--wash-muted);
    font-size: 0.98rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--wash-ink);
}

.login-input.form-control {
    border: 1px solid var(--wash-line);
    border-radius: 0.65rem;
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input.form-control:focus {
    border-color: var(--wash-blue-soft);
    box-shadow: 0 0 0 3px rgba(92, 135, 178, 0.2);
}

.login-error {
    margin: 0;
    padding: 0.7rem 0.85rem;
    border-radius: 0.65rem;
    background: #fdecee;
    color: #9b1c2e;
    font-size: 0.92rem;
}

.login-submit {
    margin-top: 0.35rem;
    width: 100%;
    border: none;
    border-radius: 0.65rem;
    padding: 0.8rem 1rem;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.01em;
    color: #fff;
    background: linear-gradient(180deg, var(--wash-blue-mid) 0%, var(--wash-blue) 100%);
    transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.login-submit:hover:not(:disabled) {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.login-submit:disabled {
    opacity: 0.7;
}

.company-block h2 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
    color: var(--wash-ink);
}

.site-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.current-site {
    font-size: 0.9rem;
}

.nav-item .btn.btn-link.nav-link {
    width: 100%;
    text-align: left;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.75rem 1rem;
}

.nav-item .btn.btn-link.nav-link:hover {
    color: #fff;
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--wash-blue-mid);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

@media (max-width: 640px) {
    .login-header-inner {
        background-position: left top;
    }

    .login-card {
        padding: 1.5rem;
    }
}

/* —— Main shell —— */
.mud-layout {
    height: 100% !important;
    max-height: 100vh;
    overflow: hidden;
}

.wash-main {
    height: calc(100vh - 48px) !important;
    max-height: calc(100vh - 48px);
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column;
    background: transparent;
}

.wash-main > .impersonation-banner + .wash-content,
.wash-main > .wash-content {
    flex: 1 1 auto;
    min-height: 0;
}

.appbar-meta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    max-width: min(560px, 70vw);
    min-width: 0;
}

.appbar-meta-item {
    min-width: 0;
}

.appbar-meta-user {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.appbar-user-icon {
    opacity: 0.9;
    flex: 0 0 auto;
}

.appbar-meta-label {
    opacity: 0.8;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appbar-meta-value {
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appbar-meta-divider {
    width: 1px;
    align-self: stretch;
    background: rgba(255, 255, 255, 0.35);
}

.drawer-brand {
    min-width: 0;
}

.mud-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.nav-user-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex: 0 0 auto;
}

.nav-user-name {
    line-height: 1.25;
    word-break: break-word;
}

.impersonation-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: #fff3cd;
    color: #5c4a00;
    border-bottom: 1px solid #e6d48a;
    flex: 0 0 auto;
}

@media (max-width: 720px) {
    .appbar-meta-item:first-child {
        display: none;
    }
}

.wash-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.wash-panel {
    width: 100%;
    box-sizing: border-box;
    padding: 0.85rem 1rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 0.85rem;
    box-shadow:
        0 1px 2px rgba(26, 35, 48, 0.05),
        0 16px 36px rgba(26, 35, 48, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--wash-ink);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wash-panel .mud-typography,
.wash-panel .mud-input-label,
.wash-panel .mud-input-slot {
    color: inherit;
}

.wash-panel .mud-input-control,
.wash-panel .mud-select,
.wash-panel .mud-text-field,
.wash-panel .mud-paper,
.wash-panel .mud-table-container,
.wash-panel .mud-alert {
    background-color: #fff;
}

.wash-panel .mud-alert {
    border-radius: 0.65rem;
}

.wash-panel .start-period-select,
.wash-panel .start-chart-panel {
    background: #fff;
}

/* —— Customers: fit viewport, page via pager (no document scroll) —— */
.customers-page {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.customers-page-header {
    flex: 0 0 auto;
    overflow: visible;
    position: relative;
    z-index: 3;
}

.customers-page-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.invoices-filters {
    display: grid;
    grid-template-columns: minmax(160px, 1.2fr) minmax(150px, 1.2fr) minmax(110px, 0.8fr) minmax(120px, 0.9fr) 168px 168px auto;
    gap: 0.5rem 0.65rem;
    align-items: end;
}

.invoices-filter-date {
    width: 168px;
    min-width: 168px;
    max-width: 168px;
}

.invoices-filter-date .mud-input-slot,
.invoices-filter-date input {
    letter-spacing: 0;
}

.invoices-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    padding-bottom: 0.15rem;
}

@media (max-width: 1200px) {
    .invoices-filters {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }

    .invoices-filter-date {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .invoices-filter-actions {
        grid-column: 1 / -1;
    }
}

.customers-page-loading {
    flex: 1;
    display: grid;
    place-items: center;
}

.customers-page-grid .customers-table,
.customers-page-grid .mud-table,
.customers-page-grid .mud-table-container {
    height: 100% !important;
    max-height: 100%;
}

.customers-page-grid .mud-table-container {
    overflow-y: auto !important;
}

.customers-page-footer {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.15rem;
}

.edit-page {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 0.5rem;
}

.edit-page-header,
.edit-page-actions {
    flex: 0 0 auto;
}

.edit-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding-top: 0.35rem;
    border-top: 1px solid var(--wash-line);
}

.edit-page-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.edit-page-body--scroll {
    overflow: auto;
}

.edit-services-list {
    max-height: 140px;
    overflow: auto;
    margin-top: 0.25rem;
}

.company-transfer--services {
    min-height: 220px;
    max-height: 280px;
}

.customer-find-field {
    width: 100%;
}

.customer-find-field .mud-input-adornment-text {
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    user-select: none;
}

.customer-find-dialog .mud-dialog-content {
    padding-top: 0.5rem;
}

.customer-find-dialog-body {
    display: flex;
    flex-direction: column;
    height: 420px;
    max-height: 60vh;
    min-height: 320px;
}

.customer-find-dialog-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--wash-line);
    border-radius: 0.35rem;
    background: #fff;
}

.customer-find-dialog-footer {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.customer-find-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    line-height: 1.25;
}

.card-site-panels {
    margin-top: 0.25rem;
}

.card-site-panels .mud-expand-panel {
    margin-bottom: 0.35rem;
}

/* Outlined floating labels sit on the top border and get clipped without room. */
.card-site-panels .mud-expand-panel-content {
    padding-top: 1rem !important;
    padding-bottom: 0.75rem !important;
    overflow: visible !important;
}

.card-site-panels .mud-collapse,
.card-site-panels .mud-collapse-wrapper,
.card-site-panels .mud-collapse-container {
    overflow: visible !important;
}

.invoice-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-row {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(90px, 0.7fr) minmax(80px, 0.6fr) minmax(110px, 0.9fr) minmax(100px, 0.8fr) auto;
    gap: 0.65rem;
    align-items: end;
}

.invoice-row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding-bottom: 0.1rem;
}

.invoice-add-row-btn.mud-button-root {
    align-self: flex-start;
    min-height: 40px !important;
    height: auto !important;
    padding: 0.5rem 1.1rem !important;
    line-height: 1.25 !important;
    white-space: nowrap;
}

.invoice-linked-field {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 8px;
}

.invoice-linked-field .invoice-linked-input {
    flex: 1 1 auto;
    min-width: 0;
}

.invoice-linked-field .invoice-linked-input.mud-input-control,
.invoice-linked-field .invoice-linked-input .mud-input-control {
    margin-top: 0 !important;
}

.invoice-linked-btn.mud-button-root {
    flex: 0 0 auto;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 0.9rem !important;
}

@media (max-width: 900px) {
    .invoice-row {
        grid-template-columns: 1fr 1fr;
    }

    .invoice-row-service {
        grid-column: 1 / -1;
    }

    .invoice-row-actions {
        justify-content: flex-start;
    }
}

.edit-page-fields {
    flex: 0 0 auto;
}

.edit-page .mud-input-control {
    margin-top: 8px !important;
}

.company-transfer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem 0.75rem;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
}

.company-transfer-pane {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.company-transfer-list {
    flex: 1 1 auto;
    min-height: 100px;
    height: auto !important;
    max-height: none;
    overflow: auto;
}

.company-transfer-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.15rem;
    padding-top: 1.5rem;
}

.company-transfer-item {
    cursor: pointer;
}

.company-transfer-item--selected {
    background: rgba(30, 90, 138, 0.12);
}

@media (max-width: 960px) {
    .company-transfer {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .company-transfer-actions {
        flex-direction: row;
        padding-top: 0;
    }

    .company-transfer-list {
        min-height: 140px;
        max-height: 180px;
    }

    .edit-page-body {
        overflow: auto;
    }
}

.nav-site-select {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 0.5rem;
}

.nav-site-select .mud-input-control {
    margin-top: 0;
}

.nav-site-select .mud-input {
    color: #fff;
}

.login-title {
    margin: 0;
    color: var(--wash-ink);
}

/* —— Revenue chart (Skumpa-style) —— */
.start-charts {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

.start-charts-toolbar {
    flex: 0 0 auto;
    max-width: 320px;
}

.start-period-select {
    width: 100%;
    background: var(--wash-card);
    border-radius: 0.5rem;
}

.start-chart-panel {
    width: 100%;
    flex: 1 1 auto;
    min-height: 700px;
    min-width: 0;
    overflow: hidden;
    background: var(--wash-card);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 0.85rem;
    box-shadow:
        0 1px 2px rgba(26, 35, 48, 0.04),
        0 12px 28px rgba(26, 35, 48, 0.08);
    padding: 0.75rem 0.75rem 1rem;
}

.start-chart-with-toplista {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.75rem;
}

.start-chart-plot {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 700px;
    overflow: visible;
}

.start-chart-plot > div,
.revenue-chart-wrap {
    height: 100% !important;
    min-height: 700px !important;
}

.revenue-chart-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.revenue-chart-wrap > .apexcharts-svg,
.revenue-chart-wrap > div:first-child {
    flex: 1 1 auto;
    min-height: 0;
}

.revenue-chart-wrap.is-daily > div:first-child {
    min-height: 640px !important;
    height: auto !important;
    flex: 1 1 auto;
}

.revenue-day-axis {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    /* Align under plot area (approx. y-axis + title width). */
    padding: 0.15rem 0.5rem 0.35rem 4.25rem;
    box-sizing: border-box;
    gap: 0;
    color: #1a2330;
    font-size: 10px;
    line-height: 1.1;
    user-select: none;
}

.revenue-day-axis-tick {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    overflow: hidden;
}

.start-chart-panel .apexcharts-canvas {
    max-width: 100% !important;
}

.start-chart-panel .apexcharts-xaxis text,
.start-chart-panel .apexcharts-xaxis-label {
    pointer-events: none;
}

.start-toplista {
    flex: 0 0 320px;
    max-width: 360px;
    min-width: 240px;
    overflow: auto;
    padding: 0.15rem 0.25rem 0.5rem 0.35rem;
    box-sizing: border-box;
}

.start-toplista-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.55rem 0;
    color: var(--wash-ink);
}

.start-toplista-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.start-toplista-row {
    margin: 0;
    padding: 0;
}

.start-toplista-toggle {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    width: 100%;
    margin: 0;
    padding: 0.1rem 0.15rem;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 12px;
    line-height: 1.35;
    color: var(--wash-ink);
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
}

.start-toplista-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

.start-toplista-row.is-hidden .start-toplista-toggle {
    opacity: 0.4;
    text-decoration: line-through;
}

.start-toplista-swatch {
    flex: 0 0 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    align-self: center;
}

.start-toplista-rank {
    flex: 0 0 auto;
    font-weight: 700;
    min-width: 1.4em;
}

.start-toplista-text {
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 960px) {
    .start-chart-with-toplista {
        flex-direction: column;
    }

    .start-toplista {
        flex: 0 0 auto;
        max-width: none;
        width: 100%;
    }

    .start-chart-plot,
    .start-chart-plot > div {
        min-height: 480px;
    }
}

