/* =====================================================================================================
   KMT Produktionsmanager — "Leitstand" design language
   Graphite chrome with a KMT signal-orange edge, an aluminium work surface, flat sheet panels with hairline
   edges, signal colours (green / amber / red) ONLY for status, orange ONLY for "here / now", DIN lettering
   (Bahnschrift ships with Windows). The MudBlazor theme in Components/Layout/KmtTheme.cs carries the same values.
   ===================================================================================================== */

:root {
    --kmt-graphite: #25272A;
    --kmt-graphite-2: #2F3236;
    --kmt-graphite-3: #3A3E43;
    --kmt-orange: #F39200;
    --kmt-alu: #ECEEF1;
    --kmt-sheet: #FFFFFF;
    --kmt-sheet-2: #F6F7F9;
    --kmt-edge: #D8DCE2;
    --kmt-edge-soft: #E6E9ED;
    --kmt-ink: #1F2226;
    --kmt-steel: #5E6671;
    --kmt-steel-light: #8C939C;
    --kmt-green: #2E9D5B;
    --kmt-amber: #E09F10;
    --kmt-red: #D64541;
    --kmt-blue: #2F6FB3;
    --kmt-din: Bahnschrift, "DIN Alternate", "DIN Next", Roboto, "Segoe UI", Arial, sans-serif;
    --kmt-radius: 8px;
    --kmt-radius-sm: 6px;
    /* Shadows only for things that float above the page (menus, dialogs, the live notice). */
    --kmt-float: 0 16px 40px rgba(20, 22, 25, 0.20), 0 2px 8px rgba(20, 22, 25, 0.10);
}

/* ---- Base ------------------------------------------------------------------------------------------ */

body {
    font-family: var(--kmt-din);
    background: var(--kmt-alu);
    color: var(--kmt-ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

:is(a, button, .mud-button-root, .mud-nav-link, .mud-tab):focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: 2px;
}

/* After every navigation Blazor puts the focus on the page's first heading (FocusOnNavigate in Routes.razor) so screen
   readers start there — that heading is not a control, so no focus frame around it (e.g. the dashboard headline). */
h1:focus,
h1:focus-visible {
    outline: none;
}

/* MudText with Color="Color.Secondary" is used across the portal for muted help texts and sub-lines. With the brand
   orange as the theme's Secondary colour those ~80 texts all turned orange — render them in the muted text colour. */
.mud-typography.mud-secondary-text {
    color: var(--mud-palette-text-secondary) !important;
}

.mud-paper-overflow {
    overflow-x: auto;
}

.mud-container-maxwidth-lg {
    max-width: 100% !important;
}

.mud-ripple-effect {
    background-color: rgba(0, 0, 0, 0) !important;
}

/* ---- Chrome: app bar ---------------------------------------------------------------------------------- */

.kmt-appbar.mud-appbar {
    border-bottom: 2px solid var(--kmt-orange);
}

.kmt-appbar .mud-toolbar {
    gap: 6px;
}

.kmt-appbar__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: 4px;
    color: inherit;
    text-decoration: none;
}

.kmt-appbar__brand img {
    display: block;
    height: 30px;
}

.kmt-appbar__product {
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 15px;
    letter-spacing: 0.02em;
    line-height: 22px;
    color: rgba(255, 255, 255, 0.74);
}

.kmt-appbar__action.mud-button-root {
    color: rgba(255, 255, 255, 0.86);
}

@media (max-width: 700px) {
    .kmt-appbar__product {
        display: none;
    }
}

/* Language switch: always visible DE | HU | EN. */
.kmt-lang {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 6px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.kmt-lang__item {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.66);
    text-decoration: none;
}

.kmt-lang__item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}

.kmt-lang__item--current,
.kmt-lang__item--current:hover {
    color: var(--kmt-graphite);
    background: var(--kmt-orange);
}

/* User menu: initials badge with an orange ring + name. */
.kmt-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.kmt-user:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kmt-user--static {
    padding-left: 8px;
    cursor: default;
}

.kmt-user--static:hover {
    background: none;
}

.kmt-user__avatar {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--kmt-graphite-3);
    box-shadow: inset 0 0 0 1.5px var(--kmt-orange);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #fff;
}

.kmt-user__name {
    max-width: 220px;
    overflow: hidden;
    font-size: 13.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .kmt-user__name {
        display: none;
    }
}

/* The bell (v1.35): the unread count in orange (= new), the panel floats under the app bar. Unread notifications carry
   the orange edge like the active suggestion in the person picker. */
.kmt-bell {
    position: relative;
    display: flex;
    align-items: center;
}

.kmt-bell__button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: rgba(255, 255, 255, 0.86);
    cursor: pointer;
}

.kmt-bell__button:hover,
.kmt-bell__button.is-open {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}

.kmt-bell__count {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--kmt-orange);
    box-shadow: 0 0 0 2px var(--kmt-graphite);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: var(--kmt-graphite);
}

.kmt-bell__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
}

.kmt-bell__panel {
    position: absolute;
    z-index: 2;
    top: calc(100% + 11px);
    right: -6px;
    display: flex;
    flex-direction: column;
    width: min(420px, calc(100vw - 24px));
    max-height: min(600px, calc(100vh - 88px));
    overflow: hidden;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius);
    background: var(--kmt-sheet);
    box-shadow: var(--kmt-float);
    font-family: var(--kmt-din);
    color: var(--kmt-ink);
}

.kmt-bell__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--kmt-edge);
}

.kmt-bell__title {
    font-size: 15px;
    font-weight: 600;
}

.kmt-bell__all {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--kmt-blue);
    cursor: pointer;
}

.kmt-bell__all:hover {
    text-decoration: underline;
}

.kmt-bell__list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.kmt-bell__empty {
    margin: 0;
    padding: 28px 14px;
    text-align: center;
    color: var(--kmt-steel);
}

.kmt-bell__item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid var(--kmt-edge-soft);
    background: none;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

.kmt-bell__item:hover {
    background: var(--kmt-sheet-2);
}

.kmt-bell__item.is-unread {
    box-shadow: inset 3px 0 0 var(--kmt-orange);
}

.kmt-bell__icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--kmt-alu);
    color: var(--kmt-steel);
}

.kmt-bell__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.kmt-bell__text {
    font-size: 14px;
    line-height: 19px;
}

.kmt-bell__item.is-unread .kmt-bell__text {
    font-weight: 600;
}

.kmt-bell__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    font-size: 12.5px;
    line-height: 17px;
    color: var(--kmt-steel);
}

.kmt-bell__excerpt {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 13px;
    line-height: 18px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.kmt-bell__time {
    font-size: 12px;
    line-height: 19px;
    white-space: nowrap;
    color: var(--kmt-steel-light);
}

.kmt-bell__online {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--kmt-edge);
    background: var(--kmt-sheet-2);
}

.kmt-bell__online-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--kmt-steel);
}

.kmt-bell__online-none {
    font-size: 13px;
    color: var(--kmt-steel);
}

.kmt-bell__people {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    max-height: 78px;
    overflow-y: auto;
}

.kmt-bell__person {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    line-height: 20px;
}

/* ---- Chrome: drawer ----------------------------------------------------------------------------------- */

.kmt-drawer.mud-drawer {
    border-right: 0;
}

.kmt-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
}

.kmt-nav.mud-navmenu {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 8px;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
    scrollbar-width: thin;
}

.kmt-nav .mud-nav-link {
    position: relative;
    margin: 1px 0;
    padding: 8px 12px;
    border-radius: var(--kmt-radius-sm);
    font-size: 14px;
    color: var(--mud-palette-drawer-text);
    transition: none;
}

.kmt-nav .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

/* Same weight as MudBlazor's own active-link rules (which paint graphite on graphite here); app.css loads later.
   The current page is marked by the orange edge, the orange icon and white text — no tinted background. */
.mud-navmenu.kmt-nav .mud-nav-link.active:not(.mud-nav-link-disabled),
.mud-navmenu.kmt-nav .mud-nav-link.active:not(.mud-nav-link-disabled):hover:not(.mud-nav-link-disabled),
.mud-navmenu.kmt-nav .mud-nav-link.active:not(.mud-nav-link-disabled):focus-visible:not(.mud-nav-link-disabled) {
    background-color: transparent;
    color: #fff;
    font-weight: 600;
}

.mud-navmenu.kmt-nav .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-nav-link-icon {
    color: var(--kmt-orange);
}

/* "You are here": an orange marker on the drawer edge. */
.kmt-nav .mud-nav-link.active::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: -8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--kmt-orange);
}

.kmt-nav .kmt-nav__rule.mud-divider {
    margin: 10px 8px;
    border-color: rgba(255, 255, 255, 0.08);
}

.kmt-drawer__footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 18px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.kmt-drawer__version {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-family: var(--kmt-din);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.74);
    cursor: pointer;
}

.kmt-drawer__version:hover {
    color: #fff;
}

.kmt-drawer__version:focus-visible {
    border-radius: 4px;
    outline: 2px solid var(--kmt-orange);
    outline-offset: 2px;
}

.kmt-drawer__maker {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.42);
}

/* ---- Work surface --------------------------------------------------------------------------------------- */

.kmt-page.mud-container {
    padding: 24px;
}

/* No sheet behind the pages: a page's outer panel is see-through, so toolbars and grids stand directly on the work
   surface (like the external shipping overview) instead of on a big white sheet. Cards inside a page keep their
   surfaces, and so do outlined panels (e.g. the error and access pages). */
.kmt-page.kmt-page--open > .mud-paper:not(.mud-paper-outlined) {
    padding: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* On the grey surface, text fields get a white field. */
.kmt-page--open .mud-input.mud-input-outlined {
    background: var(--kmt-sheet);
}

/* Tables are sheets of their own: hairline edge instead of the material shadow. */
.kmt-page .mud-table {
    box-shadow: 0 0 0 1px var(--kmt-edge);
}

@media (max-width: 600px) {
    .kmt-page.mud-container {
        padding: 16px 12px;
    }
}

/* Sheet panels: flat, hairline edge. Elevation shadows stay only on floating layers (outside the page). */
.mud-card,
.mud-paper.mud-paper-outlined {
    border: 1px solid var(--kmt-edge);
    box-shadow: none;
}

.kmt-page .mud-paper.mud-elevation-1,
.kmt-page .mud-paper.mud-elevation-2,
.kmt-page .mud-paper.mud-elevation-3,
.kmt-page .mud-paper.mud-elevation-4 {
    box-shadow: 0 0 0 1px var(--kmt-edge);
}

.mud-button-root.mud-button {
    border-radius: var(--kmt-radius-sm);
}

/* A button that doesn't fit moves to the next line as a whole instead of breaking its label. */
.mud-button-root .mud-button-label {
    white-space: nowrap;
}

.mud-button-filled,
.mud-button-filled:hover,
.mud-button-filled:active {
    box-shadow: none;
}

.mud-input.mud-input-outlined .mud-input-outlined-border {
    border-radius: var(--kmt-radius-sm);
}

.mud-tab {
    font-family: var(--kmt-din);
    text-transform: none;
    letter-spacing: 0.01em;
}

/* The active tab is "here", like the orange marker in the menu. */
.mud-tabs .mud-tab-slider {
    background: var(--kmt-orange);
}

.mud-dialog {
    border-radius: 12px;
}

.mud-dialog .mud-dialog-title {
    font-family: var(--kmt-din);
}

/* Tables and data grids: DIN header row on a light sheet, figures in fixed-width digits. */
.mud-table-head .mud-table-cell {
    background-color: var(--kmt-sheet-2);
    border-bottom: 1px solid var(--kmt-edge);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--kmt-steel);
}

.mud-table-cell {
    font-variant-numeric: tabular-nums;
}

/* Collapsed detail rows of the expandable grids are empty — without this each left a white stripe under its row. */
.mud-table-cell.mud-table-child-content:empty {
    padding: 0;
    border-bottom: 0;
}

/* Detail panels of the expandable rows (DetailField): aligned label / value pairs. */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.85rem 1.5rem;
}

.detail-field__label {
    margin-bottom: 0.15rem;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--kmt-steel);
}

.detail-field__value {
    font-size: 14px;
    font-weight: 500;
    color: var(--kmt-ink);
}

.detail-card {
    width: 100%;
    min-width: 100%;
    min-height: 13.75rem;
}

.detail-card__icon {
    width: 40px;
    height: 40px;
    background: var(--kmt-graphite);
    color: #fff;
}

.detail-card__icon--amber {
    background: var(--kmt-orange);
}

/* Danger zone: clearly marks destructive settings / actions. */
.danger-zone {
    border: 1px solid rgba(214, 69, 65, 0.40);
    border-radius: var(--kmt-radius);
    background: rgba(214, 69, 65, 0.04);
}

.dialog-blur-class {
    backdrop-filter: blur(8px);
}

.mud-popover.mud-popover-open.mud-popover-relative-width.overflow-y-auto {
    max-height: 85vh !important;
    overflow-y: auto;
}

/* ---- Dashboard ------------------------------------------------------------------------------------------ */

.dashboard {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
}

.dashboard > * {
    grid-column: 1 / -1;
}

/* The control-room panel. The one bold element of the page. */
.leitstand {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px 28px;
    padding: 22px 28px;
    border-radius: 10px;
    background: var(--kmt-graphite);
    color: #fff;
}

.leitstand__tower {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    background: #17181A;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.leitstand__lamp {
    width: 26px;
    height: 16px;
    border-radius: 4px;
    opacity: 0.16;
}

.leitstand__lamp--red { background: #FF5A52; }
.leitstand__lamp--amber { background: #FFC233; }
.leitstand__lamp--green { background: #3DDC84; }

.leitstand--ok .leitstand__lamp--green,
.leitstand--warn .leitstand__lamp--amber,
.leitstand--error .leitstand__lamp--red {
    opacity: 1;
    animation: kmt-lamp-on 700ms ease-out 150ms both;
}

.leitstand--ok .leitstand__lamp--green { box-shadow: 0 0 14px 2px rgba(61, 220, 132, 0.55); }
.leitstand--warn .leitstand__lamp--amber { box-shadow: 0 0 14px 2px rgba(255, 194, 51, 0.55); }
.leitstand--error .leitstand__lamp--red { box-shadow: 0 0 14px 2px rgba(255, 90, 82, 0.60); }

@keyframes kmt-lamp-on {
    0% { opacity: 0.16; box-shadow: none; }
    35% { opacity: 1; }
    50% { opacity: 0.55; }
    100% { opacity: 1; }
}

.leitstand__headline {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.005em;
}

.leitstand__detail {
    max-width: 62ch;
    margin: 6px 0 0;
    font-size: 14.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.72);
}

.leitstand__checks {
    display: grid;
    grid-template-columns: repeat(4, auto);
    margin: 0;
    border-radius: 8px;
    background: var(--kmt-graphite-2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.leitstand__check {
    padding: 10px 16px 11px;
}

.leitstand__check + .leitstand__check {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.leitstand__check dt {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.58);
    white-space: nowrap;
}

.leitstand__check dt::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6B7380;
}

.leitstand__check--ok dt::before { background: #3DDC84; }
.leitstand__check--warn dt::before { background: #FFC233; }
.leitstand__check--error dt::before { background: #FF5A52; }

.leitstand__check dd {
    margin: 3px 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 1280px) {
    .leitstand {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .leitstand__checks {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .leitstand {
        padding: 18px;
    }

    .leitstand__headline {
        font-size: 22px;
    }

    .leitstand__checks {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .leitstand__check:nth-child(3) {
        border-left: 0;
    }

    .leitstand__check:nth-child(n + 3) {
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .leitstand__check dt,
    .leitstand__check dd {
        white-space: normal;
    }
}

/* Key figures: one ruled block, like the title block of a technical drawing. */
.kennzahlen {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius);
    background: var(--kmt-sheet);
}

.kennzahl {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 20px 18px;
}

.kennzahl + .kennzahl {
    border-left: 1px solid var(--kmt-edge-soft);
}

.kennzahl__label {
    font-size: 13px;
    color: var(--kmt-steel);
}

.kennzahl__value {
    font-size: 34px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    color: var(--kmt-ink);
}

.kennzahl__note {
    font-size: 12px;
    color: var(--kmt-steel-light);
}

.kennzahl--alert .kennzahl__value {
    color: var(--kmt-red);
}

@media (max-width: 900px) {
    .kennzahlen {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kennzahl:nth-child(3) {
        border-left: 0;
    }

    .kennzahl:nth-child(n + 3) {
        border-top: 1px solid var(--kmt-edge-soft);
    }
}

/* Panels on the dashboard. */
.panel {
    padding: 20px 24px 22px;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius);
    background: var(--kmt-sheet);
}

.panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--kmt-ink);
}

.panel__meta {
    font-size: 13px;
    color: var(--kmt-steel);
}

/* Segmented Makó / all suppliers switch. */
.scope-toggle {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius-sm);
}

.scope-toggle__option {
    all: unset;
    padding: 5px 14px;
    font-family: var(--kmt-din);
    font-size: 13px;
    color: var(--kmt-steel);
    cursor: pointer;
}

.scope-toggle__option + .scope-toggle__option {
    border-left: 1px solid var(--kmt-edge);
}

.scope-toggle__option:hover {
    color: var(--kmt-ink);
    background: var(--kmt-sheet-2);
}

.scope-toggle__option--current,
.scope-toggle__option--current:hover {
    color: #fff;
    background: var(--kmt-graphite);
}

.scope-toggle__option:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: -2px;
}

/* The order's way through the plant: three numbered stages and one proportional bar. */
.pipeline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pipeline__stage {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 12px;
    padding: 0 20px 0 0;
    position: relative;
}

.pipeline__stage + .pipeline__stage {
    padding-left: 20px;
    border-left: 1px solid var(--kmt-edge-soft);
}

.pipeline__index {
    grid-row: span 3;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.pipeline__stage--1 .pipeline__index { background: #9AA1AA; }
.pipeline__stage--2 .pipeline__index { background: var(--kmt-graphite-3); }
.pipeline__stage--3 .pipeline__index { background: var(--kmt-green); }

.pipeline__name {
    font-size: 14px;
    font-weight: 600;
    line-height: 26px;
}

.pipeline__count {
    font-size: 30px;
    font-weight: 600;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.pipeline__hint {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--kmt-steel);
}

.pipeline__bar {
    display: flex;
    gap: 2px;
    height: 10px;
    margin-top: 20px;
    overflow: hidden;
    border-radius: 3px;
}

.pipeline__segment {
    flex-basis: 0;
    min-width: 2px;
}

.pipeline__segment--1 { background: #B7BDC5; }
.pipeline__segment--2 { background: var(--kmt-graphite-3); }
.pipeline__segment--3 { background: var(--kmt-green); }

@media (max-width: 800px) {
    .pipeline {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pipeline__stage + .pipeline__stage {
        padding-left: 0;
        border-left: 0;
    }
}

/* Due dates per calendar week. */
.due-chart-scroll {
    overflow-x: auto;
}

.due-chart {
    display: block;
    width: 100%;
    min-width: 560px;
    height: auto;
    font-family: var(--kmt-din);
}

.due-chart__grid {
    stroke: var(--kmt-edge-soft);
    stroke-width: 1;
}

.due-chart__base {
    stroke: var(--kmt-steel-light);
    stroke-width: 1;
}

.due-chart__axis {
    font-size: 11px;
    fill: var(--kmt-steel-light);
}

.due-chart__open { fill: var(--kmt-graphite-3); }
.due-chart__ready { fill: var(--kmt-green); }
.due-chart__bar--late .due-chart__open { fill: var(--kmt-red); }

.due-chart__value {
    font-size: 12px;
    font-weight: 600;
    fill: var(--kmt-ink);
}

.due-chart__label {
    font-size: 12px;
    fill: var(--kmt-steel);
}

.due-chart__bar--current .due-chart__label,
.due-chart__now {
    font-weight: 600;
    fill: var(--kmt-ink);
}

.due-chart__now {
    font-size: 11px;
    fill: #C27400;
}

.due-chart__bar:hover .due-chart__open { fill: var(--kmt-graphite); }
.due-chart__bar--late:hover .due-chart__open { fill: #B8332F; }

.chart-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    margin-top: 10px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12.5px;
    color: var(--kmt-steel);
}

.chart-legend li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.chart-legend__swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.chart-legend__swatch--open { background: var(--kmt-graphite-3); }
.chart-legend__swatch--ready { background: var(--kmt-green); }
.chart-legend__swatch--late { background: var(--kmt-red); }

.chart-note {
    font-size: 12.5px;
    color: var(--kmt-steel);
}

/* ---- Sign-in -------------------------------------------------------------------------------------------- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.login-page__grid {
    min-height: calc(100vh - 4rem);
}

.login-card.mud-paper {
    border: 1px solid var(--kmt-edge);
    border-top: 4px solid var(--kmt-orange);
    border-radius: 10px;
    background: var(--kmt-sheet);
    box-shadow: 0 24px 48px rgba(20, 22, 25, 0.10);
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.login-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--kmt-ink);
}

.login-input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid #B9C0C8;
    border-radius: var(--kmt-radius-sm);
    background: #fff;
    font: inherit;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:focus {
    border-color: var(--kmt-graphite);
    box-shadow: 0 0 0 3px rgba(243, 146, 0, 0.28);
}

.login-remember {
    padding-left: 0.25rem;
}

.login-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.login-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: var(--kmt-graphite);
}

.login-card__button.mud-button-root {
    min-height: 46px;
    border-radius: var(--kmt-radius-sm);
    font-weight: 600;
}

.login-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border: 1px solid #F3D7A6;
    border-radius: var(--kmt-radius);
    background: #FFF7EA;
}

.login-hint__title {
    font-weight: 600;
}

/* ---- External order tracking (stepper) ------------------------------------------------------------------ */

.tracker {
    display: flex;
    align-items: flex-start;
    margin: 0.75rem 0 0.25rem;
}

.tracker__step {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tracker__connector {
    position: absolute;
    top: 15px;
    left: 50%;
    z-index: 0;
    width: 100%;
    height: 3px;
    background: #D8DDE2;
}

.tracker__connector--done {
    background: var(--kmt-green);
}

.tracker__dot {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #D8DDE2;
    color: #fff;
}

.tracker__dot--done {
    background: var(--kmt-green);
}

.tracker__dot--current {
    box-shadow: 0 0 0 4px rgba(46, 157, 91, 0.20);
}

.tracker__label {
    max-width: 130px;
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: var(--kmt-steel);
}

.tracker__label--current {
    font-weight: 600;
    color: var(--kmt-ink);
}

/* ---- Account page: TOTP QR + recovery codes --------------------------------------------------------------- */

.totp-qr-img {
    width: 200px;
    height: 200px;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius);
    image-rendering: pixelated;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem 1.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Patch notes / update dialog ------------------------------------------------------------------------ */

.patchnotes {
    max-width: 560px;
}

.patchnotes__hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.4rem;
    border-radius: 10px;
    background: var(--kmt-graphite);
    color: #fff;
}

.patchnotes__icon {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: var(--kmt-orange);
    color: var(--kmt-graphite);
}

.patchnotes__icon .mud-icon-root {
    font-size: 1.9rem;
}

.patchnotes__heading {
    position: relative;
}

.patchnotes__eyebrow {
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.66);
}

.patchnotes__title {
    font-weight: 600;
    line-height: 1.2;
}

.patchnotes__body {
    padding: 1.25rem 0.5rem 0.25rem;
    line-height: 1.6;
}

.patchnotes__btn.mud-button-root {
    min-width: 140px;
    border-radius: var(--kmt-radius-sm);
    font-weight: 600;
}

/* ---- Live notice ---------------------------------------------------------------------------------------- */

.live-notice--info { --notice-color: var(--kmt-blue); --notice-glow: rgba(47, 111, 179, 0.35); }
.live-notice--warning { --notice-color: var(--kmt-amber); --notice-glow: rgba(224, 159, 16, 0.40); }
.live-notice--error { --notice-color: var(--kmt-red); --notice-glow: rgba(214, 69, 65, 0.40); }

/* Arrives over the middle of the page; everything behind it blurs until it is confirmed. */
.live-notice {
    position: fixed;
    inset: 0;
    z-index: 1450;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(37, 39, 42, 0.30);
    -webkit-backdrop-filter: blur(8px) saturate(0.85);
    backdrop-filter: blur(8px) saturate(0.85);
    animation: kmt-notice-veil 240ms ease-out both;
}

.live-notice__card {
    width: min(560px, 100%);
    overflow: hidden;
    border-radius: 12px;
    background: var(--kmt-sheet);
    box-shadow: var(--kmt-float);
    border-top: 6px solid var(--notice-color);
    animation: kmt-notice-in 460ms cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.live-notice__head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px 0;
}

.live-notice__icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--notice-color) 14%, white);
    color: var(--notice-color);
}

.live-notice__title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
}

.live-notice__meta {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--kmt-steel);
}

.live-notice__text {
    margin: 0;
    padding: 18px 28px 4px;
    font-size: 15.5px;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
    color: var(--kmt-ink);
}

.live-notice__actions {
    display: flex;
    justify-content: flex-end;
    padding: 18px 28px 24px;
}

.live-notice__confirm {
    min-width: 140px;
    padding: 10px 22px;
    border: 0;
    border-radius: var(--kmt-radius-sm);
    background: var(--kmt-graphite);
    font-family: var(--kmt-din);
    font-size: 14.5px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

.live-notice__confirm:hover {
    background: var(--kmt-graphite-3);
}

@keyframes kmt-notice-veil {
    from { background: rgba(37, 39, 42, 0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
}

@keyframes kmt-notice-in {
    from { opacity: 0; transform: translateY(-38vh) scale(0.98); }
    60% { opacity: 1; }
    to { opacity: 1; transform: none; }
}

/* After "Verstanden": the notice stays as a pill in the header; a click shows it in full again. */
.live-banner--info { --notice-color: var(--kmt-blue); --notice-glow: rgba(47, 111, 179, 0.45); }
.live-banner--warning { --notice-color: #FFC233; --notice-glow: rgba(255, 194, 51, 0.45); }
.live-banner--error { --notice-color: #FF5A52; --notice-glow: rgba(255, 90, 82, 0.50); }

.live-banner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(620px, 42vw);
    min-width: 0;
    padding: 5px 14px 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: var(--kmt-graphite-2);
    font-family: var(--kmt-din);
    font-size: 13.5px;
    color: #fff;
    cursor: pointer;
}

.live-banner:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background: var(--kmt-graphite-3);
}

.live-banner__lamp {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--notice-color);
    box-shadow: 0 0 10px 1px var(--notice-glow);
}

.live-banner__kind {
    flex: none;
    font-weight: 600;
}

.live-banner__text {
    min-width: 0;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.78);
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .live-banner__text {
        display: none;
    }
}

/* Phones: the header keeps menu, logo, the notice lamp, language and the user badge — nothing overlaps. */
@media (max-width: 600px) {
    .kmt-appbar .mud-toolbar {
        gap: 4px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .kmt-appbar__brand img {
        height: 24px;
    }

    .live-banner {
        padding: 7px;
    }

    .live-banner__kind {
        display: none;
    }

    .kmt-lang {
        margin: 0 2px;
    }

    .kmt-lang__item {
        padding: 4px 7px;
    }

    .kmt-user {
        padding: 2px;
    }
}

/* ---- Plantafel (all lists) ----------------------------------------------------------------------------- */

/* The Lieferplan as ONE white work surface directly under the app bar: command bar, week sections and rows are
   separated by hairlines only — no sheet, no gutters, no nested boxes. Sorted by Soll-Termin (overdue first, then one
   section per calendar week). Colour is a signal only: a rail at the row start plus one word; every second row is a
   shade darker for the eyes. Orange = here/now (active filter, current week). */
.plan {
    --plan-rail: transparent;
    --plan-rail-width: 12px;
    --plan-bar-h: 101px; /* measured by app.js (kmtPlan.track) — sticky offset of the column header */
    --plan-head: #DEE3E9;
    --plan-alt: #EEF1F5;
    --plan-hover: #E3E8EE;
    --plan-open: #E8ECF1;
    --plan-ink-red: #B2332F;
    --plan-ink-amber: #8A5A00;
    --plan-ink-green: #1E7A45;
    --plan-ink-blue: #245A93;
    margin: -24px;
    min-height: calc(100vh - var(--mud-appbar-height));
    background: var(--kmt-sheet);
    color: var(--kmt-ink);
    font-variant-numeric: tabular-nums;
}

.plan-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Command bar: customer picker, search, print — then the filter tabs. Stays under the app bar while scrolling. */
.plan-bar {
    position: sticky;
    top: var(--mud-appbar-height);
    z-index: 6;
    background: var(--kmt-sheet);
    border-bottom: 1px solid var(--kmt-edge);
}

.plan-bar__main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px 8px;
}

/* MudAutocomplete: the flex item is its .mud-autocomplete wrapper, Class lands on the inner input control. */
.plan-bar__main > .mud-autocomplete {
    flex: 0 1 400px;
    min-width: 260px;
}

.plan-customer.mud-input-control {
    margin: 0;
}

.plan-bar .mud-input.mud-input-outlined {
    background: var(--kmt-sheet);
    border-radius: var(--kmt-radius-sm);
    cursor: pointer;
}

.plan-bar .mud-input.mud-input-outlined .mud-input-outlined-border {
    border-color: var(--kmt-edge);
    border-radius: var(--kmt-radius-sm);
}

.plan-bar .mud-input.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--kmt-steel-light);
}

.plan-bar .mud-input.mud-input-outlined.mud-focused .mud-input-outlined-border {
    border-width: 1px;
    border-color: var(--kmt-orange);
}

.plan-bar .mud-input-slot {
    font-size: 14px;
    font-weight: 600;
}

/* The picker still selects its text on click (typing replaces the name and searches) — just without painting it. */
.plan-customer input::selection {
    background: transparent;
    color: inherit;
}

/* Picker entries: customer, due (red when > 0), open. */
.plan-pick-popover .mud-list-item {
    padding-top: 6px;
    padding-bottom: 6px;
}

.plan-pick {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px 56px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 380px;
    font-size: 14px;
}

.plan-pick--no-due {
    grid-template-columns: minmax(0, 1fr) 56px;
}

.plan-pick--head {
    padding: 8px 16px 6px;
    border-bottom: 1px solid var(--kmt-edge-soft);
    font-size: 12px;
    font-weight: 600;
    color: var(--kmt-steel);
}

.plan-pick--head > span:not(:first-child),
.plan-pick__due,
.plan-pick__open {
    text-align: right;
}

.plan-pick__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-pick__due {
    font-weight: 600;
    color: var(--plan-ink-red);
}

.plan-pick__due.is-zero,
.plan-pick__open {
    font-weight: 400;
    color: var(--kmt-steel);
}

.plan-bar__spacer {
    flex: 1;
}

.plan-search {
    display: flex;
    flex: 1 1 320px;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 6px 0 12px;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius-sm);
    background: var(--kmt-sheet);
    color: var(--kmt-steel);
    cursor: text;
}

.plan-search:hover {
    border-color: var(--kmt-steel-light);
}

.plan-search:focus-within {
    border-color: var(--kmt-orange);
}

.plan-search.is-disabled {
    opacity: 0.5;
    cursor: default;
}

.plan-search.is-disabled:hover {
    border-color: var(--kmt-edge);
}

.plan-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--kmt-ink);
}

.plan-search input::placeholder {
    color: var(--kmt-steel-light);
}

.plan-search__clear {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--kmt-radius-sm);
    background: transparent;
    color: var(--kmt-steel);
    cursor: pointer;
}

.plan-search__clear:hover {
    background: var(--kmt-alu);
    color: var(--kmt-ink);
}

/* Filter tabs: one style, the count says how much is behind each; red count = needs attention. */
.plan-tabs {
    display: flex;
    gap: 28px;
    height: 40px;
    padding: 0 24px;
    overflow-x: auto;
    scrollbar-width: none;
}

.plan-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    font: inherit;
    font-size: 14px;
    color: var(--kmt-steel);
    white-space: nowrap;
    cursor: pointer;
}

.plan-tab:hover {
    color: var(--kmt-ink);
}

.plan-tab:disabled {
    color: var(--kmt-steel-light);
    cursor: default;
}

.plan-tab.is-active {
    border-bottom-color: var(--kmt-orange);
    font-weight: 600;
    color: var(--kmt-ink);
}

.plan-tab:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: -2px;
}

.plan-tab__count {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--kmt-steel-light);
}

.plan-tab.is-active .plan-tab__count {
    color: var(--kmt-steel);
}

.plan-tab__count--alert,
.plan-tab.is-active .plan-tab__count--alert {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--kmt-red);
    font-weight: 600;
    line-height: 16px;
    text-align: center;
    color: #fff;
}

/* Buttons: quiet by default; --line for secondary actions, --solid (graphite) for THE action of a context. */
.plan-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--kmt-radius-sm);
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--kmt-ink);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.plan-btn .mud-icon-root {
    color: var(--kmt-steel);
}

.plan-btn:hover {
    background: var(--kmt-alu);
}

.plan-btn:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: 2px;
}

.plan-btn:disabled {
    opacity: 0.45;
    background: transparent;
    cursor: default;
}

.plan-btn--line {
    border-color: var(--kmt-edge);
    background: var(--kmt-sheet);
}

.plan-btn--line:hover {
    border-color: var(--kmt-steel-light);
    background: var(--kmt-sheet);
}

.plan-btn--solid {
    background: var(--kmt-graphite);
    color: #fff;
}

.plan-btn--solid .mud-icon-root {
    color: #fff;
}

.plan-btn--solid:hover {
    background: var(--kmt-graphite-3);
}

/* How many positions a bar action affects ("Fertige archivieren 12"), in the tone of the tab counts. */
.plan-btn__count {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--kmt-steel);
}

/* Einstellungen → CSV-Import: the daily run times as removable chips. */
.import-times {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    min-height: 36px;
}

.plan-progress {
    margin: 0;
}

/* The list. No scroll container on desktop, so the column header can stick under the command bar; narrow screens
   (below) scroll the list sideways instead. */

.plan-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
    line-height: 1.35;
}

.plan-table th,
.plan-table td {
    text-align: left;
    vertical-align: top;
}

/* Column headers: a clear band in ink, not the faint grey of the values; they stay under the command bar. */
.plan-table thead th {
    position: sticky;
    top: calc(var(--mud-appbar-height) + var(--plan-bar-h));
    z-index: 4;
    padding: 11px 12px;
    border-bottom: 1px solid var(--kmt-edge);
    background: var(--plan-head);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--kmt-ink);
    white-space: nowrap;
}

.plan-table thead th:first-child,
.plan-row > td:first-child {
    padding-left: calc(16px + var(--plan-rail-width));
}

/* "Liefertermin aus Ungarn" / "Szállítás Magyarországról" take two lines when space is short — the dates below are
   narrow, one long header must not push the list sideways. */
.plan-table thead th.plan-c-kmt {
    white-space: normal;
}

.plan-table thead th:last-child,
.plan-row > td:last-child {
    padding-right: 16px;
}

/* Short values stay on one line; article, index and person may wrap, and so may the typed-in Best.-Nr., P-Nummer and
   KMT dates ("Nincs megrendelés", "20265ZP00547 pótrendelés", "2026.05.22. szállítás") — one long entry would
   otherwise push the whole list sideways (laptops, and Full HD in Hungarian). Extra width is shared by all columns. */
.plan-c-date,
.plan-c-doc,
.plan-c-order,
.plan-c-qty,
.plan-c-stock,
.plan-c-material,
.plan-c-place,
.plan-c-status,
.plan-c-stamp,
.plan-c-time,
.plan-c-action {
    white-space: nowrap;
}

/* Long company / supplier names: one line, cut with "…" (full name on hover). */
.plan-c-supplier span {
    display: block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-c-surfaces {
    min-width: 180px;
}

.plan-c-raw {
    min-width: 160px;
}

/* Liefertermine: the status word with its dot, warnings below; both may wrap (1280 px in Hungarian). */
.plan-c-state {
    min-width: 110px;
}

.plan-c-state .plan-status {
    display: flex;
}

.plan-c-state .plan-tag {
    display: inline-block;
    margin: 4px 4px 0 0;
    white-space: normal;
}

/* Liefertermine: the calculation as a timeline in the open row — dates as points, working days in between. */
.plan-timeline {
    position: relative;
    margin: 14px 0 4px;
    padding: 0;
    list-style: none;
}

.plan-timeline::before {
    content: "";
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 5px;
    width: 2px;
    background: var(--kmt-edge);
}

.plan-timeline__step {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0 16px;
    padding: 5px 0 5px 26px;
    font-size: 13.5px;
    line-height: 20px;
}

.plan-timeline__step::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 0;
    box-sizing: border-box;
    width: 12px;
    height: 12px;
    border: 2px solid var(--kmt-steel-light);
    border-radius: 50%;
    background: var(--kmt-sheet);
}

.plan-timeline__step.is-key::before {
    border-color: var(--kmt-ink);
    background: var(--kmt-ink);
}

.plan-timeline__step.is-key .plan-timeline__label,
.plan-timeline__step.is-key .plan-timeline__date {
    font-weight: 600;
}

.plan-timeline__step--red.is-final::before {
    border-color: var(--kmt-red);
    background: var(--kmt-red);
}

.plan-timeline__step--green.is-final::before {
    border-color: var(--kmt-green);
    background: var(--kmt-green);
}

.plan-timeline__step--blue.is-final::before {
    border-color: var(--kmt-blue);
    background: var(--kmt-blue);
}

.plan-timeline__step.is-missing .plan-timeline__date {
    color: var(--plan-ink-red);
}

.plan-timeline__date {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.plan-timeline__note {
    grid-column: 1 / -1;
    font-size: 12px;
    line-height: 16px;
    color: var(--kmt-steel);
}

.plan-timeline__note--warn,
.plan-timeline__span--warn {
    color: var(--plan-ink-amber);
}

.plan-timeline__step--red .plan-timeline__note { color: var(--plan-ink-red); }
.plan-timeline__step--green .plan-timeline__note { color: var(--plan-ink-green); }
.plan-timeline__step--blue .plan-timeline__note { color: var(--plan-ink-blue); }

.plan-timeline__span {
    position: relative;
    padding: 1px 0 1px 26px;
    font-size: 12.5px;
    line-height: 18px;
    color: var(--kmt-steel);
}

/* Laufzeiten: the master data lists — examples of the recognised büro+ texts, inline controls for suppliers and
   customers. The examples are cut with "…" and never widen the column. */
.plan-c-examples {
    width: 46%;
}

.plan-example {
    display: block;
    overflow: hidden;
    contain: inline-size;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-c-supplier-full {
    min-width: 240px;
}

.plan-c-transport {
    min-width: 200px;
}

.plan-c-check,
.plan-c-tag {
    width: 1%;
    text-align: center !important;
    white-space: nowrap;
}

.plan-c-weekdays {
    white-space: nowrap;
}

/* (.plan-input itself comes later in this file — hence the doubled class.) */
.plan-input.plan-input--compact {
    min-height: 32px;
    padding: 5px 8px;
}

.plan-input.plan-input--days {
    flex: none;
    width: 64px;
    min-height: 32px;
    padding: 5px 8px;
    text-align: right;
}

.plan-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--kmt-graphite);
    cursor: pointer;
}

.plan-checkbox:disabled {
    cursor: default;
}

/* Delivery weekdays of a customer: five toggles, on = ink. */
.plan-weekdays {
    display: inline-flex;
    gap: 4px;
}

.plan-weekday {
    min-width: 40px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius-sm);
    background: var(--kmt-sheet);
    font: inherit;
    font-size: 12.5px;
    color: var(--kmt-steel);
    cursor: pointer;
}

.plan-weekday.is-on {
    border-color: var(--kmt-graphite);
    background: var(--kmt-graphite);
    color: #fff;
}

.plan-weekday:disabled {
    cursor: default;
}

.plan-weekday:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: 1px;
}

.plan-hint--block {
    margin: 12px 0 0;
}

.plan-hint--page {
    max-width: 960px;
    margin: 0;
    padding: 14px 24px 32px calc(16px + var(--plan-rail-width));
}

/* "Nicht erkannt": assigning a text to a surface, in the band under the row. */
.plan-assign {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto;
    align-items: end;
    gap: 10px 16px;
    padding: 14px 24px 16px calc(16px + var(--plan-rail-width));
}

.plan-assign__actions {
    display: flex;
    gap: 8px;
}

.plan-assign__hint {
    grid-column: 1 / -1;
    margin: 0;
}

/* "Kalender & Einstellungen": settings and calendar side by side. */
.plan-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
    padding: 20px 24px 40px calc(16px + var(--plan-rail-width));
}

.plan-board__section {
    min-width: 0;
}

.plan-board__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.plan-board__subtitle {
    margin: 20px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--kmt-ink);
}

.plan-year {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.plan-holidays {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
}

.plan-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.plan-mini-table--auto {
    width: auto;
}

.plan-mini-table.plan-mini-table--auto td {
    padding-right: 28px;
}

.plan-mini-table td {
    padding: 6px 10px 6px 0;
    border-bottom: 1px solid var(--kmt-edge-soft);
    vertical-align: middle;
}

.plan-check-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.plan-form--add {
    margin-top: 14px;
}

@media (max-width: 1199px) {
    .plan-board,
    .plan-holidays {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Gelöschte Werte: field name and the old / current value; they wrap (1280 px in Hungarian). */
.plan-c-field {
    min-width: 110px;
}

.plan-c-value {
    min-width: 96px;
    max-width: 320px;
    overflow-wrap: anywhere;
}

.plan-c-change {
    width: 45%;
}

.plan-c-actions {
    width: 1%;
}

/* Quantities and the stock (Lieferplan "Lager", v1.38) line up on the right. */
.plan-c-qty,
.plan-c-stock {
    text-align: right !important;
}

.plan-c-article {
    min-width: 200px;
}

.plan-c-toggle {
    width: 44px;
}

/* First line of the Beleg column: the Express tag and the lock may move under the Belegnummer when space is short. */
.plan-doc-head {
    white-space: normal;
}

/* Column widths frozen by kmtPlan.freeze (PlanColumnFreeze) on the lists other people edit live: the measured widths
   stay put; content that grows later (an Express tag, a longer name) wraps inside its column instead of pushing the
   other columns around. */
.plan-table.is-frozen {
    table-layout: fixed;
}

.plan-table.is-frozen > tbody > tr > td {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Week sections: a heading line, not a box. */
.plan-week > th {
    padding: 22px 16px 8px calc(16px + var(--plan-rail-width));
    border-bottom: 1px solid var(--kmt-edge);
    background: var(--kmt-sheet);
    font-size: 13px;
    font-weight: 400;
    color: var(--kmt-steel);
}

.plan-group:first-of-type .plan-week > th {
    padding-top: 16px;
}

.plan-week__title {
    margin-right: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--kmt-ink);
}

.plan-week__note {
    margin-left: 12px;
    font-weight: 600;
    color: var(--kmt-ink);
}

.plan-week--current .plan-week__note::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 6px 1px 0;
    border-radius: 50%;
    background: var(--kmt-orange);
}

.plan-week__count {
    float: right;
    font-size: 12.5px;
}

.plan-week--overdue .plan-week__title {
    color: var(--plan-ink-red);
}

/* Rows: white / a shade darker in turns, hairline, the status rail on the first cell. */
.plan-row {
    cursor: pointer;
}

.plan-row--static {
    cursor: default;
}

.plan-row > td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--kmt-edge-soft);
    background: var(--kmt-sheet);
}

.plan-row--alt > td {
    background: var(--plan-alt);
}

.plan-row > td:first-child {
    box-shadow: inset var(--plan-rail-width) 0 0 var(--plan-rail);
}

.plan-row:hover > td {
    background: var(--plan-hover);
}

/* Status of a row: the rail colour and, when the row is open, the same colour as a light pastel behind row and
   filing area. Rows without a status open in a neutral light grey (no colour = no status). */
.plan-state--red { --plan-rail: var(--kmt-red); --plan-open: #FBE7E6; }
.plan-state--amber { --plan-rail: var(--kmt-amber); --plan-open: #FDF1D8; }
.plan-state--green { --plan-rail: var(--kmt-green); --plan-open: #E2F3E9; }
.plan-state--blue { --plan-rail: var(--kmt-blue); --plan-open: #E5EEF8; }
.plan-state--grey { --plan-rail: #A9B0B9; --plan-open: #E8ECF1; }

/* The open row keeps its status rail; the pastel (and the turned arrow) marks it as open. */
.plan-row.is-open > td {
    border-bottom-color: transparent;
    background: var(--plan-open);
}

.plan-date,
.plan-strong {
    font-weight: 600;
    white-space: nowrap;
}

.plan-sub {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--kmt-steel);
}

.plan-sub--red { color: var(--plan-ink-red); font-weight: 600; }
.plan-sub--amber { color: var(--plan-ink-amber); font-weight: 600; }
.plan-sub--green { color: var(--plan-ink-green); font-weight: 600; }
.plan-sub--blue { color: var(--plan-ink-blue); font-weight: 600; }

.plan-muted {
    color: var(--kmt-steel-light);
}

.plan-article {
    font-weight: 600;
    white-space: nowrap;
}

.plan-desc {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: #3F4650;
}

/* "Alle Kunden": the customer under the order number, cut to the column. */
.plan-customer-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; /* one line with "…" — also in frozen lists, where the cells may wrap */
}

.plan-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 17px;
    vertical-align: 1px;
}

.plan-tag--express {
    background: var(--kmt-red);
    color: #fff;
}

.plan-flag {
    margin-left: 4px;
    vertical-align: -3px;
}

.plan-flag--lock {
    color: var(--kmt-amber);
}

/* Article cell: the info with the remark bubble right beside it — an indicator only, so the row keeps its height. */
.plan-article-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.plan-remark-flag {
    display: inline-flex;
    flex: none;
    color: var(--plan-ink-blue);
    cursor: help;
}

/* Lieferplan: the Liefer-Info column (v1.36; v1.34 it held the remark) — one line with "…"; the bubble only when the
   text is cut (app.js). The column takes a share of the width; the text itself never widens it (inline-size
   containment), else one long note would push the list past 1280 px. */
.plan-c-info {
    width: 14%;
}

.plan-remark-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.plan-remark-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    contain: inline-size;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Below 1800 px the Liefer-Info column head is the info symbol (like "Material" shows only the check mark). */
.plan-info-head {
    display: none;
    color: var(--kmt-steel);
}

.plan-info-head .mud-icon-root {
    font-size: 18px;
}

@media (max-width: 1799px) {
    .plan-info-head {
        display: inline-flex;
    }
}

.plan-remark-line .plan-remark-flag {
    display: none;
}

.plan-remark-line.is-truncated .plan-remark-flag {
    display: inline-flex;
}

/* The Liefer-Info under a supplier date (Ampelliste, Liefertermine, archives): at most two lines, never wider than the
   column. */
.plan-info-sub {
    display: -webkit-box;
    overflow: hidden;
    contain: inline-size;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
}

/* Lieferplan: released for a Best.-Nr. — in the column and under the tools of the open row. */
.plan-released {
    font-weight: 600;
    color: var(--plan-ink-green);
}

.plan-release {
    display: flex;
    flex-basis: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.plan-remark-flag .mud-icon-root {
    font-size: 18px;
}

.plan-remark-tip {
    max-width: 360px;
    white-space: pre-line;
    text-align: left;
}

.plan-missing {
    font-weight: 600;
    color: var(--plan-ink-red);
}

.plan-ok {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--plan-ink-green);
}

.plan-ok .mud-icon-root {
    font-size: 16px;
}

.plan-expand {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: -4px 0;
    border: 0;
    border-radius: var(--kmt-radius-sm);
    background: transparent;
    color: var(--kmt-steel);
    cursor: pointer;
    transition: transform 160ms ease;
}

.plan-row:hover .plan-expand {
    background: rgba(37, 39, 42, 0.07);
    color: var(--kmt-ink);
}

.plan-expand[aria-expanded="true"] {
    transform: rotate(180deg);
}

.plan-expand:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: 1px;
}

/* No customer yet / nothing matches: one quiet line inside the list. */
.plan-placeholder > td {
    padding: 48px 24px;
    text-align: center;
    color: var(--kmt-steel);
    font-size: 14.5px;
}

.plan-placeholder p {
    margin: 0 0 14px;
}

/* The open row and its filing area are one tinted band; the status rail runs on along it — no card, no border. */
.plan-detail > td {
    padding: 2px 24px 24px calc(16px + var(--plan-rail-width));
    border-bottom: 1px solid var(--kmt-edge);
    background: var(--plan-open);
    box-shadow: inset var(--plan-rail-width) 0 0 var(--plan-rail);
    cursor: default;
}

.plan-open {
    display: grid;
    grid-template-columns: minmax(300px, 5fr) minmax(420px, 6fr);
    gap: 40px;
}

.plan-open--facts-only {
    grid-template-columns: minmax(0, 1fr);
}

.plan-open__title {
    margin: 14px 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--kmt-steel);
}

.plan-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 7px 20px;
    margin: 0;
    font-size: 13.5px;
}

.plan-facts dt {
    color: var(--kmt-steel);
}

.plan-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.plan-open__tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.plan-lock {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px 12px;
    border-left: 3px solid var(--kmt-amber);
    background: var(--kmt-sheet);
    color: var(--plan-ink-amber);
}

.plan-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px 20px;
}

.plan-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.plan-field--wide {
    grid-column: 1 / -1;
}

.plan-field__label {
    font-size: 12px;
    color: var(--kmt-steel);
}

.plan-field__value {
    min-height: 36px;
    padding: 8px 0;
    font-size: 14px;
    line-height: 20px;
    overflow-wrap: anywhere;
}

.plan-field__value--text {
    white-space: pre-line;
}

.plan-input {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius-sm);
    outline: 0;
    background: var(--kmt-sheet);
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    color: var(--kmt-ink);
}

.plan-input:hover {
    border-color: var(--kmt-steel-light);
}

.plan-input:focus {
    border-color: var(--kmt-orange);
    box-shadow: 0 0 0 3px rgba(243, 146, 0, 0.16);
}

textarea.plan-input {
    min-height: 76px;
    resize: vertical;
}

/* Former free-text date under the date field ("bisheriger Eintrag"). */
.plan-field__legacy {
    font-size: 12px;
    line-height: 16px;
    color: var(--kmt-steel);
    overflow-wrap: anywhere;
}

/* Fertigende Person: the colleagues suggested under the field. */
.plan-person-field {
    position: relative;
}

.plan-person-field__list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 264px;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius-sm);
    background: var(--kmt-sheet);
    box-shadow: var(--kmt-float);
}

.plan-person-field__option {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
}

.plan-person-field__option:hover {
    background: var(--kmt-alu);
}

.plan-person-field__option.is-active {
    background: var(--kmt-alu);
    box-shadow: inset 3px 0 0 var(--kmt-orange);
}

.plan-person-field__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-person-field__login {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--kmt-steel-light);
}

/* Online status (v1.35): green while a colleague has the portal open; in lists a grey ring otherwise. */
.plan-presence {
    flex: none;
    display: inline-block;
    align-self: center;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px var(--kmt-steel-light);
    vertical-align: middle;
}

.plan-presence.is-online {
    background: var(--kmt-green);
    box-shadow: 0 0 0 2.5px rgba(46, 157, 91, 0.18);
}

.plan-person-field__option .plan-presence {
    margin-right: -4px;
}

.plan-field__value .plan-presence {
    margin-left: 8px;
}

/* Remarks with "@" mentions: the suggestions open under the text; mentioned colleagues stand out in blue. */
.plan-mention-field {
    position: relative;
}

.plan-mention {
    padding: 0 3px;
    border-radius: 4px;
    background: #E5EEF8;
    font-weight: 600;
    color: var(--kmt-blue);
}

.plan-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.plan-open__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
}

.plan-hint {
    font-size: 13px;
    color: var(--kmt-steel);
}

.plan-more {
    display: flex;
    justify-content: center;
    padding: 24px 24px 40px;
}

/* Small tags in a row: Express (red), a missing drawing (amber), log actions. */
.plan-tag--warn {
    background: #FDF1D8;
    color: var(--plan-ink-amber);
}

.plan-tag--green {
    background: #E2F3E9;
    color: var(--plan-ink-green);
}

.plan-tag--blue {
    background: #E5EEF8;
    color: var(--plan-ink-blue);
}

.plan-tag--red {
    background: #FBE7E6;
    color: var(--plan-ink-red);
}

.plan-tag--neutral {
    background: var(--kmt-alu);
    color: var(--kmt-steel);
}

.plan-row .plan-tag:first-child {
    margin-left: 0;
}

/* Numbers that signal something (stock): green when available, amber when not. */
.plan-num--ok {
    font-weight: 600;
    color: var(--plan-ink-green);
}

.plan-num--short {
    font-weight: 600;
    color: var(--plan-ink-amber);
}

/* Person cell: initials badge + name / e-mail. */
.plan-person {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The e-mail address stays on one line; the role chips wrap instead. */
.plan-c-person .plan-sub {
    white-space: nowrap;
}

.plan-avatar {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--kmt-graphite);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #fff;
}

.plan-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.plan-chip {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--kmt-edge);
    border-radius: 999px;
    background: var(--kmt-sheet);
    font-size: 12px;
    line-height: 18px;
    color: var(--kmt-steel);
    white-space: nowrap;
}

/* Row actions as quiet icon buttons (Benutzer). */
/* One line of icon buttons; the column (width: 1%) takes exactly their width. */
.plan-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
}

.plan-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--kmt-radius-sm);
    background: transparent;
    color: var(--kmt-steel);
    text-decoration: none;
    cursor: pointer;
}

.plan-icon-btn:hover {
    background: rgba(37, 39, 42, 0.07);
    color: var(--kmt-ink);
}

.plan-icon-btn:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: 1px;
}

.plan-icon-btn--danger:hover {
    color: var(--plan-ink-red);
}

/* Audit log: old / new values. */
.plan-diff {
    display: block;
    max-width: 520px;
    margin: 0 0 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.plan-diff--old {
    background: #FBE7E6;
    color: #7A2522;
}

.plan-diff--new {
    background: #E2F3E9;
    color: #165C35;
}

/* A status word with a dot in its colour (Versand, Benutzer, external lists). */
.plan-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
}

.plan-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.plan-status--green { color: var(--plan-ink-green); }
.plan-status--amber { color: var(--plan-ink-amber); }
.plan-status--red { color: var(--plan-ink-red); }
.plan-status--blue { color: var(--plan-ink-blue); }
.plan-status--grey { color: var(--kmt-steel); }

/* Drawing picker in an open article row. */
.plan-drawing {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.plan-drawing__select.mud-input-control {
    flex: 0 1 240px;
    margin: 0;
}

.plan-drawing .mud-input.mud-input-outlined {
    background: var(--kmt-sheet);
}

/* The customer's own name in the command bar of the external lists (no picker — they see only their orders). */
.plan-bar__customer {
    flex: 0 1 auto;
    padding-right: 4px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

/* Article picker (Zeichnungen) — as wide as the customer picker. */
.plan-bar__main > .mud-autocomplete:has(.plan-article-picker) {
    flex: 0 1 520px;
}

/* Head of the picked article (Zeichnungen): number, name and the master data in one line of facts. */
.plan-article-head {
    padding: 18px 24px 16px calc(16px + var(--plan-rail-width));
    border-bottom: 1px solid var(--kmt-edge);
}

.plan-article-head__title .plan-article {
    font-size: 16px;
}

.plan-article-head__title .plan-desc {
    font-size: 14px;
}

.plan-facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px 24px;
    margin: 14px 0 0;
}

.plan-facts-grid dt {
    font-size: 12px;
    color: var(--kmt-steel);
}

.plan-facts-grid dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

/* Files of one index (Zeichnungen). */
.plan-c-files {
    width: 100%;
}

.plan-file {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
}

.plan-file + .plan-file {
    border-top: 1px dashed var(--kmt-edge-soft);
}

.plan-file__icon {
    color: var(--plan-ink-green);
}

.plan-file__name {
    font-weight: 500;
}

.plan-file .plan-sub {
    margin: 0;
}

.plan-file__actions {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
}

/* The stage tracker of the external order tracking inside the open band. */
.plan-open .tracker {
    margin: 4px 0 12px;
}

/* Meta text in the command bar (e.g. "Letzte Berechnung …"). */
.plan-bar__meta {
    font-size: 12.5px;
    color: var(--kmt-steel);
    white-space: nowrap;
}

/* Yes/no tiles (CheckTile): a box + label; editable = toggle button, read-only = the same picture. */
.check-tile {
    --tile-tone: var(--kmt-graphite);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px 0 9px;
    border: 1px solid var(--kmt-edge);
    border-radius: var(--kmt-radius-sm);
    background: var(--kmt-sheet);
    font: inherit;
    font-size: 13.5px;
    color: var(--kmt-steel);
}

.check-tile--ok { --tile-tone: var(--kmt-green); }
.check-tile--alert { --tile-tone: var(--kmt-red); }

button.check-tile {
    cursor: pointer;
}

button.check-tile:hover {
    border-color: var(--kmt-steel-light);
    color: var(--kmt-ink);
}

button.check-tile:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: 2px;
}

.check-tile__box {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--kmt-steel-light);
    border-radius: 4px;
    background: var(--kmt-sheet);
    color: transparent;
}

.check-tile__box .mud-icon-root {
    font-size: 15px;
}

.check-tile.is-on {
    border-color: var(--tile-tone);
    color: var(--kmt-ink);
}

.check-tile.is-on .check-tile__box {
    border-color: var(--tile-tone);
    background: var(--tile-tone);
    color: #fff;
}

.check-tile.is-static {
    border-color: transparent;
    background: transparent;
    padding-left: 0;
}

.check-tile.is-static:not(.is-on) {
    color: var(--kmt-steel-light);
}

.check-tile.is-static:not(.is-on) .check-tile__box {
    border-style: dashed;
}

/* Below ~1600px the order number, index and P-Nummer fold into their neighbours as second lines (Beleg, Artikel,
   Fertigung), so laptops see the whole list without scrolling sideways. */
.plan-compact-only,
.plan-compact-inline {
    display: none;
}

.plan-index {
    margin-left: 6px; /* plus its leading space, the break opportunity after the article number */
    font-size: 12px;
    font-weight: 400;
    color: var(--kmt-steel);
}

@media (min-width: 1600px) {
    .plan-table {
        min-width: 1240px;
    }
}

/* Only on really wide screens (the "bestellt" word of the Lieferplan's material column). */
@media (max-width: 1799px) {
    .plan-xwide-only {
        display: none;
    }

    /* Long article numbers ("GRU-0950013-KLEMMROLLE") may break at their hyphens — with the Lieferplan's stock column
       (v1.38) Hungarian "Alle Kunden" was too wide at 1280 and 1600 px. */
    .plan-c-article .plan-article {
        white-space: normal;
    }
}

/* Between 1600 and 1799 px the order number and P-Nummer have their own columns — with the Lieferplan's stock column
   (v1.38) the customer name under the order number and the article column give a little, so Hungarian "Alle Kunden"
   fits 1600 px. */
@media (min-width: 1600px) and (max-width: 1799px) {
    .plan-customer-name {
        max-width: 160px;
    }

    .plan-c-article {
        min-width: 180px;
    }
}

@media (max-width: 1599px) {
    .plan-wide-only {
        display: none;
    }

    .plan-compact-only {
        display: block;
    }

    .plan-compact-inline {
        display: inline;
    }

    /* The name under the Beleg is cut to the column — it doesn't make the column wider ("Alle Kunden", Hungarian,
       1280 px); the full name on hover. */
    .plan-customer-name {
        max-width: none;
        contain: inline-size;
    }

    .plan-c-article {
        min-width: 170px;
    }

    .plan-table {
        min-width: 940px;
    }

    .plan-table thead th,
    .plan-row > td {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-width: 1199px) {
    .plan-scroll {
        overflow-x: auto;
    }

    .plan-table thead th {
        position: static;
    }
}

@media (max-width: 1099px) {
    .plan-open {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }
}

@media (max-width: 600px) {
    .plan {
        margin: -16px -12px;
    }

    .plan-bar {
        position: static;
    }

    .plan-bar__main {
        flex-wrap: wrap;
        padding: 10px 12px 6px;
    }

    .plan-bar__main > .mud-autocomplete,
    .plan-search {
        flex: 1 1 100%;
    }

    .plan-tabs {
        gap: 20px;
        padding: 0 12px;
    }

    .plan-pick {
        min-width: 0;
    }
}

/* ---- Reconnect display ----------------------------------------------------------------------------------- */

/* Blazor toggles components-reconnect-show (connection lost, retrying), -failed (retries used up) and -rejected (the
   server no longer knows this session, e.g. after an update — app.js reloads the page) on #components-reconnect-modal.
   MudBlazor styles Blazor's default dialog under that id (opaque background and uppercase buttons with a 40px margin,
   partly !important), hence the id in the selectors below. */
.kmt-reconnect,
.kmt-reconnect__pill,
.kmt-reconnect__card,
.kmt-reconnect__when-failed,
.kmt-reconnect__when-rejected {
    display: none;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    animation: kmt-reconnect-fade 200ms ease-out both;
}

/* A short interruption: a pill under the header; the page stays readable behind a light veil that catches clicks,
   which would otherwise get lost while there is no connection. */
#components-reconnect-modal.components-reconnect-show {
    align-items: start;
    padding-top: calc(var(--mud-appbar-height) + 12px);
    background-color: rgba(236, 238, 241, 0.55) !important;
    cursor: progress;
}

.components-reconnect-show .kmt-reconnect__pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 12px;
    border-radius: 999px;
    background: var(--kmt-graphite);
    box-shadow: var(--kmt-float);
    font-size: 13.5px;
    color: #fff;
}

.kmt-reconnect__lamp {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FFC233;
    box-shadow: 0 0 10px 1px rgba(255, 194, 51, 0.55);
    animation: kmt-reconnect-pulse 1.2s ease-in-out infinite;
}

/* Retries used up / session gone: a card over the blurred page, like the live notice. */
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    background-color: rgba(37, 39, 42, 0.30) !important;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.components-reconnect-failed .kmt-reconnect__card,
.components-reconnect-rejected .kmt-reconnect__card {
    display: block;
    width: min(480px, 100%);
    padding: 24px 28px;
    border-top: 6px solid var(--kmt-red);
    border-radius: 12px;
    background: var(--kmt-sheet);
    box-shadow: var(--kmt-float);
    animation: kmt-notice-in 380ms cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.components-reconnect-rejected .kmt-reconnect__card {
    border-top-color: var(--kmt-blue);
}

.components-reconnect-failed .kmt-reconnect__when-failed,
.components-reconnect-rejected .kmt-reconnect__when-rejected {
    display: block;
}

.kmt-reconnect__title {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
}

.kmt-reconnect__text {
    margin: 8px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--kmt-steel);
}

.kmt-reconnect__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

#components-reconnect-modal .kmt-reconnect__button {
    min-width: 0;
    margin: 0 !important;
    padding: 10px 20px;
    border: 0;
    border-radius: var(--kmt-radius-sm);
    background: var(--kmt-graphite);
    font-family: var(--kmt-din);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    color: #fff;
    cursor: pointer;
}

#components-reconnect-modal .kmt-reconnect__button:hover {
    background: var(--kmt-graphite-3);
}

#components-reconnect-modal .kmt-reconnect__button:focus-visible {
    outline: 2px solid var(--kmt-orange);
    outline-offset: 2px;
}

/* "Erneut versuchen" while the attempt runs. */
#components-reconnect-modal.kmt-reconnect--busy .kmt-reconnect__button {
    opacity: 0.6;
    cursor: progress;
}

@keyframes kmt-reconnect-fade {
    from { opacity: 0; }
}

@keyframes kmt-reconnect-pulse {
    50% { opacity: 0.35; }
}

/* ---- Reduced motion ------------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        transition-duration: 1ms !important;
    }

    .kmt-reconnect__lamp {
        animation: none !important;
    }
}

/* ---- Print (Ampelliste print view) ---------------------------------------------------------------------- */

.print-area {
    display: none;
}

@media print {
    html,
    body {
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
    }

    body * {
        visibility: hidden !important;
    }

    .print-area,
    .print-area * {
        visibility: visible !important;
    }

    .print-area {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        color: #000 !important;
        font-family: Arial, sans-serif !important;
    }

    .print-header {
        margin-bottom: 10px;
        padding-bottom: 6px;
        border-bottom: 2px solid #000;
        break-after: avoid;
        page-break-after: avoid;
    }

    .print-header h1 {
        margin: 0 0 6px 0;
        font-size: 20px;
    }

    .print-header div {
        font-size: 11px;
        line-height: 1.35;
    }

    .print-table {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        font-size: 9px;
    }

    .print-table thead {
        display: table-header-group;
    }

    .print-table tbody {
        display: table-row-group;
    }

    .print-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-table th,
    .print-table td {
        padding: 3px 4px;
        border: 1px solid #999;
        background: #fff !important;
        color: #000 !important;
        vertical-align: top;
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }

    .print-table th {
        background: #f0f0f0 !important;
        font-weight: bold;
    }

    .print-footer {
        margin-top: 10px;
        padding-top: 6px;
        border-top: 1px solid #999;
        font-size: 10px;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    @page {
        size: landscape;
        margin: 12mm;
    }
}

/* ---- Auftrag (/auftrag/{id}, v1.35) -------------------------------------------------------------------- */

/* One position on its own, in the look of an open Lieferplan row: the head band in the pastel of the status with
   its rail; below it the facts in groups, every remark, the files and the delivery date calculation. */
.order {
    --order-inset: calc(24px + var(--plan-rail-width));
    padding-bottom: 36px;
}

.order-wait,
.order-missing {
    margin: 0;
    padding: 32px var(--order-inset);
}

.order-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "ids due"
        "title due"
        "customer due";
    gap: 2px 32px;
    padding: 20px 24px 18px var(--order-inset);
    border-bottom: 1px solid var(--kmt-edge);
    background: var(--plan-open);
    box-shadow: inset var(--plan-rail-width) 0 0 var(--plan-rail);
}

.order-head__ids {
    grid-area: ids;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    font-size: 14px;
    color: var(--kmt-steel);
}

.order-head__doc {
    font-weight: 600;
    color: var(--kmt-ink);
}

.order-head__ids .plan-tag {
    margin-left: 0;
}

.order-head__title {
    grid-area: title;
    margin: 6px 0 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 30px;
    overflow-wrap: anywhere;
}

.order-head__desc {
    display: block;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
}

.order-head__customer {
    grid-area: customer;
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--kmt-steel);
}

.order-head__due {
    grid-area: due;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
}

.order-head__label {
    font-size: 12px;
    color: var(--kmt-steel);
}

.order-head__due .plan-date {
    font-size: 18px;
}

.order-note {
    margin: 0;
    padding: 10px 24px 10px var(--order-inset);
    border-bottom: 1px solid var(--kmt-edge);
    background: var(--kmt-sheet-2);
    font-size: 13.5px;
    color: var(--kmt-steel);
}

.order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 18px 24px 0 var(--order-inset);
}

.order-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0 40px;
    padding: 0 24px 0 var(--order-inset);
}

.order-section {
    padding: 0 24px 0 var(--order-inset);
}

.order-title {
    margin: 22px 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--kmt-steel);
}

.order-line {
    display: block;
}

.order-empty {
    margin: 0;
    font-size: 13.5px;
    color: var(--kmt-steel);
}

.order-remarks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px 40px;
}

.order-remark {
    padding: 10px 14px;
    border-left: 3px solid var(--kmt-edge);
    background: var(--kmt-sheet-2);
}

.order-remark__source {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--kmt-steel);
}

.order-remark__text {
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.order-files {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.order-file.plan-btn {
    height: auto;
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
    white-space: normal;
    text-align: left;
    overflow-wrap: anywhere;
}

.order-delivery {
    margin: 0 0 4px;
}

@media (max-width: 600px) {
    .order {
        --order-inset: calc(14px + var(--plan-rail-width));
    }

    .order-head {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "ids"
            "title"
            "customer"
            "due";
        padding-right: 14px;
    }

    .order-head__due {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 4px 10px;
        margin-top: 12px;
        text-align: left;
    }

    .order-actions,
    .order-groups,
    .order-section {
        padding-right: 14px;
    }

    .order-groups,
    .order-remarks {
        grid-template-columns: minmax(0, 1fr);
    }

    /* On a phone the label stands above its value — long labels ("Liefertermin aus Ungarn") leave the value room. */
    .order .plan-facts {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .order .plan-facts dd {
        margin-bottom: 10px;
        font-size: 15px;
    }
}

/* ---- KLEEMANN call-off changes (v1.37) -------------------------------------------------------------------- */

/* On top of an open row: a white sheet with a signal edge — red when the change breaks the 6-week rule, amber when it
   keeps it, grey once it is decided or closed. The one place on the band that asks for a decision. */
.calloff {
    --calloff-edge: #A9B0B9;
    --calloff-ink: var(--kmt-ink);
    margin: 14px 0 6px;
    padding: 14px 18px 16px;
    border: 1px solid var(--kmt-edge);
    border-left: 4px solid var(--calloff-edge);
    border-radius: var(--kmt-radius-sm);
    background: var(--kmt-sheet);
}

.calloff--red {
    --calloff-edge: var(--kmt-red);
    --calloff-ink: var(--plan-ink-red);
}

.calloff--amber {
    --calloff-edge: var(--kmt-amber);
    --calloff-ink: var(--plan-ink-amber);
}

.calloff__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--calloff-ink);
}

.calloff__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 32px;
    margin: 0;
}

.calloff__facts dt {
    font-size: 12px;
    color: var(--kmt-steel);
}

.calloff__facts dd {
    margin: 2px 0 0;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.calloff__facts .calloff__key {
    font-weight: 700;
    color: var(--calloff-ink);
}

.calloff__verdict {
    margin: 12px 0 0;
    font-size: 13.5px;
}

.calloff__verdict--against {
    font-weight: 600;
    color: var(--plan-ink-red);
}

.calloff__decide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.calloff__reason.plan-input {
    flex: 1 1 260px;
    width: auto;
    max-width: 440px;
}

.calloff__hint {
    margin: 8px 0 0;
    font-size: 12.5px;
    color: var(--kmt-steel);
}

.calloff__decided {
    margin: 12px 0 0;
    font-size: 13.5px;
    font-weight: 600;
}

.calloff__comment {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: #3F4650;
}

/* Overview "Terminänderungen": the period in the bar, left of the search. */
.calloff-period {
    display: flex;
    gap: 10px;
}

.calloff-period__field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--kmt-steel);
    white-space: nowrap;
}

.calloff-period__field .plan-input {
    width: 150px;
}

/* The figures of the period under the bar: numbers first, what they count below — hairlines, no cards. */
.calloff-figures {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    border-bottom: 1px solid var(--kmt-edge);
    background: var(--kmt-sheet-2);
}

.calloff-figures > div {
    padding: 12px 28px 12px calc(16px + var(--plan-rail-width));
    border-right: 1px solid var(--kmt-edge-soft);
}

.calloff-figures > div + div {
    padding-left: 28px;
}

.calloff-figures dt {
    font-size: 12px;
    color: var(--kmt-steel);
}

.calloff-figures dd {
    margin: 2px 0 0;
    font-size: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.calloff-figures dd span {
    margin-left: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--kmt-steel);
}

.calloff-figures__against dd {
    color: var(--plan-ink-red);
}

/* The kind under the time and the outcome may wrap ("méltányosságból elfogadva" — 1280 px in Hungarian). */
.plan-c-lead {
    white-space: nowrap;
}

.plan-c-time .calloff-kind {
    white-space: normal;
}

.plan-c-outcome {
    min-width: 120px;
}

/* Order page: the change under the head band. */
.order-calloff {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 24px 0 var(--order-inset);
}

.order-calloff .calloff {
    align-self: stretch;
    max-width: 920px;
}

@media (max-width: 600px) {
    .order-calloff {
        padding-right: 14px;
    }
}
