/* Shared list/detail behavior; uses the existing Fresh Corner operations palette. */
[hidden] { display: none !important; }
#main, #navigation { scroll-margin-top: 5rem; }
#main:focus, #navigation:focus { outline: none; }
body.theme-freshcorner-ops .sidebar-menu .nav-link { min-width: 0; width: 100%; padding-inline: .85rem; }
body.theme-freshcorner-ops .sidebar-menu .nav-link > p { min-width: 0; flex: 1; padding-right: 1.4rem; white-space: normal; line-height: 1.35; }
body.theme-freshcorner-ops .sidebar-menu .nav-arrow { right: .35rem; }
body.theme-freshcorner-ops .nav-treeview .nav-link > p { overflow: visible; text-overflow: clip; }
.ops-today { padding: 1.25rem; }
.ops-workspace-grid { gap: .75rem; }
.ops-section-heading { flex-wrap: wrap; gap: .75rem; }
.ops-metric-grid { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: .75rem; }
.ops-metric-grid .card { min-height: 0; }
.fc-record-list .card-header > div:first-child { min-width: min(100%,18rem); }
.fc-record-list .table { table-layout: auto; }
.fc-record-list td { max-width: 26rem; overflow-wrap: anywhere; }
.fc-record-list .table th:last-child, .fc-record-list .table td:last-child { width: 1%; white-space: nowrap; }
.fc-record-list .card-footer { padding: .85rem 1rem; }
.fc-record-list input[type=search] { max-width: 30rem; }
.fc-record-list .card-header input { min-width: 0; }
.fc-record-list .card-header .form-label { margin-bottom: .25rem; }
.table-responsive { scrollbar-gutter: stable; }
.table :is(button,a):focus-visible { outline: 3px solid #2e855b; outline-offset: 2px; }
.order-workspace .order-table { min-width: 0 !important; width: 100%; table-layout: fixed; }
.order-workspace .order-table :is(td,th) { padding: .75rem .5rem !important; overflow-wrap: anywhere; }
.order-workspace .order-table th:nth-child(1) { width: 23%; }
.order-workspace .order-table th:nth-child(2) { width: 13%; }
.order-workspace .order-table th:nth-child(3) { width: 12%; }
.order-workspace .order-table th:nth-child(4) { width: 13%; }
.order-workspace .order-table th:nth-child(5) { width: 16%; }
.order-workspace .order-table th:nth-child(6) { width: 13%; }
.order-workspace .order-table th:nth-child(7) { width: 10%; }
.order-workspace .order-actions .btn { min-width: 0; padding: .4rem .45rem; }
.order-workspace .order-number-link { max-width: 100%; }
.order-workspace .order-table .fc-status-chip { min-width: 0 !important; max-width: 100%; }
.order-workspace .order-branch { font-size: .85rem; font-weight: 500; }
.order-workspace .order-filter-bar { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr) minmax(0,.55fr); }
.order-detail-card .card-footer { flex-wrap: wrap; }
.modal-body .btn { margin-block-end: .25rem; }
@media(max-width:767.98px) {
    .ops-today { padding: 1rem; }
    .ops-metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .ops-workspace-grid { grid-template-columns: 1fr; }
    .order-workspace .order-filter-bar { grid-template-columns: 1fr; }
    .order-workspace .ops-card-header { flex-wrap: wrap; }
    .fc-record-list .table, .order-workspace .order-table { display: block; }
    .fc-record-list thead, .order-workspace .order-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .fc-record-list tbody, .order-workspace .order-table tbody { display: block; width: 100%; }
    .fc-record-list tbody tr, .order-workspace .order-table tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .3rem .75rem; padding: .9rem 1rem; border-bottom: 1px solid var(--fc-border,#dbe5df); }
    .fc-record-list tbody td, .order-workspace .order-table tbody td { display: block; border: 0; padding: .15rem 0 !important; width: auto !important; max-width: none; white-space: normal !important; }
    .fc-record-list tbody td:first-child, .fc-record-list tbody td:last-child, .order-workspace .order-table tbody td:first-child, .order-workspace .order-table tbody td:last-child { grid-column: 1/-1; }
    .fc-record-list tbody td:last-child button, .order-workspace .order-actions .btn { min-height: 2.75rem; }
    .order-workspace .order-actions { flex-direction: row; }
    .order-workspace .order-actions .btn { flex: 1; }
    .table-responsive { max-width: 100%; }
    .content .card-header > .d-flex { min-width: 0; max-width: 100%; }
    .content .card-header :is(.input-group,.form-select) { max-width: 100%; }
    .fc-record-table { display: block; width: 100%; min-width: 0 !important; }
    .fc-record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .fc-record-table tbody { display: block; width: 100%; }
    .fc-record-table tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .3rem .75rem; padding: .9rem 1rem; border-bottom: 1px solid var(--fc-border); }
    .fc-record-table tbody :is(td,th) { display: block; width: auto !important; min-width: 0; max-width: none; border: 0; padding: .15rem 0 !important; white-space: normal !important; overflow-wrap: anywhere; --bs-table-bg-type: transparent; box-shadow: none; }
    .fc-record-table tbody :is(td,th):first-child, .fc-record-table tbody td:last-child { grid-column: 1/-1; }
    .fc-record-table tbody td:last-child .btn { min-height: 44px; }
}
@media(max-width:360px) { .ops-metric-grid { grid-template-columns:1fr; } }
@media(max-width:575.98px) {
    .app-header .staff-alerts .bell span:nth-child(2) { display: none; }
    .app-header .staff-alerts .panel { position: fixed; top: 4rem; left: 12px; right: 12px; width: auto; max-height: calc(100dvh - 5rem); }
}
[class$="-toolbar"] .fc-filter-label { display: flex; flex-direction: column; align-items: stretch; gap: .25rem; margin: 0; }
.fc-filter-label input, .fc-filter-label select { width: 100%; }
.fc-record-modal .modal-footer .mt-3 { margin-top: 0 !important; }

/* Orders, picking and inspection share one record-oriented work surface. */
.fc-record-modal:has(.ops-workflow-modal) { padding: 0 !important; }
.fc-record-modal .ops-workflow-header { background: var(--fc-green-950, #123629) !important; color: #fff; padding: .75rem 1.25rem; }
.fc-record-modal .ops-workflow-header .modal-title { color: #fff; font-size: 1.1rem; }
.fc-record-modal .ops-workflow-header .btn-close { filter: brightness(0) invert(1); opacity: .9; box-sizing: border-box; width: 44px; height: 44px; min-height: 44px; }
.ops-workflow-modal .modal-body { padding: 1.35rem; }
.ops-workflow-modal .modal-footer { align-items: end; justify-content: flex-start; }
.ops-workflow-modal :is(input, select, .btn) { min-height: 44px; }
.ops-workflow-modal :is(.card, .card-header, .card-footer) { background: #fff; }
.ops-workflow-modal .order-summary-card { border: 0 !important; box-shadow: none !important; }
.ops-workflow-modal .order-summary-card > .card-header { display: none; }
.ops-workflow-modal .order-summary-card > .card-body { padding: 0; }
.ops-record-summary { margin-bottom: 1.25rem; }
.ops-record-identity { display: flex; justify-content: space-between; align-items: start; gap: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--fc-border); }
.ops-record-identity > div { min-width: 0; }
.ops-field-label { display: block; color: var(--fc-text-muted); font-size: .8rem; margin-bottom: .25rem; }
.ops-record-identity h3 { display: inline; margin-right: .75rem; color: var(--fc-green-950); font-size: clamp(1.1rem, 1.8vw, 1.55rem); font-weight: 750; overflow-wrap: anywhere; }
.ops-record-identity small { display: block; margin-top: .5rem; color: var(--fc-text-muted); }
.ops-record-metric { text-align: right; flex-shrink: 0; }
.ops-record-metric strong { color: var(--fc-green-950); font-size: clamp(1.15rem, 2vw, 1.7rem); font-variant-numeric: tabular-nums; }
.ops-record-context { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0 0; }
.ops-record-context > div { padding: .7rem .8rem; background: var(--fc-green-50); border-radius: .5rem; min-width: 0; }
.ops-record-context dt { color: var(--fc-text-muted); font-size: .8rem; font-weight: 500; }
.ops-record-context dd { margin: .25rem 0 0; font-weight: 650; overflow-wrap: anywhere; }
.ops-detail-tabs { border-bottom: 1px solid var(--fc-border); gap: .35rem; }
.ops-detail-tabs .nav-link { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--fc-text-muted); padding: .75rem .8rem; }
.ops-detail-tabs .nav-link.active { color: var(--fc-green-800); border-bottom-color: var(--fc-green-700); font-weight: 700; background: transparent; }
.ops-overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.ops-overview-grid > section + section { border-left: 1px solid var(--fc-border); padding-left: 1.5rem; }
.ops-detail-fields { display: grid; grid-template-columns: minmax(5rem, .7fr) 1.3fr; gap: .45rem 1rem; margin-bottom: 0; font-size: .9rem; }
.ops-detail-fields dt { font-weight: 500; color: var(--fc-text-muted); }
.ops-detail-fields dd { margin: 0; overflow-wrap: anywhere; }
.ops-item-summary th { background: var(--fc-green-100); color: var(--fc-green-950); }
.ops-item-summary :is(td,th) { padding: .7rem .6rem; }
.ops-overview-bottom { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-top: 1rem; }
.ops-next-step { background: var(--fc-green-50); color: var(--fc-green-950); padding: .75rem; border-radius: .5rem; margin-bottom: 0; }
.ops-invoice-totals { display: grid; grid-template-columns: 1fr auto; gap: .4rem 1.5rem; min-width: 17rem; margin: 0; font-size: .9rem; }
.ops-invoice-totals dt { font-weight: 400; }
.ops-invoice-totals dd { text-align: right; margin: 0; font-variant-numeric: tabular-nums; }
.ops-queue-summary { margin-bottom: 1.25rem; }
.ops-summary-scope { font-size: .8rem; color: var(--fc-text-muted); margin-bottom: .5rem; }
.ops-queue-counts { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 1rem; }
.ops-queue-count { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: #fff; border: 1px solid var(--fc-border); border-radius: .6rem; color: var(--fc-text); text-align: left; min-width: 0; }
.ops-queue-count strong { margin-left: auto; color: var(--fc-green-950); font-size: 1.5rem; }
button.ops-queue-count:hover, .ops-queue-count.is-active { border-color: var(--fc-green-700); background: var(--fc-green-50); }
.ops-queue-count:focus-visible { outline: 3px solid var(--fc-green-600); outline-offset: 2px; }
.ops-pick-progress { display: grid; gap: .6rem; margin-bottom: 1.25rem; font-size: .85rem; }
.ops-pick-progress progress { width: 100%; height: .7rem; accent-color: var(--fc-green-700); }
.ops-pick-item { display: grid; grid-template-columns: minmax(12rem, .8fr) minmax(0, 1.5fr); gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--fc-border); align-items: center; row-gap: .25rem; }
.ops-pick-item .fc-status-chip { margin-top: .5rem; }
.ops-weight-controls { display: grid; grid-template-columns: minmax(9rem, 14rem) auto; gap: .75rem; align-items: end; }
.ops-saved-weight { grid-column: 2; color: var(--fc-text-muted); }
.ops-completion-action { display: grid; gap: .35rem; margin-left: auto; text-align: right; max-width: 100%; }
.ops-completion-action > span { color: var(--fc-text-muted); }
.ops-inspection-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.ops-inline-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .75rem; background: #fff4dc; color: #664600; }
.ops-inspection-workspace { display: grid; grid-template-columns: minmax(13rem, .7fr) minmax(0,1.6fr); gap: 1.5rem; }
.ops-inspection-items { border-right: 1px solid var(--fc-border); padding-right: 1rem; }
.ops-inspection-item { display: flex; flex-direction: column; align-items: start; gap: .3rem; width: 100%; border: 0; border-bottom: 1px solid var(--fc-border); background: transparent; color: var(--fc-text); text-align: left; padding: .8rem; overflow-wrap: anywhere; }
.ops-inspection-item.is-active { background: var(--fc-green-50); box-shadow: inset 4px 0 var(--fc-green-700); border-radius: .4rem; }
.ops-inspection-item > span:not(.fc-status-chip) { font-size: .85rem; color: var(--fc-text-muted); }
.ops-draft-label { color: var(--fc-warning); font-weight: 650; }
.ops-inspection-form { min-width: 0; }
.ops-inspection-checks { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.ops-inspection-checks select:has(option[value="true"]:checked) { background-color: var(--fc-green-50); border-color: var(--fc-green-600); color: var(--fc-green-950); }
.ops-inspection-checks select:has(option[value="false"]:checked) { background-color: #fff4dc; border-color: #d69d35; color: #704b00; }
.ops-inspection-checks label, .ops-form-field { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.ops-form-field { margin-top: 1rem; }
.ops-form-field :is(small, textarea, input, select) { font-weight: 400; }
.ops-item-save { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.ops-item-save > span { color: var(--fc-text-muted); }
.ops-exception-fields { margin-top: 1rem; border-top: 1px solid var(--fc-border); }
.ops-exception-fields .btn { margin-top: .5rem; }
.ops-evidence-preview { display: block; max-width: 100%; max-height: 10rem; object-fit: contain; margin-top: .5rem; }
.ops-customer-communication { border-top: 1px solid var(--fc-border); margin-top: 1.25rem; padding-top: 1rem; }
.ops-customer-communication summary { cursor: pointer; }
.ops-customer-communication summary span { color: var(--fc-text-muted); font-size: .85rem; margin-left: 1rem; }
.ops-inspection-readiness { flex: 0 0 100%; background: var(--fc-green-50); padding: .65rem .8rem; border-radius: .4rem; font-size: .85rem; color: var(--fc-text); max-height: 7rem; overflow-y: auto; }
@media(max-width: 767.98px) {
    .ops-record-identity { flex-direction: column; gap: .75rem; }
    .ops-record-metric { text-align: left; }
    .ops-record-context { grid-template-columns: 1fr 1fr; }
    .ops-overview-grid, .ops-inspection-workspace { grid-template-columns: 1fr; }
    .ops-overview-grid > section + section { border-left: 0; border-top: 1px solid var(--fc-border); padding: 1rem 0 0; }
    .ops-overview-bottom { flex-direction: column; align-items: stretch; }
    .ops-invoice-totals { min-width: 0; }
    .ops-inspection-items { display: flex; gap: .5rem; overflow-x: auto; border: 0; padding: 0 0 .5rem; }
    .ops-inspection-items h4 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .ops-inspection-item { flex: 0 0 11rem; }
    .ops-pick-item, .ops-weight-controls { grid-template-columns: 1fr; }
    .ops-saved-weight { grid-column: auto; }
    .ops-customer-communication summary span { display: block; margin: .4rem 0 0; }
    .ops-workflow-modal .modal-footer { gap: .5rem; }
    .ops-completion-action { width: 100%; text-align: left; }
    .ops-inspection-readiness { max-height: 5rem; }
    .ops-item-summary thead { display: none; }
    .ops-item-summary :is(tbody,tr,td) { display: block; width: 100%; }
    .ops-item-summary tr { padding: .75rem 0; border-bottom: 1px solid var(--fc-border); }
    .ops-item-summary td { padding: .2rem 0; border: 0; text-align: left !important; }
    .ops-item-summary td::before { content: attr(data-label) ": "; font-size: .8rem; color: var(--fc-text-muted); }
}
@media(max-width: 360px) {
    .ops-record-context, .ops-inspection-checks, .ops-queue-counts { grid-template-columns: 1fr; }
}

.ops-pick-item > .btn { justify-self: start; min-width: 9rem; }
.ops-invoice-footer { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem 1.5rem; }
.ops-invoice-totals-panel { order: 2; flex: 0 1 21rem; margin-left: auto; max-width: 100%; font-variant-numeric: tabular-nums; }
.ops-invoice-totals-panel strong { text-align: right; }
.ops-invoice-actions-panel { order: 1; flex: 1 1 18rem; }
@media(max-width: 767.98px) {
    .ops-invoice-totals-panel { flex-basis: 100%; }
}
