/* =====================================================================================
   LCD Pro 2 - THÀNH PHẦN MỚI (dùng được ở cả giao diện mới lẫn cũ)
   1. Trang chủ "Hôm nay"  (lớp .td-*)      templates/dashboard.html
   2. Ô tìm nhanh Ctrl+K   (lớp .cp-*)      static/js/palette.js
   Tên lớp có tiền tố riêng nên không đụng style.css.
   ===================================================================================== */

/* ================= 1. TRANG CHỦ "HÔM NAY" ================= */
.td-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 16px; }
.td-hello { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--text); }
.td-date { margin-top: 3px; font-size: 13px; color: var(--text-muted); }
.td-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.td-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 900px) { .td-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.td-stat {
    display: flex; flex-direction: column; gap: 2px;
    padding: 14px 16px;
    background: var(--bg-card, #fff); border: 1px solid var(--border); border-radius: 12px;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.td-stat:hover { opacity: 1; border-color: #C5CEDB; box-shadow: 0 6px 18px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.td-stat-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.td-stat-label i { width: 22px; height: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; background: var(--primary-light); color: var(--primary); }
.td-stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.td-stat-note { font-size: 11.5px; color: var(--text-muted); }
.td-stat.is-warn .td-stat-label i { background: var(--warning-light); color: #B45309; }
.td-stat.is-good .td-stat-label i { background: var(--success-light); color: var(--success); }
.td-stat.is-money .td-stat-label i { background: #EDE9FE; color: #7C3AED; }

.td-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) { .td-cols { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); } }
.td-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.td-col > .card { margin-bottom: 0; }

.td-title { display: flex; align-items: center; gap: 8px; }
.td-title .td-n { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #EEF2F7; color: #475569; font-size: 12px; font-weight: 700; text-align: center; }
.td-title .td-n.is-hot { background: var(--danger-light); color: var(--danger); }
.td-more { font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* danh sách việc */
.td-list { display: flex; flex-direction: column; }
.td-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    min-width: 0;
}
.td-row:last-child { border-bottom: none; }
a.td-row:hover { background: rgba(var(--primary-rgb), .04); opacity: 1; }
.td-ico { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; background: var(--primary-light); color: var(--primary); }
.td-ico.is-danger { background: var(--danger-light); color: var(--danger); }
.td-ico.is-warn { background: var(--warning-light); color: #B45309; }
.td-ico.is-good { background: var(--success-light); color: var(--success); }
.td-ico.is-info { background: var(--info-light); color: var(--info); }
.td-main { flex: 1 1 auto; min-width: 0; }
.td-main strong { display: block; font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-main span { display: block; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-side { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.td-side .fa-chevron-right { font-size: 10px; color: #B6C0D0; }
.td-group { padding: 9px 16px 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #F8FAFC; border-bottom: 1px solid var(--border); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748B; }
.td-group form { margin: 0; }
.td-clear { padding: 30px 16px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.td-clear i { display: block; font-size: 30px; color: var(--success); margin-bottom: 8px; }

/* dòng chảy công đoạn */
.td-pipe { padding: 14px 16px 16px; }
.td-pipe-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #EEF2F7; margin-bottom: 12px; }
.td-pipe-bar span { display: block; min-width: 6px; }
.td-pipe-items { display: flex; flex-wrap: wrap; gap: 8px; }
.td-pipe-item { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font-size: 13px; }
.td-pipe-item:hover { border-color: #C5CEDB; background: #F8FAFC; opacity: 1; }
.td-pipe-item i { width: 9px; height: 9px; border-radius: 50%; }
.td-pipe-item b { font-weight: 800; }
.td-pipe-item small { font-size: 11px; color: var(--text-muted); }

.td-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 14px; }
.td-chip { padding: 5px 10px; border-radius: 8px; background: var(--warning-light); color: #92400E; font-size: 12px; font-weight: 600; }
.td-chip.is-zero { background: var(--danger-light); color: var(--danger); }
.td-status { display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

@media (max-width: 767px) {
    .td-hello { font-size: 19px; }
    .td-stat { padding: 12px 13px; }
    .td-stat-value { font-size: 22px; }
    .td-row { padding: 11px 13px; gap: 10px; }
    .td-side .td-hide-m { display: none; }
}

/* ================= 2. Ô TÌM NHANH (Ctrl+K) ================= */
.cp-backdrop {
    position: fixed; inset: 0; z-index: 3500;
    display: none; align-items: flex-start; justify-content: center;
    padding: 9vh 16px 16px;
    background: rgba(15, 23, 42, .5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.cp-backdrop.show { display: flex; }
.cp-box {
    width: 100%; max-width: 620px; max-height: 76vh;
    display: flex; flex-direction: column;
    background: #fff; border-radius: 16px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(2, 6, 23, .45);
    animation: cpIn .14s ease-out;
}
@keyframes cpIn { from { transform: translateY(-8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.cp-head { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid #E3E7EE; }
.cp-head > i { color: #7B8698; font-size: 16px; }
.cp-input { flex: 1; min-width: 0; height: 54px; border: none; outline: none; background: none; font: inherit; font-size: 16px; color: #0F172A; }
.cp-input::placeholder { color: #9AA5B5; }
.cp-esc { padding: 3px 8px; border: 1px solid #E3E7EE; border-radius: 6px; background: #F8FAFC; color: #5B6577; font: 600 11px/1.4 inherit; cursor: pointer; }
.cp-list { overflow-y: auto; padding: 6px 8px 8px; overscroll-behavior: contain; }
.cp-group { padding: 10px 10px 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7B8698; }
.cp-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: #0F172A; cursor: pointer; min-width: 0; }
.cp-item:hover { opacity: 1; }
.cp-item.active { background: #EEF4FF; }
.cp-ico { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 13px; background: #EEF2F7; color: #475569; }
.cp-item.active .cp-ico { background: var(--primary); color: #fff; }
.cp-txt { flex: 1 1 auto; min-width: 0; }
.cp-txt b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-txt small { display: block; font-size: 12px; color: #7B8698; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-tag { flex: 0 0 auto; padding: 2px 8px; border-radius: 7px; font-size: 11px; font-weight: 700; background: var(--primary-light); color: var(--primary); white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.cp-tag.success { background: #DCFCE7; color: #16A34A; }
.cp-tag.muted { background: #F1F5F9; color: #64748B; }
.cp-meta { flex: 0 0 auto; font-size: 11.5px; color: #9AA5B5; white-space: nowrap; }
.cp-empty { padding: 26px 16px; text-align: center; color: #7B8698; font-size: 13.5px; }
.cp-foot { display: flex; gap: 14px; flex-wrap: wrap; padding: 9px 16px; border-top: 1px solid #E3E7EE; background: #F8FAFC; font-size: 11.5px; color: #7B8698; }
.cp-foot kbd { padding: 1px 6px; border: 1px solid #E3E7EE; border-radius: 5px; background: #fff; font: 600 10.5px/1.5 inherit; color: #5B6577; }
.cp-loading { margin-left: auto; }
@media (max-width: 640px) {
    .cp-backdrop { padding: 0; }
    .cp-box { max-width: none; max-height: 100dvh; height: 100dvh; border-radius: 0; }
    .cp-foot { display: none; }
    .cp-esc { padding: 6px 10px; font-size: 12px; }
}

/* ================= 3. FORM ĐƠN HÀNG: bảng "Tóm tắt & kiểm tra" (.of-*) =================
   static/js/order-form.js dựng các phần tử này cạnh form tạo đơn / sửa đơn. */
.of-layout { display: block; }
.of-main > .card { margin-bottom: 0; }
.of-side { display: none; }
.of-panel { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.of-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 14.5px; font-weight: 700; color: var(--text); }
.of-head i { color: var(--primary); margin-right: 4px; }
.of-close { border: none; background: #EEF2F7; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1; color: #475569; cursor: pointer; }
.of-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.of-step { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font: inherit; font-size: 12px; font-weight: 600; color: #475569; cursor: pointer; }
.of-step i { font-size: 11px; }
.of-step:hover { border-color: #C5CEDB; }
.of-step.is-ok { border-color: #BBF7D0; background: #F0FDF4; color: #15803D; }
.of-step.is-bad { border-color: #FECACA; background: #FEF2F2; color: #B91C1C; }
.of-sec, .of-money, .of-issues { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.of-panel h4 { margin: 0 0 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.of-cust b { display: block; font-size: 14px; font-weight: 700; }
.of-cust > span { font-size: 12.5px; color: var(--text-muted); }
.of-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.of-tag { padding: 2px 8px; border-radius: 7px; background: #EEF2F7; color: #475569; font-size: 11.5px; font-weight: 700; }
.of-tag.is-debt { background: var(--danger-light); color: var(--danger); }
.of-tag.is-vip { background: #FEF3C7; color: #92400E; }
.of-open { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.of-open a { font-size: 12.5px; font-weight: 600; }
.of-open small { font-weight: 400; color: var(--text-muted); }
.of-line { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.of-line span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.of-line b { font-weight: 600; white-space: nowrap; }
.of-line.is-empty span { color: var(--text-muted); font-style: italic; }
.of-money > div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.of-money .of-final { margin-top: 4px; padding-top: 7px; border-top: 1px dashed var(--border); font-size: 14px; font-weight: 700; align-items: baseline; }
.of-money .of-final b { font-size: 19px; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }
.of-issues { padding-bottom: 12px; }
.of-issues h4:not(:first-child) { margin-top: 10px; }
.of-issue { display: flex; align-items: flex-start; gap: 8px; width: 100%; margin-bottom: 5px; padding: 7px 9px; border: 1px solid #FECACA; border-radius: 9px; background: #FEF2F2; color: #991B1B; font: inherit; font-size: 12.5px; line-height: 1.35; text-align: left; }
button.of-issue { cursor: pointer; }
button.of-issue:hover { background: #FEE2E2; }
.of-issue i { margin-top: 2px; flex: 0 0 auto; }
.of-issue.is-warn { border-color: #FDE68A; background: #FFFBEB; color: #92400E; }
.of-ready { padding: 9px 10px; border: 1px solid #BBF7D0; border-radius: 9px; background: #F0FDF4; color: #15803D; font-size: 13px; font-weight: 600; }
.of-hint { margin-top: 8px; text-align: center; font-size: 11.5px; color: var(--text-muted); }
.of-hint kbd { padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; background: #F8FAFC; font: 600 10.5px/1.5 inherit; color: #475569; }
@keyframes ofPulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); } 100% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); } }
.of-pulse { animation: ofPulse .8s ease-out 2; border-color: #DC2626 !important; }
form.of-form .section-title, form.of-form .battery-item, form.of-form .img-sec { scroll-margin-top: calc(var(--top-bar-height, 56px) + 14px); }

/* thanh dưới: điện thoại / màn hình hẹp (thay cho bảng bên cạnh) */
.of-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 105; display: flex; align-items: center; gap: 10px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: #fff;
    border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(15, 23, 42, .08); }
.of-bar-issues { flex: 0 0 auto; min-width: 46px; height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid #BBF7D0; background: #F0FDF4; color: #15803D; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.of-bar-issues.is-bad { border-color: #FECACA; background: #FEF2F2; color: #B91C1C; }
.of-bar-issues.is-warn { border-color: #FDE68A; background: #FFFBEB; color: #92400E; }
.of-bar-total { flex: 1 1 auto; min-width: 0; line-height: 1.15; }
.of-bar-total small { display: block; font-size: 10.5px; color: var(--text-muted); }
.of-bar-total b { font-size: 17px; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }
.of-bar .of-bar-save { flex: 0 0 auto; min-height: 42px; padding: 0 20px; }
@media (max-width: 1099px) {
    body.of-active .bottom-nav { display: none; }                 /* đang lập đơn: nhường chỗ cho thanh Lưu */
    body.of-active .main-content { padding-bottom: 78px; }
    .of-side.is-open { display: block; position: fixed; left: 8px; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom, 0px));
        z-index: 106; max-height: 70vh; overflow-y: auto; border-radius: 14px; box-shadow: 0 20px 50px rgba(2, 6, 23, .35); }
    .of-side.is-open .of-save, .of-side.is-open .of-hint { display: none; }
}
@media (min-width: 768px) and (max-width: 1099px) {
    .of-bar { left: var(--sidebar-width, 280px); }
}
@media (min-width: 1100px) {
    .of-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
    .of-side { display: block; position: sticky; top: calc(var(--top-bar-height, 56px) + 16px);
        max-height: calc(100vh - var(--top-bar-height, 56px) - 32px); overflow-y: auto; }
    .of-bar, .of-close { display: none !important; }
}
/* máy tính: tên khách | SĐT và đã thu | giảm giá nằm cùng hàng (trình duyệt cũ không hỗ trợ :has thì vẫn xếp dọc như trước) */
@media (min-width: 768px) {
    form.of-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 16px; }
    form.of-form > * { grid-column: 1 / -1; min-width: 0; }
    form.of-form > .form-group:has(#customerNameInput), form.of-form > .form-group:has(#phoneInput),
    form.of-form > .form-group:has([name="paid_amount"]), form.of-form > .form-group:has(#createDiscount) { grid-column: auto; }
}

/* ================= 4. TRANG CHI TIẾT ĐƠN (.ov-*) - static/js/order-view.js ================= */
.ov-nav { position: sticky; top: var(--top-bar-height, 56px); z-index: 80; display: flex; gap: 6px; overflow-x: auto;
    margin: 0 0 10px; padding: 8px 12px; background: var(--bg); scrollbar-width: none; }
.ov-nav::-webkit-scrollbar { display: none; }
.ov-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
    background: #fff; color: #475569; font: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.ov-chip:hover { border-color: #C5CEDB; color: var(--text); }
.ov-chip i { font-size: 11px; }
.ov-chip.is-primary { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(var(--primary-rgb), .3); }
.ov-on .card, .ov-on .ov-layout .card { scroll-margin-top: calc(var(--top-bar-height, 56px) + 58px); }
@keyframes ovFlash { 0% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb), .5); } 100% { box-shadow: 0 0 0 12px rgba(var(--primary-rgb), 0); } }
.ov-flash { animation: ovFlash .7s ease-out 2; }
@media (min-width: 768px) {
    .ov-nav { margin: 0 0 12px; padding: 8px 0; }
    body:not(.ui2) .ov-nav { top: 0; }                 /* giao diện cũ: thanh trên không dính khi cuộn */
}
@media (min-width: 1100px) {
    .ov-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
    .ov-main, .ov-side { min-width: 0; }
}

/* ================= 5. BẢNG QUY TRÌNH (.kb-*) - templates/process/kanban.html ================= */
.kb-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-search { position: relative; flex: 1 1 220px; min-width: 180px; max-width: 420px; }
.kb-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
.kb-search .form-input { padding-left: 34px; height: 38px; padding-top: 0; padding-bottom: 0; font-size: 14px; }
.kb-toolbar .kt-info { margin-left: auto; }
.kb-nomatch { margin: 10px 0; padding: 14px; border: 1px dashed var(--border); border-radius: 10px; background: #fff; color: var(--text-muted); font-size: 13.5px; text-align: center; }
.kb-age { padding: 1px 7px; border-radius: 999px; background: #EEF2F7; color: #475569; font-size: 11px; font-weight: 700; white-space: nowrap; }
.kb-age.is-warn { background: var(--warning-light); color: #92400E; }
.kb-age.is-late { background: var(--danger-light); color: var(--danger); }
.kanban-card.kb-mine { border-left: 3px solid var(--primary); }
.kb-doing strong { color: var(--text); font-weight: 600; }

/* chi tiết đơn - bổ sung: nút thao tác trong cột phải xuống dòng (không tràn ngang), lối tắt Sửa / In */
.ov-gap { flex: 1 0 8px; }
.ov-chip.is-action { border-color: #C7D7FE; background: #EEF4FF; color: var(--primary); }
.ov-chip.is-action:hover { background: #E0EAFF; opacity: 1; }
.ov-side .form-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.ov-side .form-actions > * { flex: 1 1 calc(50% - 4px); min-width: 0; }
.ov-side .form-actions .btn { width: 100%; white-space: normal; }
.ov-side .card-body { overflow-wrap: anywhere; }

/* bảng quy trình trên điện thoại: ô lọc một hàng, hai nút chia đôi hàng dưới */
@media (max-width: 767px) {
    .kb-search { flex: 1 1 100%; max-width: none; }
    .kb-toolbar > .btn { flex: 1 1 0; }
    .kb-toolbar .kt-info { flex: 1 1 100%; margin-left: 0; }
}

/* ================= 6. CÔNG CỤ DANH SÁCH (.lt-*) - static/js/list-tools.js ================= */
.lt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.lt-chip { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: #475569;
    font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.lt-chip b { margin-left: 4px; font-weight: 700; color: var(--text-muted); }
.lt-chip:hover { border-color: #C5CEDB; }
.lt-chip.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.lt-chip.active b { color: rgba(255, 255, 255, .85); }
.lt-count { margin-left: auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
th[data-lt-sort] { cursor: pointer; user-select: none; }
th[data-lt-sort]::after { content: " \21C5"; opacity: .35; font-size: 10px; }
th[data-lt-sort].lt-asc::after { content: " \25B2"; opacity: 1; }
th[data-lt-sort].lt-desc::after { content: " \25BC"; opacity: 1; }
.lt-empty, .lt-empty td { padding: 22px 16px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.lt-sort { width: auto; min-width: 150px; height: 34px; padding: 0 10px; font-size: 12.5px; font-weight: 600; border-radius: 999px; }
a.lt-chip { text-decoration: none; display: inline-flex; align-items: center; }
a.lt-chip:hover { text-decoration: none; }
td.lt-barcell { background-image: linear-gradient(to right, rgba(var(--primary-rgb), .13), rgba(var(--primary-rgb), .13));
    background-repeat: no-repeat; background-size: var(--lt-w, 0%) 62%; background-position: left center; }
@media (max-width: 767px) { .lt-count { flex: 1 1 100%; margin-left: 0; } .lt-sort { flex: 1 1 auto; } }
@media print { .lt-bar { display: none !important; } }

/* ================= 7. BÁO CÁO (.rp-*) - templates/reports/_nav.html ================= */
.rp-nav { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 4px; scrollbar-width: thin; }
.rp-tab { flex: 0 0 auto; padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: #475569;
    font-size: 12.5px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.rp-tab:hover { border-color: #C5CEDB; color: var(--text); text-decoration: none; }
.rp-tab.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.rp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rp-period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.rp-period .form-input { width: auto; min-width: 0; height: 36px; padding: 0 10px; font-size: 13.5px; font-weight: 600; }
.rp-period .rp-step { width: 36px; height: 36px; padding: 0; justify-content: center; }
.rp-period .btn { height: 36px; }
.rp-print { margin-left: auto; }
.rp-group { margin-bottom: 18px; }
.rp-group-title { margin: 0 2px 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.rp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rp-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff;
    color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.rp-card:hover { border-color: #C7D7FE; box-shadow: 0 4px 14px rgba(15, 23, 42, .06); text-decoration: none; }
.rp-card-icon { flex: 0 0 40px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 10px;
    background: #EEF4FF; color: var(--primary); font-size: 16px; }
.rp-card-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rp-card-text strong { font-size: 14.5px; }
.rp-card-text span { font-size: 12.5px; color: var(--text-muted); line-height: 1.35; }
.rp-card-go { color: #C7CDD6; font-size: 11px; }
.rp-rank { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.rp-rank:last-child { border-bottom: 0; }
a.rp-rank:hover { background: #F9FAFB; text-decoration: none; }
.rp-rank-no { flex: 0 0 20px; font-weight: 700; color: var(--text-muted); }
.rp-rank-name { flex: 1 1 auto; min-width: 0; font-size: 14px; }
.rp-rank-bar { display: block; height: 5px; margin-top: 5px; border-radius: 3px; background: #EEF2F7; overflow: hidden; }
.rp-rank-bar span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.rp-rank-bar.is-danger span { background: var(--danger); }
@media (max-width: 767px) {
    .rp-period .form-input { flex: 1 1 0; }
    .rp-period { flex: 1 1 100%; }
    .rp-print { margin-left: 0; }
}
@media print { .rp-nav, .rp-head { display: none !important; } }

/* ================= 8. KHÁCH HÀNG (.cu-*) và CÔNG NỢ (.dc-*, .dr-age) ================= */
.cu-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cu-ava { flex: 0 0 48px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
    background: #EEF4FF; color: var(--primary); font-size: 20px; font-weight: 700; }
.cu-who { flex: 1 1 200px; min-width: 0; }
.cu-name { font-size: 18px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.cu-sub { margin-top: 2px; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.cu-sub a { color: inherit; font-weight: 600; }
.cu-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cu-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.cu-stat { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); min-width: 0; }
.cu-stat span { display: block; font-size: 11.5px; color: var(--text-muted); }
.cu-stat strong { display: block; margin-top: 2px; font-size: 16px; overflow-wrap: anywhere; }
.cu-stat.is-danger { border-color: #FCA5A5; background: #FEF2F2; }
.cu-stat.is-danger strong { color: var(--danger); }
.cu-stat.is-ok { border-color: #BBF7D0; background: #ECFDF5; }
.cu-stat.is-ok strong { color: #047857; }
.cu-stat.is-warn strong { color: #B45309; }
.cu-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.cu-main, .cu-side { min-width: 0; }
.cu-search { width: 220px; max-width: 100%; height: 34px; padding: 0 10px; font-size: 13px; }
.cu-bar { padding: 10px 12px 0; }
.cu-bar:empty { display: none; }
.cu-bar.lt-bar { margin: 0; }
@media (min-width: 1100px) { .cu-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; } }
@media (max-width: 767px) {
    .cu-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cu-actions { flex: 1 1 100%; }
    .cu-actions .btn { flex: 1 1 auto; justify-content: center; }
    .cu-search { width: 100%; }
}
.dr-age { flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; background: var(--warning-light, #FEF3C7); color: #92400E; font-size: 11px; font-weight: 700; white-space: nowrap; }
.dr-age.is-old { background: var(--danger-light, #FEE2E2); color: var(--danger); }
.dc-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 12.5px; font-weight: 600; }
.dc-quick { margin-top: 8px; }
.dc-hint { margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.dc-hint.is-ok { color: #047857; font-weight: 600; }
.dc-hint.is-over { color: #B45309; font-weight: 600; }
@media (min-width: 1100px) {
    .dc-layout { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 18px; align-items: start; }
    .dc-pay { position: sticky; top: calc(var(--top-bar-height, 56px) + 12px); }
    .dc-pay, .dc-info { min-width: 0; }
    .dc-back { display: none; }
}

/* ================= 9. LẮP RÁP (.bm-*) - templates/bom/index.html ================= */
.bm-how { margin: 0 0 12px; padding: 8px 12px; border: 1px dashed var(--border); border-radius: 10px; background: #fff; font-size: 13px; color: var(--text-muted); }
.bm-how summary { cursor: pointer; font-weight: 600; }
.bm-pending { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid #FDE68A; border-radius: 10px;
    background: #FFFBEB; color: #92400E; font-size: 13.5px; }
.bm-pending a { font-weight: 700; }
.lt-count-line { padding: 8px 16px; }
.lt-count-line:empty { display: none; }
