/*
 * RRV3 Sales Order Module - Styles.
 */

.rrv3-sales-order-module .rrv3-so-dashboard-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}
.rrv3-so-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.rrv3-so-status-badge,
.rrv3-so-alert-badge,
.rrv3-so-emergency-pill,
.rrv3-so-missing-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.rrv3-so-status-badge {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
}
.so-status-approved,
.so-status-completed {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.so-status-emergency-open,
.rrv3-so-emergency-pill {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fdba74;
}
.so-status-mismatch-pending-manager-approval {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
.rrv3-so-alert-badge {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.so-alert-quotation-pending,
.so-alert-po-pending,
.so-alert-both-pending,
.rrv3-so-missing-pill {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    margin-right: 4px;
}
.rrv3-so-emergency-widget {
    border-left: 4px solid #f97316;
}
.rrv3-so-form-shell {
    border: 1px dashed #93c5fd;
    border-radius: 14px;
    background: #eff6ff;
}

.rrv3-so-po-upload-panel {
    border-left: 4px solid #2563eb;
}
.rrv3-so-po-preview {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #ffffff;
}
.rrv3-so-po-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 14px;
    margin-bottom: 10px;
}
.rrv3-so-match-ok {
    color: #166534;
    font-weight: 800;
}
.rrv3-so-match-missing {
    color: #92400e;
    font-weight: 800;
}
.rrv3-so-po-lines-table td,
.rrv3-so-po-lines-table th {
    vertical-align: top;
    font-size: 12.5px;
}

.rrv3-so-po-link-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}
.rrv3-so-quote-picker-list {
    display: grid;
    gap: 8px;
    max-height: 420px;
    overflow: auto;
}
.rrv3-so-quote-picker-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
}
.rrv3-so-quote-picker-card span,
.rrv3-so-quote-picker-card small {
    display: block;
    color: #64748b;
    margin-top: 2px;
}
.rrv3-so-comparison-panel {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #ffffff;
}
.rrv3-so-comparison-summary {
    display: grid;
    gap: 5px;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 10px;
    background: #f8fafc;
}
.rrv3-so-comparison-table td,
.rrv3-so-comparison-table th {
    vertical-align: top;
    font-size: 12.5px;
}
.so-compare-matched td {
    background: #f0fdf4;
}
.so-compare-extra_in_po td,
.so-compare-missing_in_po td {
    background: #fffbeb;
}

.rrv3-selected-so-card {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
}
.rrv3-so-picker-list {
    display: grid;
    gap: 8px;
    max-height: 430px;
    overflow: auto;
}
.rrv3-so-picker-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
}
.rrv3-so-picker-card span,
.rrv3-so-picker-card small {
    display: block;
    margin-top: 2px;
    color: #64748b;
}

.rrv3-so-match-warning {
    color: #92400e;
    font-weight: 800;
}

.rrv3-so-client-picker-content {
    max-width: 880px;
}

.rrv3-so-client-empty-hint {
    color: #b91c1c;
    font-weight: 700;
    margin-top: 10px;
}

.rrv3-so-client-picker-list {
    display: grid;
    gap: 8px;
    max-height: 430px;
    overflow: auto;
}
.rrv3-so-client-picker-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
}
.rrv3-so-client-picker-card span {
    display: block;
    color: #64748b;
    margin-top: 2px;
}

/* Sales Order line item display */
.rrv3-so-items-table th,
.rrv3-so-items-table td {
    vertical-align: top;
}
.rrv3-so-items-table .rrv3-so-main-line .rrv3-so-item-col {
    text-align: center;
    font-weight: 800;
}
.rrv3-so-items-table .rrv3-so-sub-line .rrv3-so-item-col {
    text-align: right;
    font-weight: 400;
    color: #475569;
}
.rrv3-so-items-table .rrv3-so-desc-col {
    text-align: justify;
}
.rrv3-so-total-row td {
    background: #eff6ff;
}

/* Sales Order comparison status badges */
.rrv3-so-comparison-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.so-comparison-match {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.so-comparison-warning,
.so-comparison-mismatch {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

/* Sales Order linked requisitions */
.rrv3-so-linked-req-count {
    display: inline-flex;
    min-width: 28px;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #93c5fd;
}
.rrv3-so-linked-requisitions {
    border-left: 4px solid #2563eb;
}

/* Sales Order progress badges */
.rrv3-so-progress-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.so-progress-completed {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.so-progress-approval,
.so-progress-pet,
.so-progress-purchasing,
.so-progress-delivery,
.so-progress-in-progress {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}
.so-progress-issue {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.rrv3-so-closeout-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* Emergency Sales Order live timer */
.rrv3-so-live-timer {
    display: inline-flex;
    align-items: center;
    margin-top: 6px;
    border-radius: 999px;
    padding: 5px 10px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 0.02em;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}
.rrv3-so-live-timer::before {
    content: '⏱';
    margin-right: 5px;
}
.rrv3-so-live-timer-large {
    font-size: 16px;
    padding: 7px 13px;
}
.rrv3-so-timer-summary {
    border-left: 4px solid #ef4444 !important;
    background: #fff1f2 !important;
}
.rrv3-so-timer-complete {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 10px;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
    font-weight: 800;
}

/* Sales Order collapsible sections and next-step banner */
.rrv3-so-next-step-banner {
    margin: 12px 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #ffffff);
    color: #1e40af;
    font-weight: 800;
}
.rrv3-so-collapsible {
    padding: 0 !important;
    overflow: hidden;
}
.rrv3-so-collapsible > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    font-weight: 800;
    color: var(--rr-text);
    background: #f8fafc;
    border-bottom: 1px solid var(--rr-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.rrv3-so-collapsible > summary::-webkit-details-marker {
    display: none;
}
.rrv3-so-collapsible > summary::after {
    content: '▾';
    color: var(--rr-text-muted);
    transition: transform 0.15s ease;
}
.rrv3-so-collapsible:not([open]) > summary::after {
    transform: rotate(-90deg);
}
.rrv3-so-collapsible-body {
    padding: 16px 18px 18px;
}
html.rrv3-dark-mode .rrv3-so-next-step-banner {
    background: #0b2a4a;
    border-color: #1d4ed8;
    color: #dbeafe;
}
html.rrv3-dark-mode .rrv3-so-collapsible > summary {
    background: #1f2937;
    border-color: var(--rr-border);
}

/* Sales Order section header pastel treatment */
.rrv3-so-view-summary > summary {
    background: linear-gradient(135deg, #dbeafe, #eff6ff) !important;
    color: #1e40af !important;
}
.rrv3-so-details-section > summary {
    background: linear-gradient(135deg, #ede9fe, #f5f3ff) !important;
    color: #5b21b6 !important;
}
.rrv3-so-temp-po-section > summary {
    background: linear-gradient(135deg, #ffedd5, #fff7ed) !important;
    color: #9a3412 !important;
}
.rrv3-so-official-po-section > summary {
    background: linear-gradient(135deg, #dcfce7, #f0fdf4) !important;
    color: #166534 !important;
}
.rrv3-so-quotation-linkage-section > summary {
    background: linear-gradient(135deg, #fce7f3, #fdf2f8) !important;
    color: #9d174d !important;
}
.rrv3-so-linked-requisitions > summary {
    background: linear-gradient(135deg, #cffafe, #ecfeff) !important;
    color: #155e75 !important;
}
.rrv3-so-items-view > summary {
    background: linear-gradient(135deg, #e2e8f0, #f8fafc) !important;
    color: #334155 !important;
}
.rrv3-so-collapsible {
    margin-bottom: 16px !important;
    border: 1px solid #dbe3ef !important;
    border-radius: 16px !important;
}
.rrv3-so-collapsible > summary {
    font-size: 14px;
    letter-spacing: 0.01em;
}
.rrv3-so-collapsible-body > .rrv3-form-row,
.rrv3-so-po-preview-grid,
.rrv3-so-comparison-summary {
    gap: 14px 18px;
}
.rrv3-so-quotation-linkage-section .rrv3-so-po-link-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.rrv3-so-quotation-linkage-section #rrv3-so-po-matched-quote {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
html.rrv3-dark-mode .rrv3-so-collapsible > summary {
    filter: saturate(0.9) brightness(0.78);
}
html.rrv3-dark-mode .rrv3-so-quotation-linkage-section #rrv3-so-po-matched-quote {
    background: #111827;
    border-color: #334155;
}

.rrv3-so-picker-status {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}

/* Simplified Emergency Sales Order create form (desktop + mobile) */
.rrv3-so-emergency-quick-page {
    max-width: 920px;
    margin: 0 auto;
}
.rrv3-so-emergency-quick-card {
    border: 1px solid #fed7aa;
    border-radius: 22px;
    background: #fff7ed;
    box-shadow: 0 18px 45px rgba(154, 52, 18, 0.12);
    overflow: hidden;
}
.rrv3-so-emergency-quick-hero {
    padding: 22px 24px;
    background: linear-gradient(135deg, #fff7ed 0%, #fee2e2 100%);
    border-bottom: 1px solid #fed7aa;
}
.rrv3-so-emergency-quick-hero h2 {
    margin: 0 0 8px;
    color: #9a3412;
    font-size: 22px;
}
.rrv3-so-emergency-quick-hero p {
    margin: 0;
    color: #7c2d12;
    font-weight: 650;
    line-height: 1.45;
}
.rrv3-so-emergency-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 22px 24px 12px;
    background: #ffffff;
}
.rrv3-so-quick-full {
    grid-column: 1 / -1;
}
.rrv3-so-quick-customer-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.rrv3-so-quick-customer-row input {
    flex: 1;
}
.rrv3-so-rm-input {
    display: flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}
.rrv3-so-rm-input span {
    padding: 0 12px;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border-right: 1px solid #cbd5e1;
    color: #475569;
    font-weight: 900;
}
.rrv3-so-rm-input input {
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.rrv3-so-emergency-quick-note {
    margin: 0 24px 16px;
    padding: 12px 14px;
    border-left: 4px solid #f97316;
    border-radius: 12px;
    background: #fff7ed;
    color: #9a3412;
    font-weight: 700;
    line-height: 1.45;
}
.rrv3-so-quick-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 0;
    padding: 14px 24px 20px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #fed7aa;
    backdrop-filter: blur(10px);
}
.rrv3-so-quick-submit {
    min-height: 46px;
    font-size: 14px;
    padding-left: 18px;
    padding-right: 18px;
}
@media (max-width: 720px) {
    .rrv3-so-emergency-quick-page {
        max-width: none;
    }
    .rrv3-so-emergency-quick-card {
        border-radius: 16px;
    }
    .rrv3-so-emergency-quick-grid {
        grid-template-columns: 1fr;
        padding: 18px 16px 8px;
    }
    .rrv3-so-quick-customer-row {
        flex-direction: column;
        align-items: stretch;
    }
    .rrv3-so-emergency-quick-hero,
    .rrv3-so-quick-actions {
        padding-left: 16px;
        padding-right: 16px;
    }
    .rrv3-so-emergency-quick-note {
        margin-left: 16px;
        margin-right: 16px;
    }
    .rrv3-so-quick-actions .rrv3-button {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

/* SBU Head mobile-friendly Sales Order approval view */
.rrv3-so-sbu-review-page {
    max-width: 980px;
    margin: 0 auto;
    padding-bottom: 94px;
}
.rrv3-so-sbu-mobile-card {
    border: 1px solid #dbe3ef;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
    overflow: hidden;
}
.rrv3-so-sbu-review-hero {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 20px 22px;
    border-bottom: 1px solid #dbe3ef;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}
.rrv3-so-sbu-review-hero.is-emergency {
    background: linear-gradient(135deg, #fff7ed 0%, #fee2e2 100%);
    border-bottom-color: #fed7aa;
}
.rrv3-so-review-type-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 8px;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
    font-size: 11.5px;
    font-weight: 900;
}
.rrv3-so-sbu-review-hero.is-emergency .rrv3-so-review-type-pill {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
.rrv3-so-sbu-review-hero h2 {
    margin: 0 0 6px;
    font-size: 24px;
    color: #0f172a;
}
.rrv3-so-sbu-review-hero p {
    margin: 0;
    color: #475569;
    font-weight: 650;
    line-height: 1.4;
}
.rrv3-so-review-status {
    white-space: nowrap;
}
.rrv3-so-sbu-review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 18px 20px;
}
.rrv3-so-sbu-review-section {
    border: 1px solid #e5edf7;
    border-radius: 16px;
    background: #f8fafc;
    padding: 15px;
}
.rrv3-so-sbu-review-checklist {
    grid-column: 1 / -1;
}
.rrv3-so-sbu-review-section h3 {
    margin: 0 0 12px;
    color: #1a365d;
    font-size: 15px;
}
.rrv3-so-review-kv {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 7px 0;
    border-bottom: 1px solid #e5edf7;
}
.rrv3-so-review-kv:last-child {
    border-bottom: 0;
}
.rrv3-so-review-kv label {
    color: #64748b;
    font-size: 11.5px;
    font-weight: 900;
}
.rrv3-so-review-kv strong {
    color: #0f172a;
    font-size: 13px;
}
.rrv3-so-evidence-button {
    min-height: 44px;
    align-items: center;
}
.rrv3-so-review-warning {
    margin: 0;
    padding: 12px;
    border-radius: 12px;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 800;
}
.rrv3-so-sbu-review-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px 18px;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #dbe3ef;
    backdrop-filter: blur(10px);
}
.rrv3-so-sbu-review-actions .rrv3-button {
    min-height: 44px;
}
@media (max-width: 760px) {
    .rrv3-so-sbu-review-page {
        max-width: none;
        padding-bottom: 120px;
    }
    .rrv3-so-sbu-mobile-card {
        border-radius: 16px;
    }
    .rrv3-so-sbu-review-hero,
    .rrv3-so-sbu-review-grid,
    .rrv3-so-sbu-review-actions {
        padding-left: 14px;
        padding-right: 14px;
    }
    .rrv3-so-sbu-review-hero {
        flex-direction: column;
    }
    .rrv3-so-sbu-review-grid {
        grid-template-columns: 1fr;
    }
    .rrv3-so-review-kv {
        grid-template-columns: 1fr;
        gap: 3px;
    }
    .rrv3-so-sbu-review-actions .rrv3-button {
        flex: 1 1 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Emergency SO WhatsApp approval share panel */
.rrv3-so-emergency-share-panel {
    margin: 0 24px 22px;
    padding: 16px;
    border: 1px solid #bbf7d0;
    border-radius: 16px;
    background: #f0fdf4;
    box-shadow: 0 8px 22px rgba(22, 101, 52, 0.10);
}
.rrv3-so-emergency-share-panel h3 {
    margin: 0 0 8px;
    color: #166534;
}
.rrv3-so-emergency-share-panel p {
    margin: 6px 0;
}
.rrv3-so-share-message {
    margin: 12px 0;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    background: #ffffff;
    overflow: auto;
}
.rrv3-so-share-message pre {
    margin: 0;
    padding: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    color: #14532d;
}
.rrv3-so-share-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
@media (max-width: 720px) {
    .rrv3-so-emergency-share-panel {
        margin-left: 16px;
        margin-right: 16px;
    }
    .rrv3-so-share-actions .rrv3-button {
        width: 100%;
        justify-content: center;
    }
}

/* Sales Order WhatsApp approval token history */
.rrv3-so-token-history-panel {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
    border-radius: 14px;
    background: #eff6ff;
}
.rrv3-so-token-history-panel h4 {
    margin: 0 0 10px;
    color: #1e40af;
    font-size: 14px;
}
.rrv3-so-token-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px 14px;
}
.rrv3-so-token-history-grid label {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 3px;
}
.rrv3-so-token-history-grid strong {
    color: #0f172a;
    font-size: 12.5px;
}
.rrv3-so-token-expired {
    color: #b91c1c !important;
    font-weight: 800;
    margin-top: 10px;
}

/* Emergency escalation countdown */
.rrv3-so-emergency-deadlines {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.rrv3-so-deadline-card {
    border: 1px solid #fed7aa;
    border-left: 4px solid #f97316;
    border-radius: 14px;
    background: #fff7ed;
    padding: 12px 14px;
}
.rrv3-so-deadline-card label {
    display: block;
    color: #9a3412;
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.rrv3-so-deadline-card strong {
    display: block;
    font-size: 16px;
    color: #0f172a;
    margin-bottom: 4px;
}
.rrv3-so-deadline-card strong.is-overdue {
    color: #b91c1c;
}
.rrv3-so-deadline-card strong.is-complete {
    color: #166534;
}
.rrv3-so-deadline-card small {
    color: #7c2d12;
    font-size: 11.5px;
    line-height: 1.35;
}

/* Emergency attention widget on Sales Dashboard */
.rrv3-so-widget-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 12px;
}
.rrv3-so-widget-head h3 {
    margin: 0 0 4px;
    color: #9a3412;
}
.rrv3-so-attention-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}
.rrv3-so-attention-card {
    border: 1px solid #fed7aa;
    border-left: 4px solid #f97316;
    border-radius: 16px;
    background: #fff7ed;
    padding: 13px;
    box-shadow: 0 4px 14px rgba(154, 52, 18, 0.08);
}
.rrv3-so-attention-card.is-overdue {
    border-color: #fca5a5;
    border-left-color: #dc2626;
    background: #fef2f2;
}
.rrv3-so-attention-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}
.rrv3-so-attention-top > strong {
    color: #0f172a;
    font-size: 14px;
}
.rrv3-so-attention-customer {
    font-weight: 800;
    color: #7c2d12;
    margin-bottom: 3px;
}
.rrv3-so-attention-job {
    color: #475569;
    font-size: 12.5px;
    margin-bottom: 8px;
    line-height: 1.35;
}
.rrv3-so-attention-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0;
}
.rrv3-so-attention-deadlines {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0;
}
.rrv3-so-attention-deadlines div {
    background: #ffffff;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 8px;
}
.rrv3-so-attention-deadlines label {
    display: block;
    color: #92400e;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.rrv3-so-attention-deadlines span {
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
}
.rrv3-so-attention-deadlines span.is-overdue {
    color: #b91c1c;
}
.rrv3-so-attention-deadlines span.is-complete {
    color: #166534;
}
.rrv3-so-attention-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}
@media (max-width: 640px) {
    .rrv3-so-widget-head,
    .rrv3-so-attention-top {
        flex-direction: column;
    }
    .rrv3-so-attention-deadlines {
        grid-template-columns: 1fr;
    }
}

/* Create requisition shortcut from approved Sales Order */
.rrv3-so-shortcut-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5edf7;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

/* Sales Order cancellation display */
.rrv3-so-closeout-actions .rrv3-button-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}
.rrv3-so-closeout-actions .rrv3-button-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* Emergency paperwork completion checklist inside Sales Order summary */
.rrv3-so-view-summary .rrv3-approval-readiness {
    margin-top: 14px;
    border-left-color: #f97316;
    background: #fff7ed;
}
.rrv3-so-view-summary .rrv3-approval-readiness h3 {
    color: #9a3412;
}

/* Sales Order table field chooser */
.rrv3-so-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.rrv3-so-table-toolbar h3 {
    margin: 0;
}
.rrv3-so-column-chooser {
    position: relative;
    min-width: 210px;
    padding: 0;
}
.rrv3-so-column-chooser summary {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #1a365d;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.rrv3-so-column-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.10);
}
.rrv3-so-column-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}
.rrv3-so-column-options input[type="checkbox"] {
    width: auto;
    margin: 0;
}
.rrv3-so-col-hidden {
    display: none !important;
}
@media (max-width: 720px) {
    .rrv3-so-table-toolbar {
        flex-direction: column;
    }
    .rrv3-so-column-chooser {
        width: 100%;
    }
    .rrv3-so-column-chooser summary {
        width: 100%;
    }
}

/* Emergency Orders widget: keep max 3 cards per row with uniform card sizing */
.rrv3-so-emergency-widget .rrv3-so-attention-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}
.rrv3-so-emergency-widget .rrv3-so-attention-card {
    min-height: 230px;
    display: flex;
    flex-direction: column;
}
.rrv3-so-emergency-widget .rrv3-so-attention-deadlines {
    margin-top: auto;
}
.rrv3-so-emergency-widget .rrv3-so-attention-actions {
    margin-top: 10px;
}
@media (max-width: 1180px) {
    .rrv3-so-emergency-widget .rrv3-so-attention-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 720px) {
    .rrv3-so-emergency-widget .rrv3-so-attention-grid {
        grid-template-columns: 1fr;
    }
    .rrv3-so-emergency-widget .rrv3-so-attention-card {
        min-height: 0;
    }
}

/* Due date lines inside Emergency Orders attention widget */
.rrv3-so-attention-deadlines small {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 10.8px;
    font-weight: 700;
    line-height: 1.25;
}

/* Compact clickable emergency paperwork pills */
.rrv3-so-view-summary .rrv3-approval-readiness-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    align-items: stretch;
}
.rrv3-so-view-summary .rrv3-readiness-item {
    position: relative;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    width: min(100%, 310px);
    min-height: 76px;
    padding: 10px 12px;
    border-radius: 999px;
    cursor: default;
    box-shadow: 0 5px 14px rgba(249, 115, 22, .08);
}
.rrv3-so-view-summary .rrv3-readiness-item.is-clickable {
    cursor: pointer;
}
.rrv3-so-view-summary .rrv3-readiness-item.is-clickable:hover,
.rrv3-so-view-summary .rrv3-readiness-item.is-clickable:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .16);
    outline: none;
}
.rrv3-so-view-summary .rrv3-readiness-text {
    min-width: 0;
}
.rrv3-so-view-summary .rrv3-readiness-text strong {
    font-size: 13px;
    line-height: 1.2;
}
.rrv3-so-view-summary .rrv3-readiness-text small {
    font-size: 11px;
    line-height: 1.25;
}
.rrv3-so-view-summary .rrv3-readiness-arrow {
    color: #ea580c;
    font-weight: 1000;
    font-size: 18px;
}
.rrv3-so-scroll-highlight {
    animation: rrv3-so-target-pulse 1.4s ease-out 1;
}
@keyframes rrv3-so-target-pulse {
    0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, .34); }
    100% { box-shadow: 0 0 0 14px rgba(249, 115, 22, 0); }
}
@media (max-width: 640px) {
    .rrv3-so-view-summary .rrv3-approval-readiness-list {
        gap: 9px;
    }
    .rrv3-so-view-summary .rrv3-readiness-item {
        width: 100%;
        border-radius: 18px;
    }
}

/* Flow arrows between emergency paperwork pills + completed/pending colours */
.rrv3-so-view-summary .rrv3-approval-readiness-list {
    gap: 12px 34px;
}
.rrv3-so-view-summary .rrv3-readiness-item {
    grid-template-columns: 24px minmax(0, 1fr);
    overflow: visible;
}
.rrv3-so-view-summary .rrv3-readiness-item:not(:last-child)::after {
    content: "→";
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 22px;
    font-weight: 1000;
    pointer-events: none;
}
.rrv3-so-view-summary .rrv3-readiness-arrow {
    display: none;
}
.rrv3-so-view-summary .rrv3-readiness-item.is-ok {
    border-color: #86efac;
    background: #f0fdf4;
    box-shadow: 0 5px 14px rgba(22, 163, 74, .10);
}
.rrv3-so-view-summary .rrv3-readiness-item.is-ok .rrv3-readiness-text strong {
    color: #166534;
}
.rrv3-so-view-summary .rrv3-readiness-item.is-warning {
    border-color: #fbbf24;
    background: #fffbeb;
    box-shadow: 0 5px 14px rgba(245, 158, 11, .10);
}
@media (max-width: 640px) {
    .rrv3-so-view-summary .rrv3-approval-readiness-list {
        gap: 26px;
    }
    .rrv3-so-view-summary .rrv3-readiness-item:not(:last-child)::after {
        content: "↓";
        right: 50%;
        top: auto;
        bottom: -24px;
        transform: translateX(50%);
    }
}

/* Sales Order operational closeout readiness */
.rrv3-so-closeout-panel {
    margin: 16px 0;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid #dbeafe;
    border-left: 5px solid #2563eb;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 78%);
}
.rrv3-so-closeout-panel.is-ready {
    border-color: #bbf7d0;
    border-left-color: #16a34a;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 78%);
}
.rrv3-so-closeout-panel.has-blockers {
    border-color: #fed7aa;
    border-left-color: #f97316;
    background: linear-gradient(135deg, #fff7ed 0%, #ffffff 78%);
}
.rrv3-so-closeout-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.rrv3-so-closeout-head h3 {
    margin: 0 0 4px;
    color: #1e3a8a;
}
.rrv3-so-closeout-head p {
    margin: 0;
    color: #475569;
    font-weight: 700;
}
.rrv3-so-closeout-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    border: 1px solid #93c5fd;
    background: #dbeafe;
    color: #1e40af;
    white-space: nowrap;
}
.rrv3-so-closeout-badge.is-ready {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}
.rrv3-so-closeout-badge.has-blockers {
    border-color: #fdba74;
    background: #ffedd5;
    color: #9a3412;
}
.rrv3-so-closeout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 10px;
}
.rrv3-so-closeout-grid > div {
    padding: 10px 12px;
    border: 1px solid #e5edf7;
    border-radius: 13px;
    background: #ffffff;
}
.rrv3-so-closeout-grid label,
.rrv3-so-closeout-grid small {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 850;
}
.rrv3-so-closeout-grid strong {
    display: block;
    color: #0f172a;
    font-size: 20px;
    margin: 2px 0;
}
.rrv3-so-closeout-blockers {
    margin: 12px 0 0;
    padding-left: 20px;
    color: #9a3412;
    font-weight: 750;
}
.rrv3-so-closeout-ok {
    color: #166534 !important;
    font-weight: 800;
}
@media (max-width: 640px) {
    .rrv3-so-closeout-head {
        flex-direction: column;
    }
}

/* 1607-04: Sticky Sales Order action bar */
.rrv3-sales-order-page {
    padding-bottom: 92px;
}
.rrv3-so-sticky-action-bar {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 999;
    width: min(96vw, 1760px);
    transform: translateX(-50%);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 0;
    padding: 12px 22px 16px;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #dbeafe;
    box-shadow: 0 -10px 26px rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(10px);
}
.rrv3-so-sticky-action-main {
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rrv3-so-sticky-action-title {
    font-size: 11px;
    font-weight: 900;
    color: #64748b;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.rrv3-so-sticky-action-ref {
    font-size: 13px;
    font-weight: 900;
    color: #0f172a;
}
.rrv3-so-sticky-action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.rrv3-so-sticky-action-buttons .rrv3-button {
    min-height: 40px;
    margin: 0;
}
@media (max-width: 760px) {
    .rrv3-sales-order-page {
        padding-bottom: 150px;
    }
    .rrv3-so-sticky-action-bar {
        align-items: stretch;
        flex-direction: column;
        width: calc(100vw - 16px);
        padding: 12px 16px 16px;
    }
    .rrv3-so-sticky-action-buttons {
        justify-content: stretch;
    }
    .rrv3-so-sticky-action-buttons .rrv3-button {
        flex: 1 1 150px;
    }
}
html.rrv3-dark-mode .rrv3-so-sticky-action-bar {
    background: rgba(15, 23, 42, 0.97);
    border-top-color: #334155;
    box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.35);
}
html.rrv3-dark-mode .rrv3-so-sticky-action-title {
    color: #94a3b8;
}
html.rrv3-dark-mode .rrv3-so-sticky-action-ref {
    color: #e2e8f0;
}


/* 1607-05: Sales Order Customer Acceptance evidence */
.rrv3-so-acceptance-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    border: 1px solid transparent;
}
.rrv3-so-acceptance-badge.so-acceptance-ok {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}
.rrv3-so-acceptance-badge.so-acceptance-missing {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.rrv3-so-acceptance-current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #eff6ff;
}
.rrv3-so-signed-quote-wrap {
    margin-top: 10px;
    padding: 12px;
    border: 1px dashed #93c5fd;
    border-radius: 12px;
    background: #f8fbff;
}
html.rrv3-dark-mode .rrv3-so-acceptance-current,
html.rrv3-dark-mode .rrv3-so-signed-quote-wrap {
    background: #0f172a;
    border-color: #334155;
}

/* Chunk 2007-26: editable Customer PO extraction details */
.rrv3-so-po-edit-panel {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #f8fbff;
}
.rrv3-so-po-edit-panel h5 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 800;
    color: #1e3a8a;
}
.rrv3-so-po-edit-panel .rrv3-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Chunk 2007-31: Accounts invoice instruction draft generator */
.rrv3-so-accounts-instruction-section .rrv3-so-accounts-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0 14px;
}
.rrv3-so-accounts-instruction-output {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    min-height: 320px;
    white-space: pre;
}
.rrv3-so-accounts-instruction-section script {
    display: none !important;
}

/* Chunk 2007-32: progressive invoice by line item */
.rrv3-so-progressive-lines-field {
    margin: 10px 0 14px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}
.rrv3-so-progressive-lines-field h5 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 800;
    color: #1e3a8a;
}
.rrv3-so-invoice-lines-table td,
.rrv3-so-invoice-lines-table th {
    vertical-align: top;
}

/* Chunk 0708-43: Sales Order declutter and source-based line item tabs */
.rrv3-so-line-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 14px;
    border-bottom: 1px solid #e2e8f0;
}
.rrv3-so-line-tab {
    appearance: none;
    border: 1px solid #dbe3ef;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    padding: 10px 14px;
    background: #f8fafc;
    color: #475569;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.rrv3-so-line-tab span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 11px;
}
.rrv3-so-line-tab.active {
    background: #ffffff;
    color: #1d4ed8;
    border-color: #93c5fd;
    box-shadow: 0 -2px 0 #2563eb inset;
}
.rrv3-so-line-tab.active span {
    background: #dbeafe;
    color: #1e40af;
}
.rrv3-so-line-tab-panel {
    display: none;
}
.rrv3-so-line-tab-panel.active {
    display: block;
}
.rrv3-so-items-table-wrap {
    width: 100%;
    overflow-x: auto;
}
.rrv3-so-source-items-table {
    min-width: 760px;
}
.rrv3-so-line-match-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 800;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
}
.rrv3-so-line-match-matched,
.rrv3-so-line-match-match,
.rrv3-so-line-match-exact-match {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.rrv3-so-line-match-possible-match,
.rrv3-so-line-match-warning,
.rrv3-so-line-match-review {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
.rrv3-so-line-match-unmatched,
.rrv3-so-line-match-mismatch {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}
html.rrv3-dark-mode .rrv3-so-line-tabs {
    border-color: #334155;
}
html.rrv3-dark-mode .rrv3-so-line-tab {
    background: #111827;
    color: #cbd5e1;
    border-color: #334155;
}
html.rrv3-dark-mode .rrv3-so-line-tab.active {
    background: #0f172a;
    color: #93c5fd;
    border-color: #2563eb;
}
html.rrv3-dark-mode .rrv3-so-line-match-status {
    background: #111827;
    color: #cbd5e1;
    border-color: #334155;
}
@media (max-width: 640px) {
    .rrv3-so-line-tab {
        flex: 1 1 100%;
        border-radius: 12px;
        border-bottom: 1px solid #dbe3ef;
    }
}

/* Chunk 0708-44: Customer PO extracted line item preview */
.rrv3-so-po-line-items-preview {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    background: #f0fdf4;
}
.rrv3-so-po-line-items-preview h5 {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 800;
    color: #166534;
}
.rrv3-so-po-line-items-preview-table {
    min-width: 680px;
}
.rrv3-so-po-line-items-preview-table th,
.rrv3-so-po-line-items-preview-table td {
    vertical-align: top;
}
html.rrv3-dark-mode .rrv3-so-po-line-items-preview {
    background: #052e16;
    border-color: #166534;
}
html.rrv3-dark-mode .rrv3-so-po-line-items-preview h5 {
    color: #bbf7d0;
}

/* Chunk 0708-45: visible create Sales Order action panel */
.rrv3-so-create-cta-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg, #eff6ff, #ffffff) !important;
    margin-bottom: 16px !important;
}
.rrv3-so-create-cta-panel h3 {
    margin: 0 0 4px;
    font-size: 17px;
    color: #1e40af;
}
.rrv3-so-create-cta-panel p {
    margin: 0;
    color: #475569;
}
.rrv3-so-create-cta-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
html.rrv3-dark-mode .rrv3-so-create-cta-panel {
    background: #0b2a4a !important;
    border-color: #1d4ed8 !important;
}
html.rrv3-dark-mode .rrv3-so-create-cta-panel h3 {
    color: #dbeafe;
}
html.rrv3-dark-mode .rrv3-so-create-cta-panel p {
    color: #cbd5e1;
}
@media (max-width: 720px) {
    .rrv3-so-create-cta-panel {
        flex-direction: column;
        align-items: stretch;
    }
    .rrv3-so-create-cta-actions {
        justify-content: flex-start;
    }
}

/* Chunk 0708-46: sticky bar disabled actions for unsaved Sales Orders */
.rrv3-so-sticky-action-buttons .rrv3-button-disabled,
.rrv3-button-disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
    filter: grayscale(0.35);
    box-shadow: none !important;
}
.rrv3-so-sticky-action-buttons span.rrv3-button-disabled {
    pointer-events: none;
    user-select: none;
}

/* Chunk 0708-47: make sticky Save Sales Order action always visible */
.rrv3-so-sticky-action-bar {
    z-index: 2147483000 !important;
    bottom: max(0px, env(safe-area-inset-bottom)) !important;
}
.rrv3-so-save-sticky-btn {
    background: #16a34a !important;
    border-color: #15803d !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.28) !important;
}
.rrv3-so-save-sticky-btn:hover,
.rrv3-so-save-sticky-btn:focus {
    background: #15803d !important;
    border-color: #166534 !important;
}

/* Chunk 0708-49: inline Save Sales Order after Customer PO extraction */
.rrv3-so-after-po-save-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #86efac;
    border-radius: 14px;
    background: linear-gradient(135deg, #dcfce7, #f0fdf4);
}
.rrv3-so-after-po-save-panel strong {
    display: block;
    color: #166534;
    font-size: 14px;
    margin-bottom: 3px;
}
.rrv3-so-after-po-save-panel p {
    margin: 0;
    color: #475569;
}
.rrv3-so-save-inline-btn {
    background: #16a34a !important;
    border-color: #15803d !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    white-space: nowrap;
}
html.rrv3-dark-mode .rrv3-so-after-po-save-panel {
    background: #052e16;
    border-color: #166534;
}
html.rrv3-dark-mode .rrv3-so-after-po-save-panel strong {
    color: #bbf7d0;
}
html.rrv3-dark-mode .rrv3-so-after-po-save-panel p {
    color: #cbd5e1;
}
@media (max-width: 720px) {
    .rrv3-so-after-po-save-panel {
        flex-direction: column;
        align-items: stretch;
    }
    .rrv3-so-save-inline-btn {
        width: 100%;
    }
}

/* Chunk RRv3-55: tax-aware Sales Order line items */
.rrv3-so-tax-items-table {
    min-width: 980px;
}
.rrv3-so-tax-items-table th,
.rrv3-so-tax-items-table td {
    vertical-align: top;
}
.rrv3-so-tax-items-table td:nth-child(7) {
    font-size: 12px;
    color: #475569;
}
html.rrv3-dark-mode .rrv3-so-tax-items-table td:nth-child(7) {
    color: #cbd5e1;
}


/* ===== RRv3-94: Billing Summary strip (unbilled balance) ===== */
.rrv3-so-billing-summary {
    margin: 4px 0 12px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.rrv3-so-billing-summary .rrv3-bs-cell label {
    display: block;
    font-size: 10.5px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
}
.rrv3-so-billing-summary .rrv3-bs-cell strong {
    display: block;
    margin-top: 2px;
    font-size: 17px;
    color: #0f172a;
}
.rrv3-so-billing-summary .rrv3-bs-balance strong {
    color: #b45309;
}
.rrv3-so-billing-summary.is-full .rrv3-bs-balance strong {
    color: #15803d;
}
.rrv3-so-billing-summary.is-over .rrv3-bs-balance strong {
    color: #b91c1c;
}
.rrv3-so-billing-state {
    grid-column: 1 / -1;
    font-size: 12.5px;
    font-weight: 700;
}
.rrv3-so-billing-state.is-normal {
    color: #475569;
}
.rrv3-so-billing-state.is-full {
    color: #15803d;
}
.rrv3-so-billing-state.is-over {
    color: #b91c1c;
}
html.rrv3-dark-mode .rrv3-so-billing-summary {
    background: #111827;
    border-color: #334155;
}
html.rrv3-dark-mode .rrv3-so-billing-summary .rrv3-bs-cell label {
    color: #94a3b8;
}
html.rrv3-dark-mode .rrv3-so-billing-summary .rrv3-bs-cell strong {
    color: #e5e7eb;
}
html.rrv3-dark-mode .rrv3-so-billing-summary .rrv3-bs-balance strong {
    color: #fbbf24;
}
html.rrv3-dark-mode .rrv3-so-billing-summary.is-full .rrv3-bs-balance strong {
    color: #86efac;
}
html.rrv3-dark-mode .rrv3-so-billing-summary.is-over .rrv3-bs-balance strong {
    color: #fca5a5;
}
html.rrv3-dark-mode .rrv3-so-billing-state.is-normal {
    color: #cbd5e1;
}
html.rrv3-dark-mode .rrv3-so-billing-state.is-full {
    color: #86efac;
}
html.rrv3-dark-mode .rrv3-so-billing-state.is-over {
    color: #fca5a5;
}

/* Attached Customer PO Box & Replacement Styles */
.rrv3-so-attached-file-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 15px;
    gap: 12px;
}
.rrv3-so-attached-file-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.rrv3-so-file-icon {
    font-size: 22px;
    line-height: 1;
}
.rrv3-so-attached-file-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.rrv3-so-attached-file-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: #166534;
}
.rrv3-so-attached-file-name {
    font-size: 13px;
    font-weight: 600;
    color: #15803d;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rrv3-so-attached-file-name:hover {
    text-decoration: underline;
}
.rrv3-so-quote-picker-card-converted {
    opacity: 0.7;
    background: #f8fafc;
    border-color: #cbd5e1;
}
html.rrv3-dark-mode .rrv3-so-attached-file-box {
    background: #064e3b;
    border-color: #059669;
}
html.rrv3-dark-mode .rrv3-so-attached-file-label {
    color: #6ee7b7;
}
html.rrv3-dark-mode .rrv3-so-attached-file-name {
    color: #a7f3d0;
}
html.rrv3-dark-mode .rrv3-so-quote-picker-card-converted {
    background: #1e293b;
    border-color: #334155;
}

