/* Extend the existing MangoRace admin theme and retain its controls. */
.dashboard:has([data-erp-orders-view]:not([hidden])) .welcome-panel { display: none; }
[data-erp-orders-view] .erp-heading { align-items: start; }
[data-erp-orders-view] .erp-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
[data-erp-orders-view] .erp-toolbar label { flex: 1 1 170px; }
[data-erp-orders-view] .erp-toolbar button { flex: 0 1 auto; }
.wb-workspace { background: white; border: 1px solid var(--line, #dfe5ef); border-radius: 12px; padding: 20px; }
.wb-workspace-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 18px; }
.wb-workspace h2 { font-size: 20px; margin: 0 0 5px; }
.wb-workspace p { color: #536177; margin: 0; }
.wb-mode { display: flex; gap: 10px; align-items: center; color: #536177; white-space: nowrap; font-size: 14px; }
.wb-mode select { width: auto; min-width: 160px; }
.wb-stage-tabs { gap: 8px; }
.wb-stage { display: inline-flex; align-items: center; gap: 16px; min-height: 44px; background: #f6f8fc; color: #45536c; border: 1px solid transparent; box-shadow: none; padding: 10px 15px; }
.wb-stage:hover { background: #edf3fc; }
.wb-stage.is-active { background: #edf3ff; color: #264f99; border-color: #b4c8eb; }
.wb-stage strong { font-size: 18px; }
.wb-selection-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding-top: 18px; margin-top: 18px; border-top: 1px solid #e6ebf2; }
.wb-selection-bar label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.wb-selection-bar input, .wb-order-identity input { width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: #3158a6; flex: 0 0 auto; }
.wb-selection-bar p { flex: 1; min-width: 200px; font-size: 13px; }
.wb-test-help { font-size: 12px; margin-top: 12px !important; }
.wb-orders-head, .wb-order-row { display: grid; grid-template-columns: minmax(130px,.8fr) minmax(300px,2.1fr) minmax(130px,1fr) minmax(135px,1fr) minmax(140px,.9fr); gap: 20px; align-items: center; }
.wb-orders-head { padding: 12px 18px; color: #5c687e; font-size: 13px; background: #edf2fa; border-radius: 10px 10px 0 0; }
.wb-order { background: #fff; border: 1px solid #e0e6ef; border-top: 0; }
.wb-order:last-child { border-radius: 0 0 10px 10px; }
.wb-order-row { padding: 18px; cursor: pointer; list-style: none; }
.wb-order-row::-webkit-details-marker { display: none; }
.wb-order-row:hover { background: #fbfcff; }
.wb-order-row > span { min-width: 0; }
.wb-order-row small, .wb-parcel small { display: block; font-size: 12px; color: #526178; margin-top: 4px; overflow-wrap: anywhere; }
.wb-order-identity { display: flex; gap: 12px; align-items: start; }
.wb-order-identity > span > strong { font-size: 17px; }
.wb-order-identity em { display: inline-block; font-size: 11px; padding: 1px 6px; margin-left: 6px; color: #3158a6; background: #ecf2fc; border-radius: 4px; font-style: normal; }
.wb-products { display: grid; gap: 10px; }
.wb-product { display: flex; gap: 12px; align-items: center; }
.wb-product img, .wb-no-image { width: 52px; height: 58px; object-fit: contain; background: #f5f7fb; border-radius: 6px; flex: 0 0 auto; }
.wb-no-image { display: grid; place-content: center; color: #667187; font-size: 11px; }
.wb-product > span:last-child { min-width: 0; }
.wb-product strong { font-size: 14px; overflow-wrap: anywhere; }
.wb-destination strong { font-size: 14px; }
.wb-status { display: inline-block; padding: 5px 9px; font-size: 13px; border-radius: 6px; background: #f0f3f8; color: #526078; }
.wb-status--picking, .wb-status--handover { background: #edf3ff; color: #285497; }
.wb-status--production { background: #fff4e4; color: #93550b; }
.wb-status--fulfilled { background: #eaf6ee; color: #236e47; }
.wb-status--review { background: #fff0ec; color: #9c3e23; }
.wb-order-row .wb-review-note { color: #a04a22; }
.wb-row-actions { display: grid; justify-items: end; gap: 8px; }
.wb-row-actions button { min-height: 40px; padding: 10px 14px; font-size: 13px; white-space: normal; }
.wb-detail-hint { color: #526178; font-size: 12px; }
.wb-order-detail { padding: 20px; border-top: 1px solid #e4eaf2; background: #fbfcfe; }
.wb-order-detail > p { overflow-wrap: anywhere; color: #526178; font-size: 14px; }
.wb-timeline { display: grid; grid-template-columns: repeat(5,1fr); gap: 15px; border-bottom: 1px solid #e2e8f1; padding-bottom: 18px; }
.wb-timeline span { display: grid; gap: 8px; color: #526178; font-size: 13px; }
.wb-timeline strong { color: #1d2c43; font-size: 14px; }
.wb-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.wb-warning { background: #fff5e9; color: #87420f !important; padding: 12px; border-left: 3px solid #eb7c40; font-size: 14px; overflow-wrap: anywhere; }
.wb-empty { padding: 35px 20px; text-align: center; color: #5c687e; background: #fff; border-radius: 10px; }
.wb-dialog { width: min(880px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; border: 1px solid #dfe5ef; border-radius: 14px; padding: 24px; color: #182235; background: #fff; }
.wb-dialog::backdrop { background: rgb(16 28 48 / 40%); }
.wb-dialog > header { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid #e3e9f1; padding-bottom: 16px; margin-bottom: 18px; }
.wb-dialog h2 { margin: 0; font-size: 20px; }
.wb-dialog h3 { font-size: 16px; margin-top: 24px; }
.wb-dialog p { line-height: 1.65; }
.wb-parcel { border-bottom: 1px solid #dfe5ef; padding: 18px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.wb-parcel > ul, .wb-parcel > p { grid-column: 1 / -1; margin: 0; }
.wb-parcel ul { padding-left: 20px; font-size: 14px; }
.wb-parcel-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 10px; align-items: center; }
.wb-link-button { display: inline-flex; align-items: center; padding: 10px 14px; min-height: 40px; background: #3158a6; color: white; border-radius: 8px; text-decoration: none; font-size: 14px; }
.wb-stock-trace { padding: 0; margin: 0; display: inline; min-height: auto; border: 0; background: none; color: #285497; box-shadow: none; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.wb-stock-trace:hover { background: none; color: #15396f; }
.wb-stock-totals { display: flex; gap: 32px; padding: 18px; background: #f4f7fc; border-radius: 8px; }
.wb-stock-totals strong { display: block; font-size: 25px; margin-top: 4px; }
.wb-reservation { padding: 14px 0; border-bottom: 1px solid #e3e9f1; }
.wb-reservation > div { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.wb-reservation > div > span:first-of-type { flex: 1; }
.wb-stock-trace:focus-visible, .wb-order summary:focus-visible, .wb-stage:focus-visible { outline: 3px solid #819fe1; outline-offset: 3px; }
.wb-print-page { background: #edf0f5; font-family: Arial, 'PingFang SC', sans-serif; color: #172133; margin: 0; }
.wb-print-toolbar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 18px 24px; background: #fff; position: sticky; top: 0; border-bottom: 1px solid #d8dfeb; }
.wb-print-toolbar button { background: #3158a6; color: #fff; border: 0; border-radius: 7px; padding: 12px 18px; cursor: pointer; }
.wb-print-toolbar span { color: #526178; font-size: 13px; }
.wb-packing-sheet { box-sizing: border-box; width: 190mm; margin: 20px auto; padding: 12mm; background: #fff; break-after: page; }
.wb-packing-sheet header { display: flex; justify-content: space-between; border-bottom: 2px solid #172133; padding-bottom: 12px; }
.wb-packing-sheet h1 { font-size: 34px; margin: 20px 0 10px; }
.wb-parcel-identity { font-size: 22px; font-weight: bold; overflow-wrap: anywhere; }
.wb-packing-sheet table { border-collapse: collapse; width: 100%; margin: 20px 0; }
.wb-packing-sheet th, .wb-packing-sheet td { padding: 12px 6px; text-align: left; vertical-align: middle; border-bottom: 1px solid #c9d2df; font-size: 13px; overflow-wrap: anywhere; }
.wb-packing-sheet tr { break-inside: avoid; }
.wb-packing-sheet img { width: 70px; height: 80px; object-fit: contain; }
.wb-packing-sheet .wb-pack-quantity { font-size: 26px; font-weight: bold; }
.wb-packing-sheet footer { font-size: 12px; color: #41516a; }
@media(max-width:1000px) {
  .wb-orders-head { display: none; }
  .wb-order-row { grid-template-columns: 140px 1fr; gap: 15px; }
  .wb-row-actions { justify-items: start; }
  .wb-order { border-top: 1px solid #e0e6ef; margin-bottom: 12px; border-radius: 10px; }
  .wb-timeline { grid-template-columns: repeat(3,1fr); }
}
@media(max-width:600px) {
  .wb-workspace-heading { flex-direction: column; }
  .wb-selection-bar { align-items: stretch; }
  .wb-selection-bar button { width: 100%; }
  .wb-order-row { grid-template-columns: 1fr; }
  .wb-timeline { grid-template-columns: 1fr 1fr; }
  .wb-stage { gap: 10px; padding: 9px 11px; }
  .wb-parcel { grid-template-columns: 1fr; }
  .wb-parcel-actions { justify-content: start; }
  .wb-packing-sheet { width: calc(100% - 20px); padding: 20px; }
}
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  .wb-print-page { background: #fff; }
  .wb-print-toolbar { display: none; }
  .wb-packing-sheet { width: auto; margin: 0; padding: 0; }
  .wb-packing-sheet:last-child { break-after: auto; }
}

.wb-demo-banner { background: #fff7e9; color: #805012; padding: 9px 20px; text-align: center; font-size: 13px; border-bottom: 1px solid #f0dfbf; }
.wb-print-frame { display: block; width: 100%; height: 68dvh; border: 1px solid #dfe5ef; border-radius: 8px; background: #edf0f5; }

[data-erp-recovery-panel]:has([data-erp-recovery-list]:empty) { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 14px 18px; }
[data-erp-recovery-panel]:has([data-erp-recovery-list]:empty) h2 { margin: 0; font-size: 16px; align-self: center; }
[data-erp-recovery-panel]:has([data-erp-recovery-list]:empty) > p:not([data-erp-recovery-message]) { display: none; }
[data-erp-recovery-panel]:has([data-erp-recovery-list]:empty) [data-erp-recovery-message] { grid-column: 1 / -1; margin: 0; }
[data-erp-recovery-panel]:has([data-erp-recovery-list]:empty) [data-erp-recovery-list] { display: none; }
[data-erp-recovery-panel]:has([data-erp-recovery-list] > p.message:only-child) { display: grid; grid-template-columns: 1fr auto; gap: 5px 14px; padding: 14px 18px; }
[data-erp-recovery-panel]:has([data-erp-recovery-list] > p.message:only-child) h2 { font-size: 16px; margin: 0; align-self: center; }
[data-erp-recovery-panel]:has([data-erp-recovery-list] > p.message:only-child) > p:not([data-erp-recovery-message]) { display: none; }
[data-erp-recovery-panel]:has([data-erp-recovery-list] > p.message:only-child) [data-erp-recovery-list] { grid-column: 1 / -1; }
[data-erp-recovery-panel]:has([data-erp-recovery-list] > p.message:only-child) [data-erp-recovery-list] > p { margin: 0; }
[data-erp-recovery-panel] [data-erp-recovery-message]:empty { display: none; }
