/* =====================================================================
   BÀN GIAO CA (SHIFT HANDOVER) — Shift Handover UI
   ---------------------------------------------------------------------
   Dùng CHUNG biến theme của app (--ghz-*) nên tự đổi màu theo theme
   đang chọn (22 theme: classic / pastel / dark / MCU / neumorphism...).
   Theme 'classic' KHÔNG khai báo --ghz-* → mọi rule có fallback để
   giao diện vẫn đúng (nền tối, viền xám, chữ trắng).

   Nguyên tắc:
   - Không hardcode màu nền/chữ. Chỉ dùng token + fallback.
   - Màu nhận diện 4 khoản tiền dùng "adaptive hue": trộn hue cố định
     với --sh-text ⇒ tự sáng/tự tối theo nền của theme (light theme ra
     màu đậm, dark theme ra màu sáng) → luôn đủ contrast.
   - Mobile-first: base = mobile, @media min-width mở rộng lên desktop.
   ===================================================================== */

/* ============ SCOPE + TOKEN DERIVED ============ */
.ghz-shift {
    /* Brand / accent */
    --sh-accent: var(--ghz-brand-color, #00c37a);
    --sh-accent-soft: color-mix(in srgb, var(--sh-accent) 12%, transparent);
    --sh-accent-soft-2: color-mix(in srgb, var(--sh-accent) 20%, transparent);

    /* Surfaces
       LƯU Ý: --ghz-card-bg có thể là GRADIENT (theme pastel) hoặc rgba (theme tối)
       ⇒ chỉ dùng được cho `background:`.
       --ghz-input-bg luôn là MÀU phẳng (rgba) ⇒ dùng cho color-mix / border-color. */
    --sh-bg: var(--ghz-card-bg, #181b20);
    --sh-flat: var(--ghz-input-bg, #14171b);
    --sh-panel-bg: var(--ghz-input-bg, #14171b);
    --sh-border: var(--ghz-card-border, #2a2e35);
    --sh-border-soft: color-mix(in srgb, var(--sh-border) 65%, transparent);
    /* Nền phẳng phục vụ mix/border — luôn là màu hợp lệ */
    --sh-solid: color-mix(in srgb, var(--ghz-text-primary, #e5e7eb) 14%, transparent);

    /* Text */
    --sh-text: var(--ghz-text-primary, #e5e7eb);
    --sh-text2: var(--ghz-text-secondary, #9aa3af);
    --sh-muted: var(--ghz-text-muted, #9aa3af);

    /* Semantic */
    --sh-success: var(--ghz-success, #22c55e);
    --sh-success-bg: var(--ghz-success-bg, rgba(34, 197, 94, 0.14));
    --sh-danger: var(--ghz-danger, #ef4444);
    --sh-danger-bg: var(--ghz-danger-bg, rgba(239, 68, 68, 0.14));
    --sh-warning: var(--ghz-warning, #f59e0b);
    --sh-warning-bg: var(--ghz-warning-bg, rgba(245, 158, 11, 0.14));
    /* BUG ĐÃ SỬA (2026-11-05): --sh-warn được dùng ở .sh-next-in.warn /
       .sh-next-ico / .sh-card-reason nhưng KHÔNG hề được khai báo ⇒ var()
       không resolve ⇒ color-mix() vô hiệu ⇒ mất viền/nền cảnh báo.
       Khai báo alias trỏ về --sh-warning. */
    --sh-warn: var(--sh-warning);
    --sh-info: var(--ghz-info, #3b82f6);
    --sh-info-bg: var(--ghz-info-bg, rgba(59, 130, 246, 0.14));
    --sh-purple: #a855f7;

    /* Các khoản tiền của ca — hue cố định, "adaptive" theo màu chữ của theme */
    --sh-pay-cash-hue: #10b981;
    --sh-pay-personal-hue: #3b82f6;
    --sh-pay-company-hue: #a855f7;
    --sh-pay-debt-hue: #f59e0b;
    --sh-pay-tradein-hue: #14b8a6;

    /* Shape */
    --sh-r-sm: 10px;
    --sh-r-md: 13px;
    --sh-r-lg: 16px;
    --sh-r-xl: 18px;

    color: var(--sh-text);
    font-family: inherit;
}

.ghz-shift :where(input, select, textarea, button) { font-family: inherit; }

/* ============ PAGE SHELL ============ */
.sh-page { max-width: 1180px; margin: 0 auto; padding: 16px 14px 24px; }
/* Desktop rộng: nội dung dùng hết bề ngang thay vì co lại như một hộp modal */
@media (min-width: 1280px) {
    .sh-page { max-width: 1400px; padding: 20px 18px 32px; }
}

/* ============ Ô "VIỆC CẦN LÀM NGAY" — 1 thao tác cho nhân viên ============ */
.sh-next { margin-bottom: 16px; }
.sh-next-in {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 14px; border-radius: var(--sh-r-lg);
    border: 1px solid var(--sh-border); background: var(--sh-panel-bg);
}
.sh-next-in.warn { border-color: color-mix(in srgb, var(--sh-warn) 45%, transparent);
    background: color-mix(in srgb, var(--sh-warn) 8%, var(--sh-panel-bg)); }
.sh-next-in.info { border-color: color-mix(in srgb, var(--sh-info) 42%, transparent);
    background: color-mix(in srgb, var(--sh-info) 8%, var(--sh-panel-bg)); }
.sh-next-ico {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 15px;
    background: color-mix(in srgb, var(--sh-warn) 16%, transparent);
    color: color-mix(in srgb, var(--sh-warn) 74%, var(--sh-text));
}
.sh-next-in.info .sh-next-ico { background: color-mix(in srgb, var(--sh-info) 16%, transparent);
    color: color-mix(in srgb, var(--sh-info) 74%, var(--sh-text)); }
.sh-next-t { flex: 1 1 220px; min-width: 0; }
.sh-next-t b { display: block; font-size: 13px; font-weight: 800; color: var(--sh-text); }
.sh-next-t span { display: block; font-size: 11.5px; color: var(--sh-text2); margin-top: 2px; line-height: 1.5; }
.sh-next-in .sh-btn { flex-shrink: 0; }
/* Mobile: giữ 1 hàng ngang, thu gọn icon + chữ + nút ⇒ không chiếm nhiều chỗ */
@media (max-width: 560px) {
    .sh-next-in {
        flex-direction: row; align-items: center; text-align: left;
        flex-wrap: nowrap;
        gap: 9px; padding: 9px 10px; border-radius: var(--sh-r-md);
    }
    .sh-next-ico { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
    .sh-next-t { flex: 1 1 auto; min-width: 0; }
    .sh-next-t b {
        font-size: 12.5px;
        /* tiêu đề 1 dòng, phần dư bị cắt */
        display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .sh-next-t span {
        font-size: 11px; margin-top: 1px; line-height: 1.4;
        /* chỉ hiện 2 dòng, phần còn lại có dấu … */
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .sh-next-in .sh-btn {
        width: auto; padding: 7px 10px; font-size: 12px; white-space: nowrap;
        flex: 0 0 auto;
    }
}
/* Mobile rất hẹp: bỏ chữ trên nút, chỉ giữ icon */
@media (max-width: 340px) {
    .sh-next-in .sh-btn { padding: 7px 9px; font-size: 0; gap: 0; }
    .sh-next-in .sh-btn i { font-size: 13px; }
}

/* ============ DÒNG BẢNG BẤM ĐƯỢC ============ */
.sh-table tbody tr.sh-row-click { cursor: pointer; transition: background-color .12s ease; }
.sh-table tbody tr.sh-row-click:hover { background: color-mix(in srgb, var(--sh-accent) 7%, transparent); }
.sh-table tbody tr.sh-row-click:focus-visible {
    outline: 2px solid var(--sh-accent); outline-offset: -2px;
}

/* ============ CARD BẤM ĐƯỢC (lịch sử gộp theo ngày) ============ */
.sh-item-click {
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}
.sh-item-click:hover {
    background: color-mix(in srgb, var(--sh-accent) 7%, transparent);
    border-color: color-mix(in srgb, var(--sh-accent) 34%, transparent);
}
.sh-item-click:focus-visible {
    outline: 2px solid var(--sh-accent); outline-offset: -2px;
}

/* ============ BADGE VAI TRÒ (dùng ở header + bảng quyền) ============ */
.sh-role-badge {
    margin-left: auto; font-size: 9.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px;
    background: color-mix(in srgb, var(--sh-accent) 16%, transparent); color: var(--sh-accent);
    border: 1px solid color-mix(in srgb, var(--sh-accent) 34%, transparent); white-space: nowrap;
}

/* ============ NHÓM TAB (Của tôi | Quản lý) ============
   Quản lý thấy 2 nhóm trong CÙNG 1 thanh tab, phân tách bằng 1 vạch
   dọc + nhãn nhóm. Nhân viên chỉ thấy 1 nhóm ⇒ không nút chuyển view. */
.sh-subtabs-label {
    display: inline-flex; align-items: center; align-self: stretch;
    padding: 0 10px 0 2px; margin-right: 2px;
    font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: var(--sh-muted); white-space: nowrap; pointer-events: none;
}
.sh-subtabs-sep {
    display: inline-block; width: 1px; align-self: stretch; margin: 2px 8px;
    background: var(--sh-border); flex: 0 0 auto;
}
@media (max-width: 640px) {
    .sh-subtabs-label { font-size: 9px; padding-right: 6px; }
    .sh-subtabs-sep { margin: 2px 5px; }
}

/* ============ VIEW (mỗi vai trò 1 view riêng) ============
   Đã bỏ 2 view tách rời + nút chuyển: giờ là 1 thanh tab phẳng,
   nội dung thay đổi theo role. Class .sh-view giữ lại để không phá
   CSS cũ, nhưng không còn được render. */
.sh-view { display: none; }
.sh-view.on { display: block; animation: shFade .18s ease-out; }

/* Badge vai trò cạnh tiêu đề */
.sh-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sh-title-row .sh-role-badge {
    margin-left: 0; display: inline-flex; align-items: center; gap: 5px;
    font-size: 10px; padding: 3px 9px;
}
.sh-role-badge-mgr {
    background: color-mix(in srgb, var(--sh-purple) 15%, transparent) !important;
    color: color-mix(in srgb, var(--sh-purple) 80%, var(--sh-text)) !important;
    border-color: color-mix(in srgb, var(--sh-purple) 34%, transparent) !important;
}
.sh-role-badge-staff {
    background: color-mix(in srgb, var(--sh-text) 8%, transparent) !important;
    color: var(--sh-text2) !important;
    border-color: var(--sh-border) !important;
}
/* Header: cột tiêu đề co giãn, ô "việc cần làm" bên phải */
.sh-head-main { flex: 1 1 320px; min-width: 0; }
.sh-head > .sh-next { flex: 0 1 340px; min-width: 0; margin-bottom: 0; }
@media (max-width: 900px) {
    .sh-head > .sh-next { flex: 1 1 100%; }
}

/* ============ HEADER ============ */
.sh-head {
    display: flex; flex-wrap: wrap; gap: 12px;
    align-items: flex-start; justify-content: space-between;
    margin-bottom: 16px;
}
.sh-eyebrow {
    font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
    color: var(--sh-accent); font-weight: 800; margin: 0 0 5px;
}
.sh-title {
    font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -.01em;
    color: var(--sh-text);
}
.sh-sub {
    margin: 6px 0 0; font-size: 12.5px; color: var(--sh-text2);
    max-width: 680px; line-height: 1.6;
}
.sh-sub b { color: var(--sh-text); font-weight: 700; }
.sh-link { color: var(--sh-accent); text-decoration: underline; text-underline-offset: 2px; }

/* ============ SUB-TABS (ngang, cuộn trên mobile) ============ */
.sh-subtabs {
    display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px; margin-bottom: 16px;
    border-bottom: 1px solid var(--sh-border);
    scroll-snap-type: x proximity;
}
.sh-subtabs::-webkit-scrollbar { display: none; }
/* Desktop: sub-tab dính đầu trang khi cuộn dài + xuống dòng nếu nhiều tab */
@media (min-width: 900px) {
    .sh-subtabs {
        position: sticky; top: 0; z-index: 20;
        background: var(--sh-bg);
        padding-top: 6px; margin-bottom: 18px;
        border-bottom: 1px solid var(--sh-border);
        flex-wrap: wrap; row-gap: 0;
    }
    /* Khi xuống dòng, nhãn nhóm + vạch dọc chỉ hiện ở dòng đầu */
    .sh-subtabs-label { align-self: center; height: auto; }
    .sh-subtabs-sep { align-self: center; height: 22px; }
}
.sh-subtab {
    position: relative; padding: 9px 13px; border: 0; background: transparent;
    color: var(--sh-text2); font-size: 13px; font-weight: 700; cursor: pointer;
    white-space: nowrap; border-radius: 9px 9px 0 0;
    scroll-snap-align: start; transition: color .15s ease, background-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.sh-subtab:hover { color: var(--sh-text); background: color-mix(in srgb, var(--sh-text) 5%, transparent); }
.sh-subtab.active { color: var(--sh-text); }
.sh-subtab.active::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
    height: 2px; border-radius: 2px; background: var(--sh-accent);
}
.sh-subtab .cnt {
    display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
    font-size: 10px; background: color-mix(in srgb, var(--sh-text) 9%, transparent);
    color: var(--sh-text2); font-weight: 800;
}
.sh-subtab.active .cnt { background: var(--sh-accent-soft-2); color: var(--sh-accent); }
.sh-subtab .cnt.hot { background: var(--sh-danger-bg); color: var(--sh-danger); }
/* Sub-tab "lịch sử cũ" — dịu hơn để không lấn át phần mới */
.sh-subtab.legacy { color: var(--sh-muted); }
.sh-subtab.legacy.active { color: var(--sh-text2); }
.sh-subtab.legacy.active::after { background: var(--sh-border); }

/* ============ PANELS ============ */
.sh-panel { display: none; }
.sh-panel.on { display: block; animation: shFade .18s ease-out; }
/* Nạp nền: panel cũ vẫn hiện, chỉ làm mờ nhẹ ⇒ không nhấp nháy khi
   dữ liệu về sau (thay vì xoá sạch rồi hiện spinner). */
.sh-panel.sh-refreshing { opacity: .55; transition: opacity .12s ease; }
@keyframes shFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============ GRID ============ */
.sh-grid { display: grid; gap: 9px; grid-template-columns: minmax(0, 1fr); }
/* QUAN TRỌNG: minmax(0,…) để nội dung dài (chip nowrap, tiền lớn) KHÔNG
   kéo giãn cột & gây tràn ngang trên mobile 360–400px. */
.sh-grid > * { min-width: 0; }
@media (min-width: 700px) {
    .sh-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px) {
    .sh-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ============ SHIFT CARD ============ */
.sh-shift {
    border: 1px solid var(--sh-border); border-radius: var(--sh-r-lg);
    padding: 14px; background: var(--sh-bg); position: relative; overflow: hidden;
}
.sh-shift::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--sh-accent);
}
.sh-shift.wait::before { background: var(--sh-warning); }
.sh-shift.done::before { background: color-mix(in srgb, var(--sh-text) 28%, transparent); }
.sh-shift.over::before { background: var(--sh-danger); }
.sh-shift-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-width: 0; }
.sh-shift-top > * { min-width: 0; }
.sh-shift-name {
    font-size: 15px; font-weight: 800; margin: 0; color: var(--sh-text);
    min-width: 0; overflow-wrap: anywhere;
}
.sh-shift-time {
    font-size: 11.5px; color: var(--sh-text2); margin-top: 3px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0;
}
.sh-shift-meta { margin-top: 11px; display: grid; gap: 7px; min-width: 0; }
.sh-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; min-width: 0; }
.sh-kv span { color: var(--sh-text2); min-width: 0; }
.sh-kv b { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--sh-text); white-space: nowrap; }
/* Dạng .sh-kv > span.k (nhãn) + span.v (giá trị) — dùng trong modal chi tiết */
.sh-kv .k { color: var(--sh-text2); flex: 0 0 auto; }
.sh-kv .v {
    color: var(--sh-text); font-weight: 800; text-align: right;
    font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere;
}
/* Trong modal chi tiết: dạng bảng 2 cột, mỗi ô có đường kẻ ngăn cách */
.sh-modal-b .sh-grid { gap: 0; }
@media (min-width: 620px) {
    .sh-modal-b .sh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
}
.sh-modal-b .sh-kv {
    padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--sh-border) 55%, transparent);
    font-size: 12.5px;
}

/* ============ CHIP ============ */
.sh-chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
    border-radius: 999px; font-size: 10.5px; font-weight: 800; white-space: nowrap;
    border: 1px solid transparent;
}
.sh-chip.ok { background: var(--sh-success-bg); color: var(--sh-success); border-color: color-mix(in srgb, var(--sh-success) 32%, transparent); }
.sh-chip.warn { background: var(--sh-warning-bg); color: var(--sh-warning); border-color: color-mix(in srgb, var(--sh-warning) 32%, transparent); }
.sh-chip.danger { background: var(--sh-danger-bg); color: var(--sh-danger); border-color: color-mix(in srgb, var(--sh-danger) 32%, transparent); }
.sh-chip.info { background: var(--sh-info-bg); color: var(--sh-info); border-color: color-mix(in srgb, var(--sh-info) 32%, transparent); }
.sh-chip.mute { background: color-mix(in srgb, var(--sh-text) 6%, transparent); color: var(--sh-text2); border-color: color-mix(in srgb, var(--sh-text) 12%, transparent); }
.sh-chip.purple { background: color-mix(in srgb, var(--sh-purple) 15%, transparent); color: color-mix(in srgb, var(--sh-purple) 78%, var(--sh-text)); border-color: color-mix(in srgb, var(--sh-purple) 34%, transparent); }
/* "Đầu ca" — dùng màu brand (accent) để phân biệt với "Cuối ca" (tím) */
.sh-chip.accent { background: var(--sh-accent-soft); color: var(--sh-accent); border-color: color-mix(in srgb, var(--sh-accent) 34%, transparent); }
/* Chữ phụ dùng chung (ngoài chip) */
.sh-muted { color: var(--sh-muted); font-size: 11.5px; }

/* ============ TIỆN ÍCH "n" (chữ phụ nhỏ) ============
   Markup dùng class="n" ở nhiều nơi:
     - <span class="n">số lượng</span> trong .sh-sec  → đã có rule riêng
     - <span class="n">tên cơ sở</span> trong .sh-item-t → CHƯA có rule
     - <td class="n">...</td> trong bảng → CHƯA có rule
   Không có rule ⇒ chữ chạy đè lên tiêu đề, mất phân cấp thị giác.
   Thứ tự: rule generic đặt TRƯỚC .sh-sec .n / .sh-item-t .n (cùng
   specificity 0,2,0) ⇒ rule chuyên biệt phía sau sẽ thắng. */
.ghz-shift .n {
    color: var(--sh-text2); font-size: 11px; font-weight: 600;
}
/* Trong tiêu đề item: "Tên ca <span class="n">Cơ sở</span>" → tách nhẹ */
.sh-item-t .n { margin-left: 4px; font-weight: 500; }
/* Trong bảng: ô trống/placeholder */
.sh-table td.n { color: var(--sh-text2); text-align: center; }

/* ============ BUTTONS ============ */
.sh-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 14px; border-radius: var(--sh-r-md);
    border: 1px solid var(--sh-border); background: var(--sh-panel-bg);
    color: var(--sh-text); font-size: 12.5px; font-weight: 700; cursor: pointer;
    transition: border-color .15s ease, filter .15s ease, transform .1s ease;
    -webkit-tap-highlight-color: transparent; text-decoration: none;
}
.sh-btn:hover { border-color: color-mix(in srgb, var(--sh-accent) 45%, var(--sh-border)); filter: brightness(1.08); }
.sh-btn:active { transform: scale(.985); }
/* Vòng focus rõ cho bàn phím (nút icon-only trong bảng cần đặc biệt rõ) */
.sh-btn:focus-visible { outline: 2px solid var(--sh-accent); outline-offset: 2px; }
.sh-btn.primary {
    background: var(--sh-accent);
    border-color: transparent;
    color: var(--ghz-text-on-brand-color, var(--ghz-text-on-brand-solid, #04231a));
}
.sh-btn.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.sh-btn.ghost { background: transparent; }
.sh-btn.danger { border-color: color-mix(in srgb, var(--sh-danger) 42%, transparent); color: var(--sh-danger); background: var(--sh-danger-bg); }
.sh-btn.sm { padding: 6px 10px; font-size: 11.5px; border-radius: 9px; }
/* Nút icon-only — gọn 1 cột trong bảng desktop.
   min-height 30px để vẫn bấm được (trước đây cao ~26px do padding 6px). */
.sh-btn.icon { padding: 6px 9px; min-width: 30px; min-height: 30px; justify-content: center; }
.sh-btn.icon i { font-size: 12px; }
/* Icon-only trong bảng: dùng .icon (KHÔNG .sm) để giữ vùng bấm ≥ 30px.
   Nếu kết hợp .sm + icon ⇒ padding 6px 10px làm nút quá nhỏ/khó bấm. */
.sh-btn.sm.icon { padding: 6px 9px; min-width: 30px; min-height: 30px; }
.sh-btn.icon:disabled { opacity: .45; cursor: not-allowed; }
.sh-btn.wide { width: 100%; }
.sh-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============ AUTO-SUMMARY BOX ============ */
.sh-auto {
    border: 1px dashed color-mix(in srgb, var(--sh-accent) 42%, transparent);
    background: var(--sh-accent-soft);
    border-radius: var(--sh-r-md); padding: 12px 13px;
}
.sh-auto-h {
    display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 800;
    color: var(--sh-accent); letter-spacing: .04em; margin-bottom: 9px; text-transform: uppercase;
}
.sh-metrics { display: grid; grid-template-columns: 1fr; gap: 9px; }
@media (min-width: 520px) { .sh-metrics { grid-template-columns: repeat(3, 1fr); } }
.sh-metric {
    background: var(--sh-flat);
    border: 1px solid var(--sh-border); border-radius: var(--sh-r-md); padding: 9px 10px;
}
.sh-metric .l { font-size: 10.5px; color: var(--sh-text2); display: flex; align-items: center; gap: 5px; }
.sh-metric .v { font-size: 17px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; color: var(--sh-text); }
.sh-metric .v.sm { font-size: 14px; }

/* ============ 4 KHOẢN TIỀN ============ */
.sh-pay {
    border: 1px solid var(--sh-border); border-radius: var(--sh-r-md);
    overflow: hidden; background: var(--sh-panel-bg);
}
.sh-pay-r {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--sh-border) 55%, transparent);
}
.sh-pay-r:last-of-type { border-bottom: 0; }
.sh-pay-ico {
    width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; font-size: 12px;
}
.sh-pay-n { flex: 1 1 auto; min-width: 0; }
.sh-pay-n b { display: block; font-size: 12.5px; color: var(--sh-text); font-weight: 700; }
.sh-pay-n span { display: block; font-size: 10px; color: var(--sh-muted); margin-top: 1px; }
.sh-pay-v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--sh-text); }
.sh-pay-src {
    font-size: 9.5px; color: var(--sh-text2);
    background: color-mix(in srgb, var(--sh-text) 6%, transparent);
    border: 1px solid var(--sh-border); border-radius: 6px; padding: 1px 6px; white-space: nowrap;
}
.sh-pay-total {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 12px; font-size: 13px; font-weight: 800;
    background: var(--sh-accent-soft);
    border-top: 1px solid color-mix(in srgb, var(--sh-accent) 28%, transparent);
    color: var(--sh-text);
}
.sh-pay-total .v { font-size: 16px; font-variant-numeric: tabular-nums; }

/* Màu nhận diện từng khoản — adaptive theo màu chữ theme.
   Markup thực tế: <div class="sh-pay-r cash"><i class="fa-solid ... sh-pay-ico">
   ⇒ class khoản nằm ở DIV CHA (sh-pay-r), không nằm ở chính icon.
   Chấp nhận CẢ HAI dạng để không vỡ nếu markup đổi:
   <div class="sh-pay-ico sh-pay-cash">  và  <div class="sh-pay-cash"><div class="sh-pay-ico"> */
.sh-pay-ico.sh-pay-cash, .sh-pay-cash .sh-pay-ico, .sh-pay-r.cash .sh-pay-ico { background: color-mix(in srgb, var(--sh-pay-cash-hue) 16%, transparent); color: color-mix(in srgb, var(--sh-pay-cash-hue) 72%, var(--sh-text)); }
.sh-pay-ico.sh-pay-personal, .sh-pay-personal .sh-pay-ico, .sh-pay-r.personal .sh-pay-ico { background: color-mix(in srgb, var(--sh-pay-personal-hue) 16%, transparent); color: color-mix(in srgb, var(--sh-pay-personal-hue) 72%, var(--sh-text)); }
.sh-pay-ico.sh-pay-company, .sh-pay-company .sh-pay-ico, .sh-pay-r.company .sh-pay-ico { background: color-mix(in srgb, var(--sh-pay-company-hue) 16%, transparent); color: color-mix(in srgb, var(--sh-pay-company-hue) 72%, var(--sh-text)); }
.sh-pay-ico.sh-pay-debt, .sh-pay-debt .sh-pay-ico, .sh-pay-r.debt .sh-pay-ico { background: color-mix(in srgb, var(--sh-pay-debt-hue) 16%, transparent); color: color-mix(in srgb, var(--sh-pay-debt-hue) 68%, var(--sh-text)); }
.sh-pay-ico.sh-pay-tradein, .sh-pay-tradein .sh-pay-ico, .sh-pay-r.tradein .sh-pay-ico { background: color-mix(in srgb, var(--sh-pay-tradein-hue) 16%, transparent); color: color-mix(in srgb, var(--sh-pay-tradein-hue) 68%, var(--sh-text)); }

/* ============ MỤC GHI BÀN GIAO ============ */
.sh-create {
    border: 1px solid color-mix(in srgb, var(--sh-accent) 40%, transparent);
    border-radius: var(--sh-r-lg);
    background:
        linear-gradient(160deg,
            color-mix(in srgb, var(--sh-accent) 9%, transparent) 0%,
            color-mix(in srgb, var(--sh-accent) 2%, transparent) 100%),
        var(--sh-bg);
    padding: 14px; margin-bottom: 14px;
}
.sh-create-h { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 13px; }
.sh-create-ico {
    width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
    background: var(--sh-accent-soft-2); border: 1px solid color-mix(in srgb, var(--sh-accent) 40%, transparent);
    display: flex; align-items: center; justify-content: center; color: var(--sh-accent); font-size: 15px;
}
.sh-create-t { font-size: 15px; font-weight: 800; margin: 0; color: var(--sh-text); }
.sh-create-s { font-size: 11.5px; color: var(--sh-text2); margin: 3px 0 0; line-height: 1.55; }
.sh-choice { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .sh-choice { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sh-choice-c {
    border: 1px solid var(--sh-border); background: var(--sh-bg);
    border-radius: var(--sh-r-lg); padding: 13px; text-align: left; cursor: pointer;
    transition: border-color .15s ease, transform .1s ease; color: inherit;
    -webkit-tap-highlight-color: transparent;
}
.sh-choice-c:hover { border-color: color-mix(in srgb, var(--sh-accent) 50%, var(--sh-border)); }
.sh-choice-c:active { transform: scale(.99); }
.sh-choice-c .t { font-size: 13.5px; font-weight: 800; display: flex; align-items: center; gap: 7px; color: var(--sh-text); }
.sh-choice-c .d { font-size: 11px; color: var(--sh-text2); margin-top: 6px; line-height: 1.5; }
.sh-choice-c .go { margin-top: 11px; display: block; }

/* ============ DANH SÁCH ITEM (việc dở / giữ cọc) ============ */
.sh-list { display: grid; gap: 8px; }
.sh-item {
    border: 1px solid var(--sh-border); border-radius: var(--sh-r-md);
    padding: 8px 10px; background: var(--sh-panel-bg);
}
.sh-item.warn { border-color: color-mix(in srgb, var(--sh-warning) 45%, transparent); background: var(--sh-warning-bg); }
.sh-item.purple { border-color: color-mix(in srgb, var(--sh-purple) 40%, transparent); background: color-mix(in srgb, var(--sh-purple) 7%, transparent); }
.sh-item-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.sh-item-t { font-size: 12px; font-weight: 800; color: var(--sh-text); min-width: 0; overflow-wrap: anywhere; }
/* Chip trên đầu item không được co lại/nhảy dòng vô lý */
.sh-item-h > .sh-chip { flex: 0 0 auto; }
.sh-item-d { font-size: 11.5px; color: var(--sh-text2); line-height: 1.45; }
.sh-item-d b { color: var(--sh-text); font-weight: 800; font-variant-numeric: tabular-nums; }
.sh-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }

/* ============ FORM ============ */
.sh-field { margin-bottom: 12px; }
.sh-label { display: block; font-size: 11.5px; font-weight: 700; color: var(--sh-text2); margin-bottom: 5px; }
.sh-label .req { color: var(--sh-danger); }
.sh-input, .sh-select, .sh-textarea {
    width: 100%; background: var(--sh-panel-bg); border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-sm); padding: 9px 11px; color: var(--sh-text);
    font-size: 13px; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.sh-input:focus, .sh-select:focus, .sh-textarea:focus {
    border-color: color-mix(in srgb, var(--sh-accent) 60%, transparent);
    box-shadow: 0 0 0 3px var(--sh-accent-soft);
}
.sh-input:disabled, .sh-input[readonly] { opacity: .65; cursor: not-allowed; }
.sh-textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.sh-select option { background: var(--sh-flat); color: var(--sh-text); }
.sh-hint { font-size: 10.5px; color: var(--sh-muted); margin-top: 4px; line-height: 1.5; }
.sh-hint b { color: var(--sh-text2); }
.sh-two { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .sh-two { grid-template-columns: 1fr 1fr; } }

/* ============ DROPDOWN CHỌN NGƯỜI (thay <select multiple>) ============
   2026-11-12 (yêu cầu QL): "ô này thành dropdown đi".
   Nút + panel trượt xuống, có ô tìm kiếm, tick nhiều người, nút bỏ chọn. */
.sh-rx { position: relative; }
.sh-rx-trigger {
    width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
    background: var(--sh-panel-bg); border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-sm); padding: 9px 11px; color: var(--sh-muted);
    font-size: 13px; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease;
}
.sh-rx-trigger:hover { border-color: color-mix(in srgb, var(--sh-accent) 45%, transparent); }
.sh-rx.open .sh-rx-trigger {
    border-color: color-mix(in srgb, var(--sh-accent) 60%, transparent);
    box-shadow: 0 0 0 3px var(--sh-accent-soft);
}
.sh-rx.has-value .sh-rx-trigger { color: var(--sh-text); font-weight: 600; }
.sh-rx-trigger-text {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sh-rx-caret { font-size: 11px; color: var(--sh-text2); transition: transform .18s ease; }
.sh-rx.open .sh-rx-caret { transform: rotate(180deg); }

.sh-rx-panel {
    position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
    background: var(--sh-flat); border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-md); box-shadow: 0 12px 28px rgba(0, 0, 0, .32);
    overflow: hidden;
}
.sh-rx-panel.hidden { display: none; }
.sh-rx-search-wrap {
    display: flex; align-items: center; gap: 7px; padding: 8px 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--sh-border) 60%, transparent);
}
.sh-rx-search-wrap i { font-size: 11px; color: var(--sh-muted); }
.sh-rx-search {
    flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
    color: var(--sh-text); font-size: 12.5px;
}
.sh-rx-search::placeholder { color: var(--sh-muted); }
.sh-rx-list { max-height: 240px; overflow-y: auto; padding: 4px; }
.sh-rx-row {
    display: flex; align-items: center; gap: 9px; padding: 7px 9px;
    border-radius: var(--sh-r-sm); cursor: pointer; color: var(--sh-text); font-size: 12.5px;
}
.sh-rx-row:hover { background: color-mix(in srgb, var(--sh-text) 6%, transparent); }
.sh-rx-row.hidden { display: none; }
.sh-rx-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.sh-rx-tick {
    flex: 0 0 auto; width: 17px; height: 17px; border-radius: 5px;
    border: 1.5px solid var(--sh-border); display: inline-flex;
    align-items: center; justify-content: center; color: transparent; font-size: 9px;
    transition: background .15s ease, border-color .15s ease;
}
.sh-rx-row input:checked + .sh-rx-tick {
    background: var(--sh-accent); border-color: var(--sh-accent); color: #06251a;
}
.sh-rx-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-rx-empty { padding: 14px 10px; text-align: center; font-size: 12px; color: var(--sh-muted); }
.sh-rx-foot { border-top: 1px solid color-mix(in srgb, var(--sh-border) 60%, transparent); padding: 6px 8px; }
.sh-rx-clear {
    width: 100%; background: transparent; border: 0; color: var(--sh-muted);
    font-size: 11.5px; font-weight: 700; padding: 5px; border-radius: var(--sh-r-sm); cursor: pointer;
}
.sh-rx-clear:hover { color: var(--sh-danger); background: color-mix(in srgb, var(--sh-danger) 10%, transparent); }

/* ============ DIFF BANNER ============ */
.sh-diff {
    border-radius: var(--sh-r-md); padding: 11px 12px; font-size: 12.5px;
    margin-top: 9px; border: 1px solid; line-height: 1.5;
}
.sh-diff.bad { border-color: color-mix(in srgb, var(--sh-danger) 45%, transparent); background: var(--sh-danger-bg); color: var(--sh-danger); }
.sh-diff.good { border-color: color-mix(in srgb, var(--sh-success) 40%, transparent); background: var(--sh-success-bg); color: var(--sh-success); }
.sh-diff b { font-variant-numeric: tabular-nums; }

/* ============ TABLE ============ */
.sh-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--sh-border); border-radius: var(--sh-r-md); }
.sh-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 640px; }
.sh-table th {
    text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--sh-text2); padding: 9px 10px; background: var(--sh-flat);
    position: sticky; top: 0; z-index: 1;
    border-bottom: 1px solid var(--sh-border); white-space: nowrap;
    /* Nền header có alpha ở theme sáng → blur để nội dung không lọt qua khi cuộn */
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.sh-table td {
    padding: 9px 10px; border-bottom: 1px solid color-mix(in srgb, var(--sh-border) 45%, transparent);
    vertical-align: middle; color: var(--sh-text);
}
.sh-table tbody tr:last-child td { border-bottom: 0; }
.sh-table tbody tr:hover td { background: color-mix(in srgb, var(--sh-text) 3%, transparent); }
.sh-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sh-row-warn td { background: var(--sh-warning-bg); }
.sh-table tbody tr.sh-row-warn:hover td { background: color-mix(in srgb, var(--sh-warning) 14%, transparent); }
.sh-scroll { max-height: 440px; overflow: auto; border: 1px solid var(--sh-border); border-radius: var(--sh-r-md); }

/* Bảng RỘNG (13 cột ca): không được bóp cột → chữ chồng lên nhau.
   min-width phải ≥ tổng bề rộng nội dung tối thiểu, và cột số/người
   phải nowrap để không xuống dòng lệch nhau. */
.sh-table.wide { min-width: 1000px; font-size: 12px; }
.sh-table.wide td, .sh-table.wide th { white-space: nowrap; padding: 8px 7px; }
.sh-table.wide td.lwrap { white-space: normal; min-width: 180px; max-width: 260px; }
/* Cột số: luôn 1 dòng, canh phải */
.sh-table td.num, .sh-table th.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Cột chip trạng thái: không bị wrap làm dòng cao lê thê */
.sh-table td .sh-chip { white-space: nowrap; }

/* Mobile: bảng rộng → cuộn ngang, cột đầu dính */
@media (max-width: 720px) {
    .sh-table-wrap { border-radius: var(--sh-r-md); }
    .sh-table { min-width: 560px; }
    .sh-table th:first-child, .sh-table td:first-child {
        position: sticky; left: 0; z-index: 2;
        background: var(--sh-flat);
        backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    }
    .sh-table th:first-child { z-index: 3; }
    .sh-table tbody tr:hover td:first-child { background: var(--sh-flat); }
}

/* ============ CARD VIEW (MOBILE) — thay cho bảng 16 cột ============ */
.sh-cards { display: none; gap: 10px; }
.sh-card {
    border: 1px solid var(--sh-border); background: var(--sh-panel-bg);
    border-radius: var(--sh-r-lg); padding: 12px; cursor: pointer;
    transition: border-color .12s ease, transform .1s ease;
    -webkit-tap-highlight-color: transparent;
}
.sh-card:active { transform: scale(.995); }
.sh-card-h {
    display: flex; align-items: center; gap: 8px; justify-content: space-between;
    margin-bottom: 6px;
}
.sh-card-h b { font-size: 13.5px; font-weight: 800; color: var(--sh-text); }
.sh-card-d { font-size: 11px; color: var(--sh-text2); font-weight: 500; margin-left: 4px; }
.sh-card-who {
    font-size: 11.5px; color: var(--sh-text2); margin-bottom: 9px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.sh-card-who i { font-size: 9px; opacity: .6; }
.sh-card-sum {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px;
    padding: 9px 10px; border-radius: var(--sh-r-sm);
    background: var(--sh-flat); border: 1px solid color-mix(in srgb, var(--sh-border) 60%, transparent);
}
.sh-card-sum span { display: block; font-size: 9.5px; color: var(--sh-text2); text-transform: uppercase; letter-spacing: .05em; }
.sh-card-sum b { display: block; font-size: 12.5px; font-weight: 800; color: var(--sh-text);
    font-variant-numeric: tabular-nums; margin-top: 2px; }
.sh-card-reason {
    font-size: 11px; color: var(--sh-text2); margin-top: 8px; line-height: 1.5;
    padding-left: 8px; border-left: 2px solid color-mix(in srgb, var(--sh-warn) 55%, transparent);
}
.sh-card-f { margin-top: 10px; display: flex; gap: 8px; }
.sh-card-f .sh-btn { flex: 1; justify-content: center; }

/* Chỉ hiện card trên mobile, ẩn bảng */
@media (max-width: 720px) {
    .sh-cards { display: grid; }
    .sh-cards:empty { display: none; }
    #pShifts .sh-scroll { display: none; }
}

/* =====================================================================
   MOBILE CARD VIEW — DÙNG CHUNG CHO MỌI BẢNG
   ---------------------------------------------------------------------
   Nguyên tắc: bảng > 4 cột trên mobile → chuyển thành card.
   Nhấn vào card → mở modal chi tiết (openDetail / openXDetail).
   Desktop: bảng hiện, card ẩn.
   ===================================================================== */

/* Wrapper card dùng chung */
.sh-cards[data-sh-cards] { display: none; gap: 10px; }
@media (max-width: 720px) {
    .sh-cards[data-sh-cards] { display: grid; }
    .sh-cards[data-sh-cards]:empty { display: none; }
    /* Ẩn bảng tương ứng khi đã có card */
    .sh-scroll[data-sh-table] { display: none; }
}

/* =====================================================================
   DANH SÁCH DÀI → CUỘN RIÊNG (không kéo dài trang)
   Áp dụng cho cả mobile lẫn desktop: khối card dài chỉ cuộn trong
   chính nó ⇒ trang không bị "đuối" theo độ dài danh sách.
   ===================================================================== */
.sh-cards.scroll-y,
.sh-list.scroll-y {
    max-height: var(--sh-list-max-h, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /* padding-bottom để card cuối không dính sát mép dưới */
    padding-bottom: 4px;
    /* Ẩn thanh cuộn ngang, giữ thanh dọc mảnh */
    scrollbar-width: thin;
}
.sh-cards.scroll-y::-webkit-scrollbar,
.sh-list.scroll-y::-webkit-scrollbar { width: 6px; }
.sh-cards.scroll-y::-webkit-scrollbar-thumb,
.sh-list.scroll-y::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--sh-text) 22%, transparent);
    border-radius: 999px;
}
.sh-cards.scroll-y::-webkit-scrollbar-track,
.sh-list.scroll-y::-webkit-scrollbar-track { background: transparent; }
/* Mobile: cao hơn một chút cho dễ cuộn, và bỏ margin-bottom của card cuối */
@media (max-width: 720px) {
    .sh-cards.scroll-y { max-height: var(--sh-list-max-h-m, 460px); }
    .sh-cards.scroll-y .sh-mcard:last-child { margin-bottom: 0; }
}
/* Desktop: cho phép nâng cao qua biến nếu cần */
@media (min-width: 721px) {
    .sh-cards.scroll-y { max-height: var(--sh-list-max-h-d, 560px); }
}

/* 1 card = 1 dòng bảng */
.sh-mcard {
    display: block; width: 100%; text-align: left;
    border: 1px solid var(--sh-border);
    background: var(--sh-panel-bg);
    border-radius: var(--sh-r-lg);
    padding: 9px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .12s ease, transform .1s ease;
    -webkit-tap-highlight-color: transparent;
}
.sh-mcard:last-child { margin-bottom: 0; }
.sh-mcard:active { transform: scale(.995); }
.sh-mcard:hover { border-color: color-mix(in srgb, var(--sh-accent) 45%, var(--sh-border)); }

/* Header: tiêu đề + chip trạng thái */
.sh-mcard-h {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 8px; margin-bottom: 5px;
}
.sh-mcard-h > div:first-child { min-width: 0; flex: 1 1 auto; }
.sh-mcard-t {
    font-size: 13px; font-weight: 800; color: var(--sh-text);
    line-height: 1.3; display: block;
    overflow-wrap: anywhere;
}
.sh-mcard-sub {
    font-size: 10.5px; color: var(--sh-text2); font-weight: 500;
    margin-top: 1px; display: block; line-height: 1.35;
}
.sh-mcard > .sh-chip { flex: 0 0 auto; }

/* Dòng label → value */
.sh-mcard-r {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; font-size: 11.5px; padding: 2px 0;
}
.sh-mcard-r > span:first-child {
    color: var(--sh-text2); flex: 0 0 auto; font-weight: 600;
}
.sh-mcard-r > span:last-child {
    color: var(--sh-text); font-weight: 700; text-align: right;
    font-variant-numeric: tabular-nums; min-width: 0;
    overflow-wrap: anywhere;
}
.sh-mcard-r.sh-mcard-stack { flex-direction: column; align-items: stretch; gap: 0; }
.sh-mcard-r.sh-mcard-stack > span:last-child { text-align: left; font-weight: 600; font-size: 11px; }
.sh-mcard-r .sh-t-ok { color: var(--sh-success); }
.sh-mcard-r .sh-t-bad { color: var(--sh-danger); }
.sh-mcard-r .sh-t-warn { color: var(--sh-warning); }

/* Ô số liệu nổi bật (tiền / doanh số) */
.sh-mcard-sum {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
    padding: 7px 9px; margin: 6px 0 2px;
    border-radius: var(--sh-r-sm);
    background: var(--sh-flat);
    border: 1px solid color-mix(in srgb, var(--sh-border) 60%, transparent);
}
.sh-mcard-sum span {
    display: block; font-size: 9px; color: var(--sh-text2);
    text-transform: uppercase; letter-spacing: .05em;
}
.sh-mcard-sum b {
    display: block; font-size: 12px; font-weight: 800; color: var(--sh-text);
    font-variant-numeric: tabular-nums; margin-top: 1px;
}
.sh-mcard-sum.sh-mcard-sum2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Ô tiền đơn lẻ (1 số, không nhãn) — dùng cho thẻ nhập/xuất kho */
.sh-mcard-amt {
    flex: 0 0 auto; text-align: right; white-space: nowrap;
    font-size: 13.5px; font-weight: 800; color: var(--sh-text);
    font-variant-numeric: tabular-nums;
}
/* Hàng chip trong thẻ mobile — các chip bám sát nhau, wrap khi chật */
.sh-mcard-tags {
    display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px;
}

/* Footer: nút hành động */
.sh-mcard-f {
    margin-top: 9px; display: flex; gap: 8px; flex-wrap: wrap;
}
.sh-mcard-f .sh-btn { flex: 1 1 auto; justify-content: center; min-height: 36px; }
.sh-mcard-f .sh-chip-btn { flex: 0 0 auto; }

/* Link "xem chi tiết" */
.sh-mcard-more {
    margin-top: 8px; font-size: 11px; color: var(--sh-accent);
    font-weight: 700; display: flex; align-items: center; gap: 4px;
}

/* Ô khoá dữ liệu chung (nhiều card dạng grid 2 cột) */
.sh-mcard-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .sh-mcard-grid { grid-template-columns: 1fr 1fr; } }

/* Empty state dùng chung */
.sh-mcard-empty {
    border: 1px dashed var(--sh-border); border-radius: var(--sh-r-lg);
    padding: 22px 14px; text-align: center;
    color: var(--sh-text2); font-size: 12px;
}
.sh-mcard-empty i { display: block; font-size: 20px; margin-bottom: 7px; opacity: .55; }

/* ============ NÚT PHỤ (chip-btn) — gọn, 1 chạm ============ */
.sh-more-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-chip-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 700; color: var(--sh-text2);
    background: var(--sh-flat); border: 1px solid var(--sh-border);
    border-radius: 999px; padding: 7px 12px; cursor: pointer; min-height: 34px;
    transition: border-color .12s ease, color .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.sh-chip-btn:hover { border-color: color-mix(in srgb, var(--sh-accent) 50%, var(--sh-border)); color: var(--sh-accent); }
.sh-chip-btn i { font-size: 11px; }
.sh-chip-btn.danger { color: #f87171; }
.sh-chip-btn.danger:hover { border-color: rgba(248, 113, 113, .55); color: #fca5a5; }

/* ============ LỌC NHANH 1 CHẠM (admin) ============ */
.sh-quick { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.sh-qbtn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 700; color: var(--sh-text2);
    background: var(--sh-panel-bg); border: 1px solid var(--sh-border);
    border-radius: 999px; padding: 7px 13px; cursor: pointer; min-height: 34px;
    transition: border-color .12s ease, color .12s ease, background-color .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.sh-qbtn:hover { border-color: color-mix(in srgb, var(--sh-accent) 45%, var(--sh-border)); }
.sh-qbtn.on {
    border-color: var(--sh-accent);
    background: var(--sh-accent-soft);
    color: var(--sh-accent);
}
.sh-qn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: color-mix(in srgb, var(--sh-text) 9%, transparent);
    font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums;
    color: var(--sh-text2);
}
.sh-qbtn.on .sh-qn { background: var(--sh-accent); color: var(--sh-flat); }
/* Mobile: 1 hàng cuộn ngang thay vì wrap → tiết kiệm chiều cao */
@media (max-width: 560px) {
    .sh-quick { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px;
        scrollbar-width: none; -ms-overflow-style: none; }
    .sh-quick::-webkit-scrollbar { display: none; }
    .sh-qbtn { flex: 0 0 auto; }
}

/* ============ VIỆC BÀN GIAO (tick hoàn thành) ============ */
.sh-card-hd {
    display: flex; align-items: center; gap: 11px; margin-bottom: 12px;
    padding: 12px 13px; border-radius: var(--sh-r-lg);
    border: 1px solid var(--sh-border); background: var(--sh-panel-bg);
}
.sh-card-hd-ico {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    background: color-mix(in srgb, var(--sh-accent) 16%, transparent);
    color: color-mix(in srgb, var(--sh-accent) 74%, var(--sh-text));
}
.sh-card-hd b { display: block; font-size: 13px; font-weight: 800; color: var(--sh-text); }
.sh-card-hd span { display: block; font-size: 11px; color: var(--sh-text2); margin-top: 2px; line-height: 1.45; }

.sh-summary {
    display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px;
    font-size: 11.5px; color: var(--sh-text2);
}
.sh-summary b { font-size: 13px; font-weight: 800; color: var(--sh-text); font-variant-numeric: tabular-nums; }
.sh-summary span:last-child { margin-left: auto; }
.sh-progress {
    height: 6px; border-radius: 999px; overflow: hidden;
    background: color-mix(in srgb, var(--sh-text) 9%, transparent); margin-bottom: 12px;
}
.sh-progress i {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--sh-accent), color-mix(in srgb, var(--sh-accent) 55%, var(--sh-info)));
    transition: width .3s ease;
}

.sh-tasklist { display: grid; gap: 8px; }
.sh-task {
    display: flex; gap: 11px; align-items: flex-start;
    padding: 11px 12px; border-radius: var(--sh-r-md);
    border: 1px solid color-mix(in srgb, var(--sh-warn) 32%, var(--sh-border));
    background: color-mix(in srgb, var(--sh-warn) 6%, var(--sh-panel-bg));
}
.sh-task.urgent {
    border-color: color-mix(in srgb, var(--sh-danger) 42%, transparent);
    background: color-mix(in srgb, var(--sh-danger) 7%, var(--sh-panel-bg));
}
/* Đã hoàn thành — làm mờ, gạch ngang */
.sh-task.done {
    border-color: color-mix(in srgb, var(--sh-success) 30%, var(--sh-border));
    background: color-mix(in srgb, var(--sh-success) 5%, var(--sh-panel-bg));
}
.sh-task.done .sh-task-h b { text-decoration: line-through; color: var(--sh-text2); font-weight: 700; }
.sh-task.done .sh-task-d { opacity: .8; }
/* Việc dở TỒN ĐỌNG (trôi qua ≥ 2 ca) — viền tím để phân biệt với việc thường */
.sh-task.purple {
    border-color: color-mix(in srgb, var(--sh-purple) 42%, transparent);
    background: color-mix(in srgb, var(--sh-purple) 7%, var(--sh-panel-bg));
}
/* Tick box — to, dễ bấm trên mobile.
   Vùng BẤM (input) rộng hơn ô nhìn thấy (24px → 40px) để bấm trên
   mobile không bị trượt; phần hiển thị vẫn giữ 24px gọn gàng. */
.sh-tick-box { position: relative; flex-shrink: 0; width: 24px; height: 24px; margin-top: 1px; }
.sh-tick-box input {
    position: absolute; opacity: 0; cursor: pointer; margin: 0;
    left: -8px; top: -8px; width: calc(100% + 16px); height: calc(100% + 16px);
}
.sh-tick-ui {
    position: absolute; inset: 0; border-radius: 7px;
    border: 2px solid var(--sh-border); background: var(--sh-flat);
    display: flex; align-items: center; justify-content: center;
    transition: border-color .14s ease, background-color .14s ease;
    pointer-events: none;
}
/* Dấu tick: dùng icon <i class="fa-solid fa-check"> trong markup.
   ::after bị bỏ vì content:"\\2713" render ra chuỗi rác, và icon bị hiện
   cả khi CHƯA tick ⇒ 2 dấu tick chồng lên nhau. */
.sh-tick-ui::after { content: none; }
.sh-tick-ui i {
    font-size: 12px; line-height: 1; color: var(--sh-flat);
    opacity: 0; transform: scale(.5);
    transition: opacity .14s ease, transform .14s ease;
}
.sh-tick-box input:checked + .sh-tick-ui {
    background: var(--sh-accent); border-color: var(--sh-accent);
}
.sh-tick-box input:checked + .sh-tick-ui i { opacity: 1; transform: scale(1); }
.sh-tick-box input:focus-visible + .sh-tick-ui { outline: 2px solid var(--sh-accent); outline-offset: 2px; }

.sh-task-b { flex: 1; min-width: 0; }
.sh-task-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sh-task-h b { font-size: 12.5px; font-weight: 800; color: var(--sh-text); }
.sh-task-d { font-size: 11px; color: var(--sh-text2); margin-top: 4px; line-height: 1.5; }
.sh-task-m {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-top: 6px; font-size: 10.5px; color: var(--sh-muted);
}
.sh-task-m i { font-size: 9.5px; opacity: .75; margin-right: 2px; }

/* 2026-11-13 (QL): thẻ sửa chữa / bảo hành gọn — không tràn thông tin.
   - .sh-task-d-clamp: dòng mô tả lỗi bị cắt gọn 2 dòng (đầy đủ trong modal).
   - .sh-task-m-compact: hàng metadata CHỈ 3 chip ngắn nhất.
   - .sh-task-m-actions: hàng nút (chip "Chi tiết" + "Nhận máy về"). */
.sh-task-d-clamp {
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    overflow-wrap: anywhere;
}
.sh-task-m-compact { gap: 8px; }
.sh-task-m-compact span {
    max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sh-task-m-actions { gap: 8px; margin-top: 8px; }
.sh-task-m-actions .sh-btn { min-height: 32px; }

/* Modal chi tiết sửa chữa */
.sh-repair-detail .sh-grid { gap: 0; }
.sh-modal-sec { margin-top: 14px; }
.sh-modal-sec > b {
    display: block; font-size: 11.5px; font-weight: 800; color: var(--sh-text);
    margin-bottom: 8px;
}
.sh-repair-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px;
}
.sh-repair-gallery img {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: 10px; border: 1px solid var(--sh-border); background: var(--sh-flat);
}

/* Mobile: task full-width, tick 28px */
@media (max-width: 560px) {
    .sh-task { padding: 12px; }
    .sh-tick-box { width: 26px; height: 26px; }
    .sh-tick-box input { left: -9px; top: -9px; width: calc(100% + 18px); height: calc(100% + 18px); }
}

/* ============ SECTION TITLE trong modal ============ */
.sh-sec {
    font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
    color: var(--sh-text2); margin: 18px 0 9px;
    display: flex; align-items: center; gap: 7px;
}
.sh-sec:first-child { margin-top: 0; }
.sh-sec .n {
    margin-left: auto; font-size: 10px; padding: 1px 7px; border-radius: 999px;
    background: color-mix(in srgb, var(--sh-text) 7%, transparent); color: var(--sh-text2);
}

/* Tiêu đề phụ (cấp 2) — ví dụ "Máy xuất" / "Máy nhập" trong modal chi tiết
   phiếu. Nhỏ hơn .sh-sec, KHÔNG viết hoa toàn bộ để không tranh chấp
   phân cấp thị giác với .sh-sec. */
.sh-sub-sec {
    font-size: 11px; font-weight: 700; color: var(--sh-text2);
    margin: 12px 0 7px; display: flex; align-items: center; gap: 7px;
}
.sh-sub-sec::before {
    content: ""; width: 3px; height: 12px; border-radius: 2px;
    background: var(--sh-accent); opacity: .55; flex: 0 0 auto;
}

/* ============ TIMELINE / AUDIT ============ */
.sh-tl { display: grid; gap: 0; position: relative; padding-left: 18px; }
.sh-tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--sh-border); }
.sh-tl-i { position: relative; padding: 7px 0; }
.sh-tl-i::before {
    content: ""; position: absolute; left: -16px; top: 12px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--sh-accent); border: 2px solid var(--sh-flat);
}
.sh-tl-t { font-size: 12px; font-weight: 700; color: var(--sh-text); line-height: 1.5; }
.sh-tl-m { font-size: 11px; color: var(--sh-text2); margin-top: 2px; }

/* ============ CALLOUT ============ */
.sh-call {
    border-radius: var(--sh-r-md); padding: 11px 12px; font-size: 12px; line-height: 1.55;
    display: flex; gap: 9px; align-items: flex-start;
}
.sh-call i { margin-top: 2px; flex-shrink: 0; }
.sh-call.info { background: var(--sh-info-bg); border: 1px solid color-mix(in srgb, var(--sh-info) 30%, transparent); color: color-mix(in srgb, var(--sh-info) 80%, var(--sh-text)); }
.sh-call.warn { background: var(--sh-warning-bg); border: 1px solid color-mix(in srgb, var(--sh-warning) 32%, transparent); color: color-mix(in srgb, var(--sh-warning) 80%, var(--sh-text)); }
.sh-call.danger { background: var(--sh-danger-bg); border: 1px solid color-mix(in srgb, var(--sh-danger) 32%, transparent); color: color-mix(in srgb, var(--sh-danger) 80%, var(--sh-text)); }
.sh-call.ok { background: var(--sh-success-bg); border: 1px solid color-mix(in srgb, var(--sh-success) 28%, transparent); color: color-mix(in srgb, var(--sh-success) 80%, var(--sh-text)); }
.sh-call b { font-weight: 800; }

/* ============ LEGACY HISTORY ============ */
.sh-legacy-note {
    border: 1px dashed color-mix(in srgb, var(--sh-text) 26%, transparent);
    background: color-mix(in srgb, var(--sh-text) 4%, transparent);
    border-radius: var(--sh-r-md); padding: 11px 12px; font-size: 12px;
    color: var(--sh-text2); line-height: 1.6; display: flex; gap: 9px; align-items: flex-start;
    margin-bottom: 12px;
}
.sh-legacy-note i { margin-top: 2px; flex-shrink: 0; color: var(--sh-muted); }
.sh-legacy-note b { color: var(--sh-text); font-weight: 700; }
.sh-legacy-note code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
    background: color-mix(in srgb, var(--sh-text) 8%, transparent); padding: 1px 5px; border-radius: 5px;
}
.sh-old {
    border: 1px solid var(--sh-border); border-radius: var(--sh-r-lg);
    padding: 12px 13px; background: var(--sh-bg); margin-bottom: 9px;
}
.sh-old-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.sh-old-tag {
    font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
    padding: 2px 7px; border-radius: 6px;
    background: color-mix(in srgb, var(--sh-text) 7%, transparent); color: var(--sh-text2);
}
.sh-old-t { font-size: 13px; font-weight: 800; color: var(--sh-text); }
.sh-old-d { font-size: 11.5px; color: var(--sh-text2); line-height: 1.5; }
.sh-old-m {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
    margin-top: 8px; font-size: 10.5px; color: var(--sh-muted);
}

/* ============ TOOLBAR ============ */
.sh-toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px;
}
.sh-toolbar .sh-input, .sh-toolbar .sh-select {
    width: auto; min-width: 140px; padding: 7px 10px; font-size: 12px;
}
/* Ô chọn ngày (datepicker) trong toolbar: ô gốc bị ẩn, trigger được chèn
   cạnh nó. Trigger mặc định width:100% + min-width lớn ⇒ mỗi ô chiếm trọn
   1 dòng. Ép trigger trong toolbar gọn lại (auto width) để 2 ô ngày
   (Từ ngày → Đến ngày) nằm chung 1 hàng. */
.sh-toolbar .ghz-dp-trigger {
    width: auto;
    min-width: 110px;
    max-width: 150px;
    padding: 7px 9px;
    font-size: 12px;
    min-height: 32px;
}
/* Ô "Ngày" bọc trong <label class="sh-field"> cũng gọn lại. */
.sh-toolbar label > .ghz-dp-trigger {
    width: auto;
    min-width: 110px;
    max-width: 150px;
}
.sh-toolbar .ghz-dp-trigger .ghz-dp-icon { font-size: 11px; }
.sh-toolbar .ghz-dp-trigger .ghz-dp-caret { display: none; }
/* 2 ô ngày (từ → đến) luôn gom về 1 hàng, không wrap giữa chừng. */
.sh-toolbar .sh-daterange {
    display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap;
}
.sh-toolbar .sh-daterange > .ghz-dp-trigger { flex: 0 0 auto; }
@media (max-width: 560px) {
    .sh-toolbar .sh-input, .sh-toolbar .sh-select { flex: 1 1 140px; min-width: 0; }
    .sh-toolbar .sh-btn { flex: 1 1 auto; }
    /* Mobile: 2 ô ngày vẫn 1 hàng nhưng co lại cho vừa bề ngang. */
    .sh-toolbar .ghz-dp-trigger { min-width: 0; flex: 1 1 0; max-width: none; }
    .sh-toolbar .sh-daterange { flex: 1 1 100%; }
}

/* ============ MÀU CHỮ / DOT THEO THEME ============ */
.sh-t-ok { color: var(--sh-success) !important; }
.sh-t-bad { color: var(--sh-danger) !important; }
.sh-t-warn { color: var(--sh-warning) !important; }
.sh-t-accent { color: var(--sh-accent) !important; }
.sh-t-purple { color: color-mix(in srgb, var(--sh-purple) 76%, var(--sh-text)) !important; }
.sh-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.sh-dot.ok { background: var(--sh-success); }
.sh-dot.warn { background: var(--sh-warning); }
.sh-dot.danger { background: var(--sh-danger); }
.sh-dot.info { background: var(--sh-info); }
.sh-dot.mute { background: var(--sh-muted); }

/* ============ LỰA CHỌN LOẠI CẦN BÀN GIAO (việc / tiền / khách) ============ */
.sh-type {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
@media (max-width: 520px) { .sh-type { grid-template-columns: 1fr; } }
.sh-type-c {
    border: 1px solid var(--sh-border); background: var(--sh-flat);
    border-radius: var(--sh-r-md); padding: 10px 8px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    text-align: center; transition: border-color .15s ease, background-color .15s ease, transform .1s ease;
    color: inherit; -webkit-tap-highlight-color: transparent;
}
.sh-type-c:hover { border-color: color-mix(in srgb, var(--sh-accent) 45%, var(--sh-border)); }
.sh-type-c:active { transform: scale(.985); }
.sh-type-c .i {
    width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; font-size: 13px; background: color-mix(in srgb, var(--sh-text) 7%, transparent);
    color: var(--sh-text2); transition: background-color .15s ease, color .15s ease;
}
.sh-type-c .l { font-size: 11.5px; font-weight: 800; color: var(--sh-text); }
.sh-type-c .s { font-size: 10px; color: var(--sh-muted); line-height: 1.4; }
.sh-type-c.on { border-color: var(--sh-accent); background: var(--sh-accent-soft); }
.sh-type-c.on .i { background: var(--sh-accent-soft-2); color: var(--sh-accent); }
.sh-type-c.on .l { color: var(--sh-accent); }

/* ============ DANH SÁCH GHI BÀN GIAO (mục đã ghi) ============ */
.sh-rec-list { display: grid; gap: 8px; }
.sh-rec {
    border: 1px solid var(--sh-border); border-radius: var(--sh-r-md);
    padding: 10px 11px; background: var(--sh-flat); position: relative;
}
.sh-rec::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    border-radius: 3px 0 0 3px; background: var(--sh-text2);
}
.sh-rec.type-pending::before { background: var(--sh-warning); }
.sh-rec.type-deposit::before { background: var(--sh-info); }
.sh-rec.type-incident::before { background: var(--sh-danger); }
.sh-rec-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sh-rec-h > .sh-chip { flex: 0 0 auto; }
.sh-rec-t { font-size: 12.5px; font-weight: 800; color: var(--sh-text); line-height: 1.45; }
.sh-rec-x {
    width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px; border: 1px solid transparent;
    background: transparent; color: var(--sh-muted); cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.sh-rec-x:hover { background: var(--sh-danger-bg); color: var(--sh-danger); }
.sh-rec-d { font-size: 11.5px; color: var(--sh-text2); margin-top: 4px; line-height: 1.5; }
.sh-rec-kv { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 7px; font-size: 11px; color: var(--sh-muted); }
.sh-rec-kv b { color: var(--sh-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.sh-rec-kv .k { color: var(--sh-text2); }

/* ============ BẢNG QUYỀN (ADMIN) ============ */
.sh-table .ctr { text-align: center; }
.sh-tick {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 7px; font-size: 10px;
    background: color-mix(in srgb, var(--sh-text) 6%, transparent);
    color: var(--sh-muted); border: 1px solid var(--sh-border);
}
.sh-tick.on {
    background: var(--sh-success-bg); color: var(--sh-success);
    border-color: color-mix(in srgb, var(--sh-success) 38%, transparent);
}
.sh-select.sh-mini { padding: 5px 8px; font-size: 11.5px; min-width: 130px; }

/* ============ THANH QUYỀN ADMIN ============ */
.sh-perm-bar {
    border: 1px solid color-mix(in srgb, var(--sh-purple) 40%, transparent);
    background: color-mix(in srgb, var(--sh-purple) 7%, transparent);
    border-radius: var(--sh-r-lg); padding: 14px; margin-bottom: 18px;
}
.sh-perm-bar-h {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 13px; margin-bottom: 12px; color: var(--sh-text);
}
.sh-perm-bar-h > i { color: var(--sh-purple); }
.sh-perm-bar-h .sh-role-badge {
    background: color-mix(in srgb, var(--sh-purple) 16%, transparent);
    color: color-mix(in srgb, var(--sh-purple) 78%, var(--sh-text));
    border-color: color-mix(in srgb, var(--sh-purple) 34%, transparent);
}
.sh-perm-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px) { .sh-perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .sh-perm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sh-perm {
    border: 1px solid var(--sh-border); border-radius: var(--sh-r-md);
    background: var(--sh-flat); padding: 11px 12px;
}
.sh-perm-h {
    display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800;
    color: var(--sh-text); margin-bottom: 8px;
}
.sh-perm-h i { color: var(--sh-accent); }
.sh-perm ul { margin: 0; padding-left: 16px; display: grid; gap: 5px; }
.sh-perm li { font-size: 11.5px; color: var(--sh-text2); line-height: 1.5; }
.sh-perm li::marker { color: var(--sh-muted); }
.sh-perm li b { color: var(--sh-text); font-weight: 700; }

/* ============ MISC ============ */
.sh-empty { text-align: center; padding: 34px 16px; color: var(--sh-text2); font-size: 12.5px; }
.sh-empty i { display: block; font-size: 30px; margin-bottom: 10px; opacity: .35; }

/* ============ ẨN/HIỆN (dùng cho các form theo loại bàn giao) ============ */
.ghz-shift .hidden { display: none !important; }

/* ============ Ô TICK QUYỀN (bảng phân quyền) ============ */
.sh-perm-box {
    width: 17px; height: 17px; cursor: pointer; accent-color: var(--sh-accent);
    vertical-align: middle;
}
.sh-table th.ctr, .sh-table td.ctr { text-align: center; }

/* ============ CHIP TRẠNG THÁI BÁO (alias của .danger) ============ */
.sh-chip.bad { background: var(--sh-danger-bg); color: var(--sh-danger); border-color: color-mix(in srgb, var(--sh-danger) 32%, transparent); }
.sh-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--sh-text2); margin-top: 10px; }
.sh-legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sh-mobile-note { display: none; font-size: 11px; color: var(--sh-text2); margin-top: 8px; }
@media (max-width: 640px) { .sh-mobile-note { display: block; } }

/* =====================================================================
   MODAL
   ---------------------------------------------------------------------
   LỖI DESKTOP ĐÃ SỬA: overlay dùng position:fixed, nhưng nếu bất kỳ
   ancestor nào có `transform` / `filter` / `backdrop-filter` / `contain`
   (app dùng animation `tabSlideIn` trên .tab-content) thì `fixed` bị
   khoá lại trong ancestor đó ⇒ modal bị "chôn" trong tab, co như hộp
   thoại lỗi thay vì overlay phủ toàn màn hình.
   ⇒ 2 lớp phòng thủ:
     1) JS: portal overlay ra thẳng `document.body` (xem sh-portal-overlays).
        Overlay tự mang class `ghz-shift` để vẫn nhận token theme.
     2) CSS: z-index 1100 (> header 100, app modal 1000) + inset 0.
   ===================================================================== */
.sh-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 7, 10, .78);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 1100; display: none; align-items: center; justify-content: center; padding: 16px;
    overscroll-behavior: contain;
}
.sh-overlay.on { display: flex; }
.sh-modal {
    width: 100%; max-width: 720px;
    /* CHIỀU CAO: modal dài đang chiếm gần hết màn hình ⇒ thu lại.
       - max-height 82dvh: vẫn đọc thoải mái mà không "nuốt" trang.
       - padding-bottom của overlay cộng thêm khoảng chừa cho mobile tab bar
         (--ghz-mobile-tabbar-space do JS đo) ⇒ modal KHÔNG bị tab bar đè. */
    max-height: calc(82dvh - 32px);
    /* Nền PHẲNG (--sh-flat) + blur ⇒ nội dung luôn đọc rõ, không bị
       gradient của theme "rò" xuyên qua (theme pastel có alpha 0.48). */
    background: var(--sh-flat);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-r-xl); display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, .7);
}
.sh-modal.narrow { max-width: 560px; }
.sh-modal-h {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 16px 18px; border-bottom: 1px solid var(--sh-border); flex-shrink: 0;
}
.sh-modal-t { font-size: 16px; font-weight: 800; margin: 0; color: var(--sh-text); }
.sh-modal-s { font-size: 11.5px; color: var(--sh-text2); margin: 4px 0 0; }
.sh-x {
    width: 36px; height: 36px; border-radius: var(--sh-r-sm); border: 1px solid transparent;
    background: transparent; color: var(--sh-text2); cursor: pointer; font-size: 16px; flex-shrink: 0;
}
.sh-x:hover { background: color-mix(in srgb, var(--sh-text) 8%, transparent); color: var(--sh-text); }
.sh-modal-b { padding: 16px 18px; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.sh-modal-f {
    padding: 12px 18px; border-top: 1px solid var(--sh-border);
    display: flex; gap: 9px; justify-content: flex-end; flex-shrink: 0;
    background: var(--sh-flat);
}
.sh-modal-f .left { margin-right: auto; font-size: 11px; color: var(--sh-text2); align-self: center; }
/* Modal nhỏ (nhập lý do / xác nhận / form) — không cần bề ngang 720px. */
#shModalReason .sh-modal,
#shModalConfirm .sh-modal,
#shModalForm .sh-modal,
#shModalEditItem .sh-modal,
#shModalNote .sh-modal {
    max-width: 460px;
}
#shModalConfirm .sh-modal-b,
#shModalReason .sh-modal-b { padding: 16px 18px; }
/* Nhóm nút hành động (dùng cho modal chi tiết) */
.sh-modal-actions { display: flex; gap: 9px; align-items: center; margin-left: auto; }
.sh-modal-actions .sh-btn { white-space: nowrap; }

/* Mobile: modal trở thành bottom-sheet full-height */
@media (max-width: 640px) {
    /* Chừa chỗ cho mobile tab bar ở đáy (biến do JS đo) ⇒ modal KHÔNG bị đè.
       - overlay padding-bottom = chiều cao tab bar → bottom-sheet dừng CAO hơn
         mép dưới ⇒ nút ở footer bấm được, không bị thanh tab che.
       - max-height tính theo phần không gian còn lại (100dvh - tabbar - 12px).
       - env(safe-area-inset-bottom) để nút không dính vào vùng gesture bar. */
    .sh-overlay {
        padding: 0 0 calc(var(--ghz-mobile-tabbar-space, 66px) + env(safe-area-inset-bottom, 0px));
        align-items: flex-end;
    }
    .sh-modal {
        max-width: 100%;
        /* Giới hạn chiều cao để modal KHÔNG nuốt trọn màn hình:
           76dvh trừ khoảng chừa tab bar → bottom-sheet chiếm ~3/4 màn hình,
           phần trên vẫn thấy context. */
        max-height: calc(76dvh - var(--ghz-mobile-tabbar-space, 66px) * .25);
        border-radius: var(--sh-r-xl) var(--sh-r-xl) 0 0;
        border-bottom: 0;
    }
    .sh-modal-h { padding: 14px 15px; }
    .sh-modal-b { padding: 14px 15px; }
    .sh-modal-f {
        padding: 11px 15px; flex-wrap: wrap;
        padding-bottom: max(11px, env(safe-area-inset-bottom));
    }
    .sh-modal-f .left { flex: 1 0 100%; margin-bottom: 2px; }
    .sh-modal-f .sh-btn { flex: 1 1 auto; }
    /* Modal chi tiết: nút chính full-width, "Đóng" ẩn (đã có nút X ở góc
       trên) ⇒ footer gọn 1 hàng. (id thật của modal là shModalDetail —
        #mDetail không tồn tại ⇒ rule cũ không bao giờ áp dụng.) */
    #shModalDetail .sh-modal-f { flex-wrap: nowrap; }
    #shModalDetail .sh-modal-f .left { display: none; }
    #shModalDetail .sh-modal-f #detailActions {
        order: -1; flex: 1 1 auto; display: flex; gap: 8px;
    }
    #shModalDetail .sh-modal-f #detailActions .sh-btn { flex: 1 1 auto; justify-content: center; }
    #shModalDetail .sh-modal-f > .sh-btn.ghost { display: none; }
}

/* =====================================================================
   THEME-SPECIFIC TUNING
   ===================================================================== */
/* Theme sáng: cột dính của bảng phải nền sáng để không bị nền tối lọt */
html[data-theme="mint-fresh"] .ghz-shift .sh-table th:first-child,
html[data-theme="peach-cream"] .ghz-shift .sh-table th:first-child,
html[data-theme="lavender-mist"] .ghz-shift .sh-table th:first-child,
html[data-theme="sky-blue"] .ghz-shift .sh-table th:first-child,
html[data-theme="sunset"] .ghz-shift .sh-table th:first-child,
html[data-theme="pink-bloom"] .ghz-shift .sh-table th:first-child,
html[data-theme="cherry-blossom"] .ghz-shift .sh-table th:first-child,
html[data-theme="coffee-cream"] .ghz-shift .sh-table th:first-child,
html[data-theme="rose-pastel"] .ghz-shift .sh-table th:first-child,
html[data-theme="aurora-pastel"] .ghz-shift .sh-table th:first-child,
html[data-theme="purple-haze"] .ghz-shift .sh-table th:first-child,
html[data-theme="neumorphism-wellness"] .ghz-shift .sh-table th:first-child,
html[data-theme="mint-fresh"] .ghz-shift .sh-table td:first-child,
html[data-theme="peach-cream"] .ghz-shift .sh-table td:first-child,
html[data-theme="lavender-mist"] .ghz-shift .sh-table td:first-child,
html[data-theme="sky-blue"] .ghz-shift .sh-table td:first-child,
html[data-theme="sunset"] .ghz-shift .sh-table td:first-child,
html[data-theme="pink-bloom"] .ghz-shift .sh-table td:first-child,
html[data-theme="cherry-blossom"] .ghz-shift .sh-table td:first-child,
html[data-theme="coffee-cream"] .ghz-shift .sh-table td:first-child,
html[data-theme="rose-pastel"] .ghz-shift .sh-table td:first-child,
html[data-theme="aurora-pastel"] .ghz-shift .sh-table td:first-child,
html[data-theme="purple-haze"] .ghz-shift .sh-table td:first-child,
html[data-theme="neumorphism-wellness"] .ghz-shift .sh-table td:first-child {
    background: #fff;
}

/* Neumorphism: bỏ border cứng, dùng shadow hai chiều */
html[data-theme="neumorphism-wellness"] .ghz-shift {
    --sh-border: color-mix(in srgb, var(--ghz-text-primary) 8%, transparent);
    --sh-border-soft: color-mix(in srgb, var(--ghz-text-primary) 6%, transparent);
}
html[data-theme="neumorphism-wellness"] .ghz-shift .sh-item,
html[data-theme="neumorphism-wellness"] .ghz-shift .sh-shift,
html[data-theme="neumorphism-wellness"] .ghz-shift .sh-pay,
html[data-theme="neumorphism-wellness"] .ghz-shift .sh-old {
    box-shadow: 4px 4px 9px rgba(120, 120, 120, .28), -4px -4px 9px rgba(255, 255, 255, .65);
    border-color: transparent;
}
html[data-theme="neumorphism-wellness"] .ghz-shift .sh-metric {
    box-shadow: inset 3px 3px 7px rgba(120, 120, 120, .2), inset -3px -3px 7px rgba(255, 255, 255, .6);
    border-color: transparent;
}

/* =====================================================================
   2026-11-10: MOBILE — CARD NỘI DUNG DÀI ĐƯỢC CUỘN RIÊNG
   ---------------------------------------------------------------------
   Vấn đề: card chứa nội dung dài trên mobile bị kéo dài vô hạn
   (danh sách ngày lịch sử, danh sách ca, tiền ra vào, mục bàn giao,
   ghi chú, mô tả nhật ký…) ⇒ phải vuốt rất xa mới tới cuối, dễ mất
   phần đầu & tốn pin vì render quá nhiều node.
   Cách sửa:
     1. Card chứa DANH SÁCH (`.sh-list`, `.sh-tasklist`, `.sh-rec-list`,
        `.sh-mcard-grid`) → giới hạn chiều cao + CUỘN DỌC RIÊNG.
     2. Card chứa TEXT DÀI trong 1 mục (`.sh-item-d`, `.sh-task-d`,
        `.sh-card-reason`, `.sh-mcard-sub`, giá trị dài của
        `.sh-mcard-r.sh-mcard-stack`) → giới hạn chiều cao + cuộn riêng
        (KHÔNG cắt chữ, không dùng line-clamp ⇒ không mất thông tin).
     3. Không dùng `overscroll-behavior: contain` ⇒ khi cuộn hết vùng
        con, trạng thái cuộn tiếp tục "nhảy" ra vùng cha (modal/trang)
        ⇒ không bị kẹt cuộn (scroll trap) trên mobile.
   ===================================================================== */
@media (max-width: 720px) {
    /* ---- 1. Danh sách card → cuộn dọc riêng ---- */
    .sh-list,
    .sh-tasklist,
    .sh-rec-list,
    .sh-mcard-grid {
        max-height: var(--sh-list-max-h-m, 460px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        padding-bottom: 4px;
        scrollbar-width: thin;
        scrollbar-color: color-mix(in srgb, var(--sh-text) 22%, transparent) transparent;
    }
    .sh-list::-webkit-scrollbar,
    .sh-tasklist::-webkit-scrollbar,
    .sh-rec-list::-webkit-scrollbar,
    .sh-mcard-grid::-webkit-scrollbar { width: 5px; }
    .sh-list::-webkit-scrollbar-thumb,
    .sh-tasklist::-webkit-scrollbar-thumb,
    .sh-rec-list::-webkit-scrollbar-thumb,
    .sh-mcard-grid::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--sh-text) 22%, transparent);
        border-radius: 999px;
    }
    .sh-list::-webkit-scrollbar-track,
    .sh-tasklist::-webkit-scrollbar-track,
    .sh-rec-list::-webkit-scrollbar-track,
    .sh-mcard-grid::-webkit-scrollbar-track { background: transparent; }

    /* ---- 2. Text dài trong 1 card → vùng cuộn riêng ---- */
    .sh-item-d,
    .sh-task-d,
    .sh-card-reason,
    .sh-mcard-sub,
    .sh-mcard-r.sh-mcard-stack > span:last-child {
        max-height: 9em;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overflow-wrap: anywhere;
        scrollbar-width: thin;
    }
    .sh-item-d::-webkit-scrollbar,
    .sh-task-d::-webkit-scrollbar,
    .sh-card-reason::-webkit-scrollbar,
    .sh-mcard-sub::-webkit-scrollbar,
    .sh-mcard-r.sh-mcard-stack > span:last-child::-webkit-scrollbar { width: 4px; }
    .sh-item-d::-webkit-scrollbar-thumb,
    .sh-task-d::-webkit-scrollbar-thumb,
    .sh-card-reason::-webkit-scrollbar-thumb,
    .sh-mcard-sub::-webkit-scrollbar-thumb,
    .sh-mcard-r.sh-mcard-stack > span:last-child::-webkit-scrollbar-thumb {
        background: color-mix(in srgb, var(--sh-text) 20%, transparent);
        border-radius: 999px;
    }

    /* Tiêu đề dài: cho xuống dòng thay vì tràn ngang */
    .sh-item-t,
    .sh-mcard-t { overflow-wrap: anywhere; word-break: break-word; }

    /* ---- 3. Trong modal: KHÔNG cuộn lồng ----
       Modal đã có vùng cuộn riêng (.sh-modal-b) ⇒ danh sách bên trong để
       chảy tự do trong modal, tránh 2 vùng cuộn lồng nhau (rất khó vuốt
       trên mobile: tay chạm vào danh sách con sẽ cuộn con thay vì modal). */
    .sh-modal-b .sh-list,
    .sh-modal-b .sh-tasklist,
    .sh-modal-b .sh-rec-list {
        max-height: none;
        overflow-y: visible;
        padding-bottom: 0;
    }
}

/* =====================================================================
   2026-11-09: ĐÃ GỠ toàn bộ CSS của CỔNG GIAO CA BẮT BUỘC (.sh-cp-gate*)
   theo yêu cầu — không còn overlay chặn NV khi đăng nhập lần đầu trong ngày.
   ===================================================================== */

/* =====================================================================
   ACCESSIBILITY / MOTION
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
    .ghz-shift *, .ghz-shift *::before, .ghz-shift *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

.ghz-shift :focus-visible {
    outline: 2px solid var(--sh-accent);
    outline-offset: 2px;
    border-radius: 6px;
}
