/* CorporateGifts admin theme — logo green / gold / white */
:root {
    --sa-sidebar-width: 260px;
    --sa-dark: #457d00;
    --sa-dark-soft: #376600;
    --sa-orange: #fbbd32;
    --sa-orange-hover: #e5a820;
    --sa-orange-light: rgba(251, 189, 50, 0.18);
    --sa-on-accent: #2d5200;
    --sa-white: #ffffff;
    --sa-text-muted: rgba(255, 255, 255, 0.82);
    --sa-border: rgba(255, 255, 255, 0.14);
    --sa-content-bg: #f3f5f0;
    --sa-card-shadow: 0 1px 3px rgba(45, 82, 0, 0.06);
    --sa-radius: 8px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9rem;
    color: #1f2a36;
    background: var(--sa-content-bg);
    min-height: 100vh;
}

a {
    text-decoration: none;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sa-sidebar-width);
    height: 100vh;
    background: var(--sa-dark);
    color: var(--sa-white);
    overflow-y: auto;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sa-border);
}

.admin-sidebar .brand {
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--sa-border);
    flex-shrink: 0;
}

.admin-sidebar .brand a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.admin-sidebar .brand-img {
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.admin-sidebar .nav { flex: 1; padding: 0.5rem 0; }

.admin-sidebar .nav-link {
    color: var(--sa-text-muted);
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border-radius: var(--sa-radius);
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}

.admin-sidebar .nav-link i {
    opacity: 0.9;
    width: 1.25em;
    text-align: center;
}

.admin-sidebar .nav-link:hover {
    color: var(--sa-white);
    background: var(--sa-dark-soft);
}

.admin-sidebar .nav-link.active {
    color: var(--sa-orange);
    background: var(--sa-orange-light);
}

.admin-sidebar .nav-link.disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* Sidebar triggers (e.g. Company Settings modal) must look identical to the anchor links. */
.admin-sidebar button.nav-link {
    width: calc(100% - 1rem);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.admin-sidebar .nav-section {
    padding: 0.5rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 5px;
    color: var(--sa-text-muted);
    background: color-mix(in srgb, var(--sa-dark) 78%, black);
}

.admin-sidebar .sidebar-sample-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin-bottom: 0.75rem;
    border-top: 1px solid var(--sa-border);
    border-radius: 0;
    padding-top: 0.85rem;
}

.sample-action {
    min-height: 44px;
}

.sample-banner {
    background: color-mix(in srgb, var(--sa-orange) 22%, #fff);
    border: 1px solid var(--sa-orange);
    color: var(--sa-on-accent);
    border-radius: var(--sa-radius);
    padding: 0.65rem 0.9rem;
    margin-bottom: 0.75rem;
}

.sample-banner a {
    font-weight: 600;
    margin-left: 0.35rem;
}

.admin-main {
    margin-left: var(--sa-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-navbar {
    background: var(--sa-white);
    border-bottom: 1px solid #e5e7eb;
    padding: 0.6rem 1.25rem;
    flex-shrink: 0;
    box-shadow: var(--sa-card-shadow);
}

.admin-navbar .page-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--sa-dark);
}

.admin-content {
    padding: 1.25rem;
    flex: 1;
}

/* Block titles: closer to content than to previous section */
.block-title {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}
.block-title:first-child {
    margin-top: 0;
}
/* Hide a page-level title that duplicates the navbar; keep nested section titles. */
.admin-content > .block-title:first-child {
    display: none;
}

.btn-sa {
    background: var(--sa-orange);
    border-color: var(--sa-orange);
    color: var(--sa-on-accent);
    font-weight: 600;
}
.btn-sa:hover {
    background: var(--sa-orange-hover);
    border-color: var(--sa-orange-hover);
    color: var(--sa-on-accent);
}
.btn-outline-sa {
    border-color: var(--sa-orange);
    color: var(--sa-orange-hover);
}
.btn-outline-sa:hover {
    background: var(--sa-orange-light);
    border-color: var(--sa-orange);
    color: var(--sa-on-accent);
}

/* Keep keyboard location obvious and icon-only controls touch-friendly. */
:where(a, button, input, select, textarea):focus-visible {
    outline: 3px solid color-mix(in srgb, var(--sa-orange) 72%, white);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--sa-orange) 22%, transparent);
}

.btn-icon {
    align-items: center;
    display: inline-flex;
    height: 2.75rem;
    justify-content: center;
    min-width: 2.75rem;
}

@media (min-width: 768px) {
    .btn-icon {
        height: 2.125rem;
        min-width: 2.125rem;
    }
}

.card {
    border-radius: var(--sa-radius);
    border: 1px solid #e5e7eb;
    box-shadow: var(--sa-card-shadow);
}
.card-header {
    font-weight: 600;
    background: var(--sa-white);
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
}

.table thead th { font-weight: 600; color: var(--sa-dark); }
.alert { border-radius: var(--sa-radius); }

/* Quotation send preview: fixed geometry so the header and the
   Cancel/Save/Save and send footer always stay on screen; the message column
   scrolls inside the modal instead of pushing the actions off the viewport. */
#quotationEmailModal .quotation-email-dialog {
    margin: 0.75rem auto;
    height: calc(100vh - 1.5rem);
}
#quotationEmailModal .modal-content {
    max-height: 100%;
    overflow: hidden;
}
#quotationEmailModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
#quotationEmailModal textarea {
    min-height: 9rem;
}

/* Supplier PO amount paid — same compact numeric input */
.po-amount-paid {
    min-width: 6.5rem;
    width: 100%;
    max-width: 8rem;
    min-height: 44px;
    font-size: 16px;
}

.po-amount-paid-block {
    margin-left: auto;
}

.po-status-dropdown-btn {
    padding: 0.15rem 0.4rem;
}

.po-status-compact .js-po-status-select,
.ops-po-hover-status .js-po-status-select {
    min-width: 7rem;
    min-height: 44px;
    font-size: 16px;
}

.ops-po-hover-entry {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ops-po-hover-entry .ops-po-hover-item {
    flex: 1;
    min-width: 0;
}

.ops-po-hover-status {
    flex-shrink: 0;
    width: 7.5rem;
}

/* First listing row: filter-wide totals */
.table.table-striped > tbody > tr.orders-totals-row > * {
    background-color: var(--sa-orange-light);
    color: var(--sa-dark);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--sa-orange);
}

/* Compact inline status dropdown on the orders listing */
.order-status-dropdown-btn {
    min-height: 44px;
    padding: 0.25rem 0.5rem;
    border-color: transparent;
}
.order-status-dropdown-btn:hover,
.order-status-dropdown-btn:focus {
    border-color: var(--sa-orange);
}
@media (min-width: 768px) {
    .order-status-dropdown-btn {
        min-height: 32px;
    }
}

/* Accordion open header emphasis */
.accordion-button:not(.collapsed) {
    background: var(--sa-orange-light);
    color: var(--sa-dark);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--sa-orange);
}

/* Login */
.admin-login-body {
    background: var(--sa-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-card {
    max-width: 400px;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
.login-header {
    background: var(--sa-dark);
    padding: 1.75rem 1.5rem;
    text-align: center;
    border-bottom: 2px solid var(--sa-orange);
}
.login-header img {
    max-height: 48px;
    width: auto;
    max-width: 100%;
}
.login-header .sub {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 500;
}
.login-body { padding: 1.5rem 1.5rem 1.75rem; }
.form-control:focus,
.form-select:focus {
    border-color: var(--sa-orange);
    box-shadow: 0 0 0 0.2rem rgba(248, 151, 29, 0.25);
}
.form-check-input:checked {
    background-color: var(--sa-orange);
    border-color: var(--sa-orange);
}

/* Dashboard KPIs, charts, funnel */
.dash-filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.5rem;
}
.dash-filter-controls .btn-group {
    flex: 0 0 auto;
}
.dash-daterange-wrap {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.5rem;
    min-width: 0;
    flex: 1 1 18rem;
    max-width: 100%;
}
.dash-filter .dash-daterange,
.listing-daterange {
    flex: 1 1 auto;
    width: min(100%, 20.5rem);
    min-width: 13.5rem;
}
.listing-daterange-col {
    min-width: min(100%, 20.5rem);
}
.dash-daterange-wrap .btn-sa {
    flex: 0 0 auto;
    white-space: nowrap;
}
/* Keep icon + field as one control when Flatpickr injects the alt input. */
.dash-daterange .flatpickr-input:not(.form-control),
.listing-daterange .flatpickr-input:not(.form-control) {
    display: none;
}
.dash-daterange .form-control,
.listing-daterange .form-control {
    min-width: 280px;
    flex: 1 1 auto;
}
.dash-daterange .input-group-text,
.listing-daterange .input-group-text {
    min-width: 2.5rem;
    justify-content: center;
    color: var(--sa-dark);
    background: #f8f9f4;
    cursor: pointer;
}
.dash-daterange .input-group-text:hover,
.listing-daterange .input-group-text:hover,
.dash-daterange .input-group-text:focus,
.listing-daterange .input-group-text:focus {
    background: var(--sa-orange-light);
    color: var(--sa-dark);
}
.dash-daterange input[type="hidden"],
.listing-daterange input[type="hidden"] {
    display: none !important;
}

/* Flatpickr range calendar — brand theme, two-month desktop layout */
.flatpickr-calendar {
    font-family: 'Plus Jakarta Sans', sans-serif;
    width: auto !important;
    max-width: calc(100vw - 1.5rem);
    padding: 0.6rem 0.65rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--sa-radius);
    box-shadow: 0 10px 28px rgba(45, 82, 0, 0.14);
    z-index: 2000;
}
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
    display: none;
}
.flatpickr-months {
    align-items: center;
    padding: 0 0.15rem 0.35rem;
}
.flatpickr-months .flatpickr-month {
    height: 2.15rem;
}
.flatpickr-current-month {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--sa-dark);
}
.flatpickr-current-month .cur-month,
.flatpickr-current-month .cur-year {
    font-weight: 600;
}
.flatpickr-current-month input.cur-year {
    width: 4.2rem;
    font-weight: 600;
}
.flatpickr-current-month .numInputWrapper {
    width: 4.2rem;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 6px;
    fill: var(--sa-dark);
    color: var(--sa-dark);
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    background: var(--sa-orange-light);
    color: var(--sa-dark);
}
.flatpickr-weekdays {
    height: 1.75rem;
}
span.flatpickr-weekday {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #6c757d;
    text-transform: uppercase;
}
.flatpickr-days {
    width: auto !important;
}
.dayContainer {
    width: 16.25rem;
    min-width: 16.25rem;
    max-width: 16.25rem;
    padding: 0 0.2rem;
}
.dayContainer + .dayContainer {
    box-shadow: none;
    border-left: 1px solid #eef0f3;
}
.flatpickr-day {
    height: 2.15rem;
    line-height: 2.15rem;
    max-width: 2.15rem;
    margin: 1px 0;
    border-radius: 6px;
    border-color: transparent;
    color: #1f2a36;
}
.flatpickr-day.today {
    border-color: var(--sa-dark);
    font-weight: 600;
}
.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
    background: var(--sa-dark);
    border-color: var(--sa-dark);
    color: #fff;
}
.flatpickr-day:hover,
.flatpickr-day:focus {
    background: var(--sa-orange-light);
    border-color: transparent;
    color: var(--sa-dark);
}
.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange {
    background: var(--sa-orange-light);
    box-shadow: none;
    border-color: transparent;
    color: var(--sa-dark);
    border-radius: 0;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: var(--sa-orange);
    border-color: var(--sa-orange);
    color: var(--sa-on-accent);
    font-weight: 700;
}
.flatpickr-day.startRange {
    border-radius: 6px 0 0 6px;
}
.flatpickr-day.endRange {
    border-radius: 0 6px 6px 0;
}
.flatpickr-day.startRange.endRange {
    border-radius: 6px;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: #c5cbd3;
}
.product-category-inline {
    min-width: 140px;
    max-width: 220px;
}
.dash-kpi {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 76px;
    padding: 0.75rem 0.9rem;
    background: var(--sa-white);
    border: 1px solid #e5e7eb;
    border-radius: var(--sa-radius);
    box-shadow: var(--sa-card-shadow);
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
a.dash-kpi:hover {
    border-color: var(--sa-orange);
    box-shadow: 0 2px 8px rgba(248, 151, 29, 0.15);
    color: inherit;
}
.dash-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin-bottom: 0.2rem;
}
.dash-kpi-value {
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    font-weight: 700;
    color: var(--sa-dark);
    line-height: 1.2;
}
.dash-kpi-hint {
    font-size: 0.75rem;
    color: #198754;
    margin-top: 0.15rem;
}
.dash-chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}
.dash-chart-wrap.dash-chart-sm { height: 220px; }
.dash-chart-wrap.dash-chart-doughnut { height: 220px; }
.dash-funnel li + li { margin-top: 0.55rem; }
.dash-funnel-row {
    display: grid;
    grid-template-columns: 5.5rem 1fr 2.5rem;
    gap: 0.5rem;
    align-items: center;
    color: inherit;
}
.dash-funnel-row:hover .dash-funnel-label { color: var(--sa-orange); }
.dash-funnel-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sa-dark);
}
.dash-funnel-bar-wrap {
    height: 10px;
    background: #eef0f3;
    border-radius: 999px;
    overflow: hidden;
}
.dash-funnel-bar {
    display: block;
    height: 100%;
    min-width: 0;
    background: linear-gradient(90deg, var(--sa-orange), var(--sa-orange-hover));
    border-radius: 999px;
}
.dash-funnel-value {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
    color: var(--sa-dark);
    font-variant-numeric: tabular-nums;
}

/* Production board (status tabs + card grid) */
.production-status-released { --prod-accent: #0aa2c0; }
.production-status-purchasing { --prod-accent: var(--sa-orange); }
.production-status-in_production { --prod-accent: #3b82f6; }
.production-status-production_ready { --prod-accent: #16a34a; }
.production-status-on_hold { --prod-accent: #ca8a04; }
.production-status-completed { --prod-accent: #457d00; }
.production-status-cancelled { --prod-accent: #dc3545; }

.production-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    align-items: stretch;
}
.production-board-meta {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}
.production-board-clear {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sa-orange);
    text-decoration: none;
    white-space: nowrap;
}
.production-board-clear:hover { color: var(--sa-orange-hover); }
.production-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    background: var(--sa-white);
    border-radius: var(--sa-radius);
    padding: 0.7rem 0.75rem;
    box-shadow: var(--sa-card-shadow);
    border: 1px solid #e5e7eb;
    border-left: 3px solid var(--prod-accent, var(--sa-orange));
    transition: border-color 0.15s, box-shadow 0.15s;
}
.production-card:hover {
    border-color: color-mix(in srgb, var(--prod-accent, var(--sa-orange)) 50%, #e5e7eb);
    box-shadow: 0 4px 12px rgba(23, 30, 39, 0.08);
}
.production-card.is-overdue { border-left-color: #dc3545; }
.production-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.production-card-doc {
    color: var(--sa-dark);
    font-weight: 700;
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.production-card-doc:hover { color: var(--sa-orange); }
.production-card-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--sa-dark);
    white-space: nowrap;
    font-size: 0.82rem;
}
.production-card-client {
    font-size: 0.82rem;
    font-weight: 550;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.production-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    color: #6c757d;
    font-size: 0.75rem;
}
.production-card-meta .is-overdue { color: #dc3545; font-weight: 650; }
.production-avatar {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sa-orange-light);
    color: var(--sa-orange-hover);
    font-size: 0.62rem;
    font-weight: 700;
    vertical-align: -1px;
    margin-right: 0.2rem;
}
.production-progress-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.production-progress { flex: 1; height: 6px; background: #eef0f3; }
.production-progress .progress-bar {
    background: linear-gradient(90deg, var(--sa-orange), var(--sa-orange-hover));
}
.production-progress-pct {
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #6c757d;
    min-width: 2rem;
    text-align: right;
}
.production-column-empty {
    grid-column: 1 / -1;
    padding: 1.25rem 0.5rem;
    text-align: center;
    border: 1px dashed rgba(23, 30, 39, 0.15);
    border-radius: var(--sa-radius);
    background: rgba(255, 255, 255, 0.55);
}
.production-column-empty i { font-size: 1.35rem; color: #9aa3af; }
.production-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    margin-top: 0.15rem;
}
.production-card-actions .form-select { font-size: 16px; }
.production-board-pager {
    margin-top: 0.75rem;
}

@media (min-width: 768px) {
    .production-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
    .production-card-actions {
        grid-template-columns: 1fr 1fr;
    }
    .production-card-actions .form-select { font-size: 0.8rem; }
}
@media (min-width: 1200px) {
    .production-board {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .admin-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1025;
    }

    body.sidebar-open .admin-sidebar-backdrop {
        display: block;
    }

    .admin-sidebar {
        width: var(--sa-sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        padding: 0;
    }

    body.sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-sidebar .nav-link span {
        display: inline;
    }

    .admin-sidebar .nav-link {
        margin: 0 0.5rem;
        padding: 0.5rem 1rem;
        text-align: left;
    }

    .admin-sidebar .nav-link i {
        margin-right: 0.5rem !important;
    }

    .admin-sidebar .nav-section {
        display: block;
    }

    .sidebar-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .dash-filter-controls,
    .dash-daterange-wrap {
        width: 100%;
    }
    .dash-filter .dash-daterange,
    .listing-daterange {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    .dash-daterange .form-control,
    .listing-daterange .form-control,
    .dash-daterange .input-group-text,
    .listing-daterange .input-group-text {
        min-height: 44px;
    }
    .dash-daterange-wrap .btn-sa {
        min-height: 44px;
    }
    .dash-filter-controls .btn-group .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .dayContainer {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

/* Contact geotag map */
.contact-map {
    width: 100%;
    height: 320px;
    border: 1px solid #e5e7eb;
    border-radius: var(--sa-radius);
    background: #eef0f3;
}

/* Proposal client live search */
.proposal-client-results {
    max-height: 280px;
    overflow-y: auto;
    z-index: 1050;
}

.proposal-client-results .dropdown-item {
    white-space: normal;
}

.proposal-client-filter-wrap .proposal-client-filter-clear {
    position: absolute;
    right: 0.15rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    line-height: 1;
    padding: 0.1rem 0.35rem;
    text-decoration: none;
    font-size: 1.1rem;
}

.proposal-client-filter-wrap .proposal-client-filter-clear:hover {
    color: var(--sa-dark) !important;
}
.proposal-client-filter-wrap.is-locked .js-client-live-filter-search {
    background-color: var(--sa-content-bg);
    pointer-events: none;
}

.proposal-create-preview-sticky {
    position: sticky;
    top: calc(var(--sa-navbar-height, 56px) + 0.75rem);
}

.proposal-create-preview-empty i {
    color: rgba(23, 30, 39, 0.25);
}

/* Proposal create/edit preview — Client | Contact columns, inline label: value rows */
#proposal_client_preview .proposal-create-preview-grid > [class*="col-"],
#proposal_edit_client_preview .proposal-create-preview-grid > [class*="col-"] {
    display: flex;
}

#proposal_client_preview .proposal-create-preview-grid .doc-panel-header,
#proposal_edit_client_preview .proposal-create-preview-grid .doc-panel-header {
    margin-top: 0;
}

#proposal_client_preview .doc-kv,
#proposal_edit_client_preview .doc-kv {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

#proposal_client_preview .doc-kv-item,
#proposal_edit_client_preview .doc-kv-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.35rem;
}

#proposal_client_preview .doc-kv-item .doc-kv-label,
#proposal_edit_client_preview .doc-kv-item .doc-kv-label {
    display: inline;
    margin-bottom: 0;
    white-space: nowrap;
}

#proposal_client_preview .doc-kv-item .doc-kv-label::after,
#proposal_edit_client_preview .doc-kv-item .doc-kv-label::after {
    content: ':';
}

#proposal_client_preview .doc-kv-item .doc-kv-value,
#proposal_edit_client_preview .doc-kv-item .doc-kv-value {
    flex: 1 1 auto;
    min-width: 0;
}

#proposal_edit_client_preview .proposal-edit-preview-accordion .accordion-item {
    margin-bottom: 0.5rem;
}

#proposal_edit_client_preview .proposal-edit-preview-accordion .accordion-button {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(23, 30, 39, 0.1);
    border-radius: var(--sa-radius);
    background: #fff;
}

#proposal_edit_client_preview .proposal-edit-preview-accordion .accordion-button:not(.collapsed) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

/* Quotation convert — modern two-column wizard layout */
#quotation-convert-page .quotation-convert-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
#quotation-convert-page .quotation-convert-step {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(23, 30, 39, 0.1);
    border-radius: 999px;
    background: #fff;
    font-size: 0.82rem;
    color: #6b7280;
}
#quotation-convert-page .quotation-convert-step.is-active {
    border-color: rgba(248, 151, 29, 0.45);
    background: rgba(248, 151, 29, 0.08);
    color: var(--sa-dark);
    font-weight: 600;
}
#quotation-convert-page .quotation-convert-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: rgba(23, 30, 39, 0.08);
    font-size: 0.72rem;
    font-weight: 700;
}
#quotation-convert-page .quotation-convert-step.is-active .quotation-convert-step-num {
    background: var(--sa-orange);
    color: #fff;
}
#quotation-convert-page .quotation-convert-subhead {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}
#quotation-convert-page .quotation-convert-subhead i {
    color: var(--sa-orange);
    margin-right: 0.25rem;
}
#quotation-convert-page .quotation-convert-kv-grid .doc-kv {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
#quotation-convert-page .quotation-convert-kv-grid .doc-kv-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.35rem;
}
#quotation-convert-page .quotation-convert-kv-grid .doc-kv-label {
    display: inline;
    margin-bottom: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #8b93a0;
    white-space: nowrap;
}
#quotation-convert-page .quotation-convert-kv-grid .doc-kv-label::after {
    content: ':';
}
#quotation-convert-page .quotation-convert-kv-grid .doc-kv-value {
    word-break: break-word;
}
#quotation-convert-page .quotation-convert-items-readonly {
    box-shadow: none;
    border: 1px solid rgba(23, 30, 39, 0.08);
}
#quotation-convert-page .convert-desc-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
}
#quotation-convert-page .quotation-convert-line {
    border-radius: calc(var(--sa-radius) + 2px);
    padding: 0.85rem 1rem;
    margin-bottom: 0.65rem;
}
#quotation-convert-page .quotation-convert-line-head {
    margin-bottom: 0.65rem;
}
#quotation-convert-page .quotation-convert-line-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: rgba(248, 151, 29, 0.12);
    color: #b86a00;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
#quotation-convert-page .quotation-convert-footer {
    position: sticky;
    bottom: 0.5rem;
    z-index: 2;
}
@media (max-width: 991.98px) {
    #quotation-convert-page .quotation-convert-footer {
        position: static;
    }
}

/* Quotation show — two-column doc layout */
#quotation-show-page .text-sa {
    color: var(--sa-orange);
}
#quotation-show-page .quotation-show-related {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
#quotation-show-page .quotation-show-related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid rgba(23, 30, 39, 0.1);
    border-radius: 999px;
    background: rgba(248, 151, 29, 0.06);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--sa-dark);
    text-decoration: none;
}
#quotation-show-page .quotation-show-related-link:hover {
    border-color: rgba(248, 151, 29, 0.45);
    background: rgba(248, 151, 29, 0.12);
    color: var(--sa-dark);
}
#quotation-show-page .quotation-show-subhead {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}
#quotation-show-page .quotation-show-subhead i {
    color: var(--sa-orange);
    margin-right: 0.25rem;
}
#quotation-show-page .quotation-show-kv-grid .doc-kv {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
#quotation-show-page .quotation-show-kv-grid .doc-kv-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.35rem;
}
#quotation-show-page .quotation-show-kv-grid .doc-kv-label {
    display: inline;
    margin-bottom: 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #8b93a0;
    white-space: nowrap;
}
#quotation-show-page .quotation-show-kv-grid .doc-kv-label::after {
    content: ':';
}
#quotation-show-page .quotation-show-kv-grid .doc-kv-value {
    word-break: break-word;
}
#quotation-show-page .quotation-show-totals {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
#quotation-show-page .quotation-show-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-size: 0.88rem;
    color: #4b5563;
}
#quotation-show-page .quotation-show-total-row.is-grand {
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(23, 30, 39, 0.1);
    font-size: 1rem;
    font-weight: 700;
    color: var(--sa-dark);
}
#quotation-show-page .quotation-show-total-row.is-grand span:last-child {
    color: var(--sa-orange);
}
#quotation-show-page .quotation-show-items-title {
    margin-top: 0;
}
#quotation-show-page .quotation-show-desc-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
}
@media (max-width: 991.98px) {
    #quotation-show-page .quotation-show-items-title {
        margin-top: 0.5rem;
    }
}

@media (max-width: 991.98px) {
    .proposal-create-preview-sticky {
        position: static;
    }
}

/* —— Document show layouts (proposal / quotation / order) —— */
.doc-show-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
@media (min-width: 576px) {
    .doc-show-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}
.doc-show-title {
    margin: 0 0 0.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.doc-show-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
}
.doc-show-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.doc-show-actions form {
    display: inline;
}
.doc-show-actions .dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

#docActionConfirmModal {
    z-index: 1092;
}

/* Streamed PDF Fancybox — near-fullscreen so A4 pages stay readable */
.fancybox__container.pdf-fancybox-container {
    z-index: 1080;
}
.pdf-fancybox-container .fancybox__slide {
    padding: 0.75rem;
}
.pdf-fancybox-container .fancybox__content {
    width: calc(75vw - 1.5rem);
    max-width: none;
    height: calc(100vh - 1.5rem);
    max-height: calc(100vh - 1.5rem);
    padding: 0;
    background: var(--sa-white, #fff);
    border-radius: var(--sa-radius, 0.5rem);
    overflow: hidden;
}
.pdf-fancybox-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: var(--sa-white, #fff);
}
.pdf-fancybox-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 2.75rem 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(23, 30, 39, 0.08);
}
.pdf-fancybox-title {
    margin: 0;
    font-size: 1rem;
}
.pdf-fancybox-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.pdf-fancybox-actions .btn {
    min-height: 44px;
}
.pdf-fancybox-body {
    flex: 1 1 auto;
    min-height: 0;
}
.pdf-preview-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    background: #525659;
}
@media (max-width: 575.98px) {
    .pdf-fancybox-container .fancybox__content {
        width: calc(100vw - 1rem);
        height: calc(100vh - 1rem);
        max-height: calc(100vh - 1rem);
    }
}

.doc-panel {
    background: var(--sa-white);
    border: 1px solid rgba(23, 30, 39, 0.08);
    border-radius: var(--sa-radius);
    box-shadow: var(--sa-card-shadow);
    height: 100%;
}
.doc-panel-body {
    padding: .25rem .5rem;
}
.doc-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.65rem;
    padding: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}
.doc-panel-header i {
    color: var(--sa-orange);
    font-size: 1rem;
}

.doc-kv {
    display: grid;
    gap: 0.85rem 1rem;
}
.doc-kv-item .doc-kv-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #8b93a0;
    margin-bottom: 0.15rem;
}
.doc-kv-item .doc-kv-value {
    color: var(--sa-dark);
    word-break: break-word;
    white-space: pre-wrap;
}
.doc-kv-item .doc-kv-value.is-empty {
    color: #9aa3af;
}

.doc-section-title {
    margin-top: 1.35rem;
    margin-bottom: 0.55rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sa-dark);
}

.doc-items-card {
    background: var(--sa-white);
    border: 1px solid rgba(23, 30, 39, 0.08);
    border-radius: var(--sa-radius);
    box-shadow: var(--sa-card-shadow);
    overflow: hidden;
}
.doc-items-card .table {
    margin-bottom: 0;
}
.doc-items-card .table > :not(caption) > * > * {
    padding: 0.65rem 0.85rem;
}
.doc-items-card thead th {
    background: #f7f8fa;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    font-weight: 700;
    border-bottom-width: 1px;
    white-space: nowrap;
}
.doc-items-card td.text-end {
    font-variant-numeric: tabular-nums;
}
.doc-items-card tfoot th,
.doc-items-card tfoot td {
    background: #fafbfc;
    border-top: 1px solid rgba(23, 30, 39, 0.1);
    font-weight: 600;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}
.doc-items-card tfoot .doc-total-label {
    text-align: end;
    color: #4b5563;
    font-weight: 500;
}
.doc-items-card tfoot .doc-total-value {
    text-align: end;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    width: 1%;
}
.doc-items-card tfoot tr.doc-total-grand th,
.doc-items-card tfoot tr.doc-total-grand td {
    background: linear-gradient(90deg, rgba(248, 151, 29, 0.08), rgba(248, 151, 29, 0.16));
    color: var(--sa-dark);
    font-size: 1.05rem;
    font-weight: 700;
}
.doc-tier-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    margin: 0.1rem 0.2rem 0.1rem 0;
    border-radius: 999px;
    border: 1px solid rgba(23, 30, 39, 0.1);
    background: #f7f8fa;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.doc-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}
.doc-timeline li {
    position: relative;
    padding: 0.85rem 0.85rem 0.85rem 1.6rem;
    border-bottom: 1px solid rgba(23, 30, 39, 0.06);
}
.doc-timeline li:last-child { border-bottom: 0; }
.doc-timeline li::before {
    content: '';
    position: absolute;
    left: 0.65rem;
    top: 1.15rem;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--sa-orange);
}

/* Proposal edit — modern quotation-style items */
.proposal-items-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 0;
    margin-bottom: .5rem;
    padding: 0.25rem;
    border-bottom: 1px solid rgba(23, 30, 39, 0.08);
    background: var(--sa-white);
    box-shadow: 0 6px 10px -8px rgba(23, 30, 39, 0.18);
}
.proposal-items-toolbar-copy {
    min-width: 0;
    flex: 1 1 12rem;
}
.proposal-items-toolbar-copy .doc-panel-header {
    margin-bottom: 0.35rem;
}
.proposal-items-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.proposal-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.proposal-item-card {
    position: relative;
    background: #fff;
    border: 1px solid rgb(207 207 207);
    border-radius: calc(var(--sa-radius) + 2px);
    box-shadow: 0 1px 2px rgba(23, 30, 39, 0.04);
    padding: 0.35rem 0.5rem 0.35rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.proposal-item-card:focus-within {
    border-color: color-mix(in srgb, var(--sa-orange) 45%, rgba(23, 30, 39, 0.12));
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--sa-orange) 16%, transparent);
}
.proposal-item-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}
.proposal-item-top-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}
.proposal-item-index {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    margin-top: 1.55rem;
    border-radius: 999px;
    background: rgb(210 210 211);
    font-weight: 700;
    line-height: 1;
}
.proposal-item-fields {
    min-width: 0;
    flex: 1 1 auto;
}
.proposal-item-fields .form-label {
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #8b93a0;
}
.proposal-item-fields .form-control {
    border-radius: calc(var(--sa-radius) - 1px);
}
.proposal-item-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    padding-top: 1.5rem;
}
.proposal-item-save-product,
.proposal-item-delete {
    flex-shrink: 0;
}
.proposal-item-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(248, 151, 29, 0.12);
    color: #b86a00;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.proposal-qty-section {
    margin-top: 0.5rem;
    margin-left: 3rem;
    padding: 0.45rem 0.5rem 0.35rem;
    border: 1px solid rgba(23, 30, 39, 0.13);
    border-radius: var(--sa-radius);
    background: linear-gradient(180deg, #f1f1f1 0%, #ffffff 100%);
}
.proposal-qty-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.proposal-qty-head .proposal-qty-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #6b7280;
}
.proposal-qty-head .proposal-qty-title i {
    color: var(--sa-orange);
}
.proposal-tiers-table {
    table-layout: auto;
    width: 100%;
    background: #fff;
    border-radius: calc(var(--sa-radius) - 2px);
    overflow: hidden;
}
.proposal-tiers-table th {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #8b93a0;
    white-space: nowrap;
    background: #f8f9fb;
}
.proposal-tiers-table td,
.proposal-tiers-table th {
    vertical-align: middle;
}
.proposal-tiers-table .tier-qty,
.proposal-tiers-table .tier-price {
    min-width: 5.5rem;
}
.proposal-tiers-table .col-qty {
    width: 42%;
}
.proposal-tiers-table .col-price {
    width: 42%;
}
.proposal-tiers-table .col-del {
    width: 1%;
    white-space: nowrap;
}
.proposal-tiers-table .remove-tier {
    min-width: 2.25rem;
    min-height: 2.25rem;
}
.proposal-product-results {
    max-height: 260px;
    overflow-y: auto;
    z-index: 1060;
}
.proposal-edit-footer {
    padding-top: 0.25rem;
}
@media (max-width: 575.98px) {
    .proposal-item-top-row {
        flex-wrap: wrap;
    }
    .proposal-item-index {
        margin-top: 0;
    }
    .proposal-item-fields {
        flex: 1 1 calc(100% - 3rem);
    }
    .proposal-item-actions {
        flex-direction: row;
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.15rem;
    }
    .proposal-qty-section {
        margin-left: 0;
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }
    .proposal-item-save-product,
    .proposal-item-delete,
    .proposal-tiers-table .remove-tier {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }
}

/* Production board — modernized */
.production-board-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
@media (min-width: 768px) {
    .production-board-toolbar {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
}
.production-board-filters {
    background: var(--sa-white);
    border: 1px solid rgba(23, 30, 39, 0.08);
    border-radius: var(--sa-radius);
    box-shadow: var(--sa-card-shadow);
    padding: 0.75rem 0.9rem;
}
.production-board-filters + .status-filter-tabs {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

/* Bootstrap pagination used by list index pages */
.bootstrap-pagination .pagination {
    gap: 0.15rem;
}
.bootstrap-pagination .page-link {
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--sa-dark);
    border-color: rgba(23, 30, 39, 0.12);
}
.bootstrap-pagination .page-link:hover {
    color: var(--sa-orange-hover);
    background: var(--sa-orange-light);
    border-color: rgba(248, 151, 29, 0.45);
}
.bootstrap-pagination .page-item.active .page-link {
    background: var(--sa-orange);
    border-color: var(--sa-orange);
    color: #fff;
}
.bootstrap-pagination .page-item.disabled .page-link {
    color: #9aa3af;
    background: #fff;
}
.card-footer .bootstrap-pagination {
    width: 100%;
}

/* Operations board — PO/DR chips */
.ops-doc-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.ops-po-cell-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-wrap: nowrap;
}
.ops-po-hover {
    --ops-po-bg: #e8f5fc;
    --ops-po-bg-deep: #d4eef9;
    --ops-po-border: #8ebddc;
    --ops-po-ink: #16314f;
    --ops-po-muted: #4d7391;
    position: relative;
    display: inline-flex;
    min-width: 0;
}
.ops-po-total {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    min-height: 44px;
    padding: 0.2rem 0.45rem 0.2rem 0.65rem;
    border: 1px solid #c5dff0;
    background: var(--ops-po-bg);
    color: var(--ops-po-ink);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ops-po-total-caret {
    font-size: 0.7rem;
    color: #3d7eab;
    transition: transform 0.16s ease;
}
.ops-po-hover:hover .ops-po-total,
.ops-po-hover:focus-within .ops-po-total {
    background: var(--ops-po-bg-deep);
    border-color: var(--ops-po-border);
    box-shadow: 0 0 0 3px rgba(142, 189, 220, 0.35);
}
.ops-po-hover:hover .ops-po-total-caret,
.ops-po-hover:focus-within .ops-po-total-caret {
    transform: rotate(180deg);
}
.ops-po-hover-panel {
    position: absolute;
    top: calc(100% - 2px);
    right: 0;
    z-index: 1080;
    width: max-content;
    min-width: 18rem;
    max-width: min(22.5rem, 92vw);
    padding-top: 10px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}
.ops-po-hover:hover .ops-po-hover-panel,
.ops-po-hover:focus-within .ops-po-hover-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.ops-po-hover-arrow {
    position: absolute;
    top: 5px;
    right: 1.15rem;
    width: 12px;
    height: 12px;
    background: var(--ops-po-bg-deep);
    border-left: 1px solid var(--ops-po-border);
    border-top: 1px solid var(--ops-po-border);
    transform: rotate(45deg);
    z-index: 2;
    pointer-events: none;
}
.ops-po-hover-card {
    overflow: hidden;
    border: 1px solid var(--ops-po-border);
    border-radius: 10px;
    background: var(--ops-po-bg);
    box-shadow: 0 12px 28px rgba(22, 49, 79, 0.16), 0 2px 6px rgba(22, 49, 79, 0.06);
}
.ops-po-hover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 0.45rem;
    background: var(--ops-po-bg-deep);
    border-bottom: 1px solid #c5dff0;
}
.ops-po-hover-head-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #2a6a96;
}
.ops-po-hover-head-label i {
    font-size: 0.85rem;
}
.ops-po-hover-head-total {
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ops-po-ink);
    white-space: nowrap;
}
.ops-po-hover-list {
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    max-height: 16rem;
    overflow-y: auto;
}
.ops-po-hover-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 44px;
    padding: 0.45rem 0.55rem 0.45rem 0.6rem;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ops-po-ink);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}
.ops-po-hover-list li + li {
    margin-top: 0.22rem;
}
.ops-po-hover-item:hover,
.ops-po-hover-item:focus-visible {
    background: #fff;
    box-shadow: 0 0 0 1px #8ebddc;
    outline: none;
}
.ops-po-hover-item.is-cancelled {
    opacity: 0.62;
}
.ops-po-hover-copy {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    flex: 1;
}
.ops-po-hover-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}
.ops-po-hover-num {
    min-width: 0;
    font-weight: 700;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1a4d73;
}
.ops-po-hover-amt {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ops-po-ink);
}
.ops-po-hover-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    font-size: 0.72rem;
    color: var(--ops-po-muted);
}
.ops-po-hover-sep {
    opacity: 0.55;
}
.ops-po-hover-supplier {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ops-po-hover-go {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #5b8fb8;
}
.ops-po-hover-item:hover .ops-po-hover-go,
.ops-po-hover-item:focus-visible .ops-po-hover-go {
    color: var(--ops-po-ink);
}
/* Operations board — DR "View DRs" hover panel (items table, then the DR list) */
.ops-dr-chips {
    display: contents;
}
.ops-dr-hover {
    --ops-dr-bg: #eaf7ee;
    --ops-dr-bg-deep: #d4efdd;
    --ops-dr-border: #93c9a8;
    --ops-dr-ink: #14432a;
    --ops-dr-muted: #4a735c;
    position: relative;
    display: inline-flex;
    min-width: 0;
}
.ops-dr-hover-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.2rem 0.5rem;
    border: 1px solid #cbe7d6;
    background: var(--ops-dr-bg);
    color: var(--ops-dr-ink);
    cursor: pointer;
    border-radius: var(--sa-radius);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ops-dr-hover-toggle:hover,
.ops-dr-hover:focus-within .ops-dr-hover-toggle {
    background: var(--ops-dr-bg-deep);
    border-color: var(--ops-dr-border);
    box-shadow: 0 0 0 3px rgba(147, 201, 168, 0.35);
}
.ops-dr-hover-panel {
    position: absolute;
    top: calc(100% - 2px);
    right: 0;
    z-index: 1080;
    width: max-content;
    min-width: 24rem;
    max-width: min(30rem, 92vw);
    padding-top: 10px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}
.ops-dr-hover:hover .ops-dr-hover-panel,
.ops-dr-hover:focus-within .ops-dr-hover-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.ops-dr-hover-arrow {
    position: absolute;
    top: 5px;
    right: 1.15rem;
    width: 12px;
    height: 12px;
    background: var(--ops-dr-bg-deep);
    border-left: 1px solid var(--ops-dr-border);
    border-top: 1px solid var(--ops-dr-border);
    transform: rotate(45deg);
    z-index: 2;
    pointer-events: none;
}
.ops-dr-hover-card {
    overflow: hidden;
    border: 1px solid var(--ops-dr-border);
    border-radius: 10px;
    background: var(--ops-dr-bg);
    box-shadow: 0 12px 28px rgba(20, 67, 42, 0.16), 0 2px 6px rgba(20, 67, 42, 0.06);
}
.ops-dr-hover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 0.45rem;
    background: var(--ops-dr-bg-deep);
    border-bottom: 1px solid #cbe7d6;
}
.ops-dr-hover-head-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #1f7a49;
    white-space: nowrap;
}
.ops-dr-hover-head-label i {
    font-size: 0.85rem;
}
.ops-dr-hover-head-total {
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ops-dr-ink);
    white-space: nowrap;
}
.ops-dr-hover-items {
    max-height: 15rem;
    overflow-y: auto;
    padding: 0.35rem 0.5rem 0.4rem;
}
.ops-dr-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.ops-dr-items-table th {
    padding: 0.25rem 0.35rem;
    border-bottom: 1px solid #cbe7d6;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ops-dr-muted);
    white-space: nowrap;
}
.ops-dr-items-table td {
    padding: 0.35rem;
    border-bottom: 1px solid rgba(147, 201, 168, 0.35);
    vertical-align: top;
}
.ops-dr-items-table tbody tr:last-child td {
    border-bottom: 0;
}
.ops-dr-items-title {
    font-weight: 650;
    color: #14603a;
}
.ops-dr-items-code {
    font-size: 0.7rem;
    color: var(--ops-dr-muted);
}
.ops-dr-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ops-dr-hover-drs {
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    max-height: 14rem;
    overflow-y: auto;
    border-top: 1px solid #cbe7d6;
}
.ops-dr-hover-drs li + li {
    margin-top: 0.22rem;
}
.ops-dr-hover-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 44px;
    padding: 0.45rem 0.55rem 0.45rem 0.6rem;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ops-dr-ink);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}
.ops-dr-hover-item:hover,
.ops-dr-hover-item:focus-visible {
    background: #fff;
    box-shadow: 0 0 0 1px var(--ops-dr-border);
    outline: none;
}
.ops-dr-hover-item.is-cancelled {
    opacity: 0.62;
}
.ops-dr-hover-copy {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    flex: 1;
}
.ops-dr-hover-num {
    min-width: 0;
    font-weight: 700;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #14603a;
}
.ops-dr-hover-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    font-size: 0.72rem;
    color: var(--ops-dr-muted);
}
.ops-dr-hover-date {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ops-dr-hover-sep {
    opacity: 0.55;
}
.ops-dr-hover-go {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #4f9a72;
}
.ops-dr-hover-item:hover .ops-dr-hover-go,
.ops-dr-hover-item:focus-visible .ops-dr-hover-go {
    color: var(--ops-dr-ink);
}
.ops-dr-hover-empty {
    display: block;
    padding: 0.65rem 0.5rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--ops-dr-muted);
}
.ops-board-table-wrap:has(.ops-po-hover:hover),
.ops-board-table-wrap:has(.ops-po-hover:focus-within),
.ops-board-table-wrap:has(.ops-dr-hover:hover),
.ops-board-table-wrap:has(.ops-dr-hover:focus-within) {
    overflow: visible;
}
#operationsBoardTable tbody tr:has(.ops-po-hover:hover),
#operationsBoardTable tbody tr:has(.ops-po-hover:focus-within),
#operationsBoardTable tbody tr:has(.ops-dr-hover:hover),
#operationsBoardTable tbody tr:has(.ops-dr-hover:focus-within) {
    position: relative;
    z-index: 6;
}

/* A.Received on the orders listing reuses the same hover panel, so the overflow
   and stacking fixes must apply to those rows too. */
#ordersListingTable tbody tr:has(.ops-po-hover:hover),
#ordersListingTable tbody tr:has(.ops-po-hover:focus-within) {
    position: relative;
    z-index: 6;
}
/* The received cell is right-aligned like the PO total it mirrors. */
.ops-received-cell {
    justify-content: flex-end;
}
.ops-dr-totals {
    display: none;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: #6b7280;
}
.ops-dr-totals .ops-dr-qty {
    display: inline-block;
    min-width: 1.75rem;
    margin-left: 0.2rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    color: var(--sa-dark);
}
.ops-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    min-height: 44px;
    padding: 0.25rem 0.45rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--sa-radius);
    background: #fff;
    color: var(--sa-dark);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ops-doc-chip:hover {
    border-color: rgba(248, 151, 29, 0.55);
    box-shadow: 0 1px 4px rgba(248, 151, 29, 0.12);
}
.ops-doc-chip-num {
    font-weight: 650;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 9rem;
}
.ops-status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.ops-dot-secondary { background: #6c757d; }
.ops-dot-primary { background: #0d6efd; }
.ops-dot-info { background: #0dcaf0; }
.ops-dot-warning { background: #ffc107; }
.ops-dot-success { background: #198754; }
.ops-dot-dark { background: #212529; }
.ops-dot-danger { background: #dc3545; }
#operationsBoardTable .ops-col-status {
    width: 1%;
    white-space: nowrap;
}
#operationsBoardTable .ops-status-control {
    position: relative;
}
#operationsBoardTable .ops-status-dot-btn {
    width: 1.1rem;
    height: 1.1rem;
    min-width: 1.1rem;
    min-height: 1.1rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), 0 0 0 2px transparent;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    transition: box-shadow 0.15s, transform 0.15s;
}
#operationsBoardTable .ops-status-dot-btn:hover,
#operationsBoardTable .ops-status-dot-btn:focus-visible,
#operationsBoardTable .ops-status-dot-btn[aria-expanded="true"] {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(248, 151, 29, 0.45);
    outline: none;
}
#operationsBoardTable .ops-status-dot-btn.ops-dot-secondary { background: #6c757d; }
#operationsBoardTable .ops-status-dot-btn.ops-dot-primary { background: #0d6efd; }
#operationsBoardTable .ops-status-dot-btn.ops-dot-info { background: #0dcaf0; }
#operationsBoardTable .ops-status-dot-btn.ops-dot-warning { background: #ffc107; }
#operationsBoardTable .ops-status-dot-btn.ops-dot-success { background: #198754; }
#operationsBoardTable .ops-status-dot-btn.ops-dot-dark { background: #212529; }
#operationsBoardTable .ops-status-dot-btn.ops-dot-danger { background: #dc3545; }
#operationsBoardTable .ops-status-menu {
    min-width: 12rem;
    padding: 0.35rem 0;
    z-index: 1080;
}
#operationsBoardTable .ops-status-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.875rem;
    padding: 0.4rem 0.85rem;
}
#operationsBoardTable .ops-status-option .ops-status-dot {
    width: 0.65rem;
    height: 0.65rem;
}
#operationsBoardTable .ops-status-option.active {
    font-weight: 600;
    background: var(--sa-orange-light);
}
.ops-doc-empty {
    font-size: 0.85rem;
}
.ops-plus-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
/* Ops PO product autocomplete — keep dropdown above table cells / modal chrome */
#opsPoItemsSection .table-responsive {
    overflow: visible;
}
.table-responsive {
    overflow-x: unset;
}
.ops-po-product-wrap {
    z-index: 1;
}
.ops-po-product-wrap:focus-within {
    z-index: 5;
}
.ops-po-product-wrap .ops-po-product-results {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 1080;
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding: 0.35rem 0;
    border: 1px solid rgba(23, 30, 39, 0.18);
    border-radius: var(--sa-radius);
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 30, 39, 0.18), 0 2px 6px rgba(23, 30, 39, 0.08);
}
.ops-po-product-wrap .ops-po-product-results.show {
    display: block;
}
.ops-po-product-wrap .ops-po-product-option {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sa-dark-soft);
    white-space: normal;
    border-left: 3px solid transparent;
}
.ops-po-product-wrap .ops-po-product-option:hover,
.ops-po-product-wrap .ops-po-product-option:focus {
    background: var(--sa-orange-light);
    color: var(--sa-dark);
    border-left-color: var(--sa-orange);
}
.ops-po-product-wrap .ops-po-product-option-name {
    flex: 1;
    min-width: 0;
}
.ops-po-product-wrap .ops-po-product-option-sku {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    background: #f0f2f5;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}
.ops-po-product-wrap .ops-po-product-hint {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    color: #5c6770;
    line-height: 1.35;
}
.ops-po-product-wrap .ops-po-product-hint--warn {
    color: #9a3412;
    background: #fff7ed;
    font-weight: 600;
}
@media (min-width: 768px) {
    .ops-doc-chip { min-height: 0; }
    .ops-plus-btn {
        min-width: 2rem;
        min-height: 2rem;
    }
    .ops-po-total {
        min-height: 2rem;
    }
    .ops-po-hover-item {
        min-height: 2.75rem;
    }
    .ops-dr-hover-toggle {
        min-width: 2rem;
        min-height: 2rem;
    }
    .ops-dr-hover-item {
        min-height: 2.75rem;
    }
}
@media (max-width: 575.98px) {
    .bootstrap-pagination .page-link {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Index status filter tabs: wrap on small screens, closer to the table than the page title */
.status-filter-tabs {
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
    gap: 0.15rem 0;
    border-bottom: 1px solid #dee2e6;
}
.status-filter-tabs .nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: #4b5563;
    font-weight: 500;
    white-space: nowrap;
}
.status-filter-tabs .nav-link:hover {
    color: var(--sa-orange);
    border-color: #e5e7eb #e5e7eb #dee2e6;
}
.status-filter-tabs .nav-link.active {
    color: var(--sa-orange);
    font-weight: 600;
    border-color: #dee2e6 #dee2e6 #fff;
    background: #fff;
}
.status-tab-count {
    min-width: 1.35rem;
    height: 1.2rem;
    padding: 0 0.35rem;
    margin-left: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(23, 30, 39, 0.08);
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #4b5563;
}
.status-filter-tabs .nav-link.active .status-tab-count {
    background: var(--sa-orange);
    color: #fff;
}
@media (min-width: 768px) {
    .status-filter-tabs .nav-link {
        min-height: 0;
        padding-top: 0.45rem;
        padding-bottom: 0.45rem;
    }
}

.error-page-code {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sa-orange);
}
.error-page-panel h5 {
    font-weight: 600;
}

@media (min-width: 992px) {
    .admin-sidebar-backdrop {
        display: none !important;
    }

    .sidebar-toggle-btn {
        display: none;
    }
}
.ocr-field-low-confidence .form-control,
.ocr-field-low-confidence .form-select {
    border-color: #dc3545;
    background-color: #fff8e1;
}
.ocr-field-low-confidence .form-label::after {
    content: " — verify";
    color: #b45309;
    font-weight: 600;
    font-size: 0.75em;
    text-transform: none;
    letter-spacing: 0;
}
.accordion-header.ocr-header-low-confidence .accordion-button {
    background-color: #fff3cd;
}
.accordion-header.ocr-header-low-confidence .accordion-button:not(.collapsed) {
    background-color: #ffe69c;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}