.po-genie {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 24px;
    width: 100vw !important;
    max-width: 100vw !important;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    box-sizing: border-box;
    font-size: 14px;
    color: #1f2937;
}

.po-genie-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.po-genie h1.po-genie-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.2;
    color: #1f2937;
}

.po-genie-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.po-genie-status-filter {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* WHY these declarations live here as well as in customer-dashboard.css: the markup uses
   the shared .crm-filter-pill / .crm-filter-search classes so the dashboard tab picks up
   the CRM styling for free, but the standalone [po_genie] shortcode page enqueues only
   this stylesheet -- so on that page the classes would be unstyled. Both copies resolve
   the same --ast-global-color-* variables, so the palette stays in one place and the two
   cannot drift in colour; only the box metrics are restated. Scoped to .po-genie so this
   never reaches a real CRM bar on a page that loads both. */
.po-genie .crm-filter-pill {
    background: transparent;
    border: 1px solid var(--ast-global-color-5, #e6e7e8);
    border-radius: 1rem;
    padding: 0.2rem 0.7rem;
    font-size: 0.75rem;
    color: var(--ast-global-color-1, #555659);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.po-genie .crm-filter-pill:hover {
    border-color: var(--ast-global-color-3, #324b6b);
    color: var(--ast-global-color-3, #324b6b);
}

.po-genie .crm-filter-pill.is-active {
    background: var(--ast-global-color-3, #324b6b);
    border-color: var(--ast-global-color-3, #324b6b);
    color: #fff;
}

.po-genie .crm-account-filter-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ast-global-color-1, #555659);
    margin-right: 0.35rem;
}

.po-genie .crm-filter-search-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 1;
    min-width: 12rem;
    max-width: 20rem;
}

.po-genie .crm-filter-search-wrap i {
    position: absolute;
    top: 50%;
    right: 0.7rem;
    transform: translateY(-50%);
    font-size: 0.8rem;
    line-height: 1;
    color: var(--ast-global-color-4, #8d8d8d);
    pointer-events: none;
}

.po-genie .crm-filter-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.3rem 2.25rem 0.3rem 0.6rem;
    border: 1px solid var(--ast-global-color-5, #e6e7e8);
    border-radius: 0.25rem;
    font-size: 0.8rem;
    background: #fff;
}

.po-genie .crm-filter-search:focus {
    outline: none;
    border-color: var(--ast-global-color-3, #324b6b);
}

.po-genie-body {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    min-height: 70vh;
}

@media (max-width: 1024px) {
    .po-genie-body {
        grid-template-columns: 1fr;
    }
}

.po-genie-list-pane,
.po-genie-detail-pane {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.po-genie-list {
    flex: 1;
    overflow-y: auto;
    max-height: 70vh;
}

.po-genie-list[aria-busy="true"] {
    opacity: 0.6;
    pointer-events: none;
}

.po-genie-row {
    display: grid;
    grid-template-columns: 1.2fr 1.6fr 0.8fr 1fr;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    align-items: center;
}

.po-genie-row:hover {
    background: #f8fafc;
}

.po-genie-row.is-selected {
    background: #eef2ff;
}

.po-genie-row--head {
    cursor: default;
    background: #f9fafb;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    position: sticky;
    top: 0;
    z-index: 1;
}

.po-genie-row--head:hover {
    background: #f9fafb;
}

.po-genie-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.po-genie-cell--po {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.po-genie-cell--muted {
    color: #6b7280;
}

.po-genie-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
    font-weight: 500;
}

.po-genie-badge--warn {
    background: #fef3c7;
    color: #92400e;
}

.po-genie-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #f1f5f9;
    background: #f9fafb;
}

/* WHY :empty and not a JS guard: renderList writes nothing here when there is only one page of
   results, but the element still stood 17px tall painting its own grey and top border -- which
   is the band that broke the white above the sidebar's action buttons. Empty is exactly the
   condition, the selector already knows it, and the alternative is every render path having to
   remember to toggle a class. */
.po-genie-pagination:empty {
    display: none;
}

/* WHY every state is spelled out: the theme styles bare buttons with white text, and these set a
   white background without a colour of their own -- so Prev and Next rendered as blank white
   boxes. They now look like the status pills above the table, the other buttons in this pane. */
.po-genie .po-genie-page-btn,
.po-genie .po-genie-page-btn:focus {
    background: transparent;
    border: 1px solid var(--ast-global-color-5, #e6e7e8);
    border-radius: 1rem;
    padding: 0.2rem 0.7rem;
    font-size: 0.75rem;
    color: var(--ast-global-color-1, #555659);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.po-genie .po-genie-page-btn:hover:not([disabled]) {
    background: transparent;
    border-color: var(--ast-global-color-3, #324b6b);
    color: var(--ast-global-color-3, #324b6b);
}

.po-genie .po-genie-page-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.po-genie-page-label {
    color: #6b7280;
    font-size: 13px;
}

.po-genie-detail {
    padding: 16px;
    overflow-y: auto;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.po-genie h2.po-genie-detail-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.2;
    color: #1f2937;
}

.po-genie-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 16px;
    margin: 0;
}

.po-genie-meta div {
    display: flex;
    flex-direction: column;
}

/* WHY a rule between the two lists: the email row states where the PO came from and
   the ERP row states what we matched it to. A divider makes that a boundary rather
   than six cells that happen to wrap. Generated with the assistance of AI. */
.po-genie-meta--erp {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.po-genie-meta dt {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.po-genie-meta dd {
    margin: 0;
    color: #1f2937;
    /* WHY set at all: with no value these inherit the theme's body line-height, which is set
       for running prose. Most cells here are one line and never show it, but the ship-to is
       three <br>-separated lines and read as a paragraph with air between each -- taking up
       the height of the whole meta block on the one field that is just an address. */
    line-height: 1.35;
}

/* WHY three columns with no gap: the middle one is the draggable divider, and it provides the
   spacing that the gap used to. A gap plus a divider would leave two seams. */
.po-genie-detail-body {
    display: grid;
    grid-template-columns: 50% 10px minmax(0, 1fr);
    flex: 1;
}

/* WHY the inline width is overridden here rather than left to win: renderDetail sets the columns
   inline, and below this width the two panes stack -- an inline three-column rule would keep
   forcing them side by side in a space that cannot hold them. */
@media (max-width: 1280px) {
    .po-genie-detail-body {
        grid-template-columns: 1fr !important;
    }

    .po-genie-splitter {
        display: none;
    }
}

.po-genie-splitter {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    /* A 10px column is a small target, so the grip is drawn narrower than the hit area. */
    user-select: none;
}

.po-genie-splitter-grip {
    display: block;
    width: 3px;
    height: 44px;
    border-radius: 2px;
    background: #d1d5db;
}

.po-genie-splitter:hover .po-genie-splitter-grip {
    background: #2563eb;
}

/* WHY the iframe stops taking pointer events mid-drag: the PDF viewer is a separate document, so
   once the pointer crosses into it the mousemove events go there and the drag dies halfway
   across the pane. The text selection ban stops the rest of the pane highlighting as the pointer
   sweeps over it. */
.po-genie-detail-body.is-resizing {
    user-select: none;
}

.po-genie-detail-body.is-resizing .po-genie-pdf {
    pointer-events: none;
}

.po-genie-detail-body.is-resizing .po-genie-splitter-grip {
    background: #2563eb;
}

.po-genie-pdf-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    min-height: 480px;
    background: #f9fafb;
}

.po-genie-pdf {
    width: 100%;
    height: 100%;
    min-height: 480px;
    border: 0;
    display: block;
}

.po-genie-lines-wrap {
    overflow: auto;
}

.po-genie-lines {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.po-genie-lines th,
.po-genie-lines td {
    text-align: left;
    padding: 0.35rem 0.6rem;
    /* WHY a translucent black and not a light grey: a light grey is lighter than the warn and
       short tints it sits between, so on exactly the rows that are coloured it read as a white
       gap rather than a rule. Alpha darkens whatever is behind it instead of painting over it. */
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

/* The dashboard's table header bar. CLAUDE.md names --ast-global-color-3 for table headers and
   reserves --ast-global-color-4 for subheads; the two house tables in the plugin use one each,
   so this follows the documented rule rather than the coin toss. */
.po-genie-lines th {
    background-color: var(--ast-global-color-3, #324b6b);
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
}

/* WHY capped on the dashboard: the detail pane there does not bound its height (#dashboard-content
   is the scroller), so the lines box grew to fit every line and a long PO scrolled the whole page,
   PDF and header with it. Capped, the lines scroll beside the PDF and the header stays put.
   Generated with the assistance of AI. */
.po-genie--embedded .po-genie-lines-wrap {
    max-height: 65vh;
}

/* Keeps the columns named while the lines scroll; the wrap is the scroll container.
   WHY -12px rather than 0: the wrap has 12px of padding (its white-box inset), and a sticky
   header stops at the padding's inner edge -- so rows scrolling up showed through a 12px strip
   above it. Pulled up by exactly the padding, the header sits flush with the box's top edge.
   Keep it equal to .po-genie-lines-wrap's padding. */
.po-genie--embedded .po-genie-lines thead th {
    position: sticky;
    top: -12px;
    z-index: 1;
}

.po-genie-lines tbody td {
    background-color: #fff;
}

.po-genie-lines tbody tr:nth-child(even) td {
    background-color: var(--ast-global-color-5, #e6e7e8);
}

/* WHY the last row gets a rule of its own: the header is a solid bar, so the table needs a
   foot to sit on -- and at .06 alpha the ordinary row rule was too faint to close it, which
   under a tinted last row left the table simply stopping. Navy bookends the header. */
.po-genie-lines tbody tr:last-child td {
    border-bottom: 1px solid var(--ast-global-color-3, #324b6b);
}

/* WHY the state tints below are selected as .po-genie-lines tbody tr.<state> td rather than
   the shorter .<state> td they used to be: they have to beat the zebra above, and specificity
   decides that regardless of order. Raised where each is declared rather than restated here,
   so a colour still has one home. */

/* WHY nowrap on every numeric cell: the Agility price cell holds the figure, its pencil
   button, and in the overridden case a struck-through price too -- all separated by real
   spaces, which are legal break opportunities. Narrow the pane and the pencil dropped onto a
   second line, making the cell two line boxes tall; vertical-align:middle then centred that
   pair, so the price sat above the single-line figures in Qty, Avail, PO $ and Total beside
   it. Numbers should not wrap regardless, and holding them on one line is what keeps a row
   reading straight across. The width this costs comes out of Description, which wraps. */
.po-genie-lines .po-genie-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The margin under each price: a second, quieter line in the same cell, so the price stays the
   figure the eye lands on and the row grows by as little as a line can. */
.po-genie-lines .po-genie-col-margin {
    display: block;
    color: #6b7280;
    font-size: 0.7rem;
    line-height: 1.1;
}

/* WHY px: the Agility price is followed by its pencil (.po-genie-price-edit, 10px icon + 2px
   padding each side), which keeps its width while hidden. Indenting the margin by exactly that
   puts its last digit under the price's rather than under the pencil. */
.po-genie-lines .po-genie-price-cell .po-genie-col-margin {
    padding-right: 14px;
}

.po-genie-empty,
.po-genie-loading,
.po-genie-error {
    padding: 24px;
    text-align: center;
    color: #6b7280;
}

/* WHY a spinner and not just the words: the panel used to open with an empty body while the
   first fetch was in flight, which reads as "it did not load" rather than "it is loading" --
   and the fetch is a round trip through WordPress to the API to SQL Server, so it is long
   enough to notice. Motion is what distinguishes waiting from broken. */
.po-genie-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 24px;
    color: #6b7280;
    font-size: 12px;
}

.po-genie-spinner::before {
    content: '';
    width: 22px;
    height: 22px;
    border: 2px solid #e5e7eb;
    border-top-color: #324b6b;
    border-radius: 50%;
    animation: po-genie-spin 0.7s linear infinite;
}

@keyframes po-genie-spin {
    to { transform: rotate(360deg); }
}

/* Respects a reader who has asked the system for less motion; the text still says what is
   happening, so nothing is lost. */
@media (prefers-reduced-motion: reduce) {
    .po-genie-spinner::before {
        animation-duration: 3s;
    }
}

.po-genie-error {
    color: #b91c1c;
}

.po-genie-detail-titlebar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.po-genie-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #e5e7eb;
    color: #374151;
}

/* WHY neutral and not amber: 'open' says a person has not finished with this PO, which is the
   normal condition of everything in the queue -- it is not a warning. What is actually wrong
   with a PO is on its own badges, derived from the lines. */
.po-genie-status--open {
    background: #e0e7ff;
    color: #3730a3;
}

.po-genie-meta-aux {
    color: #6b7280;
    font-weight: 400;
}

.po-genie-totals {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    flex-wrap: wrap;
}

.po-genie-total {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.po-genie-total span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    font-weight: 600;
}

.po-genie-total strong {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.po-genie-badge--ok {
    background: #d1fae5;
    color: #065f46;
}

.po-genie-empty-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 6px;
    word-break: break-all;
}

.po-genie-mismatch {
    color: #b91c1c;
    font-weight: 600;
}

.po-genie-lines tbody tr.po-genie-lines__row--warn td {
    background: #fffbeb;
}

/* ===========================================================================
   DASHBOARD VARIANTS

   The base .po-genie above is written for the standalone [po_genie] page, where
   it deliberately breaks out of the theme's content column (100vw + negative
   margins) to use the full window. Both dashboard mounts are already inside a
   sized panel, so that full-bleed has to be undone or it tears the layout apart.

   Generated with the assistance of AI.
   =========================================================================== */

.po-genie--embedded,
.po-genie--sidebar {
    width: auto !important;
    max-width: none !important;
    position: static;
    left: auto;
    right: auto;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* --- Main panel: filter bar + detail pane, inside #dashboard-content --- */

/* No padding: the list and the PO are each a section card of the Execute tab (see
   buildContentHtml), and the cards pad their own contents -- padding the wrapper as well would
   inset them from the Action List's card above. Its flex gap spaces the two cards, with the drag
   bar inside it. */
.po-genie--embedded {
    padding: 0;
    height: 100%;
}

/* WHY no box of its own: the document and the lines are each their own white card (below), with
   the page's grey -- and the splitter -- showing between them, the way the PO list above sits as
   a card of its own. One box around both read as a single panel with an odd seam down it. */
.po-genie--embedded .po-genie-detail {
    background: transparent;
    border: 0;
    padding: 0;
    /* WHY: #dashboard-content is itself the scroll container, so a nested
       max-height here would produce two scrollbars and strand the PDF. */
    max-height: none;
    overflow: visible;
}

/* Square and bordered like the PO list's wrapper, so the three cards read as one set. The row gap
   only shows when narrow screens stack the two (the splitter is hidden then). */
.po-genie--embedded .po-genie-detail-body {
    row-gap: 12px;
}

.po-genie--embedded .po-genie-pdf-wrap,
.po-genie--embedded .po-genie-lines-wrap {
    background: #fff;
    border: 1px solid var(--ast-global-color-5, #e6e7e8);
    border-radius: 0;
}

.po-genie--embedded .po-genie-lines-wrap {
    padding: 12px;
}

/* Laid out as the wrapper was before the cards: a column with a 16px gap between filters and list. */
.po-genie-list-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* The cards' header rule supplies the space the header would otherwise want below it. */
.po-genie-list-card > .dashboard-card-section-header {
    margin-bottom: 0;
}

/* WHY the PO's card is see-through: the document and the lines are already white boxes of their
   own, so a card around them only put a white border between the grey under the list and the
   grey between the two boxes. Without it the page grey runs unbroken from one gutter into the
   other -- one T of grey, with a drag grip on each arm. */
.po-genie-detail-card {
    background: transparent;
    border: 0;
    padding: 0;
}

/* --- Main panel: the PO table above the detail pane --- */

/* WHY a capped height with its own scroll: a full page of 25 rows would push the detail pane,
   which is where the work happens, a screen below the fold. The cap is a fixed height of about
   five rows rather than a share of the viewport, so the pane below keeps the same room on any
   screen; the sliver of a sixth row says there is more to scroll. The header sticks so the
   columns stay named while scrolling. Generated with the assistance of AI. */
.po-genie-table-wrap {
    margin-bottom: 1rem;
    border: 1px solid var(--ast-global-color-5, #e6e7e8);
    background: #fff;
}

.po-genie--embedded .po-genie-list {
    max-height: 9rem;
    overflow-y: auto;
}

/* The bar between the PO list and the detail pane; dragging it sets the list's height (see
   po-genie-section.js). It takes over the gap the table's own margin used to leave, so the
   spacing is unchanged -- the whole gap is the hit area, the grip only marks it. */
.po-genie--embedded .po-genie-table-wrap {
    margin-bottom: 0;
}

/* WHY the negative margins: .po-genie is a flex column with a 16px gap, which puts a gap on both
   sides of the bar as well as the bar itself -- 48px between the list and the PO. Pulling the bar
   into both gaps leaves just its own 12px, which is still enough to aim at. */
.po-genie-hsplitter {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 12px;
    margin: -16px 0;
    cursor: row-resize;
    user-select: none;
}

.po-genie-hsplitter-grip {
    display: block;
    width: 44px;
    height: 3px;
    border-radius: 2px;
    background: #d1d5db;
}

.po-genie-hsplitter:hover .po-genie-hsplitter-grip,
.po-genie--embedded.is-resizing-list .po-genie-hsplitter-grip {
    background: #2563eb;
}

/* WHY: see the PDF/lines splitter's .is-resizing rules -- the iframe would take the drag over. */
.po-genie--embedded.is-resizing-list {
    user-select: none;
    cursor: row-resize;
}

.po-genie--embedded.is-resizing-list .po-genie-pdf {
    pointer-events: none;
}

.po-genie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin: 0;
}

.po-genie-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--ast-global-color-3, #324b6b);
    color: #fff;
    text-align: left;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
}

/* WHY nowrap on every cell: one line per PO is what keeps the table short enough to leave
   the detail pane in view. Long values are clipped with their full text in a tooltip.
   WHY grey by default, with hairlines instead of stripes: striping every row in a dense
   dense table read as busy. Grey text lets the account -- what a reviewer scans for --
   carry the row. */
.po-genie-table td {
    padding: 0.15rem 0.5rem;
    line-height: 1.3;
    vertical-align: middle;
    border: 0;
    border-bottom: 1px solid #eef0f2;
    color: #6b7280;
    white-space: nowrap;
}

.po-genie-table .po-genie-cell--account {
    color: #1f2937;
}

/* The Math badge sits beside the status pill now the PO # column is gone. */
.po-genie-table .po-genie-cell--status .po-genie-badge {
    margin-left: 0.25rem;
}

/* WHY the pills shrink here: at their detail-header size they were the tallest thing in the
   row, so they set the row height for the whole table. */
.po-genie-table .po-genie-status,
.po-genie-table .po-genie-badge {
    font-size: 0.625rem;
    padding: 0 0.4rem;
    line-height: 1.4;
}


/* WHY display is reset: .po-genie-row is a grid for the standalone list, and a grid <tr>
   drops out of the table's column layout. The class stays for the shared click handler. */
.po-genie-table .po-genie-row {
    display: table-row;
    padding: 0;
    cursor: pointer;
}

.po-genie-table tbody .po-genie-row:hover {
    background: var(--ast-global-color-6, #CCE6F4);
}

/* WHY an inset bar as well as the fill: the fill alone can be mistaken for the hover or the
   alternating stripe, and the bar says which row the pane below belongs to. */
.po-genie-table tbody .po-genie-row.is-selected {
    background: var(--ast-global-color-6, #CCE6F4);
    box-shadow: inset 0.25rem 0 0 var(--ast-global-color-2, #F5821F);
}

/* WHY the cap sits on the inner span: an auto-layout table ignores max-width on a cell, so
   clipping the cell itself would just widen the column. The full text is in the title. */
.po-genie-table .po-genie-cell--clip > span {
    display: block;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sender + envelope: the text clips, the envelope never does. On an inner span because a
   flex <td> drops out of the table's column layout. */
.po-genie-sender {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.po-genie-table .po-genie-cell-clip {
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* WHY hidden except on the selected row: the reply is written about the PO open below, so the
   one row it belongs to is the only place it makes sense -- and a column of envelopes down
   every row was the button-in-a-table clutter to avoid. visibility rather than display so the
   column does not change width as the selection moves. */
.po-genie-sender-reply {
    visibility: hidden;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ast-global-color-3, #324b6b);
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
}

.po-genie-row.is-selected .po-genie-sender-reply {
    visibility: visible;
}

.po-genie-sender-reply:hover {
    color: var(--ast-global-color-2, #F5821F);
}

/* Kept short: most subjects are a forwarded "Fwd: PO 12345" whose useful part is the start, and
   the full line is one hover away (the span's title). Its width is better spent on the columns
   to its right, which were being pushed off the edge of the pane. */
.po-genie-table .po-genie-cell--subject > span {
    max-width: 10rem;
}

.po-genie-table .po-genie-cell--account > span {
    max-width: 18rem;
}

.po-genie-cell-sub {
    color: #6b7280;
}

/* Beside the date rather than under it, which is the extra line the list layout can afford. */
.po-genie-table .po-genie-age {
    display: inline;
    margin-left: 0.375rem;
}

/* The account, branch and ship-to in the dashboard's detail header. */
.po-genie-titlebar-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    font-size: 0.8125rem;
}

.po-genie-titlebar-field {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.po-genie-titlebar-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

/* WHY the note is let wrap onto its own line: it only appears while an account change is
   saving or has failed, and squeezing it into the bar would push the actions off the right. */
.po-genie-titlebar-meta .po-genie-customer-note {
    flex-basis: 100%;
}

/* --- The PO header in the right sidebar (dashboard) ---
   WHY these overrides: the header was laid out as one wide bar across the main panel. The
   sidebar is a third of that width, so the account and branch drop to their own rows under
   the PO number and actions, and the totals wrap rather than squeeze.
   Generated with the assistance of AI. */
.po-genie-head-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}

.po-genie-head-body .po-genie-detail-head {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.po-genie-head-body .po-genie-detail-titlebar {
    gap: 0.5rem;
}

.po-genie-head-body .po-genie-titlebar-meta {
    order: 10;
    flex-basis: 100%;
    margin-right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
}

/* The decision, last: Reject and Submit (or the order it became) under everything they decide
   on, right-aligned like the CRM forms' save row. The buttons' own auto margins are cancelled
   so the pair stays together at the right instead of splitting across the bar. */
.po-genie-head-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.po-genie-head-actions .po-genie-submit,
.po-genie-head-actions .po-genie-order-id {
    margin-left: 0;
}

.po-genie-head-actions:empty {
    display: none;
}

.po-genie-head-body .po-genie-totals {
    gap: 0.5rem 1rem;
}

/* The account as an address. Stretched so Change can sit at the right edge of its row. */
.po-genie-customer--address {
    align-self: stretch;
}

.po-genie-customer-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.po-genie-customer-head .po-genie-customer-change {
    margin-left: auto;
}

/* WHY a card in the totals bar's colours: it is the one block in the header that is a place
   rather than a figure, and setting it off the same way the totals are makes the two read as
   the header's two facts -- where it goes, and what it comes to. */
/* Ship-to label over its address card, full width under the branch. */
.po-genie-shipto {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.po-genie-shipto-address {
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-style: normal;
    line-height: 1.45;
    color: #4b5563;
}

/* Its own line under the address, set off by a hairline: a setting of the ship-to, not part of
   where it is. */
.po-genie-shipto-bo {
    display: block;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.75rem;
}

.po-genie-shipto-address .po-genie-erp-name {
    color: #1f2937;
}

/* --- Line item panel (sidebar): item, stock, last sales, forecast ---
   Generated with the assistance of AI. */
.po-genie-item-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
}

.po-genie-item-section {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* WHY the element and container in the selector: the theme styles every h4 as a display
   heading (large, navy, its own font and margins), and a bare class lost to it -- the section
   labels rendered bigger than the item they introduce. This outranks the theme without
   !important. */
.po-genie-item-panel h4.po-genie-item-heading {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: 0.8125rem;
    line-height: 1.3;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ast-global-color-3, #324b6b);
}

.po-genie-item-tag {
    display: inline-block;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #e5e7eb;
    color: #374151;
}


/* WHY table.class within the panel: the theme pads and borders every table cell generously,
   and that was beating these rules -- each row stood twice the height it needs. */
.po-genie-item-panel table.po-genie-item-table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    font-size: 0.75rem;
}

/* Subhead grey rather than the main-table navy: these sit inside a panel whose own header is
   already navy, and the codebase's table standard uses this grey for subheads. */
.po-genie-item-panel table.po-genie-item-table th {
    background: var(--ast-global-color-4, #8d8d8d);
    color: #fff;
    text-align: left;
    padding: 0.2rem 0.5rem;
    border: 0;
    font-weight: 700;
    line-height: 1.3;
}

.po-genie-item-panel table.po-genie-item-table td {
    padding: 0.2rem 0.5rem;
    border: 0;
    border-bottom: 1px solid #eef0f2;
    vertical-align: top;
    line-height: 1.3;
}

/* Numbers right-aligned, headings included, so a column of figures lines up on its last digit.
   Needs this specificity: the th and td rules above would otherwise win and left-align them. */
.po-genie-item-panel table.po-genie-item-table th.po-genie-num,
.po-genie-item-panel table.po-genie-item-table td.po-genie-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Alternating rows, white / light grey, per the codebase's table standard. */
.po-genie-item-panel table.po-genie-item-table tbody tr:nth-child(even) td {
    background: var(--ast-global-color-5, #e6e7e8);
}


.po-genie-item-far { color: #b45309; }

/* Agility's own price, under one a CSR overrode: what the account price would have been. */
.po-genie-item-proposed {
    display: block;
    font-size: 0.6875rem;
    color: #6b7280;
}

/* The product page's forecast table is sized for a full-width page (10px cells, 13px type);
   tightened here only, so the PDP keeps its spacing. */
.po-genie-item-forecast .nn-inventory-forecast-table {
    width: 100%;
    font-size: 0.75rem;
}

.po-genie-item-forecast .nn-inventory-forecast-table th,
.po-genie-item-forecast .nn-inventory-forecast-table td {
    padding: 0.2rem 0.5rem;
    line-height: 1.3;
}

.po-genie-item-panel tr.is-order-branch td {
    font-weight: 700;
}

.po-genie-item-panel tr.is-order-branch td:first-child {
    box-shadow: inset 0.25rem 0 0 var(--ast-global-color-2, #F5821F);
}

/* The plain cells of a line open the item panel, so say so. */
.po-genie-lines__row td:not(.po-genie-erp-cell):not(.po-genie-qty-cell):not(.po-genie-price-cell):not(.po-genie-lines__actions) {
    cursor: pointer;
}

/* --- Right sidebar: pickers --- */

/* WHY flex:1 rather than height:100%: this sits inside .dashboard-right-sidebar-body, which is
   a flex column with a gap. A percentage height there resolves against the container's full
   height and then the gap is added on top, so the panel either overflows or -- because the body
   scrolls -- shrink-wraps and leaves the white stopping short of the bottom with grey beneath.
   flex:1 with min-height:0 is the idiom that actually fills a flex parent, and the min-height is
   what lets the list inside it scroll instead of pushing the panel taller. */
.po-genie--sidebar {
    padding: 0;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    font-size: 13px;
    background: #fff;
}

/* The document's name, shown because no ERP account matched. */
.po-genie-cell--unmatched {
    color: #b45309;
    font-style: italic;
}

/* ===========================================================================
   ERP ACCOUNT + CHANGE PICKER

   The meta panel lists ERP-resolved values, not our OCR of the document -- the PDF
   is rendered alongside it, so restating extracted values adds nothing and can
   mislead. "Change" opens a modal with a searchable account table.
   Generated with the assistance of AI.
   =========================================================================== */

.po-genie-customer-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.po-genie-erp-name {
    font-weight: 600;
}

.po-genie-erp-unresolved {
    color: #b45309;
    font-weight: 600;
}

.po-genie-meta-aux--warn {
    color: #b45309;
}

.po-genie-customer-change {
    padding: 2px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
}

.po-genie-customer-change:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.po-genie-customer-note {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: #b45309;
    max-width: 460px;
}

.po-genie-customer-note.is-error {
    color: #b91c1c;
}

/* --- The picker modal --- */

/* WHY this overrides the modal's own wrapper: .nn-modal-container .content is
   display:flex with no flex-direction, so it defaults to row and would lay the
   picker's sections out side by side. Scoped to this modal's className so no other
   dialog is affected. */
.po-genie-picker-modal .content {
    flex-direction: column;
    padding: 12px 16px 16px;
    overflow: auto;
}

.po-genie-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    min-width: 0;
    font-size: 13px;
    color: #1f2937;
}

.po-genie-picker-doc {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.po-genie-picker-doc-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #6b7280;
}

.po-genie-picker-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
}

.po-genie-picker-search:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}

/* WHY a bounded scroll area: a common first token matches plenty -- "BUILDERS"
   returns 141 accounts -- and an unbounded table would push the action buttons off
   the bottom of an auto-height dialog. */
.po-genie-picker-results {
    max-height: 46vh;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

.po-genie-picker-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

/* WHY: without a nowrap on the narrow columns the browser wraps "KEIM HOME CENTER
   #0920 DO-IT" one word per line to make room, which is what turned the rows into
   tall stacks. Let the name wrap and keep the rest on one line. */
.po-genie-picker-table td:first-child {
    min-width: 12rem;
}

.po-genie-picker-table td:nth-child(2),
.po-genie-picker-table td:nth-child(3) {
    white-space: nowrap;
}

.po-genie-picker-table th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #6b7280;
}

.po-genie-picker-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.po-genie-picker-row {
    cursor: pointer;
}

.po-genie-picker-row:hover {
    background: #f9fafb;
}

.po-genie-picker-row.is-chosen {
    background: #eff6ff;
    box-shadow: inset 2px 0 0 #2563eb;
}

.po-genie-picker-row.is-current td:first-child {
    font-weight: 600;
}

.po-genie-picker-current {
    display: inline-block;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 3px;
    background: #e5e7eb;
    color: #4b5563;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.po-genie-picker-code {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.po-genie-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.po-genie-picker-cancel,
.po-genie-picker-select {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.po-genie-picker-cancel {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.po-genie-picker-select {
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #fff;
}

.po-genie-picker-select[disabled] {
    opacity: .5;
    cursor: default;
}

/* ===========================================================================
   AVAILABILITY

   Comes from the same Agility xref lookup as erp_unit_price. A line can price
   perfectly and still be unfillable, which is the case a reviewer scanning prices
   will otherwise miss. Generated with the assistance of AI.
   =========================================================================== */

.po-genie-avail {
    font-variant-numeric: tabular-nums;
}

.po-genie-avail--short {
    color: #b91c1c;
    font-weight: 700;
}

/* WHY on td and not tr: the existing --warn rule tints cells, and a tr background sits
   behind them -- mixing the two makes the stacking order decide which tint wins.
   WHY a clearly different hue: a failed cross-reference means we do not know what the
   item is (amber, above), while a shortfall means we know exactly what it is and cannot
   supply enough (rose). Both need attention, but conflating them loses which problem to
   go and solve, and #fff7ed against #fffbeb was not a distinction anyone would see. */
.po-genie-lines tbody tr.po-genie-lines__row--short td {
    background: #fff1f2;
}

/* --- Issue counts in the totals bar --- */

.po-genie-issues {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* --- Jump-to-flagged buttons in the totals bar --- */

/* WHY it has to opt back into the badge look: it is a <button> so it can be clicked and
   focused, and the browser's default control styling would otherwise override the badge
   background and font it inherits. */
.po-genie-jump {
    border: 0;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    line-height: inherit;
}

.po-genie-jump:hover {
    filter: brightness(0.95);
}

.po-genie-jump:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

/* WHY an outline rather than a background: the flagged rows already carry a tint, and a
   second background would fight it — the reviewer would not be able to tell the landed-on
   row from the others. The marker also stays put after the scroll settles, so the row is
   still identifiable once the animation ends. */
.po-genie-lines__row.is-jump-target td {
    box-shadow: inset 0 2px 0 #2563eb, inset 0 -2px 0 #2563eb;
}

.po-genie-lines__row.is-jump-target td:first-child {
    box-shadow: inset 2px 0 0 #2563eb, inset 0 2px 0 #2563eb, inset 0 -2px 0 #2563eb;
}

.po-genie-lines__row.is-jump-target td:last-child {
    box-shadow: inset -2px 0 0 #2563eb, inset 0 2px 0 #2563eb, inset 0 -2px 0 #2563eb;
}

/* --- Agility match mark on the list rows --- */

/* WHY sized down and nudged up: it sits inline before the account name and should read
   as a mark on that name, not as an element competing with it. */
.po-genie-match {
    font-size: 0.8em;
    margin-right: 5px;
    vertical-align: 1px;
}

.po-genie-match--ok {
    color: #16a34a;
}

.po-genie-match--no {
    color: #dc2626;
}

/* ===========================================================================
   EXCLUDED LINES

   A reviewer can drop a line the order cannot fill. The row is struck through and
   greyed rather than removed, because the PO is a record of what the customer asked
   for. Generated with the assistance of AI.
   =========================================================================== */

/* WHY the strike is on the cells and not the row: a line-through set on a <tr> is not
   inherited into its cells by every browser, and the existing --warn rule already tints
   at td level, so keeping both at the same level avoids one overriding the other. */
.po-genie-lines tbody tr.po-genie-lines__row--excluded td {
    background: #f9fafb;
    color: #9ca3af;
    /* WHY the strike is coloured and thickened rather than left to inherit: on greyed-out
       text a line-through in the same grey is nearly invisible, which defeats the point of
       striking it. Red at 2px reads as removed at a glance. */
    text-decoration: line-through;
    text-decoration-color: #dc2626;
    text-decoration-thickness: 2px;
}

/* WHY the button opts out: it is the way back, so striking it through would make the
   control look as disabled as the row it sits on. */
.po-genie-lines__row--excluded td.po-genie-lines__actions {
    text-decoration: none;
}

/* WHY the mismatch and short markers are neutralised here: they mean "act on this", and
   the line has been acted on -- leaving them red would keep drawing the eye to a row
   that is already resolved. */
.po-genie-lines__row--excluded .po-genie-mismatch,
.po-genie-lines__row--excluded .po-genie-avail--short {
    color: inherit;
    font-weight: 400;
}

.po-genie-lines__actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.po-genie-line-toggle {
    border: 0;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
}

.po-genie-line-toggle:hover {
    color: #b91c1c;
}

.po-genie-lines__row--excluded .po-genie-line-toggle:hover {
    color: #16a34a;
}

.po-genie-line-toggle[disabled] {
    opacity: 0.4;
    cursor: default;
}

/* WHY the adjusted total is visually quieter than the two stored ones: it is derived, and
   the PO and Agility totals are the pair a reviewer checks against the document. */
.po-genie-total--adjusted span {
    color: #b45309;
}

/* Visually hidden, for the actions column's header label. Defined here rather than
   relying on the theme's screen-reader-text, which this plugin does not ship. */
.po-genie-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===========================================================================
   SUBMIT TO AGILITY

   The one action on this screen that cannot be undone, so it is styled as a commit
   rather than a nav control, and its refusals are shown in full.
   Generated with the assistance of AI.
   =========================================================================== */

/* WHY navy rather than the green it used to be: this is the dashboard's primary action button
   in the same role as .crm-section-add-btn, .mdm-add-account-btn and .pca-button, and those are
   navy with a white-and-navy inverse on hover. Green made the most consequential button in the
   pane the one that looked least like the rest of the application -- and green in this palette
   reads as a state that has been reached, which is what the Math badge and the order-id pill
   next to it use it for, not as something waiting to be pressed. */
.po-genie-submit {
    margin-left: auto;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--ast-global-color-3, #324b6b);
    border-radius: 0.25rem;
    background: var(--ast-global-color-3, #324b6b);
    color: #fff;
    font-size: 0.82rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.po-genie-submit:hover:not([disabled]) {
    background: #fff;
    color: var(--ast-global-color-3, #324b6b);
    border-color: var(--ast-global-color-3, #324b6b);
}

.po-genie-submit[disabled] {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #9ca3af;
    cursor: default;
}

/* The order it became, in place of the button. */
.po-genie-order-id {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 4px;
    background: #d1fae5;
    color: #065f46;
    font-size: 12px;
    font-weight: 700;
}

.po-genie-status--ordered {
    background: #d1fae5;
    color: #065f46;
}

/* An order being placed in the background: in progress, not a problem -- the accent blue the
   rest of the pane uses for "working". */
.po-genie-status--placing {
    background: var(--ast-global-color-6, #CCE6F4);
    color: var(--ast-global-color-3, #324b6b);
}

/* A placing that never answered: the one state a reviewer must act on before anything else. */
.po-genie-status--unknown {
    background: #fee2e2;
    color: #991b1b;
}

/* News about a PO the reviewer may have moved away from, in the corner of the screen. Above the
   sidebar and dialogs so it is never hidden behind the pane it is about. */
.po-genie-toasts {
    position: fixed;
    right: 1rem;
    bottom: 3.5rem;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 24rem;
}

.po-genie-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.8125rem;
    line-height: 1.35;
    background: #fff;
    border-left: 4px solid var(--ast-global-color-3, #324b6b);
    color: var(--ast-global-color-1, #555659);
}

.po-genie-toast--success {
    border-left-color: #059669;
}

.po-genie-toast--error {
    border-left-color: #b91c1c;
}

.po-genie-toast-close {
    margin-left: auto;
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

/* WHY the base state is neutral and green is opt-in: this box is reused for "Checking...",
   for a refusal, and for "order created". It used to default to green, so clicking Submit
   flashed a green box while the dry run was in flight -- which on this screen reads as "the
   order went in". Green is the one signal here that must never appear spuriously, so it is
   now a state something has to ask for. */
.po-genie-submit-note {
    padding: 8px 12px;
    border-radius: 4px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 13px;
}

.po-genie-submit-note.is-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
    font-weight: 600;
}

.po-genie-submit-note.is-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* WHY the refusal list is not truncated: each entry names a line the reviewer has to go and
   deal with, so hiding any of them behind a "and 6 more" just means a second round trip
   through the same screen. */
.po-genie-submit-problems {
    margin: 6px 0 0;
    padding-left: 18px;
}

.po-genie-submit-problems li {
    margin: 2px 0;
}

/* --- The confirmation dialog --- */

.po-genie-confirm-modal .content {
    flex-direction: column;
    padding: 12px 16px 16px;
    overflow: auto;
}

.po-genie-confirm {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13px;
    color: #1f2937;
}

.po-genie-confirm-lead {
    margin: 0;
    padding: 8px 10px;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
}

.po-genie-confirm-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    margin: 0;
}

.po-genie-confirm-facts div {
    display: flex;
    flex-direction: column;
}

.po-genie-confirm-facts dt {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #6b7280;
}

.po-genie-confirm-facts dd {
    margin: 0;
}

.po-genie-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.po-genie-confirm-cancel,
.po-genie-confirm-go {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.po-genie-confirm-cancel {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
}

.po-genie-confirm-go {
    border: 1px solid #15803d;
    background: #16a34a;
    color: #fff;
    font-weight: 600;
}

.po-genie-confirm-go[disabled] {
    opacity: .6;
    cursor: default;
}

/* --- What is not being ordered, acknowledged before committing --- */

.po-genie-dropped {
    border: 1px solid #fecaca;
    border-radius: 4px;
    background: #fef2f2;
    padding: 10px 12px;
}

.po-genie-dropped-title {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #991b1b;
}

.po-genie-dropped-list {
    margin: 0 0 10px;
    padding-left: 18px;
    font-size: 12px;
    color: #7f1d1d;
    /* WHY bounded: a PO where most lines were dropped would push the acknowledgement and the
       buttons off the bottom of an auto-height dialog. Scrolling the list keeps the act of
       acknowledging reachable without hiding what is being acknowledged. */
    max-height: 30vh;
    overflow-y: auto;
}

.po-genie-dropped-list li {
    margin: 3px 0;
}

.po-genie-dropped-ack {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #7f1d1d;
    cursor: pointer;
}

/* Refusal entries are buttons so they can be clicked, but they carry sentence text.
   WHY text-transform is reset: the theme uppercases buttons, which is right for a CTA and
   wrong for "61102 has 0 available against 1 ordered" -- in caps it reads as shouting and is
   measurably harder to scan, which matters most on the list a rep is meant to work through. */
.po-genie-problem-jump {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: underline dotted;
    cursor: pointer;
}

.po-genie-problem-jump:hover {
    text-decoration: underline solid;
}

/* Same reason as .po-genie-problem-jump: these carry counts as sentences ("1 item out of
   stock"), not labels, so the theme's uppercasing works against them. */
.po-genie-jump {
    text-transform: none;
    letter-spacing: normal;
}

/* WHY a muted, quoted style and not the red used for "not found": nothing is known to be
   wrong with these lines -- no lookup ever ran. Red would send a reviewer hunting for a fault
   that may not exist, when the action needed is simply to re-assess. */
.po-genie-unchecked {
    color: #6b7280;
    font-style: italic;
    font-size: 11px;
}

/* WHY the re-assess button is quieter than Submit: both sit in the titlebar, and only one of
   them is irreversible. A second filled button beside the commit would make them look
   equivalent. */
.po-genie-reassess {
    margin-left: auto;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
}

.po-genie-reassess:hover:not([disabled]) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* WHY it matches Re-assess rather than Submit: emailing the sender is a step on the way to
   an order, not the order itself, so it reads as the same weight as the other reversible
   action beside it. No margin-left here -- Re-assess already pushes the group right. */
.po-genie-reply {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
}

.po-genie-reply:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* WHY Reject reads as quiet and not destructive-red: it is reversible and reopening is one
   click, so styling it as a danger action would overstate it next to Submit, which is the
   irreversible one on this bar. */
.po-genie-reject,
.po-genie-reopen {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
}

.po-genie-reject:hover:not([disabled]) {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}

.po-genie-reopen:hover:not([disabled]) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* The status pill for a closed PO. Grey rather than red: rejected is a finished state, not an
   error, and it should not compete with the stock and math warnings below it. */
.po-genie-status--rejected {
    background: #e5e7eb;
    color: #4b5563;
}

/* WHY the reason gets a banner of its own: it is the point of rejecting rather than deleting,
   and whoever opens the PO next -- or answers the customer asking where their order went --
   should not have to hover a pill to find it. */
/* WHY amber and above the lines: it is not a fault in a line, it is a question about whether the
   PO should be worked at all — so it belongs where a reviewer reads before starting, and it
   wants more weight than an issue badge without reading as an error. */
/* WHY blue and not amber: somebody else being in the PO is information, not a problem -- the
   warnings below it are for things that are actually wrong. Active reads stronger than a trace
   because only one of the two should stop a reviewer from starting. */
.po-genie-viewing {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0;
    padding: 8px 12px;
    border: 1px solid #e0e7ff;
    border-left: 3px solid #a5b4fc;
    border-radius: 4px;
    background: #eef2ff;
    font-size: 12px;
    color: #3730a3;
}

.po-genie-viewing.is-active {
    border-color: #6366f1;
    border-left-color: #4338ca;
    font-size: 13px;
}

.po-genie-viewing strong {
    font-weight: 600;
}

.po-genie-dupe-note {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 0;
    padding: 10px 12px;
    border: 1px solid #f59e0b;
    border-left: 3px solid #d97706;
    border-radius: 4px;
    background: #fffbeb;
    font-size: 13px;
    color: #92400e;
}

.po-genie-dupe-note strong {
    font-weight: 600;
}

.po-genie-dupe-note ul {
    margin: 0;
    padding-left: 18px;
}

.po-genie-dupe-note span {
    font-size: 12px;
    opacity: 0.85;
}

.po-genie-dupe-jump {
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: #92400e;
    text-transform: none;
    text-decoration: underline dotted;
    cursor: pointer;
}

.po-genie-dupe-jump:hover {
    text-decoration: underline solid;
}

/* WHY on its own line under the date: the sidebar row is a 2x2 grid and the date shares its cell
   with this, so stacking keeps the grid from widening on a PO that has waited a while. */
.po-genie-age {
    display: block;
    font-size: 10px;
    color: #9ca3af;
}

.po-genie-age.is-stale {
    color: #b45309;
    font-weight: 600;
}

.po-genie-rejected-note {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 8px 0 0;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #9ca3af;
    border-radius: 4px;
    background: #f9fafb;
    font-size: 13px;
    color: #4b5563;
}

.po-genie-rejected-note strong {
    font-weight: 600;
    color: #374151;
}

/* Matches .po-genie-po-input so the reason box is not the one field in the app with its own
   look; only the height and wrapping differ, because a sentence is not a PO number. */
.po-genie-reject-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    resize: vertical;
}

.po-genie-reject-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* WHY this line exists at all: the PO's PDF is attached server-side from the bucket, so it
   never shows up in the composer's file field. Without saying so, the reviewer cannot tell
   the customer is getting their own document back and may attach it again by hand. */
.po-genie-reply-attach {
    margin: 8px 0 0;
    font-size: 12px;
    color: #6b7280;
}

.po-genie-reassess[disabled] {
    color: #9ca3af;
    cursor: default;
}

/* WHY Submit loses its auto-margin when both are present: the pair should sit together at the
   right, not be pushed apart by two competing margins. */
.po-genie-reassess + .po-genie-submit {
    margin-left: 8px;
}

/* --- The PO number, when the document did not carry one --- */

/* WHY it reads as an action rather than a value: an empty title looks like something failed to
   load, where a prompt says whose turn it is. A planogram legitimately has no PO header. */
.po-genie-po-edit {
    border: 1px dashed #b45309;
    border-radius: 4px;
    background: #fffbeb;
    color: #92400e;
    padding: 2px 10px;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.po-genie-po-edit:hover {
    background: #fef3c7;
}

/* Once a number exists the control is a quiet pencil, not a call to action. */
.po-genie-po-edit--small {
    border: 0;
    background: transparent;
    color: #9ca3af;
    padding: 0 4px;
    font-size: 11px;
}

.po-genie-po-edit--small:hover {
    background: transparent;
    color: #374151;
}

/* --- The Agility catalogue answer, where no customer-scoped price exists yet --- */

/* Ours, just not priced for an account yet: a fact, not a fault. */
/* WHY amber and not red: a number that is not in our catalogue is the expected shape of a
   customer's own part number, and their cross-reference is what translates it. It needs
   attention, not alarm. */
.po-genie-sku-theirs {
    color: #b45309;
    font-style: italic;
    font-size: 11px;
}

/* ===========================================================================
   ITEM NUMBER COLUMN

   A document often carries several identifier columns and only one holds National Nail
   numbers. Reading the wrong one makes every line unresolvable while looking exactly like
   a PO full of items we do not stock, so which column is in use is stated above the table
   rather than left implicit. Generated with the assistance of AI.
   =========================================================================== */

.po-genie-source-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #f9fafb;
    font-size: 12px;
}

.po-genie-source-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #6b7280;
}

.po-genie-source-current {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.po-genie-source-change {
    margin-left: auto;
    padding: 2px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 12px;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.po-genie-source-change:hover:not([disabled]) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.po-genie-source-change[disabled] {
    opacity: .5;
    cursor: default;
}

/* --- The picker rows --- */

.po-genie-source-row {
    cursor: pointer;
}

.po-genie-source-row:hover {
    background: #f9fafb;
}

.po-genie-source-row.is-chosen {
    background: #eff6ff;
    box-shadow: inset 2px 0 0 #2563eb;
}

/* WHY the fully-recognised column is tinted: it is almost always the right answer, and a
   reviewer who does not know our numbering should not have to work out that 8 of 8 beats
   0 of 8. The colour does the reading for them. */
.po-genie-source-row.is-ours td {
    background: #f0fdf4;
}

.po-genie-source-row.is-ours.is-chosen td {
    background: #eff6ff;
}

.po-genie-source-example {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}

/* WHY the warning is stated before the choice, not after: switching discards resolved
   pricing, and someone should know that before clicking, not from a toast afterwards. */
.po-genie-source-warning {
    margin: 0;
    padding: 8px 10px;
    border-radius: 4px;
    background: #fffbeb;
    color: #92400e;
    font-size: 12px;
}

.po-genie-source-apply {
    padding: 6px 14px;
    border: 1px solid #2563eb;
    border-radius: 4px;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.po-genie-source-apply[disabled] {
    opacity: .5;
    cursor: default;
}

/* --- Order branch --- */

.po-genie-branch-current {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 600;
}

.po-genie-branch-change {
    border: 0;
    background: transparent;
    padding: 0 4px;
    color: #6b7280;
    font-size: 11px;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: underline dotted;
    cursor: pointer;
}

.po-genie-branch-change:hover:not([disabled]) {
    color: #1f2937;
    text-decoration: underline solid;
}

.po-genie-branch-row {
    cursor: pointer;
}

.po-genie-branch-row:hover {
    background: #f9fafb;
}

.po-genie-branch-row.is-chosen {
    background: #eff6ff;
    box-shadow: inset 2px 0 0 #2563eb;
}

.po-genie-branch-apply {
    padding: 6px 14px;
    border: 1px solid #2563eb;
    border-radius: 4px;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.po-genie-branch-apply[disabled] {
    opacity: .5;
    cursor: default;
}

/* WHY quieter than "current": it says where this account's orders normally go, which is
   context for the choice rather than the state of it. */
.po-genie-branch-default {
    display: inline-block;
    padding: 0 5px;
    border-radius: 3px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* ===========================================================================
   PRICE OVERRIDE

   The order is billed at Agility's price by default; a reviewer can charge something else,
   usually to honour what the PO printed. Both figures stay on screen because the reviewer
   needs to see what they departed from — and because Agility's price can move on the next
   re-assessment, so the gap they accepted is not necessarily the gap today.
   Generated with the assistance of AI.
   =========================================================================== */

/* The Agility price, once something else is being charged. */
.po-genie-price-was {
    color: #9ca3af;
    font-size: 11px;
    text-decoration: line-through;
}

.po-genie-price-override {
    color: #1d4ed8;
    font-weight: 700;
}

/* WHY the pencil is nearly invisible until hover: it appears on every line of a
   twenty-seven-row table, and an override is the exception. A visible control per row would
   read as though something needed doing on all of them. */
/* WHY the document's figure stays visible, struck through: the pane exists so a reviewer can
   check us against the PDF in front of them, and a quantity that no longer matches the page has
   to say so -- otherwise the next person reads 8 here, 12 there, and cannot tell which is the
   mistake. Mirrors .po-genie-price-was so a changed quantity and a changed price read as one
   idea rather than two features. */
/* WHY quiet by default and amber only past an hour: old figures are not an error -- submit
   re-checks them before it judges anything -- but a reviewer reading stock off the screen to
   decide what to strike should know how much to trust it. */
/* WHY it sits inside the success note rather than beside Submit: it is only offered once an
   order has actually gone short, and it belongs with the sentence that says so. Filled rather
   than outlined because the note is already green -- an outlined button disappears into it. */
/* --- Adding a product the document does not contain --- */

/* WHY it sits below the table and not as a row inside it: the table is a transcript of the
   document, and an empty editable row among the customer's own lines invites reading it as one
   of them. */
.po-genie-add-line {
    display: flex;
    justify-content: flex-start;
    padding: 8px 0 0;
}

.po-genie-add-product {
    padding: 6px 12px;
    border: 1px dashed #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    text-transform: none;
    cursor: pointer;
}

.po-genie-add-product:hover {
    border-style: solid;
    border-color: #2563eb;
    color: #1d4ed8;
}

/* WHY a tag and not a row tint: the tints already mean "needs a decision", and an added line
   needs none -- it says where the line came from, not that anything is wrong with it. */
.po-genie-added-tag {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 8px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.po-genie-line-delete {
    border: 0;
    background: transparent;
    padding: 0 2px;
    color: transparent;
    font-size: 11px;
    cursor: pointer;
}

.po-genie-lines__row:hover .po-genie-line-delete {
    color: #9ca3af;
}

.po-genie-line-delete:hover,
.po-genie-lines__row:hover .po-genie-line-delete:hover {
    color: #b91c1c;
}

.po-genie-product-search {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
}

.po-genie-product-search:focus {
    outline: none;
    border-color: #2563eb;
}

/* Bounded so a broad keyword cannot push the actions off the bottom of the dialog -- the same
   reasoning as the account picker's result list. */
.po-genie-product-results {
    max-height: 17rem;
    overflow-y: auto;
    margin: 8px 0;
    border: 1px solid #f1f5f9;
    border-radius: 4px;
}

.po-genie-product-row {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 2px 10px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: transparent;
    text-align: left;
    text-transform: none;
    cursor: pointer;
}

.po-genie-product-row:hover {
    background: #f8fafc;
}

.po-genie-product-row.is-chosen {
    background: #eff6ff;
    box-shadow: inset 3px 0 0 #2563eb;
}

/* An item already on the PO stays listed but unselectable — hiding it would leave a reviewer
   hunting for something they can see on the table. */
.po-genie-product-row.is-on-po {
    cursor: default;
    opacity: 0.55;
}

.po-genie-product-row.is-on-po:hover {
    background: transparent;
}

.po-genie-product-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: #1f2937;
}

.po-genie-product-desc {
    font-size: 12px;
    color: #1f2937;
}

.po-genie-product-meta {
    grid-column: 2;
    font-size: 11px;
    color: #6b7280;
}

.po-genie-product-out {
    color: #b45309;
    font-weight: 600;
}

.po-genie-product-qty {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
}

.po-genie-tell-customer {
    margin-left: 8px;
    padding: 4px 10px;
    border: 1px solid #047857;
    border-radius: 4px;
    background: #047857;
    color: #fff;
    font-size: 12px;
    text-transform: none;
    cursor: pointer;
}

.po-genie-tell-customer:hover {
    background: #065f46;
    border-color: #065f46;
}

.po-genie-priced-age {
    margin-left: auto;
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.po-genie-priced-age.is-stale {
    color: #b45309;
}

.po-genie-qty-was {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 11px;
}

.po-genie-qty-override {
    font-weight: 600;
    color: #1d4ed8;
}

.po-genie-qty-edit {
    border: 0;
    background: transparent;
    padding: 0 2px;
    color: transparent;
    font-size: 10px;
    cursor: pointer;
}

.po-genie-lines__row:hover .po-genie-qty-edit {
    color: #9ca3af;
}

.po-genie-qty-edit:hover,
.po-genie-lines__row:hover .po-genie-qty-edit:hover {
    color: #1d4ed8;
}

/* An excluded line is not being ordered, so its quantity control goes with it. */
.po-genie-lines__row--excluded .po-genie-qty-edit {
    display: none;
}

/* The whole quantity cell opens the editor, so say so on hover. Not on a struck-off line,
   where it does nothing. */
.po-genie-lines__row:not(.po-genie-lines__row--excluded) .po-genie-qty-cell {
    cursor: pointer;
}

.po-genie-lines__row:not(.po-genie-lines__row--excluded) .po-genie-qty-cell:hover {
    background: var(--ast-global-color-6, #CCE6F4);
}

.po-genie-qty-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
}

.po-genie-qty-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* Sits with Cancel/Save but reads as the quieter of the three: it undoes rather than commits. */
.po-genie-qty-clear {
    margin-right: auto;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    text-transform: none;
    cursor: pointer;
}

.po-genie-qty-clear:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.po-genie-price-edit {
    border: 0;
    background: transparent;
    padding: 0 2px;
    color: transparent;
    font-size: 10px;
    cursor: pointer;
}

.po-genie-lines__row:hover .po-genie-price-edit {
    color: #9ca3af;
}

.po-genie-price-edit:hover,
.po-genie-lines__row:hover .po-genie-price-edit:hover {
    color: #1d4ed8;
}

/* An excluded line is not being charged anything, so its price control goes with it. */
.po-genie-lines__row--excluded .po-genie-price-edit {
    display: none;
}

/* --- Form modals (price, PO number) --- */

.po-genie-price-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #6b7280;
}

.po-genie-price-label input {
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
}

.po-genie-price-label input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}

/* WHY the candidate prices are buttons and not a select: there are two of them, both are one
   click, and a dropdown would hide the figures behind an interaction. */
.po-genie-price-quicks {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.po-genie-price-quick {
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 12px;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.po-genie-price-quick:hover {
    background: #eff6ff;
    border-color: #2563eb;
    color: #1d4ed8;
}

/* The running line total, and where a validation message lands. */
.po-genie-price-total {
    margin: 0;
    min-height: 1.2em;
    font-size: 12px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.po-genie-price-clear {
    margin-right: auto;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
}

.po-genie-form-save {
    padding: 6px 14px;
    border: 1px solid #2563eb;
    border-radius: 4px;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.po-genie-form-save[disabled] {
    opacity: .6;
    cursor: default;
}

/* The candidates offered on a line that resolved to nothing at all -- neither a cross-reference
   nor a description match good enough to adopt. A line WE resolved is marked on the number
   itself instead; see .po-genie-picked. */
.po-genie-suggest {
    margin-left: 4px;
    padding: 1px 6px;
    border: 1px solid var(--ast-global-color-3, #324b6b);
    border-radius: 8px;
    background: transparent;
    color: var(--ast-global-color-3, #324b6b);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    vertical-align: middle;
}

.po-genie-suggest:hover {
    background: var(--ast-global-color-6, #cce6f4);
}


/* A mapping another ship-to already confirmed is the strongest thing in the modal, so it is
   the only part of it that is tinted. */
.po-genie-suggest-sibling {
    padding: 6px 8px;
    border-left: 3px solid var(--ast-global-color-2, #f5821f);
    background: #fff7ed;
}

.po-genie-suggest-note {
    color: #6b7280;
    font-size: 11px;
}

/* The price column the order will be placed at, chosen in its own header. */
.po-genie-price-pick {
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    cursor: pointer;
    opacity: .65;
}

.po-genie-price-pick.is-active {
    opacity: 1;
}

.po-genie-price-pick input {
    margin: 0;
    cursor: pointer;
}


/* Backordered lines ARE being ordered, unlike the dropped block above whose red says they are
   not. Amber carries "you should know" without borrowing the weight of "this is not going". */
.po-genie-backordered {
    border-color: #fde68a;
    background: #fffbeb;
}

.po-genie-backordered .po-genie-dropped-title {
    color: #92400e;
}

.po-genie-backordered .po-genie-dropped-list,
.po-genie-backordered .po-genie-dropped-ack {
    color: #78350f;
}

/* WHY the description is set smaller than the rest of the table: it is the only column that
   wraps, so it alone decides how tall a row is -- and a six-line description made a row tall
   enough to lose the figures beside it. It is also the column a reviewer needs least, since
   the document it came from is open alongside. */
.po-genie-lines__desc {
    font-size: 11px;
    line-height: 1.35;
    color: #4b5563;
}

/* An item we resolved rather than cross-referenced. The number itself is the control, so the
   cell stays one line and the row keeps reading straight across. */
.po-genie-picked {
    /* Left, not centred: the number has to line up with the item number in the column beside
       it, and centring a two-line block would push it off. */
    display: inline-block;
    text-align: left;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    border-bottom: 1px dotted #9ca3af;
}

.po-genie-picked:hover {
    border-bottom-style: solid;
    border-bottom-color: var(--ast-global-color-3, #324b6b);
}

.po-genie-picked--unconfirmed {
    color: #92400e;
    border-bottom-color: #d97706;
}

/* WHY block, having once been inline: inline kept the cell one line so the item number sat
   level with the figures on the row, which mattered when a wrapping description made rows six
   lines tall. With the description set smaller the rows are short, and the mark now reads as a
   label belonging to the number above it rather than a word trailing off its end. */
.po-genie-picked-mark {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .8;
}

/* The open-PO count on the sidebar item. Sits at the end of the row so it reads as a count of
   what is behind the tab rather than part of its name. */
.sidebar-nav-badge {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0 .35rem;
    border-radius: .625rem;
    background: var(--ast-global-color-2, #f5821f);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
}

/* The search inside the change-item picker, under whatever the ranking offered. The rule is
   what says "or, if none of those are right" without a heading having to say it. */
.po-genie-suggest-search {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

/* WHY both lists are bounded rather than the dialog: five ranked candidates plus a search that
   can return many would push the acknowledgement and the buttons off an auto-height dialog. */
.po-genie-suggest-ranked,
.po-genie-search-results {
    max-height: 30vh;
    overflow-y: auto;
}

/* The action note in the filter header. Right-aligned so it reads as status for the pane rather
   than another control in the bar, and a compact pill because it shares a row with the filter
   pills and the search box. Hidden when empty, so it takes no space until there is something
   to say. */
.po-genie-filters .po-genie-submit-note {
    margin-left: auto;
    padding: 2px 10px;
    border: 0;
    border-radius: 10px;
    background: #eef2f7;
    color: #374151;
    font-size: 11px;
    font-weight: 600;
}

.po-genie-filters .po-genie-submit-note.is-success {
    background: #ecfdf5;
    color: #065f46;
}

.po-genie-filters .po-genie-submit-note.is-error {
    background: #fef2f2;
    color: #991b1b;
}

/* The sum at the foot of the Total column. Navy on white rather than a filled bar: the header
   is the filled one, and two solid bars would frame the rows like a separate table.
   WHY no border-top: the last body row already carries the navy rule that used to close the
   table, and it now serves as the line above the total -- adding one here would double it. The
   bottom border moves down to this row, so the table still sits on something. */
.po-genie-lines__foot td {
    padding-top: 0.5rem;
    background-color: #fff;
    border-bottom: 1px solid var(--ast-global-color-3, #324b6b);
    color: var(--ast-global-color-3, #324b6b);
    font-weight: bold;
}

.po-genie-lines__foot td:first-child {
    text-align: right;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 11px;
}

/* A refusal that names a fault per line. It sits above the table rather than in the header,
   because it is a paragraph and the header is a row of controls -- and because the rows it is
   about, and that its entries jump to, are directly beneath it. */
.po-genie-problems {
    margin-bottom: 8px;
    padding: 8px 12px;
    border: 1px solid #fecaca;
    border-left: 3px solid #b91c1c;
    border-radius: 4px;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 12px;
}

.po-genie-problems strong {
    display: block;
    margin-bottom: 4px;
}

/* WHY bounded: a PO where most lines are at fault would push the table off the bottom of the
   pane with a list of reasons for a table nobody can see. */
.po-genie-problems .po-genie-submit-problems {
    margin: 0;
    padding-left: 18px;
    max-height: 22vh;
    overflow-y: auto;
}

/* ---------------------------------------------------------------------------
 * Inline number editing (quantity and price)
 *
 * Changing a quantity or a price is the commonest thing a reviewer does here, and it used to
 * cost a modal. The pencil now swaps the cell for a focused input; these rules keep that from
 * shifting the row, which is what makes it feel immediate rather than merely quicker.
 * ------------------------------------------------------------------------ */
.po-genie-inline {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    /* No min-width: with the quick-value buttons gone there is nothing to hold open, and
     * forcing one widened every Qty and Price column the moment a cell was edited. */
}

.po-genie-inline-input {
    width: 100%;
    padding: 0.15rem 0.3rem;
    font: inherit;
    text-align: right;
    border: 1px solid var(--ast-global-color-3, #324b6b);
    border-radius: 0;
    background: #fff;
}

.po-genie-inline-input:focus {
    outline: 2px solid var(--ast-global-color-6, #CCE6F4);
    outline-offset: 0;
}

.po-genie-inline-input:disabled {
    background: var(--ast-global-color-5, #e6e7e8);
}


/* Empty most of the time -- only a refused value writes to it -- and an empty <p> would
 * still reserve a line under every field it appears in. */
.po-genie-inline-hint:empty {
    display: none;
}

.po-genie-inline-hint {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: right;
    color: var(--ast-global-color-1, #555659);
}

/* The PO asked to ship somewhere the order is not going. Rare by design -- it only renders
 * when a document names a delivery address the matched account does not have -- so it can
 * afford to be loud. */
.po-genie-meta__warn dt {
    color: var(--ast-global-color-2, #F5821F);
}

.po-genie-meta__warn dd {
    border-left: 3px solid var(--ast-global-color-2, #F5821F);
    padding-left: 0.5rem;
}

/* A picker running in the right sidebar rather than a dialog. */
.po-genie-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.po-genie-panel .po-genie-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 12px;
    overflow-y: auto;
}

/* WHY the caps come off here: 30vh each exists so five candidates plus a search cannot push
   the Save button out of an auto-height dialog. A sidebar panel is a fixed-height column that
   scrolls as a whole, so the lists can simply be as long as they are -- which is the reason
   this picker is worth moving out of a modal at all. */
.po-genie-panel .po-genie-suggest-ranked,
.po-genie-panel .po-genie-search-results {
    max-height: none;
    overflow-y: visible;
}

/* The actions sit at the foot of the column rather than floating after the content, so Save is
   in the same place whether two candidates came back or eleven. */
.po-genie-panel .po-genie-picker-actions {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}
