/* v52: font Hanken Grotesk tự lưu trên máy chủ + icon Lucide — xem ui.css / icons.css (không còn tải từ Google Fonts / jsDelivr) */

/* MÀU CHỮ — các giá trị dưới đây đã được đo tương phản theo chuẩn WCAG AA (chữ thường cần
   >= 4,5:1 so với nền nó nằm lên). ĐỪNG đổi sang màu nhạt hơn nếu chưa đo lại: chữ xám nhạt
   #9ca3af trước đây chỉ đạt 2,5:1 trên nền trắng (gần như không đọc được ngoài nắng).
   QUY TẮC: --accent/--success/--warning/--danger DÙNG CHO CHỮ + viền + cột biểu đồ.
   Nút có NỀN ĐẶC chữ trắng phải dùng --*-solid (xem bên dưới), vì ở chế độ tối 4 biến trên
   được làm SÁNG lên để đọc được trên nền tối → chữ trắng đặt lên sẽ mất hút. */
:root {
    --bg-page: #f4f5f7;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #646b78;
    --accent: #4338ca;
    --accent-bg: #eef2ff;
    --success: #147a3a;
    --success-bg: #dcfce7;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    /* Nền đặc cho nút/nhãn có CHỮ TRẮNG — giữ đậm ở cả 2 chế độ (>= 5:1 với chữ trắng). */
    --accent-solid: #4338ca;
    --success-solid: #15803d;
    --warning-solid: #b45309;
    --danger-solid: #b91c1c;
    --radius: 12px;
}

/* Chế độ tối — bật bằng thuộc tính data-theme="dark" trên thẻ <html>, gán qua JS + lưu
   localStorage (xem app.js). Ngoài nền/viền/chữ, 4 màu nhấn cũng phải đổi: bản gốc giữ
   nguyên #4338ca/#16a34a/#b45309/#dc2626 cho cả 2 chế độ, nhưng trên nền tối chúng chỉ đạt
   1,7–3,9:1 (mục "Tổng quan" đang chọn ở thanh bên chỉ 1,66:1 — chữ chìm hẳn vào nền).
   Các giá trị dưới đây đạt 5,4–9,6:1 trên nền thẻ/nền trang/nền nhãn tương ứng. */
[data-theme="dark"] {
    --bg-page: #16171d;
    --bg-card: #1f2128;
    --border: #333540;
    --text-primary: #f0f1f4;
    --text-secondary: #c4c7d0;
    --text-muted: #9ea1ac;
    --accent: #a5b4fc;
    --accent-bg: #2a2d55;
    --success: #4ade80;
    --success-bg: #123a24;
    --warning: #fbbf24;
    --warning-bg: #4a3510;
    --danger: #f87171;
    --danger-bg: #4a1616;
    --accent-solid: #4f46e5;
}
/* .btn-primary dùng var(--text-primary) làm NỀN (đậm ở light mode) — trong dark mode
   --text-primary lại là màu SÁNG (chữ dễ đọc trên nền tối), nên phải ghi đè riêng, nếu
   không nút primary sẽ có nền sáng + chữ trắng, gần như không đọc được. */
[data-theme="dark"] .btn-primary { background: var(--accent-solid); border-color: var(--accent-solid); }
[data-theme="dark"] .btn-primary:hover { background: #5b52d6; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
}

a { text-decoration: none; color: inherit; }

/* ===== LAYOUT ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 1rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    overflow-y: auto;
    transition: width 0.18s ease;
}

/* ===== SIDEBAR THU NHỎ (chỉ hiện icon + logo) ===== */
.sidebar.collapsed {
    width: 64px;
    padding: 1rem 0.5rem;
}
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .sidebar-lang,
.sidebar.collapsed .nav-admin-group { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; }
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.5rem;
}
.sidebar.collapsed .nav-item i { width: 18px; }   /* v107: icon vẽ bằng CSS mask (v52) không có chữ bên trong → width:auto = 0px, mất icon khi thu nhỏ thanh bên */
.sidebar.collapsed .user-card { justify-content: center; padding: 0.55rem; }
.sidebar.collapsed .btn-logout { padding: 0.35rem; }

/* Nút thu nhỏ/mở rộng — nổi thành hình tròn nhỏ, nằm đè lên viền phải sidebar
   (tách biệt hoàn toàn khỏi hàng logo, tránh tạo khoảng trống lạc lõng cạnh logo) */
.sidebar-toggle-btn {
    position: absolute;
    top: 22px;
    right: -12px;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 5;
    transition: transform 0.18s ease;
}
.sidebar-toggle-btn:hover { background: var(--bg-page); }
.sidebar.collapsed .sidebar-toggle-btn { transform: rotate(180deg); }

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.3rem 0.6rem;
    font-weight: 600;
    font-size: 1rem;
}

.sidebar-lang {
    display: flex;
    gap: 4px;
    background: var(--bg-page);
    border-radius: 999px;
    padding: 3px;
    margin-bottom: 0.4rem;
}
.sidebar-lang button {
    flex: 1;
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
}
.sidebar-lang button.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-page);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
}
.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.role-badge {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    width: 100%;
    padding: 0.35rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
}
.btn-logout:hover { background: var(--bg-page); }

.sidebar-divider { border-top: 1px solid var(--border); margin: 0.2rem 0; }

.nav-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0.42rem 0.6rem;
    border-radius: 7px;
    border-left: 3px solid transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
    transition: background-color 0.15s, border-color 0.15s;
}
.nav-item i { font-size: 1rem; width: 18px; text-align: center; color: var(--text-secondary); }
.nav-item:hover { background: var(--bg-page); }
.nav-item.active {
    background: var(--accent-bg);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}
.nav-item.active i { color: var(--accent); }

.nav-subgroup { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.nav-subitem { padding-left: 1.6rem; font-size: 0.84rem; }
.nav-subitem i { font-size: 0.92rem; }
.sidebar.collapsed .nav-subgroup { display: none !important; }

.nav-admin-group { margin-top: 0.4rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; min-width: 0; padding: 1.4rem 1.8rem; }

.page-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    font-size: 1.15rem;
    font-weight: 600;
}
.page-header .subtitle { color: var(--text-muted); font-weight: 400; font-size: 0.95rem; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}
.card-title { font-size: 0.92rem; font-weight: 600; margin-bottom: 0.7rem; }

/* Metric card */
.metric-grid { display: grid; gap: 0.8rem; }
.metric-grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.metric-grid.cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.metric-card { background: var(--bg-page); border-radius: 10px; padding: 0.75rem 0.9rem; }
.metric-card .lbl { font-size: 0.75rem; color: var(--text-secondary); }
.metric-card .val { font-size: 1.15rem; font-weight: 600; margin-top: 3px; }
.metric-card.main .val { color: var(--accent); font-size: 1.4rem; }
.metric-card .val.success { color: var(--success); }
.metric-card .val.danger { color: var(--danger); }

/* Status grid (Cần xử lý) */
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.status-item {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--border); border-radius: 10px;
    padding: 0.6rem 0.75rem; cursor: pointer; background: none; text-align: left;
    font-family: inherit; font-size: 0.85rem; color: var(--text-primary);
}
.status-item:hover { background: var(--bg-page); }
.status-item .badge-icon {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}

/* Breakdown rows (Accounts Manager / Nhân viên) */
.breakdown-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0; border-top: 1px solid #f0f0f2; font-size: 0.85rem;
}
.breakdown-row:first-of-type { border-top: none; }
.breakdown-row .lbl { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.breakdown-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.breakdown-row .val { font-weight: 600; }
.breakdown-row .goto-btn {
    border: none; background: transparent; color: var(--accent);
    cursor: pointer; font-size: 0.9rem; padding: 2px 6px; margin-left: 6px;
}
.breakdown-row .goto-btn:hover { text-decoration: underline; }

.link-btn {
    border: none; background: transparent; color: var(--accent);
    font-size: 0.78rem; cursor: pointer; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.empty-state { text-align: center; padding: 1.4rem 0; color: var(--text-muted); font-size: 0.85rem; }
.empty-state .circle {
    width: 56px; height: 56px; border-radius: 50%; background: var(--bg-page);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 0.6rem; font-size: 1.4rem;
}

/* Badges (payment_status, status) */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-paid { background: var(--success-bg); color: var(--success); }
.badge-cancelled { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--bg-page); color: var(--text-secondary); }
/* Nhãn màu TỰ CHỌN (Accounts Manager, Sale Amount, Trạng thái, Nguồn khách, Nhãn dán...).
   4 biến --bdyn-* do hàm badge_vars() trong colors.py tính sẵn cho từng màu, đảm bảo chữ luôn
   >= 5:1 so với nền ở CẢ 2 chế độ (trước đây chữ = đúng màu người dùng chọn nên ở chế độ tối
   chỉ còn 1,7–3,2:1). Giá trị dự phòng phía sau dùng khi template quên gắn style. */
.badge-dyn { background: var(--bdyn-bg, var(--bg-page)); color: var(--bdyn-fg, var(--text-secondary)); }
[data-theme="dark"] .badge-dyn { background: var(--bdyn-bg-d, var(--bg-page)); color: var(--bdyn-fg-d, var(--text-secondary)); }

/* Buttons */
.btn { border-radius: 8px; padding: 0.5rem 1rem; font-size: 0.85rem; cursor: pointer; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); }
.btn:hover { background: var(--bg-page); }
.btn-primary { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }
.btn-primary:hover { background: #1f2937; }
.btn-danger { color: var(--danger); border-color: var(--danger-bg); }
.btn-success { color: var(--success); border-color: var(--success-bg); }
.btn-block { width: 100%; }
/* Nút đang tắt (vd Mua / Thuê khi chưa kiểm tra giá) phải nhìn ra là đang tắt */
.btn:disabled, .btn[disabled] { cursor: not-allowed; background: var(--bg-page) !important; color: var(--text-secondary) !important;
    border-color: var(--border) !important; box-shadow: none !important; }

/* Forms */
label.field-label { display: block; font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 3px; }
input[type="text"], input[type="email"], input[type="search"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%; border: 1px solid var(--border); border-radius: 8px;
    padding: 0.5rem 0.65rem; font-size: 0.88rem; font-family: inherit;
    background: var(--bg-card); color: var(--text-primary);
}
textarea { resize: vertical; }
.form-grid { display: grid; gap: 0.8rem; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Login page */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: url('/static/img/login-bg.png') center center / cover no-repeat;
    padding: 1rem;
}
.login-card {
    background: var(--bg-card); border-radius: 18px; padding: 2rem 1.8rem;
    width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-avatar {
    width: 80px; height: 80px; border-radius: 50%; background: var(--bg-page);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem; font-size: 36px;
}
.login-title { text-align: center; margin: 0 0 1.4rem; }
.login-error { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.85rem; margin-bottom: 0.8rem; }

/* Table */
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.data-table th { text-align: left; padding: 8px 6px; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table td { padding: 7px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.cell-clamp {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr.selected { background: var(--accent-bg); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0.9rem; }
.toolbar select, .toolbar input { width: auto; min-width: 130px; }

.selection-bar {
    display: none;
    align-items: center; justify-content: space-between;
    background: var(--accent-bg); border: 1px solid #c7d2fe;
    border-radius: 8px; padding: 0.55rem 0.8rem; margin-bottom: 0.8rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 8px;
}
.selection-bar.show { display: flex; }
.selection-bar .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.selection-bar .actions .btn { white-space: nowrap; font-size: 0.8rem; padding: 0.4rem 0.7rem; }

.toast {
    position: fixed; top: 1rem; right: 1rem; z-index: 999;
    background: #111827; color: #fff; padding: 0.6rem 1rem; border-radius: 8px;
    font-size: 0.85rem; box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    opacity: 0; transform: translateY(-8px); transition: opacity 0.2s, transform 0.2s;
    /* v48: thông báo chỉ là chữ — cho chuột bấm xuyên qua, kẻo che nút ở góc phải trên (💲 Sửa Cost…) */
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== TỐI ƯU MOBILE ===== */
@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.7rem;
        gap: 0.5rem;
    }
    .sidebar-brand { padding: 0 0 0.3rem; }
    /* Trên điện thoại menu nằm ngang phía trên: nút thu nhỏ không có tác dụng và còn thò ra 12px
       ngoài mép phải làm MỌI trang bị lắc ngang khi vuốt. Lỡ lưu trạng thái "thu nhỏ" từ màn hình
       lớn (xoay máy tính bảng) cũng bỏ qua, luôn hiện đủ menu. */
    .sidebar-toggle-btn { display: none; }
    .sidebar.collapsed { width: 100%; padding: 0.7rem; }
    .sidebar.collapsed .sidebar-text { display: inline; }
    .sidebar.collapsed .sidebar-lang { display: flex; }
    .sidebar.collapsed .nav-admin-group { display: block; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 0.45rem 0.7rem; }
    .nav-list {
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 4px;
    }
    .nav-item {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.45rem 0.7rem;
    }
    .nav-item.active { border-left-color: transparent; border-bottom-color: var(--accent); }
    .nav-admin-group {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        border-left: 1px solid var(--border);
        padding-left: 6px;
        margin-left: 2px;
        flex-shrink: 0;
    }
    .sidebar-bottom {
        margin-top: 0.4rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .sidebar-bottom .sidebar-divider { display: none; }
    .user-card { flex: 1; }
    .btn-logout { width: auto; padding: 0.35rem 0.7rem; }

    .main-content { padding: 0.9rem; }

    .form-grid.cols-2, .form-grid.cols-4 { grid-template-columns: 1fr; }
    .metric-grid.cols-4, .metric-grid.cols-5 { grid-template-columns: repeat(2, minmax(0,1fr)); }

    div[style*="grid-template-columns:2fr 1fr"],
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns:1.5fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar select, .toolbar input { width: 100%; min-width: 0; }

    table.data-table { font-size: 0.78rem; }
    .cell-clamp { max-width: 140px; }

    .login-card { padding: 1.5rem 1.2rem; }

    /* v39: lưới 3 cột, chữ xuống dòng — trước đây 8–9 nút dồn 1 hàng, chữ tràn ra ngoài làm cả trang bị kéo
       rộng hơn màn hình điện thoại (cuộn ngang) */
    .selection-bar .actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .selection-bar .actions .btn { min-width: 0; padding: 0.4rem 0.3rem; font-size: 0.72rem; white-space: normal; line-height: 1.25;
        overflow: hidden; overflow-wrap: anywhere; display: flex; align-items: center; justify-content: center; text-align: center; }
    .selection-bar .actions select { grid-column: span 2; min-width: 0; width: 100%; }
}

/* ===== LIGHTBOX (xem ảnh to, không mở tab mới) ===== */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.82);
    z-index: 999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 2rem;
}
.lightbox-overlay.show { display: flex; }
.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    cursor: default;
}
.mockup-thumb {
    cursor: zoom-in;
    transition: transform 0.12s ease;
}
.mockup-thumb:hover {
    transform: scale(1.08);
}

/* ===== TIMELINE FEDEX (hiện khi hover vào badge trạng thái) — dùng position:fixed
   gắn trực tiếp vào <body> qua JS, KHÔNG bị cắt bởi overflow-x:auto của khung bảng ===== */
.fedex-popup {
    display: none;
    position: fixed;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    padding: 0.8rem;
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
    white-space: normal;
    font-size: 0.8rem;
    cursor: default;
}
.fedex-popup.show { display: block; }
.fedex-timeline-item {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f2;
}
.fedex-timeline-item:last-child { border-bottom: none; }

/* ===== KÉO GIÃN CỘT (resizable columns) trong Danh sách đơn hàng ===== */
.col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    background: transparent;
}
.col-resize-handle:hover { background: var(--accent); opacity: 0.4; }
/* th cần có position (khác static) để tay cầm kéo giãn cột (absolute) neo đúng chỗ.
   Riêng bảng đơn hàng dùng sticky thay cho relative — xem quy tắc #ordersTable thead th. */
table.data-table th { position: relative; }

/* ===== Đóng băng cột Order ID khi cuộn ngang (#4) =====
   Bảng Danh sách đơn hàng có rất nhiều cột, phải cuộn ngang để xem hết — khi cuộn, dễ mất dấu
   đang xem dòng nào. Ghim cột Order ID (và ô checkbox liền trước nó) luôn hiển thị bên trái.
   Dùng position:sticky với nền đặc (var(--bg-card)) để nội dung cột khác không lộ qua khi cuộn. */
#ordersTable th[data-order-id-col],
#ordersTable td[data-order-id-col] {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--bg-card);
    box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.12);
}
#ordersTable thead th[data-order-id-col] { z-index: 5; }

/* ===== Màu nền dòng theo Status (#5) =====
   Nhìn lướt là biết ngay tình trạng đơn, không cần đọc từng badge — đặc biệt hữu ích khi bảng
   dài. Dùng màu NHẠT (độ mờ thấp) để không lấn át nội dung và vẫn đọc chữ thoải mái ở cả chế
   độ sáng lẫn tối. */
#ordersTable tr[data-row-status="cancelled"] td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
#ordersTable tr[data-row-status="delivered"] td { background: color-mix(in srgb, var(--success) 7%, transparent); }
#ordersTable tr[data-row-status="shipping"] td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
/* Dòng đã ghim sticky cần nền ĐẶC riêng, nếu không sẽ bị nội dung cuộn qua lộ phía dưới */
#ordersTable tr[data-row-status="cancelled"] td[data-order-id-col] { background: color-mix(in srgb, var(--danger) 7%, var(--bg-card)); }
#ordersTable tr[data-row-status="delivered"] td[data-order-id-col] { background: color-mix(in srgb, var(--success) 7%, var(--bg-card)); }
#ordersTable tr[data-row-status="shipping"] td[data-order-id-col] { background: color-mix(in srgb, var(--accent) 6%, var(--bg-card)); }

/* ===== Xuất PDF / In trang (#82) =====
   Khi bấm "Xuất PDF / In", trình duyệt mở hộp thoại in — chọn "Save as PDF" là ra file gửi báo
   cáo được ngay. Ẩn các phần chỉ dùng để thao tác (sidebar, nút bấm, bảng chọn widget) vì trên
   bản in chúng vô nghĩa và chiếm chỗ. */
@media print {
    .sidebar, .no-print, .btn, .goto-btn, .toast { display: none !important; }
    .app-layout, .main-content { display: block !important; margin: 0 !important; padding: 0 !important; }
    .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd !important; }
    body { background: #fff !important; }
    /* Ép về màu sáng khi in kể cả đang bật chế độ tối — in nền tối rất tốn mực và khó đọc */
    [data-theme="dark"] { --bg-page: #fff; --bg-card: #fff; --text-primary: #000; --text-secondary: #444; --border: #ccc; }
}

/* Ô chọn ngày/tháng: trình duyệt tự vẽ nền trắng và icon lịch màu tối, ở chế độ tối trông
   chói và icon gần như biến mất. color-scheme báo cho trình duyệt biết đang dùng nền tối để
   nó tự vẽ lại các thành phần gốc (lịch, mũi tên) cho phù hợp. */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] select {
    color-scheme: dark;
}

/* ===== Dải cảnh báo ở đầu trang Tổng quan =====
   Các mục cảnh báo xếp ngang trong 1 khối, mỗi mục có vạch màu bên trái để phân biệt mức độ
   mà không cần tô nền rực rỡ cho từng cái (nhiều mảng màu cạnh nhau trông rất rối). */
.alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0.7rem 1rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.86rem;
    border-top: 1px solid var(--border);
    transition: background-color 0.15s;
}
.alert-row:hover { background: var(--bg-page); }
.alert-sub { font-size: 0.75rem; color: var(--text-secondary); font-weight: 400; }

/* ===== Tô màu cả dòng khi rê chuột (#danh sách đơn hàng) =====
   Bảng rộng hơn 2000px nên phải cuộn ngang; khi xem các cột bên phải rất dễ lạc dòng. Làm nổi
   cả dòng đang trỏ để mắt bám được đúng đơn — giống cảm giác dùng bảng tính.
   Thứ tự ưu tiên (viết sau đè lên viết trước): đang trỏ < trạng thái đơn < đã tick. */
#ordersTable tbody tr:hover td { background: var(--bg-page); }
#ordersTable tbody tr:hover td[data-order-id-col] { background: var(--bg-page); }

/* Dòng đã tick — đè lên mọi màu khác để luôn thấy rõ mình đang chọn gì */
#ordersTable tbody tr.row-selected td,
#ordersTable tbody tr.row-selected:hover td { background: var(--accent-bg); }
#ordersTable tbody tr.row-selected td[data-order-id-col],
#ordersTable tbody tr.row-selected:hover td[data-order-id-col] {
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-card));
}

/* ===== Menu chuột phải trong bảng ===== */
.ctx-menu {
    position: fixed;
    z-index: 300;
    min-width: 210px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    padding: 5px;
    display: none;
}
.ctx-menu.show { display: block; }
.ctx-head { font-size: 0.7rem; color: var(--text-muted); padding: 4px 9px 3px; }
.ctx-item {
    display: flex; align-items: center; gap: 9px;
    padding: 6px 9px; font-size: 0.84rem; border-radius: 4px;
    cursor: pointer; color: var(--text-primary);
    background: none; border: none; width: 100%; text-align: left;
    font-family: inherit;
}
.ctx-item:hover { background: var(--bg-page); }
.ctx-item.danger { color: var(--danger); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ===== Cuộn đơn hàng trong khung, TỰ ĐỘNG THEO MÀN HÌNH =====
   Trên màn cao (máy bàn 24-27 inch): khoá chiều cao khung, con lăn chỉ cuộn danh sách đơn —
   bộ lọc, dải tổng và thanh thao tác luôn nằm nguyên chỗ. Đo thực tế: màn 27" 2K thấy 29 dòng
   cùng lúc ở mức phóng 100%, vẫn 20 dòng ở mức 125%.
   Trên màn thấp (laptop 14"): KHÔNG khoá, vì chỉ còn ~12 dòng — chật hơn cả cách cuộn trang.
   Lúc đó chỉ ghim hàng tiêu đề để cuộn xuống vẫn biết đang xem cột nào. */

/* Ghim hàng tiêu đề — áp cho MỌI kích thước màn hình */
#ordersTable thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--bg-card);
}
/* Ô góc trên bên trái vừa ghim dọc vừa ghim ngang -> phải nằm trên cùng, nếu không sẽ bị
   các ô khác trượt đè lên khi cuộn chéo */
#ordersTable thead th[data-order-id-col] { z-index: 6; }

@media (min-height: 900px) {
    .orders-scroll-wrap {
        max-height: calc(100vh - 330px);
        overflow-y: auto;
        /* Chặn "cuộn lan": lăn hết danh sách thì DỪNG, không tự trượt tiếp ra trang ngoài
           khiến mất dấu vị trí đang xem */
        overscroll-behavior: contain;
    }
}

/* ===== Bảng đơn hàng kiểu bảng tính: dòng hẹp, kẻ viền đủ, tô xen kẽ =====
   Dòng cao 21px để thấy nhiều đơn cùng lúc. Ảnh mockup thu về 17px cho vừa chiều cao dòng —
   rê chuột vào ảnh sẽ phóng to (dùng lại lightbox có sẵn). */
#ordersTable { border-collapse: collapse; font-size: 0.78rem; }
#ordersTable th,
#ordersTable td {
    /* Tổng chiều cao dòng = nội dung + đệm trên dưới + viền. Để ra đúng 21px: nội dung cao nhất
       15px + đệm 2px + viền 2px = 19-21px. Ảnh mockup và các nhãn badge đều phải nhỏ theo, nếu
       không chúng sẽ tự đẩy dòng cao lên (đo thực tế: badge 18px làm dòng thành 26px). */
    padding: 2px 5px;
    line-height: 1.2;
    border: 1px solid var(--border);   /* kẻ viền ĐỦ 4 cạnh như bảng tính */
}
#ordersTable thead th { padding: 3px 5px; }
#ordersTable td .mockup-thumb { width: 18px !important; height: 18px !important; border-radius: 2px; }
#ordersTable td img { max-height: 18px !important; width: auto !important; }
/* Nhãn badge trong bảng thu nhỏ lại cho vừa chiều cao dòng */
#ordersTable td .badge {
    font-size: 0.68rem; padding: 0 5px; line-height: 18px; height: 18px; display: inline-block;
}
#ordersTable td .link-btn, #ordersTable td button { font-size: 0.74rem; line-height: 17px; padding: 0 2px; }

/* Tô xen kẽ — dòng chẵn nền khác để mắt bám ngang dễ hơn khi bảng rất rộng */
#ordersTable tbody tr:nth-child(even) td { background: var(--bg-page); }

/* Thứ tự ưu tiên màu (viết sau đè trước): xen kẽ < trạng thái đơn < đang trỏ < đã tick */
#ordersTable tbody tr[data-row-status="cancelled"] td { background: color-mix(in srgb, var(--danger) 8%, var(--bg-card)); }
#ordersTable tbody tr[data-row-status="delivered"] td { background: color-mix(in srgb, var(--success) 8%, var(--bg-card)); }
#ordersTable tbody tr[data-row-status="shipping"] td { background: color-mix(in srgb, var(--accent) 7%, var(--bg-card)); }
#ordersTable tbody tr:hover td { background: color-mix(in srgb, var(--accent) 10%, var(--bg-card)); }
#ordersTable tbody tr.row-selected td,
#ordersTable tbody tr.row-selected:hover td { background: var(--accent-bg); }

/* Ô đang sửa trực tiếp */
#ordersTable td.cell-editing { padding: 0 !important; }
#ordersTable td.cell-editing input,
#ordersTable td.cell-editing select {
    width: 100%; height: 23px; border: 2px solid var(--accent); border-radius: 2px;
    font-size: 0.78rem; padding: 0 4px; font-family: inherit;
    background: var(--bg-card); color: var(--text-primary);
}
/* Cột sửa được: con trỏ dạng ô nhập cho biết bấm vào là sửa được */
#ordersTable td[data-editable] { cursor: cell; }

/* ===== NÚT 🔔 THÔNG BÁO Ở THANH BÊN + KHUNG BẬT/TẮT — dùng cho MỌI tài khoản =====
   Trạng thái được JS gắn lên nút dạng class push-state-*: on (đang bật) · off (chưa bật) ·
   warn (cần cài app / bị trình duyệt chặn) · na (trình duyệt không hỗ trợ) · loading. */
.push-bell-btn { border: none; background: none; font-family: inherit; }
.push-bell-btn:hover { background: var(--bg-page); }
.push-bell-icon { position: relative; display: inline-flex; }
.push-dot {
    position: absolute; top: -1px; right: -3px;
    width: 8px; height: 8px; border-radius: 50%;
    border: 1.5px solid var(--bg-card);
    background: var(--text-muted);
    display: none;
}
/* Thanh bên thu nhỏ chỉ còn icon — chấm màu thay cho nhãn trạng thái */
.sidebar.collapsed .push-dot { display: block; }
.push-pill {
    font-size: 0.68rem; font-weight: 600; padding: 1px 7px; border-radius: 999px;
    background: var(--bg-page); color: var(--text-secondary); white-space: nowrap;
}
.push-state-on .push-pill { background: var(--success-bg); color: var(--success); }
.push-state-on .push-dot { background: var(--success); }
.push-state-off .push-pill, .push-state-warn .push-pill { background: var(--warning-bg); color: var(--warning); }
.push-state-off .push-dot, .push-state-warn .push-dot { background: #f59e0b; }
[data-theme="dark"] .push-state-off .push-pill,
[data-theme="dark"] .push-state-warn .push-pill { color: #fbbf24; }

/* Khung bật/tắt — đặt ngoài thanh bên (thanh bên có overflow cuộn sẽ cắt mất khung), JS tự
   canh vị trí cạnh nút chuông */
.push-panel {
    position: fixed; z-index: 1000; left: 0; top: 0;
    width: 292px; max-width: calc(100vw - 16px);
    background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    padding: 0.75rem 0.85rem 0.7rem;
    font-size: 0.84rem;
    display: none;
}
.push-panel.show { display: block; }
.push-panel button { font-family: inherit; }
.push-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; margin-bottom: 0.4rem;
}
.push-panel-close {
    border: none; background: none; cursor: pointer; color: var(--text-muted);
    padding: 2px 4px; border-radius: 6px; font-size: 1rem; line-height: 1;
}
.push-panel-close:hover { background: var(--bg-page); color: var(--text-primary); }
.push-panel-status { font-size: 0.8rem; line-height: 1.45; margin-bottom: 0.6rem; color: var(--text-secondary); }
.push-panel-status.on { color: var(--success); }
.push-panel-status.off, .push-panel-status.warn { color: var(--warning); }
[data-theme="dark"] .push-panel-status.off,
[data-theme="dark"] .push-panel-status.warn { color: #fbbf24; }
.push-panel-help { font-size: 0.8rem; line-height: 1.55; color: var(--text-secondary); margin-bottom: 0.6rem; }
.push-panel-help:empty { display: none; }
.push-panel-help ol { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.push-panel-help li { margin: 2px 0; }
.push-panel-help b { color: var(--text-primary); font-weight: 600; }
.push-main-btn { display: block; width: 100%; margin-bottom: 0.45rem; }
.push-sub-actions { display: flex; gap: 6px; }
.push-sub-actions .btn { flex: 1; font-size: 0.78rem; padding: 0.45rem 0.4rem; white-space: nowrap; }
.push-panel-msg { font-size: 0.78rem; line-height: 1.45; margin-top: 0.55rem; }
.push-panel-msg:empty { display: none; }
.push-panel-msg.ok { color: var(--success); }
.push-panel-msg.err { color: var(--danger); }
.push-panel-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.55rem; }
.push-panel button[disabled] { opacity: 0.6; cursor: wait; }

@media (max-width: 768px) {
    /* Hàng dưới cùng của thanh bên trên điện thoại chật — chỉ giữ icon chuông + chấm màu */
    .push-bell-btn .sidebar-text { display: none; }
    .push-dot { display: block; }
    .sidebar-bottom .btn-logout { white-space: nowrap; }
}
@media (max-width: 480px) {
    /* Điện thoại hẹp (iPhone ~390px): nút Chế độ tối chỉ còn icon như chuông để cả hàng nằm gọn
       1 dòng; tên dài thì tự cắt "…" thay vì đẩy các nút xuống dòng. */
    #darkModeLabel { display: none; }
    .user-card { min-width: 0; }
}

@media print {
    .push-panel, .push-bell-btn { display: none !important; }
}

/* =====================================================================================
   TRANG CHẤM CÔNG (att-*) — thẻ Hôm nay, Tháng này, Quy định, Team hôm nay, Bảng công, Lương
   ===================================================================================== */
:root { --ot: #7c3aed; --ot-bg: #ede9fe; --lunch: #f59e0b; --work: #16a34a; }
[data-theme="dark"] { --ot: #a78bfa; --ot-bg: #2e1f5e; --lunch: #fbbf24; --work: #22c55e; }

.att-header { justify-content: space-between; flex-wrap: wrap; }
.att-header-date { font-size: 0.85rem; font-weight: 500; }
.att-muted { color: var(--text-muted); }
.att-ot { color: var(--ot); font-weight: 600; }
.att-money { color: var(--success); }
.att-flash {
    background: var(--accent-bg); color: var(--accent); border-radius: 10px;
    padding: 0.6rem 1rem; margin-bottom: 1rem; font-size: 0.86rem;
}
[data-theme="dark"] .att-flash { color: #c7d2fe; }

.att-top { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.att-top > .card, .att-side > .card { margin-bottom: 0; }
.att-side { display: flex; flex-direction: column; gap: 1rem; }
.att-top { margin-bottom: 1rem; }
.att-card-title { font-size: 0.95rem; font-weight: 600; }
.att-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
    flex-wrap: wrap; margin-bottom: 0.8rem;
}

/* ---- Thẻ Hôm nay ---- */
.att-today { padding: 1.1rem 1.25rem 1.2rem; }
.att-today-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; font-size: 0.8rem; }
.att-pill {
    display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px; border-radius: 999px;
    font-size: 0.8rem; font-weight: 600; background: var(--bg-page); color: var(--text-secondary);
}
.att-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.att-pill-working, .att-pill-resumed { background: var(--success-bg); color: var(--success); }
.att-pill-lunch { background: var(--warning-bg); color: var(--warning); }
.att-pill-done { background: var(--accent-bg); color: var(--accent); }
[data-theme="dark"] .att-pill-working, [data-theme="dark"] .att-pill-resumed { color: #4ade80; }
[data-theme="dark"] .att-pill-lunch { color: #fbbf24; }
[data-theme="dark"] .att-pill-done { color: #c7d2fe; }
.att-pill-working .att-dot, .att-pill-resumed .att-dot { animation: att-pulse 1.6s ease-in-out infinite; }
@keyframes att-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0); }
}
@media (prefers-reduced-motion: reduce) { .att-pill-working .att-dot { animation: none; } }

.att-today-main { display: flex; align-items: center; gap: 1.2rem; margin: 1rem 0 1.1rem; }
.att-ring-wrap { position: relative; width: 116px; height: 116px; flex-shrink: 0; }
.att-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.att-ring circle { fill: none; stroke-width: 11; }
.att-ring-bg { stroke: var(--bg-page); }
.att-ring-work { stroke: var(--work); stroke-linecap: round; transition: stroke-dasharray 0.6s ease; }
.att-ring-ot { stroke: var(--ot); stroke-linecap: round; transition: stroke-dasharray 0.6s ease; }
.att-state-lunch .att-ring-work { stroke: var(--lunch); }
.att-ring-text {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; line-height: 1.15;
}
.att-ring-text b { font-size: 1.25rem; font-weight: 700; }
.att-ring-text span { font-size: 0.72rem; color: var(--text-muted); }
.att-today-info { min-width: 0; }
.att-clock { font-size: 2.3rem; font-weight: 700; letter-spacing: -0.5px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.att-clock span { font-size: 1rem; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.att-line { font-size: 0.88rem; color: var(--text-secondary); margin-top: 6px; }
.att-line-2 { color: var(--text-secondary); margin-top: 2px; font-weight: 500; }
.att-line-2.is-ot { color: var(--ot); }
.att-line-2:empty { display: none; }

/* Dòng thời gian trong ngày */
.att-tl { position: relative; height: 16px; border-radius: 8px; background: var(--bg-page); overflow: hidden; }
.att-seg { position: absolute; top: 0; bottom: 0; }
.att-seg-work { background: var(--work); }
.att-seg-ot { background: var(--ot); }
.att-seg-lunch { background: var(--lunch); }
.att-seg-lunch-plan {
    top: 3px; bottom: 3px; border-radius: 4px; opacity: 0.55;
    background: repeating-linear-gradient(135deg, var(--lunch) 0 4px, transparent 4px 8px);
}
.att-seg-plan { top: 3px; bottom: 3px; border: 1.5px dashed var(--work); border-radius: 4px; }
.att-seg-plan-ot { top: 3px; bottom: 3px; border: 1.5px dashed var(--ot); border-radius: 4px; }
.att-now { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--text-primary); border-radius: 1px; }
.att-tl-scale { position: relative; height: 16px; margin-top: 4px; font-size: 0.68rem; color: var(--text-muted); }
.att-tl-scale span { position: absolute; white-space: nowrap; }

.att-stamps { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.82rem; color: var(--text-secondary); margin: 0.7rem 0 0.95rem; }
.att-stamps b { color: var(--text-primary); font-weight: 600; }
.att-stamps b.att-planned { color: var(--text-muted); font-weight: 500; }
.att-tag {
    display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: 6px; vertical-align: 1px;
    font-size: 0.68rem; font-weight: 600; background: var(--warning-bg); color: var(--warning);
}
.att-tag-warn { background: var(--danger-bg); color: var(--danger); }
.att-tag-muted { background: var(--bg-page); color: var(--text-muted); }

.att-actions { display: flex; flex-direction: column; gap: 6px; }
.att-actions form { margin: 0; }
.att-btn {
    width: 100%; min-height: 50px; border: none; border-radius: 12px; cursor: pointer;
    font-family: inherit; font-size: 1.02rem; font-weight: 600; color: #fff;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.08s ease, filter 0.15s ease;
}
.att-btn:hover { filter: brightness(1.06); }
.att-btn:active { transform: scale(0.99); }
.att-btn-go { background: var(--success-solid); }
.att-btn-stop { background: #dc2626; }
.att-btn-back { background: var(--accent-solid); }
.att-btn-link {
    width: 100%; background: none; border: none; cursor: pointer; font-family: inherit;
    font-size: 0.84rem; color: var(--text-secondary); padding: 6px; text-decoration: underline;
    text-underline-offset: 3px;
}
.att-btn-link:hover { color: var(--text-primary); }
.att-done {
    background: var(--success-bg); color: var(--success); border-radius: 12px;
    padding: 0.8rem 1rem; text-align: center; font-size: 0.9rem; font-weight: 600;
}
[data-theme="dark"] .att-done { color: #4ade80; }

/* ---- Tháng này + Quy định ---- */
.att-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin-top: 0.8rem; }
.att-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 0.9rem; }
.att-kpi { background: var(--bg-page); border-radius: 10px; padding: 0.65rem 0.8rem; min-width: 0; }
.att-kpi span { display: block; font-size: 0.74rem; color: var(--text-secondary); }
.att-kpi b { display: block; font-size: 1.2rem; font-weight: 700; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-kpi b.att-money { font-size: 1.05rem; }
.att-kpi-main { background: var(--success-bg); }
.att-note { font-size: 0.8rem; border-radius: 8px; padding: 0.55rem 0.75rem; margin-top: 0.7rem; }
.att-note-warn { background: var(--warning-bg); color: var(--warning); }
[data-theme="dark"] .att-note-warn { color: #fbbf24; }
.att-rule-list { list-style: none; margin: 0.7rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.att-rule-list li { display: flex; gap: 9px; align-items: flex-start; font-size: 0.83rem; line-height: 1.45; color: var(--text-secondary); }
.att-rule-list li i { font-size: 1rem; color: var(--accent); margin-top: 1px; flex-shrink: 0; }
[data-theme="dark"] .att-rule-list li i { color: #a5b4fc; }
.att-rule-list b { color: var(--text-primary); font-weight: 600; }
.att-rules-edit { margin-top: 0.8rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.att-rules-edit summary { cursor: pointer; font-size: 0.83rem; font-weight: 600; color: var(--accent); }
[data-theme="dark"] .att-rules-edit summary { color: #a5b4fc; }
.att-rules-edit form { margin-top: 0.7rem; display: flex; flex-direction: column; gap: 0.55rem; align-items: flex-start; }
.att-form-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.att-form-row label { display: flex; flex-direction: column; gap: 3px; font-size: 0.76rem; color: var(--text-secondary); }
.att-form-row input { width: 120px; }
.att-check { display: flex; align-items: center; gap: 7px; font-size: 0.83rem; }

/* ---- Team hôm nay ---- */
.att-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.att-chip {
    display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
    font-size: 0.74rem; font-weight: 600; background: var(--bg-page); color: var(--text-secondary);
}
.att-chip-working, .att-chip-resumed { background: var(--success-bg); color: var(--success); }
.att-chip-lunch { background: var(--warning-bg); color: var(--warning); }
.att-chip-done { background: var(--accent-bg); color: var(--accent); }
.att-chip-missing { background: var(--danger-bg); color: var(--danger); }
[data-theme="dark"] .att-chip-working, [data-theme="dark"] .att-chip-resumed { color: #4ade80; }
[data-theme="dark"] .att-chip-lunch { color: #fbbf24; }
[data-theme="dark"] .att-chip-done { color: #c7d2fe; }
[data-theme="dark"] .att-chip-missing { color: #f87171; }
.att-team-list { display: flex; flex-direction: column; }
.att-team-row {
    display: grid; align-items: center; gap: 4px 12px; padding: 9px 6px; border-top: 1px solid var(--border);
    grid-template-columns: 34px minmax(0, 1.4fr) 104px minmax(0, 1.2fr) minmax(0, 1.3fr);
    grid-template-areas: "av name chip time hours"; color: inherit;
}
.att-team-row:first-child { border-top: none; }
.att-team-row:hover { background: var(--bg-page); }
.att-avatar {
    grid-area: av; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.74rem; font-weight: 700; background: var(--bg-page); color: var(--text-secondary);
}
.att-avatar-working, .att-avatar-resumed { background: var(--success-bg); color: var(--success); }
.att-avatar-lunch { background: var(--warning-bg); color: var(--warning); }
.att-avatar-done { background: var(--accent-bg); color: var(--accent); }
.att-team-name { grid-area: name; font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-team-chip { grid-area: chip; }
.att-team-time { grid-area: time; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-team-hours { grid-area: hours; min-width: 0; }
.att-team-hours-top { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 600; margin-bottom: 3px; }
.att-bar { height: 6px; border-radius: 3px; background: var(--bg-page); overflow: hidden; }
.att-bar-fill { height: 100%; border-radius: 3px; background: var(--work); }
.att-bar-fill.is-ot { background: var(--ot); }
.att-bar-fill.is-lunch { background: var(--lunch); }

/* ---- Bảng chấm công + Lương ---- */
.att-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.att-filter select, .att-filter input { width: auto; min-width: 150px; padding: 0.4rem 0.6rem; font-size: 0.84rem; }
.att-summary { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.83rem; color: var(--text-secondary); margin-bottom: 0.7rem; }
.att-summary b { color: var(--text-primary); }
.att-summary b.att-ot { color: var(--ot); }
.att-warn-text { color: var(--danger); font-weight: 600; }
.att-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.att-table td.num, .att-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.att-table td { vertical-align: middle; }
.att-wd { display: inline-block; min-width: 26px; color: var(--text-muted); font-size: 0.78rem; font-weight: 600; }
.att-row-today td { background: color-mix(in srgb, var(--accent) 6%, var(--bg-card)); }
.att-muted-row td { color: var(--text-muted); font-size: 0.8rem; }
.att-total-row td { font-weight: 700; font-size: 0.92rem; border-top: 2px solid var(--border); }
.att-total-row td:last-child { color: var(--success); }
[data-theme="dark"] .att-total-row td:last-child { color: #4ade80; }
.att-link { color: var(--accent); font-weight: 600; }
[data-theme="dark"] .att-link { color: #a5b4fc; }
.att-link:hover { text-decoration: underline; }
.att-salary-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.att-trend { background: var(--bg-page); border-radius: 10px; padding: 0.75rem 0.9rem; }
.att-trend-bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.att-trend-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.att-trend-bar { width: 100%; max-width: 34px; min-height: 3px; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--accent) 30%, var(--bg-card)); }
.att-trend-col.is-current .att-trend-bar { background: var(--accent); }
.att-trend-val { font-size: 0.68rem; color: var(--text-secondary); }
.att-trend-lbl { font-size: 0.66rem; color: var(--text-muted); }
.att-howto { margin-top: 0.9rem; font-size: 0.82rem; color: var(--text-secondary); }
.att-howto summary { cursor: pointer; font-weight: 600; color: var(--text-primary); }
.att-howto ul { margin: 0.5rem 0 0; padding-left: 1.2rem; line-height: 1.6; }

@media (max-width: 1100px) {
    .att-top { grid-template-columns: minmax(0, 1fr); }
    .att-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .att-side { grid-template-columns: minmax(0, 1fr); }
    .att-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .att-salary-grid { grid-template-columns: minmax(0, 1fr); }
    .att-team-row {
        grid-template-columns: 34px minmax(0, 1fr) auto;
        grid-template-areas: "av name chip" "av time hours";
    }
    .att-team-hours { min-width: 110px; }
    .att-filter { width: 100%; }
    .att-filter select, .att-filter input { flex: 1; min-width: 0; }
}
@media (max-width: 480px) {
    .att-today { padding: 1rem; }
    .att-today-main { gap: 0.9rem; }
    .att-ring-wrap { width: 96px; height: 96px; }
    .att-clock { font-size: 1.9rem; }
}
@media print {
    .att-actions, .att-filter, .att-rules-edit { display: none !important; }
}
.att-salary-grid.is-single { grid-template-columns: minmax(0, 1fr); }
.att-collapsed .att-extra { display: none; }
.att-more-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 0.6rem;
    padding: 0.55rem; border: 1px dashed var(--border); border-radius: 10px; background: none; cursor: pointer;
    font-family: inherit; font-size: 0.84rem; font-weight: 600; color: var(--text-secondary);
}
.att-more-btn:hover { background: var(--bg-page); color: var(--text-primary); }

/* Điện thoại: bảng chấm công xếp thành thẻ 2 dòng (ngày | giờ vào → ra, nghỉ trưa | giờ làm, tăng ca)
   thay vì bảng 6 cột phải cuộn ngang mới thấy giờ làm */
@media (max-width: 600px) {
    .att-hide-sm { display: none; }
    .att-table-cards thead { display: none; }
    .att-table-cards, .att-table-cards tbody { display: block; width: 100%; }
    .att-table-cards tr {
        display: grid; column-gap: 8px; row-gap: 3px; align-items: center; padding: 9px 4px;
        border-bottom: 1px solid var(--border);
        grid-template-columns: 46px auto minmax(0, 1fr) auto;
        grid-template-areas: "date in out net" "date lunch lunch ot";
    }
    .att-table-cards.has-person tr { grid-template-areas: "date person person net" "date in out ot" "date lunch lunch ot"; }
    .att-table-cards tr:last-child { border-bottom: none; }
    table.att-table-cards td { border: none; padding: 0; background: none !important; font-size: 0.84rem; white-space: nowrap; }
    table.att-table-cards .att-tag { font-size: 0.64rem; padding: 0 5px; margin-left: 4px; }
    .att-table-cards tr.att-row-today { background: color-mix(in srgb, var(--accent) 6%, var(--bg-card)); border-radius: 8px; }
    .att-table-cards td.c-date { grid-area: date; align-self: start; font-weight: 600; line-height: 1.3; }
    .att-table-cards td.c-date .att-wd { display: block; }
    .att-table-cards td.c-person { grid-area: person; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
    .att-table-cards td.c-in { grid-area: in; }
    .att-table-cards td.c-out { grid-area: out; }
    .att-table-cards td.c-out::before { content: "→ "; color: var(--text-muted); }
    table.att-table-cards td.c-lunch { grid-area: lunch; font-size: 0.76rem; color: var(--text-secondary); white-space: normal; }
    .att-table-cards td.c-lunch::before { content: "Nghỉ "; color: var(--text-muted); }
    .att-table-cards td.c-net { grid-area: net; font-weight: 600; }
    .att-table-cards td.c-ot { grid-area: ot; font-size: 0.78rem; }
}
@media (max-width: 600px) {
    table.att-table-salary td:first-child { white-space: normal; }
    table.att-table-salary td.num { white-space: nowrap; }
}
@media (max-width: 600px) {
    table.att-table-payroll th, table.att-table-payroll td { padding: 8px 4px; }
    table.att-table-payroll td:first-child { white-space: normal; }
    table.att-table-payroll td:first-child .att-tag { display: table; margin: 3px 0 0; }
    table.att-table-payroll td:last-child .att-muted { white-space: normal; display: inline-block; max-width: 80px; }
}
@media (max-width: 380px) {
    table.att-table-payroll th, table.att-table-payroll td { font-size: 0.76rem; padding: 8px 3px; }
}

/* ===== Điện thoại: không để trang bị kéo lệch ngang =====
   - Lưới nhiều cột viết thẳng trong trang (style="grid-template-columns:...") → 1 cột (2 cột với lưới 3-4 ô nhỏ).
     Quy tắc cũ chỉ bắt dạng có dấu cách "grid-template-columns: 1fr 1fr" nên bỏ sót phần lớn các trang.
   - Bảng rộng hơn màn hình → cuộn ngang ngay trong bảng thay vì kéo lệch cả trang (Đối chiếu, Báo cáo,
     Khách hàng, Ảnh Mockup, Thư viện Design, Cài đặt...). Bảng Chấm công có bố cục thẻ riêng, bảng Danh sách
     đơn đã nằm trong khung cuộn sẵn → không áp dụng. */
@media (max-width: 768px) {
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns:1fr 1.6fr"],
    div[style*="grid-template-columns:1.2fr 1fr"],
    div[style*="grid-template-columns:2fr 1fr"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    div[style*="grid-template-columns:repeat(3, 1fr)"],
    div[style*="grid-template-columns:repeat(4, 1fr)"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    table.data-table:not(.att-table):not(#ordersTable) {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* =========================================================
   TỔNG QUAN 2026 — lớp .ov-* dùng riêng cho trang Tổng quan (templates/tong_quan.html).
   Nguyên tắc: MỌI màu lấy qua biến theme (var(--...)) để chế độ tối tự đúng; các dải màu
   biểu đồ (--ov-s1, --ov-flow-*) khai báo riêng 2 bộ sáng/tối vì phải đo tương phản với nền
   tương ứng. Cột/đường biểu đồ là "vệt màu" nên chỉ cần >= 3:1, chữ mới cần >= 4,5:1 —
   chữ trong mọi khối dưới đây đều dùng --text-* hoặc --accent/--success/--warning/--danger.
   ========================================================= */
:root {
    --ov-s1: #2a78d6;          /* đường/cột "kỳ này" */
    --ov-prev: #b8bcc6;        /* đường "kỳ trước" — xám, chỉ làm nền so sánh */
    --ov-grid: #eceef2;        /* lưới ngang mảnh */
    --ov-cost: #8b909b;        /* giá vốn */
    --ov-fee: #c9ccd3;         /* phí eBay */
    --ov-flow-0: #86b6ef; --ov-flow-1: #5598e7; --ov-flow-2: #2a78d6; --ov-flow-3: #184f95;
    --ov-flow-cancel: #8b909b; --ov-flow-other: #c9ccd3;
}
[data-theme="dark"] {
    --ov-s1: #3987e5;
    --ov-prev: #5b5f6b;
    --ov-grid: #2b2d36;
    --ov-cost: #7b808c;
    --ov-fee: #4d515c;
    --ov-flow-0: #1c5cab; --ov-flow-1: #2a78d6; --ov-flow-2: #5598e7; --ov-flow-3: #86b6ef;
    --ov-flow-cancel: #7b808c; --ov-flow-other: #4d515c;
}

.ov-sub { display: block; font-size: 0.76rem; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.ov-muted { color: var(--text-muted); font-size: 0.78rem; font-weight: 400; }
.ov-label { color: var(--text-secondary); font-size: 0.78rem; }
.ov-v1 { font-size: 1.5rem; font-weight: 600; line-height: 1.25; }
.ov-v2 { font-size: 1.1rem; font-weight: 600; }
.ov-num { font-variant-numeric: tabular-nums; }
.ov-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ov-ok { color: var(--success); font-weight: 600; }
.ov-link { color: var(--accent); font-weight: 600; text-decoration: underline; }
.ov-check { display: flex; align-items: center; gap: 6px; }
.ov-foot { margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.ov-delta { display: inline-flex; align-items: center; gap: 1px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.ov-delta.is-up { color: var(--success); }
.ov-delta.is-down { color: var(--danger); }
.ov-delta.is-flat { color: var(--text-muted); }

/* --- Tầng 1: Hôm nay / Mục tiêu / Việc cần làm --- */
.ov-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.ov-top-left { min-width: 0; }
.ov-today-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ov-today-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: none; background: none; padding: 0; cursor: pointer; font-family: inherit; color: inherit; text-align: left; }
.ov-today-cell:hover .ov-v2 { text-decoration: underline; }
.ov-week { display: flex; align-items: flex-end; gap: 6px; margin-top: 0.9rem; }
.ov-week-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.ov-week-bar { width: 100%; max-width: 24px; background: var(--ov-fee); border-radius: 4px 4px 0 0; }
.ov-week-bar.is-today { background: var(--ov-s1); }
.ov-week-lb { font-size: 0.68rem; color: var(--text-muted); }

.ov-goal-head { display: flex; align-items: baseline; gap: 6px; }
.ov-goal-pct { margin-left: auto; font-size: 0.95rem; }
.ov-meter { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--accent-bg); display: block; }
.ov-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.ov-meter.is-warn .ov-meter-fill { background: var(--warning); }
.ov-meter.is-bad .ov-meter-fill { background: var(--danger); }
.ov-meter-pace { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--text-secondary); }
.ov-goal-list { margin-top: 0.8rem; border-top: 1px solid var(--border); padding-top: 0.6rem; display: grid; gap: 7px; }
.ov-goal-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }

.ov-todo { display: flex; flex-direction: column; }
.ov-todo-list { display: flex; flex-direction: column; }
.ov-todo-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border: none; border-top: 1px solid var(--border); background: none; cursor: pointer; font-family: inherit; font-size: 0.85rem; color: var(--text-primary); text-align: left; width: 100%; }
.ov-todo-row:first-child { border-top: none; }
.ov-todo-row:hover { background: var(--bg-page); }
.ov-todo-ic { width: 30px; height: 30px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.ov-todo-ic.is-bad { background: var(--danger-bg); color: var(--danger); }
.ov-todo-ic.is-warn { background: var(--warning-bg); color: var(--warning); }
.ov-todo-ic.is-accent { background: var(--accent-bg); color: var(--accent); }
.ov-todo-ic.is-neutral { background: var(--bg-page); color: var(--text-secondary); }
.ov-todo-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ov-todo-go { color: var(--text-muted); }
.ov-todo-all { margin-top: auto; padding-top: 0.7rem; border-top: 1px solid var(--border); font-size: 0.8rem; font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 6px; }

/* --- Tầng 2: bộ chọn kỳ + các khối phân tích --- */
.ov-section { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin: 1.6rem 0 0.8rem; }
.ov-section-title { font-size: 1rem; font-weight: 600; }
.ov-period { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); }
.ov-period a { font-size: 0.8rem; padding: 5px 11px; border-radius: 7px; color: var(--text-secondary); }
.ov-period a:hover { background: var(--bg-page); }
.ov-period a.is-on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.ov-period select { border: none; background: transparent; color: var(--text-secondary); font-family: inherit; font-size: 0.8rem; padding: 5px 6px; border-radius: 7px; }

.ov-insight { display: flex; gap: 10px; background: var(--accent-bg); border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.85rem; }
.ov-insight > i { font-size: 1.1rem; color: var(--accent); flex: none; }
.ov-insight > div > div + div { margin-top: 2px; }

.ov-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; }
.ov-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; cursor: pointer; font-family: inherit; text-align: left; color: inherit; }
.ov-tile.is-on { border-color: var(--ov-s1); }
.ov-tile.is-on .ov-label { color: var(--text-primary); font-weight: 600; }
.ov-tile-delta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ov-spark { width: 100%; height: 30px; margin-top: 8px; display: block; overflow: visible; }

.ov-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 0.4rem; }
.ov-legend { display: flex; gap: 14px; font-size: 0.78rem; color: var(--text-secondary); flex-wrap: wrap; }
.ov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ov-key { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.ov-key.is-cur { background: var(--ov-s1); }
.ov-key.is-prev { background: var(--ov-prev); }
.ov-chart { position: relative; min-height: 232px; }
.ov-chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.ov-tip { position: absolute; pointer-events: none; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px; font-size: 0.78rem; min-width: 150px; display: none; box-shadow: 0 4px 14px rgba(0,0,0,0.08); z-index: 3; }
.ov-tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.ov-tip-key { width: 10px; height: 2px; flex: none; border-radius: 1px; }
.ov-axis { font-size: 0.68rem; fill: var(--text-muted); }

.ov-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.ov-three { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.ov-two > .card, .ov-three > .card, .ov-top > .card { margin-bottom: 0; min-width: 0; }
.ov-two.ov-wide { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
.ov-two.is-single, .ov-two.ov-wide.is-single { grid-template-columns: minmax(0, 1fr); }
.ov-stack { display: flex; gap: 2px; height: 12px; margin-bottom: 0.7rem; }
.ov-seg { display: block; border-radius: 0; }
.ov-stack .ov-seg:first-child { border-radius: 4px 0 0 4px; }
.ov-stack .ov-seg:last-child { border-radius: 0 4px 4px 0; }
.ov-seg.is-profit, .ov-sw.is-profit { background: var(--ov-s1); }
.ov-seg.is-cost, .ov-sw.is-cost { background: var(--ov-cost); }
.ov-seg.is-fee, .ov-sw.is-fee { background: var(--ov-fee); }
.ov-flow-0 { background: var(--ov-flow-0); }
.ov-flow-1 { background: var(--ov-flow-1); }
.ov-flow-2 { background: var(--ov-flow-2); }
.ov-flow-3 { background: var(--ov-flow-3); }
.ov-flow-cancel { background: var(--ov-flow-cancel); }
.ov-flow-other { background: var(--ov-flow-other); }
.ov-sw { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.ov-pl-rows > div { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); font-size: 0.85rem; }
.ov-pl-rows > div:first-child { border-top: none; }
.ov-pl-name { flex: 1; color: var(--text-secondary); }
.ov-pl-name.is-strong { color: var(--text-primary); font-weight: 600; }
.ov-pl-pct { width: 52px; text-align: right; }
.ov-flow-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 7px 14px; font-size: 0.83rem; }
.ov-flow-legend > div { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ov-flow-name { flex: 1; color: var(--text-secondary); }

.ov-staff { display: grid; }
.ov-staff-row { display: grid; grid-template-columns: 14px 28px minmax(0, 1fr) auto auto; align-items: center; gap: 4px 8px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 0.85rem; }
.ov-staff-row:first-child { border-top: none; }
.ov-rank { width: 14px; }
.ov-avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 600; background: var(--bdyn-bg, var(--accent-bg)); color: var(--bdyn-fg, var(--accent)); }
[data-theme="dark"] .ov-avatar { background: var(--bdyn-bg-d, var(--accent-bg)); color: var(--bdyn-fg-d, var(--accent)); }
.ov-staff-name { border: none; background: none; padding: 0; font-family: inherit; font-size: 0.85rem; color: var(--text-primary); cursor: pointer; min-width: 0; text-align: left; }
.ov-staff-name:hover { text-decoration: underline; }
.ov-staff-orders { width: 62px; text-align: right; }
.ov-staff-rev { width: 74px; text-align: right; }
.ov-staff-bar { grid-column: 3 / -1; min-width: 40px; }
.ov-staff-delta { min-width: 58px; text-align: right; }
.ov-bar { display: block; height: 6px; border-radius: 3px; background: var(--ov-grid); overflow: hidden; }
.ov-bar > span { display: block; height: 6px; border-radius: 3px; background: var(--ov-s1); }
.ov-bar-row { padding: 7px 0; border-top: 1px solid var(--border); }
.ov-bar-row:first-of-type { border-top: none; }
.ov-bar-top { display: flex; align-items: baseline; gap: 8px; font-size: 0.85rem; }
.ov-bar-top > span:first-child { flex: 1; }
.ov-bar-bottom { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.ov-bar-bottom .ov-bar { flex: 1; }

.ov-items { display: grid; gap: 2px; }
.ov-item { display: flex; align-items: center; gap: 9px; padding: 6px 0; border-top: 1px solid var(--border); }
.ov-item:first-child { border-top: none; }
.ov-item-img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex: none; background: var(--bg-page); }
.ov-item-img.is-empty { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.ov-item-txt { display: flex; flex-direction: column; min-width: 0; font-size: 0.84rem; }

.ov-holidays { display: flex; flex-direction: column; gap: 7px; }
.ov-holiday { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.7rem; min-width: 0; font-size: 0.84rem; }
.ov-holiday.is-soon { border-color: var(--warning); }
.ov-holiday-date { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 40px; }
.ov-holiday-name { flex: 1; color: var(--text-secondary); }
.ov-holiday-left { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; }
.ov-holiday-left.is-soon { color: var(--warning); font-weight: 600; }

@media (max-width: 1100px) {
    .ov-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ov-two.ov-wide { grid-template-columns: minmax(0, 1fr); }
    .ov-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .ov-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .ov-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ov-v1 { font-size: 1.3rem; }
    .ov-staff-orders { display: none; }
    .ov-section { align-items: flex-start; }
}

/* Hỏi làm thêm giờ trước giờ tan ca (trang Chấm công) */
.att-ot-ask { border: 1px solid var(--warning); background: var(--warning-bg); border-radius: 12px; padding: 0.7rem 0.9rem; margin-bottom: 0.7rem; }
.att-ot-ask-q { font-size: 0.88rem; font-weight: 600; color: var(--warning); display: flex; align-items: center; gap: 7px; margin-bottom: 0.5rem; }
.att-ot-ask-btns { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.att-ot-ask-btns form { margin: 0; }
.att-btn-ot { background: var(--warning-solid); min-height: 40px; font-size: 0.92rem; padding: 0 1rem; width: auto; }
.att-note-ot { background: var(--accent-bg); color: var(--accent); display: flex; align-items: center; gap: 7px; }

/* =========================================================================================
   Tool → Cloudflare Domain (/tool/cloudflare-domain) — chữ chỉ dùng token --text-*/--success/
   --warning/--danger/--accent để tự đúng tương phản ở cả chế độ sáng và tối.
   ========================================================================================= */
.cfd-sub { font-size: 0.85rem; color: var(--text-secondary); margin: -0.4rem 0 1rem; }
.cfd-conn { display: flex; align-items: center; gap: 0.5rem 0.9rem; flex-wrap: wrap; font-size: 0.85rem; }
.cfd-conn .cfd-spacer { flex: 1; }
.cfd-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
    font-size: 0.76rem; font-weight: 600; white-space: nowrap; background: var(--bg-page); color: var(--text-secondary); }
.cfd-pill.is-ok { background: var(--success-bg); color: var(--success); }
.cfd-pill.is-warn { background: var(--warning-bg); color: var(--warning); }
.cfd-pill.is-bad { background: var(--danger-bg); color: var(--danger); }
.cfd-pill.is-info { background: var(--accent-bg); color: var(--accent); }
.cfd-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.cfd-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
    padding: 0.55rem 0.9rem; font-size: 0.86rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.cfd-tab:hover { color: var(--text-primary); }
.cfd-tab.is-on { color: var(--text-primary); border-bottom-color: var(--accent); }
.cfd-panel[hidden] { display: none; }
.cfd-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.2rem; }
.cfd-lbl { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin: 0.2rem 0 0.35rem; }
.cfd-ta { width: 100%; min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; line-height: 1.55; }
.cfd-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 0.5rem; min-height: 1.4rem; }
.cfd-note { font-size: 0.78rem; color: var(--text-secondary); }
.cfd-opt { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.86rem; margin: 0.45rem 0; cursor: pointer; }
.cfd-opt input { margin-top: 3px; }
.cfd-radio { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.86rem; margin: 0.2rem 0 0.6rem 0.1rem; }
.cfd-radio label { display: flex; gap: 0.5rem; align-items: center; cursor: pointer; }
.cfd-radio label.is-disabled { color: var(--text-muted); cursor: default; }
.cfd-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.cfd-row input[type=text], .cfd-row input[type=email] { flex: 1; min-width: 200px; }
.cfd-btns { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.cfd-banner { border-radius: 10px; padding: 0.65rem 0.9rem; font-size: 0.85rem; margin-bottom: 0.8rem; }
.cfd-banner.is-warn { background: var(--warning-bg); color: var(--warning); }
.cfd-banner.is-bad { background: var(--danger-bg); color: var(--danger); }
.cfd-ns { display: flex; align-items: center; gap: 0.5rem 0.8rem; flex-wrap: wrap; background: var(--accent-bg);
    color: var(--text-primary); border-radius: 10px; padding: 0.65rem 0.9rem; margin-bottom: 0.6rem; font-size: 0.85rem; }
.cfd-ns code { background: var(--bg-card); color: var(--text-primary); padding: 2px 8px; border-radius: 6px; font-size: 0.82rem; }
.cfd-table td, .cfd-table th { font-size: 0.82rem; }
.cfd-table td.cfd-wrap { white-space: normal; min-width: 160px; }
.cfd-err { color: var(--danger); font-size: 0.78rem; white-space: normal; }
.cfd-muted { color: var(--text-muted); }
.cfd-scroll { overflow-x: auto; }
@media (max-width: 860px) {
    .cfd-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Quản lý Domain: Mua domain (Porkbun) + ImprovMX ---- */
.dm-sum { background: var(--bg-page); border-radius: 12px; padding: 0.85rem 1rem; font-size: 0.86rem; }
.dm-line { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.22rem 0; }
.dm-big { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); }
.dm-flow { font-size: 0.82rem; color: var(--text-secondary); margin: 0.1rem 0 0.4rem; line-height: 1.6; }
.dm-flow b { color: var(--text-primary); }
.dm-sep { border-top: 1px solid var(--border); margin: 1.2rem 0 1rem; }
.dm-h { font-weight: 700; font-size: 0.95rem; margin: 0.1rem 0 0.5rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dm-quota { display: flex; gap: 0.6rem 1.4rem; flex-wrap: wrap; align-items: center; font-size: 0.85rem; margin-bottom: 0.8rem; }
.dm-quota b { font-size: 1.02rem; }
.dm-meter { height: 6px; border-radius: 99px; background: var(--bg-page); width: 120px; overflow: hidden; margin-top: 4px; }
.dm-meter i { display: block; height: 100%; background: var(--accent); }
.dm-meter.is-full i { background: var(--danger); }
.dm-addrow { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.dm-addrow input[type=text] { flex: 1; min-width: 220px; }
.dm-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.2rem; }
.dm-row { cursor: pointer; }
.dm-row:hover td { background: var(--bg-page); }
.dm-row.is-on td { background: var(--accent-bg); }
.dm-act { white-space: nowrap; }
.dm-act button { background: none; border: none; padding: 0 0.3rem; cursor: pointer; font-size: 0.8rem; color: var(--accent); }
.dm-act button.is-danger { color: var(--danger); }
.dm-alias-add { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) auto; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.dm-dns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0.3rem 0 0.8rem; }
.dm-del { border: 1px solid var(--danger); border-radius: 12px; padding: 0.9rem 1rem; margin-top: 1rem; background: var(--bg-card); }
.dm-del h4 { margin: 0 0 0.5rem; font-size: 0.98rem; color: var(--danger); }
.dm-del ul { margin: 0 0 0.6rem 1.1rem; padding: 0; font-size: 0.85rem; }
.dm-del li { margin: 0.25rem 0; }
.dm-log { white-space: pre-line; font-size: 0.76rem; color: var(--text-secondary); margin-top: 0.3rem; }
.dm-pick { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.85rem; margin: 0.4rem 0; }
.btn-danger-solid { color: var(--danger); border-color: var(--danger); }
/* v33: lý do lỗi ngay dưới ô · việc chạy nền · bản ghi DNS sửa tay · thanh lọc danh sách domain */
.dm-tip { display: block; font-size: 0.75rem; line-height: 1.35; color: var(--danger); margin-top: 3px; white-space: normal; max-width: 280px; }
.dm-task { border: 1px dashed var(--border); border-radius: 12px; padding: 0.7rem 2rem 0.7rem 0.9rem; margin: 0 0 0.8rem; background: var(--bg-page); font-size: 0.86rem; position: relative; }
.dm-task.is-error { border-color: var(--danger); border-style: solid; }
.dm-task.is-done { border-style: solid; }
.dm-task-x { position: absolute; top: 0.4rem; right: 0.5rem; background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 1rem; line-height: 1; padding: 0.2rem; }
.dm-task ol { margin: 0.35rem 0 0; padding: 0; list-style: none; }
.dm-task li { margin: 0.18rem 0; display: flex; gap: 0.45rem; align-items: flex-start; }
.dm-task li > span:first-child { flex: 0 0 1.2rem; text-align: center; }
.dm-task li.is-bad { color: var(--danger); }
.dm-rec { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; background: var(--bg-page); border-radius: 8px; padding: 0.5rem 0.65rem; line-height: 1.7; overflow-x: auto; white-space: pre; margin: 0.35rem 0; }
.dm-box { border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 0.9rem; margin-bottom: 0.8rem; }
.dm-bar { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0 0 0.6rem; }
.dm-bar input[type=search] { max-width: 260px; flex: 1 1 200px; }
.dm-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 0 0.7rem; }
.dm-chip { font-size: 0.78rem; border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; color: var(--text-secondary); background: none; cursor: pointer; }
.dm-chip.is-on { background: var(--accent-bg); color: var(--accent); border-color: transparent; font-weight: 700; }
.dm-src { font-size: 0.72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--bg-page); color: var(--text-secondary); white-space: nowrap; }
.dm-ns { display: block; font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; }
/* v34: Quản lý Phone */
.cfd-banner.is-info { background: var(--accent-bg); color: var(--accent); }
.cfd-banner.is-ok { background: var(--success-bg); color: var(--success); }
.ph-split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.ph-buy { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
.ph-num { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; white-space: nowrap; }
.ph-act { white-space: nowrap; text-align: right; }
.ph-act .btn { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.ph-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem 0.9rem; }
.ph-form.ph-form2 { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.ph-acts { margin: 0.7rem 0 0; align-items: center; }
.ph-inline { display: inline-flex; gap: 0.4rem; align-items: center; }
.ph-inline select { width: auto; }
.ph-copy { padding: 0.15rem 0.5rem; font-size: 0.8rem; }
.ph-sms { font-size: 0.82rem; border-top: 1px solid var(--border); padding: 0.4rem 0; line-height: 1.45; word-break: break-word; }
.ph-codebox { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.6rem 0 0.3rem; }
.ph-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.9rem; font-weight: 800; letter-spacing: 0.22em;
    color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0.2rem 0.7rem; }
.ph-codebtn { border: none; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; }
.ph-cyc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem; align-items: start; }
/* v35: Quản lý Phone giống TextVerified — mỗi số 1 dòng: ✉ (chấm đỏ = SMS chưa đọc) · dịch vụ + số ·
   công tắc tự gia hạn · gia hạn/hết hạn sau N ngày · tag (= tài khoản eBay) · ghi chú · trạng thái · menu ⋮ */
.tv-warn { display: flex; gap: 0.5rem; align-items: flex-start; background: var(--warning-bg); color: var(--warning); border-radius: 12px;
    padding: 0.65rem 0.9rem; font-size: 0.86rem; margin-top: 0.7rem; line-height: 1.5; }
.tv-warn b { color: inherit; }
.tv-cyc { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.55rem; }
.tv-cyc span { font-size: 0.76rem; border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; color: var(--text-secondary); white-space: nowrap; }
.tv-cyc span.is-bad { border-color: transparent; background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.tv-cyc span.is-ok { border-color: transparent; background: var(--success-bg); color: var(--success); }
.ph-split.tv-split { grid-template-columns: minmax(0, 1fr) 340px; }
.tv-side { position: sticky; top: 1rem; }
.tv-wrap { container-type: inline-size; }
.tv-list { border: 1px solid var(--border); border-radius: 14px; }
.tv-row { display: grid; grid-template-columns: 40px minmax(150px, 1.3fr) 46px minmax(140px, 1fr) minmax(76px, 0.8fr) 36px 132px 38px;
    grid-template-areas: "env svc tog when tags note st more"; align-items: center; gap: 0.45rem; padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--border); cursor: pointer; }
.tv-row:first-child { border-top: none; border-radius: 14px 14px 0 0; }
.tv-row:last-child { border-radius: 0 0 14px 14px; }
.tv-row:first-child:last-child { border-radius: 14px; }
.tv-row:hover { background: var(--bg-page); }
.tv-row.is-on { background: color-mix(in srgb, var(--accent-bg) 55%, var(--bg-card)); box-shadow: inset 3px 0 0 var(--accent); }
.tv-row > .tv-env { grid-area: env; } .tv-row > .tv-svc { grid-area: svc; } .tv-row > .tv-tog { grid-area: tog; }
.tv-row > .tv-whenc { grid-area: when; } .tv-row > .tv-tags { grid-area: tags; } .tv-row > .tv-notebtn { grid-area: note; }
.tv-row > .tv-st { grid-area: st; } .tv-row > .tv-morew { grid-area: more; }
.tv-empty { padding: 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.tv-env { position: relative; width: 36px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: none; background: none;
    color: var(--text-secondary); font-size: 1.15rem; cursor: pointer; }
.tv-env:hover { background: var(--accent-bg); color: var(--accent); }
.tv-env i { position: absolute; top: -3px; left: -3px; background: var(--danger-solid); color: #fff; font-style: normal; font-size: 0.66rem;
    font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; }
.tv-svc { display: flex; gap: 0.55rem; align-items: center; min-width: 0; }
.tv-ava { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 0.8rem;
    color: #fff; background: var(--accent-solid); text-transform: uppercase; }
.tv-svc-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tv-svc-t b { font-weight: 500; font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-n { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.tv-sub { font-size: 0.74rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-tog { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 40px; cursor: pointer; }
.tv-tog input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: inherit; z-index: 1; }
.tv-tog span { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background 0.15s; }
.tv-tog span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: left 0.15s; }
.tv-tog input:checked + span { background: var(--accent-solid); }
.tv-tog input:checked + span::after { left: 21px; }
.tv-tog input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.tv-tog input:disabled { cursor: not-allowed; }
.tv-tog input:disabled + span { opacity: 0.35; }
.tv-whenc { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.tv-when { font-size: 0.84rem; color: var(--text-secondary); white-space: nowrap; }
.tv-when.is-warn { color: var(--warning); font-weight: 600; }
.tv-when.is-bad { color: var(--danger); font-weight: 600; }
.tv-when.is-muted { color: var(--text-muted); }
.tv-whenc small { font-size: 0.72rem; color: var(--text-muted); }
.tv-whenc small.is-bad { color: var(--danger); font-weight: 600; }
.tv-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; min-width: 0; }
.tv-chip { display: inline-block; background: var(--accent-bg); color: var(--accent); font-weight: 700; font-size: 0.78rem; border-radius: 7px;
    padding: 3px 8px; border: 1px solid transparent; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-chip.is-2 { background: var(--bg-page); color: var(--text-secondary); font-weight: 600; }
.tv-chip.is-empty { background: none; border: 1px dashed var(--border); color: var(--text-secondary); font-weight: 500; }
.tv-tags input { width: 100%; min-width: 0; padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.tv-notebtn { width: 34px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; font-size: 1rem;
    color: var(--text-secondary); filter: grayscale(1); }
.tv-notebtn:hover { filter: none; background: var(--bg-page); }
.tv-notebtn.has { filter: none; background: var(--accent-bg); color: var(--accent); }
.tv-st { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); border-radius: 9px; padding: 0.38rem 0.6rem;
    font-size: 0.8rem; font-weight: 700; display: inline-flex; gap: 0.4rem; align-items: center; cursor: pointer; white-space: nowrap;
    justify-content: flex-start; width: 100%; }
.tv-st:hover:not(:disabled) { border-color: var(--accent); }
.tv-st i { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--success); display: inline-block; }
.tv-st.is-sleep { font-weight: 600; }
.tv-st.is-sleep i { background: var(--text-muted); }
.tv-st.is-bad { color: var(--danger); }
.tv-st.is-bad i { background: var(--danger); }
.tv-st.is-wait i { background: var(--warning); animation: tvpulse 1s infinite alternate; }
.tv-st.is-off { cursor: default; color: var(--text-secondary); font-weight: 600; }
.tv-st.is-off i { background: var(--text-muted); }
.tv-st:disabled { cursor: progress; }
@keyframes tvpulse { from { opacity: 0.35; } to { opacity: 1; } }
.tv-morew { position: relative; justify-self: end; }
.tv-more { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); border-radius: 9px; width: 34px; height: 32px;
    font-weight: 800; font-size: 1rem; cursor: pointer; line-height: 1; }
.tv-more:hover, .tv-more[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.tv-menu { position: absolute; right: 0; top: 38px; z-index: 30; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22); width: 236px; padding: 0.3rem; cursor: default; }
.tv-menu button { display: flex; gap: 0.5rem; width: 100%; text-align: left; background: none; border: none; padding: 0.48rem 0.6rem; border-radius: 8px;
    font-size: 0.84rem; color: var(--text-primary); cursor: pointer; align-items: center; }
.tv-menu button:hover, .tv-menu button:focus-visible { background: var(--accent-bg); outline: none; }
.tv-menu button.is-danger { color: var(--danger); }
.tv-menu button .tv-check { margin-left: auto; color: var(--success); font-weight: 800; }
.tv-menu hr { border: none; border-top: 1px solid var(--border); margin: 0.25rem 0; }
.tv-edit { grid-column: 1 / -1; border-top: 1px dashed var(--border); padding: 0.65rem 0.8rem 0.75rem 3.4rem; background: var(--bg-page); cursor: default; }
.tv-edit textarea { width: 100%; min-height: 64px; font-size: 0.85rem; }
.tv-edit .cfd-btns { margin-top: 0.5rem; align-items: center; }
.tv-edit select { width: auto; }
.tv-drawer { border: 1px solid var(--border); border-radius: 14px; padding: 0.85rem 0.95rem; }
.tv-drawer .dm-h { margin-bottom: 0.2rem; }
.tv-latest { margin: 0.55rem 0 0.4rem; }
.tv-latest .ph-code { font-size: 1.75rem; }
.tv-drawer .ph-sms b { font-weight: 600; }
@container (max-width: 700px) {
    .tv-row { grid-template-columns: 40px minmax(0, 1fr) minmax(0, auto) 36px;
        grid-template-areas: "env svc st more" "tog when tags note"; row-gap: 0.4rem; padding: 0.6rem 0.6rem; }
    .tv-row > .tv-st { width: auto; justify-self: end; }
    .tv-row > .tv-tags { justify-content: flex-end; }
    .tv-row > .tv-tog { justify-self: center; }
    .tv-edit { padding-left: 0.8rem; }
}
@container (max-width: 460px) {           /* điện thoại: 3 dòng để số điện thoại luôn hiện đủ */
    .tv-row { grid-template-columns: 40px minmax(0, 1fr) auto 36px;
        grid-template-areas: "env svc svc more" "tog when st st" ". tags tags note"; }
    .tv-row > .tv-st { justify-self: end; }
    .tv-row > .tv-tags { justify-content: flex-start; }
    .tv-when { white-space: normal; }
}
.tv-back { display: none; }
@media (max-width: 1400px) { .tv-back { display: inline-flex; } }
/* Ô chọn dịch vụ có tìm kiếm (hàng nghìn dịch vụ) — dùng chung Thuê số mới + Xác minh 1 lần */
.ph-combo { position: relative; }
.ph-combo input { width: 100%; }
.ph-combo-count { display: block; font-size: 0.72rem; color: var(--text-secondary); margin-top: 3px; }
.ph-combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2); max-height: 320px; overflow-y: auto; padding: 0.25rem 0; min-width: 240px; }
.ph-combo-list[hidden] { display: none; }
.ph-grp { font-size: 0.7rem; font-weight: 700; color: var(--text-secondary); padding: 0.45rem 0.75rem 0.2rem; text-transform: uppercase; letter-spacing: 0.04em; }
.ph-opt { display: flex; gap: 0.5rem; align-items: center; padding: 0.42rem 0.75rem; font-size: 0.86rem; cursor: pointer; color: var(--text-primary); }
.ph-opt.is-hl { background: var(--accent-bg); }
.ph-opt.is-cur::after { content: "✓"; margin-left: auto; color: var(--success); font-weight: 800; }
.ph-opt .tv-ava { flex-basis: 20px; width: 20px; height: 20px; font-size: 0.68rem; border-radius: 5px; }
.ph-opt mark { background: none; color: var(--accent); font-weight: 800; }
.ph-more { font-size: 0.75rem; color: var(--text-secondary); padding: 0.4rem 0.75rem; }
@media (max-width: 1400px) {
    .ph-split.tv-split { grid-template-columns: minmax(0, 1fr); }
    .tv-side { position: static; }
}
@media (max-width: 960px) {
    .ph-split, .ph-buy, .ph-cyc { grid-template-columns: minmax(0, 1fr); }
    .ph-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .ph-form, .ph-form.ph-form2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .dm-split { grid-template-columns: minmax(0, 1fr); }
    .dm-alias-add { grid-template-columns: minmax(0, 1fr); }
}

/* v36: Danh sách đơn — bấm Order ID để sao chép · 💲 Sửa Cost hàng loạt */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.oid-copy { cursor: copy; border-radius: 4px; padding: 1px 2px; margin: -1px -2px; transition: background 0.15s; }
.oid-copy:hover, .oid-copy:focus-visible { background: var(--accent-bg); color: var(--accent); outline: none; }
.oid-copy.is-copied { background: var(--success-bg); color: var(--success); }
.cb-box { background: var(--bg-card); color: var(--text-primary); border-radius: 14px; padding: 1.1rem 1.2rem; width: 1140px; max-width: 95vw;
    max-height: 92vh; overflow-y: auto; cursor: default; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.cb-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; font-size: 1.02rem; }
.cb-x { margin-left: auto; background: none; border: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--text-secondary); padding: 0 0.3rem; }
.cb-cols { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.cb-step { font-size: 0.72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35rem; }
.cb-hint { font-size: 0.8rem; color: var(--text-secondary); margin: 0 0 0.5rem; line-height: 1.5; }
.cb-hint code { font-size: 0.78rem; background: var(--bg-page); padding: 0 4px; border-radius: 4px; }
.cb-ta { width: 100%; min-height: 230px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; line-height: 1.6;
    white-space: pre; overflow-x: auto; tab-size: 4; }
.cb-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 0.6rem; }
.cb-scroll { overflow-x: auto; max-height: 52vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.cb-tbl { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.cb-tbl th { position: sticky; top: 0; background: var(--bg-card); text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 0.74rem;
    padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.cb-tbl td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
.cb-tbl tr:last-child td { border-bottom: none; }
.cb-tbl .num { text-align: right; }
.cb-tbl tr.cb-skip td { background: var(--bg-page); color: var(--text-secondary); }
.cb-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cb-old { color: var(--text-muted); text-decoration: line-through; margin-right: 4px; }
.cb-ok { color: var(--success); font-weight: 600; }
.cb-warn { color: var(--warning); font-weight: 600; }
.cb-bad { color: var(--danger); font-weight: 600; }
.cb-muted { color: var(--text-secondary); }
.cb-up { color: var(--success); font-weight: 700; }
.cb-down { color: var(--danger); font-weight: 700; }
.cb-note { font-size: 0.72rem; color: var(--text-secondary); font-weight: 400; white-space: normal; max-width: 260px; }
.cb-sum .cb-warn { color: var(--text-primary); }
.cb-sum { display: flex; gap: 0.4rem 1.2rem; flex-wrap: wrap; background: var(--accent-bg); color: var(--text-primary); border-radius: 10px;
    padding: 0.55rem 0.8rem; font-size: 0.84rem; margin: 0.6rem 0 0; }
@media (max-width: 900px) {
    .cb-cols { grid-template-columns: minmax(0, 1fr); }
    .cb-ta { min-height: 150px; }
}

/* v36: Admin sửa bảng chấm công + % hoa hồng riêng (trang Chấm công) */
.att-pencil { background: var(--bg-card); border: 1px solid var(--border); border-radius: 7px; padding: 1px 7px; cursor: pointer; font-size: 0.8rem;
    line-height: 1.5; color: var(--text-secondary); }
.att-pencil:hover, .att-pencil:focus-visible { border-color: var(--accent); }
th.att-edit-col, td.att-edit-col { width: 40px; text-align: right; }
.att-tag.att-tag-edit { background: var(--accent-bg); color: var(--accent); cursor: help; }
tr.att-row-editing td { background: var(--accent-bg); }
tr.att-edit-row > td { background: var(--accent-bg); padding: 0.2rem 0.6rem 0.8rem; white-space: normal; }
.att-add-box { background: var(--accent-bg); border-radius: 12px; padding: 0.7rem 0.8rem; margin: 0 0 0.8rem; }
.att-edit-title { font-weight: 700; font-size: 0.86rem; margin: 0.35rem 0 0.5rem; color: var(--text-primary); }
.att-edit-grid { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: flex-start; }
.att-f { display: flex; flex-direction: column; gap: 3px; font-size: 0.78rem; color: var(--text-secondary); }
.att-f > span { font-weight: 600; }
.att-f select, .att-f input[type=date] { font-size: 0.84rem; padding: 0.3rem 0.45rem; }
input.att-t { width: 74px; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem; padding: 0.3rem 0.4rem; }
input.att-t:disabled { opacity: 0.45; }
.att-lunch { display: flex; align-items: center; gap: 4px; color: var(--text-secondary); }
.att-chk { display: flex; align-items: center; gap: 5px; font-size: 0.76rem; color: var(--text-secondary); cursor: pointer; margin-top: 2px; }
.att-edit-row2 { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: flex-end; margin-top: 0.55rem; }
.att-f-reason { flex: 1 1 280px; }
.att-f-reason input { width: 100%; font-size: 0.84rem; padding: 0.35rem 0.5rem; }
.att-prev { font-size: 0.84rem; color: var(--text-primary); min-height: 1.3em; padding-bottom: 0.3rem; }
.att-err { color: var(--danger); font-weight: 600; }
.att-edit-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 0.55rem; }
.att-edit-hint { font-size: 0.74rem; color: var(--text-secondary); margin-top: 0.4rem; }
.att-comm-edit { background: var(--accent-bg); border-radius: 10px; padding: 0.6rem 0.75rem; display: flex; gap: 0.45rem 0.7rem; align-items: center;
    flex-wrap: wrap; font-size: 0.84rem; color: var(--text-primary); }
.att-comm-edit input { width: 72px; text-align: center; font-weight: 700; padding: 0.3rem 0.4rem; }
.att-comm-edit select { width: auto; font-size: 0.82rem; padding: 0.3rem 0.4rem; }
.att-comm-note { flex-basis: 100%; font-size: 0.76rem; color: var(--text-secondary); line-height: 1.5; }
#attCommRow .att-pencil { margin-left: 6px; }
@media (max-width: 600px) {
    .att-table-cards.has-edit tr { grid-template-columns: 46px auto minmax(0, 1fr) auto 34px; grid-template-areas: "date in out net edit" "date lunch lunch ot edit"; }
    .att-table-cards.has-edit.has-person tr { grid-template-areas: "date person person net edit" "date in out ot edit" "date lunch lunch ot edit"; }
    .att-table-cards td.att-edit-col { grid-area: edit; width: auto; }
    table.att-table-cards td.c-date .att-tag-edit { display: table; margin: 2px 0 0; padding: 0 3px; }   /* chỉ còn ✏️ cho vừa cột ngày */
    .att-table-cards .att-tag-txt { display: none; }
    .att-table-cards tr.att-edit-row { display: block; padding: 0; }
    table.att-table-cards tr.att-edit-row > td { display: block; padding: 0.2rem 0.4rem 0.8rem; white-space: normal; background: var(--accent-bg) !important; }
    input.att-t { width: 64px; }
}
.att-msg { font-size: 0.82rem; }

/* v37: Tool ™ Trademark ảnh */
.tm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1.2rem; align-items: start; }
.tm-drop { border: 2px dashed var(--accent); border-radius: 14px; padding: 1rem 1.1rem; text-align: center; background: var(--accent-bg);
    color: var(--text-primary); display: flex; flex-direction: column; gap: 0.3rem; cursor: pointer; }
.tm-drop:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tm-drop.is-over { background: color-mix(in srgb, var(--accent) 18%, var(--bg-card)); }
.tm-drop b { font-size: 1rem; }
.tm-drop > span { font-size: 0.82rem; color: var(--text-secondary); }
.tm-drop kbd { display: inline-block; border: 1px solid var(--border); border-bottom-width: 2px; background: var(--bg-card); color: var(--text-primary);
    border-radius: 6px; padding: 0 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; }
.tm-link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.tm-linkrow { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.tm-linkrow input { flex: 1; min-width: 0; }
.tm-stage { margin-top: 0.7rem; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background:
    repeating-conic-gradient(var(--bg-page) 0% 25%, var(--bg-card) 0% 50%) 50% / 18px 18px; min-height: 160px; display: grid; place-items: center; }
.tm-stage canvas { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; }
.tm-empty { color: var(--text-secondary); font-size: 0.86rem; padding: 2.5rem 1rem; text-align: center; background: var(--bg-card); border-radius: 10px; }
.tm-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.7rem; }
.tm-meta { font-size: 0.78rem; color: var(--text-secondary); margin-left: auto; }
.tm-status { margin-top: 0.5rem; min-height: 1.4em; font-size: 0.84rem; word-break: break-all; }
.tm-st.is-ok { color: var(--success); }
.tm-st.is-warn { color: var(--warning); }
.tm-st.is-bad { color: var(--danger); }
.tm-st b { color: inherit; }
.tm-set { display: flex; flex-direction: column; gap: 0.8rem; }
.tm-f { display: flex; flex-direction: column; gap: 5px; }
.tm-f > label, .tm-lbl { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.tm-f textarea { font-size: 0.92rem; font-weight: 600; resize: vertical; min-height: 58px; }
.tm-hint { font-weight: 400; font-size: 0.75rem; color: var(--text-secondary); margin: 0; }
.tm-sym { display: flex; gap: 0.35rem; }
.tm-sym .btn { padding: 0.2rem 0.6rem; }
.tm-logo { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.tm-logo img { width: 44px; height: 44px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px;
    background: repeating-conic-gradient(var(--bg-page) 0% 25%, var(--bg-card) 0% 50%) 50% / 10px 10px; }
.tm-seg { display: flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.tm-seg label { flex: 1; display: flex; cursor: pointer; }
.tm-seg input { position: absolute; opacity: 0; pointer-events: none; }
.tm-seg span { flex: 1; text-align: center; padding: 0.4rem 0.3rem; font-size: 0.79rem; color: var(--text-secondary); line-height: 1.25; }
.tm-seg label + label span { border-left: 1px solid var(--border); }
.tm-seg input:checked + span { background: var(--accent-bg); color: var(--accent); font-weight: 700; }
.tm-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.tm-range { display: flex; gap: 0.6rem; align-items: center; }
.tm-range input { flex: 1; accent-color: var(--accent-solid); }
.tm-range b { min-width: 46px; text-align: right; font-size: 0.84rem; color: var(--text-primary); }
.tm-f.is-off { opacity: 0.5; }
.tm-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tm-allhead { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.tm-allbtns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.8rem; }
.tm-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-card); }
.tm-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.tm-thumb { display: block; width: 100%; padding: 0; border: none; background: var(--bg-page); cursor: zoom-in; }
.tm-thumb canvas { display: block; width: 100%; height: 170px; object-fit: contain; }
.tm-cardbar { display: flex; gap: 0.3rem; align-items: center; padding: 0.4rem; }
.tm-cardbar .btn { padding: 0.15rem 0.45rem; font-size: 0.82rem; }
.tm-cardname { flex: 1; min-width: 0; font-size: 0.74rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-cardlink { font-size: 0.72rem; padding: 0 0.45rem 0.4rem; word-break: break-all; }
.tm-cardlink:empty { display: none; }
#tmLinksText { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; }
@media (max-width: 1100px) {
    .tm-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
    .tm-bar .btn { flex: 1 1 auto; }
    .tm-meta { margin-left: 0; flex-basis: 100%; }
    .tm-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tm-thumb canvas { height: 130px; }
}
.tm-grid [hidden], #tmAllCard[hidden], #tmAllCard [hidden] { display: none !important; }   /* thuộc tính hidden thắng display: flex */

/* =========================================================================================
   v38 — Công tắc giao diện Sáng / Tối / Kính + số đếm nhỏ ở thanh bên (mọi giao diện)
   ========================================================================================= */
.theme-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-page); }
.theme-switch button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px;
    border: none; background: transparent; border-radius: 7px; padding: 0.25rem 0.3rem; font-family: inherit; font-size: 0.76rem;
    color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.theme-switch button:hover { color: var(--text-primary); }
.theme-switch button.is-on { background: var(--bg-card); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.12), inset 0 0 0 1px var(--border); }
.theme-switch button i { font-size: 0.95rem; }
.sidebar.collapsed .theme-switch { flex-direction: column; }
@media (max-width: 768px) {
    .theme-switch { flex: none; }
    .theme-switch .sidebar-text { display: none; }
    .theme-switch button { padding: 0.25rem 0.45rem; }
}

.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; line-height: 18px;
    text-align: center; background: var(--danger-bg); color: var(--danger); font-variant-numeric: tabular-nums; }
.nav-badge.is-live { background: var(--success-bg); color: var(--success); display: inline-flex; align-items: center; gap: 4px; }
.nav-badge.is-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sidebar.collapsed .nav-badge { display: none; }

/* =========================================================================================
   v38 — Tổng quan bố cục mới (mọi giao diện)
   ========================================================================================= */
.ov-head { justify-content: space-between; flex-wrap: wrap; }
.ov-head-actions { display: flex; gap: 8px; align-items: center; }
.ov-head-actions .btn { font-size: 0.8rem; display: inline-flex; align-items: center; gap: 6px; }
.ov-head + .ov-section { margin-top: 0.2rem; }
.ov-pop-wrap { position: relative; }
.ov-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 340px; max-width: calc(100vw - 24px);
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 0.85rem;
    box-shadow: 0 16px 40px rgba(0,0,0,0.22); font-weight: 400; }
.ov-pop-title { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; }
.ov-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; font-size: 0.82rem; }
.ov-pop-grid .ov-check { padding: 5px 2px; cursor: pointer; }
.ov-period select { width: auto; max-width: 140px; }
.ov-period select.is-on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

.ov-tile-head { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; }
.ov-tile-ic { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
    border: 1px solid var(--border); background: var(--bg-page); flex: none; }
.ov-tile-ic.is-rev { color: var(--ov-s1); }
.ov-tile-ic.is-pro { color: var(--success); }
.ov-tile-ic.is-n { color: var(--text-secondary); }
.ov-tile-ic.is-aov { color: var(--warning); }

.ov-tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-page); }
.ov-tab { border: none; background: transparent; border-radius: 6px; padding: 4px 10px; font-family: inherit; font-size: 0.76rem; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.ov-tab:hover { color: var(--text-primary); }
.ov-tab.is-on { background: var(--bg-card); color: var(--text-primary); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border); }
.ov-chart-head + .ov-legend { margin: 0 0 0.3rem; }

/* Vòng tròn tài khoản eBay — màu theo đúng màu tài khoản (bản sáng hơn ở chế độ tối) */
.ov-donut-wrap { display: flex; justify-content: center; margin: 0.2rem 0 0.6rem; }
.ov-donut { max-width: 100%; height: auto; overflow: visible; }
.ov-donut path { fill: var(--sl); stroke: var(--ov-ring, var(--bg-card)); stroke-width: 2; transition: opacity 0.15s; }
[data-theme="dark"] .ov-donut path { fill: var(--sl-d); }
.ov-donut:hover path { opacity: 0.55; }
.ov-donut path:hover { opacity: 1; }
.ov-donut-v { font-size: 19px; font-weight: 700; fill: var(--text-primary); }
.ov-donut-l { font-size: 11px; fill: var(--text-muted); }
.ov-donut-legend { display: flex; flex-direction: column; }
.ov-dl-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 38px 58px; align-items: center; gap: 8px; padding: 6px 2px;
    border: none; border-top: 1px solid var(--border); background: none; font-family: inherit; font-size: 0.83rem; color: var(--text-primary); text-align: left; width: 100%; }
.ov-dl-row:first-child { border-top: none; }
button.ov-dl-row { cursor: pointer; }
button.ov-dl-row:hover { background: var(--bg-page); }
.ov-dl-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--sl); }
[data-theme="dark"] .ov-dl-sw { background: var(--sl-d); }
.ov-dl-pct, .ov-dl-delta { text-align: right; }

/* Đơn mới nhất */
.ov-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 0.6rem; }
.ov-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ov-chip { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 3px 10px; font-family: inherit; font-size: 0.74rem;
    color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.ov-chip:hover { color: var(--text-primary); }
.ov-chip.is-on { background: var(--accent-bg); color: var(--accent); border-color: transparent; font-weight: 600; }
.ov-rtable { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.ov-rtable th { text-align: left; font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
    padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ov-rtable td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ov-rtable tr:last-child td { border-bottom: none; }
.ov-rtable td.ov-who-td { max-width: 0; width: 100%; }     /* cột Khách co giãn, chữ dài tự cắt "…" */
.ov-rtable .badge { white-space: nowrap; }
.ov-rtable tbody tr { cursor: pointer; }
.ov-rtable tbody tr:hover td, .ov-rtable tbody tr:focus-visible td { background: var(--bg-page); }
.ov-rtable tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ov-r { text-align: right !important; white-space: nowrap; }
.ov-oid { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.76rem; color: var(--text-primary); white-space: nowrap;
    cursor: copy; border-radius: 5px; padding: 1px 3px; margin: -1px -3px; }
.ov-oid:hover { background: var(--accent-bg); color: var(--accent); }
.ov-oid.is-copied { background: var(--success-bg); color: var(--success); }
.ov-who { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ov-who-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ov-who-txt b { font-weight: 600; }
.ov-who-txt .ov-muted { font-size: 0.74rem; }
.ov-who-txt > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-rtable .ov-avatar { border-radius: 8px; font-size: 0.68rem; }
.ov-notrack { color: var(--warning); margin-left: 4px; vertical-align: -2px; }
.ov-show-sm { display: none; }
.ov-more { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 0.6rem; padding-top: 0.6rem; border: none;
    border-top: 1px solid var(--border); background: none; width: 100%; font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--accent); cursor: pointer; }
.ov-more[hidden] { display: none !important; }
.ov-recent, .ov-act { display: flex; flex-direction: column; }
.ov-recent .ov-more, .ov-act .ov-more { margin-top: auto; }
.ov-recent-list { margin-bottom: 0.6rem; overflow-x: auto; }

/* Hoạt động */
.ov-live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 700; color: var(--success); background: var(--success-bg);
    padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.ov-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: ovPulse 2s infinite; }
.ov-live.is-off { color: var(--text-muted); background: var(--bg-page); }
.ov-live.is-off::before { animation: none; }
@keyframes ovPulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.45); } 70% { box-shadow: 0 0 0 6px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }
@media (prefers-reduced-motion: reduce) { .ov-live::before { animation: none; } }
.ov-act-chips { margin-bottom: 0.4rem; }
.ov-feed { display: flex; flex-direction: column; margin-bottom: 0.6rem; }
.ov-feed-wait { padding: 1rem 0; text-align: center; }
.ov-fi { display: flex; align-items: flex-start; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; border-radius: 6px; }
.ov-fi:first-child { border-top: none; }
a.ov-fi:hover { background: var(--bg-page); }
.ov-fi-ic { width: 30px; height: 30px; border-radius: 9px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
    border: 1px solid var(--border); background: var(--bg-page); color: var(--text-secondary); }
.ov-fi-ic.k-order { color: var(--ov-s1); }
.ov-fi-ic.k-pay, .ov-fi-ic.k-ship { color: var(--success); }
.ov-fi-ic.k-track { color: var(--warning); }
.ov-fi-ic.k-att { color: var(--accent); }
.ov-fi-ic.k-sms { color: var(--danger); }
.ov-fi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.ov-fi-body b { font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-fi-body small { font-size: 0.74rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-fi-t { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; padding-top: 2px; }

@media (max-width: 560px) {
    .ov-hide-sm { display: none; }
    .ov-show-sm { display: block; }
    td .ov-show-sm { margin-top: 4px; }
    .ov-pop-grid { grid-template-columns: 1fr; }
    .ov-head-actions { width: 100%; }
    .ov-pop { right: auto; left: 0; }
    .ov-dl-row { grid-template-columns: 10px minmax(0, 1fr) auto 34px; }
    .ov-dl-delta { display: none; }
    .ov-chart-head .ov-tabs { width: 100%; }
    .ov-chart-head .ov-tab { flex: 1; }
}

/* =========================================================================================
   v39 — BURGERPRINTS: cột Xưởng (Danh sách), khung Gửi BP (xem trước), trang /burgerprints, Cài đặt
   ========================================================================================= */
.btn-bp { border-color: var(--warning); color: var(--warning); font-weight: 600; }
.btn-bp:hover { background: var(--warning-bg); }
.bp-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; text-decoration: none; }
.bp-q { background: var(--warning-bg); color: var(--warning); }
.bp-p { background: var(--accent-bg); color: var(--accent); }
.bp-s { background: var(--success-bg); color: var(--success); }
.bp-x { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }
.bp-w { background: var(--danger-bg); color: var(--danger); }
a.bp-badge:hover { text-decoration: underline; }
.bp-track { display: block; margin-top: 3px; font-size: 0.72rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }
.bp-muted { color: var(--text-secondary); font-size: 0.76rem; }
.bp-hint { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; margin: 0.2rem 0 0.6rem; }
.bp-sub { font-size: 0.78rem; color: var(--text-secondary); font-weight: 400; }
.page-header .bp-sub { margin-left: 0.4rem; }
.bp-flash { background: var(--accent-bg); color: var(--accent); border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 1rem; font-size: 0.85rem; }

/* ---- khung Gửi BP (xem trước) ---- */
.lightbox-overlay.bp-ov { cursor: default; padding: 1rem; z-index: 1000; }
.bp-box { width: 1180px; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.bp-box .cb-head { padding: 0.9rem 3rem 0.6rem 1.2rem; margin: 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; position: relative; }
.bp-box .cb-head .cb-x { position: absolute; top: 0.6rem; right: 0.8rem; }
.bp-body { flex: 1 1 auto; overflow-y: auto; padding: 0.8rem 1.2rem; display: flex; flex-direction: column; gap: 0.7rem; min-height: 120px; }
.bp-foot { border-top: 1px solid var(--border); padding: 0.7rem 1.2rem; display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; background: var(--bg-card); }
.bp-loading { color: var(--text-secondary); font-size: 0.86rem; padding: 1.2rem 0; text-align: center; }
.bp-spin { display: inline-block; animation: bp-spin 1s linear infinite; }
@keyframes bp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bp-spin { animation: none; } }
.bp-err, .bp-note-bad { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 0.55rem 0.8rem; font-size: 0.84rem; }
.bp-note-warn { background: var(--warning-bg); color: var(--warning); border-radius: 8px; padding: 0.4rem 0.7rem; font-size: 0.78rem; margin-top: 0.35rem; }
.bp-ord { border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.8rem; background: var(--bg-card); }
.bp-ord.is-off { background: var(--bg-page); }
.bp-ord.is-done { border-color: var(--success); }
.bp-ord-h { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; font-size: 0.86rem; }
.bp-inc-lbl { display: inline-flex; align-items: center; }
.bp-inc-lbl input { width: 16px; height: 16px; }
.bp-result { margin-left: auto; font-size: 0.8rem; }
.bp-block, .bp-force { border-radius: 8px; padding: 0.35rem 0.6rem; font-size: 0.78rem; margin-bottom: 0.45rem; }
.bp-block { background: var(--danger-bg); color: var(--danger); }
.bp-force { background: var(--warning-bg); color: var(--warning); }
.bp-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 0.9rem; }
.bp-col { min-width: 0; }
.bp-cap { font-size: 0.72rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.3rem; }
.bp-addr { display: grid; grid-template-columns: minmax(0, 1fr) 52px 104px 46px; gap: 6px; }   /* v73: ô Zip đủ chỗ cho Zip+4 (80127-3932) */
.bp-addr input { font-size: 0.82rem; padding: 0.35rem 0.5rem; min-width: 0; width: 100%; }
.bp-addr .full { grid-column: 1 / -1; }
.bp-addr input.is-bad { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.bp-addr-msg { font-size: 0.76rem; margin-top: 4px; min-height: 1em; }
.bp-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; padding: 0.5rem 0; border-top: 1px dashed var(--border); }
.bp-line:first-of-type, .bp-cap + .bp-line { border-top: none; padding-top: 0.1rem; }
.bp-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.bp-thumb-e { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--bg-page); }
.bp-line-main { min-width: 0; }
.bp-line-t { font-weight: 600; font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-line-price { font-size: 0.84rem; font-weight: 600; white-space: nowrap; }
.bp-pick { display: flex; gap: 6px; flex-wrap: wrap; margin: 0.35rem 0; }
.bp-pick select, .bp-pick input { width: auto; max-width: 100%; font-size: 0.8rem; padding: 0.3rem 0.45rem; }
.bp-pick select[hidden], .bp-pick input[hidden] { display: none; }
.bp-pick .bp-size { min-width: 74px; }
.bp-sku-in { min-width: 200px; }
.bp-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.bp-chip { font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.bp-chip.ok { background: var(--success-bg); color: var(--success); }
.bp-chip.warn { background: var(--warning-bg); color: var(--warning); white-space: normal; }
.bp-chip.bad { background: var(--danger-bg); color: var(--danger); white-space: normal; }
.bp-chip.muted { background: var(--bg-page); color: var(--text-secondary); }
.bp-links { margin-top: 0.3rem; }
.bp-links summary { font-size: 0.76rem; color: var(--accent); cursor: pointer; width: max-content; }
.bp-links input { display: block; width: 100%; font-size: 0.8rem; padding: 0.3rem 0.45rem; margin-top: 4px; }
.bp-links .bp-hint { margin: 4px 0 0; font-size: 0.72rem; }
.bp-opts { display: flex; gap: 0.4rem 1rem; flex-wrap: wrap; align-items: center; font-size: 0.82rem; }
.bp-opts label { display: inline-flex; align-items: center; gap: 5px; }
.bp-opts select { width: auto; font-size: 0.82rem; padding: 0.3rem 0.45rem; }
.bp-force-lbl { color: var(--warning); font-weight: 600; }
.bp-foot-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.bp-sum { font-size: 0.82rem; color: var(--text-secondary); }

/* ---- v40: chọn kiểu đơn (Create Order / Create Label Order) + ô label ---- */
.bp-mode { display: flex; gap: 8px; padding: 0.6rem 1.2rem; border-bottom: 1px solid var(--border); background: var(--bg-page); }
.bp-mode-opt { flex: 1 1 0; min-width: 0; display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 12px;
    padding: 0.55rem 0.75rem; background: var(--bg-card); cursor: pointer; }
.bp-mode-opt input { margin-top: 3px; flex-shrink: 0; }
.bp-mode-opt b { display: block; font-size: 0.88rem; }
.bp-mode-opt small { display: block; color: var(--text-secondary); font-size: 0.75rem; line-height: 1.4; }
.bp-mode-opt.is-on { border-color: var(--accent-solid); box-shadow: 0 0 0 2px var(--accent-bg); }
.bp-mode-opt:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.bp-lab { border: 1.5px dashed var(--accent); border-radius: 10px; padding: 0.55rem 0.7rem; background: var(--accent-bg); }
.bp-lab.is-bad { border-color: var(--danger); background: var(--danger-bg); }
.bp-lab-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bp-lab-row + .bp-lab-row { margin-top: 6px; }
.bp-lab-url { flex: 1 1 160px; min-width: 0; font-size: 0.8rem; padding: 0.3rem 0.45rem; }
.bp-tr-in { flex: 1 1 200px; min-width: 0; max-width: 260px; font-size: 0.8rem; padding: 0.3rem 0.45rem; }
.bp-file { display: inline-flex; gap: 6px; align-items: center; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border);
    border-radius: 8px; padding: 4px 9px; font-size: 0.78rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-who { margin: 6px 0 0; }
.bp-kinds { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 3px; }
.bp-kind { display: inline-block; font-size: 0.66rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--accent-bg); color: var(--accent); }
.bp-kind.is-label { background: var(--warning-bg); color: var(--warning); }
.bp-kind.is-dash { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }
.bp-src { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: -0.2rem 0 0.7rem; font-size: 0.8rem; }
.bp-src-a { padding: 0.2rem 0.6rem; border-radius: 999px; text-decoration: none; color: var(--text-secondary); border: 1px solid var(--border); background: var(--bg-card); }
.bp-src-a.is-on { color: var(--text-primary); border-color: var(--accent); font-weight: 600; }
.bp-import { max-width: 360px; }

/* ---- v41: xưởng in DTG / DTF · so label với khách · gợi ý design từ đơn cũ ---- */
.bp-pick .bp-fac-sel { min-width: 210px; }
.bp-kind.is-fac { background: var(--bg-page); color: var(--text-primary); border: 1px solid var(--border); }
.bp-kind-wrap { display: inline-flex; gap: 6px; align-items: center; }
.bp-kindsel { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.bp-kind-btn { border: none; background: var(--bg-card); color: var(--text-primary); padding: 0.3rem 0.8rem; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.bp-kind-btn + .bp-kind-btn { border-left: 1px solid var(--border); }
.bp-kind-btn.is-on { background: var(--accent-solid); color: #fff; }
.bp-kind-btn:disabled { color: var(--text-muted); cursor: not-allowed; }
.bp-kind-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bp-url-note { font-size: 0.74rem; min-height: 1.15em; margin: 2px 0 0; overflow-wrap: anywhere; }
.bp-view { text-decoration: none; }
.bp-ver { margin-top: 6px; border-radius: 10px; padding: 0.5rem 0.7rem; font-size: 0.8rem; line-height: 1.5; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-primary); }
.bp-ver.is-ok { border-color: var(--success); background: var(--success-bg); }
.bp-ver.is-bad { border-color: var(--danger); background: var(--danger-bg); }
.bp-ver.is-warn { border-color: var(--warning); background: var(--warning-bg); }
.bp-ver-h { font-weight: 700; margin-bottom: 2px; }
.bp-ver-r { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.bp-ver-r > span:first-of-type { overflow-wrap: anywhere; }
.bp-ver-k { min-width: 68px; color: var(--text-secondary); font-weight: 600; flex-shrink: 0; }
.bp-ver-y { color: var(--success); font-weight: 800; }
.bp-ver-n { color: var(--danger); font-weight: 800; }
.bp-ver-q { color: var(--text-secondary); font-weight: 700; }
.bp-ver-snip { margin-top: 4px; color: var(--text-secondary); overflow-wrap: anywhere; }
.bp-ver-snip .cb-mono { color: var(--text-primary); }
.bp-ver-ok { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-weight: 600; cursor: pointer; }
.bp-ver-ok input { width: 16px; height: 16px; flex-shrink: 0; }
.bp-dh { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; padding: 5px 8px; border-radius: 9px;
    border: 1.5px dashed var(--warning); background: var(--warning-bg); color: var(--text-primary); font-size: 0.78rem; }
.bp-dh[hidden] { display: none; }
.bp-dh-a { color: var(--accent); font-weight: 700; text-decoration: none; }
.bp-dh-a:hover { text-decoration: underline; }
.bp-dh .bp-muted { overflow-wrap: anywhere; }
/* Danh sách: ô Design có gợi ý */
.dh-box { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; min-width: 200px; max-width: 280px; padding: 3px 5px; border-radius: 7px;
    border: 1.5px dashed var(--warning); background: var(--warning-bg); color: var(--text-primary); font-size: 0.72rem; cursor: default; }
.dh-link { color: var(--accent); font-weight: 700; text-decoration: none; }
.dh-src { color: var(--text-secondary); white-space: normal; line-height: 1.3; }
.dh-acts { display: inline-flex; gap: 4px; }
.dh-btn { font-size: 0.72rem; padding: 0.15rem 0.5rem; min-height: 0; }
.dh-ok { display: inline-block; margin-left: 3px; font-size: 0.68rem; font-weight: 700; color: var(--success); }
/* Cài đặt: bảng xưởng in */
.bp-fac-set { margin-top: 0.9rem; }
.bp-fac-table td, .bp-fac-table th { vertical-align: middle; }
.bp-fac-table input[type="text"] { width: 100%; min-width: 120px; font-size: 0.82rem; padding: 0.3rem 0.45rem; }
.bp-fac-table select { font-size: 0.82rem; padding: 0.3rem 0.45rem; }
.bp-c-def { text-align: center; width: 90px; }
.bp-fac-src { font-size: 0.7rem; }
@media (max-width: 768px) {
    .bp-mode { flex-direction: column; gap: 6px; padding: 0.5rem 0.7rem; }
    .bp-mode-opt { flex: 0 0 auto; min-height: 40px; align-items: center; padding: 0.45rem 0.7rem; }
    .bp-mode-opt:not(.is-on) small { display: none; }        /* điện thoại: chỉ giải thích kiểu đang chọn */
    .bp-lab-url, .bp-tr-in, .bp-addr input { font-size: 16px; min-height: 40px; }   /* 16px: iPhone không tự phóng to khi gõ */
    .bp-tr-in { max-width: none; }
    .bp-lab .bp-mini-txt { min-height: 38px; }
    .bp-import { max-width: none; }
    .bp-pick .bp-fac-sel { min-width: 0; width: 100%; }
    .bp-pick select { min-height: 38px; }
    .bp-kind-wrap { width: 100%; }
    .bp-kind-btn { min-height: 38px; padding: 0.3rem 1.1rem; }
    .bp-ver-ok input { width: 20px; height: 20px; }
    .bp-dh .btn { min-height: 36px; }
}

/* ---- hộp xác nhận ---- */
.bp-confirm { background: var(--bg-card); color: var(--text-primary); border-radius: 14px; padding: 1rem 1.2rem; width: 460px; max-width: 94vw;
    cursor: default; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.bp-confirm-h { font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; }
.bp-confirm-b { font-size: 0.85rem; line-height: 1.55; }
.bp-confirm-f { display: flex; justify-content: flex-end; gap: 8px; margin-top: 0.9rem; }
.bp-kv { border-collapse: collapse; width: 100%; margin-bottom: 0.5rem; }
.bp-kv th { text-align: left; font-weight: 500; color: var(--text-secondary); padding: 3px 12px 3px 0; }
.bp-kv td { text-align: right; font-weight: 700; padding: 3px 0; }

/* ---- trang /burgerprints ---- */
.bp-top { display: flex; gap: 0.7rem; flex-wrap: wrap; align-items: stretch; margin-bottom: 0.8rem; }
.bp-top .card { margin-bottom: 0; }
.bp-stat { display: flex; flex-direction: column; gap: 3px; padding: 0.7rem 0.9rem; min-width: 190px; }
.bp-stat-k { font-size: 0.72rem; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.bp-stat-v { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.bp-stat-v small { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); }
.bp-stat .bp-mini-txt { align-self: flex-start; margin-top: 2px; }
.bp-dash { align-self: center; }
.bp-mini { padding: 0.15rem 0.4rem; font-size: 0.8rem; line-height: 1.2; }
.bp-mini-txt { padding: 0.25rem 0.6rem; font-size: 0.76rem; }
.bp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 0.7rem; }
.bp-tab { padding: 0.4rem 0.8rem; border-radius: 999px; font-size: 0.84rem; text-decoration: none; color: var(--text-secondary);
    border: 1px solid var(--border); background: var(--bg-card); white-space: nowrap; }
.bp-tab:hover { border-color: var(--accent); color: var(--text-primary); }
.bp-tab.is-on { background: var(--accent-solid); color: #ffffff; border-color: var(--accent-solid); font-weight: 600; }
.bp-tab-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--bg-page); color: var(--text-primary);
    font-size: 0.72rem; font-weight: 700; text-align: center; }
.bp-tab.is-on .bp-tab-n { background: #ffffff; color: var(--accent-solid); }
.bp-tab-n.is-bad { background: var(--danger-bg); color: var(--danger); }
.bp-card { padding: 0.8rem; }
.bp-paybar { display: flex; gap: 0.5rem 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.7rem; font-size: 0.84rem; }
.bp-paybar label { display: inline-flex; align-items: center; gap: 6px; }
.bp-paybar .btn { margin-left: auto; }
.bp-table-wrap { overflow-x: auto; }
.bp-table td { vertical-align: top; }
.bp-table .num { text-align: right; }
.bp-c-chk { width: 28px; }
.bp-nowrap { white-space: nowrap; }
.bp-c-items { min-width: 220px; max-width: 300px; }
.bp-li { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.bp-li-sub { margin-bottom: 4px; }
.bp-li-sub:last-child { margin-bottom: 0; }
.bp-table tr.is-late td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.bp-c-state { min-width: 210px; }
.bp-late { font-size: 0.74rem; color: var(--danger); margin-top: 3px; max-width: 280px; white-space: normal; font-weight: 600; }
.bp-err-s { font-size: 0.72rem; color: var(--danger); margin-top: 3px; max-width: 260px; white-space: normal; }
.bp-acts .btn { display: block; margin: 0 0 4px; white-space: nowrap; }
.bp-empty, .bp-empty-row { padding: 1.2rem; text-align: center; color: var(--text-secondary); font-size: 0.86rem; }
.bp-empty p { margin: 0 0 0.6rem; }
.bp-set-status { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.82rem; background: var(--bg-page); border-radius: 8px; padding: 0.55rem 0.8rem; margin-bottom: 0.8rem; }
.bp-set-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 0.8rem; }
.bp-set-actions form { margin: 0; }
.bp-pre { white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow: auto; font-size: 0.72rem; background: var(--bg-page); padding: 0.5rem; border-radius: 6px; color: var(--text-primary); }
@media (max-width: 768px) {
    .lightbox-overlay.bp-ov { padding: 0.4rem; align-items: stretch; }
    .bp-box { max-height: none; height: 100%; }
    .bp-grid { grid-template-columns: minmax(0, 1fr); }
    .bp-addr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .bp-box .cb-head { padding: 0.7rem 2.6rem 0.5rem 0.9rem; font-size: 0.95rem; }
    .bp-body { padding: 0.6rem 0.7rem; }
    .bp-foot { padding: 0.55rem 0.7rem; gap: 0.4rem; }
    .bp-opts > .bp-muted { display: none; }
    .bp-foot-r { margin-left: 0; width: 100%; }
    .bp-foot-r .btn { flex: 1 1 auto; }
    .bp-sum { flex-basis: 100%; }
    .bp-stat { flex: 1 1 100%; }
    .bp-paybar .btn { margin-left: 0; width: 100%; }
}

/* ---- v42: ảnh nhỏ Mockup / Design (bấm xem to) · giá label ▼▲ · điền link Design tự lưu · tự cập nhật ---- */
#lightboxOverlay { z-index: 1200; }        /* xem ảnh to nổi TRÊN khung Gửi BurgerPrints (z 1000) */
.bp-thumbs { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; margin: 5px 0 6px; }
.bp-th { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; width: 58px; padding: 0; border: none; background: none;
    color: var(--text-secondary); font: inherit; font-size: 0.66rem; line-height: 1.2; text-align: center; text-decoration: none; cursor: zoom-in; }
.bp-th > img, .bp-th > .bp-th-e { width: 58px; height: 58px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover;
    background: repeating-conic-gradient(var(--border) 0 25%, var(--bg-page) 0 50%) 0 0 / 12px 12px; }
.bp-th > .bp-th-e { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--bg-page); }
.bp-th.is-link { cursor: pointer; }
.bp-th.is-miss { cursor: default; }
.bp-th.is-miss > .bp-th-e { border: 1.5px dashed var(--warning); background: var(--warning-bg); color: var(--text-secondary); font-size: 0.64rem; }
.bp-th:hover > img { transform: scale(1.05); }
.bp-th > img { transition: transform 0.12s ease; }
.bp-th:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.bp-c-items .bp-thumbs { margin: 3px 0 5px; }
.bp-c-items .bp-th { width: 42px; font-size: 0.62rem; }
.bp-c-items .bp-th > img, .bp-c-items .bp-th > .bp-th-e { width: 42px; height: 42px; border-radius: 7px; font-size: 1.05rem; }
.bp-links-new input { font-size: 0.8rem; }
.bp-dsave { font-size: 0.74rem; margin-top: 4px; color: var(--text-secondary); line-height: 1.35; overflow-wrap: anywhere; min-height: 1.2em; }
.bp-dsave.is-ok { color: var(--success); font-weight: 700; }
.bp-dsave.is-warn { color: var(--warning); font-weight: 600; }
.bp-dsave.is-bad { color: var(--danger); font-weight: 600; }
.bp-step { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--bg-card); }
.bp-step-b { border: none; background: var(--bg-page); color: var(--text-primary); width: 34px; min-height: 30px; font-size: 0.85rem; cursor: pointer; }
.bp-step-b:hover:not(:disabled) { background: var(--accent-bg); color: var(--accent); }
.bp-step-b:disabled { color: var(--text-muted); cursor: not-allowed; }
.bp-step-b:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bp-step-v { min-width: 60px; display: flex; align-items: center; justify-content: center; font-size: 0.88rem; color: var(--text-primary); }
.bp-costline { margin-top: 6px; font-size: 0.78rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
    color: var(--text-primary); line-height: 1.45; }
.bp-cost { font-size: 0.74rem; color: var(--text-primary); margin-top: 2px; white-space: nowrap; }
.bp-auto-st { display: inline-flex; min-height: 1.2em; }
.bp-auto-st .bp-chip { white-space: normal; }
.bp-auto-note { position: fixed; z-index: 950; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center;
    max-width: calc(100vw - 32px); padding: 0.55rem 0.7rem 0.55rem 0.9rem; border-radius: 12px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-primary); font-size: 0.82rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); }
.bp-auto-x { border: none; background: none; color: var(--text-secondary); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 0.2rem; }
@media (max-width: 768px) {
    .bp-step-b { width: 42px; min-height: 40px; font-size: 1rem; }
    .bp-links-new input { font-size: 16px; min-height: 40px; }
    .bp-th { width: 52px; }
    .bp-th > img, .bp-th > .bp-th-e { width: 52px; height: 52px; }
    .bp-auto-note { left: 16px; right: 16px; transform: none; bottom: 12px; flex-wrap: wrap; }
}

/* ---- v43: gộp đơn cùng khách · nhớ lựa chọn · kiểm link Design · áo thử · kéo thả nhiều label · lãi · hạn ship ---- */
.bp-chip.merged { background: var(--success-bg); color: var(--success); }
.bp-chip.learn { background: #ede9fe; color: #5b21b6; white-space: normal; }
[data-theme="dark"] .bp-chip.learn { background: #3b2a6b; color: #ddd6fe; }
.bp-merge { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; padding: 6px 10px; border-radius: 10px;
    border: 1.5px dashed var(--success); background: var(--success-bg); color: var(--text-primary); font-size: 0.8rem; line-height: 1.45; }
.bp-merge.is-on { border-style: solid; }
.bp-merge.is-more { border-color: var(--warning); background: var(--warning-bg); }
.bp-merge > span { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.bp-dcs:empty { display: none; }
.bp-dc { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 5px; padding: 5px 9px; border-radius: 9px; font-size: 0.78rem;
    border: 1px solid var(--danger); background: var(--danger-bg); color: var(--text-primary); }
.bp-dc > span { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.bp-dc-ok { display: inline-flex; gap: 5px; align-items: center; font-weight: 700; cursor: pointer; }
.bp-dc-ok input { width: 16px; height: 16px; }
.bp-th.try { cursor: pointer; }
.bp-th.try > svg { width: 58px; height: 58px; border-radius: 8px; border: 1px solid var(--accent); background: var(--bg-card); padding: 3px; box-sizing: border-box; }
.bp-c-items .bp-th.try > svg { width: 42px; height: 42px; }
.lightbox-overlay.bp-tryon { z-index: 1200; cursor: default; padding: 1rem; }
.bp-try-box { background: var(--bg-card); color: var(--text-primary); border-radius: 16px; padding: 14px 16px 16px; width: min(720px, 100%);
    max-height: calc(100vh - 2rem); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.bp-try-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bp-try-h b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-try-h .cb-x { position: static; }
.bp-try-stage { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; background: repeating-conic-gradient(var(--border) 0 25%, var(--bg-page) 0 50%) 0 0 / 18px 18px;
    border-radius: 12px; padding: 12px; }
.bp-try-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bp-try-fig svg { max-width: 100%; height: auto; }
.bp-try-fig figcaption { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); background: var(--bg-card); padding: 1px 8px; border-radius: 999px; }
.bp-try-cap { font-size: 0.82rem; font-weight: 600; margin: 8px 0 4px; }
.bp-try-sw { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.bp-try-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.bp-try-dot.is-on { outline: 2px solid var(--accent); outline-offset: 2px; }
.bp-try-dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bp-dzw { margin: 0 0 10px; }
.bp-dz { border: 2px dashed var(--accent); border-radius: 12px; background: var(--accent-bg); color: var(--text-primary); padding: 12px 14px;
    text-align: center; font-size: 0.86rem; cursor: pointer; }
.bp-dz.is-over { border-style: solid; box-shadow: 0 0 0 3px var(--accent-bg); }
.bp-dz:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bp-dz-sum { margin: 6px 2px 0; min-height: 1.2em; }
.bp-dz-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin-top: 6px; }
.bp-dz-table th, .bp-dz-table td { text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-primary); }
.bp-dz-table th { color: var(--text-secondary); font-weight: 600; }
.bp-dz-table td:nth-child(3) { overflow-wrap: anywhere; }
.bp-dz-f { overflow-wrap: anywhere; }
.bp-dz-sel { font-size: 0.78rem; padding: 0.25rem 0.4rem; margin-top: 4px; max-width: 100%; }
/* v44: bản Label theo nước của khách (US Label / EU Label) */
.bp-region { margin: 6px 0 2px; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; }
.bp-region-tag { display: inline-block; font-weight: 700; font-size: 0.74rem; padding: 1px 8px; border-radius: 999px;
    background: var(--accent-bg); color: var(--text-primary); border: 1px solid var(--accent); }
.bp-region.is-warn { color: var(--warning); }
.bp-region.is-warn .bp-region-tag { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.bp-profit { margin-top: 6px; font-size: 0.78rem; line-height: 1.45; color: var(--text-primary); }
.bp-profit[hidden] { display: none; }
.bp-pos { color: var(--success); font-weight: 800; }
.bp-neg { color: var(--danger); font-weight: 800; }
.bp-c-profit { white-space: nowrap; }
.bp-table tr.is-loss > td { background: var(--danger-bg); }
.bp-pay-sum { font-size: 0.82rem; color: var(--text-primary); }
.bp-dd { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0 2px; padding: 5px 8px; border-radius: 9px; font-size: 0.76rem;
    border: 1.5px dashed var(--warning); background: var(--warning-bg); color: var(--text-primary); white-space: normal; }
.bp-dd.is-done { border-style: solid; border-color: var(--success); background: var(--success-bg); color: var(--success); font-weight: 700; }
.bp-dd-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 7px 10px; margin-bottom: 8px; border-radius: 10px;
    background: var(--warning-bg); color: var(--text-primary); font-size: 0.82rem; }
.ship-due { display: inline-block; margin-top: 3px; font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; text-decoration: none; }
.ship-due.is-soon { background: var(--warning-bg); color: var(--warning); }
.ship-due.is-late { background: var(--danger-bg); color: var(--danger); }

/* ---- v45: Export to buy label (file CSV mua label hàng loạt) ---- */
.btn-bl { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn-bl:hover { background: var(--accent-bg); }
.bl-done { display: inline-block; margin-top: 3px; font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px;
    white-space: nowrap; background: var(--accent-bg); color: var(--text-primary); border: 1px solid var(--accent); }
.bl-box { width: 1120px; }
.bl-from { background: var(--bg-page); border: 1px dashed var(--border); border-radius: 10px; padding: 0.5rem 0.75rem; font-size: 0.82rem; line-height: 1.5; }
.bl-from a { color: var(--accent); font-weight: 600; }
.bl-pkg { color: var(--text-secondary); }
.bl-opts { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.82rem; }
.bl-opt { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text-primary); }
.bl-opt input { width: 16px; height: 16px; }
.bl-sum { display: flex; flex-wrap: wrap; gap: 6px; }
.bl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.bl-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 760px; }
.bl-table th, .bl-table td { text-align: left; padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-primary); }
.bl-table th { color: var(--text-secondary); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.02em; background: var(--bg-page); }
.bl-table tr:last-child td { border-bottom: 0; }
.bl-table tr.is-skip td, .bl-table tr.is-bad td:not(.bl-chk) { color: var(--text-secondary); }
.bl-table .bl-ids { font-size: 0.74rem; white-space: nowrap; }
.bl-table .bl-pk { white-space: nowrap; }
.bl-chk { min-width: 220px; }
.bl-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.bl-chips .bp-chip { white-space: normal; line-height: 1.35; }
.bl-ok { background: var(--success-bg); color: var(--success); border-radius: 8px; padding: 0.55rem 0.8rem; font-size: 0.84rem; font-weight: 600; }
.bl-fname { font-size: 0.82rem; overflow-wrap: anywhere; }
#buylabel .bl-acc { border: 1px solid var(--border); border-radius: 10px; margin-top: 0.5rem; background: var(--bg-card); }
#buylabel .bl-acc > summary { cursor: pointer; padding: 0.55rem 0.8rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; }
#buylabel .bl-acc[open] > summary { border-bottom: 1px solid var(--border); }
#buylabel .bl-acc form { padding: 0.7rem 0.8rem; }
#buylabel .bl-acc-sum { color: var(--text-secondary); font-size: 0.8rem; overflow-wrap: anywhere; }
#buylabel .bl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem 0.8rem; }
#buylabel .bl-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 120px)); gap: 0.5rem 0.8rem; }
#buylabel .bl-acts { display: flex; gap: 0.5rem; margin-top: 0.7rem; flex-wrap: wrap; }
@media (max-width: 640px) {
    #buylabel .bl-grid { grid-template-columns: minmax(0, 1fr); }
    #buylabel .bl-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bl-box .bp-foot { justify-content: flex-end; }
    /* điện thoại: mỗi kiện thành 1 thẻ (không phải cuộn ngang để xem cột Kiểm tra) */
    .bl-wrap { overflow-x: visible; border: 0; }
    .bl-table { min-width: 0; }
    .bl-table thead { display: none; }
    .bl-table, .bl-table tbody, .bl-table tr, .bl-table td { display: block; width: 100%; }
    .bl-table tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 0.55rem; padding: 0.35rem 0.6rem; background: var(--bg-card); }
    .bl-table td { border: 0; padding: 0.2rem 0; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 0.5rem; }
    .bl-table td::before { content: attr(data-label); color: var(--text-secondary); font-size: 0.72rem; font-weight: 600; }
    .bl-table td.bl-n { display: none; }
    .bl-chk { min-width: 0; }
}
.bp-table .ship-due { white-space: normal; }
.ship-due-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 0.7rem; }
.ship-chip { font-size: 0.8rem; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-primary); text-decoration: none; }
.ship-chip.is-soon { border-color: var(--warning); }
.ship-chip.is-late { border-color: var(--danger); }
.ship-chip.is-on { font-weight: 700; box-shadow: inset 0 0 0 1px currentColor; }
.ship-chip.is-soon.is-on { background: var(--warning-bg); }
.ship-chip.is-late.is-on { background: var(--danger-bg); }
.ship-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ship-due-banner { border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 1rem; font-size: 0.85rem; background: var(--warning-bg); color: var(--text-primary); }
.ship-due-banner.is-late { background: var(--danger-bg); }
.ship-due-banner a { color: var(--accent); text-decoration: underline; margin-left: 6px; }
.t17-set { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px dashed var(--border); }
.t17-h { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.t17-p { font-size: 0.8rem; color: var(--text-secondary); margin: 0.4rem 0 0.7rem; line-height: 1.5; }
.t17-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.t17-form input[type="password"] { flex: 1 1 240px; min-width: 0; }
.t17-on, .t17-del { display: inline-flex; gap: 6px; align-items: center; font-size: 0.85rem; }
.t17-on input, .t17-del input { width: auto; }
.t17-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 0.6rem; }
.t17-acts form { margin: 0; }
.t17-last { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.6rem; }
@media (max-width: 768px) {
    .bp-dc-ok input { width: 20px; height: 20px; }
    .bp-merge .btn, .bp-dc .btn, .bp-dd .btn { min-height: 36px; }
    .bp-th.try > svg { width: 52px; height: 52px; }
    .bp-dz-table thead { display: none; }
    .bp-dz-table tr { display: block; border-bottom: 1px solid var(--border); padding: 4px 0; }
    .bp-dz-table td { display: block; border: none; padding: 2px 4px; }
    .bp-dz-sel { font-size: 16px; min-height: 38px; width: 100%; }
    .t17-form input[type="password"] { font-size: 16px; }
}

/* =========================================================================================
   v38 — GIAO DIỆN KÍNH  (html[data-theme="dark"][data-skin="glass"])
   Dùng lại TOÀN BỘ màu chữ/nền tối đã đo tương phản (data-theme="dark"), chỉ thêm:
     - nền "đá vỡ" xám tự vẽ (static/img/glass-bg.svg, có phủ 1 lớp tối 35% cho chữ luôn đọc rõ)
     - thẻ (.card) + thanh bên là kính mờ (nền trong 62% + làm mờ phía sau)
     - màu nhấn cam đỏ: nút chính nền #c93b1b (chữ trắng 5,1:1), chữ nhấn #ffa184
   --bg-card vẫn là màu ĐẶC: dùng cho hộp thoại, menu nổi, ô ghim cột của bảng — các chỗ này mà
   trong suốt thì chữ của lớp bên dưới lộ ra, không đọc được.
   Điện thoại / máy bật "giảm hiệu ứng trong suốt": tắt làm mờ (đỡ giật khi cuộn), nền thẻ đặc hơn.
   ========================================================================================= */
[data-skin="glass"] {
    --bg-page: rgba(255, 255, 255, 0.045);
    --bg-card: #16171c;
    --border: rgba(255, 255, 255, 0.10);
    --text-muted: #a7aab5;
    --accent: #ffa184;
    --accent-bg: rgba(217, 65, 31, 0.16);
    --accent-solid: #c93b1b;
    --glass: rgba(22, 23, 28, 0.62);
    --glass-line: rgba(255, 255, 255, 0.10);
    --ov-ring: #17181d;
    --ov-grid: rgba(255, 255, 255, 0.07);
    --ov-prev: #6b6f7b;
    --ov-fee: rgba(255, 255, 255, 0.16);
    --ov-area-top: 0.34;
    color-scheme: dark;
    background: #0b0c0f;
}
[data-skin="glass"] body { background: transparent; }
[data-skin="glass"] body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(rgba(11, 12, 15, 0.35), rgba(11, 12, 15, 0.35)),
                #0b0c0f url("/static/img/glass-bg.svg") center / cover no-repeat;
}
[data-skin="glass"] .card,
[data-skin="glass"] .sidebar {
    background: var(--glass);
    border-color: var(--glass-line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 40px rgba(0, 0, 0, 0.38);
    -webkit-backdrop-filter: blur(16px) saturate(125%);
    backdrop-filter: blur(16px) saturate(125%);
}
[data-skin="glass"] .card { border-radius: 16px; }
/* Thẻ kính tạo "lớp" riêng → danh sách gợi ý / menu xổ xuống bên trong (VD chọn dịch vụ ở Quản lý Phone)
   có thể bị thẻ phía sau đè lên. Khi đang thao tác trong thẻ nào thì đưa thẻ đó lên trên. */
[data-skin="glass"] .card:focus-within { position: relative; z-index: 5; }
@media (min-width: 769px) {
    [data-skin="glass"] .app-shell { padding: 12px 0 12px 12px; }
    [data-skin="glass"] .sidebar { top: 12px; height: calc(100vh - 24px); border: 1px solid var(--glass-line); border-radius: 18px; }
    [data-skin="glass"] .main-content { padding-top: calc(1.4rem - 12px); }
}
[data-skin="glass"] .sidebar-toggle-btn { background: #1d1e24; border-color: var(--glass-line); }
[data-skin="glass"] .sidebar-lang, [data-skin="glass"] .user-card { background: rgba(255, 255, 255, 0.05); }
[data-skin="glass"] .sidebar-lang button.active { background: rgba(255, 255, 255, 0.10); }
[data-skin="glass"] .btn-logout { background: rgba(0, 0, 0, 0.22); border-color: var(--glass-line); }
[data-skin="glass"] .btn-logout:hover { background: rgba(255, 255, 255, 0.07); }
[data-skin="glass"] .nav-item:hover { background: rgba(255, 255, 255, 0.06); }
[data-skin="glass"] .nav-item.active { background: rgba(255, 255, 255, 0.085); color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13); border-left-color: transparent; }
[data-skin="glass"] .nav-item.active i { color: var(--accent); }
[data-skin="glass"] .theme-switch { background: rgba(0, 0, 0, 0.28); border-color: var(--glass-line); }
[data-skin="glass"] .theme-switch button.is-on { background: rgba(255, 255, 255, 0.10); }
[data-skin="glass"] .nav-badge { background: rgba(217, 65, 31, 0.22); color: var(--accent); }
[data-skin="glass"] .nav-badge.is-live { background: var(--success-bg); color: var(--success); }

[data-skin="glass"] .btn { background: rgba(0, 0, 0, 0.26); border-color: rgba(255, 255, 255, 0.12); }
[data-skin="glass"] .btn:hover { background: rgba(255, 255, 255, 0.08); }
[data-skin="glass"] .btn-primary { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; box-shadow: 0 8px 22px rgba(217, 65, 31, 0.30); }
[data-skin="glass"] .btn-primary:hover { background: #b8341a; }
[data-skin="glass"] input[type="text"], [data-skin="glass"] input[type="email"], [data-skin="glass"] input[type="search"],
[data-skin="glass"] input[type="password"], [data-skin="glass"] input[type="number"], [data-skin="glass"] input[type="date"],
[data-skin="glass"] input[type="month"], [data-skin="glass"] input[type="time"], [data-skin="glass"] select, [data-skin="glass"] textarea {
    background-color: rgba(0, 0, 0, 0.28); border-color: rgba(255, 255, 255, 0.12);
}
[data-skin="glass"] option, [data-skin="glass"] optgroup { background: #16171c; color: var(--text-primary); }
/* Chữ nằm thẳng trên nền (ngoài thẻ): thêm bóng mờ để không lẫn vào mảnh kính sáng */
[data-skin="glass"] .main-content > .page-header,
[data-skin="glass"] .main-content > .ov-section { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
[data-skin="glass"] .ov-period, [data-skin="glass"] .ov-tabs { background: rgba(0, 0, 0, 0.30); border-color: var(--glass-line); text-shadow: none; }
[data-skin="glass"] .ov-period a.is-on, [data-skin="glass"] .ov-period select.is-on,
[data-skin="glass"] .ov-tab.is-on { background: rgba(255, 255, 255, 0.10); color: var(--text-primary); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
[data-skin="glass"] .ov-insight { background: var(--glass); border: 1px solid var(--glass-line);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
[data-skin="glass"] .ov-insight > i { color: #fbbf24; }
[data-skin="glass"] .ov-tile { transition: transform 0.18s, border-color 0.18s; }
[data-skin="glass"] .ov-tile:hover { transform: translateY(-3px); }
[data-skin="glass"] .ov-tile.is-on { border-color: rgba(57, 135, 229, 0.55); }
[data-skin="glass"] .ov-line-cur { filter: drop-shadow(0 0 4px rgba(57, 135, 229, 0.55)); }
[data-skin="glass"] .ov-tip { background: rgba(12, 13, 16, 0.94); border-color: rgba(255, 255, 255, 0.16); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
[data-skin="glass"] .ov-pop { background: rgba(20, 21, 26, 0.97); border-color: rgba(255, 255, 255, 0.14); }
[data-skin="glass"] .ov-chip.is-on { background: rgba(255, 255, 255, 0.09); color: var(--text-primary); border-color: rgba(255, 255, 255, 0.16); }
[data-skin="glass"] .ov-holiday.is-soon { border-color: rgba(245, 184, 74, 0.45); }

@media (max-width: 768px) {
    [data-skin="glass"] .card, [data-skin="glass"] .sidebar, [data-skin="glass"] .ov-insight {
        -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(20, 21, 26, 0.86);
    }
    [data-skin="glass"] .sidebar { border-radius: 0 0 16px 16px; border-bottom: 1px solid var(--glass-line); }
}
@media (prefers-reduced-transparency: reduce) {
    [data-skin="glass"] .card, [data-skin="glass"] .sidebar, [data-skin="glass"] .ov-insight {
        -webkit-backdrop-filter: none; backdrop-filter: none; background: #17181d;
    }
}
@media print {
    [data-skin="glass"] { background: #fff; --bg-card: #fff; --bg-page: #fff; --border: #ccc; --glass: #fff; --accent: #000; }
    [data-skin="glass"] body::before { display: none; }
    [data-skin="glass"] .card, [data-skin="glass"] .sidebar, [data-skin="glass"] .ov-insight { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
    [data-skin="glass"] .main-content > .page-header, [data-skin="glass"] .main-content > .ov-section { text-shadow: none; }
}

/* ---- v47: Danh sách đơn hàng — thanh thao tác 1 hàng (chung hàng ⚙️ Columns), Cancel, cột kéo thu/phóng ---- */
.order-bar { display: flex; align-items: center; gap: 8px; height: 46px; margin-bottom: 0.5rem; position: relative;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); padding: 0 6px 0 10px; }
.order-bar.has-sel { background: var(--accent-bg); border-color: var(--accent); }
.order-bar .selection-bar { display: flex; flex: 1 1 auto; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; background: transparent;
    flex-wrap: nowrap; align-items: center; gap: 10px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; border-radius: 0; }
.order-bar .selection-bar .ob-hint { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.order-bar .selection-bar .ob-sum, .order-bar .selection-bar .actions { display: none; }
.order-bar .selection-bar.show .ob-hint { display: none; }
.order-bar .selection-bar.show .ob-sum { display: inline; white-space: nowrap; font-size: 0.8rem; }
.order-bar .selection-bar.show .actions { display: flex; flex-wrap: nowrap; gap: 5px; }
.order-bar .selection-bar .actions .btn { font-size: 0.76rem; padding: 0.3rem 0.55rem; white-space: nowrap; }
.order-bar .ob-cols { flex: 0 0 auto; position: relative; }
.order-bar .ob-cols > .btn { font-size: 0.78rem; padding: 0.3rem 0.6rem; white-space: nowrap; }
.btn-cancel { color: var(--danger); border-color: var(--danger); font-weight: 700; }
.btn-cancel:hover { background: var(--danger-bg); }
.ctx-item.ctx-cancel { font-weight: 700; }
@media (max-width: 768px) {
    .order-bar .selection-bar .ob-hint { font-size: 0.74rem; }
}

/* đơn Cancel (Hoàn/Huỷ): mờ + gạch ngang, vẫn hiện trong danh sách (nhãn badge không bị gạch vì là inline-block) */
#ordersTable tbody tr[data-row-status="cancelled"] td { color: var(--text-muted); text-decoration: line-through; }

/* ảnh Mockup + nhãn hạn ship gọn (⚠️ Trễ / ⏰ Hôm nay) */
#ordersTable .mk-cell { display: flex; align-items: center; gap: 4px; }
.due-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 0.66rem; font-weight: 800; line-height: 16px; height: 16px;
    padding: 0 6px; border-radius: 999px; white-space: nowrap; text-decoration: none; }
.due-chip.is-late { background: var(--danger-bg); color: var(--danger); }
.due-chip.is-soon { background: var(--warning-bg); color: var(--warning); }
.due-chip:hover { text-decoration: underline; }

/* Status gồm Xưởng BP (badge BP + link tracking nằm cùng ô Status) */
#ordersTable td[data-col="status"] .bp-badge { font-size: 0.66rem; padding: 0 6px; line-height: 16px; vertical-align: middle; }
#ordersTable td[data-col="status"] .bp-track { font-size: 0.68rem; }
#ordersTable td[data-col="status"] .bl-done { margin-top: 0; font-size: 0.66rem; line-height: 14px; vertical-align: middle; }

/* cột kéo thu / phóng: bảng cố định độ rộng, chữ dài cắt "…" */
#ordersTable.cols-fixed { table-layout: fixed; }
#ordersTable.cols-fixed th, #ordersTable.cols-fixed td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ordersTable.cols-fixed td.cell-clamp { max-width: none !important; }
#ordersTable.cols-fixed th.col-resizing { background: var(--accent-bg); }
#ordersTable .col-resize-handle { width: 7px; z-index: 6; }
#ordersTable .col-resize-handle:hover, #ordersTable th.col-resizing .col-resize-handle { background: var(--accent); opacity: 0.55; }
#ordersTable.cols-fixed td[data-col="design"]:has(.dh-box) { white-space: normal; }
#ordersTable.cols-fixed th { box-sizing: border-box; }
/* còn nút bị che bên phải → mép phải mờ dần + mũi tên gợi ý cuộn (lăn chuột trên thanh để cuộn ngang) */
.order-bar.more-right .ob-cols::before { content: "›"; position: absolute; right: calc(100% + 2px); top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: flex-end; padding-right: 4px; pointer-events: none;
    font-size: 1.1rem; font-weight: 800; color: var(--accent);
    background: linear-gradient(90deg, transparent, var(--accent-bg) 70%); }
/* v48: kích thước kiện theo từng mẫu áo (Cài đặt → Mua label) */
#buylabel .bl-pkg-wrap { overflow-x: auto; }
#buylabel .bl-pkg-table { border-collapse: collapse; font-size: 0.82rem; min-width: 520px; }
#buylabel .bl-pkg-table th, #buylabel .bl-pkg-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; }
#buylabel .bl-pkg-table thead th { color: var(--text-secondary); font-weight: 600; font-size: 0.74rem; }
#buylabel .bl-pkg-table tbody th { font-weight: 600; white-space: nowrap; }
#buylabel .bl-pkg-table input { width: 84px; padding: 0.3rem 0.45rem; }
/* v48: Thư viện Design — tự lưu + mẫu lệch file */
.dl-auto { background: var(--success-bg); color: var(--text-primary); border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.82rem; margin-bottom: 1rem; line-height: 1.5; }
.dl-conf-card { border-color: var(--warning); }
.dl-conf { border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; margin-top: 0.6rem; background: var(--bg-card); }
.dl-conf-t { font-size: 0.86rem; margin-bottom: 0.4rem; }
.dl-muted { color: var(--text-secondary); font-size: 0.76rem; }
.dl-opts { display: flex; flex-direction: column; gap: 6px; }
.dl-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--bg-page); }
.dl-thumbs { display: flex; gap: 4px; }
.dl-th { position: relative; width: 52px; height: 52px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; display: inline-flex;
    align-items: center; justify-content: center; background: repeating-conic-gradient(#cfd4dc 0 25%, #f4f5f7 0 50%) 0 0/10px 10px; text-decoration: none; }
.dl-th img { width: 100%; height: 100%; object-fit: contain; }
.dl-th span { position: absolute; right: 2px; bottom: 1px; font-size: 0.62rem; font-weight: 800; color: #fff; background: rgba(0, 0, 0, 0.55); border-radius: 4px; padding: 0 3px; }
.dl-info { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; min-width: 0; }
.dl-link { overflow-wrap: anywhere; }
.dl-tag { align-self: flex-start; font-size: 0.68rem; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--accent-bg); color: var(--text-primary); border: 1px solid var(--accent); }
.dl-skip { margin-top: 6px; }
.dl-skip .btn { font-size: 0.76rem; }
@media (max-width: 640px) { .dl-opt { grid-template-columns: auto minmax(0, 1fr); } .dl-opt form { grid-column: 1 / -1; } }

/* ---- v48: Danh sách — 1 hàng: tiêu đề · tìm · Filter ▾ · Hôm nay/Hôm qua · Tìm · nhãn hạn ship · công cụ ---- */
.ds-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 0.7rem; }
.ds-bar .ds-title { margin: 0 6px 0 0; font-size: 1rem; line-height: 1.2; font-weight: 800; white-space: nowrap; color: var(--text-primary); }
.ds-bar .ds-search { flex: 1 1 220px; min-width: 160px; width: auto; }
.ds-bar > .btn, .ds-bar .ds-fbtn { white-space: nowrap; font-size: 0.8rem; line-height: 1.2; padding: 0.4rem 0.62rem; }
.ds-bar .ds-sp { flex: 0 0 4px; }
.ds-filter { position: relative; }
.ds-fbtn.is-on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.ds-fbtn b { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent-solid, var(--accent)); color: #fff; font-size: 0.7rem; line-height: 16px; text-align: center; }
.ds-fpanel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: min(640px, 92vw); background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16); padding: 12px; }
.ds-fgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.ds-fgrid label { display: flex; flex-direction: column; gap: 3px; font-size: 0.74rem; font-weight: 600; color: var(--text-secondary); }
.ds-fgrid select, .ds-fgrid input { width: 100%; min-width: 0; font-size: 0.8rem; padding: 0.35rem 0.45rem; }
.ds-fgrid .is-on { border-color: var(--accent); background: var(--accent-bg); color: var(--text-primary); }
.ds-ffoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.74rem; color: var(--text-secondary); flex-wrap: wrap; }
.ds-ffoot .btn { font-size: 0.78rem; }
.ds-clear { padding: 0.42rem 0.55rem !important; }
.ds-chips { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.ds-chips .ship-chip { font-size: 0.74rem; padding: 3px 9px; white-space: nowrap; }
@media (max-width: 1280px) { .ds-bar { flex-wrap: wrap; } .ds-chips { flex-wrap: wrap; } }
@media (max-width: 640px) { .ds-fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ds-bar .ds-search { flex-basis: 100%; } }

/* ---- v48: ô Status = bước mới nhất của timeline (BP / tracking) — rê chuột xem full ---- */
#ordersTable .tl-badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap;
    font-size: 0.68rem; font-weight: 700; line-height: 18px; height: 18px; padding: 0 7px; border-radius: 999px; text-decoration: none; cursor: help; }
#ordersTable .tl-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-del { background: var(--success-bg); color: var(--success); }
.tl-ofd { background: color-mix(in srgb, var(--success) 14%, var(--bg-card)); color: var(--success); }
.tl-tr { background: var(--accent-bg); color: var(--accent); }
.tl-pr { background: color-mix(in srgb, var(--accent) 9%, var(--bg-card)); color: var(--text-primary); }
.tl-wait { background: var(--warning-bg); color: var(--warning); }
.tl-bad { background: var(--danger-bg); color: var(--danger); }
#ordersTable .tl-date { font-size: 0.66rem; color: var(--text-muted); margin-left: 3px; vertical-align: middle; }
/* bảng timeline khi rê chuột: rộng hơn, cuộn được, rê vào bảng không bị tắt */
.fedex-popup { width: 380px; max-height: 420px; }
.tlp-h { font-weight: 700; margin-bottom: 6px; font-size: 0.8rem; }
.tlp-i { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.tlp-i:last-child { border-bottom: 0; }
.tlp-d { color: var(--text-muted); font-size: 0.7rem; line-height: 1.35; }
.tlp-s { font-weight: 700; font-size: 0.78rem; }
.tlp-i:first-of-type .tlp-s { color: var(--success); }
.tlp-x { color: var(--text-secondary); font-size: 0.72rem; line-height: 1.4; overflow-wrap: anywhere; }
.tlp-l { color: var(--text-secondary); font-size: 0.72rem; }
.tlp-x { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-muted); font-size: 0.7rem; }


/* ===== v49: địa chỉ · cảnh báo tracking · hạn khiếu nại · lợi nhuận thực · payout · thời gian xưởng ===== */
.ship-chip.is-ice { border-color: #0284c7; }
.ship-chip.is-lech { border-color: #7c3aed; }
.ship-chip.is-addr { border-color: #c2410c; }
.ship-chip.is-ice.is-on { background: #e0f2fe; color: #075985; }
.ship-chip.is-lech.is-on { background: #ede9fe; color: #5b21b6; }
.ship-chip.is-addr.is-on { background: #ffedd5; color: #9a3412; }
[data-theme="dark"] .ship-chip.is-ice.is-on { background: rgba(14, 165, 233, 0.18); color: #7dd3fc; }
[data-theme="dark"] .ship-chip.is-lech.is-on { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
[data-theme="dark"] .ship-chip.is-addr.is-on { background: rgba(234, 88, 12, 0.2); color: #fdba74; }
#ordersTable td[data-col="client_name"] .ab { display: block; width: max-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ab { display: inline-block; margin-top: 2px; font-size: 0.66rem; font-weight: 700; line-height: 16px; padding: 0 6px; border-radius: 6px; white-space: nowrap; }
.a-ok { background: var(--success-bg); color: var(--success); }
.a-ack { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }
.a-warn { background: var(--warning-bg); color: var(--warning); }
.a-bad { background: var(--danger-bg); color: var(--danger); }
#ordersTable .tf, .ap-flags .tf { display: block; width: max-content; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-top: 3px; font-size: 0.66rem; font-weight: 700; line-height: 17px; padding: 0 7px; border-radius: 999px; cursor: help; }
.ap-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ap-flags .tf { display: inline-block; margin-top: 0; }
.tf-bad { background: var(--danger-bg); color: var(--danger); }
.tf-warn { background: var(--warning-bg); color: var(--warning); }
.tf-ice { background: #e0f2fe; color: #075985; }
[data-theme="dark"] .tf-ice { background: rgba(14, 165, 233, 0.18); color: #7dd3fc; }
.tf-claim { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }
.tf-claim.tf-closed { opacity: 1; color: var(--text-muted); }
.pf-tag { display: inline-block; font-size: 0.6rem; font-weight: 800; line-height: 15px; padding: 0 4px; border-radius: 4px; margin-right: 4px; vertical-align: 1px; }
.pf-real { background: var(--success-bg); color: var(--success); cursor: help; }
.pf-real:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pf-est { background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }
.pf-pop { position: fixed; z-index: 400; width: 350px; max-width: 92vw; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18); padding: 10px 12px; font-size: 0.76rem; display: none; }
.pf-pop.show { display: block; }
.pf-h { font-weight: 700; margin-bottom: 6px; }
.pf-ln { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.pf-ln i { color: var(--text-muted); font-style: normal; }
.pf-sum { font-weight: 700; }
.pf-tot { border-bottom: 0; border-top: 2px solid var(--border); margin-top: 3px; padding-top: 6px; font-weight: 800; }
.pf-tot b { color: var(--success); }
.pf-neg { color: var(--danger); }
.pf-pos { color: var(--text-primary); }
.pf-mut { color: var(--text-muted); }
.pf-note { margin-top: 6px; color: var(--text-secondary); font-size: 0.7rem; }
.pay-sub { display: block; margin-top: 3px; font-size: 0.66rem; color: var(--text-secondary); white-space: nowrap; }
.pay-hold { color: var(--warning); font-weight: 700; }
/* Sửa đơn — khung kiểm tra địa chỉ */
.addr-panel { margin-top: 0.6rem; border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.8rem; background: var(--bg-card); }
.addr-panel.ap-bad { border-color: var(--danger); }
.addr-panel.ap-warn { border-color: var(--warning); }
.addr-panel.ap-ok, .addr-panel.ap-ack { border-color: var(--success); }
.ap-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ap-src { color: var(--text-muted); font-size: 0.72rem; margin-left: auto; }
.ap-iss { margin-top: 4px; }
.ap-iss.ap-bad { color: var(--danger); font-weight: 600; }
.ap-iss.ap-warn { color: var(--warning); font-weight: 600; }
.ap-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.ap-cmp > div { border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; line-height: 1.5; }
.ap-cmp > div.u { border-color: var(--success); background: var(--success-bg); }
.ap-cmp h5 { margin: 0 0 3px; font-size: 0.72rem; color: var(--text-secondary); }
.ap-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ap-btns .btn { font-size: 0.76rem; padding: 0.3rem 0.6rem; }
.ap-msg { margin-top: 5px; font-size: 0.76rem; color: var(--text-secondary); min-height: 1em; }
@media (max-width: 640px) { .ap-cmp { grid-template-columns: 1fr; } }
/* khung gửi BurgerPrints */
.bp-addr-chk { margin-top: 6px; font-size: 0.76rem; border-radius: 8px; padding: 5px 8px; display: flex; flex-direction: column; gap: 4px; }
.bp-addr-chk.is-bad { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.bp-addr-chk.is-warn { background: var(--warning-bg); color: var(--warning); font-weight: 600; }
.bp-addr-chk.is-ok { background: var(--success-bg); color: var(--success); font-weight: 600; }
.bp-addr-chk.is-muted { background: var(--bg-page); color: var(--text-secondary); }
.bp-addr-ok { color: var(--text-primary); font-weight: 600; display: flex; gap: 6px; align-items: center; }
/* Đối chiếu — Transaction report */
.tx-sub { font-size: 0.74rem; font-weight: 500; color: var(--text-secondary); margin-left: 6px; }
.tx-up { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.tx-drop { flex: 1 1 340px; display: flex; flex-direction: column; gap: 4px; border: 2px dashed var(--border); border-radius: 10px; padding: 8px 10px;
    font-size: 0.78rem; color: var(--text-secondary); cursor: pointer; }
.tx-drop input { font-size: 0.8rem; }
.tx-results { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.tx-metrics { margin-top: 0.8rem; }
.tx-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 0.6rem; }
.tx-h { font-weight: 700; font-size: 0.82rem; margin-bottom: 4px; }
.tx-tbl { font-size: 0.78rem; }
.tx-st { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: 0.72rem; font-weight: 700; line-height: 18px; }
.tx-warn { background: var(--warning-bg); color: var(--warning); }
.tx-bad { background: var(--danger-bg); color: var(--danger); }
.tx-empty, .tx-note, .tx-files { font-size: 0.78rem; color: var(--text-secondary); margin-top: 6px; line-height: 1.55; }
.tx-files span { cursor: help; }
@media (max-width: 900px) { .tx-two { grid-template-columns: 1fr; } }
/* Báo cáo — thời gian xưởng */
.fs-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fs-days { margin-left: auto; display: flex; gap: 4px; }
.fs-days .btn { font-size: 0.72rem; padding: 0.2rem 0.5rem; }
.fs-tbl { font-size: 0.8rem; }
.fs-bar { display: inline-block; height: 10px; border-radius: 3px; background: var(--accent); vertical-align: middle; }
.fs-bar2 { background: #94a3b8; }
.fs-sub td { font-size: 0.74rem; color: var(--text-secondary); background: var(--bg-page); }
.fs-wk { display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 34px; margin: 0 3px; vertical-align: middle; cursor: help; }
.fs-wkb { width: 14px; background: var(--accent); border-radius: 3px 3px 0 0; }
.fs-wkl { font-size: 0.6rem; color: var(--text-muted); line-height: 10px; }
.fs-slow { margin-top: 8px; font-size: 0.8rem; }
.fs-slow a { color: var(--accent); }
/* Cài đặt — USPS */
.usps-form { display: flex; flex-direction: column; gap: 8px; }
.usps-keys { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.usps-keys input { flex: 1 1 220px; }
.usps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 0.8rem; }
.usps-grid label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.usps-n { width: 70px !important; min-width: 0 !important; padding: 0.2rem 0.4rem !important; }
.usps-form > .btn { align-self: flex-start; }
@media (max-width: 760px) { .usps-grid { grid-template-columns: 1fr; } }

/* v49: dấu ✓ nhỏ trước địa chỉ đã đúng (USPS) / đã xem — không thêm dòng */
.ab-i { font-weight: 800; font-size: 0.72rem; cursor: help; }
.ab-i.a-ok { color: var(--success); background: none; }
.ab-i.a-ack { color: var(--text-muted); background: none; border: 0; }
/* thanh 1 hàng: màn chưa đủ rộng → 3 nhãn mới chỉ còn biểu tượng + số (rê chuột xem chữ); thiếu chỗ thì xuống hàng, không che nút */
@media (max-width: 1750px) { .ds-chips .ship-chip.is-ice .cl, .ds-chips .ship-chip.is-lech .cl, .ds-chips .ship-chip.is-addr .cl { display: none; } }
.usps-keys .t17-del { white-space: nowrap; }

/* ===== v50: tô màu dòng theo Status / trạng thái BurgerPrints ===== */
#ordersTable .tl-badge.tl-bpc { color: var(--bdyn-fg); background: var(--bdyn-bg); }
[data-theme="dark"] #ordersTable .tl-badge.tl-bpc { color: var(--bdyn-fg-d); background: var(--bdyn-bg-d); }
.rowc-set { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px dashed var(--border); font-size: 0.8rem; }
.rowc-h { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.rowc-seg { display: inline-flex; gap: 8px; align-items: center; color: var(--text-secondary); }
.rowc-seg label { color: var(--text-primary); display: inline-flex; gap: 3px; align-items: center; }
.rowc-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; }
.rowc-cap { font-weight: 700; margin-bottom: 4px; }
.rowc-cap span { font-weight: 400; color: var(--text-muted); font-size: 0.74rem; }
.rowc-row { display: grid; grid-template-columns: 30px 150px 84px minmax(0, 1fr); gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.rowc-sw { width: 26px; height: 20px; border-radius: 5px; border: 1px solid var(--border); }
.rowc-pick { width: 30px !important; height: 24px !important; padding: 1px !important; min-width: 0 !important; }
.rowc-prev { border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; color: var(--text-secondary); }
.rowc-desc { color: var(--text-muted); font-size: 0.72rem; overflow-wrap: anywhere; }
.rowc-note { font-size: 0.76rem; color: var(--text-secondary); margin: 8px 0 0; line-height: 1.55; }
@media (max-width: 900px) { .rowc-grid { grid-template-columns: 1fr; } .rowc-row { grid-template-columns: 30px 1fr 80px; } .rowc-row .rowc-desc, .rowc-row .rowc-prev { grid-column: 2 / -1; } }

/* ===== v51: tracking USPS 94055… tự sửa thành 94019… ===== */
.tfx { display: inline-block; margin-right: 4px; width: 15px; height: 15px; font-size: 0.68rem; font-weight: 900; line-height: 15px; text-align: center; border-radius: 999px;
    background: #0369a1; color: #fff; white-space: nowrap; cursor: help; vertical-align: 0; }
[data-theme="dark"] .tfx { background: #38bdf8; color: #0c1a24; }
.tfx-hint { margin-top: 6px; font-size: 0.78rem; line-height: 1.5; color: #075985; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: 6px 10px; overflow-wrap: anywhere; }
[data-theme="dark"] .tfx-hint { color: #bae6fd; background: rgba(14, 165, 233, 0.12); border-color: rgba(14, 165, 233, 0.35); }
.tfx-hint .muted { color: var(--text-muted); }
.ds-ffoot .tfx-link { font-weight: 700; color: var(--text-primary); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; }
.ds-ffoot .tfx-link:hover { border-color: var(--accent); color: var(--accent); }
.ship-chip.is-tfx { background: #e0f2fe; color: #075985; border-color: #7dd3fc; }
[data-theme="dark"] .ship-chip.is-tfx { background: rgba(14, 165, 233, 0.18); color: #7dd3fc; border-color: rgba(14, 165, 233, 0.45); }

/* v124: đơn Hoàn/Huỷ — ô Lợi nhuận KHÔNG gạch ngang; số âm (lỗ Cost khi đã đi đơn) tô đỏ */
#ordersTable tbody tr[data-row-status="cancelled"] td[data-col="profit"] { text-decoration: none; }
#ordersTable td[data-col="profit"] .pf-neg { color: var(--danger, #b91c1c); font-weight: 700; }

/* v125: đơn xưởng từ chối / huỷ → ✋ Đi tay */
.fx-go { margin-left: 4px; border: 1px dashed var(--danger, #b91c1c); background: transparent; color: var(--danger, #b91c1c); border-radius: 999px; padding: 1px 8px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.fx-go:hover { background: var(--danger-bg, #fde8e8); }
.fx-man { margin-left: 4px; display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; background: var(--bg-page, #f2ede3); color: var(--text-secondary, #6b6358); }

/* v126: tiền hoàn / case của đơn (Transaction report) */
.tx-rf { margin-left: 4px; display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; background: var(--danger-bg, #fde8e8); color: var(--danger, #b91c1c); cursor: help; }

/* v126: đơn đã xuất file upload tracking eBay */
.tk-up{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:#16a34a;color:#fff;margin-right:4px;vertical-align:-3px;font-size:11px;cursor:help}
.tk-up .ti{font-weight:900}
[data-theme="dark"] .tk-up{background:#22c55e;color:#052e16}

/* v126: cảnh báo đơn trên chuông */
.top-bell{position:relative}
.al-dot{position:absolute;top:-3px;right:-5px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:#dc2626;color:#fff;font-size:10.5px;font-weight:800;line-height:17px;text-align:center;box-shadow:0 0 0 2px var(--bg-page,#fff);pointer-events:none}
.al-dot[hidden]{display:none}
.al-box{border-bottom:1px solid var(--border,#eee);padding:8px 12px 10px;max-height:46vh;overflow:auto}
.al-box[hidden]{display:none}
.al-h{font-size:13px;margin-bottom:6px}
.al-chips{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:6px}
.al-chip{font-size:11px;font-weight:700;border-radius:6px;padding:1px 6px;background:var(--bg-page,#f3efe6)}
.al-chip.k-late,.al-chip.k-rel{background:#fee2e2;color:#991b1b}.al-chip.k-soon,.al-chip.k-unsent{background:#fef3c7;color:#92400e}
.al-chip.k-big,.al-chip.k-rep{background:#dcfce7;color:#166534}
.al-it{display:flex;gap:8px;align-items:flex-start;padding:6px 4px;border-radius:8px;text-decoration:none;color:inherit}
.al-it:hover{background:var(--bg-page,#f6f2ea)}
.al-ic{flex:none;width:20px;text-align:center}.al-tx{min-width:0;display:flex;flex-direction:column}
.al-tx b{font-size:12.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.al-tx small{font-size:11.5px;color:var(--text-muted,#8a8378)}
.al-more{margin-top:4px;background:none;border:0;color:var(--accent,#2563eb);font:inherit;font-size:12.5px;cursor:pointer;padding:4px}
[data-theme="dark"] .al-chip.k-late,[data-theme="dark"] .al-chip.k-rel{background:#7f1d1d;color:#fecaca}
[data-theme="dark"] .al-chip.k-soon,[data-theme="dark"] .al-chip.k-unsent{background:#78350f;color:#fde68a}
[data-theme="dark"] .al-chip.k-big,[data-theme="dark"] .al-chip.k-rep{background:#14532d;color:#bbf7d0}
/* v137: tải label theo mã đơn */
.bp-dz-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bp-dz-zip { border: 1px solid var(--border); background: var(--bg-card); color: inherit; border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; margin-top: 6px; }
.bp-dz-zip:hover { background: var(--bg-page); }
