html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* Tightens MudBlazor form controls so the long order and client forms fit on one screen. */
.compact-form .mud-input-control {
    margin-top: 4px;
    margin-bottom: 4px;
}

.compact-form .mud-input-control .mud-input.mud-input-text {
    font-size: 0.9rem;
}

.compact-form .mud-input-control-helper-text {
    margin-top: 1px;
}

.compact-grid .mud-table-container {
    overflow-x: hidden;
}

.compact-grid .mud-table-cell {
    font-size: 0.82rem;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding-top: 6px;
    padding-bottom: 6px;
}

.compact-grid .mud-table-head .mud-table-cell {
    font-size: 0.78rem;
    font-weight: 600;
}

.compact-grid .column-header {
    min-width: 0;
}

.planned-date-today {
    color: #0d6efd;
    font-weight: 600;
}

.planned-date-overdue-week {
    color: #fd7e14;
    font-weight: 600;
}

.planned-date-overdue {
    color: #dc3545;
    font-weight: 600;
}

.order-detail-page .mud-paper {
    font-size: 0.9rem;
}

.order-detail-page .mud-paper .mud-typography-h6 {
    font-size: 1rem;
}

.qr-bill-layout {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(400px, 2fr);
    border: 1px solid #777;
}

.qr-bill-layout > section {
    padding: 1rem;
}

.qr-bill-receipt {
    border-right: 1px solid #777;
}

.qr-bill-code {
    width: 250px;
    max-width: 100%;
    height: auto;
}

.qr-bill-print-title {
    display: none;
}

@media print {
    body * {
        visibility: hidden;
    }

    .qr-bill-print, .qr-bill-print * {
        visibility: visible;
    }

    .qr-bill-print {
        position: absolute;
        inset: 0;
        width: 100%;
    }

    .qr-bill-no-print {
        display: none !important;
    }

    .qr-bill-print-title {
        display: block;
    }

    .qr-bill-layout {
        grid-template-columns: 1fr 2fr;
        break-inside: avoid;
    }
}

@media (max-width: 700px) {
    .qr-bill-layout {
        grid-template-columns: 1fr;
    }

    .qr-bill-receipt {
        border-right: 0;
        border-bottom: 1px solid #777;
    }
}

.order-detail-page .mud-table-root .mud-table-cell {
    font-size: 0.86rem;
    line-height: 1.3;
}

.order-detail-page .mud-input-control,
.order-detail-page .mud-button-root {
    font-size: 0.86rem;
}

.order-general-fields .mud-input,
.order-general-fields .mud-input-slot,
.order-general-fields .mud-typography-body1 {
    font-size: 0.86rem;
}

.order-vehicle-grid .mud-table-root {
    width: 100%;
    table-layout: fixed;
}

.order-compact-layout .mud-table-root .mud-table-cell {
    padding: 2px 8px;
}

.order-compact-layout .mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
}

.order-compact-layout .mud-input.mud-input-outlined .mud-input-slot {
    padding: 6px 8px;
}

/* Multi-line notes need more room than the compact single-line inputs, or text touches and clips at the border. */
.order-compact-layout .mud-input.mud-input-outlined textarea.mud-input-slot {
    padding: 10px 12px;
    line-height: 1.5;
}

.order-compact-layout .mud-input-adornment .mud-icon-button,
.order-compact-layout .mud-checkbox .mud-icon-button {
    padding: 4px;
}

.order-vehicle-grid .mud-table-cell:first-child {
    width: 42%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.order-vehicle-grid .mud-stack > .mud-input-control {
    min-width: 0;
}

@media (min-width: 960px) {
    .order-overview-grid > .order-overview-general {
        flex-basis: 60%;
        max-width: 60%;
    }

    .order-overview-grid > .order-overview-progress {
        flex-basis: 40%;
        max-width: 40%;
    }
}

.photo-thumbnail {
    cursor: zoom-in;
    position: relative;
}

/* The photo's position in the report, top left on the thumbnail. */
.photo-position {
    position: absolute;
    top: 10px;
    left: 10px;
    min-width: 1.6rem;
    padding: 0 0.35rem;
    border-radius: 0.8rem;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.6rem;
    text-align: center;
}

.photo-thumbnail img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    border: 12px solid #d6d6d6;
}

/* Always two photos per line, matching the report layout; capped so wide screens stay dense. */
.photo-drop-zone {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-height: 120px;
    max-width: 880px;
}

.photo-drop-zone .photo-thumbnail img {
    height: auto;
    aspect-ratio: 4 / 3;
    border-width: 6px;
}

.photo-drop-item {
    cursor: grab;
    border: 1px solid var(--mud-palette-lines-default);
}

.photo-drag-handle {
    color: var(--mud-palette-text-secondary);
}

/* Move, title, zoom, download and delete fit narrow cards by wrapping instead of overflowing. */
.photo-drop-item .mud-card-actions {
    flex-wrap: wrap;
    row-gap: 2px;
    padding: 4px;
}

.photo-viewer {
    display: flex;
    flex-direction: column;
    max-width: 94vw;
    padding: 12px;
    border-radius: 4px;
    background: var(--mud-palette-surface);
    cursor: default;
}

.photo-viewer img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    align-self: center;
}

.photo-viewer-pdf {
    width: min(900px, 90vw);
    height: 80vh;
    border: 0;
}

.photo-viewer-comment {
    white-space: pre-line;
}

/* Static hint from startup-check.js when the live server connection never starts. */
#lhk-startup-error:not([hidden]) {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    padding: 12px 16px;
    background: #8a1c1c;
    color: #fff;
    font-size: 0.95rem;
}

#lhk-startup-error a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

/* List tables (Aufträge, Auftraggeber, Benutzer, Verlauf) share the order list's look: many narrow columns, so a
   smaller font; the table scrolls sideways on phones instead of clipping.
   The selectors repeat MudBlazor's own (body/head + cell) so they win on order. */
.list-grid .mud-table-container {
    overflow-x: auto;
}

/* compact-grid breaks words anywhere; with many narrow columns that splits headers like "Datum". */
.list-grid .mud-table-cell {
    overflow-wrap: normal;
    word-break: normal;
}

.list-grid .mud-table-head .mud-table-cell {
    white-space: nowrap;
}

.list-grid .mud-table-body .mud-table-cell {
    font-size: 0.72rem;
    line-height: 1.2;
    padding: 4px 6px;
}

.list-grid .mud-table-head .mud-table-cell {
    font-size: 0.7rem;
    padding: 4px 6px;
}

.list-grid .nowrap {
    white-space: nowrap;
}

/* Damage tables: edited in place like the desk form. Each row is a grid with the same columns; the share steps get one
   narrow column each, labelled in the header. */
/* Inputs inside dense tables sit flat in their cells: no frame until hovered or edited, little padding. */
.flat-inputs .mud-input.mud-input-outlined .mud-input-outlined-border {
    border-color: transparent;
}

.flat-inputs .mud-input.mud-input-outlined:hover:not(.mud-disabled) .mud-input-outlined-border {
    border-color: var(--mud-palette-lines-inputs);
}

.flat-inputs .mud-input.mud-input-outlined:focus-within:not(.mud-disabled) .mud-input-outlined-border {
    border-color: var(--mud-palette-primary);
}

.flat-inputs .mud-input-root {
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 0.8125rem;
}

.flat-inputs .mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
}

/* Striped rows: every other row tinted, the hovered one lighter, the one being edited marked with the accent colour. */
.striped-row:nth-child(even of .striped-row) {
    background: var(--mud-palette-table-striped);
}

.striped-row:hover {
    background: var(--mud-palette-table-hover);
}

.striped-row:focus-within {
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
    box-shadow: inset 3px 0 0 var(--mud-palette-primary);
}

.damage-table {
    --damage-columns: minmax(10rem, 2fr) minmax(8rem, 1.5fr) 7.5rem calc(var(--share-steps) * 1.6rem) 6.5rem 6.5rem 4.5rem;
    display: grid;
    font-size: 0.8125rem;
}

.damage-table-zoned {
    --damage-columns: minmax(10rem, 2fr) minmax(8rem, 1.5fr) minmax(8rem, 1.5fr) 7.5rem calc(var(--share-steps) * 1.6rem) 6.5rem 6.5rem 4.5rem;
}

.damage-table-readonly {
    --share-steps: 0 !important;
}

.damage-table-row {
    display: grid;
    grid-template-columns: var(--damage-columns);
    align-items: center;
    min-height: 30px;
}

/* Thin column lines like a spreadsheet. */
.damage-table-row > [role="cell"],
.damage-table-row > [role="columnheader"] {
    padding: 0 4px;
    min-width: 0;
    border-right: 1px solid var(--mud-palette-table-lines);
}

.damage-table-row > :last-child,
.damage-table-foot > [role="cell"] {
    border-right: none;
}

.damage-table-head {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    min-height: 24px;
}

.damage-table-foot {
    border-top: 1px solid var(--mud-palette-text-secondary);
    font-weight: 500;
}

.damage-table-number {
    text-align: right;
}

.damage-table .inline-number input {
    text-align: right;
}

.damage-table-shares {
    display: grid;
    grid-template-columns: repeat(var(--share-steps), 1.6rem);
    justify-items: center;
    align-items: center;
}

.damage-share-step {
    display: contents;
    cursor: pointer;
}

.damage-share-step span {
    display: none;
}

.damage-table-actions {
    display: flex;
    justify-content: flex-end;
}

.damage-table-zone-line {
    grid-column: 1 / -1;
    max-width: 20rem;
}

/* The empty row for the next position: set apart by a dashed line, never striped. */
.damage-table-new {
    border-top: 1px dashed var(--mud-palette-lines-inputs);
}

.damage-table .damage-table-new:not(:focus-within) {
    background: transparent;
}

.damage-table-empty {
    padding: 6px 0;
}

/* Below this width each position becomes a card: part on its own line, then the other fields in two columns. */
@media (max-width: 1100px) {
    .damage-table-head {
        display: none;
    }

    .damage-table-row:not(.damage-table-foot) {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        row-gap: 2px;
        padding: 6px 4px;
    }

    .damage-table-row > [role="cell"] {
        border-right: none;
    }

    .damage-table-row > [role="cell"]:first-child,
    .damage-table-shares,
    .damage-table-actions {
        grid-column: 1 / -1;
    }

    .damage-table-row > [data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        color: var(--mud-palette-text-secondary);
        text-align: left;
    }

    .damage-table-shares {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .damage-share-step {
        display: inline-flex;
        align-items: center;
        gap: 3px;
    }

    .damage-share-step span {
        display: inline;
    }

    .damage-table-readonly .damage-table-shares,
    .damage-table-new .damage-table-actions,
    .damage-table-row > [role="cell"]:empty {
        display: none;
    }

    .damage-table-foot {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .damage-table-foot > [role="cell"]:empty {
        display: none;
    }
}

/* Expert signature (transparent PNG with dark ink): shown on white like on paper so it stays readable in the dark theme. */
.expert-signature {
    height: 98px;
    display: flex;
    align-items: flex-end;
    background: #fff;
    border-radius: 4px;
    padding: 4px 8px;
}

.expert-signature img {
    max-height: 90px;
    max-width: 100%;
    object-fit: contain;
}

/* Right-aligned number columns in simple tables (MudBlazor ships no text-right utility and its cell rule is more specific). */
.text-right,
.mud-simple-table table th.text-right,
.mud-simple-table table td.text-right {
    text-align: right !important;
}

/* Anleitung: readable line length and spacing inside the collapsible chapters. */
.manual-text {
    max-width: 75ch;
}

.manual-text p,
.manual-text ul {
    margin-bottom: 0.75rem;
}

.manual-text ul {
    padding-left: 1.25rem;
    list-style: disc;
}

.manual-text li {
    margin-bottom: 0.35rem;
}

/* Every table reads like the order table: small text, bold small headers, tight rows. */
.mud-table .mud-table-cell {
    font-size: 0.82rem;
    line-height: 1.25;
}

.mud-table .mud-table-head .mud-table-cell {
    font-size: 0.78rem;
    font-weight: 600;
}

.mud-table-dense .mud-table-cell {
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Tab labels and form fields follow the same scale. */
.mud-tab {
    font-size: 0.78rem;
}

.mud-input,
.mud-input-label {
    font-size: 0.82rem;
}

/* MudBlazor gives inputs the subtitle1 style, which the theme makes semi-bold for headings; field text stays normal. */
.mud-input.mud-typography-subtitle1 {
    font-weight: var(--mud-typography-body1-weight);
}

/* Document tabs (Eurotax, Audatex, Fotodokumentation): title, then upload field, then content. */
.document-section-title {
    margin-bottom: 0.75rem;
}

.document-section-title .document-section-hint {
    display: block;
    color: var(--mud-palette-text-secondary);
}

.document-card {
    margin-top: 0.75rem;
}

/* Verlauf: long values wrap within their own line, also in the phone card layout. */
.audit-grid .mud-table-body .mud-table-cell {
    min-width: 0;
}

.audit-grid .audit-change {
    overflow-wrap: anywhere;
    white-space: normal;
}

.audit-grid .audit-change + .audit-change {
    margin-top: 2px;
}

/* In the phone card layout each cell is a flex row; keep a cell's lines stacked in one block. */
.audit-grid .audit-cell {
    min-width: 0;
    text-align: left;
}

/* Bereifung: tyres supplied and mounted set on the left, one row per season (rim, method with tread depths, brand and size). */
.tyre-layout {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 8px;
}

.tyre-sets {
    display: grid;
    gap: 8px;
}

/* Dense like the other order tabs: no extra space around the outlined inputs. */
.tyre-layout .mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
}

/* Two parts: a narrow column with season, rim and tread depths, and the axles taking the remaining width. */
.tyre-row {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.tyre-side {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 16px;
    border-right: 1px solid var(--mud-palette-lines-default);
}

.tyre-side-title {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tyre-side-title .tyre-season {
    flex: 1;
}

.tyre-readonly {
    overflow-x: auto;
}

.tyre-side-label {
    color: var(--mud-palette-text-secondary);
}

/* Tread depths as seen from above: right side on top, left side below, the arrow pointing to the front. */
.tyre-treads {
    display: grid;
    grid-template-columns: auto 3.5rem 3.5rem auto;
    justify-content: start;
    align-items: center;
    gap: 2px 6px;
}

.tyre-axle-label {
    font-weight: 600;
}

.tyre-treads .tyre-tread {
    margin: 0;
}

.tyre-treads .tyre-tread input {
    text-align: center;
}

.tyre-add-sets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* The arrow points to the front (V). */
.tyre-arrow {
    grid-column: span 2;
    height: 2px;
    margin: 4px 0;
    background: var(--mud-palette-text-primary);
    position: relative;
}

.tyre-arrow::before {
    content: "";
    position: absolute;
    left: -2px;
    top: -5px;
    border: 6px solid transparent;
    border-right-color: var(--mud-palette-text-primary);
    border-left-width: 0;
}

/* Load per tyre and maximum speed from the dimension's service description, one below the other. */
.tyre-max {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 5.5rem;
    white-space: nowrap;
    line-height: 1.3;
}

.tyre-axles .tyre-brand,
.tyre-axles .tyre-size {
    min-width: 0;
}

/* Below make and dimension: the DOT number and the production week and age it gives. */
.tyre-production {
    grid-column: span 2;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.tyre-axles {
    display: grid;
    grid-template-columns: auto minmax(0, 2fr) minmax(0, 3fr) auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
}

/* Each axle is a row of the axle grid (subgrid). */
.tyre-axle-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: subgrid;
    align-items: center;
    row-gap: 2px;
    padding: 3px 4px;
}

@media (max-width: 960px) {
    .tyre-layout,
    .tyre-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .tyre-side {
        padding-right: 0;
        border-right: none;
    }
}

/* On a phone each axle stacks: name, make, then dimension with the limits beside it, then DOT and production date. */
@media (max-width: 600px) {
    .tyre-axles {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .tyre-axles .tyre-axle-corner,
    .tyre-axles > .mud-typography-subtitle2 {
        display: none;
    }

    .tyre-axles .tyre-axle-name,
    .tyre-axles .tyre-brand,
    .tyre-axles .tyre-production {
        grid-column: 1 / -1;
    }

    .tyre-axles .tyre-axle-name {
        margin-top: 4px;
        font-weight: 500;
    }
}


/* Abkürzungen: one dense row per entry. */
.abbreviation-table td {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

.abbreviation-table .mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
}

/* Listenverwaltung: the same rows as the Abkürzungen; the chosen area is marked. */
.catalog-table-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.catalog-table tr.catalog-selected td {
    box-shadow: inset 3px 0 0 var(--mud-palette-primary);
}

.catalog-table tr.catalog-selected td + td {
    box-shadow: none;
}
