/* ═══════════════════════════════════════════════════════════════
   EBRAMUS Pre-Order Manager — Frontend (Employee Portal)
   v5.0.0 — All rules scoped under #po-app for theme isolation
   Strategic !important on critical visual properties to defeat
   aggressive theme/page-builder resets.
═══════════════════════════════════════════════════════════════ */

/* ───── Root reset + design tokens ───── */
#po-app,
#po-app *,
#po-app *::before,
#po-app *::after {
    box-sizing: border-box !important;
}

#po-app {
    /* Tokens */
    --po-bg:           #F8FAFC;
    --po-surface:      #FFFFFF;
    --po-border:       #E5E7EB;
    --po-border-light: #F1F5F9;
    --po-text:         #0F172A;
    --po-text-soft:    #475569;
    --po-text-mute:    #94A3B8;
    --po-primary:      #6366F1;
    --po-primary-d:    #4F46E5;
    --po-accent:       #8B5CF6;
    --po-green:        #10B981;
    --po-orange:       #F59E0B;
    --po-red:          #EF4444;
    --po-grey:         #9CA3AF;
    --po-black:        #374151;
    --po-shadow-sm:    0 1px 2px rgba(15,23,42,.06);
    --po-shadow:       0 4px 12px rgba(15,23,42,.08);
    --po-shadow-lg:    0 20px 50px rgba(15,23,42,.2);
    --po-radius:       10px;
    --po-radius-sm:    6px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: var(--po-text) !important;
    background: var(--po-bg) !important;
    border-radius: 14px;
    padding: 0;
    margin: 24px 0;
    overflow: hidden;
    box-shadow: var(--po-shadow);
}

/* Universal form reset inside the app */
#po-app input,
#po-app select,
#po-app textarea,
#po-app button {
    font-family: inherit !important;
    font-size: 14px !important;
    color: var(--po-text) !important;
    margin: 0 !important;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    box-sizing: border-box !important;
}
#po-app input[type=text],
#po-app input[type=tel],
#po-app input[type=email],
#po-app input[type=number],
#po-app input[type=password],
#po-app input[type=date],
#po-app select,
#po-app textarea {
    width: 100%;
    padding: 8px 10px !important;
    background: #FFFFFF !important;
    border: 1px solid var(--po-border) !important;
    border-radius: var(--po-radius-sm) !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: 36px !important;
    box-shadow: none !important;
    transition: border-color .15s, box-shadow .15s;
}
#po-app input:focus,
#po-app select:focus,
#po-app textarea:focus {
    border-color: var(--po-primary) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15) !important;
    outline: none !important;
}
#po-app textarea {
    min-height: 60px !important;
    resize: vertical;
}
#po-app .po-ro-fi {
    background: var(--po-border-light) !important;
    color: var(--po-text-soft) !important;
    cursor: not-allowed;
}
#po-app label {
    display: block;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--po-text-soft) !important;
    margin: 0 0 4px !important;
}
#po-app .po-req { color: var(--po-red); font-weight: 700; }
#po-app .po-hint {
    display: block;
    font-size: 11px !important;
    color: var(--po-text-mute) !important;
    margin-top: 3px;
    line-height: 1.3;
}
#po-app .po-mono { font-family: ui-monospace, Menlo, Consolas, monospace !important; letter-spacing: .02em; }
#po-app .po-num  { text-align: right; }
#po-app .po-mb   { margin-bottom: 14px !important; }
#po-app .po-mb4  { margin-bottom: 6px !important; }

/* Strip any inherited theme styling on internal headings */
#po-app h1, #po-app h2, #po-app h3 {
    color: var(--po-text) !important;
    font-family: inherit !important;
    border: 0 !important;
    text-transform: none !important;
    line-height: 1.3 !important;
    text-shadow: none !important;
    background: transparent !important;
}

/* SVG icons inherit color */
#po-app svg { color: inherit; display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   APP SHELL — Dark header section
═══════════════════════════════════════════════════════════════ */
#po-app .po-shell {
    background: linear-gradient(180deg, #0F172A, #1E293B);
    color: #F1F5F9 !important;
    padding: 0;
}

/* Header bar */
#po-app .po-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-wrap: wrap;
}
#po-app .po-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
#po-app .po-header-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--po-primary), var(--po-accent));
    color: #fff !important;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(99,102,241,.4);
}
#po-app .po-header-title {
    display: block;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #F1F5F9 !important;
    line-height: 1.2 !important;
    letter-spacing: .01em;
}
#po-app .po-header-sub {
    display: block;
    font-size: 11px !important;
    color: #94A3B8 !important;
    line-height: 1.2 !important;
    margin-top: 2px;
}

/* Stats strip */
#po-app .po-stats-strip {
    display: flex;
    gap: 28px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}
#po-app .po-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
#po-app .po-stat-n {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #F1F5F9 !important;
    line-height: 1.1 !important;
}
#po-app .po-stat-dep { color: #34D399 !important; }
#po-app .po-stat-bal { color: #F87171 !important; }
#po-app .po-prof-pos { color: #34D399 !important; }
#po-app .po-prof-neg { color: #F87171 !important; }
#po-app .po-stat-l {
    font-size: 10px !important;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94A3B8 !important;
    margin-top: 3px;
}

/* Header right side: user chip, tabs, new btn */
#po-app .po-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
#po-app .po-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: rgba(255,255,255,.08) !important;
    color: #E2E8F0 !important;
    border-radius: 999px;
    font-size: 12px !important;
    font-weight: 600;
}
#po-app .po-tab {
    background: rgba(255,255,255,.06) !important;
    color: #CBD5E1 !important;
    border: 1px solid transparent !important;
    padding: 7px 12px !important;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
}
#po-app .po-tab:hover {
    background: rgba(255,255,255,.12) !important;
    color: #F8FAFC !important;
}
#po-app .po-tab-on {
    background: linear-gradient(135deg, var(--po-primary), var(--po-accent)) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(99,102,241,.4);
}
#po-app .po-btn-add {
    background: linear-gradient(135deg, #10B981, #059669) !important;
    color: #fff !important;
    padding: 7px 13px !important;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px !important;
    font-weight: 700 !important;
    border: none !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(16,185,129,.35);
}
#po-app .po-btn-add:hover { transform: translateY(-1px); }

/* PIN bar */
#po-app .po-pin-bar {
    background: linear-gradient(90deg, #F59E0B, #D97706);
    color: #fff !important;
    padding: 11px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(0,0,0,.1);
}
#po-app .po-pin-bar-icon {
    background: rgba(255,255,255,.2);
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#po-app .po-pin-bar-text { flex: 1; font-size: 13px !important; }
#po-app .po-pin-bar-text strong { color: #FFFBEB; }
#po-app .po-pin-bar-row { display: flex; gap: 8px; align-items: center; }
#po-app .po-pin-input {
    width: 110px !important;
    padding: 7px 10px !important;
    min-height: 34px !important;
    border: 2px solid #FFFFFF !important;
    border-radius: var(--po-radius-sm) !important;
    background: #1F2937 !important;
    color: #FFFFFF !important;
    font-size: 16px !important;
    letter-spacing: 4px;
    text-align: center;
    font-weight: 700 !important;
}
#po-app .po-pin-input::placeholder { color: rgba(255,255,255,.55) !important; letter-spacing: normal; font-weight: 500; }
#po-app .po-pin-input:focus {
    background: #0F172A !important;
    border-color: #FCD34D !important;
    box-shadow: 0 0 0 3px rgba(252,211,77,.3) !important;
}
#po-app .po-btn-pin {
    background: rgba(255,255,255,.95) !important;
    color: #92400E !important;
    border: none !important;
    padding: 7px 12px !important;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    font-weight: 700 !important;
    font-size: 12px !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
#po-app .po-btn-pin:hover { background: #fff !important; }
#po-app .po-pin-msg {
    font-size: 12px !important;
    color: #FEF3C7 !important;
    font-weight: 600;
}
#po-app .po-pin-msg.po-ok  { color: #D1FAE5 !important; }
#po-app .po-pin-msg.po-err { color: #FECACA !important; }

/* Access bar (when unlocked / has cap) */
#po-app .po-access-bar {
    background: rgba(16,185,129,.15);
    color: #6EE7B7 !important;
    padding: 8px 20px;
    font-size: 12px !important;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

/* Controls (stage pills + filters) */
#po-app .po-controls {
    padding: 12px 20px;
    background: rgba(255,255,255,.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#po-app .po-stages-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
#po-app .po-stages {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
#po-app .po-stages-ext {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
#po-app .po-stage {
    background: rgba(255,255,255,.06) !important;
    color: #CBD5E1 !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    padding: 6px 12px !important;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
}
#po-app .po-stage:hover {
    background: rgba(255,255,255,.12) !important;
    color: #F8FAFC !important;
}
#po-app .po-stage-active {
    background: rgba(255,255,255,.95) !important;
    color: #0F172A !important;
    border-color: transparent !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
#po-app .po-stage-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
#po-app .po-stage-ct {
    background: rgba(0,0,0,.18);
    color: inherit;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px !important;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}
#po-app .po-stage-active .po-stage-ct { background: rgba(99,102,241,.15); color: var(--po-primary-d) !important; }

#po-app .po-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
#po-app .po-search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 340px;
}
#po-app .po-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748B !important;
    pointer-events: none;
    z-index: 2;
    display: flex;
    align-items: center;
}
#po-app .po-search-inp {
    padding-left: 12px !important;
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    color: #0F172A !important;
    font-weight: 500 !important;
    text-indent: 0 !important;
}
#po-app .po-search-inp::placeholder {
    color: #94A3B8 !important;
    font-weight: 400 !important;
    text-indent: 0 !important;
}
#po-app .po-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    color: #94A3B8 !important;
    cursor: pointer;
    padding: 4px 7px !important;
    font-size: 14px !important;
    line-height: 1 !important;
}
#po-app .po-sel {
    width: auto !important;
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    color: #0F172A !important;
    min-width: 130px;
    font-weight: 500 !important;
}
#po-app .po-btn-reset {
    background: rgba(239,68,68,.15) !important;
    color: #FCA5A5 !important;
    border: 1px solid rgba(239,68,68,.3) !important;
    padding: 8px 12px !important;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
#po-app .po-btn-reset:hover {
    background: rgba(239,68,68,.25) !important;
    color: #FECACA !important;
}

/* ═══════════════════════════════════════════════════════════════
   VIEWS (orders / report)
═══════════════════════════════════════════════════════════════ */
#po-app .po-view {
    background: var(--po-bg);
    padding: 16px;
    min-height: 200px;
}

/* Empty state */
#po-app .po-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--po-text-mute) !important;
}
#po-app .po-empty svg { color: var(--po-text-mute) !important; opacity: .5; }
#po-app .po-empty p {
    margin: 14px 0 18px !important;
    font-size: 15px !important;
    color: var(--po-text-soft) !important;
}

/* ═══════════════════════════════════════════════════════════════
   ORDER CARDS
═══════════════════════════════════════════════════════════════ */
#po-app .po-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#po-app .po-card {
    position: relative;
    background: var(--po-surface) !important;
    border: 1px solid var(--po-border) !important;
    border-radius: var(--po-radius);
    box-shadow: var(--po-shadow-sm);
    overflow: hidden;
    transition: transform .12s, box-shadow .12s;
}
#po-app .po-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--po-shadow);
}
#po-app .po-card-stripe {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--po-grey);
}
#po-app .po-c-grey   .po-card-stripe { background: var(--po-grey); }
#po-app .po-c-orange .po-card-stripe { background: var(--po-orange); }
#po-app .po-c-green  .po-card-stripe { background: var(--po-green); }
#po-app .po-c-red    .po-card-stripe { background: var(--po-red); }
#po-app .po-c-black  .po-card-stripe { background: var(--po-black); }

/* Subtle status tint */
#po-app .po-c-grey   { background: linear-gradient(90deg, #F8FAFC, #FFFFFF 30%) !important; }
#po-app .po-c-orange { background: linear-gradient(90deg, #FFFBEB, #FFFFFF 30%) !important; }
#po-app .po-c-green  { background: linear-gradient(90deg, #ECFDF5, #FFFFFF 30%) !important; }
#po-app .po-c-red    { background: linear-gradient(90deg, #FEF2F2, #FFFFFF 30%) !important; }
#po-app .po-c-black  { background: linear-gradient(90deg, #F1F5F9, #FFFFFF 30%) !important; }

#po-app .po-card-content {
    padding: 12px 14px 12px 22px;
}

/* Row A: IDs + date + actions */
#po-app .po-row-a {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
#po-app .po-row-a-left {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}
#po-app .po-row-a-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
#po-app .po-ordno {
    background: linear-gradient(135deg, var(--po-primary), var(--po-accent));
    color: #fff !important;
    padding: 3px 8px !important;
    border-radius: 5px;
    font-weight: 700 !important;
    font-size: 12px !important;
    font-family: ui-monospace, Menlo, Consolas, monospace !important;
    letter-spacing: .02em;
}
#po-app .po-tag {
    padding: 2px 7px !important;
    border-radius: 4px;
    font-size: 11px !important;
    font-weight: 600 !important;
    border: 1px solid;
    line-height: 1.4 !important;
}
#po-app .po-tag-src { background: #F1F5F9; color: var(--po-text); border-color: #CBD5E1; font-family: ui-monospace, Menlo, monospace !important; letter-spacing: .04em; }
#po-app .po-tag-ref { background: #FEF3C7; color: #92400E; border-color: #FCD34D; font-family: ui-monospace, Menlo, monospace !important; }
#po-app .po-tag-ebr { background: #DBEAFE; color: #1E40AF; border-color: #93C5FD; font-family: ui-monospace, Menlo, monospace !important; }
#po-app .po-tag-qty { background: #F3E8FF; color: #6B21A8; border-color: #D8B4FE; }

#po-app .po-card-date {
    font-size: 12px !important;
    color: var(--po-text-mute) !important;
    font-weight: 500;
}

#po-app .po-act-btns {
    display: flex;
    gap: 4px;
}
#po-app .po-act {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,.95) !important;
    border: 1px solid var(--po-border) !important;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--po-text-soft) !important;
    padding: 0 !important;
    transition: all .12s;
}
#po-app .po-act:hover { background: #fff !important; transform: translateY(-1px); box-shadow: var(--po-shadow-sm); }
#po-app .po-act-qe:hover  { color: #6366F1 !important; border-color: #C7D2FE !important; }
#po-app .po-act-fe:hover  { color: #0891B2 !important; border-color: #67E8F9 !important; }
#po-app .po-act-del:hover { color: #EF4444 !important; border-color: #FCA5A5 !important; }

/* Row B: item + customer */
#po-app .po-row-b {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--po-border-light);
}
#po-app .po-item-block { min-width: 0; }
#po-app .po-item-name {
    font-weight: 600 !important;
    color: var(--po-text) !important;
    font-size: 13.5px !important;
    line-height: 1.4 !important;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}
#po-app .po-item-codes {
    display: flex;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
}
#po-app .po-item-codes code {
    background: #F1F5F9 !important;
    color: #475569 !important;
    padding: 1px 5px !important;
    border-radius: 3px;
    font-size: 10px !important;
    font-family: ui-monospace, Menlo, monospace !important;
    border: 1px solid var(--po-border) !important;
}
#po-app .po-cust-block {
    text-align: right;
}
#po-app .po-cust-name {
    font-weight: 600 !important;
    color: var(--po-text) !important;
    font-size: 13px !important;
    display: block;
}
#po-app .po-cust-phone {
    font-size: 11px !important;
    color: var(--po-text-mute) !important;
    font-family: ui-monospace, Menlo, monospace !important;
    display: block;
    margin-top: 1px;
}

/* Row C: financials — 5 equal columns, clean single row */
#po-app .po-row-c {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    align-items: start;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--po-border-light);
    margin-bottom: 10px;
}
#po-app .po-fin {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
#po-app .po-fin-lbl {
    font-size: 10px !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--po-text-mute) !important;
    font-weight: 600 !important;
    line-height: 1.2;
}
#po-app .po-fin-val {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--po-text) !important;
    line-height: 1.15;
    font-family: ui-monospace, Menlo, Consolas, monospace !important;
}
#po-app .po-v-pur  .po-fin-val { color: var(--po-orange) !important; }
#po-app .po-v-dep  .po-fin-val { color: var(--po-green)  !important; }
#po-app .po-v-bal  .po-fin-val { color: var(--po-red)    !important; }
#po-app .po-fin-sub {
    font-size: 10.5px !important;
    color: var(--po-text-mute) !important;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#po-app .po-fin-nil { color: var(--po-text-mute) !important; }
#po-app .po-paid-chip {
    display: inline-block;
    background: #D1FAE5;
    color: #065F46;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px !important;
    font-weight: 700;
    border: 1px solid #6EE7B7;
    width: fit-content;
}
#po-app .po-masked-val {
    font-family: ui-monospace, Menlo, monospace !important;
    font-weight: 700 !important;
    color: var(--po-text-mute) !important;
    letter-spacing: 3px;
    font-size: 15px !important;
}
#po-app .po-fin-hidden { opacity: .55; }

/* Row D: badges + by */
#po-app .po-row-d {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
#po-app .po-badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}
#po-app .po-badge {
    display: inline-block;
    padding: 2px 8px !important;
    border-radius: 999px;
    font-size: 10.5px !important;
    font-weight: 600 !important;
    border: 1px solid;
    line-height: 1.4 !important;
}
#po-app .po-badge-sm { font-size: 9.5px !important; padding: 1px 6px !important; }
#po-app .po-badge-date {
    background: #F1F5F9 !important;
    color: var(--po-text-mute) !important;
    border: 1px solid var(--po-border) !important;
    padding: 1px 6px !important;
    border-radius: 4px;
    font-size: 10px !important;
}
#po-app .po-card-by {
    font-size: 10.5px !important;
    color: var(--po-text-mute) !important;
    font-style: italic;
}

/* Header SELL stat tone */
#po-app .po-stat-sell { color: #38BDF8 !important; }

/* Lock button in access bar */
#po-app .po-access-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}
#po-app .po-access-msg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#po-app .po-btn-lock {
    background: rgba(255,255,255,.1) !important;
    color: #D1FAE5 !important;
    border: 1px solid rgba(255,255,255,.2) !important;
    padding: 5px 11px !important;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    font-size: 11px !important;
    font-weight: 600 !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all .15s;
}
#po-app .po-btn-lock:hover {
    background: rgba(255,255,255,.2) !important;
    color: #fff !important;
}

/* Quick-markup widget */
#po-app .po-quickmark {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: linear-gradient(90deg, #FAF5FF, #EEF2FF) !important;
    border: 1px dashed #C7D2FE;
    border-radius: var(--po-radius-sm);
    padding: 10px 12px;
    margin-bottom: 12px;
}
#po-app .po-quickmark-l {
    font-size: 11px !important;
    text-transform: uppercase;
    font-weight: 700 !important;
    letter-spacing: .05em;
    color: var(--po-primary-d) !important;
}
#po-app .po-quickmark-formula {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px !important;
    color: var(--po-text-soft) !important;
    font-weight: 500;
}
#po-app .po-quickmark-inp {
    width: 64px !important;
    text-align: center;
    padding: 4px 6px !important;
    min-height: 28px !important;
    font-weight: 700 !important;
    color: var(--po-primary-d) !important;
    border-color: #C7D2FE !important;
    background: #fff !important;
}
#po-app .po-quickmark-hint {
    font-size: 11px !important;
    color: var(--po-text-mute) !important;
    font-style: italic;
}

/* New 4-column grid */
#po-app .po-fg4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { #po-app .po-fg4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { #po-app .po-fg4 { grid-template-columns: 1fr; } }

/* List footer */
#po-app .po-list-footer {
    background: var(--po-surface);
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius);
    padding: 10px 14px;
    margin-top: 12px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px !important;
    color: var(--po-text-soft) !important;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-list-footer strong { color: var(--po-text) !important; }
#po-app .po-fts { color: var(--po-text-mute) !important; }

/* ═══════════════════════════════════════════════════════════════
   INLINE QUICK-EDIT PANEL
═══════════════════════════════════════════════════════════════ */
#po-app .po-qe {
    background: linear-gradient(180deg, #EEF2FF, #FFFFFF) !important;
    border: 2px solid #C7D2FE !important;
    border-radius: var(--po-radius);
    margin-top: 2px;
    margin-bottom: 4px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(99,102,241,.15);
}
#po-app .po-qe-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--po-primary), var(--po-accent));
    color: #fff !important;
}
#po-app .po-qe-headleft {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px !important;
    font-weight: 600;
}
#po-app .po-qe-customer { color: rgba(255,255,255,.85) !important; font-weight: 400; }
#po-app .po-qe-x {
    background: rgba(255,255,255,.15) !important;
    color: #fff !important;
    border: none !important;
    width: 28px;
    height: 28px;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}
#po-app .po-qe-x:hover { background: rgba(255,255,255,.25) !important; }

#po-app .po-qe-body { padding: 14px; }
#po-app .po-qe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
#po-app .po-qe-group {
    background: rgba(255,255,255,.7);
    border: 1px solid #E0E7FF;
    border-radius: var(--po-radius-sm);
    padding: 10px;
}
#po-app .po-qe-group-ttl {
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--po-primary-d) !important;
    display: block;
    margin-bottom: 8px;
}
#po-app .po-qef { margin-bottom: 8px; }
#po-app .po-qef:last-child { margin-bottom: 0; }
#po-app .po-qe-summary {
    background: rgba(255,255,255,.7);
    border: 1px dashed #C7D2FE;
    border-radius: var(--po-radius-sm);
    padding: 8px 12px;
    margin-top: 12px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px !important;
    color: var(--po-text-soft) !important;
}
#po-app .po-qe-summary strong { color: var(--po-text) !important; }
#po-app .po-qe-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 10px;
}
#po-app .po-qe-note {
    font-size: 11px !important;
    color: var(--po-text-mute) !important;
    font-style: italic;
}
#po-app .po-qe-fbtns { display: flex; gap: 6px; }

/* Prefix input for $ */
#po-app .po-pfx-w { position: relative; }
#po-app .po-pfx {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--po-text-mute) !important;
    font-weight: 700;
    font-size: 13px !important;
    pointer-events: none;
}
#po-app .po-pfxinp { padding-left: 24px !important; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
#po-app .po-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px !important;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: 1px solid transparent !important;
    text-decoration: none !important;
    transition: all .12s;
    line-height: 1.3 !important;
}
#po-app .po-btn-sm { padding: 6px 11px !important; font-size: 12px !important; }
#po-app .po-btn-primary {
    background: linear-gradient(135deg, var(--po-primary), var(--po-accent)) !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(99,102,241,.35);
}
#po-app .po-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(99,102,241,.45); }
#po-app .po-btn-ghost {
    background: var(--po-surface) !important;
    color: var(--po-text-soft) !important;
    border-color: var(--po-border) !important;
}
#po-app .po-btn-ghost:hover { background: #F8FAFC !important; }
#po-app .po-btn-outline {
    background: transparent !important;
    color: var(--po-primary-d) !important;
    border-color: #C7D2FE !important;
}
#po-app .po-btn-outline:hover { background: #EEF2FF !important; }
#po-app .po-btn-danger {
    background: var(--po-red) !important;
    color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════════
   FULL EDIT MODAL
═══════════════════════════════════════════════════════════════ */
#po-app .po-overlay {
    position: fixed !important;
    inset: 0;
    background: rgba(15,23,42,.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 30px 16px;
    overflow-y: auto;
}
#po-app .po-modal {
    background: var(--po-surface) !important;
    width: 100%;
    max-width: 920px;
    border-radius: 14px;
    box-shadow: var(--po-shadow-lg);
    overflow: hidden;
    animation: po-modal-in .2s ease;
}
@keyframes po-modal-in {
    from { opacity: 0; transform: translateY(-15px); }
    to   { opacity: 1; transform: translateY(0); }
}
#po-app .po-modal-head {
    background: linear-gradient(135deg, #0F172A, #1E293B);
    color: #fff !important;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#po-app .po-modal-title {
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: 10px;
}
#po-app .po-modal-status {
    font-size: 11px !important;
    background: rgba(255,255,255,.15);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
}
#po-app .po-modal-x {
    background: rgba(255,255,255,.1) !important;
    border: none !important;
    color: #fff !important;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}
#po-app .po-modal-x:hover { background: rgba(255,255,255,.2) !important; }

#po-app .po-modal-body { padding: 18px; }
#po-app .po-modal-cols {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 18px;
}
@media (max-width: 880px) {
    #po-app .po-modal-cols { grid-template-columns: 1fr; }
}

#po-app .po-msec {
    background: #F8FAFC !important;
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius);
    padding: 12px;
    margin-bottom: 12px;
}
#po-app .po-msec-last { margin-bottom: 0; }
#po-app .po-msec-label {
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--po-primary-d) !important;
    margin-bottom: 10px;
}
#po-app .po-mf { margin-bottom: 0; }
#po-app .po-fg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#po-app .po-fg3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 540px) {
    #po-app .po-fg2, #po-app .po-fg3 { grid-template-columns: 1fr; }
}

#po-app .po-qty-tag {
    background: var(--po-primary);
    color: #fff !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px !important;
    font-weight: 700;
    margin-left: 8px;
}

/* Pricing flow */
#po-app .po-pricing {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
}
#po-app .po-pb {
    flex: 1;
    min-width: 180px;
    padding: 10px;
    border-radius: var(--po-radius-sm);
    background: var(--po-surface);
    border: 1px solid;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-pb-buy    { border-color: #FCD34D; background: #FFFBEB !important; }
#po-app .po-pb-sell   { border-color: #6EE7B7; background: #ECFDF5 !important; }
#po-app .po-pb-profit { border-color: #C7D2FE; background: #EEF2FF !important; }
#po-app .po-pb-label {
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--po-text-soft) !important;
    display: block;
    margin-bottom: 6px;
}
#po-app .po-parrow {
    align-self: center;
    font-size: 18px;
    color: var(--po-text-mute);
    font-weight: 700;
}
#po-app .po-pcalc { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
#po-app .po-pcr {
    display: flex;
    justify-content: space-between;
    font-size: 11px !important;
    color: var(--po-text-soft) !important;
}
#po-app .po-pcr b { color: var(--po-text) !important; font-family: ui-monospace, Menlo, monospace !important; }
#po-app .po-pcr-tot {
    border-top: 1px dashed var(--po-border);
    padding-top: 4px;
    margin-top: 2px;
    font-weight: 700;
    font-size: 13px !important;
}
#po-app .po-pcr-tot span { color: var(--po-text) !important; }
#po-app .po-profit-disp { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 80px; }
#po-app .po-profit-disp b {
    font-size: 22px !important;
    font-weight: 800 !important;
    color: var(--po-primary-d) !important;
}
#po-app .po-profit-disp b.po-prof-pos { color: #10B981 !important; }
#po-app .po-profit-disp b.po-prof-neg { color: #EF4444 !important; }
#po-app .po-profit-disp small { font-size: 11px !important; color: var(--po-text-soft) !important; margin-top: 3px; }

/* Delivery status grid */
#po-app .po-del-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
}
#po-app .po-delopt {
    display: flex !important;
    align-items: center;
    gap: 6px;
    padding: 6px 9px !important;
    border-radius: var(--po-radius-sm);
    background: var(--po-bg) !important;
    border: 1px solid var(--po-border) !important;
    cursor: pointer;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--po-text-soft) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    margin: 0 !important;
    transition: all .12s;
}
#po-app .po-delopt:hover { background: #F1F5F9 !important; }
#po-app .po-delopt input { margin: 0 !important; accent-color: var(--bc); }
#po-app .po-delopt:has(input:checked) {
    background: var(--bg) !important;
    border-color: var(--bc) !important;
    color: var(--fc) !important;
    font-weight: 700 !important;
}

/* Modal foot */
#po-app .po-modal-msg { padding: 0 4px; }
#po-app .po-modal-foot {
    background: #F8FAFC !important;
    border-top: 1px solid var(--po-border);
    padding: 12px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 18px -18px -18px;
}

/* Form messages */
#po-app .po-msg-err,
#po-app .po-msg-ok {
    padding: 9px 12px;
    border-radius: var(--po-radius-sm);
    font-size: 13px !important;
    margin: 10px 0;
    font-weight: 500;
}
#po-app .po-msg-err { background: #FEE2E2; color: #991B1B !important; border: 1px solid #FCA5A5; }
#po-app .po-msg-ok  { background: #D1FAE5; color: #065F46 !important; border: 1px solid #6EE7B7; }

/* ═══════════════════════════════════════════════════════════════
   REPORT VIEW (employee-facing)
═══════════════════════════════════════════════════════════════ */
#po-app .po-report { display: flex; flex-direction: column; gap: 14px; }
#po-app .po-report-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--po-surface);
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius);
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-report-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--po-text) !important;
    display: flex;
    align-items: center;
    gap: 7px;
}
#po-app .po-report-picker { display: flex; gap: 6px; margin: 0 !important; }
#po-app .po-sel-sm { width: auto !important; min-height: 32px !important; padding: 4px 8px !important; }

#po-app .po-rep-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
#po-app .po-rkpi {
    background: var(--po-surface);
    border: 1px solid var(--po-border);
    border-left: 4px solid var(--c, var(--po-primary));
    border-radius: var(--po-radius);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-rkpi-icon {
    width: 36px;
    height: 36px;
    background: color-mix(in srgb, var(--c) 12%, transparent);
    color: var(--c) !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#po-app .po-rkpi-n {
    display: block;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--po-text) !important;
    line-height: 1.1;
}
#po-app .po-rkpi-l {
    display: block;
    font-size: 10.5px !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--po-text-mute) !important;
    margin-top: 2px;
}

#po-app .po-rep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}
#po-app .po-rep-card {
    background: var(--po-surface);
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius);
    padding: 14px;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-rep-ttl {
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--po-primary-d) !important;
    margin: 0 0 10px !important;
}

#po-app .po-mini-tbl {
    width: 100%;
    border-collapse: collapse;
}
#po-app .po-mini-tbl th,
#po-app .po-mini-tbl td {
    padding: 6px 7px !important;
    text-align: left;
    border-bottom: 1px solid var(--po-border-light);
    font-size: 12.5px !important;
    color: var(--po-text) !important;
    line-height: 1.4;
}
#po-app .po-mini-tbl th {
    background: #F8FAFC !important;
    color: var(--po-text-mute) !important;
    font-weight: 600 !important;
    font-size: 10.5px !important;
    text-transform: uppercase;
    letter-spacing: .05em;
}
#po-app .po-mini-tbl .po-num { text-align: right; }
#po-app .po-bar {
    background: #F1F5F9;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 2px;
}
#po-app .po-bar-fill { height: 100%; border-radius: 999px; }
#po-app .po-mini-tbl small { color: var(--po-text-mute); font-size: 10px !important; }
#po-app .po-rep-tbl-wrap { overflow-x: auto; }
#po-app .po-rep-tr td { font-size: 12px !important; }
#po-app .po-td-item { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#po-app .po-rep-totals { background: #F8FAFC; font-weight: 700; border-top: 2px solid var(--po-border); }
#po-app .po-rep-totals td { font-weight: 700 !important; font-size: 13px !important; }

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS (JS-injected)
═══════════════════════════════════════════════════════════════ */
.po-toast {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: #fff;
    border-radius: 10px;
    padding: 12px 18px;
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
    z-index: 999999;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid var(--po-primary);
    color: var(--po-text);
    animation: po-toast-in .25s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 360px;
}
.po-toast-ok  { border-left-color: #10B981; }
.po-toast-err { border-left-color: #EF4444; }
@keyframes po-toast-in {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    #po-app .po-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    #po-app .po-stats-strip {
        gap: 12px;
        justify-content: space-around;
    }
    #po-app .po-header-right { justify-content: space-between; }
    #po-app .po-search-wrap { max-width: none; }
    #po-app .po-row-b { grid-template-columns: 1fr; }
    #po-app .po-cust-block { text-align: left; }
    #po-app .po-list-footer { font-size: 11px !important; }
    #po-app .po-row-c { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 540px) {
    #po-app .po-row-c { grid-template-columns: repeat(2, 1fr); }
    #po-app .po-card-content { padding: 10px 12px 10px 18px; }
    #po-app .po-modal-body { padding: 12px; }
    #po-app .po-row-d { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════
   V3 ADDITIONS — pagination, daterange, multi-product, locked,
   employee report (admin-style), external links, mobile polish
═══════════════════════════════════════════════════════════════ */

/* Stats strip — masked when locked */
#po-app .po-stat-masked {
    color: rgba(255,255,255,.4) !important;
    letter-spacing: 4px;
    font-size: 16px !important;
}
#po-app .po-stat-locked .po-stat-l { opacity: .7; }

/* Filter bar row 2: daterange + per-page */
#po-app .po-filters-row2 {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255,255,255,.08);
}
#po-app .po-filter-spacer { flex: 1; min-width: 8px; }
#po-app .po-daterange {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
#po-app .po-daterange-lbl {
    color: #94A3B8 !important;
    display: inline-flex;
    align-items: center;
    margin-right: 2px;
}
#po-app .po-d-inp {
    min-width: 130px !important;
    min-height: 34px !important;
    color-scheme: light;
    background: #FFFFFF !important;
    color: #0F172A !important;
    border: 1px solid #CBD5E1 !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
}
#po-app .po-daterange-to {
    color: #94A3B8;
    font-weight: 700;
    font-size: 14px;
    padding: 0 2px;
}
#po-app .po-perpage-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}
#po-app .po-perpage-lbl {
    font-size: 11px !important;
    color: #94A3B8 !important;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
    white-space: nowrap;
}
#po-app .po-sel-sm {
    min-width: 70px !important;
    padding: 4px 8px !important;
    min-height: 30px !important;
}

/* External link buttons (Order Label / Invoices) */
#po-app .po-ext-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 11px !important;
    background: linear-gradient(135deg, #F59E0B, #D97706) !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
    border-radius: var(--po-radius-sm);
    font-size: 12px !important;
    font-weight: 700 !important;
    transition: all .15s;
    border: none !important;
    box-shadow: 0 2px 6px rgba(245,158,11,.3);
}
#po-app .po-ext-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #FBBF24, #F59E0B) !important;
    color: #fff !important;
}

/* Pagination */
#po-app .po-pagination {
    background: var(--po-surface);
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius);
    padding: 10px 14px;
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-page-btn {
    background: #fff !important;
    border: 1px solid var(--po-border) !important;
    padding: 6px 12px !important;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: var(--po-text-soft) !important;
    transition: all .12s;
}
#po-app .po-page-btn:hover:not(:disabled) {
    background: var(--po-primary) !important;
    color: #fff !important;
    border-color: var(--po-primary) !important;
}
#po-app .po-page-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}
#po-app .po-page-nums {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}
#po-app .po-page-num {
    background: #fff !important;
    border: 1px solid var(--po-border) !important;
    padding: 5px 10px !important;
    border-radius: var(--po-radius-sm);
    cursor: pointer;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--po-text-soft) !important;
    min-width: 30px;
    text-align: center;
    transition: all .12s;
}
#po-app .po-page-num:hover {
    background: #EEF2FF !important;
    color: var(--po-primary-d) !important;
}
#po-app .po-page-num.po-page-on {
    background: linear-gradient(135deg, var(--po-primary), var(--po-accent)) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 2px 6px rgba(99,102,241,.3);
}
#po-app .po-page-info {
    margin-left: auto;
    font-size: 12px !important;
    color: var(--po-text-mute) !important;
}

/* Locked footer markers */
#po-app .po-locked-inline {
    color: var(--po-text-mute) !important;
    font-weight: 600 !important;
    font-style: italic;
}

/* Locked pricing in modal */
#po-app .po-locked-pricing {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
}
#po-app .po-pb-locked {
    flex: 1;
    min-width: 180px;
    padding: 14px;
    border-radius: var(--po-radius-sm);
    background: linear-gradient(135deg, #F1F5F9, #E2E8F0) !important;
    border: 2px dashed #94A3B8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
#po-app .po-pb-locked .po-pb-label {
    color: #475569 !important;
    font-weight: 700 !important;
}
#po-app .po-locked-mask {
    font-size: 28px !important;
    letter-spacing: 6px;
    color: #94A3B8 !important;
    font-weight: 700 !important;
    font-family: ui-monospace, Menlo, monospace !important;
    margin: 8px 0;
}
#po-app .po-locked-mask-sm {
    font-size: 16px;
    letter-spacing: 3px;
    color: #94A3B8;
    font-weight: 700;
    font-family: ui-monospace, Menlo, monospace;
    padding: 8px 10px;
    background: #F1F5F9;
    border: 1px dashed #CBD5E1;
    border-radius: var(--po-radius-sm);
    text-align: center;
}
#po-app .po-pb-locked small {
    color: #64748B !important;
    font-size: 11px !important;
    font-style: italic;
}

/* Multi-product item sections */
#po-app .po-msec-action {
    float: right;
    text-transform: none;
    letter-spacing: 0;
}
#po-app .po-msec-extra {
    background: linear-gradient(180deg, #FEFCE8, #FFFFFF) !important;
    border: 1px dashed #FDE047 !important;
    position: relative;
}
#po-app .po-msec-extra .po-msec-label {
    color: #92400E !important;
}
#po-app .po-rm-item {
    color: #B91C1C !important;
    border-color: #FCA5A5 !important;
}
#po-app .po-rm-item:hover { background: #FEE2E2 !important; }
#po-app .po-extra-chip {
    display: inline-block;
    background: #F3E8FF;
    color: #6B21A8;
    border: 1px solid #D8B4FE;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    margin-left: 6px;
}
#po-app .po-locked-mini { opacity: .7; }

/* PIN modal for unlocking edit */
.po-pinmodal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.72);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.po-pinmodal {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--po-shadow-lg);
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: po-modal-in .2s ease;
}
.po-pinmodal-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    box-shadow: 0 6px 20px rgba(245,158,11,.4);
    font-size: 22px;
}
.po-pinmodal h3 {
    font-size: 17px;
    color: #0F172A;
    margin: 0 0 6px;
    font-weight: 700;
}
.po-pinmodal p {
    font-size: 13px;
    color: #64748B;
    margin: 0 0 18px;
}
.po-pinmodal-inp {
    width: 100%;
    padding: 12px 14px;
    font-size: 20px;
    text-align: center;
    letter-spacing: 8px;
    font-weight: 700;
    border: 2px solid #CBD5E1;
    border-radius: 8px;
    background: #F8FAFC;
    color: #0F172A;
    font-family: ui-monospace, Menlo, monospace;
    margin-bottom: 12px;
}
.po-pinmodal-inp::placeholder {
    letter-spacing: normal;
    color: #94A3B8;
    font-weight: 500;
}
.po-pinmodal-inp:focus {
    border-color: #F59E0B;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(245,158,11,.18);
    outline: none;
}
.po-pinmodal-msg {
    font-size: 12px;
    color: #DC2626;
    margin-bottom: 12px;
    min-height: 16px;
    font-weight: 600;
}
.po-pinmodal-msg.po-ok { color: #059669; }
.po-pinmodal-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.po-pinmodal-btn {
    padding: 9px 16px;
    border-radius: 7px;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .12s;
}
.po-pinmodal-btn-primary {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
}
.po-pinmodal-btn-primary:hover { transform: translateY(-1px); }
.po-pinmodal-btn-ghost {
    background: #fff;
    color: #475569;
    border-color: #CBD5E1;
}
.po-pinmodal-btn-ghost:hover { background: #F1F5F9; }

/* Employee report (matches admin styling) */
#po-app .po-rep-head {
    background: var(--po-surface);
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius);
    padding: 14px 16px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-rep-head-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
#po-app .po-rep-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--po-primary), var(--po-accent));
    color: #fff !important;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#po-app .po-rep-h1 {
    display: block;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--po-text) !important;
    line-height: 1.2;
}
#po-app .po-rep-h2 {
    display: block;
    font-size: 12px !important;
    color: var(--po-text-mute) !important;
    line-height: 1.2;
    margin-top: 2px;
}
#po-app .po-rep-picker {
    display: flex;
    gap: 6px;
    margin: 0 !important;
}

/* KPI row reuses .po-rkpi defined earlier */
#po-app .po-rep-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
#po-app .po-rkpi-locked {
    opacity: .8;
    background: linear-gradient(135deg, #F8FAFC, #F1F5F9) !important;
}
#po-app .po-rkpi-locked .po-rkpi-icon {
    background: #E2E8F0 !important;
    color: #94A3B8 !important;
    font-size: 16px !important;
}

#po-app .po-rep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
#po-app .po-rep-card {
    background: var(--po-surface) !important;
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius);
    padding: 14px;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-rep-ttl {
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--po-primary-d) !important;
    margin: 0 0 10px !important;
    line-height: 1.2;
}
#po-app .po-rep-log .po-rep-tbl-wrap { overflow-x: auto; max-height: 60vh; }
#po-app .po-mini-tbl-log td { font-size: 12px !important; }
#po-app .po-rep-totals td { background: #F8FAFC; font-weight: 700; }

/* Mobile polish */
@media (max-width: 768px) {
    #po-app .po-header {
        padding: 12px 14px;
    }
    #po-app .po-stats-strip {
        gap: 10px !important;
        order: 2;
        width: 100%;
        justify-content: space-between !important;
    }
    #po-app .po-stat-n { font-size: 15px !important; }
    #po-app .po-stat-l { font-size: 9px !important; }
    #po-app .po-header-right {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        gap: 6px !important;
    }
    #po-app .po-header-right .po-tab,
    #po-app .po-header-right .po-btn-add {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    #po-app .po-user-chip { font-size: 11px !important; padding: 5px 8px !important; }
    #po-app .po-controls { padding: 10px 14px; }
    #po-app .po-stages { gap: 4px; }
    #po-app .po-stage { padding: 5px 10px !important; font-size: 11px !important; }
    #po-app .po-stage-ct { font-size: 9px !important; }
    #po-app .po-filters { gap: 6px; }
    #po-app .po-search-wrap { max-width: 100%; min-width: 100%; }
    #po-app .po-sel { min-width: 100px; font-size: 12px !important; }
    #po-app .po-filters-row2 { flex-wrap: wrap; }
    #po-app .po-daterange { width: 100%; justify-content: flex-start; }
    #po-app .po-d-inp { min-width: 0 !important; flex: 1; }
    #po-app .po-ext-btn { padding: 6px 9px !important; font-size: 11px !important; }
    #po-app .po-row-c { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    #po-app .po-row-d { flex-direction: column; align-items: flex-start; gap: 6px; }
    #po-app .po-pin-bar { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
    #po-app .po-pin-bar-text { width: 100%; font-size: 12px !important; }
    #po-app .po-pin-bar-row { width: 100%; }
    #po-app .po-pin-input { flex: 1; width: auto !important; }
    #po-app .po-list-footer { font-size: 11px !important; gap: 8px; }
    #po-app .po-modal { max-width: calc(100vw - 16px); margin: 8px; }
    #po-app .po-modal-body { padding: 12px; }
    #po-app .po-modal-cols { gap: 12px; }
    #po-app .po-fg2, #po-app .po-fg3, #po-app .po-fg4 { grid-template-columns: 1fr !important; }
    #po-app .po-pricing,
    #po-app .po-locked-pricing { flex-direction: column; }
    #po-app .po-parrow { transform: rotate(90deg); align-self: center; }
    #po-app .po-pb,
    #po-app .po-pb-locked { min-width: 0 !important; width: 100%; }
    #po-app .po-quickmark { flex-direction: column; align-items: stretch; }
    #po-app .po-quickmark-formula { font-size: 12px !important; }
    #po-app .po-rep-head { flex-direction: column; align-items: stretch; }
    #po-app .po-rep-picker { width: 100%; justify-content: stretch; }
    #po-app .po-rep-picker select { flex: 1; }
    #po-app .po-stat-locked { display: none; } /* hide locked masked stats on mobile */
    #po-app .po-row-a-right { flex-wrap: wrap; }
    #po-app .po-card-content { padding: 10px 10px 10px 16px; }
    #po-app .po-modal-foot { flex-wrap: wrap; }
    #po-app .po-modal-foot .po-btn { flex: 1; justify-content: center; min-width: 80px; }
}
@media (max-width: 480px) {
    #po-app .po-row-c { grid-template-columns: 1fr 1fr !important; }
    #po-app .po-stats-strip { gap: 6px !important; }
    #po-app .po-stats-strip .po-stat:nth-child(n+5) { display: none; } /* keep most important */
    #po-app .po-overlay { padding: 8px; align-items: flex-start; }
    #po-app .po-page-info { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   V3.1 ADDITIONS — alerts zone, per-item subtotals, controls reflow
═══════════════════════════════════════════════════════════════ */

/* Per-item quickmark (compact variant) */
#po-app .po-quickmark-mini {
    padding: 6px 10px !important;
    margin-bottom: 8px !important;
    background: linear-gradient(90deg, #FEF3C7, #FEF9E7) !important;
    border: 1px dashed #FCD34D !important;
}
#po-app .po-quickmark-mini .po-quickmark-l { font-size: 10px !important; }
#po-app .po-quickmark-mini .po-quickmark-formula { font-size: 11.5px !important; }
#po-app .po-quickmark-mini .po-quickmark-inp { width: 52px !important; min-height: 24px !important; padding: 2px 5px !important; font-size: 11px !important; }
#po-app .po-quickmark-mini .po-btn { padding: 4px 8px !important; font-size: 11px !important; min-height: 24px !important; }

/* Per-item subtotal strip */
#po-app .po-li-subtot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #F8FAFC;
    border-radius: 6px;
    border: 1px solid var(--po-border-light);
    font-size: 12px;
    color: var(--po-text-soft);
    flex-wrap: wrap;
}
#po-app .po-li-subtot strong {
    font-size: 14px !important;
    color: var(--po-text) !important;
    font-family: ui-monospace, Menlo, monospace !important;
}
#po-app .po-li-prof {
    font-size: 11.5px;
    font-weight: 600;
    font-family: ui-monospace, Menlo, monospace;
}

/* ═══ ALERT ZONE (reports) ═══ */
#po-app .po-alert-zone {
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7) !important;
    border: 2px solid #FCD34D !important;
    margin-bottom: 14px;
}
#po-app .po-alert-zone.po-alert-clear {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5) !important;
    border-color: #6EE7B7 !important;
}
#po-app .po-alert-ttl {
    color: #92400E !important;
    font-size: 14px !important;
    margin-bottom: 12px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
#po-app .po-alert-ttl-ok {
    color: #065F46 !important;
    font-size: 14px !important;
    margin: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
#po-app .po-alert-block {
    background: #fff;
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}
#po-app .po-alert-block summary {
    cursor: pointer;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--po-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    user-select: none;
}
#po-app .po-alert-block summary::-webkit-details-marker { display: none; }
#po-app .po-alert-block summary::before {
    content: '▶';
    font-size: 9px;
    margin-right: 8px;
    color: var(--po-text-mute);
    transition: transform .2s;
    display: inline-block;
}
#po-app .po-alert-block[open] summary::before { transform: rotate(90deg); }
#po-app .po-alert-summary-l { flex: 1; }
#po-app .po-alert-summary-ct {
    background: var(--po-red);
    color: #fff;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
}
#po-app .po-alert-red    { border-left: 4px solid #EF4444 !important; }
#po-app .po-alert-orange { border-left: 4px solid #F97316 !important; }
#po-app .po-alert-amber  { border-left: 4px solid #F59E0B !important; }
#po-app .po-alert-grey   { border-left: 4px solid #64748B !important; }
#po-app .po-alert-orange .po-alert-summary-ct { background: #F97316; }
#po-app .po-alert-amber .po-alert-summary-ct  { background: #F59E0B; }
#po-app .po-alert-grey .po-alert-summary-ct   { background: #64748B; }

#po-app .po-alert-tip {
    margin: 0 12px 8px !important;
    padding: 6px 10px;
    background: #F8FAFC;
    font-size: 11.5px;
    color: var(--po-text-mute);
    font-style: italic;
    border-radius: 4px;
}
#po-app .po-alert-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px dashed var(--po-border-light);
    gap: 12px;
    flex-wrap: wrap;
}
#po-app .po-alert-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1;
}
#po-app .po-alert-row-left strong {
    font-size: 12.5px;
    color: var(--po-primary-d);
    font-family: ui-monospace, Menlo, monospace;
}
#po-app .po-alert-row-cust {
    font-size: 12.5px;
    color: var(--po-text);
    font-weight: 500;
}
#po-app .po-alert-row-phone {
    background: #ECFDF5;
    color: #065F46 !important;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none !important;
    border: 1px solid #6EE7B7;
}
#po-app .po-alert-row-phone:hover { background: #D1FAE5; }
#po-app .po-alert-row-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11.5px;
    color: var(--po-text-mute);
}
#po-app .po-alert-row-extra {
    background: #F1F5F9;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--po-text-soft);
}
#po-app .po-alert-row-bal strong {
    color: var(--po-red) !important;
    font-family: ui-monospace, Menlo, monospace;
}

/* Report header: improved Apply button alignment */
#po-app .po-rep-picker {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 0 !important;
}
#po-app .po-rep-picker .po-btn-sm {
    padding: 6px 12px !important;
    min-height: 32px !important;
    font-size: 12px !important;
}

/* Mobile polish for new elements */
@media (max-width: 768px) {
    #po-app .po-stages-row { flex-direction: column; align-items: stretch; }
    #po-app .po-stages-ext { justify-content: stretch; }
    #po-app .po-stages-ext .po-ext-btn { flex: 1; justify-content: center; }
    #po-app .po-filters .po-filter-spacer { display: none; }
    #po-app .po-daterange { width: 100%; flex-wrap: wrap; }
    #po-app .po-d-inp { flex: 1; min-width: 0 !important; }
    #po-app .po-perpage-wrap { margin-left: 0; }
    #po-app .po-alert-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    #po-app .po-alert-row-right { width: 100%; justify-content: space-between; }
    #po-app .po-rep-picker { width: 100%; flex-wrap: wrap; }
    #po-app .po-rep-picker .po-fi { flex: 1; min-width: 100px; }
}

/* ═══════════════════════════════════════════════════════════════
   V3.2 ADDITIONS — Order Totals (sum), item pricing inside item card
═══════════════════════════════════════════════════════════════ */

/* When .po-pricing appears inside an item card, tighten it a notch */
#po-app .po-pricing-item .po-pb {
    padding: 10px;
}
#po-app .po-pricing-item .po-pb-label { font-size: 10.5px !important; }
#po-app .po-pricing-item .po-pcalc { font-size: 11px; }

/* ───── Order Totals section ───── */
#po-app .po-msec-totals {
    background: linear-gradient(135deg, #EEF2FF, #F5F3FF) !important;
    border: 2px solid #C7D2FE !important;
}
#po-app .po-msec-totals .po-msec-label {
    color: var(--po-primary-d) !important;
    font-weight: 700 !important;
}
#po-app .po-totals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: stretch;
}
#po-app .po-total-card {
    background: #fff;
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-total-card.po-total-buy    { border-left: 4px solid var(--po-orange); }
#po-app .po-total-card.po-total-sell   { border-left: 4px solid var(--po-green); }
#po-app .po-total-card.po-total-profit { border-left: 4px solid var(--po-primary); }
#po-app .po-total-card.po-total-locked {
    background: linear-gradient(135deg, #F1F5F9, #E2E8F0) !important;
    border-left: 4px solid #94A3B8 !important;
    align-items: center;
    justify-content: center;
}
#po-app .po-total-lbl {
    font-size: 11px !important;
    color: var(--po-text-mute) !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 700 !important;
}
#po-app .po-total-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#po-app .po-total-rows .po-pcr {
    display: flex;
    justify-content: space-between;
    font-size: 12px !important;
    color: var(--po-text-soft);
}
#po-app .po-total-rows .po-pcr b {
    font-family: ui-monospace, Menlo, monospace !important;
    color: var(--po-text);
}
#po-app .po-total-rows .po-pcr-tot {
    padding-top: 5px;
    margin-top: 3px;
    border-top: 1px dashed var(--po-border);
    font-weight: 700 !important;
}
#po-app .po-total-rows .po-pcr-tot b { font-size: 14px !important; }
#po-app .po-total-profit .po-profit-disp {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
#po-app .po-profit-big b {
    font-size: 22px !important;
    font-weight: 700 !important;
    font-family: ui-monospace, Menlo, monospace !important;
}
#po-app .po-profit-big small {
    font-size: 12px !important;
    color: var(--po-text-mute) !important;
    margin-top: 4px;
}

/* Mobile: stack totals to single column */
@media (max-width: 768px) {
    #po-app .po-totals-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   V3.2 — Alert grid (3 columns) + see-more modal
═══════════════════════════════════════════════════════════════ */

/* Replace old row layout with grid */
#po-app .po-alert-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 0 12px 12px;
}
#po-app .po-alert-card {
    background: #fff;
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: var(--po-shadow-sm);
    transition: transform .12s, box-shadow .12s;
}
#po-app .po-alert-card:hover { transform: translateY(-1px); box-shadow: var(--po-shadow); }
#po-app .po-alert-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
#po-app .po-alert-card-no {
    color: var(--po-primary-d) !important;
    font-family: ui-monospace, Menlo, monospace !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}
#po-app .po-alert-card-extra {
    background: #F1F5F9;
    color: var(--po-text-soft);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 500;
}
#po-app .po-alert-card-cust {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--po-text);
    line-height: 1.3;
}
#po-app .po-alert-card-phone {
    align-self: flex-start;
    background: #ECFDF5;
    color: #065F46 !important;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none !important;
    border: 1px solid #6EE7B7;
}
#po-app .po-alert-card-phone:hover { background: #D1FAE5; }
#po-app .po-alert-card-bal {
    font-size: 11.5px;
    color: var(--po-text-mute);
    padding-top: 4px;
    border-top: 1px dashed var(--po-border-light);
}
#po-app .po-alert-card-bal strong {
    color: var(--po-red) !important;
    font-family: ui-monospace, Menlo, monospace;
}

/* See more button */
#po-app .po-alert-more-btn {
    display: inline-block;
    margin: 0 12px 12px;
    padding: 7px 14px;
    background: transparent !important;
    border: 1px dashed var(--po-primary) !important;
    color: var(--po-primary-d) !important;
    border-radius: var(--po-radius-sm);
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all .12s;
}
#po-app .po-alert-more-btn:hover {
    background: var(--po-primary) !important;
    color: #fff !important;
    border-style: solid !important;
}

/* Alert "See more" modal */
.po-alert-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.72);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    animation: po-modal-in .15s ease;
}
.po-alert-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}
.po-alert-modal-head {
    padding: 16px 22px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: #F8FAFC;
}
.po-alert-modal-alert-red    .po-alert-modal-head { background: #FEF2F2; border-bottom-color: #FCA5A5; }
.po-alert-modal-alert-orange .po-alert-modal-head { background: #FFF7ED; border-bottom-color: #FDBA74; }
.po-alert-modal-alert-amber  .po-alert-modal-head { background: #FFFBEB; border-bottom-color: #FCD34D; }
.po-alert-modal-alert-grey   .po-alert-modal-head { background: #F1F5F9; border-bottom-color: #CBD5E1; }
.po-alert-modal-head h3 {
    margin: 0;
    font-size: 15px;
    color: #0F172A;
    font-weight: 700;
}
.po-alert-modal-close {
    background: rgba(0,0,0,.05);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #475569;
    transition: all .12s;
}
.po-alert-modal-close:hover { background: rgba(0,0,0,.12); }
.po-alert-modal-body {
    overflow-y: auto;
    padding: 16px 16px 20px;
    background: #fff;
}
.po-alert-modal-body .po-alert-grid {
    padding: 0;
    grid-template-columns: 1fr 1fr 1fr;
}
.po-alert-modal-body .po-alert-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* Mobile: stack alert cards on small screens */
@media (max-width: 900px) {
    #po-app .po-alert-grid { grid-template-columns: 1fr 1fr; }
    .po-alert-modal-body .po-alert-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    #po-app .po-alert-grid { grid-template-columns: 1fr; }
    .po-alert-modal-body .po-alert-grid { grid-template-columns: 1fr; }
}

/* Employee user ID styling */
#po-app .po-emp-uid {
    color: var(--po-text-mute) !important;
    font-family: ui-monospace, Menlo, monospace !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    margin-left: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   V3.3 ADDITIONS
   - Compact "Action Needed" summary bar
   - Order detail modal
   - Refund stat color
═══════════════════════════════════════════════════════════════ */

/* Refund stat */
#po-app .po-stat-refund { color: #A78BFA !important; }

/* Footer note */
#po-app .po-fts-note {
    color: var(--po-text-mute) !important;
    font-style: italic;
    font-size: 11px !important;
    cursor: help;
}

/* Compact summary bar */
#po-app .po-alert-summary-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7) !important;
    border: 2px solid #FCD34D !important;
    border-radius: var(--po-radius);
    color: #92400E !important;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    box-shadow: var(--po-shadow-sm);
}
#po-app .po-alert-summary-bar:hover {
    transform: translateY(-1px);
    box-shadow: var(--po-shadow);
    border-color: #F59E0B !important;
}
#po-app .po-alert-summary-bar.po-alert-summary-ok {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5) !important;
    border-color: #6EE7B7 !important;
    color: #065F46 !important;
    cursor: default;
}
#po-app .po-alert-summary-bar.po-alert-summary-ok:hover {
    transform: none;
    border-color: #6EE7B7 !important;
}
#po-app .po-alert-summary-icon {
    font-size: 20px;
    line-height: 1;
}
#po-app .po-alert-summary-text {
    flex: 1;
    font-size: 13.5px !important;
}
#po-app .po-alert-summary-text strong { font-weight: 700 !important; }
#po-app .po-alert-summary-chips {
    display: inline-flex;
    gap: 5px;
}
#po-app .po-alert-chip {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #fff !important;
    min-width: 22px;
    text-align: center;
}
#po-app .po-alert-chip.po-alert-red    { background: #EF4444; }
#po-app .po-alert-chip.po-alert-orange { background: #F97316; }
#po-app .po-alert-chip.po-alert-amber  { background: #F59E0B; }
#po-app .po-alert-chip.po-alert-grey   { background: #64748B; }
#po-app .po-alert-summary-cta {
    font-size: 12px !important;
    color: #92400E !important;
    font-weight: 600 !important;
    white-space: nowrap;
    opacity: .8;
}

/* Breakdown modal — looks like the original details inside */
.po-alert-modal-breakdown .po-alert-modal-body { padding: 16px; }
.po-alert-modal-inner .po-alert-block {
    background: #fff;
    border: 1px solid var(--po-border);
    border-radius: var(--po-radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
}
.po-alert-modal-inner .po-alert-block-head {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #0F172A;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
}
.po-alert-modal-inner .po-alert-block.po-alert-red    { border-left: 4px solid #EF4444; }
.po-alert-modal-inner .po-alert-block.po-alert-orange { border-left: 4px solid #F97316; }
.po-alert-modal-inner .po-alert-block.po-alert-amber  { border-left: 4px solid #F59E0B; }
.po-alert-modal-inner .po-alert-block.po-alert-grey   { border-left: 4px solid #64748B; }
.po-alert-modal-inner .po-alert-summary-ct {
    background: #EF4444;
    color: #fff;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
}
.po-alert-modal-inner .po-alert-block.po-alert-orange .po-alert-summary-ct { background: #F97316; }
.po-alert-modal-inner .po-alert-block.po-alert-amber  .po-alert-summary-ct { background: #F59E0B; }
.po-alert-modal-inner .po-alert-block.po-alert-grey   .po-alert-summary-ct { background: #64748B; }
.po-alert-modal-inner .po-alert-tip {
    margin: 0 12px 8px !important;
    padding: 6px 10px;
    background: #F8FAFC;
    font-size: 11.5px;
    color: #64748B;
    font-style: italic;
    border-radius: 4px;
}
.po-alert-modal-inner .po-alert-grid {
    padding: 0 12px 12px;
}
.po-alert-modal-inner .po-alert-more-btn {
    margin: 0 12px 12px;
    padding: 7px 14px;
    background: transparent;
    border: 1px dashed #6366F1;
    color: #4F46E5;
    border-radius: var(--po-radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s;
}
.po-alert-modal-inner .po-alert-more-btn:hover {
    background: #6366F1;
    color: #fff;
    border-style: solid;
}

/* Clickable alert cards */
#po-app .po-alert-card,
.po-alert-modal-inner .po-alert-card {
    cursor: pointer;
}
#po-app .po-alert-card-hint,
.po-alert-modal-inner .po-alert-card-hint {
    font-size: 10.5px;
    color: var(--po-primary-d);
    font-weight: 600;
    margin-top: 2px;
    opacity: 0;
    transition: opacity .12s;
}
#po-app .po-alert-card:hover .po-alert-card-hint,
.po-alert-modal-inner .po-alert-card:hover .po-alert-card-hint {
    opacity: .9;
}

/* ─── Order Detail Modal ─── */
.po-alert-modal-detail .po-alert-modal-body { padding: 18px; }
.po-od-loading,
.po-od-err {
    padding: 40px 24px;
    text-align: center;
    color: #64748B;
    font-size: 13px;
}
.po-od-err { color: #DC2626; }
.po-od-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.po-od-section {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 12px 14px;
}
.po-od-section h4 {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #4F46E5 !important;
    margin: 0 0 8px !important;
    padding-bottom: 6px;
    border-bottom: 1px dashed #CBD5E1;
}
.po-od-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 12.5px;
}
.po-od-row span:first-child {
    color: #64748B;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}
.po-od-row strong {
    color: #0F172A;
    font-weight: 600;
    text-align: right;
}
.po-od-items {
    grid-column: 1 / -1;
}
.po-od-item {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 12.5px;
}
.po-od-item:last-child { margin-bottom: 0; }
.po-od-item-desc {
    font-size: 11px !important;
    color: #4F46E5 !important;
    font-weight: 700 !important;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.po-od-item-codes {
    margin-top: 4px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.po-od-item-codes code {
    background: #EEF2FF;
    color: #4338CA;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-family: ui-monospace, Menlo, monospace;
}
.po-od-item-prices {
    margin-top: 6px;
    font-size: 11.5px;
    color: #64748B;
    font-family: ui-monospace, Menlo, monospace;
}
.po-od-money { background: linear-gradient(135deg, #FEFCE8, #FFFFFF); border-color: #FDE68A; }
.po-od-money strong { font-family: ui-monospace, Menlo, monospace !important; }
.po-od-notes { grid-column: 1 / -1; background: linear-gradient(135deg, #FDF4FF, #FAF5FF); border-color: #E9D5FF; }
.po-od-note-body {
    font-size: 12.5px;
    color: #0F172A;
    white-space: pre-wrap;
    line-height: 1.5;
}

@media (max-width: 700px) {
    .po-od-grid { grid-template-columns: 1fr; }
    #po-app .po-alert-summary-bar {
        flex-wrap: wrap;
    }
    #po-app .po-alert-summary-cta {
        flex-basis: 100%;
        text-align: right;
    }
}
