body, html { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5; color: #1f2328; }
h1:focus { outline: none; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #0969da; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

/* Drawer content area — must be the scroll container so position:sticky works
   inside pages. The overflow:hidden on k-drawer-container (needed to clip the
   sliding drawer panel) breaks sticky for any descendant; making k-drawer-content
   scroll instead restores the correct sticky context. */
.k-drawer-content {
    height: calc(100vh - var(--app-header-height));
    overflow-y: auto;
    overflow-x: hidden;
}

/* Telerik AppBar — must be global to reach Telerik's rendered DOM */
.cc-appbar.k-appbar {
    background-color: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
    box-shadow: none;
    padding: 0 1rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 10003;
}

/* Hamburger button — dark icon/text on light AppBar (theme default assumes dark background) */
.cc-appbar .k-button-flat {
    color: #1f2328;
}
.cc-appbar .k-button-flat:hover,
.cc-appbar .k-button-flat:focus-visible {
    color: #1f2328;
    background-color: rgba(31, 35, 40, 0.08);
    box-shadow: none;
}

/* Drawer (overlay mode) — AppBar stays on top (z-index:10003 > drawer z-index:10002).
   The drawer panel is still position:fixed from top:0, so padding-top pushes the nav
   items below the AppBar. The backdrop is offset so it does not dim the AppBar. */
.k-drawer {
    padding-top: 56px;
}
.k-overlay {
    top: 56px;
    height: calc(100vh - 56px);
}

/* Drawer nav links — remove browser default underline; align with AppBar's 1rem left padding */
.k-drawer-link {
    padding-left: 1rem;
}
.k-drawer-link,
.k-drawer-link:hover,
.k-drawer-link:visited,
.k-drawer-link:focus {
    text-decoration: none;
}

/* Telerik input standardisation — consistent height for all text-style inputs */
.k-input {
    height: var(--app-input-height);
}

.k-input-inner {
    font-size: var(--app-input-font-size);
}

/* FormGroup heading — slightly larger, bolder, darker */
.k-form-legend {
    font-size: 1.35rem;
    font-weight: 600;
    color: #1a1e23;
}

/* Drawer group header (non-clickable admin section label) */
.k-drawer-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--app-text-muted);
    user-select: none;
}

/* Suppress hover highlight on header items */
.k-drawer-item:has(.k-drawer-group-header) {
    cursor: default;
    pointer-events: none;
}

/* Indent drawer sub-items (admin children) */
.k-drawer-link--indented {
    padding-left: 2.5rem;
}

.equal-width-buttons .k-button {
    width: 140px;
}

/* Stretch button(s) to fill the form width */
.full-width-buttons {
    width: 100%;
}

.full-width-buttons .k-button {
    width: 100%;
}

/* ── Order Monitor: Monday.com-style tall grid rows ──────────────────────────
   Applied globally because TelerikGrid renders its own DOM outside of Blazor
   component CSS isolation scope. The .om-grid class gates all overrides.      */

.om-grid .k-grid-table tr {
    height: 45px;
}

.om-grid .k-grid-table td {
    padding: 0;
    vertical-align: middle;
}

/* Cell buttons fill the entire cell width/height */
.om-grid .om-cell-btn.k-button {
    width: 100%;
    min-height: 45px;
    border-radius: 0;
    justify-content: flex-start;
    padding: 0 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.om-grid .om-cell-btn.k-button:hover {
    background-color: var(--kendo-color-base-hover, #f5f5f5);
}

/* Order Number cell: bold, brand primary colour */
.om-grid .om-cell-btn--order.k-button {
    color: var(--kendo-color-primary, #5ea5f3);
    font-weight: 600;
}

/* Create Action — Note textarea height override */
.ca-note-wrap {
    height: 9rem;
}

.ca-note-wrap .ca-note-textarea,
.ca-note-wrap .ca-note-textarea .k-input,
.ca-note-wrap .ca-note-textarea .k-input-inner,
.ca-note-wrap .ca-note-textarea textarea {
    height: 100% !important;
    min-height: unset !important;
    resize: none;
}

/* ── PO ERP Review and Reconcile (per-*) - shared by PoErpReviewQueue, PoErpReviewDetail,
   PoErpCreateFailure, PoReconcileGrid, and the ERP flag on the PO list / edit screens ── */
.per-page-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.per-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.per-header-actions,
.per-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.per-count { font-weight: 600; color: var(--app-text-muted, #666); }
.per-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.per-status-msg,
.per-blurb { display: flex; align-items: center; gap: 10px; padding: 14px 16px; flex-wrap: wrap; }
.per-blurb { color: var(--app-text-muted, #555); }
.per-muted { color: var(--app-text-muted, #888); font-size: 0.85em; }
.per-link { font-weight: 600; text-decoration: none; }
.per-link:hover { text-decoration: underline; }
.per-click-grid tbody tr { cursor: pointer; }

.per-chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.85em; font-weight: 600;
            background: var(--app-warning-soft, #fff3e0); color: #9a5b00; white-space: nowrap; }
.per-chip-error   { background: var(--app-error-soft, #fdecea); color: var(--app-error, #b3261e); }
.per-chip-missing { background: var(--app-surface-alt, #eceff1); color: var(--app-text, #37474f); border: 1px dashed var(--app-border-strong, #90a4ae); }
/* PO Order Links (2026-11-01): suggestion match levels. */
.olk-chip-match { background: #e6f4ea; color: #1e6b34; }
.olk-chip-qty   { background: var(--app-warning-soft, #fff3e0); color: #9a5b00; }
.olk-chip-comp  { background: #e8eefc; color: #2747a0; }
.olk-chip-order { background: var(--app-surface-alt, #eceff1); color: var(--app-text, #37474f); }
.old-chip-uom   { background: var(--app-error-soft, #fdecea); color: var(--app-error, #b3261e); }
.per-status-chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.85em;
                   background: var(--app-surface-alt, #f1f3f5); color: var(--app-text, #333); white-space: nowrap; }

/* Orange 2080 "Purchase Order ERP Review" flag (colour comes from SYS_Status.ColorHex). */
.per-flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 12px;
            font-size: 0.8em; font-weight: 700; white-space: nowrap; text-decoration: none;
            color: #fff; background: var(--per-flag-color, #ff9900); }
a.per-flag:hover { filter: brightness(0.92); }

.per-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 20px; padding: 14px 16px; }
.per-facts label,
.per-compare label { display: block; font-size: 0.78em; text-transform: uppercase; letter-spacing: .04em; color: var(--app-text-muted, #888); }
.per-facts span { font-weight: 600; }

.per-item { padding: 14px 16px; border-left: 4px solid var(--app-warning, #ff9900); display: flex; flex-direction: column; gap: 10px; }
.per-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.per-detail { margin: 0; overflow-wrap: anywhere; }
.per-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 20px;
               padding: 10px 12px; border-radius: var(--app-radius-md, 6px); background: var(--app-surface-alt, #f7f7f9); }
.per-confirm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px;
               border-radius: var(--app-radius-md, 6px); background: var(--app-warning-soft, #fff3e0); }

.per-section { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.per-section-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.per-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.per-history li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }

.per-conflict { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--app-border, #e5e7eb); }
.per-conflict:first-of-type { border-top: none; }
.per-conflict-info { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Receiving reconcile grid */
.per-recon-summary { display: flex; flex-direction: column; gap: 4px; }
.per-recon-ok   { color: var(--app-success, #2e7d32); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.per-recon-warn { color: #9a5b00; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.per-table-wrap { overflow-x: auto; }
.per-table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.per-table th, .per-table td { padding: 8px 10px; border-bottom: 1px solid var(--app-border, #e5e7eb); text-align: left; vertical-align: top; }
.per-table th { font-weight: 600; color: var(--app-text-muted, #666); white-space: nowrap; }
.per-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.per-part { font-weight: 600; }
.per-notes { white-space: pre-wrap; min-width: 220px; font-size: 0.9em; }
.per-variance { font-weight: 700; }
.per-variance.pos { color: var(--app-error, #b3261e); }
.per-variance.neg { color: var(--app-text-muted, #888); }
.per-row-variance td { background: var(--app-warning-soft, #fff8e6); }
.per-row-note td.per-notes { color: #9a5b00; }
.per-row-deleted td:not(.per-notes) { text-decoration: line-through; color: var(--app-text-muted, #888); }
.per-removed-tag { display: inline-block; margin-top: 2px; font-size: 0.75em; font-weight: 700; text-decoration: none;
                   color: var(--app-error, #b3261e); }

.per-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap;
              border-left: 4px solid var(--app-warning, #ff9900); }
.pol-erp-flag { margin-left: 6px; }

/* Dialogs and windows never spill past the screen (user 2026-10-14: the ERP import and tracking
   popups ran off a tablet's edges). Telerik writes the requested Width / Height inline; a max-width
   still wins over that, and the content area scrolls instead of the window growing. */
.k-window {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
}
.k-window-content {
    min-width: 0;
    overflow: auto;
}

/* Room to scroll a focused KeypadTextBox to the top of the page while the on-screen keyboard is
   up, so a short list under it is not left behind the keyboard (wwwroot/js/keypadBox.js). */
body.kp-keyboard-open .k-drawer-content {
    padding-bottom: 60vh;
}

/* ERP review grids (PO + order, 2026-11-01): the Change column carries the detail text and takes the free width. */
.per-grid.k-grid td { vertical-align: top; }
.per-row-detail { margin: 6px 0 4px; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
