/* ---------- Fonts & design tokens (ported from the old shadcn/tailwind app) ---------- */
@font-face {
    font-family: Inter;
    src: url('/fonts/Inter-Variable.ttf');
    font-display: swap;
}

:root {
    --app-primary: #2c6dce;
    --app-primary-soft: rgba(44, 109, 206, 0.2);
    --app-fg: #18181b;
    --app-muted-fg: #71717a;
    --app-muted-bg: #f4f4f5;
    --app-border: #e4e4e7;
    --app-radius: 0.65rem;

    /* AntDesign (variable.css) primary palette -> #2c6dce */
    --ant-primary-color: #2c6dce;
    --ant-primary-color-hover: #5189d9;
    --ant-primary-color-active: #1f53a3;
    --ant-primary-color-outline: rgba(44, 109, 206, 0.2);
    --ant-primary-1: #e9f0fa;
    --ant-primary-2: #c8daf3;
    --ant-primary-3: #a0bfea;
    --ant-primary-4: #78a3e0;
    --ant-primary-5: #5189d9;
    --ant-primary-6: #2c6dce;
    --ant-primary-7: #1f53a3;
    --ant-primary-color-deprecated-l-35: #c8daf3;
    --ant-primary-color-deprecated-l-20: #86ace4;
    --ant-primary-color-deprecated-t-20: #5689d8;
    --ant-primary-color-deprecated-t-50: #95b6e6;
    --ant-primary-color-deprecated-f-12: rgba(44, 109, 206, 0.12);
    --ant-primary-color-active-deprecated-f-30: rgba(233, 240, 250, 0.3);
    --ant-primary-color-active-deprecated-d-02: #e1eaf8;
    --ant-info-color: #2c6dce;
    --ant-font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--app-fg);
    background: #fff;
}

h1:focus {
    outline: none;
}

/* ---------- Generic layout helpers (replacing the tailwind/bootstrap utilities) ---------- */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.app-main {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.page-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

/* Wide tables (label job) use the whole screen. */
.page-container.page-full {
    max-width: none;
}

.page-band {
    background: var(--app-primary-soft);
    flex-shrink: 0;
}

.page-band h1 {
    margin: 0;
    padding: 1rem 0;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 2rem;
}

.page-band .page-container {
    padding-top: 0;
    padding-bottom: 0;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.flex-col-fill {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.muted {
    color: var(--app-muted-fg);
}

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

.empty-box {
    padding: 3rem;
    text-align: center;
    color: var(--app-muted-fg);
    background: rgba(244, 244, 245, 0.4);
    border: 1px dashed var(--app-border);
    border-radius: var(--app-radius);
}

.center-spin {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

/* ---------- Header (HeaderView.tsx) ---------- */
.app-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.25rem;
    background: var(--app-primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    z-index: 10;
    overflow: hidden;
    flex-shrink: 0;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /* Basis 0 + automatic min width: the left side only takes free space and never shrinks
       below the logo, so the context button can't slide over it */
    flex: 1 1 0;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    margin-left: auto;
}

/* Only the context button gives way when the header is full; the other buttons keep their size */
.app-header-right > * {
    flex-shrink: 0;
}

.app-header .ant-btn.header-btn.context-btn {
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.app-header .ant-btn.header-btn,
.app-header .ant-btn.header-btn:focus {
    color: #fff;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.app-header .ant-btn.header-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.app-header-brand:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.app-header-logo {
    display: block;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
}

.app-header-title {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 5rem;
}

.context-btn-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.context-btn-content .sep {
    opacity: 0.3;
}

.context-btn-content .ctx-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 240px;
    min-width: 0;
}

.context-btn-content .ctx-item .anticon {
    flex-shrink: 0;
}

.context-btn-content .ctx-text {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.context-btn-content .ctx-item .anticon {
    opacity: 0.8;
}

@media (max-width: 639px) {
    .context-btn-content {
        gap: 0.35rem;
    }

    .context-btn-content .ctx-item {
        max-width: 28vw;
    }

    /* Pages with their own title (pick list detail): the title gets the room, the context
       button shrinks to the user icon - it still opens the context dialog */
    .app-header:has(.app-header-title) .context-btn-content .ctx-text,
    .app-header:has(.app-header-title) .context-btn-content .sep,
    .app-header:has(.app-header-title) .context-btn-content .ctx-item:not(.ctx-user) {
        display: none;
    }

    .app-header:has(.app-header-title) .app-header-left {
        min-width: 0;
    }
}

/* ---------- Context selection (RequireUserContext.tsx) ---------- */
/* The dialog never grows past the screen: content is capped at the viewport height and
   the profile/warehouse lists shrink (and scroll) instead of the whole modal */
.context-modal .ant-modal {
    padding-bottom: 0;
}

.context-modal .ant-modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 2rem);
}

.context-modal .ant-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.context-grid {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .context-grid {
        flex-direction: row;
    }

    .context-grid .context-card {
        flex: 1 1 0;
    }
}

.context-card {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    min-width: 0;
}

.context-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--app-border);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--app-muted-fg);
}

.context-card-title .anticon {
    color: var(--app-primary);
    font-size: 1.2rem;
}

.context-options {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 0 1 auto;
    min-height: 7rem;
    max-height: 300px;
    overflow: auto;
}

/* Warehouses: a short list, always shown whole - only the profile list shrinks and scrolls */
.context-card-full {
    flex-shrink: 0;
}

.context-card-full .context-options {
    min-height: 0;
    max-height: none;
    overflow: visible;
}

.context-options .ant-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: auto;
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.context-options .ant-btn .selected-mark {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.8;
}

.context-continue {
    flex-shrink: 0;
    width: 100%;
    margin: 1.5rem auto 0;
    max-width: 28rem;
}

.context-continue .ant-btn {
    height: 3.25rem;
    font-size: 1.25rem;
    font-weight: 600;
}

/* ---------- Home tiles (HomePage.tsx) ---------- */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .tiles-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    color: var(--app-fg);
    text-align: center;
    text-decoration: none;
    transition: background-color .15s;
}

.app-tile:hover {
    background: #f8fafc;
    color: var(--app-fg);
}

.app-tile .anticon {
    font-size: 3rem;
    color: #1e293b;
}

/* Phones and tablets (touch as the main input) don't get computer-only modules. */
@media (pointer: coarse) {
    .desktop-only {
        display: none !important;
    }
}

/* Sits right under .home-logout, which is pinned to the bottom of .app-main (flex column). */
.home-footer {
    margin-top: 0;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--app-muted-fg);
    opacity: 0.5;
}

/* ---------- Pick list dashboard (PickListsDashboardPage.tsx) ---------- */
.pl-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    align-items: center;
}

.pl-col-3 { grid-column: span 3 / span 3; }
.pl-col-2 { grid-column: span 2 / span 2; }

.pl-list-header {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-muted-fg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pl-list-header .text-right {
    text-align: right;
}

.pl-items {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.pl-item {
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
    color: var(--app-fg);
    text-decoration: none;
    font-size: 0.875rem;
    transition: border-color .2s, box-shadow .2s;
}

.pl-item:hover {
    color: var(--app-fg);
    border-color: rgba(44, 109, 206, 0.5);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.pl-item:hover .pl-name {
    color: var(--app-primary);
}

.pl-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.pl-date .anticon {
    color: var(--app-primary);
}

.pl-date small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--app-muted-fg);
}

.pl-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--app-muted-fg);
    min-width: 0;
}

.pl-meta .anticon {
    opacity: 0.7;
}

.pl-name {
    font-weight: 500;
    transition: color .2s;
}

.pl-progress {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.pl-progress .ant-progress {
    width: 5rem;
    margin: 0;
}

.pl-progress span.pct {
    width: 2.25rem;
    text-align: right;
    font-weight: 500;
    font-size: 0.75rem;
}

.pl-mobile {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
}

.pl-mobile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(228, 228, 231, 0.6);
}

.pl-mobile .pl-name {
    font-weight: 600;
    font-size: 1rem;
}

.pl-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    background: var(--app-muted-bg);
}

.pl-mobile-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--app-muted-fg);
}

.pl-mobile-bottom strong {
    color: var(--app-fg);
}

.pl-section-archival {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--app-border);
}

.pl-section-archival-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pl-section-archival-head h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--app-muted-fg);
}

@media (max-width: 767px) {
    .pl-desktop-only {
        display: none !important;
    }

    .pl-mobile {
        display: flex;
    }

    .pl-items {
        gap: 0.75rem;
    }

    .pl-item {
        padding: 1rem;
    }
}

/* ---------- Document selection (SelectDocumentsView.tsx) ---------- */
.docs-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.docs-panel-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.docs-panel-head h2 {
    margin: 0;
    padding: 1rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.docs-table-wrap {
    overflow: auto;
    min-height: 8rem;
}

.docs-table-wrap.pz {
    flex: 1;
    border: 1px solid #a78bfa;
}

.docs-table-wrap.wz {
    flex: 2;
    border: 1px solid #22c55e;
}

.create-pick-name {
    padding: 0.5rem 0;
}

.page-footer-actions {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 0;
    flex-shrink: 0;
}

/* ---------- Plain data tables styled like shadcn <Table> ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 2.5rem;
    padding: 0 0.5rem;
    text-align: left;
    font-weight: 500;
    color: var(--app-fg);
    white-space: nowrap;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

.data-table tbody tr:hover > td {
    background-color: rgba(244, 244, 245, 0.5);
}

.data-table tr.clickable {
    cursor: pointer;
}

.data-table tr.row-past > td,
.data-table tr.row-past:hover > td {
    background-color: #d1d5db;
}

.data-table tr.row-selected > td,
.data-table tr.row-selected:hover > td {
    background-color: #bfdbfe;
}

.cell-ellipsis {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-pill {
    display: inline-block;
    min-width: 4.5rem;
    padding: 0 0.25rem;
    border-radius: 0.25rem;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.status-pill.open { background: #16a34a; }
.status-pill.closed { background: #dc2626; }

/* ---------- Pick list detail (PickListViewPage.tsx / PickListTable.tsx / PickListMobileList.tsx) ---------- */
.pick-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.pick-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.pick-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pick-letters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    z-index: 20;
    border-bottom: 1px solid var(--app-border);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.pick-letter.ant-btn {
    height: auto;
    padding: 0.5rem 1rem;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.75rem;
}

.pick-letter.ant-btn:focus {
    box-shadow: inset 0 0 0 2px #3b82f6;
}

@media (min-width: 640px) {
    .pick-letter.ant-btn {
        padding: 1.5rem;
    }
}

.pick-scroll {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.pick-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.875rem;
}

.pick-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: left;
}

.pick-table td {
    padding: 0;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

.pick-table tbody tr {
    cursor: pointer;
}

.pick-table tbody tr:hover > td {
    background-color: rgba(244, 244, 245, 0.5);
}

.pick-sort-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    font: inherit;
    font-weight: 500;
    color: var(--app-fg);
    white-space: nowrap;
    cursor: pointer;
}

.pick-sort-btn:hover {
    background: var(--app-muted-bg);
}

.pick-cell {
    padding: 0.5rem;
    user-select: none;
}

.pick-check-cell {
    padding: 0.5rem;
}

.pick-check-cell .ant-checkbox-inner {
    width: 1.25rem;
    height: 1.25rem;
}

.pick-check-cell .ant-checkbox-inner::after {
    left: 28%;
}

.pick-article {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
}

.pick-article span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.pick-thumb {
    width: 2rem;
    height: 2rem;
    object-fit: cover;
    border-radius: 0.25rem;
    flex-shrink: 0;
}

.pick-done-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: #166534;
    box-shadow: inset 0 2px 4px rgba(209, 213, 219, 1);
    outline: none;
}

.pick-done-input:focus {
    box-shadow: inset 0 0 0 2px var(--app-primary);
}

.pick-marker {
    width: 0.25rem;
    height: 2.5rem;
}

.pick-handled .pick-marker {
    background: #f97316;
}

.txt-amber { color: #92400e; }
.txt-amber-strong { color: #b45309; }
.txt-green { color: #166534; }
.txt-blue { color: #1e40af; }
.txt-red { color: #dc2626; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.pick-table tr.pick-done > td { background-color: rgba(74, 222, 128, 0.3); }
.pick-table tr.pick-partial > td { background-color: rgba(254, 240, 138, 0.5); }
.pick-table tr.pick-repeated > td { background-color: rgba(221, 214, 254, 0.5); }
.pick-table tr.pick-stale { opacity: 0.5; }
.pick-table tr.pick-selected > td { background-color: #f4f4f5; }
.pick-table tr.pick-done.pick-selected > td { background-color: rgba(74, 222, 128, 0.45); }
.pick-table tr.pick-partial.pick-selected > td { background-color: rgba(254, 240, 138, 0.75); }
.pick-table tr.pick-repeated.pick-selected > td { background-color: rgba(221, 214, 254, 0.75); }

.pick-table tr.pick-handled {
    outline: 2px solid #f97316;
    outline-offset: -2px;
}

.pick-table tr.pick-selected {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.line-through {
    text-decoration: line-through;
}

/* Mobile list */
.pick-mobile-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #9ca3af;
}

.pick-mobile-row .pick-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    height: auto;
}

.pick-mobile-row.pick-handled {
    outline: 2px solid #f97316;
    outline-offset: -2px;
    z-index: 1;
}

.pick-mobile-row.pick-selected {
    box-shadow: inset 0 0 0 4px #3b82f6;
}

.pick-mobile-row.pick-partial { background: #fef08a; }
.pick-mobile-row.pick-done { background: #86efac; }
.pick-mobile-row.pick-repeated { background: #ddd6fe; }
.pick-mobile-row.pick-stale { opacity: 0.5; }

.pick-mobile-row .ant-checkbox-inner {
    width: 1.5rem;
    height: 1.5rem;
}

.pick-mobile-row .ant-checkbox-inner::after {
    left: 30%;
    width: 0.4rem;
    height: 0.8rem;
}

.pick-mobile-content {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.pick-mobile-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.pick-mobile-img {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: 0.25rem;
    flex-shrink: 0;
    cursor: pointer;
    background: #fff;
}

.pick-mobile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.pick-mobile-stats .anticon {
    color: rgba(0, 0, 0, 0.6);
    font-size: 0.75rem;
}

.pick-qty-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pick-qty-row .slash {
    font-weight: 700;
    color: #9ca3af;
}

.pick-qty-box {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    height: 2.25rem;
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pick-qty-box.partial {
    border-color: #f59e0b;
    background: #fde68a;
}

.pick-qty-box.plain {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.pick-qty-box .anticon {
    padding: 0 0.5rem;
    font-size: 1rem;
}

.pick-qty-box input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    outline: none;
}

.pick-list-end {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 16rem;
    background: #e5e7eb;
    color: #9ca3af;
}

/* Footer */
.pick-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--app-border);
    background: #f3f4f6;
    font-size: 0.875rem;
    font-weight: 500;
    flex-shrink: 0;
}

.pick-footer .spacer {
    flex: 1;
}

.pick-footer .progress-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 12.5rem;
}

.pick-footer .progress-box .ant-progress {
    margin: 0;
}

.pick-footer .divider {
    height: 1rem;
    border-right: 1px solid rgba(0, 0, 0, 0.2);
}

.pick-footer .nowrap {
    white-space: nowrap;
}

.conn-state {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    color: #fff;
    white-space: nowrap;
}

.conn-state.open { background: #15803d; }
.conn-state.connecting { background: #ca8a04; }
.conn-state.error { background: #dc2626; }

@media (max-width: 639px) {
    .pick-footer .spacer {
        display: none;
    }
}

/* Desktop table vs mobile list (useRsponsiveLayout: compact below 1024px) */
.pick-desktop { display: table; }
.pick-mobile { display: none; }
.pick-side { display: flex; }

@media (max-width: 1024px) {
    .pick-desktop { display: none; }
    .pick-mobile { display: block; }
    .pick-side { display: none !important; }
}

/* Details side panel (PickListDetailsPanel.tsx) */
.pick-side {
    width: 28rem;
    min-width: 24rem;
    border-left: 4px solid var(--app-border);
    overflow: auto;
}

.details-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f9fafb;
    min-width: 0;
    min-height: 100%;
    box-sizing: border-box;
}

.details-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #6b7280;
}

.details-empty .anticon {
    font-size: 4rem;
    color: #9ca3af;
}

.details-image .ant-image {
    display: block;
    width: 100%;
}

.details-image .ant-image-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 50vh;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    cursor: zoom-in;
}

.details-title {
    display: inline-block;
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 500;
    color: var(--app-fg);
}

.details-title:hover {
    color: var(--app-fg);
    text-decoration: underline;
}

.details-handlers.ant-alert {
    background: #c2410c;
    border-color: #c2410c;
}

.details-handlers.ant-alert .ant-alert-message,
.details-handlers.ant-alert .ant-alert-icon {
    color: #fff;
}

.details-panel .ant-tabs-nav {
    margin-bottom: 0;
}

.details-tab-body {
    border: 1px solid var(--app-border);
    background: #fff;
    overflow: auto;
}

.details-no-orders {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    font-weight: 500;
}

.details-no-orders .anticon {
    font-size: 2rem;
    color: #dc2626;
}

.bg-blue-50 { background: #eff6ff; }
.bg-green-50 { background: #f0fdf4; }

.link-cell {
    font-weight: 500;
    cursor: pointer;
    white-space: normal;
}

.link-cell:hover {
    text-decoration: underline;
}

.contractor-rows-img {
    width: 4rem;
    height: 4rem;
    min-width: 4rem;
    object-fit: contain;
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    background: #fff;
    cursor: zoom-in;
}

.mobile-details-drawer .ant-drawer-body {
    padding: 0;
}

.mobile-details-close {
    padding: 0.5rem 0.5rem 0;
    background: #f9fafb;
}

.pick-docs-modal .ant-modal-body {
    height: calc(90vh - 110px);
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* Header "..." menu: one line per item, never wider than the screen */
.pick-menu {
    min-width: 16rem;
    max-width: calc(100vw - 1rem);
}

.pick-menu .ant-dropdown-menu-item {
    white-space: nowrap;
}

/* Phones: the documents dialog takes the whole screen, footer buttons share the width */
@media (max-width: 767px) {
    .pick-docs-modal .ant-modal {
        top: 0;
        width: 100vw !important;
        max-width: 100vw;
        margin: 0;
        padding: 0;
    }

    /* WrapClassName lands on the centered wrapper itself */
    .pick-docs-modal.ant-modal-centered::before {
        display: none;
    }

    .pick-docs-modal .ant-modal {
        vertical-align: top;
    }

    .pick-docs-modal .ant-modal-content {
        display: flex;
        flex-direction: column;
        height: 100dvh;
        border-radius: 0;
    }

    .pick-docs-modal .ant-modal-header {
        padding: 0.75rem 1rem;
    }

    .pick-docs-modal .ant-modal-body {
        flex: 1;
        height: auto;
        min-height: 0;
        padding: 0;
    }

    .pick-docs-modal .ant-modal-footer {
        display: flex;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .pick-docs-modal .ant-modal-footer .ant-btn {
        flex: 1;
        margin: 0;
        height: 2.75rem;
    }
}


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

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

/* ---------- Data collector dashboard (DataCollectorDashboard.tsx) ---------- */
.dc-search {
    margin-bottom: 1.5rem;
}

.dc-search .ant-input-affix-wrapper {
    height: 2.5rem;
}

.dc-only-open {
    margin-top: 0.5rem;
}

/* Infinite scroll trigger below the list (infinite-scroll.js). */
.dc-sentinel {
    height: 1px;
}

.dc-table-wrap {
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    overflow: auto;
    background: #fff;
}

.dc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.dc-table th {
    height: 3rem;
    padding: 0 1rem;
    font-weight: 500;
    color: var(--app-muted-fg);
    background: rgba(244, 244, 245, 0.5);
    border-bottom: 1px solid var(--app-border);
    white-space: nowrap;
}

.dc-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--app-border);
    vertical-align: middle;
}

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

.dc-table tbody tr {
    cursor: pointer;
    transition: background-color .15s;
}

.dc-table tbody tr:hover {
    background: rgba(244, 244, 245, 0.5);
}

.dc-table tbody tr.done {
    background: #f4f4f5;
}

.dc-table tbody tr.done:hover {
    background: #e4e4e7;
}

.dc-table tbody tr.dc-group-row {
    cursor: default;
}

.dc-table tbody tr.dc-group-row:hover {
    background: transparent;
}

.dc-table .dc-group-row td,
.dc-group-head {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
}

.dc-group-head {
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
}

.dc-group-head:first-child {
    margin-top: 0;
}

.dc-group-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 1.5rem;
}

/* Mobile day header: the small button is too fiddly to tap */
.dc-group-head .ant-btn.dc-day-delete {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
}

.dc-group-head .ant-btn.dc-day-delete > *,
.dc-group-head .ant-btn.dc-day-delete svg {
    font-size: 1.5rem;
}

.dc-inline {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.dc-inline .anticon {
    color: var(--app-muted-fg);
}

.dc-number {
    font-weight: 600;
    color: var(--app-primary);
}

.dc-time {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--app-muted-fg);
    cursor: help;
}

.dc-status {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.dc-status.open { background: #15803d; color: #fff; }
.dc-status.done { background: #e2e8f0; color: #0f172a; }

.dc-cards {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
}

.dc-card {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem 0.625rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.dc-card:active {
    background: rgba(244, 244, 245, 0.6);
}

/* Completed documents recede so the open ones stand out. */
.dc-card.done {
    background: #f4f4f5;
}

.dc-card.done:active {
    background: #e4e4e7;
}

.dc-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.825rem;
}

/* Status badge + actions menu share the head row (no separate footer strip - keeps the card low). */
.dc-card-head-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dc-card-head-right .dc-menu-btn.ant-btn {
    width: 2.25rem;
    height: 2.25rem;
}

.dc-card-metrics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.875rem;
    font-size: 0.75rem;
    color: var(--app-muted-fg);
}

.dc-card-metrics > .dc-inline {
    min-width: 0;
}

.dc-card-metrics strong {
    color: var(--app-fg);
}

.dc-card-contractor {
    font-size: 1.0625rem;
}

/* Yellow so the notes (often the only identification of a document without a contractor) stand out. */
.dc-notes {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    background: #fef08a;
    color: #713f12;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.dc-card-notes {
    display: block;
    font-size: 0.8125rem;
}

@media (max-width: 767px) {
    .dc-table-wrap { display: none; }
    .dc-cards { display: flex; }
    .dc-new-btn, .dc-new-btn .ant-btn { width: 100%; }
    .dc-new-btn .ant-btn { height: 2.75rem; font-size: 1rem; }
    .dc-search .ant-input-affix-wrapper { height: 2.75rem; }
}

/* ---------- Data collector document (DataCollectorViewPage.tsx) ---------- */
/* Flex item of .app-main (flex column, scrolls): grows to fill the screen, never shrinks below its
   content. min-height: 100% replaced the item's automatic min size, so long lists overflowed past
   the background. */
.dcv-page {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    color: #0f172a;
    user-select: none;
}

.dcv-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dcv-header-inner {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dcv-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.dcv-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dcv-title-row h1 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
}

.dcv-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.dcv-badge.open { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.dcv-badge.done { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }

.dcv-sub {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.125rem;
    font-size: 0.9375rem;
    color: #64748b;
}

.dcv-sub .contractor {
    font-weight: 500;
    color: #334155;
}

.dcv-sub .anticon {
    color: #94a3b8;
}

.dcv-header-text {
    min-width: 0;
}

/* Desktop: contractor, document number and worker in one row. */
@media (min-width: 768px) {
    .dcv-header-text {
        display: flex;
        align-items: baseline;
        gap: 1rem;
    }

    .dcv-header-text .dcv-sub {
        margin-top: 0;
    }
}

@media (max-width: 639px) {
    .dcv-sub .sm-only { display: none; }
    .dcv-complete .label { display: none; }
}

.dcv-complete.ant-btn,
.dcv-complete.ant-btn:focus {
    background: #059669;
    border-color: #059669;
    color: #fff;
    font-weight: 700;
}

.dcv-complete.ant-btn:hover {
    background: #047857;
    border-color: #047857;
    color: #fff;
}

.dcv-complete.ant-btn[disabled] {
    opacity: 0.5;
}

.dcv-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.dc-menu-btn.ant-btn {
    width: 2.75rem;
    height: 2.75rem;
}

.dcv-main {
    flex: 1;
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    padding: 0.75rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .dcv-main { padding: 1.5rem; }
}

.dcv-mode {
    display: flex;
    width: 100%;
    padding: 0.25rem;
    box-sizing: border-box;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-weight: 500;
}

.dcv-mode button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    font: inherit;
    font-size: 0.875rem;
    color: #475569;
    cursor: pointer;
}

.dcv-mode button:hover {
    color: #0f172a;
}

.dcv-mode button.active {
    background: #fff;
    color: #2563eb;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dcv-add.ant-btn {
    width: 100%;
    height: 3rem;
    margin-top: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Full-screen article search (Shared ArticlePicker - collector and labels); below the AntD modal (z-index 1000) so the
   quantity dialog opens on top. */
.dcv-picker {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    color: #0f172a;
}

.dcv-picker-header {
    position: relative;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dcv-picker-header-inner {
    max-width: 56rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dcv-picker-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.dcv-picker-field-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.15rem;
    pointer-events: none;
}

/* font-size >= 16px, otherwise iOS zooms in on focus. */
.dcv-picker-input {
    width: 100%;
    height: 3rem;
    box-sizing: border-box;
    padding: 0 2.5rem;
    font: inherit;
    font-size: 1rem;
    color: #0f172a;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.dcv-picker-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.dcv-picker-input::-webkit-search-cancel-button {
    display: none;
}

.dcv-picker-field-spin,
.dcv-picker-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

.dcv-picker-clear {
    display: flex;
    padding: 0.25rem;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
}

.dcv-picker-results {
    flex: 1;
    width: 100%;
    max-width: 56rem;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.dcv-picker-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #64748b;
}

.dcv-picker-finish {
    display: flex;
    justify-content: center;
    padding: 0 1rem 2rem;
}

.dcv-picker-finish .ant-btn {
    min-width: 14rem;
    height: 3rem;
}

.dcv-picker-added {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: calc(100% + 0.5rem);
    transform: translateX(-50%);
    max-width: calc(100vw - 2rem);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    pointer-events: none;
}

.dcv-picker-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.dcv-picker-item:hover { background: #eff6ff; }
.dcv-picker-item:active { background: #dbeafe; }

.dcv-picker-item p {
    margin: 0 0 0.25rem;
}

.dcv-picker-name {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.dcv-picker-price {
    font-size: 1.25rem;
}

.dcv-picker-stock {
    font-size: 1rem;
    color: #64748b;
}

.dcv-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dcv-thumb {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    color: #cbd5e1;
}

.dcv-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dcv-thumb .ant-image {
    display: block;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}

.dcv-thumb.lg { width: 6rem; height: 6rem; }
.dcv-thumb.md { width: 3.5rem; height: 3.5rem; border-radius: 0.5rem; font-size: 1.5rem; }

.dcv-list-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
    padding: 0 0.25rem;
    margin-bottom: 0.75rem;
}

.dcv-list-head h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
}

.dcv-list-head span {
    margin-left: auto;
    white-space: nowrap;
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
}

.dcv-list-head strong {
    color: #0f172a;
}

.dcv-rows {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.dcv-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.dcv-row-info {
    flex: 1;
    min-width: 0;
}

.dcv-new-delivery {
    display: inline-block;
    margin-bottom: 0.25rem;
    padding: 0.0625rem 0.5rem;
    border-radius: 0.375rem;
    background: #15803d;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Up to two lines - with the bigger font one line cut most names off on a phone. */
.dcv-row-info h3 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.dcv-row-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.125rem;
    font-size: 0.875rem;
    color: #64748b;
}

.dcv-code {
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: #f1f5f9;
    color: #334155;
}

/* Row whose article no longer exists in Wapro - blocks completing the document. */
.dcv-missing {
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
    white-space: nowrap;
}

.dcv-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.dcv-qty {
    padding: 0.375rem 0.625rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f1f5f9;
    font-size: 1.0625rem;
    font-weight: 700;
    white-space: nowrap;
}

.dcv-qty.over {
    color: #fff;
    background: #b91c1c;
    border-color: #991b1b;
}

.dcv-remove.ant-btn {
    color: #94a3b8;
}

.dcv-remove.ant-btn:hover,
.dcv-remove.ant-btn:focus {
    color: #dc2626;
    background: #fef2f2;
}

.dcv-empty {
    padding: 2rem;
    text-align: center;
    color: #94a3b8;
    background: #fff;
    border: 2px dashed #e2e8f0;
    border-radius: 0.75rem;
}

.dcv-empty .anticon {
    font-size: 3rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.dcv-empty p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
}

.dcv-convert-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 5rem;
    margin-top: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    cursor: pointer;
    font: inherit;
    color: #0f172a;
}

.dcv-convert-option .anticon {
    font-size: 1.5rem;
    color: #2563eb;
}

.dcv-convert-option:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.dcv-convert-option:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.dcv-convert-option .title {
    font-weight: 700;
    font-size: 0.875rem;
}

.dcv-convert-option .hint {
    font-size: 0.625rem;
    color: #64748b;
}

/* ---------- Quantity picker (QuantityPicker.razor, full screen) ---------- */
/* Above the article search (.dcv-picker, 900), below AntD modals (1000). */
.sq-screen {
    position: fixed;
    inset: 0;
    z-index: 910;
    display: flex;
    flex-direction: column;
    /* No header bar any more - keep the photo clear of the notch / status bar in the installed PWA. */
    padding-top: env(safe-area-inset-top);
    background: #fff;
    color: #0f172a;
}

.sq-footer-inner {
    max-width: 28rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sq-name {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The photo takes whatever height the controls leave; with the on-screen keyboard up it shrinks
   to its minimum and the body scrolls. */
.sq-body {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sq-image {
    flex: 1 1 0;
    min-height: 8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    color: #cbd5e1;
}

.sq-image .anticon {
    font-size: 4rem;
}

.sq-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sq-body > :not(.sq-image) {
    flex-shrink: 0;
}

.sq-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.875rem;
    font-size: 1rem;
    color: #475569;
}

.sq-price {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
}

.sq-meta .min {
    color: #2563eb;
    font-weight: 600;
}

.sq-meta .low {
    color: #dc2626;
}

.sq-warning {
    padding: 0.5rem 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 1.0625rem;
    line-height: 1.35;
}

.sq-input-wrap {
    position: relative;
}

/* font-size >= 16px, otherwise iOS zooms in on focus. */
.sq-input {
    width: 100%;
    height: 3.5rem;
    box-sizing: border-box;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    text-align: center;
    font: inherit;
    font-size: 1.75rem;
    font-weight: 900;
    outline: none;
    padding: 0 2.5rem; /* room for the unit label so the number stays centered */
}

.sq-input:focus {
    border-color: #2563eb;
    background: #fff;
}

.sq-input.over {
    color: #dc2626;
    border-color: #fca5a5;
}

.sq-unit {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    font-weight: 700;
    color: #94a3b8;
    pointer-events: none;
}

.sq-over {
    margin-top: -0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #dc2626;
    text-align: center;
}

.sq-qty-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.75rem 0;
}

.sq-step.ant-btn {
    width: 100%;
    height: 3.25rem;
    min-width: 0;
    padding: 0;
    border: 2px solid #e2e8f0;
    font-size: 1.125rem;
    font-weight: 700;
}

/* -P / +P : step by the minimum quantity */
.sq-step.sq-step-big.ant-btn {
    font-weight: 800;
    color: #2563eb;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.sq-step.ant-btn:active {
    transform: scale(0.95);
}

.sq-quick {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(3rem, 1fr));
    gap: 0.375rem;
}

.sq-quick .ant-btn {
    min-width: 0;
    height: 2.5rem;
    padding: 0;
    font-size: 1.375rem;
    font-weight: 700;
}

/* Presets in violet, so they don't blend with the white/blue steppers above. */
.sq-quick .sq-preset.ant-btn {
    color: #6d28d9;
    background: #f5f3ff;
    border-color: #c4b5fd;
}

.sq-quick .sq-preset.ant-btn.active {
    color: #fff;
    background: #7c3aed;
    border-color: #7c3aed;
}

.sq-footer {
    flex-shrink: 0;
    padding: 1rem 0.75rem calc(1rem + env(safe-area-inset-bottom));
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.sq-footer .ant-btn {
    flex: 1;
    height: 3.25rem;
    font-weight: 600;
}

.sq-footer .sq-cancel.ant-btn,
.sq-footer .sq-cancel.ant-btn:hover,
.sq-footer .sq-cancel.ant-btn:focus {
    border: 2px solid #dc2626;
    color: #dc2626;
}

.sq-footer .ant-btn-primary {
    flex: 2;
    font-weight: 700;
    font-size: 1.0625rem;
}

/* ---------- Create data collector dialog (CreateDataCollectorDialog.tsx) ---------- */
.cdc-desc {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.cdc-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
}

.cdc-field {
    margin-bottom: 1rem;
}

.cdc-selected {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.cdc-selected .anticon {
    color: #2563eb;
}

.cdc-selected .change {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
}

.cdc-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.cdc-results {
    margin-top: 0.25rem;
    max-height: 12rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.cdc-result {
    padding: 0.625rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.cdc-result:last-child {
    border-bottom: 0;
}

.cdc-result:hover { background: #eff6ff; }

.cdc-result-nip {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
}

.cdc-results-info {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    color: #64748b;
}

.cdc-result-nip > span + span { margin-left: 0.75rem; }

.cdc-result-discount { color: #16a34a; font-weight: 500; }

.cdc-label-hint {
    margin-left: 0.25rem;
    font-weight: 400;
    color: #64748b;
}

.cdc-notes-count {
    margin-top: 0.25rem;
    text-align: right;
    font-size: 0.75rem;
    color: #64748b;
}

.cdc-notes-count.over {
    color: #dc2626;
}

.cdc-current {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.dc-contractor-cell {
    display: inline-flex;
    max-width: 220px;
    min-width: 0;
    font-size: 1rem;
}

/* ---------- Camera scanner ---------- */
.scanner {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #0f172a;
}

.scanner video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-top-left,
.scanner-top-right {
    position: absolute;
    top: 0.5rem;
    z-index: 1;
}

.scanner-top-left { left: 0.5rem; }
.scanner-top-right { right: 0.5rem; }

.scanner-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
}

.scanner-bottom .ant-btn {
    width: 100%;
    max-width: 20rem;
}

.scanner-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    box-sizing: border-box;
    padding: 1.5rem;
    color: #fff;
    text-align: center;
}

/* ---------- WZ split (SplitDocumentsPage.tsx) ---------- */
.split-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 1.5rem;
}

.split-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.split-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.375rem 1rem;
    background: var(--app-muted-bg);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: var(--app-muted-fg);
}

.split-info strong,
.split-info .val {
    color: var(--app-fg);
}

.split-info .val {
    font-weight: 500;
}

.split-info .sep {
    width: 1px;
    height: 1rem;
    background: var(--app-border);
}

@media (max-width: 767px) {
    .split-info { display: none; }
}

.split-head-actions {
    display: flex;
    flex: 1;
    justify-content: flex-end;
}

.split-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.split-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 12rem;
    color: var(--app-muted-fg);
    font-size: 0.875rem;
}

.split-placeholder.dashed {
    border: 2px dashed var(--app-border);
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.split-placeholder.small {
    flex-direction: row;
    min-height: 0;
    padding: 2rem 1rem;
    font-size: 0.75rem;
    border-width: 1px;
}

.split-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
}

.split-table {
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.split-table th {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.75rem;
    text-align: left;
    font-weight: 500;
    color: var(--app-muted-fg);
    background: var(--app-muted-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    vertical-align: top;
}

.split-table td {
    padding: 0.75rem;
    border-top: 1px solid var(--app-border);
    vertical-align: middle;
}

.split-table tbody tr {
    transition: background-color .15s;
}

.split-table tbody tr:hover {
    background: rgba(244, 244, 245, 0.3);
}

.split-table tbody tr.balanced { background: #dcfce7; }
.split-table tbody tr.over { background: #fee2e2; }

.split-table th.split-col-head {
    min-width: 13rem;
    padding: 0.5rem;
    border-left: 1px solid var(--app-border);
}

.split-col-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 1.5rem;
    padding: 0 0.25rem;
    font-size: 0.75rem;
}

.split-col-name {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem;
}

.split-name-input,
.split-qty-input {
    flex: 1;
    min-width: 0;
    height: 2.25rem;
    box-sizing: border-box;
    padding: 0 0.5rem;
    border: 1px solid #d9d9d9;
    border-radius: 0.375rem;
    background: #fff;
    font: inherit;
    font-weight: 600;
    text-align: center;
    color: var(--app-fg);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.split-name-input:focus,
.split-qty-input:focus {
    border-color: var(--ant-primary-5);
    box-shadow: 0 0 0 2px var(--ant-primary-color-outline);
}

.split-name-input::placeholder,
.split-qty-input::placeholder {
    color: #9ca3af;
}

.split-qty-cell {
    border-left: 1px solid var(--app-border);
    padding: 0.5rem !important;
}

.split-qty-input {
    width: 100%;
    font-size: 1.125rem;
    font-weight: 700;
}

.split-table .split-add-col {
    width: 4rem;
    text-align: center;
    border-left: 1px solid var(--app-border);
    background: rgba(244, 244, 245, 0.5);
}

.split-balance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.split-balance .anticon {
    font-size: 1.25rem;
}

.split-balance .ok { color: #15803d; }
.split-balance .over { color: #dc2626; }
.split-balance .pending { color: #9ca3af; }

.split-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--app-border);
    flex-shrink: 0;
}

.split-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-muted-fg);
}

.split-contractor {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.split-wz-list {
    max-height: 22rem;
    overflow: auto;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
}

.split-feedback {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem 0;
}

.split-feedback h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.split-feedback p {
    margin: 0.5rem 0 1.5rem;
    font-size: 0.875rem;
    color: var(--app-muted-fg);
}

.split-feedback-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    border-radius: 9999px;
    font-size: 2.5rem;
}

.split-feedback-icon.ok { background: #dcfce7; color: #16a34a; }
.split-feedback-icon.err { background: #fee2e2; color: #dc2626; }

.split-ok-btn.ant-btn,
.split-ok-btn.ant-btn:focus {
    background: #16a34a;
    border-color: #16a34a;
}

.split-ok-btn.ant-btn:hover {
    background: #15803d;
    border-color: #15803d;
}

/* ---------- Mobile full-width buttons ---------- */
/* Main page actions (create, choose, submit) span the whole width on phones.
   Row actions, icon buttons, header buttons and small helper buttons keep their natural size. */
@media (max-width: 767px) {
    .pl-new-btn,
    .pl-new-btn .ant-btn,
    .split-head-actions,
    .split-head-actions .ant-btn,
    .split-footer .ant-btn,
    .page-footer-actions .ant-btn {
        width: 100%;
    }

    .pl-new-btn .ant-btn,
    .split-head-actions .ant-btn,
    .page-footer-actions .ant-btn {
        height: 2.75rem;
        font-size: 1rem;
    }

    /* Short heading and both select buttons on one line, so the tables keep the space */
    .docs-panel-head {
        flex-wrap: nowrap;
        padding: 0.5rem 0;
    }

    .docs-panel-head h2 {
        flex: 1;
        min-width: 0;
        padding: 0;
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .docs-panel-head .ant-btn {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .pick-docs-modal .docs-panel-head {
        padding: 0.5rem;
    }

    .docs-head-long {
        display: none;
    }

    /* Document rows as two-line cards instead of a wide table:
       [x] number    status  date
           contractor        total
           notes                    */
    .docs-table thead {
        display: none;
    }

    .docs-table tr {
        display: grid;
        grid-template-columns: 2.5rem minmax(0, 1fr) auto auto;
        grid-template-areas:
            "check number status date"
            "check contractor contractor total"
            "check notes notes notes";
        align-items: center;
        column-gap: 0.5rem;
        padding: 0.5rem 0.5rem 0.5rem 0;
        border-bottom: 1px solid var(--app-border);
    }

    .docs-table td,
    .docs-table tr.row-past > td,
    .docs-table tr.row-selected > td,
    .docs-table tbody tr:hover > td {
        width: auto !important;
        max-width: none;
        padding: 0 !important;
        border: none;
        background: transparent;
    }

    .docs-table tbody tr:hover {
        background-color: rgba(244, 244, 245, 0.5);
    }

    .docs-table tr.row-past,
    .docs-table tr.row-past:hover {
        background-color: #d1d5db;
    }

    .docs-table tr.row-selected,
    .docs-table tr.row-selected:hover {
        background-color: #bfdbfe;
    }

    .docs-table td:empty {
        display: none;
    }

    .docs-cell-check { grid-area: check; justify-self: center; }
    .docs-cell-number { grid-area: number; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .docs-cell-status { grid-area: status; }
    .docs-cell-date { grid-area: date; white-space: nowrap; }
    .docs-cell-contractor { grid-area: contractor; }
    .docs-cell-notes { grid-area: notes; color: var(--app-muted-fg); font-size: 0.8rem; }
    .docs-cell-total { grid-area: total; justify-self: end; }
}

@media (min-width: 768px) {
    .docs-head-short {
        display: none;
    }
}

/* ---------- Data collector document - mobile layout ---------- */
@media (max-width: 639px) {
    .app-header .ant-btn.header-btn {
        padding: 0 0.5rem;
    }

    /* Logo only on phones, the text takes space from the context buttons */
    .app-header-brand-text {
        display: none;
    }

    .dcv-header {
        padding: 0.5rem 0.75rem;
    }

    .dcv-header-inner {
        gap: 0.5rem;
    }

    .dcv-title-row {
        flex-wrap: wrap;
        row-gap: 0.125rem;
    }

    .dcv-title-row h1 {
        font-size: 1.0625rem;
    }

    .dcv-sub .contractor {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dcv-sub {
        min-width: 0;
    }

    /* Icon only (label hidden above), square like the back button */
    .dcv-complete-header.ant-btn {
        flex-shrink: 0;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
    }

    /* AntD wraps ChildContent in its own span with margin-left after the icon - hide the wrapper, not just .label */
    .dcv-complete-header.ant-btn > .anticon + span {
        display: none;
    }

    .dcv-main {
        gap: 1rem;
    }

    .dcv-mode button {
        padding: 0.5rem;
    }

    .dcv-row {
        gap: 0.5rem;
    }

    .dcv-thumb.md {
        width: 3rem;
        height: 3rem;
    }

    .dcv-row-info h3 {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.3;
    }

    .dcv-row-actions {
        gap: 0.125rem;
    }

    .dcv-qty {
        padding: 0.25rem 0.5rem;
    }

    .dcv-remove.ant-btn {
        height: 2rem;
        width: 2rem;
    }
}

/* ---------- Touch devices: finger sized targets (min ~44px) ---------- */
@media (pointer: coarse) {
    /* Generic AntDesign controls */
    .ant-btn {
        min-height: 2.75rem;
        padding-left: 1rem;
        padding-right: 1rem;
        font-size: 1rem;
    }

    .ant-btn.ant-btn-icon-only {
        min-width: 2.75rem;
        padding: 0;
    }

    .ant-btn.ant-btn-sm {
        min-height: 2.25rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        font-size: 0.875rem;
    }

    .ant-btn.ant-btn-sm.ant-btn-icon-only {
        min-width: 2.25rem;
    }

    .ant-btn-lg {
        min-height: 3rem;
    }

    /* 16px font stops iOS from zooming into focused inputs */
    .ant-input,
    .ant-input-affix-wrapper {
        min-height: 2.75rem;
        font-size: 1rem;
    }

    .ant-input-affix-wrapper .ant-input {
        min-height: 0;
    }

    .ant-input-clear-icon {
        font-size: 1.25rem;
        padding: 0.25rem;
    }

    .ant-checkbox-inner {
        width: 1.5rem;
        height: 1.5rem;
    }

    .ant-checkbox-inner::after {
        left: 30%;
        width: 0.4rem;
        height: 0.8rem;
    }

    .ant-dropdown-menu-item {
        min-height: 3rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        font-size: 1rem;
    }

    .ant-modal-close-x {
        width: 3.5rem;
        height: 3.5rem;
        line-height: 3.5rem;
        font-size: 1.25rem;
    }

    .ant-modal-footer .ant-btn {
        min-height: 3rem;
    }

    .ant-tabs-tab {
        padding-top: 0.875rem;
        padding-bottom: 0.875rem;
    }

    .ant-popover-buttons .ant-btn {
        min-height: 2.5rem;
    }

    /* Header */
    .app-header {
        min-height: 3.25rem;
    }

    .app-header .ant-btn.header-btn {
        min-height: 2.75rem;
    }

    /* Context selection */
    .context-options .ant-btn {
        min-height: 3.25rem;
    }

    /* Pick lists */
    .pl-item {
        padding: 1rem;
    }

    .pick-qty-box {
        height: 2.75rem;
    }

    .pick-qty-box input {
        font-size: 1rem;
    }

    .pick-mobile-row .ant-checkbox-inner {
        width: 1.75rem;
        height: 1.75rem;
    }

    .pick-mobile-row .ant-checkbox-inner::after {
        width: 0.5rem;
        height: 0.95rem;
    }

    .pick-done-input {
        min-height: 2.75rem;
        font-size: 1rem;
    }

    .data-table td {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    /* Data collector - dashboard */
    .dc-search .ant-input-affix-wrapper {
        height: 3rem;
    }

    /* Data collector - document */
    .dcv-header .ant-btn.ant-btn-icon-only {
        width: 2.75rem;
        height: 2.75rem;
    }

    .dcv-mode button {
        min-height: 3rem;
        font-size: 1rem;
    }

    .dcv-add.ant-btn {
        height: 3.25rem;
    }

    .dcv-picker-header .ant-btn.ant-btn-icon-only {
        width: 3rem;
        height: 3rem;
    }

    .dcv-picker-item {
        padding: 0.875rem 0.75rem;
    }

    .dcv-row {
        padding: 0.625rem;
        min-height: 4.5rem;
    }

    .dcv-qty {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }

    .dcv-remove.ant-btn,
    .dcv-remove.ant-btn.ant-btn-icon-only {
        width: 2.75rem;
        height: 2.75rem;
        min-width: 2.75rem;
        font-size: 1.15rem;
    }

    /* Contractor search results (new document, WZ picker) */
    .cdc-results {
        max-height: 16rem;
    }

    .cdc-result {
        min-height: 3rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        padding: 0.75rem;
        font-size: 1rem;
    }

    .cdc-selected {
        min-height: 3rem;
    }

    /* Camera scanner */
    .scanner-top-left .ant-btn,
    .scanner-top-right .ant-btn {
        min-height: 3rem;
        min-width: 3rem;
    }

    .scanner-bottom .ant-btn {
        min-height: 3.25rem;
    }

    /* WZ split */
    .split-name-input,
    .split-qty-input {
        height: 2.75rem;
        font-size: 1rem;
    }
}

/* ---------- All buttons: sharp corners ---------- */
button,
.ant-btn,
.ant-btn-group > .ant-btn,
.ant-btn::after,
.pick-sort-btn,
.dcv-mode button,
.dcv-convert-option,
.sq-step.ant-btn,
.sq-footer .ant-btn {
    border-radius: 0 !important;
}

/* ---------- Login ---------- */
.login-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
    background: var(--app-muted-bg);
}

.login-card {
    width: 100%;
    max-width: 22rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid var(--app-border);
}

.login-logo {
    width: 6rem;
    height: 6rem;
    align-self: center;
    margin-bottom: 0.5rem;
}

.login-input {
    height: 2.75rem;
    padding: 0 0.75rem;
    font-size: 1rem; /* >= 16px so iOS does not zoom on focus */
    border: 1px solid var(--app-border);
    border-radius: 0;
    outline: none;
}

.login-input:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px var(--app-primary-soft);
}

.login-button {
    height: 2.75rem;
    font-size: 1rem;
    color: #fff;
    background: var(--app-primary);
    border: 0;
    cursor: pointer;
}

.login-error {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
}

.home-logout {
    display: flex;
    justify-content: center;
    margin: auto 0 0;
    padding-top: 1.5rem;
}

.home-logout-btn {
    height: 2.25rem;
    padding: 0 1.5rem;
    color: var(--app-fg);
    background: #e5e7eb;
    border: 0;
    cursor: pointer;
}

.home-logout-btn:hover {
    background: #d1d5db;
}

/* ---------- Labels (LabelJobsDashboard / LabelJobDetail / LabelView) ---------- */
.lbl-jobs-wrap {
    overflow-x: auto;
    border: 1px solid var(--app-border);
}

.lbl-jobs .num {
    width: 1px;
    white-space: nowrap;
}

.lbl-jobs-progress {
    width: 12rem;
    white-space: nowrap;
}

.lbl-jobs-progress .ant-progress {
    width: 7rem;
    margin-right: 0.5rem;
}

.lbl-jobs-note {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
}

.lbl-job-documents {
    margin-left: 0.75rem;
    color: var(--app-muted-fg);
    font-size: 0.875rem;
}

.lbl-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    flex-shrink: 0;
}

.lbl-size {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lbl-size-select {
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid #d9d9d9;
    background: #fff;
    font: inherit;
}

.lbl-content {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.lbl-table-wrap {
    flex: 1;
    min-width: 0;
    overflow: auto;
    border: 1px solid var(--app-border);
}

/* Number columns shrink to their content. */
.lbl-table .num {
    width: 1px;
    text-align: center;
    white-space: nowrap;
}

.lbl-table .check {
    width: 1px;
    text-align: center;
    white-space: nowrap;
}

/* Read-only but not greyed out like a disabled AntD checkbox: clicks fall through to the row. */
.lbl-readonly-check,
.lbl-readonly-check * {
    pointer-events: none;
}

.lbl-table-name {
    font-size: 1rem;
}

.lbl-table-index {
    color: var(--app-muted-fg);
    font-size: 0.875rem;
}

/* The last column fills the space on the right; the article column keeps a readable width instead of
   shrinking to its longest word. */
.lbl-table .lbl-count-cell {
    width: 100%;
    white-space: nowrap;
}

.lbl-table .lbl-article {
    min-width: 20rem;
}

.lbl-table .lbl-count {
    width: 5rem;
}

.lbl-table .lbl-count input {
    font-weight: 700;
}

/* Articles marked "Wydrukowano"; the selected row stays blue. */
.data-table tr.lbl-row-printed:not(.row-selected) > td,
.data-table tr.lbl-row-printed:not(.row-selected):hover > td {
    background-color: #dcfce7;
}

/* Browser other than Chrome / Edge (BrowserWarning.razor) - full width strip above the page. */
.lbl-browser-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fef3c7;
    border-bottom: 1px solid #fcd34d;
    color: #78350f;
    flex-shrink: 0;
}

/* Stock that was on the shop before the delivery and its "Zmiana ceny" - these labels get reprinted. */
.lbl-badge-orange {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    background: #fed7aa;
    color: #000;
    font-weight: 600;
    white-space: nowrap;
}

.lbl-received {
    color: var(--ant-primary-color);
    font-weight: 700;
}

.lbl-thumb-cell {
    width: 1px;
}

.lbl-preview-box {
    flex-shrink: 0;
}

/* Wide .app-tiles above the jobs list (LabelJobsDashboard), icon on top, caption at the bottom. */
.lbl-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.app-tile.lbl-tile {
    justify-content: space-between;
    width: 15rem;
    height: 7.5rem;
    box-sizing: border-box;
}

/* ArticleLabels: one article found by hand - its info and label count left, preview right. */
.lbl-article-content {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    max-width: 50rem;
    margin: 0 auto;
}

.lbl-article-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.lbl-article-stock {
    margin-top: 0.5rem;
}

@media (max-width: 900px) {
    .lbl-article-content {
        flex-direction: column;
    }
}

/* Admissions history under the preview (ArticleAdmissions.razor) - a long history scrolls instead of stretching the box. */
.lbl-admissions {
    margin-top: 1rem;
    max-height: 16rem;
    overflow: auto;
}

.lbl-batch-size-input {
    width: 4.5rem;
}

/* Print wizard (PrintWizardDialog.razor) */
.lbl-wizard {
    display: flex;
    gap: 1.5rem;
}

.lbl-wizard-main {
    flex: 1;
    min-width: 0;
}

/* As wide as the preview label (--lbl-w is set on it too). */
.lbl-wizard-side {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
    width: max(var(--lbl-w), 18rem);
}

.lbl-wizard-question {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ant-info-color)
}

@media (max-width: 700px) {
    .lbl-wizard {
        flex-direction: column;
    }

    .lbl-wizard-side {
        width: auto;
    }
}

.lbl-wizard-step {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 1rem;
}

.lbl-wizard-rows {
    max-height: 50vh;
    margin-top: 0.75rem;
    overflow: auto;
    border: 1px solid var(--app-border);
}

.lbl-wizard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 0.75rem;
}

.lbl-wizard-row + .lbl-wizard-row {
    border-top: 1px solid var(--app-border);
}

.lbl-wizard-name {
    min-width: 0;
}

.lbl-wizard-hint {
    font-size: 0.875rem;
}

.lbl-wizard-count {
    font-size: 1.125rem;
}

.lbl-wizard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 2rem;
}

/* .ant-btn too, to beat AntD's own border (and hover / focus) colours. */
.ant-btn.lbl-reprint-btn,
.ant-btn.lbl-reprint-btn:hover,
.ant-btn.lbl-reprint-btn:focus {
    border-color: #fa0;
}

.lbl-preview-title {
    margin-bottom: 0.5rem;
    color: var(--app-muted-fg);
    font-size: 0.875rem;
}

.lbl-preview .lbl-label {
    box-shadow: 0 0 0 1px var(--app-border), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lbl-footer {
    align-items: center;
    gap: 0.5rem;
}

.lbl-total {
    margin-right: auto;
}

@media (max-width: 900px) {
    .lbl-content {
        flex-direction: column-reverse;
    }
}

/* The label itself: every size derives from --lbl-w / --lbl-h (set from Options:LabelSizes), tuned on 80 x 40 mm
   to match the old labels: name on top, barcode bottom-left, note / price / coded price in a column next to it.
   The paddings and the sizes of the barcode, note and prices are mirrored in the LabelNameLayout constants (it fits the
   name into what is left) - change both together. */
.lbl-label {
    display: flex;
    flex-direction: column;
    width: var(--lbl-w);
    height: var(--lbl-h);
    padding: calc(var(--lbl-h) * 0.055) calc(var(--lbl-w) * 0.03) calc(var(--lbl-h) * 0.04);
    box-sizing: border-box;
    overflow: hidden;
    background: #fff;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1;
}

/* Small logo in the bottom right corner, in the row of the coded price (wwwroot/images/label-logo.svg is the logo
   recoloured black - greys get eaten by the printer's dithering). Low enough to stay under the big price. An <img>, not
   a CSS background, so it prints with "background graphics" off and print-helper.js can wait for it to load. */
.lbl-label {
    position: relative;
}

.lbl-logo {
    position: absolute;
    right: calc(var(--lbl-w) * 0.03);
    bottom: calc(var(--lbl-h) * 0.04);
    height: calc(var(--lbl-h) * 0.16);
}

/* "Zmiana ceny" (LabelRow.PriceChanged): filled mark in the top right corner, running from the top edge of the label down
   inside the top padding so it doesn't cover the name. */
.lbl-price-changed {
    position: absolute;
    top: 0;
    right: calc(var(--lbl-w) * 0.01);
    width: calc(var(--lbl-h) * 0.04);
    height: calc(var(--lbl-h) * 0.04);
    background: #000;
    /* Chrome leaves backgrounds out of the printout unless "Background graphics" is ticked. */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Font size and line breaks come from LabelNameLayout (server-side, as big as fits on up to two lines), long names get
   their lines squeezed with scaleX. line-height = LabelNameLayout.LineHeight. */
.lbl-name {
    line-height: 1.15;
}

.lbl-name-line {
    white-space: nowrap;
    transform-origin: left;
}

/* Above the price in a box as wide as the text, may wrap to a second line in the column next to the barcode.
   Sizes are mirrored in LabelNameLayout; the font is a bit smaller than without the box so "Sprzedaż na całe
   paletki" stays on one line on 80 x 40 mm. */
.lbl-note {
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: calc(var(--lbl-h) * 0.02);
    padding: calc(var(--lbl-h) * 0.012) calc(var(--lbl-w) * 0.006);
    border: calc(var(--lbl-h) * 0.006) solid #000;
    font-size: calc(var(--lbl-h) * 0.08);
    font-weight: 700;
    line-height: 1.1;
    white-space: normal;
}

.lbl-bottom {
    display: flex;
    align-items: flex-end;
    gap: calc(var(--lbl-w) * 0.03);
    flex: 1;
    min-height: 0;
}

/* A bit wider than the SVG's viewBox (Ean13Barcode) on 80 x 40 mm - the SVG stretches to fill it (wider bars scan
   more reliably), the height can't grow on the label. */
.lbl-barcode {
    flex-shrink: 0;
    width: calc(var(--lbl-w) * 0.41);
    height: calc(var(--lbl-h) * 0.54);
}

.lbl-barcode svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lbl-prices {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.lbl-price {
    font-size: calc(var(--lbl-h) * 0.27);
    font-weight: 700;
}

.lbl-coded {
    margin-top: calc(var(--lbl-h) * 0.04);
    font-size: calc(var(--lbl-h) * 0.105);
}

/* Regular-weight Arial is too thin for a 203 dpi thermal printer: its strokes land on 1-2 dots and come out ragged. */
.lbl-name {
    font-weight: 700;
}

/* Print iframe (print-helper.js): one label per page, no break after the last one (blank page). */
.lbl-print .lbl-label {
    break-after: page;
}

.lbl-print .lbl-label:last-child {
    break-after: auto;
}

/* "Obrót wydruku": the page is the label turned on its side (--lbl-h wide, --lbl-w tall), the label rotated onto it
   around its top-left corner and shifted back into the page. */
.lbl-print .lbl-page {
    position: relative;
    width: var(--lbl-h);
    height: var(--lbl-w);
    overflow: hidden;
    break-after: page;
}

.lbl-print .lbl-page:last-child {
    break-after: auto;
}

.lbl-print .lbl-page .lbl-label {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

.lbl-print .lbl-cw .lbl-label {
    transform: translateX(var(--lbl-h)) rotate(90deg);
}

.lbl-print .lbl-ccw .lbl-label {
    transform: translateY(var(--lbl-w)) rotate(-90deg);
}
