/*
 * Arizcreations UI — "Symox" styling (2026-10-22): white cards on a cool grey canvas, blue primary with
 * soft tinted variants, dark-teal top bar with an underlined active tab, bold table headers over
 * hairline rows, 38 px controls, Geist (2026-10-25).
 *
 * Every colour is a token on :root (light); dark values are redefined under [data-theme="dark"] and under
 * prefers-color-scheme: dark for :root:not([data-theme="light"]). Components use tokens only.
 * Never style .js-* classes: they are behaviour hooks (see docs/ui-components.md).
 */

/* ------------------------------------------------------------------------
 * Fonts (self-hosted variable latin woff2, SIL OFL 1.1; licences beside the files in public/assets/fonts/)
 * Geist for text, Geist Mono for codes and numbers that are read in columns.
 * ---------------------------------------------------------------------- */

@font-face {
    font-family: "Geist";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/geist-latin-var.woff2") format("woff2");
}

@font-face {
    font-family: "Geist Mono";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/geist-mono-latin-var.woff2") format("woff2");
}

/* ------------------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------------- */

:root {
    color-scheme: light;

    --font-text: "Geist", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-heading: var(--font-text);
    --font-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;

    --bg: #f4f5f6;
    --surface: #ffffff;
    --surface2: #f8f9fa;
    --row-hover: #f1f3f5;
    --field: #ffffff;
    --field-border: #c5cbd2;
    --ink: #082a3e;
    --heading: #061e2c;
    --muted: #5c6173;
    --border: #eff0f2;
    --border2: #e2e5e8;

    --primary: #c2410c;
    --primary-hover: #9a3412;
    --on-primary: #ffffff;
    --primary-soft: #ffedd5;
    --primary-ink: #9a3412;

    --success: #33a186;
    --on-success: #ffffff;
    --success-soft: #d6ece7;
    --success-ink: #1a6b59;

    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --warning-ink: #854d0e;

    --danger: #fa6374;
    --on-danger: #ffffff;
    --danger-soft: #fee0e3;
    --danger-ink: #b7303f;

    --info: #4bafe1;
    --info-soft: #dbeff9;
    --info-ink: #1e5f82;

    --live: #33a186;

    --bar: #003032;
    --bar-text: #ffffff;
    --bar-muted: #b9cfd0;
    --bar-hover: #164547;
    --bar-line: #0f4446;
    --bar-divider: rgba(255, 255, 255, 0.2);
    --bar-active: #fb923c;
    --switch-track: #4a7375;
    --switch-knob: #ffffff;

    --backdrop: rgba(6, 30, 44, 0.45);
    --shadow: 0 2px 3px #e6e8eb;
    --shadow-lg: 0 5px 12px rgba(3, 15, 22, 0.12);
    --ring: 0 0 0 3px rgba(194, 65, 12, 0.25);
    --ring-danger: 0 0 0 3px rgba(250, 99, 116, 0.25);
    --focus-bar: #ffffff;

    --radius-sm: 4px;
    --radius: 4px;
    --radius-input: 5px;
    --radius-lg: 6px;
    --tap: 44px;
    --control: 38px;
    --control-sm: 32px;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0d1b25;
        --surface: #122633;
        --surface2: #17303f;
        --row-hover: #1c3849;
        --field: #0f2130;
        --field-border: #2d4a5d;
        --ink: #dde6ec;
        --heading: #ffffff;
        --muted: #9fb0bc;
        --border: #1f3a4a;
        --border2: #2d4a5d;
        --primary: #fb923c;
        --primary-hover: #fdba74;
        --on-primary: #2a1104;
        --primary-soft: #43240f;
        --primary-ink: #fdba74;
        --success: #4fc0a3;
        --on-success: #06212f;
        --success-soft: #133f35;
        --success-ink: #8fe0c8;
        --warning: #fbbf24;
        --warning-soft: #45320a;
        --warning-ink: #fde68a;
        --danger: #ff8491;
        --on-danger: #2a0a0f;
        --danger-soft: #4d1f27;
        --danger-ink: #ffb3bb;
        --info: #6cc0ec;
        --info-soft: #163a4e;
        --info-ink: #a6daf6;
        --live: #4fc0a3;
        --bar: #061e2c;
        --bar-text: #ffffff;
        --bar-muted: #a8b0c5;
        --bar-hover: #0f3043;
        --bar-line: #1b3a4b;
        --bar-divider: rgba(255, 255, 255, 0.2);
        --bar-active: #fb923c;
        --switch-track: #fb923c;
        --switch-knob: #2a1104;
        --backdrop: rgba(0, 0, 0, 0.6);
        --shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
        --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.5);
        --ring: 0 0 0 3px rgba(251, 146, 60, 0.4);
        --ring-danger: 0 0 0 3px rgba(255, 132, 145, 0.35);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1b25;
    --surface: #122633;
    --surface2: #17303f;
    --row-hover: #1c3849;
    --field: #0f2130;
    --field-border: #2d4a5d;
    --ink: #dde6ec;
    --heading: #ffffff;
    --muted: #9fb0bc;
    --border: #1f3a4a;
    --border2: #2d4a5d;
    --primary: #fb923c;
    --primary-hover: #fdba74;
    --on-primary: #2a1104;
    --primary-soft: #43240f;
    --primary-ink: #fdba74;
    --success: #4fc0a3;
    --on-success: #06212f;
    --success-soft: #133f35;
    --success-ink: #8fe0c8;
    --warning: #fbbf24;
    --warning-soft: #45320a;
    --warning-ink: #fde68a;
    --danger: #ff8491;
    --on-danger: #2a0a0f;
    --danger-soft: #4d1f27;
    --danger-ink: #ffb3bb;
    --info: #6cc0ec;
    --info-soft: #163a4e;
    --info-ink: #a6daf6;
    --live: #4fc0a3;
    --bar: #061e2c;
    --bar-text: #ffffff;
    --bar-muted: #a8b0c5;
    --bar-hover: #0f3043;
    --bar-line: #1b3a4b;
    --bar-divider: rgba(255, 255, 255, 0.2);
    --bar-active: #fb923c;
    --switch-track: #fb923c;
    --switch-knob: #2a1104;
    --backdrop: rgba(0, 0, 0, 0.6);
    --shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.5);
    --ring: 0 0 0 3px rgba(251, 146, 60, 0.4);
    --ring-danger: 0 0 0 3px rgba(255, 132, 145, 0.35);
}

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

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-text);
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--heading);
    text-wrap: balance;
}

p {
    margin: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

code {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

/* The hidden attribute always wins, even over display rules on component classes. */
[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.app-header :focus-visible {
    outline-color: var(--focus-bar);
}

/* Skip link: hidden until a keyboard user tabs to it, then shown above the header. */
.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1000;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: none;
}

.app-main:focus {
    outline: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------------------
 * Top bar (dark teal, horizontal navigation, underlined active tab)
 * ---------------------------------------------------------------------- */

.layout-app {
    min-height: 100vh;
    min-height: 100dvh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 70px;
    padding: 0 24px;
    color: var(--bar-text);
    background: var(--bar);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.12);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--bar-text);
    text-decoration: none;
    flex-shrink: 0;
}

.app-brand:hover {
    color: var(--bar-text);
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--on-primary);
    background: var(--primary);
}

.brand-mark--lg {
    width: 56px;
    height: 56px;
    font-size: 22px;
    border-radius: var(--radius-lg);
}

.app-brand__logo {
    display: block;
    height: 34px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    border-radius: 3px;
    background: #ffffff;
}

.app-brand__logo.brand-mark--lg {
    height: 56px;
    max-width: 180px;
}

.app-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.app-brand__name {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.app-brand__tagline {
    font-size: 11px;
    color: var(--bar-muted);
}

.app-nav {
    display: flex;
    align-self: stretch;
    align-items: stretch;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
    display: none;
}

.app-nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--bar-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color 160ms var(--ease);
}

.app-nav__link::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 0;
    left: 10px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: transparent;
    transition: background-color 160ms var(--ease);
}

.app-nav__link:hover {
    color: var(--bar-text);
    text-decoration: none;
}

.app-nav__link.is-active,
.app-nav__link.is-active:hover {
    color: var(--bar-text);
}

.app-nav__link.is-active::after {
    background: var(--bar-active);
}

/* Between two groups of the menu (work, records, admin, developer). */
.app-nav__divider {
    flex: 0 0 1px;
    align-self: center;
    height: 22px;
    margin: 0 6px;
    background: var(--bar-divider);
}

.app-user {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.app-user__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--bar-text);
}

/* The signed-in name links to "Change password" (keeps the bar short). */
.app-user__link {
    padding: 4px 6px;
    border-radius: var(--radius);
    text-decoration: none;
}

.app-user__link:hover,
.app-user__link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.app-header .btn--ghost {
    color: var(--bar-text);
    border-color: var(--bar-line);
    background: var(--bar-hover);
}

.app-header .btn--ghost:hover:not(:disabled) {
    color: var(--bar-text);
    border-color: var(--bar-muted);
    background: var(--bar-hover);
}

/* Full-width content: pages use the whole window, with a 24 px gutter. */
.app-main {
    width: 100%;
    padding: 24px;
}

/* Bare pages (sign-in, reset): the switch sits top-right over the canvas. */
.layout-bare {
    min-height: 100vh;
    /* Phones: 100vh includes the space under the browser bars, which made the sign-in page scroll and bounce. */
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.bare-bar {
    display: flex;
    justify-content: flex-end;
    padding: 16px 24px 0;
}

.layout-bare .app-main {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    padding: 24px;
}

/* ------------------------------------------------------------------------
 * Light/dark switch
 * ---------------------------------------------------------------------- */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 6px 0 12px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--muted);
}

.app-header .theme-toggle {
    color: var(--bar-text);
    border-color: var(--bar-line);
    background: var(--bar-hover);
}

.app-header .theme-toggle:hover {
    border-color: var(--bar-muted);
}

.theme-toggle__track {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: var(--switch-track);
    transition: background-color 160ms var(--ease);
}

.theme-toggle__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--switch-knob);
    transition: transform 160ms var(--ease);
}

.theme-toggle[aria-pressed="true"] .theme-toggle__knob {
    transform: translateX(14px);
}

/* ------------------------------------------------------------------------
 * Page frame
 * ---------------------------------------------------------------------- */

.page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
}

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.page-eyebrow {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.page-eyebrow .link {
    font-size: inherit;
    letter-spacing: inherit;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

h2.page-title {
    font-size: 16px;
}

.page-title small {
    margin-left: 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
}

.page-lead {
    max-width: 68ch;
    color: var(--muted);
}

.page > section + section {
    margin-top: 4px;
}

/* ------------------------------------------------------------------------
 * Cards: auth card, module cards, side menu, tables, dialogs all share this surface.
 * ---------------------------------------------------------------------- */

.auth-card {
    width: min(420px, 100%);
    padding: 28px 28px 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.layout-app .app-main > .auth-card {
    margin: 0 auto;
}

.auth-card__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.auth-card__heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-card__title {
    font-size: 18px;
    font-weight: 600;
}

.auth-card__lead {
    margin-bottom: 20px;
    color: var(--muted);
}

.auth-card .form-actions {
    justify-content: space-between;
}

.auth-card .form-actions .btn {
    min-width: 140px;
}

.auth-card .form-actions .link {
    font-size: 13px;
}

/* Sign-in: a wide two-panel screen (brand panel with the illustration, form panel). */
.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    width: min(1160px, 100%);
    min-height: min(680px, calc(100vh - 120px));
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 30, 32, 0.18);
}

.auth-split__art {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 40px 44px 28px;
    color: var(--bar-text);
    background: var(--bar);
}

.auth-split__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.auth-split__name {
    font-size: 17px;
    font-weight: 700;
}

.auth-split__headline {
    max-width: 22ch;
    margin: 18px 0 0;
    font-size: clamp(26px, 2.6vw, 34px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--bar-text);
}

.auth-split__points {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14.5px;
    color: var(--bar-muted);
}

.auth-split__points li {
    align-items: flex-start;
    gap: 10px;
}

.auth-split__points .icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    color: var(--bar-active);
}

.auth-split__image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: max(200px, calc(100vh - 470px));
    margin-top: auto;
}

.auth-split__panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
    padding: 48px clamp(28px, 5vw, 72px);
}

.auth-split__eyebrow {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
}

.auth-split__title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--heading);
}

.auth-split__lead {
    margin: 6px 0 0;
    font-size: 15px;
    color: var(--muted);
}

.auth-split__form {
    gap: 18px;
}

.auth-split__form .form-field input {
    min-height: 46px;
    font-size: 15px;
}

.auth-split__label-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
}

.auth-split__label-row .link {
    font-size: 13px;
}

.auth-split__submit {
    width: 100%;
    min-height: 46px;
    font-size: 15px;
}

.auth-split__footnote {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .auth-split {
        grid-template-columns: minmax(0, 1fr);
        width: min(520px, 100%);
        min-height: 0;
    }

    .auth-split__art {
        gap: 12px;
        padding: 24px 24px 22px;
    }

    .auth-split__headline {
        margin-top: 6px;
        font-size: 22px;
    }

    .auth-split__points,
    .auth-split__image {
        display: none;
    }

    .auth-split__panel {
        padding: 28px 24px 30px;
    }
}

/* Phones: the sign-in card starts near the top (no centring gap), so it fits the screen without scrolling. */
@media (max-width: 600px) {
    .bare-bar {
        padding: 12px 16px 0;
    }

    .layout-bare .app-main {
        align-items: start;
        padding: 12px 16px 16px;
    }
}

/* Password fields: an eye button inside the field shows or hides what was typed (js/app.js). */
.password-field {
    position: relative;
    display: block;
}

.password-field > input {
    width: 100%;
    padding-right: 44px;
}

/* Edge draws its own eye in password fields; ours replaces it so there are never two. */
.password-field > input::-ms-reveal,
.password-field > input::-ms-clear {
    display: none;
}

.password-field__toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-field__toggle:hover,
.password-field__toggle[aria-pressed="true"] {
    color: var(--heading);
}

.password-field__toggle .icon {
    width: 18px;
    height: 18px;
}

/* ------------------------------------------------------------------------
 * Forms
 * ---------------------------------------------------------------------- */

.form {
    display: grid;
    gap: 16px;
}

.form-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.form-field label,
.form-field .form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--heading);
}

.form-field small,
.form-group legend small {
    font-weight: 400;
    color: var(--muted);
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-field textarea,
.form-field select {
    width: 100%;
    min-height: var(--control);
    padding: 7px 12px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-input);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--field);
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.form-field textarea {
    min-height: 90px;
    resize: vertical;
}

.form-field select {
    appearance: none;
    padding-right: 36px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.form-field input[type="file"] {
    min-height: var(--control);
    padding: 7px 0;
    color: var(--ink);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--muted);
    opacity: 0.9;
}

.form-field input:focus-visible,
.form-field textarea:focus-visible,
.form-field select:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.form-field input[type="checkbox"],
.form-field input[type="radio"],
.check-grid__item input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
}

.form-field--check label {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: var(--control);
    font-weight: 400;
    color: var(--ink);
}

.form-field .is-invalid,
.form-group .is-invalid,
.is-invalid {
    border-color: var(--danger) !important;
}

.form-field input.is-invalid:focus-visible,
.form-field textarea.is-invalid:focus-visible,
.form-field select.is-invalid:focus-visible {
    box-shadow: var(--ring-danger);
}

.field-error {
    font-size: 13px;
    color: var(--danger-ink);
}

.form-hint {
    font-size: 13px;
    color: var(--muted);
}

.form-hint .btn {
    margin-left: 6px;
    vertical-align: middle;
}

.form-group {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 14px 16px 16px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-input);
}

.form-group legend {
    padding: 0 6px;
    font-weight: 600;
    color: var(--heading);
}

.form-group:disabled {
    opacity: 0.55;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px 16px;
}

.check-grid__item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    font-weight: 400;
}

.check-grid__heading {
    margin: 4px 0 -4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.check-grid__item small {
    color: var(--muted);
}

.check-grid__item--sub {
    padding-left: 22px;
    color: var(--muted);
}

/* A search form laid out in one row. */
.form.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-bar .form-field {
    flex: 1 1 260px;
}

.filter-bar .form-field--check {
    flex: 0 0 auto;
}

/* Settings > Production > Types: one part type picker, not stretched across the page. */
.filter-bar--single .form-field {
    flex: 0 1 360px;
}

.filter-bar__note {
    margin-left: auto;
    font-size: 13px;
    color: var(--muted);
}

.inline-field {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.inline-field .form-field {
    flex: 1 1 220px;
}

/* ------------------------------------------------------------------------
 * Buttons: solid primary, light default, soft danger, ghost, small, icon.
 * ---------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--control);
    padding: 0 16px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
    background: var(--surface2);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 160ms var(--ease), border-color 160ms var(--ease),
        color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.btn:hover:not(:disabled) {
    color: var(--ink);
    border-color: var(--field-border);
    background: var(--border);
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
}

.btn--primary {
    color: var(--on-primary);
    border-color: var(--primary);
    background: var(--primary);
}

/* A pale orange still reads as "press me"; a switched-off main button turns neutral instead. */
.btn--primary:disabled:not(.is-loading),
.btn--primary[aria-disabled="true"]:not(.is-loading) {
    color: var(--muted);
    border-color: var(--border2);
    background: var(--surface2);
    opacity: 1;
}

.btn--primary:hover:not(:disabled) {
    color: var(--on-primary);
    border-color: var(--primary-hover);
    background: var(--primary-hover);
}

.btn--ghost {
    color: var(--primary);
    border-color: transparent;
    background: transparent;
}

.btn--ghost:hover:not(:disabled) {
    color: var(--primary-ink);
    border-color: transparent;
    background: var(--primary-soft);
}

.btn--danger {
    color: var(--danger-ink);
    border-color: transparent;
    background: var(--danger-soft);
}

.btn--danger:hover:not(:disabled) {
    color: var(--on-danger);
    border-color: var(--danger);
    background: var(--danger);
}

.btn--small {
    min-height: var(--control-sm);
    padding: 0 12px;
    font-size: 13px;
}

.btn--icon {
    min-width: var(--control-sm);
    padding: 0 8px;
    font-size: 15px;
    line-height: 1;
}

.link {
    font-weight: 500;
    color: var(--primary);
}

.link:hover {
    color: var(--primary-hover);
}

/* Filter pills (status filters above a list). Selected = aria-pressed="true" or .is-active. */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    background: var(--surface);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}

.pill:hover {
    color: var(--primary-ink);
    border-color: var(--primary);
    background: var(--primary-soft);
    text-decoration: none;
}

.pill[aria-pressed="true"],
.pill.is-active {
    color: var(--on-primary);
    border-color: var(--primary);
    background: var(--primary);
}

/* ------------------------------------------------------------------------
 * Tables (list views): bold header, hairline rows, quiet actions.
 * ---------------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.table th,
.table td {
    padding: 8px 16px;
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--heading);
    background: var(--surface);
    border-bottom: 1px solid var(--border2);
}

.table tbody td {
    height: 44px;
    border-bottom: 1px solid var(--border);
    transition: background-color 120ms var(--ease);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

/* Alternate row shading; the hover tint is one step stronger so it still reads on shaded rows. */
.table tbody tr:nth-child(even) td {
    background: var(--surface2);
}

.table tbody tr:hover td {
    background: var(--row-hover);
}

.table tbody tr[aria-current="true"] td,
.table tbody tr[aria-selected="true"] td,
.table tbody tr[aria-current="true"]:nth-child(even) td,
.table tbody tr[aria-selected="true"]:nth-child(even) td {
    background: var(--primary-soft);
}

/* Group header rows do not take part in the striping. */
.table tbody tr:nth-child(even) th[scope="colgroup"] {
    background: var(--surface2);
}

.table td:first-child,
.table td strong {
    font-weight: 600;
    color: var(--heading);
}

.table th[scope="colgroup"] {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.table tbody tr:first-child th[scope="colgroup"] {
    border-top: 0;
}

.table-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    white-space: nowrap;
}

.table .table-actions {
    display: table-cell;
    text-align: right;
}

.table .table-actions .btn + .btn {
    margin-left: 4px;
}

/* Buttons with and without an icon sit on one line ("Edit" no longer floats above "Deactivate"). */
.table .table-actions .btn {
    vertical-align: middle;
}

/* Row actions are quiet links that gain a surface on hover; danger stays soft. */
.table .btn:not(.btn--primary):not(.btn--danger) {
    min-height: var(--control-sm);
    padding: 0 10px;
    border-color: transparent;
    font-size: 13px;
    color: var(--primary);
    background: transparent;
}

.table .btn:not(.btn--primary):not(.btn--danger):hover:not(:disabled) {
    color: var(--primary-ink);
    border-color: transparent;
    background: var(--primary-soft);
}

.table .btn.btn--icon:not(.btn--primary):not(.btn--danger) {
    min-width: var(--control-sm);
    padding: 0;
    border-color: var(--border2);
    color: var(--ink);
    background: var(--surface2);
}

.table .btn.btn--icon:not(.btn--primary):not(.btn--danger):hover:not(:disabled) {
    border-color: var(--field-border);
    color: var(--heading);
    background: var(--border);
}

.table .btn--icon:disabled {
    opacity: 0.35;
}

/* Row danger actions (Deactivate, Remove) stay grey in the list and turn red when pointed at or focused,
 * so a column of red words does not shout on every row. The confirm dialog still says what will happen. */
.table .btn--danger {
    min-height: var(--control-sm);
    padding: 0 10px;
    font-size: 13px;
    color: var(--muted);
    background: transparent;
}

.table .btn--danger:focus-visible {
    color: var(--danger-ink);
}

.table .btn--danger:hover:not(:disabled) {
    color: var(--danger-ink);
    border-color: transparent;
    background: var(--danger-soft);
}

.table-logo {
    height: 28px;
    width: auto;
    max-width: 80px;
    margin-right: 10px;
    object-fit: contain;
    vertical-align: middle;
    border-radius: 3px;
}

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

.pager .form-hint {
    margin: 0;
}

/* ------------------------------------------------------------------------
 * Badges (soft tints)
 * ---------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--muted);
    background: var(--surface2);
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge--ok {
    color: var(--success-ink);
    background: var(--success-soft);
}

.badge--warn {
    color: var(--warning-ink);
    background: var(--warning-soft);
}

.badge--danger {
    color: var(--danger-ink);
    background: var(--danger-soft);
}

.badge--info {
    color: var(--info-ink);
    background: var(--info-soft);
}

/* Users list: "last seen" text when the user is not online */
.user-seen {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

.empty-state {
    padding: 28px;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border2);
    border-radius: var(--radius);
}

/* ------------------------------------------------------------------------
 * Dialogs, definition lists, images
 * ---------------------------------------------------------------------- */

.dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 24px;
    color: var(--ink);
    background: var(--surface);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Part type dialog: room for the route table with its parts and cabinets scanning choices (0034). */
.dialog--route {
    width: min(860px, calc(100vw - 32px));
}

.route-scan {
    min-width: 170px;
    min-height: var(--control-sm);
    padding: 4px 32px 4px 10px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-input);
    font-size: 14px;
    color: var(--ink);
    background: var(--field);
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.route-scan:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

/* Wide dialog: details on the left, option groups on the right (stacks on narrow screens). */
.dialog--wide {
    width: min(1040px, calc(100vw - 32px));
}

.dialog-columns {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 0 32px;
    align-items: start;
}

.dialog-columns__main,
.dialog-columns__side {
    display: grid;
    gap: 16px;
    align-content: start;
    min-width: 0;
}

@media (max-width: 760px) {
    .dialog-columns {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

.dialog::backdrop {
    background: var(--backdrop);
}

/* Browsers without <dialog> (Safari before iOS 15.4): js/app.js opens windows itself, under the notices. */
dialog:not([open]) {
    display: none;
}

.dialog--fallback {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 991;
    display: block;
    margin: 0;
    transform: translate(-50%, -50%);
}

.dialog-fallback-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 990;
    background: var(--backdrop);
}

.dialog-fallback-backdrop[hidden] {
    display: none;
}

.has-dialog-fallback,
.has-dialog-fallback body {
    overflow: hidden;
}

/* A window's title with a Close (X) button at its right (Arin, 2026-11-06: "Add photos?"). */
.dialog__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.dialog__head .dialog__title {
    margin-bottom: 0;
    border-bottom: 0;
}

.dialog__head .btn {
    flex: none;
    margin-top: -4px;
}

.dialog__title {
    margin-bottom: 16px;
    padding-bottom: 12px;
    font-size: 16px;
    border-bottom: 1px solid var(--border);
}

.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 16px;
    margin: 0 0 20px;
}

.kv dt {
    font-weight: 500;
    color: var(--muted);
}

.kv dd {
    margin: 0;
}

.kv code {
    padding: 2px 6px;
    font-size: 15px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
}

.logo-preview {
    max-height: 80px;
    max-width: 100%;
    border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------------------
 * Dashboard module cards
 * ---------------------------------------------------------------------- */

.module-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.module-card {
    display: grid;
    gap: 4px;
    padding: 20px;
    color: var(--ink);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.module-card--link {
    transition: box-shadow 160ms var(--ease), transform 160ms var(--ease);
}

.module-card--link:hover {
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.module-card--locked {
    opacity: 0.6;
}

.module-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
}

.module-card__note {
    font-size: 13px;
    color: var(--muted);
}

/* ------------------------------------------------------------------------
 * Settings: side menu + one panel at a time
 * ---------------------------------------------------------------------- */

.settings-layout {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.settings-panels {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.side-menu {
    position: sticky;
    top: 86px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.side-menu__group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
}

.side-menu__group + .side-menu__group {
    border-top: 1px solid var(--border);
}

/* Group titles are shaded bands that separate the sections. */
.side-menu__title {
    margin: -6px -6px 4px;
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-ink);
    background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface));
    border-bottom: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
}

.side-menu__link {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.side-menu__link:hover {
    color: var(--heading);
    background: var(--surface2);
    text-decoration: none;
}

.side-menu__link.is-active,
.side-menu__link[aria-current="page"] {
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-soft);
}

/* ------------------------------------------------------------------------
 * Loading state (api.js) and toasts (notify.js)
 * ---------------------------------------------------------------------- */

.is-loading {
    position: relative;
    cursor: progress;
    color: transparent !important;
}

.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 1em;
    height: 1em;
    border: 2px solid var(--primary);
    border-right-color: transparent;
    border-radius: 50%;
    animation: is-loading-spin 0.8s linear infinite;
}

.btn--primary.is-loading::after {
    border-color: var(--on-primary);
    border-right-color: transparent;
}

.app-header .is-loading::after {
    border-color: var(--bar-text);
    border-right-color: transparent;
}

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

.notify-region {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(26rem, calc(100vw - 32px));
}

.notify {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.notify--info {
    border-left-color: var(--primary);
}

.notify--success {
    border-left-color: var(--success);
}

.notify--error {
    border-left-color: var(--danger);
}

.notify__text {
    flex: 1;
    overflow-wrap: anywhere;
}

.notify__close {
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.notify__close:hover {
    color: var(--heading);
}

.notify__close:focus-visible {
    outline: 2px solid var(--primary);
    border-radius: 3px;
}

/* ------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */

@media (max-width: 860px) {
    .app-header {
        flex-wrap: wrap;
        gap: 8px 16px;
        padding: 10px 16px;
        min-height: 0;
    }

    .app-nav {
        order: 3;
        width: 100%;
        align-self: auto;
        min-height: 42px;
    }

    .app-user {
        margin-left: auto;
    }

    .app-main {
        padding: 16px;
    }

    .settings-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .side-menu {
        position: static;
        flex-direction: row;
        gap: 4px;
        padding: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .side-menu__group {
        flex-direction: row;
        gap: 4px;
        padding: 0;
    }

    .side-menu__group + .side-menu__group {
        border-top: 0;
    }

    .side-menu__title {
        display: none;
    }

    .side-menu__link {
        white-space: nowrap;
        border-radius: 999px;
    }

    .page-header .btn {
        width: 100%;
    }

    .page-header .btn + .btn {
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .app-brand__tagline {
        display: none;
    }

    .app-user__name {
        display: none;
    }

    .auth-card {
        padding: 22px 18px;
    }
}

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

    .is-loading::after {
        animation-duration: 1.5s !important;
    }

    .module-card--link:hover {
        transform: none;
    }
}

@media print {
    .app-header,
    .bare-bar,
    .notify-region,
    .theme-toggle,
    .table-actions,
    .page-header .btn {
        display: none !important;
    }

    body {
        background: #ffffff;
    }

    .table-wrap,
    .module-card,
    .side-menu {
        box-shadow: none;
        border: 1px solid #cccccc;
    }
}

/* ------------------------------------------------------------------------
 * Master–detail pages (Materials): a list of items on the left, the chosen item's detail on the right.
 * ---------------------------------------------------------------------- */

.split-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.split-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.split-list__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.split-list__head h2 {
    font-size: 15px;
}

.split-detail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.split-placeholder {
    display: grid;
    place-items: center;
    min-height: 220px;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border2);
    border-radius: var(--radius);
}

/* Selectable list of items (buttons) inside a card. */
.item-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.item-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius);
    text-align: left;
    color: var(--ink);
    background: transparent;
    cursor: pointer;
    transition: background-color 140ms var(--ease);
}

.item-list__item:hover {
    background: var(--surface2);
}

.item-list__item[aria-current="true"] {
    background: var(--primary-soft);
}

.item-list__item:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.item-list__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.item-list__title {
    font-weight: 600;
    color: var(--heading);
    overflow-wrap: anywhere;
}

.item-list__item[aria-current="true"] .item-list__title {
    color: var(--primary-ink);
}

.item-list__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}

.item-list__meta code {
    font-size: 12px;
}

.item-list__count {
    flex-shrink: 0;
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--muted);
    background: var(--surface2);
}

.item-list__item[aria-current="true"] .item-list__count {
    color: var(--on-primary);
    background: var(--primary);
}

/* Header of the detail panel: title with badges on the left, actions on the right. */
.detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 16px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.detail-header__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.detail-header__title h2 {
    font-size: 17px;
}

.detail-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

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

/* 3.3 projects list */

.project-filters .project-filters__search {
    flex: 2 1 280px;
}

.project-filters .project-filters__select {
    flex: 1 1 160px;
}

.project-filters .project-filters__select--narrow {
    flex: 0 1 130px;
}

/*
 * Keep the columns readable on phones: the table scrolls inside .table-wrap instead of squashing. It is the
 * containing block of its .visually-hidden texts, so they scroll with it instead of widening the page.
 */
.project-table {
    position: relative;
    min-width: 820px;
}

.project-table tbody tr[data-id] {
    cursor: pointer;
}

.project-table tbody tr:focus-within td {
    background: var(--row-hover);
}

.project-table__sub {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.project-table thead .project-table__sub {
    font-size: 11px;
}

.project-table__name {
    min-width: 180px;
}

.project-table__customer {
    min-width: 160px;
}

/* Customer ID, then the job name: the job as the labels name it (Arin, 2026-10-27). */
.project-table__code {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The project number (customer ID - project count) in its own column, as big as the job number. */
.project-table__project {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    white-space: nowrap;
}

.project-table__due {
    white-space: nowrap;
}

.project-status-select {
    min-width: 170px;
    max-width: 240px;
    min-height: var(--control-sm);
    padding: 4px 30px 4px 10px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-input);
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    background-color: var(--field);
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    appearance: none;
    cursor: pointer;
}

.project-status-select:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.project-status-select:disabled {
    cursor: progress;
    opacity: 0.7;
}

/* API.* marks the pending control .is-loading (built for buttons); a select keeps its text visible. */
.project-status-select.is-loading {
    color: var(--muted) !important;
}

.priority-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 22px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.priority-pill--1 {
    color: var(--danger-ink);
    background: var(--danger-soft);
    border-color: var(--danger);
}

.priority-pill--2 {
    color: var(--warning-ink);
    background: var(--warning-soft);
}

.priority-pill--3 {
    color: var(--info-ink);
    background: var(--info-soft);
}

.priority-pill--4 {
    color: var(--muted);
    background: var(--surface2);
    border-color: var(--border2);
}

.due-date {
    color: var(--ink);
}

.due-date--late {
    font-weight: 600;
    color: var(--danger-ink);
}

.due-date--soon {
    font-weight: 600;
    color: var(--warning-ink);
}

.project-table__due .badge {
    margin-left: 6px;
}

.line-counts {
    white-space: nowrap;
    color: var(--ink);
}

.line-counts--none,
.line-counts__sep {
    color: var(--muted);
}

/* The kinds of parts a job has, small tags under its line counts (wrap within the cell). */
.project-part-types {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 14rem;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.project-part-types__item {
    padding: 1px 7px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    background: var(--surface2);
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.5;
    white-space: nowrap;
}

.project-part-types__item.is-match {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.project-empty {
    display: grid;
    justify-items: center;
    gap: 12px;
}

.project-empty p {
    margin: 0;
}

/* 3.3 job entry */

/* Header badges and the Send / Close actions next to the page title. */
.job-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

/* A long badge (e.g. "Now at: Cutting · Packaging / Wrapping · ...") wraps instead of widening a phone screen. */
.badge--wrap {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* The buttons stay at the right even when many badges push them onto their own line; the hint wraps under them. */
.job-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    max-width: 520px;
    margin-left: auto;
}

.job-actions__hint {
    flex-basis: 100%;
    text-align: right;
}

/* State notices (in production, closed, stale edit). */
.job-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px 16px;
    color: var(--ink);
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
}

.job-notice p {
    margin: 0;
}

.job-notice--info {
    color: var(--info-ink);
    background: var(--info-soft);
    border-color: transparent;
}

.job-notice--danger {
    color: var(--danger-ink);
    background: var(--danger-soft);
    border-color: transparent;
}

/* The header card and its responsive field grid (also used inside the line dialogs). */
.job-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.job-card__title {
    font-size: 15px;
}

.job-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.job-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
    align-items: start;
    gap: 16px 20px;
}

.job-grid > .form-field {
    align-content: start;
}

.job-grid__wide {
    grid-column: span 2;
}

.job-grid__full {
    grid-column: 1 / -1;
}

/* The material line editor's titled blocks (Arin, 2026-11-03): "Panel stock material" (brand, color, quantity; order
   status, color code, unit under them) and "Edge banding material" (brand and color; the line's text and notes). */
.line-block {
    display: grid;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
}

.line-block__title {
    padding: 0 4px;
    font-weight: 600;
    color: var(--heading);
}

.line-block__grid {
    display: grid;
    align-items: start;
    gap: 16px 20px;
}

.line-block__grid > .form-field {
    min-width: 0;
    align-content: start;
}

.line-block__grid--material {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
        "brand color qty"
        "status code unit"
        "vendor . .";
}

.line-block__grid--edge {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
        "ebrand ecolor"
        "evendor ."
        "etext etext"
        "enotes enotes";
}

/* A name typed because it is not in the list (0044): under its select, which reads "Other ... (type the name)". */
.typed-name {
    margin-top: 6px;
}

.line-block__brand { grid-area: brand; }
.line-block__color { grid-area: color; }
.line-block__qty { grid-area: qty; }
.line-block__status { grid-area: status; }
.line-block__code { grid-area: code; }
.line-block__unit { grid-area: unit; }
.line-block__ebrand { grid-area: ebrand; }
.line-block__ecolor { grid-area: ecolor; }
.line-block__etext { grid-area: etext; }
.line-block__enotes { grid-area: enotes; }
.line-block__vendor { grid-area: vendor; }
.line-block__evendor { grid-area: evendor; }

@media (max-width: 600px) {
    .line-block__grid--material {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "brand" "color" "code" "qty" "unit" "vendor" "status";
    }

    .line-block__grid--edge {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "ebrand" "ecolor" "evendor" "etext" "enotes";
    }
}

/* More edge bandings on a line (0043): up to three rows under the first banding. */
.edge-more {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.edge-more__list {
    display: grid;
    gap: 10px;
}

.edge-more__list:empty {
    display: none;
}

.edge-more .btn {
    justify-self: start;
}

.edge-extra {
    margin: 0;
    padding: 10px 12px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 0;
}

.edge-extra__title {
    padding: 0 4px;
    font-weight: 600;
    color: var(--ink);
}

.edge-extra__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.edge-extra__text {
    grid-column: 1 / -1;
}

.edge-extra .edge-extra__remove {
    margin-top: 8px;
}

.job-cell-banding {
    color: var(--ink);
}

@media (max-width: 600px) {
    .edge-extra__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* "Must be scanned on this job" (0038): cabinets and one tick per part type of the job. */
.job-scan__title {
    font-weight: 600;
    color: var(--ink);
}

.job-static {
    display: flex;
    align-items: center;
    min-height: var(--control);
}

.job-dialog .form-field input[readonly][type="text"] {
    color: var(--muted);
    background: var(--surface2);
}

/* Line grids: one row per line, scrolling sideways inside .table-wrap on narrow screens. */
.job-lines {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

/* The section header and what is under it (the table, the empty note, the drop zone) read as one card. */
.job-lines > .detail-header {
    border-bottom: 1px solid var(--border);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.job-lines > .detail-header ~ .table-wrap,
.job-lines > .detail-header ~ .empty-state {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.job-lines > .detail-header ~ .empty-state {
    border: 0;
    box-shadow: var(--shadow);
}

.job-files.job-lines > .job-files__drop {
    margin: 0;
    border-top-width: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}

.job-files.job-lines > .job-files__grid:not(:empty) {
    margin-top: 14px;
}

/* With a drop zone on screen ("Drop PDFs, photos … here") a second "No files yet" says nothing new. */
.job-files.job-lines > .job-files__drop ~ .empty-state {
    display: none;
}

.job-lines-table td {
    white-space: nowrap;
}

.job-lines-table td.job-cell-wrap {
    min-width: 120px;
    max-width: 320px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.job-lines-table .job-cell-number,
.job-lines-table th.job-cell-number {
    text-align: right;
}

.job-cell-sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.job-dialog {
    width: min(760px, calc(100vw - 32px));
}

.job-confirm p {
    margin: 0 0 12px;
}

/* Delete permanently (administrators, 2026-11-03): set apart from the everyday cards at the bottom of the job. */
.job-danger {
    border: 1px solid var(--danger-soft);
    border-left: 4px solid var(--danger);
}

.job-danger .form-hint {
    margin: 0;
}

.job-danger .form-actions {
    justify-content: flex-start;
}

.job-confirm .job-notice--danger {
    display: block;
}

@media (max-width: 860px) {
    .job-actions {
        width: 100%;
        max-width: none;
    }

    .job-actions .btn {
        flex: 1 1 200px;
    }
}

@media (max-width: 600px) {
    .job-grid__wide {
        grid-column: 1 / -1;
    }

    .job-actions__hint {
        text-align: left;
    }

    .job-card {
        padding: 16px;
    }
}

/* 3.4 ordering printout */

.printout__header {
    align-items: flex-start;
}

.printout__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.printout__job {
    display: grid;
    gap: 6px;
    margin-bottom: 20px;
    break-inside: avoid;
}

.printout__job-title {
    margin: 0;
    font-size: 15px;
}

.printout__job-title small {
    margin-left: 8px;
    font-weight: 500;
    color: var(--muted);
}

.printout__job-meta {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.printout__table {
    table-layout: fixed;
    width: 100%;
}

.printout__table th:nth-child(1) {
    width: 16%;
}

.printout__table th:nth-child(3) {
    width: 20%;
}

.printout__num {
    width: 7%;
    text-align: right;
}

.printout__table td {
    overflow-wrap: anywhere;
}

.printout__check {
    width: 72px;
    text-align: center;
}

.printout__box {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--muted);
    border-radius: 2px;
}

@media print {
    .app-main {
        padding: 0;
    }

    .printout__actions {
        display: none !important;
    }

    .printout .table {
        font-size: 11px;
    }

    .printout .table tr:nth-child(even) td {
        background: transparent;
    }

    .printout .table th,
    .printout .table td {
        padding: 4px 6px;
        height: auto;
    }
}

/* Job invoice printout: bill-to and reference facts side by side, priced lines, totals in the foot. */

.invoice__parties {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 64px;
    margin-bottom: 20px;
}

.invoice__party h2 {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.invoice__customer {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.invoice__facts {
    display: grid;
    grid-template-columns: auto auto;
    gap: 2px 16px;
    margin: 0 0 0 auto;
    font-size: 14px;
}

.invoice__facts dt {
    color: var(--muted);
}

.invoice__facts dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

.invoice__table {
    width: 100%;
}

.invoice__num {
    text-align: right;
    white-space: nowrap;
}

.invoice__table tfoot th {
    text-align: left;
    font-weight: 500;
}

.invoice__table tfoot td {
    font-weight: 500;
}

.invoice__table .invoice__total th,
.invoice__table .invoice__total td {
    font-size: 15px;
    font-weight: 700;
    border-top: 2px solid var(--border, #cccccc);
}

.invoice__note {
    font-size: 13px;
    color: var(--muted);
}

.invoice__footer {
    margin-top: 32px;
    font-size: 13px;
    color: var(--muted);
}

.invoice__footer p {
    margin: 0 0 4px;
}

@media print {
    .invoice {
        /* The print rules zero the main padding; keep invoice content off the paper edge. */
        padding: 0 12px;
    }

    .invoice__table {
        font-size: 11px;
    }
}

/* 3.4 ordering page */

.ordering-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Tabs: underlined like the top bar; the selected tab is orange. */
.ordering-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border2);
}

.ordering-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 0 16px;
    border: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    font: inherit;
    font-weight: 500;
    color: var(--muted);
    background: transparent;
    box-shadow: inset 0 -2px 0 transparent;
    white-space: nowrap;
    cursor: pointer;
    transition: color 160ms var(--ease), box-shadow 160ms var(--ease), background-color 160ms var(--ease);
}

.ordering-tab:hover {
    color: var(--heading);
    background: var(--surface2);
}

.ordering-tab[aria-selected="true"] {
    color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
}

.ordering-tab:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.ordering-tab__count {
    min-width: 24px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--muted);
    background: var(--surface2);
}

.ordering-tab[aria-selected="true"] .ordering-tab__count {
    color: var(--primary-ink);
    background: var(--primary-soft);
}

.ordering-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.ordering-filters .ordering-filters__search {
    flex: 2 1 260px;
}

.ordering-filters .ordering-filters__select {
    flex: 1 1 190px;
}

.ordering-filters .ordering-filters__check {
    flex: 0 0 auto;
}

.ordering-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 16px;
}

.ordering-toolbar p {
    margin: 0;
}

.ordering-scope-note,
.ordering-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 16px;
    border-radius: var(--radius);
}

.ordering-scope-note {
    color: var(--info-ink);
    background: var(--info-soft);
}

.ordering-notice {
    color: var(--danger-ink);
    background: var(--danger-soft);
}

.ordering-scope-note p,
.ordering-notice p {
    flex: 1 1 320px;
    margin: 0;
}

/* The table scrolls inside .table-wrap on narrow screens; it contains its .visually-hidden texts. */
.ordering-table {
    position: relative;
    min-width: 960px;
}

.ordering-table td {
    white-space: nowrap;
}

.ordering-table .ordering-select {
    width: 52px;
    padding-right: 4px;
    text-align: center;
}

.ordering-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--control-sm);
    min-height: var(--control-sm);
    cursor: pointer;
}

.ordering-check__box {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.ordering-check__box:disabled {
    cursor: default;
}

.ordering-table .ordering-cell-number {
    text-align: right;
}

.ordering-table td.ordering-cell-wrap {
    min-width: 120px;
    max-width: 280px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ordering-table td.ordering-cell-strong {
    font-weight: 600;
    color: var(--heading);
}

/* List view: every job group is its own table, so fixed shared widths keep Qty, Stage and Order status in the
 * same place from one job to the next. Notes takes what is left. */
.ordering-lines:not(.ordering-combined__table):not(.is-stacked) {
    table-layout: fixed;
}

.ordering-lines:not(.ordering-combined__table):not(.is-stacked) td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ordering-lines:not(.ordering-combined__table):not(.is-stacked) td.ordering-cell-stage,
.ordering-lines:not(.ordering-combined__table):not(.is-stacked) td.ordering-cell-status {
    white-space: normal;
}

.ordering-lines:not(.ordering-combined__table) .ordering-col--part_type_name,
.ordering-lines:not(.ordering-combined__table) .ordering-col--category {
    width: 12%;
}

.ordering-lines:not(.ordering-combined__table) .ordering-col--brand_name,
.ordering-lines:not(.ordering-combined__table) .ordering-col--brand {
    width: 10%;
}

.ordering-lines:not(.ordering-combined__table) .ordering-col--color_name,
.ordering-lines:not(.ordering-combined__table) .ordering-col--part_name,
.ordering-lines:not(.ordering-combined__table) .ordering-col--specification,
.ordering-lines:not(.ordering-combined__table) .ordering-col--status {
    width: 14%;
}

.ordering-lines:not(.ordering-combined__table) .ordering-col--stage {
    width: 13%;
}

.ordering-lines:not(.ordering-combined__table) .ordering-col--color_code {
    width: 9%;
}

/* The vendor (0044) takes its room from the color and the code. */
.ordering-lines:not(.ordering-combined__table) .ordering-col--supplier_name {
    width: 10%;
}

.ordering-lines:not(.ordering-combined__table) th.ordering-col--color_name {
    width: 12%;
}

.ordering-lines:not(.ordering-combined__table) .ordering-col--quantity,
.ordering-lines:not(.ordering-combined__table) .ordering-col--unit {
    width: 6%;
}

.ordering-table td.ordering-cell-stage .badge,
.ordering-table td.ordering-cell-status .badge + .badge {
    margin-left: 4px;
}

.ordering-table tbody tr.ordering-line {
    cursor: pointer;
}

/* Job header rows: a shaded band with the job's number, name, customer, priority, due date and status. */
.ordering-table tbody tr.ordering-job-row td,
.ordering-table tbody tr.ordering-job-row th,
.ordering-table tbody tr.ordering-job-row:hover td,
.ordering-table tbody tr.ordering-job-row:hover th {
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    font-weight: 400;
    color: var(--ink);
    background: var(--bg);
    border-top: 1px solid var(--border2);
    border-bottom: 1px solid var(--border2);
}

.ordering-table tbody:first-of-type tr.ordering-job-row > * {
    border-top: 0;
}

.ordering-job {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    white-space: normal;
}

.ordering-job__number {
    font-weight: 700;
    color: var(--heading);
}

.ordering-job__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.ordering-job__customer {
    color: var(--ink);
}

.ordering-job__code {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.ordering-job__facts {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    font-size: 13px;
}

.ordering-job__due {
    white-space: nowrap;
    color: var(--muted);
}

.ordering-job__due .badge {
    margin-left: 4px;
}

.ordering-job__count {
    font-size: 12px;
    color: var(--muted);
}

/* Lines are not striped (the job bands group them); hover, selection and stale marks tint them. */
.ordering-table tbody tr.ordering-line:nth-child(even) td {
    background: var(--surface);
}

.ordering-table tbody tr.ordering-line:hover td {
    background: var(--row-hover);
}

/* Selected lines take the primary tint; lines changed by someone else (409) the danger tint. */
.ordering-table tbody tr.is-selected td,
.ordering-table tbody tr.is-selected:nth-child(even) td,
.ordering-table tbody tr.is-selected:hover td {
    background: var(--primary-soft);
}

.ordering-table tbody tr.is-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--primary);
}

.ordering-table tbody tr.ordering-line--stale td,
.ordering-table tbody tr.ordering-line--stale:nth-child(even) td,
.ordering-table tbody tr.ordering-line--stale:hover td {
    background: var(--danger-soft);
}

.ordering-table tbody tr.ordering-line--stale td:first-child {
    box-shadow: inset 3px 0 0 var(--danger);
}

.ordering-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
}

.ordering-empty p {
    margin: 0;
}

.ordering-empty__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
}

.ordering-empty--good {
    border-color: var(--success);
}

.ordering-empty--good .ordering-empty__title {
    color: var(--success-ink);
}

/*
 * The action bar follows the table in the page flow and sticks to the bottom of the window while the list
 * scrolls past, so it never covers the last rows once the end of the list is reached.
 */
.ordering-actionbar {
    position: sticky;
    bottom: calc(12px + var(--tabbar, 0px));
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 10px 16px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.ordering-actionbar__count {
    margin: 0;
    font-weight: 600;
    color: var(--heading);
}

.ordering-actionbar__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ordering-actionbar__select {
    min-width: 220px;
    min-height: var(--control);
    padding: 6px 34px 6px 12px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-input);
    font: inherit;
    color: var(--ink);
    background-color: var(--field);
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    appearance: none;
    cursor: pointer;
}

.ordering-actionbar__select:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

@media (max-width: 860px) {
    .ordering-actions {
        width: 100%;
    }

    .ordering-actions .btn {
        flex: 1 1 0;
        width: auto;
    }
}

@media (max-width: 600px) {

    .ordering-actionbar {
        bottom: var(--tabbar, 0px);
        padding: 10px 12px;
    }

    .ordering-actionbar__controls {
        width: 100%;
    }

    .ordering-actionbar__select {
        flex: 1 1 100%;
        min-width: 0;
    }

    .ordering-actionbar__controls .btn {
        flex: 1 1 0;
    }
}

@media print {
    .ordering-tabs,
    .ordering-filters,
    .ordering-actionbar,
    .ordering-notice,
    .ordering-panel > .pager {
        display: none !important;
    }
}

/* 3.4 ordering: one card per job (readability pass) */

.ordering-pagebar {
    display: flex;
    align-items: center;
    margin: 4px 0 10px;
    padding: 0 16px;
    font-size: 13px;
    color: var(--muted);
}

.ordering-pagebar__all {
    gap: 10px;
    cursor: pointer;
}

.ordering-groups {
    display: grid;
    gap: 18px;
}

.ordering-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.ordering-card__head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

.ordering-card__head .ordering-job {
    flex: 1;
    min-width: 0;
}

.ordering-card__lines.table-wrap {
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* Inside a card the lines are plain rows: no stripes, a thin separator, and calm text colours. */
.ordering-lines thead th {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
}

.ordering-lines tbody tr.ordering-line td,
.ordering-lines tbody tr.ordering-line:nth-child(even) td {
    background: var(--surface);
    border-top: 1px solid var(--border2);
}

.ordering-lines tbody tr.ordering-line:hover td {
    background: var(--row-hover);
}

.ordering-lines tbody tr.is-selected td,
.ordering-lines tbody tr.is-selected:nth-child(even) td,
.ordering-lines tbody tr.is-selected:hover td {
    background: var(--primary-soft);
}

.ordering-job__status {
    font-size: 13px;
    color: var(--muted);
}

.ordering-job__due-tag {
    font-weight: 600;
}

.ordering-stage__status {
    color: var(--muted);
}

.ordering-status {
    color: var(--ink);
}

.ordering-status--available {
    font-weight: 600;
    color: var(--success-ink);
}

/* In the list tables the order status is a pill like every other status (statuses are the company's own,
 * so it stays neutral; only "available" and "mixed" keep their meaning colours). */
.badge.ordering-status {
    color: var(--ink);
}

.badge.ordering-status--available {
    color: var(--success-ink);
    background: var(--success-soft);
}

.badge.ordering-status--mixed {
    color: var(--warning-ink);
    background: var(--warning-soft);
}

/* Pagers float at the bottom centre of the screen while the list scrolls, on frosted glass. */
.pager {
    position: sticky;
    bottom: calc(16px + var(--tabbar, 0px));
    z-index: 6;
    width: fit-content;
    max-width: calc(100% - 32px);
    margin: 20px auto 0;
    padding: 6px;
    justify-content: center;
    gap: 6px;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 62%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
}

.pager .btn {
    min-width: 96px;
    border-radius: 999px;
    color: var(--ink);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.pager .btn:hover:not(:disabled) {
    color: var(--primary-ink);
    background: color-mix(in srgb, var(--primary-soft) 80%, transparent);
    border-color: var(--primary);
}

.pager .btn:disabled {
    opacity: 0.45;
}

.pager .pager__prev::before {
    content: "\2039\00a0";
}

.pager .pager__next::after {
    content: "\00a0\203A";
}

.pager .form-hint {
    margin: 0;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--heading);
    white-space: nowrap;
}

/* On Ordering the selection bar also sits at the bottom: the pager floats just above it. */
.ordering-actionbar:not([hidden]) ~ .pager {
    bottom: calc(96px + var(--tabbar, 0px));
}

/* Rows passing under the floating pager stay out of the way: the glass is nearly opaque. */
.pager {
    background: color-mix(in srgb, var(--surface) 90%, transparent);
}

@media (max-width: 600px) {
    /* On a phone the pager would sit over the cards' due dates; it stays at the end of the list instead. */
    .pager {
        position: static;
        background: var(--surface);
    }

    .pager .btn {
        min-width: 0;
    }

    .pager .form-hint {
        padding: 0 4px;
        white-space: normal;
        text-align: center;
    }

    .ordering-actionbar:not([hidden]) ~ .pager {
        bottom: calc(170px + var(--tabbar, 0px));
    }
}

@media print {
    .pager {
        display: none !important;
    }
}

/* 3.4 ordering: tinted job headers, dividers between jobs, and the Cards view */

.view-switch {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.view-switch__btn {
    min-height: 30px;
    padding: 0 16px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.view-switch__btn:hover {
    color: var(--ink);
}

.view-switch__btn[aria-pressed="true"] {
    color: var(--on-primary);
    background: var(--primary);
}

.view-switch__btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* List view: each job header is tinted, and a divider separates one job from the next. */
.ordering-groups {
    gap: 34px;
}

.ordering-card {
    position: relative;
    overflow: visible;
}

.ordering-card__head {
    background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface));
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ordering-card__lines.table-wrap {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.ordering-groups:not(.ordering-groups--cards) > .ordering-card + .ordering-card::before {
    content: "";
    position: absolute;
    top: -18px;
    left: 0;
    right: 0;
    border-top: 2px dashed var(--border);
}

/* Cards view: one tile per job in a responsive grid. */
.ordering-groups--cards {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
    align-items: start;
}

.ordering-tile {
    display: flex;
    flex-direction: column;
    height: 360px;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.ordering-tile__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface));
    border-top: 4px solid var(--primary);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ordering-tile__head .ordering-job {
    flex: 1;
    min-width: 0;
}

.ordering-tile__head {
    flex: none;
    min-height: 104px;
}

/* Every card has the same size: the body shows the first lines and clips the rest ("+3 more"). */
.ordering-tile__body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.ordering-tile__foot {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
}

.ordering-tile__more {
    font-size: 13px;
    color: var(--muted);
}

.ordering-tile__foot .btn {
    min-width: 88px;
}

.ordering-tile__detail,
.ordering-tile__state {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ordering-tile__notes {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.ordering-tile__lines {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.ordering-tile__lines th:last-child {
    width: 84px;
}

.ordering-tile__lines td {
    padding: 10px 12px;
    vertical-align: top;
    border-top: 1px solid var(--border2);
}

.ordering-tile__lines tbody tr:first-child td {
    border-top: 0;
}

.ordering-tile__lines td.ordering-select {
    width: 44px;
    padding-right: 0;
}

.ordering-tile__lines tr.ordering-line:hover td {
    background: var(--row-hover);
}

.ordering-tile__lines tr.is-selected td,
.ordering-tile__lines tr.is-selected:hover td {
    background: var(--primary-soft);
}

.ordering-tile__lines tr.ordering-line--stale td {
    background: var(--danger-soft);
}

.ordering-tile__item {
    min-width: 0;
    overflow-wrap: break-word;
}

.ordering-tile__title {
    display: block;
    font-weight: 600;
    color: var(--heading);
}

.ordering-tile__detail,
.ordering-tile__notes {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.ordering-tile__state {
    display: block;
    margin-top: 6px;
    font-size: 13px;
}

.ordering-tile__stage {
    color: var(--muted);
}

.ordering-tile__notes {
    font-style: italic;
}

.ordering-tile__qty {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-weight: 600;
}

@media (max-width: 420px) {
    .ordering-groups--cards {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Ordering cards: text buttons in the footer; the complete order in a popup. */
.ordering-tile__foot {
    justify-content: flex-start;
}

.ordering-tile__foot .ordering-tile__more {
    flex: 1;
}

.ordering-tile__foot .btn {
    min-width: 0;
    padding: 0 8px;
    font-weight: 600;
}

.ordering-dialog {
    width: min(720px, calc(100vw - 32px));
}

.ordering-dialog__body {
    max-height: min(60vh, 560px);
    margin-bottom: 16px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.ordering-dialog__head {
    position: sticky;
    top: 0;
    z-index: 1;
    min-height: 0;
    border-radius: 0;
}

.ordering-dialog .ordering-tile__detail,
.ordering-dialog .ordering-tile__state {
    white-space: normal;
}

.ordering-dialog .ordering-tile__lines th:last-child {
    width: 110px;
}

.ordering-toolbar__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
}

.ordering-toolbar__summary .btn {
    padding: 0 8px;
    font-weight: 600;
}

/* Project numbers (customer code + the customer's project count, as used in Mozaik). */
.ordering-job__project {
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-ink);
    background: var(--primary-soft);
    border-radius: 999px;
}

/* 3.7 drawings and files on the job page */
.job-files__add {
    position: relative;
    cursor: pointer;
}

/* The real file input covers the button: keyboard focus and screen readers reach it, no script needed. */
.job-files__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.job-files__add:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.job-files__drop {
    display: grid;
    gap: 2px;
    margin-bottom: 14px;
    padding: 18px;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
}

.job-files__drop p {
    margin: 0;
}

.job-files__drop.is-dragging {
    color: var(--primary-ink);
    background: var(--primary-soft);
    border-color: var(--primary);
}

.job-files__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.job-file {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.job-file__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

.job-file__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* A thumbnail that could not be loaded (js/thumbs.js): a plain box in its place. */
.file-thumb-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: var(--muted);
    font-size: 0.8125rem;
    text-align: center;
    background: var(--surface2);
}

.job-file__doc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 80px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--on-danger);
    background: var(--danger);
    border-radius: 6px;
}

/* DXF drawings: no preview, a blue tile; the file downloads to open in the drawing software. */
.job-file__doc--dxf {
    color: var(--info-ink);
    background: var(--info-soft);
}

.job-file__body {
    display: grid;
    gap: 2px;
    padding: 10px 12px 4px;
    min-width: 0;
}

.job-file__name {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-file__meta {
    font-size: 12px;
    color: var(--muted);
}

.job-file__actions {
    display: flex;
    gap: 4px;
    padding: 4px 6px 8px;
}

.job-file__actions .btn {
    padding: 0 8px;
}

.job-file__remove {
    margin-left: auto;
    color: var(--danger-ink);
}

/* Uploads in progress: a tile per file with its own bar; the Add files button is busy meanwhile. */
.job-files__add.is-disabled {
    pointer-events: none;
    opacity: 0.75;
}

.job-files__drop.is-busy {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface));
}

.job-file--pending .job-file__preview {
    padding: 0 24px;
}

.job-file__bar {
    display: block;
    width: 100%;
    height: 8px;
    overflow: hidden;
    background: var(--border);
    border-radius: 999px;
}

.job-file__bar-fill {
    display: block;
    width: 0;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.2s ease;
}

.job-file--pending .job-file__meta {
    padding-bottom: 10px;
    font-weight: 600;
    color: var(--primary-ink);
}

.job-file--done .job-file__bar-fill {
    background: var(--success);
}

.job-file--failed .job-file__bar-fill {
    width: 100%;
    background: var(--danger);
}

.job-file--failed .job-file__meta {
    color: var(--danger-ink);
}

/*
 * The panel's status bar (2026-11-05): a folder's upload as a whole ("file 3 of 24") with a filling bar, and the
 * "Download all" zip being prepared with a moving stripe (its length is not known).
 */
.job-files__status {
    display: grid;
    gap: 8px;
    margin: 4px 0 16px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
    border-radius: var(--radius, 10px);
}

.job-files__status[hidden] {
    display: none;
}

.job-files__status-text {
    margin: 0;
    overflow: hidden;
    font-weight: 600;
    color: var(--primary-ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-files__meter {
    position: relative;
    display: block;
    width: 100%;
    height: 10px;
    overflow: hidden;
    background: var(--border);
    border-radius: 999px;
}

.job-files__meter-fill {
    display: block;
    width: 0;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.job-files__meter.is-indeterminate .job-files__meter-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 35%;
    transition: none;
    animation: job-files-stripe 1.2s ease-in-out infinite;
}

@keyframes job-files-stripe {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(290%); }
}

@media (prefers-reduced-motion: reduce) {
    .job-files__meter.is-indeterminate .job-files__meter-fill {
        width: 100%;
        animation: none;
        opacity: 0.6;
    }
}

/* Activity log */
.activity-filters {
    align-items: flex-end;
    margin-bottom: 16px;
}

.activity-filters .activity-filters__search {
    flex: 2 1 260px;
}

.activity-filters .activity-filters__select {
    flex: 1 1 170px;
}

.activity-filters .activity-filters__date {
    flex: 0 1 170px;
}

.activity-filters__clear {
    flex: none;
    min-height: var(--control);
}

.activity-table__when {
    white-space: nowrap;
    color: var(--muted);
}

.activity-table td.activity-table__when {
    font-weight: 400;
}

.activity-table__who {
    white-space: nowrap;
    font-weight: 600;
    color: var(--heading);
}

.activity-table__what {
    min-width: 280px;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------------
 * Phones and tablets
 * ---------------------------------------------------------------------- */

/* Menu button: only on phones and tablets, where the main menu folds away. */
.app-menu-toggle {
    display: none;
}

/* Lists in a card always fit the page; a wide table scrolls inside its card instead. */
.ordering-groups:not(.ordering-groups--cards) {
    grid-template-columns: minmax(0, 1fr);
}

.ordering-card {
    min-width: 0;
}

/* The sticky top bar must not cover a section scrolled into view. */
.split-detail {
    scroll-margin-top: 76px;
}

/* Below laptop width the menu folds behind the Menu button (it no longer fits on one line). */
@media (max-width: 1240px) {
    .app-header {
        flex-wrap: wrap;
        gap: 0 12px;
        padding: 10px 16px;
    }

    .app-menu-toggle {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        min-height: 40px;
        margin-left: auto;
        padding: 0 14px;
        font: inherit;
        font-size: 14px;
        font-weight: 600;
        color: var(--bar-text);
        background: var(--bar-hover);
        border: 1px solid var(--bar-line);
        border-radius: var(--radius);
        cursor: pointer;
    }

    .app-menu-toggle__bars {
        position: relative;
        display: block;
        width: 18px;
        height: 2px;
        background: currentColor;
        border-radius: 2px;
        box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
    }

    .app-menu-toggle[aria-expanded="true"] .app-menu-toggle__bars {
        background: transparent;
        box-shadow: none;
    }

    .app-menu-toggle[aria-expanded="true"] .app-menu-toggle__bars::before,
    .app-menu-toggle[aria-expanded="true"] .app-menu-toggle__bars::after {
        content: "";
        position: absolute;
        inset: 0;
        background: currentColor;
        border-radius: 2px;
        transform: rotate(45deg);
    }

    .app-menu-toggle[aria-expanded="true"] .app-menu-toggle__bars::after {
        transform: rotate(-45deg);
    }

    .app-header .app-nav,
    .app-header .app-user {
        display: none;
    }

    .app-header.is-menu-open .app-nav {
        display: flex;
        flex-direction: column;
        order: 3;
        width: 100%;
        gap: 2px;
        margin-top: 10px;
        padding-top: 8px;
        overflow: visible;
        border-top: 1px solid var(--bar-line);
    }

    .app-header.is-menu-open .app-nav__link {
        min-height: var(--tap);
        padding: 0 12px;
        font-size: 16px;
        border-radius: var(--radius);
    }

    .app-header.is-menu-open .app-nav__link::after {
        display: none;
    }

    .app-header.is-menu-open .app-nav__divider {
        flex-basis: auto;
        align-self: stretch;
        height: 1px;
        margin: 6px 12px;
    }

    .app-header.is-menu-open .app-nav__link.is-active {
        font-weight: 700;
        background: var(--bar-hover);
        box-shadow: inset 3px 0 0 var(--bar-active);
    }

    .app-header.is-menu-open .app-user {
        display: flex;
        flex-wrap: wrap;
        order: 4;
        width: 100%;
        gap: 10px 14px;
        margin: 8px 0 4px;
        padding-top: 12px;
        border-top: 1px solid var(--bar-line);
    }

    .app-header.is-menu-open .app-user__name {
        display: inline;
        margin-right: auto;
    }

    .app-header.is-menu-open .app-user .btn,
    .app-header.is-menu-open .theme-toggle {
        min-height: 40px;
    }
}

@media (max-width: 860px) {
    /* Phones zoom into fields with text under 16px; keep them at 16px so the page stays put. */
    .form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    .form-field textarea,
    .form-field select,
    input[type="search"],
    .project-status-select,
    .ordering-actionbar__select {
        font-size: 16px;
    }

    /* The brand list is long: it scrolls in its own box so the colours stay close. */
    .split-list .item-list {
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Tablets: the wide lists fit the screen; long values wrap instead of pushing columns out of view. */
@media (max-width: 1024px) {
    .project-table,
    .ordering-table {
        min-width: 0;
    }

    .project-table__name,
    .project-table__customer {
        min-width: 0;
    }

    .project-status-select {
        min-width: 140px;
        max-width: 180px;
    }

    .table .table-actions,
    .project-table__due {
        white-space: normal;
    }

    .ordering-table td,
    .ordering-table td.ordering-cell-wrap {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .table th,
    .table td {
        padding-right: 10px;
        padding-left: 10px;
    }

    .table thead th {
        white-space: normal;
    }
}

/* Touch screens: larger targets for fingers. */
@media (pointer: coarse) {
    :root {
        --control: 44px;
        --control-sm: 44px;
    }

    .form-field input[type="checkbox"],
    .form-field input[type="radio"],
    .check-grid__item input,
    .ordering-check__box {
        width: 22px;
        height: 22px;
    }

    .ordering-check {
        min-width: var(--tap);
        min-height: var(--tap);
    }

    .btn--small,
    .view-switch__btn {
        min-height: var(--tap);
    }
}

/*
 * A list table that does not fit its space (phones, and tablets for the widest lists) is drawn as one card per row:
 * app.js measures it and sets .is-stacked; each value sits beside the name of its column (data-label). On a wide
 * screen the values of a card flow into several columns.
 */
.table.table--stack.is-stacked {
    min-width: 0;
}

.table--stack.is-stacked > thead {
    display: none;
}

.table--stack.is-stacked,
.table--stack.is-stacked > tbody {
    display: block;
    width: 100%;
}

.table--stack.is-stacked > tbody > tr {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    column-gap: 24px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border2);
}

.table--stack.is-stacked > tbody > tr:nth-child(even) {
    background: var(--surface2);
}

.table--stack.is-stacked > tbody > tr:last-child {
    border-bottom: 0;
}

.table--stack.is-stacked > tbody > tr[aria-selected="true"],
.table--stack.is-stacked > tbody > tr[aria-current="true"],
.table--stack.is-stacked > tbody > tr.is-selected {
    background: var(--primary-soft);
}

.table.table--stack.is-stacked > tbody > tr > td {
    display: grid;
    grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
    align-items: center;
    justify-items: start;
    gap: 12px;
    min-width: 0;
    max-width: none;
    height: auto;
    padding: 5px 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* A cell's own content (a name with its project number, a date with its tag) stays in the value column. */
.table--stack.is-stacked > tbody > tr > td > * {
    grid-column: 2;
}

.table--stack.is-stacked > tbody > tr > td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--muted);
}

.table--stack.is-stacked > tbody > tr > td[data-label=""] {
    display: block;
    grid-column: 1 / -1;
}

.table--stack.is-stacked > tbody > tr > td[data-label=""]::before,
.table--stack.is-stacked > tbody > tr > td:not([data-label])::before {
    content: none;
}

.table--stack.is-stacked > tbody > tr > td:empty {
    display: none;
}

/* Group rows ("Shop", "Glass doors") stay a full-width band. */
.table--stack.is-stacked > tbody > tr:has(> th[scope="colgroup"]) {
    display: block;
    padding: 0;
}

.table--stack.is-stacked > tbody > tr > th[scope="colgroup"] {
    display: block;
    width: 100%;
}

/* The row's buttons sit side by side at the foot of its card, without a label. */
.table.table--stack.is-stacked > tbody > tr > td.table-actions {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 8px;
    padding-top: 8px;
}

.table.table--stack.is-stacked > tbody > tr > td.table-actions::before {
    content: none;
}

.table.table--stack.is-stacked .table-actions .btn + .btn {
    margin-left: 0;
}

/* Ordering: the tick box sits at the top right of each line's card. */
.ordering-lines.table--stack.is-stacked > tbody > tr.ordering-line {
    display: block;
    background: var(--surface);
}

.ordering-lines.table--stack.is-stacked > tbody > tr.ordering-line.is-selected {
    background: var(--primary-soft);
}

.ordering-lines.table--stack.is-stacked > tbody > tr.ordering-line > td {
    background: transparent;
    border: 0;
}

.ordering-lines.table--stack.is-stacked > tbody > tr > td:first-child {
    display: block;
    float: right;
    margin: -4px -8px 0 8px;
}

.ordering-lines.table--stack.is-stacked > tbody > tr > td:first-child::before {
    content: none;
}

@media (pointer: coarse) {
    .table--stack.is-stacked .btn {
        min-height: 40px;
    }
}

@media (max-width: 640px) {
    .ordering-card__head {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    /* Dialogs open as a sheet from the bottom of the screen. */
    .dialog,
    .dialog--wide,
    .dialog--route {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 24px);
        margin: auto 0 0;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

/* Ordering: Combined view (one row per identical item, its total across jobs) and its printout. */
.ordering-table tbody tr.ordering-combined-row {
    cursor: pointer;
}

.ordering-combined__table td.ordering-cell-strong.ordering-cell-number {
    font-size: 15px;
    color: var(--heading);
}

.ordering-combined__jobs {
    min-width: 200px;
}

.ordering-combined__job,
.ordering-combined__more,
.ordering-combined__statuses,
.ordering-combined__part {
    display: block;
}

.ordering-combined__job + .ordering-combined__job {
    margin-top: 4px;
}

.ordering-combined__job .ordering-job__number {
    font-size: 13px;
}

.ordering-combined__customer {
    color: var(--muted);
}

.ordering-combined__share {
    font-weight: 600;
    color: var(--ink);
}

.ordering-combined__more,
.ordering-combined__statuses,
.ordering-combined__part {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.ordering-status--mixed {
    font-weight: 600;
    color: var(--warning-ink);
}

.ordering-lines.table--stack.is-stacked > tbody > tr.ordering-combined-row {
    display: block;
    background: var(--surface);
}

.ordering-lines.table--stack.is-stacked > tbody > tr.ordering-combined-row.is-selected {
    background: var(--primary-soft);
}

.ordering-lines.table--stack.is-stacked > tbody > tr.ordering-combined-row > td {
    background: transparent;
    border: 0;
}

.printout__variant {
    font-size: 0.6em;
    font-weight: 500;
    color: var(--muted);
}

.printout__job-share {
    display: block;
    font-size: 12px;
}

.printout__table--combined th:nth-child(1),
.printout__table--combined th:nth-child(3) {
    width: auto;
}

.printout__table--combined th:nth-child(7) {
    width: 26%;
}

/* Projects list: the job just created, marked once when the user comes back from it */
.project-row.is-highlighted > td {
    background: var(--primary-soft);
}

/* Job page: office steps checklist (done / current / to do) */
.job-steps__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.job-steps__header .job-card__title {
    margin: 0;
}

.job-steps__side {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.step-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 8px 16px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.step-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.step-list__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.step-list__label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.step-list__no {
    min-width: 1.4em;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.step-list__item--done .step-list__label {
    color: var(--muted);
}

.step-list__item--current {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.step-list__item--current .step-list__label {
    font-weight: 600;
    color: var(--heading);
}

.step-list__item--todo .step-list__label {
    color: var(--muted);
}

.step-list__note {
    font-size: 12px;
    color: var(--muted);
}

/* Projects list: the office step with its tick button */
.project-step {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Its own line under the status (more specific than the [data-icon] rule that makes icon labels inline). */
.project-table .project-where {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    max-width: 16rem;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.3;
}

.project-step__progress {
    font-size: 12px;
    color: var(--muted);
}

/* Send to production: the lines that go in this run */
.send-lines__quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.send-lines__list {
    display: grid;
    gap: 4px;
    max-height: 240px;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.send-lines__item label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
    font-weight: 400;
}

.send-lines__item input {
    accent-color: var(--primary);
}

.send-lines__from {
    font-size: 12px;
    color: var(--muted);
}

/* Job page: one card per run, each with its own office steps */
.run-cards {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.run-card {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.run-card--sent {
    background: transparent;
}

.run-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.run-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--heading);
}

.run-card__meta {
    font-size: 13px;
    color: var(--muted);
}

/* The run's note (0041): its own line under the name, kept as typed (line breaks too). */
.run-card__notes {
    flex-basis: 100%;
    margin: 2px 0 0;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--ink);
    white-space: pre-line;
    overflow-wrap: anywhere;
    background: var(--surface);
    border-left: 3px solid var(--border2);
    border-radius: var(--radius-sm);
}

.run-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.run-card__hint {
    margin: 8px 0 0;
}

/* Runs in colour: the card, the heading row and the lines of one run share a stripe (six colours, then repeat).
   Stripes only, never text, so they read in both themes. */
.run-tone-1 { --run-tone: #2563eb; }
.run-tone-2 { --run-tone: #16a34a; }
.run-tone-3 { --run-tone: #9333ea; }
.run-tone-4 { --run-tone: #ea580c; }
.run-tone-5 { --run-tone: #0891b2; }
.run-tone-6 { --run-tone: #db2777; }

.run-card[class*="run-tone-"] {
    border-left: 4px solid var(--run-tone);
}

.run-group th {
    padding: 10px 8px 8px;
    text-align: left;
    background: var(--surface2);
    border-top: 1px solid var(--border);
    box-shadow: inset 4px 0 0 var(--run-tone);
}

.run-group__inner {
    position: sticky;
    left: 12px;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-weight: 400;
}

.run-group__swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--run-tone);
}

.run-group__title {
    font-weight: 600;
    color: var(--heading);
}

.run-group__meta {
    font-size: 13px;
    color: var(--muted);
}

.run-group.is-flash th {
    background: var(--primary-soft);
    transition: background-color 400ms var(--ease);
}

.job-lines-table tr.run-row > td:first-child {
    box-shadow: inset 4px 0 0 var(--run-tone);
}

/* Stacked as cards (narrow screens): the stripe runs down the whole card. */
.table--stack.is-stacked > tbody > tr.run-row {
    box-shadow: inset 4px 0 0 var(--run-tone);
}

.table--stack.is-stacked > tbody > tr.run-row > td:first-child {
    box-shadow: none;
}

.job-lines-table .job-cell-select {
    width: 36px;
    padding-left: 14px;
}

.job-lines-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Bottom bar while lines are ticked: "3 lines selected · Move to [run] · Move · Clear". */
.move-bar {
    position: sticky;
    bottom: 12px;
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.move-bar__count {
    font-weight: 600;
    margin-right: auto;
}

.move-bar__label {
    font-size: 14px;
    color: var(--muted);
}

.move-bar__target {
    min-width: 0;
    max-width: 100%;
    flex: 0 1 280px;
}

@media (max-width: 600px) {
    .move-bar {
        bottom: 8px;
    }

    .move-bar__count {
        width: 100%;
    }

    .move-bar__target {
        flex: 1 1 100%;
    }
}

/* Projects list: a job of several runs shows each run on its own line */
.project-runs {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.project-runs__run {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.project-runs__label {
    min-width: 3.5em;
    font-size: 12px;
    color: var(--muted);
}

/* Icons (Lucide, stored sprite): drawn in the colour of the surrounding text */
.icon {
    display: inline-block;
    flex: none;
    width: 1.25em;
    height: 1.25em;
    vertical-align: -0.25em;
}

.btn--icon,
.badge--icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge--icon::before {
    content: none;
}

.badge--icon .icon {
    width: 13px;
    height: 13px;
}

/* Developer icon page */
.dev-icons__demo,
.dev-icons__menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

.dev-icons__menu {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: #fff;
    background: #063239;
}

.dev-icons__menu-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}

.dev-icons__area {
    margin: 20px 0 8px;
    font-size: 14px;
    color: var(--muted);
}

.dev-icons__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dev-icons__grid--all {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    margin-top: 12px;
}

.dev-icons__pick {
    display: grid;
    justify-items: center;
    gap: 6px;
    width: 100%;
    padding: 14px 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--heading);
    background: var(--surface);
    cursor: pointer;
}

.dev-icons__pick:hover,
.dev-icons__pick:focus-visible {
    border-color: var(--primary);
    color: var(--primary);
}

.dev-icons__pick .icon {
    width: 24px;
    height: 24px;
}

.dev-icons__grid--all[data-size="16"] .icon {
    width: 16px;
    height: 16px;
}

.dev-icons__grid--all[data-size="32"] .icon {
    width: 32px;
    height: 32px;
}

.dev-icons__label {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.dev-icons__name {
    max-width: 100%;
    overflow: hidden;
    font-size: 11px;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dev-icons__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
}

.dev-icons__toolbar .job-card__title {
    margin: 0 auto 0 0;
}

.dev-icons__search {
    min-width: min(100%, 320px);
}

/* Icons in front of labels (data-icon, js/app.js). */
.has-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn.has-icon .icon {
    width: 16px;
    height: 16px;
}

.btn--small.has-icon .icon {
    width: 14px;
    height: 14px;
}

.app-nav__link.has-icon .icon {
    width: 17px;
    height: 17px;
    opacity: 0.85;
}

.badge.has-icon::before {
    content: none;
}

.badge.has-icon .icon {
    width: 13px;
    height: 13px;
}

/* Laptop widths: the menu shows its labels without icons, so every item fits beside the account controls (with
   Reports the menu has nine items, which needs this up to 1599px). */
@media (min-width: 1241px) and (max-width: 1599px) {
    .app-nav__link.has-icon .icon {
        display: none;
    }

    .app-nav__link {
        padding: 0 11px;
    }
}

/* A long menu (the developer's, with its icon-only tools) tightens its spacing so it stays on one line. */
.app-nav:has(> a.app-nav__link:nth-of-type(9)) {
    gap: 4px;
}

.app-nav:has(> a.app-nav__link:nth-of-type(9)) .app-nav__link {
    padding: 0 10px;
}

/* Phones and touch tablets: the daily pages (Projects, Ordering, Production) in a bar at the bottom. */
.app-tabbar {
    display: none;
}

@media (max-width: 1240px) and (pointer: coarse), (max-width: 760px) {
    .app-tabbar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 15;
        display: grid;
        grid-auto-columns: minmax(0, 1fr);
        grid-auto-flow: column;
        padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
        background: var(--bar);
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.14);
    }

    .app-tabbar__link {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 54px;
        font-size: 12.5px;
        font-weight: 600;
        color: var(--bar-muted);
        text-decoration: none;
        border-radius: var(--radius);
    }

    .app-tabbar__link.has-icon .icon {
        width: 22px;
        height: 22px;
    }

    .app-tabbar__link:hover {
        color: var(--bar-text);
        text-decoration: none;
    }

    .app-tabbar__link.is-active {
        color: var(--bar-text);
        background: var(--bar-hover);
    }

    .app-tabbar__link.is-active::before {
        content: "";
        position: absolute;
        top: -4px;
        right: 28%;
        left: 28%;
        height: 3px;
        border-radius: 0 0 3px 3px;
        background: var(--bar-active);
    }

    .app-tabbar__link:focus-visible {
        outline: 2px solid var(--bar-active);
        outline-offset: -2px;
    }

    /* The page keeps its last rows and its own bottom bars (pager, Ordering selection) clear of the bar. */
    .app-tabbar ~ .app-main {
        --tabbar: 62px;
        padding-bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom, 0px));
    }
}

@media print {
    .app-tabbar {
        display: none !important;
    }
}

/* Read-only job view (/projects/{id}/view, experiment 2026-10-25): compact cards, dense tables. */
.job-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.job-view > *,
.job-view__card {
    min-width: 0;
}

.job-view__table td.job-cell-wrap {
    min-width: 180px;
}

.job-view__actions {
    display: flex;
    gap: 8px;
}

.job-view__card {
    padding: 16px 18px;
}

.job-view__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
}

.job-view__facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px 20px;
    margin: 0;
}

.job-view__facts dt {
    font-size: 12px;
    color: var(--muted);
}

.job-view__facts dd {
    margin: 2px 0 0;
    font-weight: 500;
    color: var(--heading);
    overflow-wrap: anywhere;
}

.job-view__wide {
    grid-column: 1 / -1;
}

.job-view__notes {
    white-space: pre-line;
    font-weight: 400;
}

.job-view__table th,
.job-view__table td {
    padding-top: 6px;
    padding-bottom: 6px;
}

.job-view__steps {
    display: inline-flex;
    gap: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

.job-view__step {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    border: 1px solid var(--border-strong, var(--border));
}

.job-view__step--done {
    background: var(--success);
    border-color: var(--success);
}

.job-view__step--current {
    background: var(--warning);
    border-color: var(--warning);
}

/* Colour for a quick read: each section has its own accent; key facts are tinted by what they say. */
.job-view__card--details,
.section-tone--details { --section: var(--primary); --section-soft: var(--primary-soft); }
.job-view__card--runs,
.section-tone--runs { --section: var(--info); --section-soft: var(--info-soft); }
.job-view__card--material,
.section-tone--material { --section: var(--success); --section-soft: var(--success-soft); }
.job-view__card--hardware,
.section-tone--hardware { --section: var(--warning); --section-soft: var(--warning-soft); }
.job-view__card--files,
.section-tone--files { --section: var(--muted); --section-soft: var(--surface2); }

/* Job page (js/job-entry.js): the same accents as the job view. Only the section's icon carries its colour; the
 * cards and table heads stay neutral, so green and amber are not read as "OK" and "warning". */
.section-tone > .job-card__title .icon,
.section-tone .detail-header__title h2 .icon,
.section-tone .job-steps__header .job-card__title .icon {
    box-sizing: content-box;
    width: 16px;
    height: 16px;
    padding: 6px;
    border-radius: 8px;
    color: var(--section);
    background: var(--section-soft);
}

.section-tone .job-card__title.has-icon,
.section-tone .detail-header__title h2.has-icon {
    gap: 8px;
}

.section-tone .job-lines-table > thead th {
    color: var(--heading);
    background: var(--surface2);
}

.section-tone .job-lines-table > tbody > tr:not(.run-group):nth-child(even) > td {
    background: color-mix(in srgb, var(--surface2) 70%, transparent);
}

.job-cell-qty {
    font-weight: 600;
    color: var(--heading);
}

.job-view__title .icon {
    box-sizing: content-box;
    width: 16px;
    height: 16px;
    padding: 6px;
    border-radius: 8px;
    color: var(--section);
    background: var(--section-soft);
}

.job-view__facts > div {
    --fact: transparent;
    --fact-soft: var(--surface2);
    padding: 8px 10px;
    border-left: 3px solid var(--fact);
    border-radius: 8px;
    background: var(--fact-soft);
}

.job-view__facts > .job-view__fact--primary { --fact: var(--primary); --fact-soft: var(--primary-soft); }
.job-view__facts > .job-view__fact--info { --fact: var(--info); --fact-soft: var(--info-soft); }
.job-view__facts > .job-view__fact--ok { --fact: var(--success); --fact-soft: var(--success-soft); }
.job-view__facts > .job-view__fact--warn { --fact: var(--warning); --fact-soft: var(--warning-soft); }
.job-view__facts > .job-view__fact--danger { --fact: var(--danger); --fact-soft: var(--danger-soft); }

.job-view__table > thead th {
    color: var(--heading);
    background: var(--section-soft, var(--surface2));
}

.job-view__table > tbody > tr:not(.run-group):nth-child(even) > td {
    background: color-mix(in srgb, var(--surface2) 70%, transparent);
}

.job-view__qty {
    font-weight: 600;
    color: var(--heading);
}

/* ------------------------------------------------------------------------
 * Production: department screens (3.5a). Big touch targets for tablets on the shop floor.
 * ---------------------------------------------------------------------- */

.production-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.production-live__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live);
}

.production-live.is-stale .production-live__dot {
    background: var(--warning);
}

/*
 * Department colours: each tab (and the panel of the open tab, via data-hue) gets one of eight hues. Soft tints are
 * mixed with the surface colour, so they work in the light and the dark theme. Every hue keeps white text at 4.5:1
 * or more (selected tabs and pills).
 */
.production-tab--hue-0, .production-panel[data-hue="0"],
.production-header[data-hue="0"],
.production-dialog[data-hue="0"] { --stage: #c2410c; }
.production-tab--hue-1, .production-panel[data-hue="1"],
.production-header[data-hue="1"],
.production-dialog[data-hue="1"] { --stage: #1971c2; }
.production-tab--hue-2, .production-panel[data-hue="2"],
.production-header[data-hue="2"],
.production-dialog[data-hue="2"] { --stage: #2b7a3b; }
.production-tab--hue-3, .production-panel[data-hue="3"],
.production-header[data-hue="3"],
.production-dialog[data-hue="3"] { --stage: #6741d9; }
.production-tab--hue-4, .production-panel[data-hue="4"],
.production-header[data-hue="4"],
.production-dialog[data-hue="4"] { --stage: #c2255c; }
.production-tab--hue-5, .production-panel[data-hue="5"],
.production-header[data-hue="5"],
.production-dialog[data-hue="5"] { --stage: #0b7285; }
.production-tab--hue-6, .production-panel[data-hue="6"],
.production-header[data-hue="6"],
.production-dialog[data-hue="6"] { --stage: #a35200; }
.production-tab--hue-7, .production-panel[data-hue="7"],
.production-header[data-hue="7"],
.production-dialog[data-hue="7"] { --stage: #3b5bdb; }

.production-panel {
    --stage-soft: color-mix(in srgb, var(--stage, var(--primary)) 12%, var(--surface));
    display: grid;
    gap: 14px;
    padding-top: 16px;
}

/* The tags of a line in the job dialog. */
.production-line__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

/* The line's actual-time stopwatch at this department (0050). */
.production-line__timer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.production-empty__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
}

/*
 * The job window's title with a Close at its right (Arin, 2026-11-05). It stays at the top while the window scrolls,
 * so Close is always at hand on a long job; the line under it is the title's own.
 */
.production-dialog__top {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin: -8px 0 16px;
    padding-top: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.production-dialog__top .dialog__title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 0;
    overflow-wrap: anywhere;
}

.production-dialog__close {
    flex: none;
}

.production-dialog__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.production-dialog__facts {
    margin: 0;
    color: var(--muted);
}

.production-dialog__customer {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}

.production-dialog__number {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--heading);
}

.production-dialog__notes {
    flex-basis: 100%;
    margin: 0;
    padding: 8px 12px;
    border-radius: var(--radius);
    white-space: pre-line;
    color: var(--warning-ink);
    background: var(--warning-soft);
}

.production-lines {
    display: grid;
    gap: 10px;
}

.production-lines__none {
    margin: 0;
    color: var(--muted);
}

.production-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: var(--tap);
    min-height: var(--tap);
    cursor: pointer;
}

.production-check input {
    width: 20px;
    height: 20px;
}

.production-line {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.production-line--in_progress {
    border-color: var(--info);
    background: var(--info-soft);
}

.production-line--missing {
    border-color: var(--danger);
}

.production-line--not_started {
    background: var(--surface2);
}

.production-line__info {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.production-line__title,
.production-line__details,
.production-line__note {
    margin: 0;
}

.production-line__qty {
    font-weight: 700;
    color: var(--heading);
}

.production-line__details {
    color: var(--ink);
}

.production-line__note {
    font-size: 13px;
    color: var(--muted);
}

.production-line__run {
    font-size: 12px;
    color: var(--muted);
}

.production-line__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.production-action {
    min-height: var(--tap);
    padding: 0 18px;
    font-size: 15px;
}

.production-line__wait {
    font-size: 13px;
    color: var(--muted);
}

.production-actionbar {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    background: var(--primary-soft);
}

.production-actionbar__count {
    margin: 0;
    font-weight: 600;
    color: var(--primary-ink);
}

.production-actionbar__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.production-moves {
    margin-top: 16px;
}

.production-moves__title {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--heading);
}

.production-moves__list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.production-move {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 12px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--surface2);
}

.production-move__line {
    font-weight: 500;
    color: var(--ink);
}

.production-move__what {
    grid-column: 1;
    font-size: 13px;
    color: var(--muted);
}

.production-move__undo {
    grid-column: 2;
    grid-row: 1 / span 2;
}

/* The department's Completed list: one row per finished line, its job on top, Undo (or why not) on the right. */
.production-done {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.production-done__item {
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border2);
}

.production-done__job {
    grid-column: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.production-done__number {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--heading);
}

.production-done__customer {
    font-size: 14px;
    color: var(--ink);
}

.production-done__note {
    grid-column: 2;
    grid-row: 1 / span 3;
    font-size: 12.5px;
    color: var(--muted);
}

.production-done__item .production-move__undo {
    grid-row: 1 / span 3;
}

@media (max-width: 760px) {
    .production-line {
        grid-template-columns: auto 1fr;
    }

    .production-line__actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .production-line__actions .production-action {
        flex: 1 1 0;
    }
}

/* Production header: title with the department in its colour, the department's figures, and the live pill. */
.production-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    margin-bottom: 14px;
}

.production-header__title {
    margin: 0;
    font-size: 24px;
    color: var(--heading);
}

.production-header__stage:not(:empty)::before {
    content: " · ";
    color: var(--muted);
}

.production-header__stage {
    color: var(--stage, var(--primary));
}

.production-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.production-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.production-stat__value {
    font-size: 18px;
    font-weight: 700;
    color: var(--heading);
}

.production-stat__label {
    font-size: 13px;
    color: var(--muted);
}

.production-stat--lines .production-stat__value { color: var(--stage, var(--heading)); }
.production-stat--ready .production-stat__value { color: var(--success-ink); }
.production-stat--in_progress .production-stat__value { color: var(--info-ink); }
.production-stat--held .production-stat__value { color: var(--warning-ink); }
.production-stat--late .production-stat__value { color: var(--danger-ink); }
.production-stat.is-zero .production-stat__value { color: var(--muted); }

.production-header .production-live {
    margin-left: auto;
    padding: 4px 12px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    background: var(--surface);
}

@media (max-width: 760px) {
    .production-header {
        gap: 8px;
    }

    .production-header__title {
        flex: 1 1 auto;
        font-size: 20px;
    }

    .production-header .production-live {
        order: -1;
        margin-left: auto;
        padding: 2px 8px;
        font-size: 12px;
    }

    .production-header__title {
        order: -2;
    }

    /* One row of figures that scrolls sideways instead of wrapping onto several rows. */
    .production-stats {
        flex-basis: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .production-stat {
        flex: 0 0 auto;
        padding: 3px 9px;
    }

    .production-stat__value {
        font-size: 15px;
    }

    .production-stat__label {
        font-size: 12px;
    }
}

/* ------------------------------------------------------------------------
 * Per-line departments (3.5b): the department checklist in the material line editor and each line's route as
 * small steps on the job page and the job view.
 * ---------------------------------------------------------------------- */

.line-stages {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface2);
}

.line-stages legend {
    padding: 0 4px;
    font-weight: 600;
    color: var(--heading);
}

.line-stages__groups {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.line-stages__group {
    display: grid;
    gap: 6px;
}

.line-stages__area {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.line-stages__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
}

.line-stages__option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    background: var(--surface);
    cursor: pointer;
}

.line-stages__option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-ink);
}

.line-stages__option.is-locked {
    cursor: not-allowed;
    opacity: 0.7;
}

.line-stages__note {
    color: var(--muted);
}

.line-stages__suggest {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    padding: 6px 10px;
    border-radius: var(--radius);
    color: var(--info-ink);
    background: var(--info-soft);
}

.line-route {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
    min-width: 220px;
    max-width: 360px;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.6;
}

.line-route__step {
    color: var(--muted);
    white-space: nowrap;
}

.line-route__step + .line-route__step::before {
    content: "\203A";
    margin: 0 4px;
    color: var(--muted);
}

.line-route__step--done {
    color: var(--success-ink);
}

.line-route__step--done::after {
    content: "\00a0\2713";
}

.line-route__step--here {
    padding: 0 6px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--info-ink);
    background: var(--info-soft);
}

.line-route__none {
    font-style: italic;
    color: var(--muted);
}

/* ------------------------------------------------------------------------
 * Production: deliveries and installation (3.5b). "Delivered partially" is purple everywhere.
 * ---------------------------------------------------------------------- */

.badge--partial {
    color: #5f3dc4;
    background: color-mix(in srgb, #7048e8 14%, var(--surface));
}

:root[data-theme="dark"] .badge--partial {
    color: #c0b0ff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .badge--partial {
        color: #c0b0ff;
    }
}

.production-line--partial {
    border-color: #7048e8;
    background: color-mix(in srgb, #7048e8 8%, var(--surface));
}

.production-action--partial {
    color: #5f3dc4;
    border-color: color-mix(in srgb, #7048e8 45%, var(--border2));
    background: color-mix(in srgb, #7048e8 10%, var(--surface));
}

.production-action--partial:hover:not(:disabled) {
    color: #ffffff;
    border-color: #5f3dc4;
    background: #5f3dc4;
}

.production-install[data-confirming="1"] {
    border-color: var(--success-ink);
    background: var(--success-ink);
}

.production-install-note {
    margin: 0 0 10px;
    color: var(--muted);
}

.production-delivered {
    display: grid;
    gap: 6px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
}

.production-delivered__item {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--surface2);
}

.production-delivered__detail {
    color: var(--muted);
}

.production-install-actions {
    display: flex;
    justify-content: flex-end;
}

.production-install-actions .production-install {
    min-height: var(--tap);
    padding: 0 22px;
    font-size: 15px;
}

.project-delivery {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.project-delivery:empty {
    display: none;
}

.project-delivery__reason {
    color: var(--muted);
    font-size: 12px;
}

/* ------------------------------------------------------------------------
 * Production redesign (user's choice, 2026-10-26): departments as pipelines, a segmented status switch beside the
 * search, one row per job with its items as tags, and in the job dialog one main button per line plus "More".
 * ---------------------------------------------------------------------- */

/* Status colours of the switch dots and item tags. --pill-strong is dark enough for white text in both themes. */
.production-pill--ready { --pill: var(--success); --pill-strong: #1e7a65; }
.production-pill--in_progress { --pill: var(--info); --pill-strong: #1971c2; }
.production-pill--missing { --pill: var(--danger); --pill-strong: #c92a2a; }
.production-pill--on_hold { --pill: var(--warning); --pill-strong: #a35200; }
.production-pill--not_started { --pill: #a8adb8; --pill-strong: #5c6370; }
.production-pill--partial { --pill: #7048e8; --pill-strong: #5f3dc4; }
.production-pill--all { --pill: var(--stage, var(--primary)); --pill-strong: var(--stage, var(--primary)); }
.production-pill--done { --pill: #495057; --pill-strong: #343a40; }

/* Pipelines: one per area, steps in shop order. */
.production-pipelines {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.production-pipeline {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.production-pipeline__area {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.production-pipeline__steps {
    display: flex;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.production-step {
    --arrow: 14px;
    position: relative;
    display: grid;
    flex: 1 0 128px;
    max-width: 220px;
    gap: 2px;
    margin-right: -6px;
    padding: 9px calc(var(--arrow) + 8px) 9px calc(var(--arrow) + 12px);
    border: 0;
    font: inherit;
    text-align: left;
    color: var(--ink);
    background: var(--surface2);
    cursor: pointer;
    clip-path: polygon(0 0, calc(100% - var(--arrow)) 0, 100% 50%, calc(100% - var(--arrow)) 100%, 0 100%,
        var(--arrow) 50%);
    transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.production-pipeline__steps .production-step:first-child {
    padding-left: 14px;
    clip-path: polygon(0 0, calc(100% - var(--arrow)) 0, 100% 50%, calc(100% - var(--arrow)) 100%, 0 100%);
}

.production-step:hover {
    background: color-mix(in srgb, var(--stage) 12%, var(--surface2));
}

/* The arrow shape (clip-path) would cut an outline off, so the focus ring is a bar along the top and bottom. */
.production-step:focus-visible {
    outline: none;
    box-shadow: inset 0 2px 0 currentColor, inset 0 -2px 0 currentColor;
    background: color-mix(in srgb, var(--stage) 22%, var(--surface2));
}

.production-step__count {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    color: color-mix(in srgb, var(--stage) 70%, var(--ink));
}

.production-step.is-empty .production-step__count {
    font-weight: 500;
    color: var(--muted);
}

.production-step__name {
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--muted);
}

/* "2 jobs" and, at Cutting, "40 panels" under the department's name (Arin, 2026-11-10), one line each. */
.production-step__meta {
    display: grid;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    color: color-mix(in srgb, var(--stage) 70%, var(--ink));
}

.production-step__metaline {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.production-step__meta[hidden] {
    display: none;
}

.production-step__bar {
    display: block;
    height: 4px;
    margin-top: 4px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--muted) 22%, transparent);
    overflow: hidden;
}

.production-step__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 2px;
    background: var(--success);
    transition: width 240ms var(--ease);
}

.production-step[aria-selected="true"] {
    color: #ffffff;
    background: var(--stage);
}

.production-step[aria-selected="true"] .production-step__count,
.production-step[aria-selected="true"] .production-step__name,
.production-step[aria-selected="true"] .production-step__meta {
    color: #ffffff;
}

.production-step[aria-selected="true"] .production-step__bar {
    background: rgba(255, 255, 255, 0.35);
}

.production-step[aria-selected="true"] .production-step__fill {
    background: #ffffff;
}

.production-step[aria-selected="true"]:focus-visible .production-step__name {
    text-decoration: underline;
}

/* The panel's column never grows past the page (the status switch scrolls sideways on phones instead). */
.production-panel {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
}

/* Status switch and search on one toolbar. */
.production-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.production-switch {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
}

.production-switch__option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--control);
    padding: 0 12px;
    border: 0;
    border-right: 1px solid var(--border2);
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    background: transparent;
    cursor: pointer;
}

.production-switch__option:last-child {
    border-right: 0;
}

.production-switch__option:hover {
    background: var(--surface2);
}

.production-switch__option:focus-visible {
    outline: none;
    box-shadow: inset var(--ring);
}

.production-switch__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pill);
}

.production-switch__count {
    font-weight: 700;
}

.production-switch__option[aria-pressed="true"] {
    color: #ffffff;
    background: var(--pill-strong);
}

.production-switch__option[aria-pressed="true"] .production-switch__dot {
    background: #ffffff;
}

.production-toolbar__search {
    flex: 1 1 260px;
    min-width: 0;
}

.production-toolbar__search input {
    width: 100%;
    min-height: max(40px, var(--control));
    padding: 0 12px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-input);
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--field);
}

.production-toolbar__search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

/* The jobs: one row each. */
.production-queue {
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
}

.production-queue:empty {
    display: none;
}

.production-row {
    display: grid;
    grid-template-columns: 34px minmax(200px, 300px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 120ms var(--ease);
}

.production-row:last-child {
    border-bottom: 0;
}

.production-row:hover {
    background: var(--stage-soft, var(--surface2));
}

/* A late job: a thin red marker on the left edge. */
.production-row--late {
    box-shadow: inset 3px 0 0 var(--danger);
}

.production-row__who {
    min-width: 0;
    line-height: 1.3;
}

.production-row__title,
.production-row__meta {
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.production-row__number {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 700;
    color: var(--heading);
}

.production-row__name {
    font-weight: 600;
    color: var(--heading);
}

/* The app's job number (#514) after a title led by the project number: small, for the office (Arin, 2026-11-05). */
.production-appnum {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.production-row__code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
}

.production-row__meta {
    font-size: 12.5px;
    color: var(--muted);
}

/* The customer: what the shop reads after the project number. */
.production-row__customer {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
}

.production-row__items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.production-row__end {
    display: flex;
    align-items: center;
    gap: 8px;
}

.production-row__open {
    color: color-mix(in srgb, var(--stage, var(--primary)) 75%, var(--ink));
}

/* The items of a job as tags: status dot, quantity, what it is, small markers. */
.production-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 9px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--ink);
    background: var(--surface);
}

.production-tag__dot {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a8adb8;
}

.production-tag--ready .production-tag__dot { background: var(--success); }
.production-tag--in_progress .production-tag__dot { background: var(--info); }
.production-tag--missing .production-tag__dot { background: var(--danger); }
.production-tag--on_hold .production-tag__dot { background: var(--warning); }
.production-tag--partial .production-tag__dot { background: #7048e8; }

.production-tag__qty {
    flex: none;
    font-weight: 700;
    color: var(--heading);
}

.production-tag__what {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.production-tag__mark {
    flex: none;
    padding: 0 5px;
    border-radius: 3px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--info-ink);
    background: var(--info-soft);
}

.production-tag__mark--partial {
    color: var(--warning-ink);
    background: var(--warning-soft);
}

.production-tag--more {
    padding: 0;
    border-style: dashed;
}

.production-tag__more {
    padding: 3px 9px;
    border: 0;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    background: transparent;
    cursor: pointer;
}

.production-tag__more:hover {
    text-decoration: underline;
}

/* Layout switch (List | Boxes) at the right of the toolbar. */
.production-viewswitch {
    display: inline-flex;
    margin-left: auto;
    padding: 3px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.production-viewswitch__option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--control-sm);
    padding: 0 12px;
    border: 0;
    border-radius: 5px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.production-viewswitch__option .icon {
    width: 15px;
    height: 15px;
}

.production-viewswitch__option:hover {
    color: var(--ink);
}

.production-viewswitch__option:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.production-viewswitch__option[aria-pressed="true"] {
    color: var(--ink);
    background: var(--surface2);
    box-shadow: inset 0 0 0 1px var(--border2);
}

/*
 * Boxes view: one full-width box per job, stacked, with every line of it here and its buttons, so lines are marked
 * on this screen. Calm: no coloured borders; a late job has a thin red left edge.
 */
.production-queue--boxes {
    display: grid;
    gap: 22px;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.production-jobbox {
    min-width: 0;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.production-jobbox--late {
    box-shadow: inset 3px 0 0 var(--danger), var(--shadow);
}

.production-jobbox__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 14px 16px;
    /* The job header reads as a band of the department's colour, clearly apart from its lines. */
    background: color-mix(in srgb, var(--stage, var(--primary)) 10%, var(--surface));
    border-bottom: 2px solid color-mix(in srgb, var(--stage, var(--primary)) 40%, var(--border2));
}

.production-jobbox__head .production-row__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--heading);
}

.production-jobbox__head .production-row__number {
    font-size: 18px;
    font-weight: 700;
}

.production-jobbox__all {
    flex: none;
}

.production-jobbox__who {
    flex: 1 1 0;
    min-width: 0;
    line-height: 1.35;
}

.production-jobbox__marks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.production-jobbox__sheet {
    font-size: 13px;
}

/* Same left padding as the job header, so the line checkboxes sit right under the job's "select all" box. */
.production-jobbox__lines .production-line {
    padding: 12px 16px;
    background: var(--surface);
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
}

.production-jobbox__lines .production-line:first-child {
    border-top: 0;
}

.production-jobbox__delivered {
    padding: 12px 14px;
}

.production-jobbox__undo {
    border-top: 1px solid var(--border);
    font-size: 13px;
}

.production-jobbox__undo summary {
    padding: 8px 14px;
    color: var(--muted);
    cursor: pointer;
}

.production-jobbox__undo summary:hover {
    color: var(--ink);
}

.production-jobbox__moves {
    padding: 0 14px 12px;
}

@media (max-width: 760px) {
    .production-jobbox__marks {
        flex-basis: 100%;
        margin-left: 0;
    }
}

/* The Boxes view's batch bar sticks to the bottom of the screen while lines are ticked. */
.production-boxbar {
    z-index: 15;
    bottom: 12px;
    box-shadow: var(--shadow-lg);
}

/* Job dialog: each line gets the room; one main button (and Done beside Start), the rest under "More". */
.production-line {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    padding: 14px;
}

.production-line__info {
    gap: 3px;
}

.production-line__title {
    font-size: 15px;
}

.production-line__actions {
    flex-wrap: wrap;
    align-items: center;
    align-self: center;
}

/*
 * Compact, modern buttons (user, 2026-10-26: "smaller and modern"): 34px tall, 6px radius, small icon. The next
 * step is filled in the department colour, the other steps are a light tint, Missing and On hold a light red tint.
 * Every action is a button of its own (Arin, 2026-10-27), wrapping onto a second row when there is no room.
 */
.production-action {
    gap: 6px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
}

.production-action .icon {
    width: 15px;
    height: 15px;
}

.production-action--main.btn--primary {
    color: #ffffff;
    border-color: var(--stage, var(--primary));
    background: var(--stage, var(--primary));
}

.production-action--main.btn--primary:hover:not(:disabled) {
    color: #ffffff;
    border-color: color-mix(in srgb, var(--stage, var(--primary)) 82%, #000000);
    background: color-mix(in srgb, var(--stage, var(--primary)) 82%, #000000);
}

.production-action--main:not(.btn--primary) {
    color: color-mix(in srgb, var(--stage, var(--primary)) 78%, var(--ink));
    border-color: transparent;
    background: color-mix(in srgb, var(--stage, var(--primary)) 11%, var(--surface));
}

.production-action--main:not(.btn--primary):hover:not(:disabled) {
    color: color-mix(in srgb, var(--stage, var(--primary)) 78%, var(--ink));
    border-color: transparent;
    background: color-mix(in srgb, var(--stage, var(--primary)) 19%, var(--surface));
}

.production-action--main.production-action--problem {
    color: var(--danger-ink);
    background: color-mix(in srgb, var(--danger-ink) 9%, var(--surface));
}

.production-action--main.production-action--problem:hover:not(:disabled) {
    color: var(--danger-ink);
    background: color-mix(in srgb, var(--danger-ink) 17%, var(--surface));
}

@media (max-width: 760px) {
    .production-pipelines {
        padding: 10px;
    }

    .production-step {
        flex-basis: 112px;
    }

    /* Long department names ("Glass Door Cutting") take two lines instead of all reading "Glass Doo…". */
    .production-step__name {
        display: -webkit-box;
        white-space: normal;
        line-height: 1.25;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .production-switch {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .production-switch__option {
        flex: none;
    }

    .production-row {
        grid-template-columns: 30px minmax(0, 1fr) auto;
        gap: 8px 10px;
    }

    .production-row__items {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .production-line {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .production-line__actions {
        grid-column: 1 / -1;
        flex-wrap: wrap;
    }

    .production-line__actions .production-action--main {
        flex: 1 1 0;
    }
}


/* A job's only line in the department: no checkbox column (nothing to select it with). */
.production-line.production-line--single {
    grid-template-columns: minmax(0, 1fr) auto;
}

@media (max-width: 760px) {
    .production-line.production-line--single {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ------------------------------------------------------------------------
 * Parts and QR labels (3.6): parts status chips, the parts dialog on the job page, scanning on the Production page,
 * and the printable label sheet.
 * ---------------------------------------------------------------------- */

.job-cell-files {
    white-space: nowrap;
}

.job-parts-button .badge {
    margin-left: 2px;
}

.job-parts__import {
    position: relative;
    cursor: pointer;
}

/* The real file input covers the button, like the files picker: keyboard and screen readers reach it. */
.job-parts__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.job-parts__import:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.job-parts__hint {
    margin: 0 0 12px;
}

.job-parts__replace {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--warning);
    border-radius: var(--radius-lg);
    color: var(--warning-ink);
    background: var(--warning-soft);
}

.job-parts__replace p {
    margin: 0;
}

.job-parts__replace-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.job-parts__table td {
    vertical-align: top;
}

.production-tag__mark--parts {
    color: var(--warning-ink);
    background: var(--warning-soft);
    text-transform: none;
}

.production-tag__mark--parts.is-complete {
    color: var(--success-ink);
    background: var(--success-soft);
}

/* Parts an earlier department completed the line without (QA 2026-11-02): "2 missing from Cutting". */
.production-tag__mark--missing {
    color: var(--danger-ink);
    background: var(--danger-soft);
    text-transform: none;
}

.production-parts {
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

.production-parts__scan {
    display: block;
    max-width: 320px;
}

.production-parts__input {
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 1px dashed var(--field-border);
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    background: var(--field);
}

.production-parts__input:focus {
    outline: none;
    border-style: solid;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

/* The open job's own scan box (a part on any of its lines here). */
.production-job-scan {
    display: grid;
    gap: 4px;
    max-width: 420px;
    margin: 12px 0 4px;
}

.production-job-scan__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.production-job-scan .production-parts__input {
    min-height: 42px;
    font-size: 15px;
}

/* A scan's result, right under the scan box that was used (Arin, 2026-10-29): green, amber or red, big enough to
   read from the bench. */
.production-scan-result {
    max-width: 420px;
    margin: 0;
    padding: 8px 12px;
    border-left: 4px solid currentColor;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.production-scan-result.is-ok {
    color: var(--success-ink);
    background: var(--success-soft);
}

.production-scan-result.is-warn {
    color: var(--warning-ink);
    background: var(--warning-soft);
}

.production-scan-result.is-error {
    color: var(--danger-ink);
    background: var(--danger-soft);
    animation: production-scan-alarm 0.4s ease-in-out 2;
}

@keyframes production-scan-alarm {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
    .production-scan-result.is-error {
        animation: none;
    }
}

/* The job's drawings and files on the shop floor (read only). */
.production-files {
    margin: 8px 0 12px;
    font-size: 13px;
}

.production-files__summary {
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.production-files__body {
    margin-top: 6px;
    color: var(--muted);
}

.production-files__actions {
    margin-bottom: 8px;
}

/* A line's own files on the shop floor (Arin, 2026-11-09), under its details. */
.production-files--line {
    margin: 6px 0 0;
}

.production-files__group {
    margin: 10px 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.production-files__list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.production-files__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--ink);
    background: var(--surface2);
}

.production-files__kind {
    min-width: 42px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-transform: uppercase;
}

.production-files__name {
    flex: 1 1 200px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.production-parts__list summary {
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
}

.production-parts__list summary:hover {
    color: var(--ink);
}

.production-parts__body {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

.production-parts__items {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.production-parts__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--ink);
    background: var(--surface2);
}

.production-parts__item.is-scanned {
    background: var(--success-soft);
}

.production-parts__no {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.production-parts__what {
    flex: 1 1 200px;
    min-width: 0;
}

/* Job sheet: one line per department that scans cabinets, under "Required / Not required". */
.job-view__cabinets {
    display: block;
    font-size: 13px;
    color: var(--muted);
}

/* Cabinets of the job at a department that scans them: scan box, then one chip per cabinet (green once scanned). */
.production-cabinets {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface2);
}

.production-cabinets__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.production-cabinets__title {
    margin: 0;
    font-size: 15px;
}

.production-cabinets__hint {
    margin: 0;
}

.production-cabinets__list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.production-cabinets__item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
    padding: 2px 10px;
    border: 1px solid var(--border2);
    border-radius: 999px;
    font-size: 13px;
    color: var(--ink);
    background: var(--surface);
}

.production-cabinets__item.is-scanned {
    border-color: transparent;
    color: var(--success-ink);
    background: var(--success-soft);
}

.production-cabinets__no {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Label sheet: three labels a row on screen and paper, each kept whole on one page. */
.part-labels {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.part-label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: #000000;
    background: #ffffff;
    break-inside: avoid;
    page-break-inside: avoid;
}

/* The QR is always black on white (scanners need contrast), at least 22 mm wide when printed. */
.part-label__qr {
    width: 28mm;
    height: 28mm;
    background: #ffffff;
}

.part-label__svg {
    display: block;
    width: 100%;
    height: 100%;
}

.part-label__svg-back {
    fill: #ffffff;
}

.part-label__svg-dot {
    fill: #000000;
}

.part-label__text {
    display: grid;
    gap: 2px;
    min-width: 0;
    font-size: 12px;
    line-height: 1.3;
}

.part-label__text p {
    margin: 0;
    overflow-wrap: anywhere;
}

.part-label__item {
    font-size: 15px;
    font-weight: 700;
}

.part-label__name {
    font-weight: 600;
}

.part-label__job {
    font-weight: 600;
}

.part-label__code {
    font-family: var(--font-mono);
    font-size: 10px;
    color: #333333;
}

.part-label__fail {
    font-size: 11px;
    font-weight: 600;
    color: #b7303f;
}

@media print {
    .part-labels-page .part-labels {
        grid-template-columns: repeat(3, 1fr);
        gap: 4mm;
    }

    .part-labels-page .part-label {
        border-color: #999999;
        border-radius: 0;
    }

    .part-labels-page .page-header {
        display: none;
    }
}

/* Production search: a scan icon in the box says a part label can be scanned here. */
.production-search {
    position: relative;
}

.production-search__icon {
    position: absolute;
    top: 50%;
    left: 11px;
    display: inline-flex;
    color: var(--primary);
    transform: translateY(-50%);
    pointer-events: none;
}

.production-search input {
    padding-left: 36px;
}

/* A permission with an explanation (Users page: "Projects: add only") spans the row, its hint under the label. */
.check-grid__item--hinted {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    row-gap: 0;
}

.check-grid__item--hinted small {
    flex-basis: 100%;
    padding-left: 26px;
    font-size: 12px;
}

/* A search box that also takes a scanned part label (Projects list): a scan icon inside the box. */
.search-scan {
    position: relative;
}

.search-scan__icon {
    position: absolute;
    top: 50%;
    left: 11px;
    display: inline-flex;
    color: var(--primary);
    transform: translateY(-50%);
    pointer-events: none;
}

/* Matches the form-field input rule's weight (it sets padding: 7px 12px) so the text starts after the icon. */
.form-field .search-scan input[type="search"]:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
    padding-left: 38px;
}

/* ------------------------------------------------------------------------
 * Dashboard (3.8): KPI strip, panels (urgent jobs, shop floor, ordering), quick links. Calm cards, no coloured
 * borders; department colours come from production-tab--hue-* (sets --stage only).
 * ---------------------------------------------------------------------- */

.dashboard {
    display: grid;
    gap: 18px;
}

.dashboard__header {
    align-items: flex-end;
}

.dashboard__updated {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.dashboard__kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.dashboard-kpi {
    --kpi: var(--primary);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.dashboard-kpi--alert { --kpi: var(--danger); }
.dashboard-kpi--warn { --kpi: var(--warning); }
.dashboard-kpi--ok { --kpi: var(--success); }

.dashboard-kpi__icon {
    grid-row: 1 / span 2;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--kpi);
    background: color-mix(in srgb, var(--kpi) 14%, var(--surface));
}

.dashboard-kpi__value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--heading);
    font-variant-numeric: tabular-nums;
}

.dashboard-kpi__label {
    font-size: 13px;
    color: var(--muted);
}

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

.dashboard-panel {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* A column of panels (ordering above the urgent jobs; the shop floor on the right). */
.dashboard__column {
    display: grid;
    align-content: start;
    gap: 16px;
    min-width: 0;
}

/* "Still to order": the first lines of each kind, most urgent job first. */
.dashboard-orders {
    display: grid;
    gap: 4px;
}

.dashboard-orders__title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.dashboard-orders__list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-orders__item + .dashboard-orders__item {
    border-top: 1px solid var(--border);
}

.dashboard-orders__link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 2px 10px;
    padding: 7px 4px;
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
}

.dashboard-orders__link:hover {
    background: var(--surface2);
}

.dashboard-orders__qty {
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.dashboard-orders__what {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-orders__detail,
.dashboard-orders__job,
.dashboard-orders__status {
    font-size: 12.5px;
    color: var(--muted);
}

.dashboard-orders__job {
    grid-column: 2 / -1;
}

.dashboard-orders__status {
    white-space: nowrap;
}

.dashboard-orders__more {
    justify-self: start;
    font-size: 13px;
}

.dashboard-panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.dashboard-panel__title {
    margin: 0;
    font-size: 16px;
    color: var(--heading);
}

.dashboard-panel__more {
    font-size: 13px;
    white-space: nowrap;
}

.dashboard-panel__empty {
    margin: 0;
    color: var(--muted);
}

.dashboard-urgent {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-urgent__item + .dashboard-urgent__item {
    border-top: 1px solid var(--border);
}

.dashboard-urgent__link {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
        "prio who tags"
        "prio where tags";
    gap: 2px 12px;
    align-items: center;
    padding: 10px 6px;
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
}

.dashboard-urgent__link:hover {
    background: var(--row-hover);
    text-decoration: none;
}

.dashboard-urgent__link .priority-pill { grid-area: prio; }

.dashboard-urgent__who {
    grid-area: who;
    display: grid;
    min-width: 0;
}

.dashboard-urgent__name {
    overflow: hidden;
    font-weight: 600;
    color: var(--heading);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-urgent__number {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
}

.dashboard-urgent__meta,
.dashboard-urgent__where,
.dashboard-urgent__due {
    overflow: hidden;
    font-size: 12.5px;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-urgent__where { grid-area: where; }

.dashboard-urgent__tags {
    grid-area: tags;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

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

.dashboard-flag {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--ink);
    background: var(--surface2);
    text-decoration: none;
}

a.dashboard-flag:hover {
    background: var(--row-hover);
    text-decoration: none;
}

.dashboard-flag__value {
    font-size: 22px;
    font-weight: 700;
    color: var(--heading);
    font-variant-numeric: tabular-nums;
}

.dashboard-flag__label {
    font-size: 12.5px;
    color: var(--muted);
}

.dashboard-stages {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
}

.dashboard-stage:hover {
    background: var(--row-hover);
    text-decoration: none;
}

.dashboard-stage__name {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    font-size: 13.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-stage__name::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--stage, var(--primary));
}

.dashboard-stage__count {
    font-weight: 700;
    color: var(--heading);
    font-variant-numeric: tabular-nums;
}

/* "2 jobs · 40 panels" (Arin, 2026-11-10), under the name, before the bar. */
.dashboard-stage__meta {
    grid-column: 1 / -1;
    margin: -2px 0 0 16px;
    font-size: 12px;
    color: var(--muted);
}

.dashboard-stage__problems {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 8px 4px 24px;
}

.dashboard-stage__problem {
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--danger-ink);
    background: var(--danger-soft);
    text-decoration: none;
}

.dashboard-stage__problem--on-hold {
    color: var(--warning-ink);
    background: var(--warning-soft);
}

.dashboard-stage__problem:hover {
    text-decoration: underline;
}

.dashboard-stage__count.is-zero {
    font-weight: 500;
    color: var(--muted);
}

.dashboard-stage__bar {
    grid-column: 1 / -1;
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--border);
}

.dashboard-stage__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 2px;
    background: var(--success);
}

.dashboard-stage__fill--10 { width: 10%; }
.dashboard-stage__fill--20 { width: 20%; }
.dashboard-stage__fill--30 { width: 30%; }
.dashboard-stage__fill--40 { width: 40%; }
.dashboard-stage__fill--50 { width: 50%; }
.dashboard-stage__fill--60 { width: 60%; }
.dashboard-stage__fill--70 { width: 70%; }
.dashboard-stage__fill--80 { width: 80%; }
.dashboard-stage__fill--90 { width: 90%; }
.dashboard-stage__fill--100 { width: 100%; }

/* "Office steps" (2026-11-05): the same rows as the shop floor; the bar is the step's share of the runs in the
   office, and side states (On Hold) have an amber dot. */
.dashboard-panel__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    min-width: 0;
}

.dashboard-panel__total {
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.dashboard-stage--office .dashboard-stage__fill {
    background: var(--primary);
}

.dashboard-stage--side .dashboard-stage__name::before {
    background: var(--warning);
}

.dashboard__links-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.dashboard-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dashboard-link {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    color: var(--ink);
    background: var(--surface);
    text-decoration: none;
}

.dashboard-link:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.dashboard-link > svg {
    grid-row: 1 / span 2;
    color: var(--primary);
}

.dashboard-link__label {
    font-weight: 600;
    color: var(--heading);
}

.dashboard-link__note {
    font-size: 12.5px;
    color: var(--muted);
}

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

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

    .dashboard-urgent__link {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "prio who"
            "prio where"
            "prio tags";
    }

    .dashboard-urgent__tags {
        justify-content: flex-start;
    }
}

/* ------------------------------------------------------------------------
 * Reports (3.8): hub cards, filter bar, report tables, print.
 * ---------------------------------------------------------------------- */

.report-hint {
    margin-top: 14px;
}

/* Reports hub: one list, a row per report with what you choose, what it shows and how it comes out. */
.report-list-wrap {
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.report-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.report-list th,
.report-list td {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.report-list thead th {
    border-top: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    background: var(--surface2);
}

.report-list tbody tr:hover {
    background: var(--row-hover);
}

.report-list__name {
    min-width: 240px;
    font-weight: 400;
}

.report-list__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
}

a.report-list__title:hover {
    color: var(--primary);
}

.report-list__text {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.report-list__shows {
    max-width: 320px;
    color: var(--muted);
}

.report-list__output {
    white-space: nowrap;
}

.report-list td .badge + .badge {
    margin-left: 4px;
}

.report-list__open {
    text-align: right;
    white-space: nowrap;
}

/* Phones: each report becomes a block, the column names shown before each value. */
@media (max-width: 760px) {
    .report-list thead {
        display: none;
    }

    .report-list tr,
    .report-list th,
    .report-list td {
        display: block;
    }

    .report-list tr {
        padding: 6px 0;
        border-top: 1px solid var(--border);
    }

    .report-list tbody tr:first-child {
        border-top: 0;
    }

    .report-list th,
    .report-list td {
        padding: 6px 16px;
        border-top: 0;
    }

    .report-list td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 11.5px;
        font-weight: 600;
        color: var(--muted);
        text-transform: uppercase;
    }

    .report-list__name {
        min-width: 0;
    }

    .report-list__shows {
        max-width: none;
    }

    .report-list__open {
        text-align: left;
    }
}

.report-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 14px;
}

.report-filters__customer {
    min-width: 220px;
}

.report-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.report-table__mono {
    font-family: var(--font-mono);
}

.report-table__late {
    font-weight: 600;
    color: var(--danger-ink);
}

.report-table__note {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.report-group {
    margin-top: 18px;
}

.report-none {
    margin: 4px 0 0;
    color: var(--muted);
}

.report-total {
    margin-top: 16px;
    font-weight: 600;
    color: var(--heading);
}

.report-errors {
    padding: 16px 18px;
    border: 1px solid var(--danger);
    border-radius: var(--radius-lg);
    color: var(--danger-ink);
    background: var(--danger-soft);
}

.report-errors ul {
    margin: 0 0 12px;
    padding-left: 18px;
}

@media print {
    .report-filters,
    .report .form-hint,
    .report-hint {
        display: none !important;
    }

    .report-table__late {
        color: #000000;
    }
}

/* Reports tables size their columns to the content (the ordering printout's fixed widths do not fit them). */
.printout__table.report-table {
    table-layout: auto;
}

.printout__table.report-table th,
.printout__table.report-table td {
    width: auto;
    overflow-wrap: normal;
}

.report-table__num,
.report-table__mono {
    white-space: nowrap;
}

/* Small laptops (1241–1439px): nine menu items need slightly tighter spacing to stay on one line. */
@media (min-width: 1241px) and (max-width: 1439px) {
    .app-nav,
    .app-nav:has(> a.app-nav__link:nth-of-type(9)) {
        gap: 2px;
    }

    .app-nav__link,
    .app-nav:has(> a.app-nav__link:nth-of-type(9)) .app-nav__link {
        padding: 0 8px;
        font-size: 14px;
    }
}

/* Settings > E-mail (customer e-mails, 3.8b): white cards for the settings, the test and the recent e-mails */
.mail-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.mail-card__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--heading);
}

.mail-switch {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: var(--primary-soft);
    border-radius: var(--radius-input);
}

.mail-switch strong {
    color: var(--primary-ink);
}

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

.mail-grid__wide {
    grid-column: 1 / -1;
}

.mail-events {
    display: grid;
    gap: 6px;
}

.mail-events .form-field--check label {
    flex-wrap: wrap;
    column-gap: 10px;
    row-gap: 0;
}

@media (max-width: 760px) {
    /* The hint goes under its label (lined up with the text) instead of squeezing beside it */
    .mail-events .form-field--check small {
        flex-basis: 100%;
        padding-left: 28px;
    }
}

.mail-warning {
    margin: 0;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--warning-ink);
    background: var(--warning-soft);
    border-radius: var(--radius-input);
}

.mail-test__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

.mail-test__row .form-field {
    flex: 1 1 260px;
}

.mail-log__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mail-log__when {
    white-space: nowrap;
}

.mail-log__to small,
.mail-log__error {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.mail-log__error {
    max-width: 320px;
    color: var(--danger-ink);
}

/* Platform companies: the customer e-mail add-on badge with its switch */
.company-emails {
    white-space: nowrap;
}

.company-emails .btn {
    margin-left: 6px;
}

.company-modules {
    white-space: nowrap;
}

.company-module + .company-module {
    margin-top: 6px;
}

.company-module__name {
    display: inline-block;
    min-width: 80px;
}

.company-module .btn {
    margin-left: 6px;
}

@media (max-width: 760px) {
    .mail-card {
        padding: 14px;
    }

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

/* ------------------------------------------------------------------------
 * Mozaik upload (js/mozaik-upload.js): steps, drop zone, progress, preview, result
 * ---------------------------------------------------------------------- */

.mozaik-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.mozaik-steps__btn {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
    min-height: var(--tap);
    padding: 10px 12px;
    text-align: left;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.mozaik-steps__btn:hover:not(:disabled) {
    background: var(--row-hover);
}

.mozaik-steps__btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.mozaik-steps__btn.is-current {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.mozaik-steps__btn.is-locked {
    opacity: 0.7;
}

.mozaik-steps__btn:disabled {
    cursor: default;
}

.mozaik-steps__no {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 26px;
    height: 26px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface2);
    border-radius: 50%;
}

.mozaik-steps__btn.is-current .mozaik-steps__no {
    color: var(--on-primary);
    background: var(--primary);
}

.mozaik-steps__text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.mozaik-steps__text strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--heading);
}

.mozaik-steps__text small {
    font-size: 12px;
    color: var(--muted);
}

.mozaik-pick {
    display: grid;
    gap: 12px;
}

.mozaik-drop {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 28px 18px;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 2px dashed var(--border2);
    border-radius: var(--radius-lg);
}

.mozaik-drop p {
    max-width: 560px;
    margin: 0;
}

/* Under a CNC-file preview: the place to add the run's pricing report as well (smaller than the first drop). */
.mozaik-drop--add {
    padding: 16px 14px;
    margin-bottom: 4px;
}

.mozaik-drop.is-dragging {
    color: var(--primary-ink);
    background: var(--primary-soft);
    border-color: var(--primary);
}

.mozaik-drop__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--heading);
}

.mozaik-drop__pick {
    position: relative;
    margin: 4px 0;
    cursor: pointer;
}

/* The real file input covers the button, so keyboard and screen readers reach it (as on the parts import). */
.mozaik-drop__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.mozaik-drop__pick:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.mozaik-progress {
    display: grid;
    gap: 10px;
    padding: 28px 18px;
    background: var(--surface2);
    border-radius: var(--radius-lg);
}

.mozaik-progress p {
    margin: 0;
}

.mozaik-progress__file {
    font-weight: 600;
    color: var(--heading);
    overflow-wrap: anywhere;
}

.mozaik-progress__text {
    font-weight: 600;
    color: var(--primary-ink);
}

.mozaik-bar {
    position: relative;
    height: 10px;
    overflow: hidden;
    background: var(--border2);
    border-radius: 999px;
}

.mozaik-bar__fill {
    display: block;
    width: 0;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.2s ease;
}

/* Uploaded, the server reads the file: a moving stripe says it is still working. */
.mozaik-bar.is-reading .mozaik-bar__fill {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 50%, var(--primary) 100%);
    background-size: 200% 100%;
    animation: mozaik-reading 1.2s linear infinite;
}

@keyframes mozaik-reading {
    from { background-position: 200% 0; }
    to { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    .mozaik-bar.is-reading .mozaik-bar__fill {
        animation: none;
    }
}

.mozaik-note {
    padding: 12px 14px;
    border: 1px solid var(--border2);
    border-left-width: 4px;
    border-radius: var(--radius-lg);
    color: var(--ink);
    background: var(--surface2);
}

.mozaik-note p {
    margin: 0;
}

.mozaik-note__title {
    font-weight: 600;
}

.mozaik-note__list {
    display: grid;
    gap: 4px;
    margin: 6px 0 0;
    padding-left: 18px;
}

.mozaik-note--danger {
    color: var(--danger-ink);
    background: var(--danger-soft);
    border-color: var(--danger);
}

.mozaik-note--warn {
    color: var(--warning-ink);
    background: var(--warning-soft);
    border-color: var(--warning);
}

.mozaik-note--info {
    color: var(--info-ink);
    background: var(--info-soft);
    border-color: var(--info);
}

.mozaik-preview {
    display: grid;
    gap: 14px;
}

.mozaik-preview p {
    margin: 0;
}

.mozaik-preview__lead {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-weight: 500;
}

.mozaik-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr));
    gap: 8px;
}

.mozaik-facts__item {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 10px 12px;
    background: var(--surface2);
    border-radius: var(--radius-lg);
}

.mozaik-facts__label {
    font-size: 12px;
    color: var(--muted);
}

.mozaik-facts__value {
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
    overflow-wrap: anywhere;
}

/* One file of a two-file preview (the CNC file and the pricing report, 2026-11-05). */
.mozaik-part {
    display: grid;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border2);
}

.mozaik-part__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--heading);
}

.mozaik-part__file {
    font-weight: 400;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.mozaik-section {
    display: grid;
    gap: 10px;
}

.mozaik-section__title {
    margin: 4px 0 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
}

.mozaik-material {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
}

.mozaik-material--keep {
    border-left-color: var(--border2);
    background: var(--surface2);
}

.mozaik-material__head {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
}

.mozaik-material__name {
    margin: 0 4px 0 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--heading);
    overflow-wrap: anywhere;
}

.mozaik-material__facts {
    font-size: 13px;
    color: var(--muted);
}

.mozaik-material__qty {
    font-size: 13px;
}

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

/* How the product type was filled in ("Filled in: remembered"), or "Choose the product type" while it is empty. */
.mozaik-map__source {
    display: block;
    margin-top: 2px;
}

.mozaik-map__source.is-missing {
    color: var(--warning-ink);
    font-weight: 600;
}

.mozaik-material__remember {
    margin-top: 4px;
}

.mozaik-material__missing {
    margin-top: 8px;
}

.mozaik-required {
    color: var(--danger-ink);
}

.mozaik-details summary {
    display: flex;
    align-items: center;
    min-height: var(--tap);
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-ink);
    cursor: pointer;
}

.mozaik-details .table-wrap {
    max-height: 320px;
    overflow: auto;
}

.mozaik-cabinets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 6px 16px;
    margin: 0;
    padding: 0;
    font-size: 14px;
    list-style: none;
}

.mozaik-remember {
    padding: 4px 12px;
    background: var(--surface2);
    border-radius: var(--radius-lg);
}

.mozaik__actions {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.mozaik-done {
    display: grid;
    gap: 12px;
}

.mozaik-done__head {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    color: var(--success-ink);
    background: var(--success-soft);
    border-radius: var(--radius-lg);
}

.mozaik-done p,
.mozaik-done__title {
    margin: 0;
}

.mozaik-done__title {
    font-size: 17px;
    font-weight: 600;
}

.mozaik-done__icon .icon {
    width: 28px;
    height: 28px;
}

.mozaik-done__list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 20px;
}

.job-cell-mozaik {
    overflow-wrap: anywhere;
}

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

@media (max-width: 760px) {
    .mozaik-steps,
    .mozaik-map {
        grid-template-columns: minmax(0, 1fr);
    }

    .mozaik-drop,
    .mozaik-progress {
        padding: 20px 12px;
    }

    .mozaik__actions .btn {
        flex: 1 1 auto;
    }
}

/* ------------------------------------------------------------------------
 * Settings > Mozaik materials (2026-10-29): one card row per remembered Mozaik material, its actions on the right
 * (below the text on phones).
 * ---------------------------------------------------------------------- */
.mozaik-maps {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.mozaik-maps__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.mozaik-maps__item:first-child {
    border-top: 0;
}

.mozaik-maps__main {
    display: grid;
    gap: 2px;
    flex: 1 1 18rem;
    min-width: 0;
}

.mozaik-maps__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.mozaik-maps__becomes {
    overflow-wrap: anywhere;
}

.mozaik-maps__arrow,
.mozaik-maps__changed {
    color: var(--muted);
}

.mozaik-maps__changed {
    font-size: 12px;
}

.mozaik-maps__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mozaik-maps__dialog-name {
    margin: 0 0 12px;
    overflow-wrap: anywhere;
}

/* ----------------------------------------------------------------------
 * Cutting leftovers (0028): the question after Completed (shop tablets and phones: big, simple buttons), the
 * Completed list's leftovers, and Ordering > Leftovers.
 * ---------------------------------------------------------------------- */

.leftover-dialog {
    width: min(620px, calc(100vw - 24px));
}

.leftover-dialog .dialog__title {
    font-size: 20px;
}

.leftover-dialog__lead {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.leftover-dialog__lines,
.leftover-dialog__amounts-wrap {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.leftover-dialog__legend {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.leftover-dialog__choices {
    display: grid;
    gap: 8px;
}

.leftover-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    min-height: var(--tap);
    padding: 8px 12px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.leftover-choice:has(input:checked) {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.leftover-choice input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.leftover-choice__text {
    flex: 1 1 180px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.leftover-amounts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.leftover-amount {
    min-height: 60px;
    padding: 6px 4px;
    font: inherit;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid var(--field-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.leftover-amount:hover {
    border-color: var(--primary);
}

.leftover-amount:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.leftover-amount[aria-pressed="true"] {
    color: var(--on-primary);
    background: var(--primary);
    border-color: var(--primary);
}

.leftover-dialog__actions .btn {
    min-height: 52px;
    padding-inline: 22px;
    font-size: 16px;
}

.leftover-dialog__actions .leftover-dialog__save {
    flex: 1 1 auto;
}

.leftover-dialog input[name="note"] {
    min-height: var(--tap);
    font-size: 16px;
}

@media (max-width: 520px) {
    .leftover-amounts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .leftover-dialog__actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .leftover-dialog__actions .btn {
        width: 100%;
    }
}

.production-done__leftovers {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.leftover-totals {
    margin: 0 0 20px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.leftover-totals__title {
    margin: 0 0 10px;
    font-size: 15px;
}

.leftover-totals__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.leftover-totals__item {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--success-soft);
}

.leftover-totals__amount {
    font-size: 17px;
    font-weight: 700;
    color: var(--success-ink);
}

.leftover-totals__material {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.leftover-totals__count {
    font-size: 12.5px;
    color: var(--muted);
}

.leftover-filters__search {
    flex: 1 1 260px;
}

.leftover-table__material strong {
    overflow-wrap: anywhere;
}

.leftover-table__sub {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
}

.leftover-table__amount {
    font-weight: 700;
    white-space: nowrap;
}

.leftover-table__note {
    max-width: 240px;
    overflow-wrap: anywhere;
}

.leftover-table tr.is-used td {
    color: var(--muted);
}

/* Printed labels: the question before a change that makes them outdated (job page, material line dialog). */
.relabel-notice {
    display: grid;
    gap: 8px;
    justify-items: start;
    padding: 10px 12px;
    border: 1px solid var(--warning);
    border-radius: 8px;
    background: var(--warning-soft);
}

.relabel-notice__text {
    margin: 0;
    color: var(--warning-ink);
}

/* ---- Shop stations (0029): PIN sign-in ------------------------------------------------------- */

.station {
    display: grid;
    gap: 24px;
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 24px 16px 40px;
}

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

.station__brand {
    display: flex;
    gap: 10px;
    align-items: center;
}

.station__app {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

.station__name {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.station__title {
    margin: 0 0 16px;
    font-size: 26px;
    text-align: center;
    color: var(--ink);
}

.station__workers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.station__worker {
    display: grid;
    gap: 10px;
    justify-items: center;
    width: 100%;
    min-height: 140px;
    padding: 18px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font: inherit;
    color: var(--ink);
    cursor: pointer;
}

.station__worker:hover,
.station__worker:focus-visible {
    border-color: var(--primary);
    outline: none;
    box-shadow: var(--ring);
}

.station__avatar {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
}

.station__worker-name {
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    overflow-wrap: anywhere;
}

.station__pin {
    display: grid;
    gap: 18px;
    justify-items: center;
}

/* The real input stays focusable for keyboards and scanners; the dots show how many digits are typed. */
.station__pin-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.station__dots {
    display: flex;
    gap: 16px;
}

.station__dot {
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary);
    border-radius: 50%;
}

.station__dot.is-filled {
    background: var(--primary);
}

.station__pin.is-wrong .station__dots {
    animation: station-shake 0.35s;
}

.station__pin.is-loading {
    opacity: 0.7;
}

@keyframes station-shake {
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

@media (prefers-reduced-motion: reduce) {
    .station__pin.is-wrong .station__dots {
        animation: none;
    }
}

.station__keys {
    display: grid;
    grid-template-columns: repeat(3, 84px);
    gap: 12px;
}

.station__key {
    height: 72px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font: inherit;
    font-size: 26px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.station__key:hover,
.station__key:focus-visible {
    border-color: var(--primary);
    outline: none;
}

.station__key--soft {
    font-size: 16px;
    color: var(--muted);
}

.station__footnote {
    margin: 0;
    text-align: center;
}

.station-here {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--ink);
}

.station-form {
    max-width: 420px;
}

.stations__title {
    margin-top: 28px;
    font-size: 18px;
}

/* Receiving (0035): lines waiting for a delivery, by supplier and job; large tap targets for a phone. */
.receiving-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.receiving-filters__search {
    flex: 1 1 280px;
}

.receiving-filters__vendor {
    flex: 0 1 220px;
    min-width: 0;
}

.receiving-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 12px;
    padding: 10px 16px;
    color: var(--danger-ink);
    background: var(--danger-soft);
    border-radius: var(--radius);
}

.receiving-notice p {
    flex: 1 1 280px;
    margin: 0;
}

.receiving-groups {
    display: grid;
    gap: 16px;
}

.receiving-supplier {
    padding: 12px 16px 16px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.receiving-supplier__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border2);
}

.receiving-supplier__name {
    margin: 0;
    font-size: 17px;
    color: var(--heading);
}

.receiving-supplier__head .btn {
    margin-left: auto;
}

.receiving-job {
    margin-top: 12px;
}

.receiving-job__title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.receiving-lines {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.receiving-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 12px;
    min-height: var(--tap);
    padding: 10px 12px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
}

.receiving-line.is-selected {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.receiving-line--missing {
    border-left: 4px solid var(--danger);
}

.receiving-line--stale {
    border-color: var(--danger);
}

.receiving-line__check {
    width: 24px;
    height: 24px;
    margin: 2px 0 0;
    accent-color: var(--primary);
}

.receiving-line__what {
    display: grid;
    gap: 2px;
    cursor: pointer;
}

.receiving-line__title {
    font-weight: 600;
    color: var(--heading);
}

.receiving-line__amount {
    font-variant-numeric: tabular-nums;
}

.receiving-line__state,
.receiving-line__notes,
.receiving-line__vendor {
    font-size: 13px;
    color: var(--muted);
}

/* The line's vendor (0044), also under a delivered line in the Received list. */
.receiving-line__vendor {
    display: block;
}

.receiving-line__missing {
    font-size: 13px;
    color: var(--danger-ink);
}

.receiving-empty__title {
    font-weight: 600;
}

.receiving-actionbar {
    position: sticky;
    bottom: calc(12px + var(--tabbar, 0px));
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-top: 16px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.receiving-actionbar__count {
    margin: 0;
    font-weight: 600;
    color: var(--heading);
}

.receiving-actionbar__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.receiving-partial-lines {
    display: grid;
    gap: 12px;
    margin: 12px 0;
}

.receiving-photo-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.receiving-photo-pick {
    position: relative;
    cursor: pointer;
}

.receiving-photo-pick:focus-within {
    box-shadow: var(--ring);
}

.receiving-photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.receiving-photo {
    display: block;
    width: 88px;
    height: 88px;
    overflow: hidden;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
}

.receiving-photo__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.receiving-history__list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.receiving-history__item {
    padding: 10px 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
}

.receiving-history__head,
.receiving-history__facts,
.receiving-history__note {
    margin: 0 0 4px;
}

.receiving-history__facts {
    font-size: 13px;
    color: var(--muted);
}

.receiving-history__note {
    color: var(--danger-ink);
}

/* Receiving > Received (2026-11-06): the deliveries booked lately, one card each, newest first. */
.receiving-tabs {
    margin-bottom: 12px;
}

.receiving-received__list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.receiving-received__item {
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.receiving-received__head {
    margin: 0 0 6px;
}

.receiving-received__lines {
    display: grid;
    gap: 6px;
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
}

.receiving-received__line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    padding: 6px 0;
    border-top: 1px solid var(--border2);
}

.receiving-received__job {
    font-weight: 600;
    color: var(--heading);
}

.receiving-received__facts {
    flex-basis: 100%;
    margin: 0;
}

.receiving-received__line .btn {
    margin-left: auto;
}

.receiving-received__item > .receiving-photo-list {
    margin-bottom: 8px;
}

/* Ordering: what Receiving booked on a line (a Missing note the office follows up, or what came so far). */
.ordering-receiving {
    display: block;
    margin-top: 4px;
    font-size: 13px;
}

.ordering-receiving__note {
    color: var(--danger-ink);
}

/* Ordering (0046): a partially ordered line, "Ordered 10 of 21 · 11 still to order". */
.ordering-ordered {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--heading);
}

/* Ordering (0044): a material line without a vendor. */
.ordering-novendor {
    font-weight: 500;
    color: var(--danger-ink);
}

/* The "How many were ordered?" window (0046): one field per selected line. */
.ordering-qty__lines {
    display: grid;
    gap: 12px;
    max-height: 55vh;
    margin: 12px 0;
    overflow-y: auto;
}

.ordering-qty__line .ordering-qty__input {
    max-width: 160px;
}

/* The material line form (0046): "How many were ordered?" under a status that asks for it. */
.ordered-qty {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

@media (max-width: 600px) {
    .receiving-supplier {
        padding: 10px 10px 12px;
    }

    .receiving-line {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .receiving-line .btn {
        grid-column: 2;
        justify-self: start;
    }

    .receiving-actionbar__controls .btn {
        flex: 1 1 auto;
    }
}

/* Required scanning (0034): what a department completed lines without. */
.production-tofix {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: var(--danger-soft);
}

.production-tofix__title {
    margin: 0;
    font-size: 16px;
    color: var(--danger-ink);
}

.production-tofix__jobs,
.production-tofix__job {
    display: grid;
    gap: 8px;
}

.production-tofix__jobname,
.production-tofix__what {
    margin: 0;
    font-size: 14px;
}

.production-tofix__number {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
}

.production-tofix__line {
    display: grid;
    gap: 6px;
}

.production-parts__missing {
    margin: 0 0 6px;
    font-weight: 600;
    color: var(--danger-ink);
}

.production-parts__required {
    margin: 0 0 6px;
}

.production-missing__list {
    margin: 0 0 12px;
    padding-left: 18px;
}

.job-missing {
    margin-top: 6px;
}

.job-missing summary {
    cursor: pointer;
}

.job-missing__list {
    margin: 6px 0 0;
    padding-left: 18px;
}

.job-missing__item {
    margin-bottom: 4px;
}

/* A drop-down list you can search (js/search-select.js): the button shows the chosen entry; the panel holds the
   search box and the matching entries. The real <select> stays in the form, hidden. */
.search-select {
    position: relative;
}

.search-select__native {
    display: none !important;
}

.form-field .search-select__toggle,
.search-select__toggle {
    display: block;
    width: 100%;
    min-height: var(--control);
    padding: 7px 36px 7px 12px;
    overflow: hidden;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-input);
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    background-color: var(--field);
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.search-select__toggle.is-placeholder {
    color: var(--muted);
}

.search-select__toggle:focus-visible,
.search-select.is-open .search-select__toggle {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.search-select__toggle:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.search-select__toggle.is-invalid {
    border-color: var(--danger);
}

.search-select__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 60;
    width: 100%;
    min-width: min(300px, 86vw);
    padding: 6px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.search-select__panel[hidden] {
    display: none;
}

.form-field .search-select__input,
.search-select__input {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-input);
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    background: var(--field);
}

.form-field .search-select__input:focus-visible,
.search-select__input:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.search-select__list {
    max-height: 260px;
    margin: 6px 0 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    -webkit-overflow-scrolling: touch;
}

.search-select__item {
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
}

.search-select__item.is-chosen {
    font-weight: 600;
}

.search-select__item.is-active,
.search-select__item:hover {
    color: var(--primary-ink);
    background: var(--primary-soft);
}

.search-select__item.is-disabled {
    color: var(--muted);
    cursor: not-allowed;
}

.search-select__item--typed {
    border-top: 1px solid var(--border2);
    font-style: italic;
}

.search-select__group {
    padding: 8px 10px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.search-select__empty {
    padding: 8px 10px;
    font-size: 13px;
    color: var(--muted);
}

/* Rush (0047; Arin, 2026-11-12): a rush material line flashes red at every department and its job comes first;
   the office sees a red "Rush" badge. Steady red when the device turns animations off. */
@keyframes rush-flash {
    0%, 100% { background-color: var(--danger-soft); box-shadow: inset 4px 0 0 var(--danger); }
    50% { background-color: var(--surface); box-shadow: inset 4px 0 0 var(--danger-soft); }
}

@keyframes rush-badge {
    0%, 100% { color: #ffffff; background-color: var(--danger); }
    50% { color: var(--danger-ink); background-color: var(--danger-soft); }
}

.badge--rush {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #ffffff;
    background: var(--danger);
}

.production-row--rush,
.production-jobbox--rush,
.production-line--rush {
    border-color: var(--danger);
    animation: rush-flash 1.2s ease-in-out infinite;
}

.production-row--rush .badge--rush,
.production-jobbox--rush .badge--rush,
.production-line--rush .badge--rush {
    animation: rush-badge 1.2s ease-in-out infinite;
}

.production-tag--rush {
    border-color: var(--danger);
}

.production-tag__mark--rush {
    color: #ffffff;
    background: var(--danger);
}

.project-row--rush > td:first-child {
    box-shadow: inset 4px 0 0 var(--danger);
}

.rush-check {
    font-weight: 600;
    color: var(--danger-ink);
}

@media (prefers-reduced-motion: reduce) {
    .production-row--rush,
    .production-jobbox--rush,
    .production-line--rush,
    .production-row--rush .badge--rush,
    .production-jobbox--rush .badge--rush,
    .production-line--rush .badge--rush {
        animation: none;
    }

    .production-row--rush,
    .production-jobbox--rush,
    .production-line--rush {
        background-color: var(--danger-soft);
        box-shadow: inset 4px 0 0 var(--danger);
    }
}
