/* Điều phối đơn — kiểu riêng của trang (dùng biến màu của hub.css). Mọi lớp bắt đầu bằng dp-. */

/* ---------------------------------------------------------------- nhãn trạng thái (tone trong shared/flow.js) */
.badge.dp-tone-ok { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.badge.dp-tone-info { background: var(--info-soft); color: var(--info-ink); border-color: transparent; }
.badge.dp-tone-warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.badge.dp-tone-muted { background: var(--surface-3); color: var(--dim); }
.badge.dp-late { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.badge.dp-team { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.dp-code { font-family: var(--mono); font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.dp-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.dp-pre { white-space: pre-line; overflow-wrap: anywhere; }
.dp-inline { display: inline; }
.dp-link { background: none; border: none; padding: 0; cursor: pointer; color: var(--primary-ink); font-family: var(--mono); font-size: 12.5px; font-weight: 700; }
.dp-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- đầu trang & mục con */
.dp-nav a { display: inline-flex; align-items: center; gap: 6px; }
.dp-nav a.active .nav-badge { background: #fff; color: var(--primary); }
.dp-alert .btn { margin-left: 6px; }
.dp-error { margin: 30px auto; }

/* ---------------------------------------------------------------- Việc của tôi */
.dp-hello { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.dp-hello h3 { margin: 0 0 6px; }
.dp-teams { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* Quản lý nhận thay việc của team chưa có tài khoản phụ trách (VD chưa có Thủ kho). */
.dp-cover { flex-basis: 100%; margin-top: 6px; font-size: 13px; }
.dp-hello-stats { display: flex; gap: 28px; }
.dp-hello-stats .stat { flex: 0 0 auto; min-width: 0; }
.dp-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, 1fr); gap: 16px; align-items: start; }
.dp-side > .card, .dp-main > .card, .dp-main > .notice { margin-bottom: 16px; }
.dp-group .card-head { margin-bottom: 10px; }
.dp-group .card-head h3 { gap: 6px; }
.dp-more { font-size: 13px; font-weight: 600; text-decoration: none; }
.dp-more:hover { text-decoration: underline; }

.dp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.dp-item {
  position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0;
  padding: 11px 13px; border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 11px;
  background: var(--surface); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.dp-item:hover { border-color: #93c5fd; border-left-color: var(--primary); box-shadow: 0 3px 12px rgba(37, 99, 235, 0.08); }
.dp-item.is-late { border-left-color: var(--bad); }
.dp-item-po { border-left-color: var(--violet); }
.dp-item-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dp-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-item-meta { display: flex; gap: 2px 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--dim); }
.dp-item-progress { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dim); min-width: 0; }
.dp-item-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }

/* chấm tiến độ 7 bước */
.dp-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dim); }
.dp-dots { display: inline-flex; gap: 3px; flex-shrink: 0; }
.dp-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.dp-dots i.done { background: var(--good); }
.dp-dots i.now { background: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.dp-dots.is-off i { background: var(--border); }

/* thông báo */
.dp-notif-list { list-style: none; margin: 0; padding: 0; }
.dp-notif {
  position: relative; width: 100%; display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  background: none; border: none; border-top: 1px solid var(--border); padding: 9px 6px 9px 18px; font-size: 13px; color: var(--dim);
}
.dp-notif-list li:first-child .dp-notif { border-top: none; }
.dp-notif:hover { background: var(--surface-2); }
.dp-notif.unread { color: var(--ink); font-weight: 500; }
.dp-notif.unread::before { content: ''; position: absolute; left: 5px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.dp-notif small { color: var(--faint); font-size: 11.5px; font-weight: 400; }
.dp-older summary { cursor: pointer; font-size: 12.5px; color: var(--faint); margin-top: 8px; }

/* KPI tháng */
.dp-kpi-val b { font-size: 22px; letter-spacing: -0.01em; }
.dp-kpi-val span { color: var(--faint); font-size: 14px; }
.dp-bar { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; margin: 10px 0 8px; }
.dp-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary), var(--good)); }

/* mở nhanh */
.dp-links h3 { margin-bottom: 10px; }
.dp-link-list { display: flex; flex-direction: column; gap: 6px; }
.dp-link-list .btn { justify-content: space-between; white-space: normal; text-align: left; }

/* ---------------------------------------------------------------- danh sách (Đơn hàng, Mua hàng, NCC) */
.dp-toolbar .input { min-width: 0; }
.dp-seg-wrap { overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; scrollbar-width: none; }
.dp-filter-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: -4px 0 12px; color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.dp-filter-sum b { color: var(--ink); }
.dp-seg-wrap::-webkit-scrollbar { display: none; }
.dp-seg button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dp-count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-3); color: var(--dim); font-size: 11px; font-weight: 700; text-align: center; }
.dp-seg button.on .dp-count { background: rgba(255, 255, 255, 0.25); color: #fff; }
.dp-list-card { padding: 8px 14px; }
.dp-list-card > .hint { padding: 0 4px; }
.dp-table-wrap { overflow-x: auto; }
.dp-rtable tr[data-open-order], .dp-rtable tr[data-open-po] { cursor: pointer; }
.dp-rtable tr[data-open-order]:focus-visible, .dp-rtable tr[data-open-po]:focus-visible { outline-offset: -2px; }
.dp-row-late > td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.dp-wrap { min-width: 180px; max-width: 340px; }
.dp-orders td:nth-child(5) .dp-badges, .dp-pos td:nth-child(7) .dp-badges { justify-content: flex-start; }
.dp-inactive { opacity: 0.6; }
.dp-row-acts .btn { margin-left: 4px; }
.dp-kpis { margin-bottom: 14px; }
.dp-kpis .kpi-val.neg { color: var(--bad); }

/* ---------------------------------------------------------------- chi tiết đơn */
.dp-d-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dp-next { font-size: 13px; color: var(--dim); }
.dp-stepper { margin: 14px 0 12px; }
.dp-step-pre { font-size: 12.5px; font-weight: 700; color: var(--warn-ink); margin-bottom: 8px; }
.dp-stepper.is-off .dp-step-pre { color: var(--faint); }
.dp-steps { position: relative; list-style: none; margin: 0; padding: 0 0 4px; display: flex; overflow-x: auto; scrollbar-width: thin; }
.dp-step {
  position: relative; flex: 1 0 84px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 0 2px; text-align: center; font-size: 11.5px; line-height: 1.3; color: var(--faint);
}
.dp-step::before { content: ''; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: var(--border); }
.dp-step:first-child::before { display: none; }
.dp-step i {
  position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-weight: 700; font-size: 12px; background: var(--surface); border: 2px solid var(--border-strong); color: var(--faint);
}
.dp-step.done { color: var(--good-ink); }
.dp-step.done i { background: var(--good); border-color: var(--good); color: #fff; }
.dp-step.done::before, .dp-step.now::before, .dp-step.skip::before { background: var(--good); }
.dp-step.now { color: var(--primary-ink); font-weight: 700; }
.dp-step.now i { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.dp-step.skip i { border-style: dashed; }
.dp-stepper.is-off .dp-step { opacity: 0.45; }

.dp-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 0 0 14px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
/* "⧉ Sao chép đơn" nằm cuối thanh thao tác (không phải bước của đơn); hộp Lên đơn sao chép báo các phần không chép được. */
.dp-actions .dp-copy-btn { margin-left: auto; }
.dp-copy-warn { margin-top: 6px; color: var(--warn-ink); }
.dp-facts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 18px;
  padding: 12px 14px; margin-bottom: 4px; background: var(--surface-2); border-radius: 12px; font-size: 13.5px;
}
.dp-fact > span { display: block; margin-bottom: 2px; font-size: 11.5px; font-weight: 600; color: var(--faint); }
.dp-fact > div { overflow-wrap: anywhere; }
.dp-fact small { display: block; font-size: 12px; color: var(--faint); }
.dp-fact small.warn { color: var(--warn-ink); }
.dp-h { margin: 18px 0 8px; font-size: 14px; }
.dp-items td.dp-main .badge { margin-left: 4px; }
.dp-totals { display: flex; flex-direction: column; gap: 4px; max-width: 340px; margin: 10px 0 0 auto; font-size: 13.5px; }
.dp-totals > div { display: flex; justify-content: space-between; gap: 16px; }
.dp-totals dt { color: var(--dim); }
.dp-totals dd { margin: 0; font-weight: 600; white-space: nowrap; }
.dp-totals .dp-total { margin-top: 2px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 15px; }
.dp-totals .dp-total dd { font-weight: 700; }
.dp-note { margin-top: 14px; padding: 10px 12px; border-left: 3px solid var(--warn); background: #fffbeb; border-radius: 0 10px 10px 0; font-size: 13.5px; }
.dp-note > span { display: block; font-size: 11.5px; font-weight: 600; color: var(--warn-ink); margin-bottom: 2px; }
/* đơn chờ hàng còn thiếu chưa có đơn mua */
.dp-need { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.dp-need ul { margin: 0; padding-left: 20px; }
.dp-need-sub { font-size: 12.5px; opacity: 0.9; }
/* đơn đã giữ hàng mà hàng giữ bị thiếu (bán ở quầy…) — chưa xuất kho được */
.notice.dp-bad { background: var(--bad-soft); color: var(--bad-ink); border-left: 3px solid var(--bad); }
/* hộp "Bỏ các thay đổi chưa lưu?" nằm trên hộp đang nhập */
.modal.dp-confirm { max-width: 400px; }
/* tình trạng từng kho dưới bảng sản phẩm (đơn chưa chọn kho) */
.dp-whcov { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; }
.dp-whcov > span { font-weight: 600; }
.dp-po-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dp-po-links li { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--violet); border-radius: 10px; }
.dp-po-links li.is-late { border-left-color: var(--bad); }
.dp-comment { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.dp-comment textarea { flex: 1; min-height: 42px; resize: vertical; }
.dp-timeline .tl-body > b { font-weight: 700; }
.dp-ev { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--dim); }
.dp-ev-status .dp-ev { background: var(--good-soft); color: var(--good-ink); }
.dp-ev-comment .dp-ev { background: var(--primary-soft); color: var(--primary-ink); }
.dp-ev-system .dp-ev { background: var(--warn-soft); color: var(--warn-ink); }
.dp-ev-payment .dp-ev, .dp-ev-receive .dp-ev { background: var(--violet-soft); color: var(--violet-ink); }

/* ---------------------------------------------------------------- hộp thoại thao tác */
.dp-modal.modal-wide { max-width: 860px; }
.dp-modal:focus { outline: none; }
.dp-summary { padding: 9px 12px; margin-bottom: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; }
.dp-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.dp-form .dp-totals { margin-bottom: 12px; }
.dp-echo { font-size: 12px; color: var(--primary-ink); font-weight: 600; min-height: 1em; }
.dp-echo:empty { display: none; }
.dp-cov { margin-bottom: 10px; }
.dp-cov tr.dp-short td { background: #fff7f7; }
.input.dp-qty { width: 100px; padding: 6px 8px; text-align: right; }
.input.dp-money { width: 130px; padding: 6px 8px; text-align: right; }
/* ô "đã ghi ở Bán hàng" khi ghi thu tiền: nhấn mạnh khi máy chủ / kiểm tra gợi ý đánh dấu */
.dp-check { align-items: flex-start; line-height: 1.45; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.dp-check input { margin-top: 2px; flex-shrink: 0; }
.dp-check.is-hint { border-color: var(--warn); background: var(--warn-soft); box-shadow: 0 0 0 3px var(--warn-soft); }
.dp-debt { margin-bottom: 12px; }

/* soạn đơn */
/* Đơn đang soạn (Đơn 1, Đơn 2… như "Hóa đơn 1 / Hóa đơn 2" của KiotViet): hàng tab đầu hộp Lên đơn; nhiều tab thì xuống dòng (không cuộn ngang). */
.dp-drafts { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin: 0 0 14px; padding: 0 0 10px; border-bottom: 1px solid var(--border); }
.dp-dtab { display: inline-flex; align-items: stretch; min-width: 0; max-width: 240px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); overflow: hidden; }
.dp-dtab.on { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(37, 99, 235, .25); }
.dp-dtab-go { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 6px 4px 6px 11px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dp-dtab-go b { font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.dp-dtab-go small { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; line-height: 1.3; color: var(--faint); }
.dp-dtab.on .dp-dtab-go { cursor: default; }
.dp-dtab.on .dp-dtab-go small { color: rgba(255, 255, 255, .85); }
.dp-dtab:not(.on):hover { border-color: #93c5fd; background: #f5f9ff; }
.dp-dtab-x { flex: 0 0 auto; width: 30px; padding: 0; background: none; border: 0; color: inherit; font-size: 17px; line-height: 1; opacity: .55; cursor: pointer; }
.dp-dtab-x:hover, .dp-dtab-x:focus-visible { opacity: 1; background: rgba(0, 0, 0, .08); }
.dp-dtab-new { flex: 0 0 auto; padding: 6px 12px; background: none; border: 1px dashed var(--primary); border-radius: 10px; color: var(--primary); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.dp-dtab-new:hover, .dp-dtab-new:focus-visible { background: var(--primary-soft); }
.dp-draft-chip { white-space: nowrap; }
.dp-picker { position: relative; }
/* Bảng giá khi lên đơn (người thấy cả giá buôn và giá lẻ): ô chọn nằm cùng dòng nhãn "Sản phẩm". */
.field-label.dp-prod-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dp-pricebook { width: auto; min-width: 0; max-width: 100%; padding-top: 4px; padding-bottom: 4px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.dp-pricebook.dp-pricebook-le { border-color: var(--primary, #f97316); color: var(--primary, #f97316); }
.dp-results {
  display: flex; flex-direction: column; gap: 2px; max-height: 290px; overflow-y: auto; margin: 6px 0 8px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
}
.dp-results:empty { display: none; }
.dp-result { display: flex; flex-direction: column; gap: 1px; text-align: left; background: none; border: none; border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.dp-result:hover, .dp-result:focus-visible { background: #f5f9ff; }
.dp-result small { font-size: 12px; color: var(--faint); }
.dp-result small.dp-stock { color: var(--info-ink); }
.dp-noresult { padding: 8px 10px; font-size: 13px; color: var(--faint); }
.dp-chosen { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: #f5f9ff; border: 1px solid #bfdbfe; border-radius: 10px; }
.dp-chosen small { display: block; font-size: 12px; color: var(--faint); }
.dp-newcust { padding: 10px 12px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; }
/* Hàng 2 của dòng soạn đơn: Kho xuất của dòng + ghi chú dòng + "＋ Dòng cùng hàng" (cùng 1 hàng nhiều dòng: viên nguyên / viên cắt,
   hoặc lấy thêm ở kho khác). */
.dp-line-extra { grid-area: extra; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.dp-line-wh { display: flex; align-items: center; gap: 6px; flex: 0 1 300px; min-width: 0; }
.dp-line-whlab { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .02em; }
.dp-line .dp-line-whsel { flex: 1 1 auto; min-width: 0; width: auto; padding: 5px 8px; font-size: 13px; }
select.dp-wh-empty, .dp-line .dp-line-whsel.dp-wh-empty { border-color: var(--warn); background: var(--warn-soft); } /* Kế toán chưa chọn kho của dòng */
.dp-approve-wh select { width: 100%; min-width: 190px; padding: 6px 8px; }
.dp-line-extra .dp-line-note { flex: 1 1 200px; min-width: 0; padding: 5px 8px; font-size: 13px; }
.dp-line-split { flex: 0 0 auto; white-space: nowrap; }
.dp-line-notetag { font-weight: 600; }
/* Khách trả hàng: sản phẩm khách đã mua (bấm để thêm), hoàn tiền (trừ công nợ / trả tiền). */
.dp-ret-debt b { color: var(--text); }
.dp-ret-bought { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 2px; }
.dp-ret-bought > .hint { margin: 0; font-size: 12.5px; }
.dp-ret-chip {
  display: flex; flex-direction: column; gap: 1px; max-width: 260px; padding: 6px 10px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; font: inherit;
}
.dp-ret-chip b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-ret-chip small { font-size: 12px; color: var(--faint); white-space: nowrap; }
.dp-ret-chip:hover, .dp-ret-chip:focus-visible { background: #f5f9ff; border-color: #93c5fd; }
.dp-ret-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 4px 0 6px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; font-size: 13.5px; }
.dp-ret-pay label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.dp-ret-pay input[type='radio'] { width: auto; margin: 0; }
.dp-ret-pay select { width: auto; min-width: 190px; }
.dp-picker > .btn, .dp-newcust > .btn { margin-top: 2px; }
.dp-lines { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.dp-line {
  display: grid; gap: 4px 10px; align-items: end; padding: 9px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  grid-template-columns: minmax(0, 1fr) 110px 130px 120px 32px;
  grid-template-areas: 'name qty price total del' 'conv conv conv conv conv' 'warn warn warn warn warn';
}
/* Dòng có đơn vị bán (m² / viên / hộp…): ô số lượng kèm ô chọn đơn vị. */
.dp-line.dp-line-units { grid-template-columns: minmax(0, 1fr) 190px 130px 120px 32px; }
.dp-line.dp-line-x { grid-template-areas: 'name qty price total del' 'extra extra extra extra extra' 'conv conv conv conv conv' 'warn warn warn warn warn'; }
.dp-line .dp-qty-unit { display: flex; gap: 4px; margin: 0; font-size: inherit; font-weight: inherit; color: inherit; } /* không theo nhãn nhỏ của label > span */
.dp-qty-unit input { flex: 1 1 auto; min-width: 0; }
.dp-qty-unit select { flex: 0 0 auto; width: auto; max-width: 92px; }
.dp-line-conv { grid-area: conv; font-size: 12px; color: var(--faint); }
.dp-line-conv:empty { display: none; }
.dp-line-po { grid-template-columns: minmax(0, 1fr) 130px 32px; grid-template-areas: 'name qty del'; }
.dp-line-name { grid-area: name; align-self: center; min-width: 0; }
.dp-line-name small { display: block; font-size: 12px; color: var(--faint); }
.dp-line-qty { grid-area: qty; }
.dp-line-price { grid-area: price; }
.dp-line-total { grid-area: total; text-align: right; padding-bottom: 7px; white-space: nowrap; }
.dp-line-del { grid-area: del; align-self: center; }
.dp-line-warn { grid-area: warn; font-size: 12px; color: var(--warn-ink); }
.dp-line-warn:empty { display: none; }
.dp-line label > span, .dp-line-total > span { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 600; color: var(--faint); }
.dp-line .input { padding: 7px 9px; }
.dp-ed-grid { margin-top: 12px; }

/* ---------------------------------------------------------------- màn hình vừa & nhỏ */
@media (max-width: 1100px) {
  .dp-grid { grid-template-columns: minmax(0, 1fr); }
  .dp-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 16px; align-items: start; }
}

@media (max-width: 700px) {
  .dp-page .page-head p { display: none; }
  /* Việc của tôi: KPI và thông báo chưa đọc lên trước hộp việc, lối tắt xuống cuối */
  .dp-grid { display: flex; flex-direction: column; gap: 0; align-items: stretch; }
  .dp-side { display: contents; }
  .dp-kpi { order: -2; }
  .dp-notifs { order: -1; }
  .dp-notifs.is-empty, .dp-links { order: 1; }
  /* Thẻ tổng mục Nhà cung cấp (tới 4 thẻ, số tiền hàng chục tỷ): 2 cột — 3 cột làm số tiền bị cắt mất đuôi */
  .dp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dp-kpis .kpi { padding: 10px 10px 10px 14px; }
  .dp-kpis .kpi-lbl { font-size: 11px; }
  .dp-kpis .kpi-val { font-size: 15px; overflow-wrap: anywhere; }
  .dp-cards { grid-template-columns: minmax(0, 1fr); }
  .dp-hello-stats { gap: 18px; }
  .dp-toolbar input[type=search] { flex: 1 1 100%; max-width: none; }
  .dp-toolbar .input, .dp-toolbar .btn { flex: 1 1 auto; }
  .dp-toolbar .spacer { display: none; }
  .dp-list-card { padding: 4px 12px; }

  /* bảng → thẻ: mỗi dòng một khối, mỗi ô "nhãn: giá trị" */
  .table.dp-rtable { min-width: 0; }
  .dp-rtable thead { display: none; }
  .dp-rtable, .dp-rtable tbody, .dp-rtable tr { display: block; width: 100%; }
  .dp-rtable tr { padding: 10px 2px; border-bottom: 1px solid var(--border); }
  .dp-rtable tbody tr:last-child { border-bottom: none; }
  .table.dp-rtable td { display: flow-root; width: 100%; min-width: 0; max-width: none; padding: 3px 0; border: none; text-align: right; overflow-wrap: anywhere; }
  .table.dp-rtable td[data-label]::before { content: attr(data-label); float: left; margin-right: 12px; font-size: 12px; font-weight: 500; color: var(--faint); text-align: left; }
  .table.dp-rtable td.dp-main { padding-bottom: 5px; text-align: left; font-weight: 600; }
  .table.dp-rtable td:empty { display: none; }
  .dp-row-late > td:first-child { box-shadow: none; }
  .dp-rtable tr.dp-row-late { box-shadow: inset 3px 0 0 var(--bad); padding-left: 10px; }
  .dp-rtable .sub { font-weight: 400; }
  .dp-orders td:nth-child(5) .dp-badges, .dp-pos td:nth-child(7) .dp-badges { justify-content: flex-end; }
  .dp-cov tr.dp-short td { background: none; }
  .dp-cov tr.dp-short { background: #fff7f7; }
  .dp-row-acts { padding-top: 6px !important; }

  /* hộp thoại toàn màn hình */
  /* flex-start (không stretch): hộp cao theo nội dung, cuộn cả lớp nền — stretch làm hộp chỉ cao bằng màn hình, phần dưới tràn ra nền trong suốt */
  .modal-backdrop.dp-backdrop { padding: 0; align-items: flex-start; }
  .dp-modal, .dp-modal.modal-wide { max-width: none; min-height: 100%; border-radius: 0; }
  .dp-modal .modal-head { position: sticky; top: 0; z-index: 3; padding: 12px 16px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .dp-modal .modal-head h3 { font-size: 16px; }
  .dp-modal .modal-body { padding: 12px 16px 20px; }
  .dp-modal .grid-2 { grid-template-columns: 1fr; }
  .dp-modal input, .dp-modal select, .dp-modal textarea { font-size: 16px; } /* iPhone không tự phóng to khi chạm ô nhập */
  .dp-modal .modal-actions { position: sticky; bottom: 0; z-index: 2; margin: 14px -16px -20px; padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--border); }
  .dp-modal .modal-actions .btn { flex: 1 1 auto; }
  /* Báo lỗi nằm ngay trên thanh nút dính đáy: cuộn tới thì chừa chỗ cho thanh nút (trước đây bị che — bấm Lưu tưởng không có gì). */
  .dp-modal .form-error { scroll-margin-bottom: 150px; } /* thanh nút xuống 2 hàng khi nhiều nút (~110 px) */
  .dp-facts { grid-template-columns: 1fr 1fr; padding: 10px 12px; }
  .dp-totals { max-width: none; }
  .dp-actions .btn { flex: 1 1 auto; }
  .dp-step { flex-basis: 70px; font-size: 11px; }
  .input.dp-qty, .input.dp-money { width: 120px; }

  .dp-line, .dp-line.dp-line-units { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; grid-template-areas: 'name name del' 'qty price price' 'conv conv conv' 'total total total' 'warn warn warn'; }
  .dp-line.dp-line-x { grid-template-areas: 'name name del' 'extra extra extra' 'qty price price' 'conv conv conv' 'total total total' 'warn warn warn'; }
  .dp-line-wh { flex: 1 1 100%; }
  .dp-line-po { grid-template-areas: 'name name del' 'qty qty qty'; }
  .dp-line-total { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0 0; }
  .dp-line-total > span { margin: 0; }
}

@media (max-width: 420px) {
  .dp-hello-stats .stat b { font-size: 17px; }
}

/* Đơn chờ duyệt (Kế toán / Quản lý duyệt đơn Sale gửi, đơn khách tự đặt) */
.dp-hint { color: var(--dim); font-size: 13px; margin: 0 0 12px; line-height: 1.55; }
.dp-pending-list { display: flex; flex-direction: column; gap: 12px; }
.dp-pending { margin: 0; cursor: pointer; border-left: 4px solid var(--info); }
.dp-pending.is-late { border-left-color: var(--bad); }
.dp-pending:hover { box-shadow: 0 0 0 1px var(--border-strong), var(--shadow); }
.dp-pending-time { margin-left: auto; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.dp-pending-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; margin-top: 8px; align-items: start; }
.dp-pending .dp-item-title { font-size: 15px; white-space: normal; }
.dp-pending-lines { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; color: var(--ink); }
.dp-pending-lines li { padding: 2px 0; overflow-wrap: anywhere; }
.dp-pending-note { margin-top: 6px; font-size: 12.5px; color: var(--dim); background: var(--surface-2); border-radius: 8px; padding: 5px 9px; overflow-wrap: anywhere; }
.dp-pending-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; min-width: 190px; }
.dp-pending-debt { text-align: right; font-size: 12.5px; color: var(--faint); }
.dp-pending-debt b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.dp-pending-debt b.neg { color: var(--bad-ink); }
.dp-pending-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) {
  .dp-pending-body { grid-template-columns: minmax(0, 1fr); }
  .dp-pending-side { align-items: stretch; min-width: 0; }
  .dp-pending-debt { text-align: left; }
  .dp-pending-acts { justify-content: flex-start; }
}

/* Đơn đã bán (từ Bán hàng): mã đơn Bán hàng cạnh mã Điều phối; khối kiểm hàng (tồn sổ sách, số thiếu). */
.dp-hd { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.dp-presold { display: flex; flex-direction: column; gap: 8px; }
.dp-presold .btn { align-self: flex-start; }
.dp-presold .dp-owed { font-size: 13px; }
.dp-check-table { margin: 0; font-variant-numeric: tabular-nums; }
.dp-check-table td, .dp-check-table th { padding: 6px 8px; vertical-align: top; }
.dp-check-table .sub { font-size: 12px; }
.dp-check-table .sub.warn { color: var(--warn, #b45309); }
.dp-check-table .dp-qty { width: 90px; text-align: right; margin-left: auto; }
@media (max-width: 700px) {
  .dp-check-table .dp-qty { width: 76px; font-size: 16px; }
}
.dp-fact .dp-print { margin-top: 4px; }
