* {
    box-sizing: border-box;
}

html.preload body {
    display: none !important;
}

html,
body,
input,
textarea,
select,
button {
    margin: 0;
    height: 100%;
    padding: 0;
    font-family: "Exo 2", sans-serif;
    font-optical-sizing: auto;
    color: #3e3e3e;
    font-weight: 500;
    transition: background 0.3s ease, color 0.3s ease;
}

:target {
    scroll-margin-top: 80px;
    /* điều chỉnh cho vừa với chiều cao <th> sticky */
}

.row-hidden {
    display: none !important;
}

.readonly-select {
    pointer-events: none;
    background-color: #eee;
    color: #555;
}

input:focus,
textarea:focus {
    background-color: #fffadd !important;
}



@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.pointer {
    cursor: pointer !important;
    user-select: none;
    /* ❌ không cho select chữ */
    -webkit-user-select: none;
    -moz-user-select: none;
}

.pointer[role="button"],
.pointer[tabindex] {
    cursor: pointer !important;
}


.container {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    min-height: 100vh;
}

.main {
    background: #e8e8e8;
}


.main-content-card {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding-bottom: 10px;
}

.topbar {
    background: rgba(0, 81, 128, 0.965);
    backdrop-filter: blur(10px);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    padding: 10px;
    gap: 10px;
}


.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 5px;
}

.theme-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

select,
textarea,
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="file"] {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid #6cace4;
    font-size: 14px;
    background: #fdfdfd;
    color: #333;
    max-width: 100%;
    box-sizing: border-box;
}

input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
select {
    height: 30px;
}


select:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: #0077b6;
    outline: none;
    background: #fdfff3;
}

.batchInput {
    font-size: 20px !important;
    font-weight: bold !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    height: 50px !important;
    text-align: center !important;
    width: 95% !important;
    display: inline-block !important;
    padding: 2px !important;
}


.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 5px;
    background: #d8e4ed;
}


.stat-box {
    background: #ffffff;
    color: #0077b6;
    padding: 5px 15px;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #00b4d8;
}


table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: fixed;
}


th,
td {
    padding: 10px 5px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td.description {
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

/* bỏ viền dọc ở cột cuối cho đẹp */
tr:last-child td {
    border-bottom: none !important;
}

tr.row-error input {
    border: 1px solid red !important;
    background: #ffecec;
}

tbody tr:hover {
    background: #f3faff;
    transition: background 0.2s ease;
}

.no-hover tbody tr:hover {
    background: inherit !important;
    cursor: default;
}

td img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

td label {
    margin-bottom: 4px;
}



thead th {
    position: sticky;
    top: 0;
    background: rgb(59, 130, 172);
    ;
    /* hoặc white */
    z-index: 9;
    color: #fff;
}


.no-border th,
.no-border td {
    border: 0;
}

/* ===== TABLE FULL BORDER STYLE ===== */
.table-bordered {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ccc;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #ccc;
    padding: 8px !important;
    text-align: left;
    font-size: 14px;
}

.table-bordered td:first-child {
    padding-left: 8px !important;
}

.table-bordered th {
    background: #f5f6fa;
    font-weight: 600;
}

.table-bordered tr:nth-child(even) td {
    background: #fafafa;
}

.table-bordered tr:hover td {
    background: #f0f8ff;
}

/* ===== DARK MODE ===== */






/* Bảng lương Payroll */

.payroll-row {
    display: grid;
    grid-template-columns: 64% 34%;
    /* 👈 Tỉ lệ */
    gap: 10px;
    align-items: stretch;
}

@media (max-width: 768px) {
    .payroll-row {
        grid-template-columns: 1fr;
        /* 👈 Mobile: xuống dòng */
    }
}

.wrapper-payroll {
    position: relative;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 5px;
    padding: 10px;
}

.wrapper-payroll canvas {
    display: block;
    width: 100% !important;
    /* ✨ Quan trọng */
    height: auto !important;
    /* Cho co giãn theo tỉ lệ */
}


.table-payroll {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    table-layout: fixed;
}

.table-payroll th,
.table-payroll td {
    padding: 4px;
    border: 0;
    border-bottom: 1px solid #eee;
    font-size: 15px;
    padding: 10px 5px;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
}

.table-payroll tr.payroll-header {
    background: #dcf0fe;
}




.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.form-item {
    display: flex;
    flex-direction: column;
}

.form-item.full {
    grid-column: 1 / -1;
}

.form-item label {
    font-weight: 600;
    margin-bottom: 5px;
}

@media (max-width: 480px) {
    .form-item label {
        font-size: 14px;
    }
}

/* Định nghĩa bảng không tự ẩn chữ */
.table-nowrap {
    table-layout: auto;
    /* Để bảng tự động điều chỉnh theo nội dung */
    white-space: nowrap;
    /* Cấm tự động xuống dòng */
    overflow-x: auto;
    /* Nếu cần thiết, có thể kéo ngang để xem nội dung */
}

/* Cấu trúc cột để đảm bảo bảng mở rộng */
.table-nowrap td,
.table-nowrap th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nowrap {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    word-break: break-word;
}

.progress-box .progress-container {
    height: 15px;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
}

.progress-container {
    height: 8px;
    background: #cecece;
    border-radius: 10px;
    overflow: hidden;
    width: 98%;
}

.progress-bar {
    height: 100%;
    background: #01be04;
}

.filter-option {
    display: inline-block;
    background: #f2f2f2;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 4px 10px;
    margin: 2px 2px 2px 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: normal;
    /* Cho phép xuống dòng */
    user-select: none;
}

.filter-option:hover {
    background: #e0f0ff !important;
    border-color: #66aaff !important;
    color: #0066cc !important;
}

.filter-option.active {
    background: #007bff !important;
    border-color: #006fe6 !important;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 0 4px rgba(0, 123, 255, 0.4) !important;
}

.filter-option:active {
    transform: scale(0.97) !important;
}


/* ----------- BASE DESKTOP (≥900px) ----------- */
/* Sidebar luôn cố định cạnh trái, cao bằng màn hình */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    /* top:0; left:0; bottom:0 */
    width: 180px;
    background: rgb(0, 81, 128);
    color: #fff;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    /* header | profile | menu(scroll) | footer */
    z-index: 2000;

    /* slide in/out mượt nếu đang dùng off-canvas */
    transform: translateX(0);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}

/* Chỉ phần menu ở giữa được scroll; footer & header luôn “đặt dưới/đặt trên” đúng chỗ */
.sidebar-menu {
    overflow: auto;
    min-height: 0;
    padding-block: 6px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Footer KHÔNG fixed, KHÔNG overlay: nằm ở hàng 3, luôn ở đáy sidebar */
.sidebar-footer {
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, .7);
    border-top: 1px solid rgba(255, 255, 255, .12);
    flex-shrink: 0;
    /* dư phòng nếu bạn đổi sang flex sau này */
}

/* Off-canvas trên màn nhỏ (nếu có) */
body.sidebar-closed .sidebar {
    transform: translateX(-100%);
}

.sidebar-toggle {
    display: none;
}

/* ----------- MOBILE & TABLET PORTRAIT (<900px) ----------- */
@media (max-width: 899px) {

    /* Sidebar mặc định ẩn */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s ease;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
        overflow-y: auto;
        /* cho phép cuộn nếu menu dài */
        z-index: 2000;
    }

    /* Khi mở sidebar (body có class sidebar-open) */
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Main chiếm toàn màn hình */
    .main {
        margin-left: 0;
        width: 100%;
    }
}

/* ----------- PC / TABLET LANDSCAPE (≥900px) ----------- */
@media (min-width: 900px) {
    .sidebar {
        transform: none;
        /* luôn hiển thị */
    }

    .sidebar-toggle {
        display: none;
    }

    .main {
        margin-left: 180px;
        width: calc(100% - 180px);
    }
}

/* ----------- Tùy chọn: màn hình thấp ----------- */
@media (max-height: 480px) {
    .sidebar-footer {
        padding: 6px 8px;
        font-size: 12px;
    }

    .sidebar-footer img {
        max-width: 64px;
    }
}

/* ----------- MOBILE & TABLET (BOTTOM BAR) ----------- */
@media (max-width: 899px) {

    /* Thanh bar cố định ở đáy màn hình */
    .bottom-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        padding: 0 10px;
        width: 100%;
        height: 52px;
        background: rgba(0, 81, 128, 0.97);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1900;
        box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(6px);
        transition: opacity 0.35s ease, transform 0.35s ease;
        /* 🪄 smooth */
    }


    /* Link chung trong bottom bar */
    .bottom-bar .bar-link {
        color: white;
        text-decoration: none;
        font-size: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 52px;
        height: 52px;
        transition: background 0.25s ease, transform 0.15s ease;
    }

    .bottom-bar .bar-link:hover {
        background: #ffffff22;
    }

    /* Nút toggle ở giữa */
    .bottom-bar .sidebar-toggle {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 35px;
        height: 35px;
        border-radius: 8px;
        background: #ffffff22;
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.3);
        font-size: 22px;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
        transition: background 0.3s ease, transform 0.15s ease;
    }

    .bottom-bar .sidebar-toggle:hover {
        background: #ffffff33;
    }

    .bottom-bar .bar-link.active {
        background: rgba(255, 255, 255, 0.25);
        transition: all 0.2s ease;
    }


    /* Khi sidebar mở => ẩn bottom bar bằng hiệu ứng slide & fade */
    body.sidebar-open .bottom-bar {
        opacity: 0;
        transform: translateY(100%);
        /* 🧊 trượt xuống mượt */
        pointer-events: none;
    }

    /* Khi sidebar đóng lại => bottom bar trượt ngược lên */
    body:not(.sidebar-open) .bottom-bar {
        opacity: 1;
        transform: translateY(0);
    }

    /* Đẩy nội dung chính lên để không bị bottom bar che */
    .main {
        padding-bottom: 60px;
    }
}

/* ----------- PC (ẩn bottom bar) ----------- */
@media (min-width: 900px) {
    .bottom-bar {
        display: none;
    }
}


.sidebar-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 7px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}


.right-actions {
    display: flex;
    gap: 6px;
}

.left-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-header-actions .button {
    background: transparent;
    border: none;
    color: white;
    font-size: 13px;
    padding: 2px;
    cursor: pointer;
}

.sidebar-header-actions .button:hover {
    color: #90e0ef;
}


.sidebar-profile {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    padding: 10px 0;
}

.sidebar-profile .name {
    font-weight: bold;
    margin-top: 6px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    /* Bóng chữ nhẹ */
}

.sidebar a {
    padding: 6px 20px;
    color: white;
    text-decoration: none;
    transition: background 0.3s, color 0.3s;
    border-left: 4px solid transparent;
    margin: 0 5px 1px 5px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar a:hover,
.sidebar a.active {
    background: rgba(255, 255, 255, 0.15);
    border-left: 4px solid #90e0ef;
    color: #90e0ef;
}

.sidebar a.active {
    font-weight: bold;
}

.sidebar a.selected {
    background: rgba(255, 255, 255, 0.15);
    border-left: 4px solid #90e0ef;
    color: #90e0ef;
    font-weight: bold;
}


.page-not-found {
    padding: 40px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #d90429;
    background: #ffecec;
    border: 1px solid #f5b5b5;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    margin: 40px auto;
    width: 350px;
}


/* ===================== PAGINATION ===================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 20px auto;
    padding: 5px;
    font-size: 15px;
    user-select: none;
}

.pagination a {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f2f5f8;
    color: #004b80;
    text-decoration: none;
    border: 1px solid #d0d9e0;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: #0078d4;
    color: #fff !important;
    border-color: #0078d4;
}

.pagination a.active {
    background: #0078d4 !important;
    color: #fff !important;
    font-weight: 600;
    cursor: default;
}

.pagination a.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* 🌙 DARK MODE */



/* 🔹 Responsive tweak */
@media (max-width: 600px) {
    .pagination {
        gap: 4px;
        font-size: 14px;
    }

    .pagination a {
        padding: 5px 9px;
    }
}

.text-bold {
    font-weight: bold;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-white {
    color: #ffffff !important;
}


.text-blue {
    color: #0077b6 !important;
}


.text-green {
    color: #2e8b57 !important;
}

.text-gray {
    color: #666666 !important;
}


.text-orange {
    color: #ff8533 !important;
}

.text-red {
    color: #d90429 !important;
}

.xsmall-text {
    font-size: 12px;
}

.small-text {
    font-size: 14px;
}

.medium-text {
    font-size: 16px;
}

.large-text {
    font-size: 20px;
}

.xlarge-text {
    font-size: 24px;
}

.xxlarge-text {
    font-size: 28px;
}

.bold600 {
    font-weight: 600;
}

.bold700 {
    font-weight: 700;
}

.bold800 {
    font-weight: 800;
}

/* CSS chung cho Button */
/* BASE BUTTON STYLE */
.button {
    display: inline-block;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}

/* SIZE */
.button.xsmall {
    font-size: 12px;
    padding: 1px 5px;
}

.button.small {
    font-size: 13px;
    padding: 5px 8px;
}

.button.medium {
    font-size: 14px;
    padding: 6px 14px;
}

.button.big {
    font-size: 18px;
    padding: 5px 10px;
}

/* COLOR THEMES */
.button.red {
    background-color: #e63946;
    color: white;
}

.button.green {
    background-color: #2a9d8f;
    color: white;
}

.button.blue {
    background-color: #0077b6;
    color: white;
}

.button.gray {
    background-color: #adb5bd;
    color: white;
}

.button.orange {
    background-color: #ff8533;
    color: white;
}

.button.purple {
    background-color: #e600ac;
    color: white;
}

.button.transparent {
    background: transparent;
    border: none;
    color: #ffffff;
    padding: 2px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.button.transparent:hover {
    color: #ff8533;
}

/* HOVER */
.button.red:hover {
    background-color: #c62e3c;
}



.button.gray:hover {
    background-color: #888;
}

.button.orange:hover {
    background-color: #d98e51;
}

.button {
    color: white;
    text-decoration: none;
}

.button:hover {
    color: white;
}

.button.transparent:hover {
    color: #90e0ef;
}

/* DARK MODE */




/* CSS CHO INPUT */
.input.small.tcenter {
    width: 50px;
    padding: 2px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 6px;
    height: 34px;
}

.input-cell {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    padding: 6px !important;
}

.input-cell input {
    width: 40px;
    display: inline-block;
    text-align: center;
}

/* ============================ */
/* STYLES CHO THẺ <a> CHUNG TRONG MAIN CONTENT */
/* ============================ */

.main a,
.main-content-card a,
.scrollable a,
.content a {
    color: #0077b6;
    text-decoration: none;
    transition: color 0.2s ease;
}

.main a:hover,
.main-content-card a:hover,
.scrollable a:hover,
.content a:hover {
    color: #002e47;
    text-decoration: none;
}

.main a:focus,
.main-content-card a:focus,
.scrollable a:focus,
.content a:focus {
    outline: none;
    text-decoration: none;
}



a.button {
    color: white !important;
    text-decoration: none;
}

a.button:hover {
    color: white !important;
}

/* CSS cho header của đơn hàng */
#custom-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 10px;
    font-size: 16px;
    border-radius: 5px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 9999;
    display: none;
}

.order-header-grid.bigfont-mode {
    padding: 10px;
    margin: 0 10px 5px 10px;
    text-align: justify;
    font-size: 0;
    /* chống khoảng trắng thừa */
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    min-height: 50px;
    background: linear-gradient(to top, #bbdcff, #ffffff);
}

.order-header-grid.bigfont-mode::after {
    content: "";
    display: inline-block;
    width: 100%;
}

.order-header-grid.bigfont-mode>div {
    display: inline-block;
    font-size: 14px;
    min-width: 120px;
    white-space: nowrap;
    cursor: pointer;
}

.order-header-grid.bigfont-mode span {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-header-grid.bigfont-mode strong {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    word-break: break-word;
}

.order-header-grid.bigfont-mode strong:hover {
    color: #0077b6;
}

/* ✅ Dark mode */



.finance-col {
    transition: all 0.3s ease;
}

/* CSS cho các tabs menu của đơn hàng background: #e3eef8 .tab color: #555 */
.order-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
    background: rgba(0, 81, 128, 0.956);
    padding: 5px;
    position: relative;
    z-index: 10;
    /* đảm bảo trên mọi tab-content */
    overflow-x: visible;
    /* ✅ FIX dropdown bị che */
    overflow-y: visible;
    /* ✅ cần nếu dropdown mở xuống */
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

/* ✅ Dark mode */


.order-tabs .tab {
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    color: #fcfcfc;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    /* ❌ không cho select chữ */
    -webkit-user-select: none;
    -moz-user-select: none;
}

.order-tabs .tab:hover {
    color: #96dfff;
    border-color: #007bff;
}

.order-tabs .tab.active {
    color: #96dfff;
    border-color: #007bff;
}

/* Dropdown menu trong order-tabs */
.order-tabs .dropdown-menu {
    display: inline-flex;
    align-items: stretch;
}

.order-tabs .dropdown-menu .menu-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    color: #fcfcfc;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    height: 100%;
    box-sizing: border-box;
}

.order-tabs .dropdown-menu .menu-trigger:hover,
.order-tabs .dropdown-menu .menu-trigger.active {
    color: #96dfff;
    border-color: #007bff;
}


/* Active state cho menu items trong dropdown */
.dropdown-menu .menu-content a.active {
    background: #e0f0ff;
    color: #007bff;
    font-weight: 600;
}


.order-tab-content {
    display: none;
    z-index: 0;
}

.order-tab-content.active {
    display: block;
}

/* Dropdown Menu Styles */
/* ===== Base style giữ nguyên vibe hiện tại ===== */
.dropdown-menu {
    position: relative;
    display: inline-block;
    z-index: 20;
}

/* Nút trigger sẽ là anchor */
.dropdown-menu .menu-trigger {
    /* để làm anchor */
    anchor-name: --trigger;
    cursor: pointer;
}

/* Menu ẩn mặc định */
.dropdown-menu .menu-content {
    display: none;
    position: absolute;
    min-width: 180px;
    width: max-content;
    max-width: min(90vw, 480px);
    /* chống tràn ngang viewport */
    max-height: min(60vh, 480px);
    /* chống tràn dọc viewport */
    overflow: auto;
    /* nhiều item thì cuộn */
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    border-radius: 6px;
    padding: 5px;
    text-align: left;

    /* animation nhẹ */
    opacity: 0;
    transform: scale(.98);
    transition: opacity .15s ease, transform .15s ease;

    margin-top: 0;
    top: 100%;
    left: 0;
}

/* Tạo vùng đệm vô hình để giữ hover khi di chuột từ trigger xuống menu */
.dropdown-menu .menu-content::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: transparent;
}

/* Hover để mở (như cách bạn đang dùng) */
.dropdown-menu:hover .menu-content {
    display: block;
    opacity: 1;
    transform: scale(1);
}

/* ====== Progressive enhancement: Anchor Positioning ======
   Nếu trình duyệt hỗ trợ, menu sẽ tự bám theo trigger và tự flip nếu tràn  */
@supports (position-anchor: --x) and (anchor-name: --x) {
    .dropdown-menu .menu-content {
        /* gắn vào anchor (menu-trigger) */
        position-anchor: --trigger;

        /* Mặc định: xổ xuống, canh giữa theo trigger */
        top: anchor(bottom);
        left: anchor(center);
        translate: -50% 0;

        /* Tự thử lật theo khối (trên/dưới) và theo trục inline (trái/phải) nếu tràn */
        position-try: flip-block, flip-inline;

        /* (tuỳ chọn) thêm lựa chọn ưa thích thứ tự khi thử */
        position-try-order: most-useful;

        /* Tạo khoảng cách giữa trigger và menu */
        position-area: bottom 6px;
    }
}

/* ===== Dark mode giữ nguyên ===== */



/* Item styles (như cũ) */
.dropdown-menu .menu-content a,
.dropdown-menu .menu-content label {
    display: block;
    padding: 10px 30px;
    text-decoration: none;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid #eee;
    transition: background .3s;
    cursor: pointer;
}

.dropdown-menu .menu-content a:last-child {
    border-bottom: none;
}

.dropdown-menu .menu-content a:hover {
    background: #f0f0f0;
    color: #007bff;
    border-bottom: 2px solid #007bff;
}

/* CSS TAB Sản xuất */
.highlight-row {
    background-color: rgb(255, 246, 246) !important;
}


/* LOGIN FORM */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: #eef1f5;
}


.login-form {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    border-color: #989898;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    text-align: center;
    width: 100%;
    max-width: 560px;
    margin-top: 10vh;
}


.login-form h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #0077b6;
}

.login-form input[type="tel"],
.login-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 15px;
    border-radius: 8px;
    height: 40px !important;
    font-size: 20px !important;
    font-weight: bold !important;
    border: 1px solid #ccc;
    background: #fdfdfd;
    color: #333;
}


.login-form input[type="submit"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    background: #0077b6;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.login-form input[type="submit"]:hover {
    background: #005f91;
}

.login-form .error-message {
    color: red;
    font-weight: 500;
    margin-bottom: 10px;
}

/* Permission table */
.permission-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
}

.permission-table th,
.permission-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
    text-align: left;
}

.permission-table td label {
    background: #d5e9ff;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.permission-label {
    min-width: 200px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.dark .permission-table td label {
    background: rgba(255, 255, 255, 0.08);
    color: #eee;
}

#inactiveEmployees {
    min-height: 100px;
    overflow: hidden;
}

.invoice-header-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    width: 100%;
}

.invoice-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, #fff, #e0f2ff);
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex: 0 0 auto;
}

/* Width cố định cho 4 card (đã trừ gap) */
.invoice-card:first-child {
    width: 27%;
}

.invoice-card:nth-child(2) {
    width: 27%;
}

.invoice-card:nth-child(3) {
    width: 24%;
}

.invoice-card:nth-child(4) {
    width: 22%;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .invoice-card {
        width: 100% !important;
        border-bottom: 2px solid #fff;
    }
}

.invoice-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
}


.finance-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    border-bottom: 1px solid #cdcdcd;
    padding-bottom: 5px;
}


.finance-row span {
    font-weight: 500;
}

.money {
    font-weight: bold;
    color: #0077b6;
}


/* Thông tin chung */
.info-block {
    margin: 5px 0 5px 0;
}

.invoice-card label {
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
}

/* ICON FILE */
.file-icons {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.file-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

/* Cập nhật lại file icons để sử dụng class tooltip */
.file-icons a:hover {
    background: #0077b6;
    border-color: #0077b6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.file-icons i {
    font-size: 16px;
    color: #0077b6;
    transition: all 0.2s ease;
}

.file-icons a:hover i {
    color: white;
    transform: scale(1.1);
}

/* Remove old file label since we now use tooltips */
.file-label {
    display: none;
}

/* Lịch sử cập nhật */

/* FORM CẬP NHẬT PAYMENT */
.history-payment-form form {
    display: inline-block;
    width: 100%;
    max-width: 420px;
    padding: 0px;
}

.history-payment-form table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-payment-form td {
    padding: 5px;
    vertical-align: middle;
}

.history-payment-form input,
.history-payment-form select {
    width: 100%;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
}


/* Packinglist */
/* 🎯 CSS riêng cho bảng Packinglist */
.table-packinglist {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: white;
    table-layout: fixed;
    color: #222;
}

.table-packinglist th,
.table-packinglist td {
    padding: 3px 4px;
    border: 1px solid #ddd;
    white-space: nowrap;
    vertical-align: middle;
}

.table-packinglist th {
    background: #3b82ac;
    font-weight: 600;
    text-align: center;
    font-size: 11px !important;
    /* 🔥 giảm xuống 10px cứng tay */
}

.table-packinglist td {
    text-align: center;
    font-size: 12px !important;
    /* 🔥 giảm xuống 10px cứng tay */
}

.table-packinglist td.description {
    text-align: left;
    /* ✅ override riêng cho mô tả */
    white-space: normal;
}

.table-packinglist td.total {
    font-weight: bold;
    background: #f0f8ff;
}

/* ✅ Hover hiệu ứng nhẹ */
.table-packinglist tbody tr:hover {
    background: #f6fcff;
}

/* ✅ DARK MODE hỗ trợ đầy đủ */





.suggestion-box {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    z-index: 9999;
    max-height: 180px;
    overflow-y: auto;
    min-width: 300px;
    font-size: 14px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Hover từng item trong gợi ý */
.suggestion-box div {
    padding: 6px 10px;
    cursor: pointer;
}

.suggestion-box div:hover {
    background: #f0f0f0;
}

/* ⚫ DARK MODE */


#qtyCheckMsg {
    position: absolute;
    background: #fff;
    color: #000;
    border: 1px solid #ccc;
    padding: 8px 12px;
    margin-top: 4px;
    font-size: 0.9em;
    z-index: 9999;
    display: none;
    max-width: 320px;
    width: max-content;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

/* Dark mode support */

/* CSS gợi ý số lượng đóng gói */
.qty-check-box {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    padding: 6px 10px;
    font-size: 0.9em;
    max-width: 300px;
    margin-top: 5px;
    z-index: 9999;
    display: none;
    right: 0;
    left: auto;
    text-align: left;
}

/* Dark mode */

/* Báo cáo hàng ra - Quality report */
.output-day-group {
    background: linear-gradient(to top, #f3faff, #e0f2ff);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border-radius: 5px;
    margin: 0 10px 10px 10px;
    overflow: hidden;
    border: 1px solid #b4e0ff;
}

.output-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #1a3e72;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
}

.output-day-header:hover {
    background: linear-gradient(to top, #ffffff, #a3c8f0);
}

/* ✅ DARK MODE */



.header-left {
    font-size: 16px;
    white-space: nowrap;
}

.arrow {
    font-size: 16px;
}

.output-day-content {
    padding: 5px 5px;
    display: none;
}

.header-right {
    display: grid;
    grid-template-columns: repeat(5, auto);
    justify-content: end;
    gap: 10px;
}

.metric {
    min-width: 130px;
    text-align: left;
}

@media (max-width: 600px) {
    .metric {
        min-width: 100px;
        /* Thu gọn khi ở mobile */
    }

    .header-right {
        grid-template-columns: repeat(2, auto);
        justify-content: flex-end;
    }
}


/* CSS cho Customer Detail */
.subtab-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    align-items: center;
    position: relative;
    /* Để làm mốc cho dropdown */
}

.subtab-links a {
    position: relative;
    display: inline-block;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    padding: 4px 6px;
    transition: all 0.2s ease;
    border-bottom-color: #ced8e2;
}

.subtab-links a:hover,
.subtab-links a.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

/* ===== MENU DOWNLOAD DROPDOWN ===== */
.menu-trigger {
    position: relative;
}

.menu-wrapper:hover .download-content {
    display: block;
}

.download-content {
    display: none;
    position: absolute;
    top: calc(100% - 1px);
    /* 👈 Sát nút, không có khoảng hở */
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 0;
    min-width: 300px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    z-index: 99;
}



/* Style cho từng link trong dropdown */
.download-content a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.download-content a:hover {
    background: #f2f6ff;
    color: #007bff;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .subtab-links {
        gap: 8px 10px;
    }

    .download-content {
        min-width: 200px;
        left: auto;
        right: 0;
    }
}

/* CSS cho báo cáo tài chính của khách hàng */
/* ========== Dashboard Layout ========== */
.dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    /* 👈 auto xuống dòng */
    gap: 10px;
    margin-bottom: 20px;
}

.dashboard-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    min-width: 0;
    /* 👈 bắt buộc với grid */
}

.dashboard-panel canvas {
    height: 200px !important;
    max-height: 200px;
}

.dashboard-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dashboard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* ✅ Cho responsive */
    gap: 10px;
    margin-top: 20px;
}

.dashboard-header-row .title h3 {
    margin: 0px;
    font-size: 20px;
    font-weight: bold;
}

.dashboard-header-row .filter {
    min-width: 150px;
}

/* ========== Table & Sorting ========== */
th.defect-detail-col,
td.defect-detail-col {
    display: none;
}

th.sortable-column.active {
    background: #ffebcc;
    /* Cam nhạt */
    color: #cc6600;
    /* Cam đậm */
}

td.highlight-col {
    background: #fff3e0;
    /* Vàng cam siêu nhạt */
}

html.dark th.sortable-column.active {
    background: #7f5539;
    /* Nâu nhạt trong darkmode */
    color: #ffe0b2;
    /* Cam sáng */
}

html.dark td.highlight-col {
    background: #483429;
    /* Màu nâu đậm cho dark mode */
}

/* ========== Dark Mode cho Panel ========== */
html.dark .dashboard-panel {
    background: #272c31;
    border-color: rgb(69, 69, 69);
    color: #cbd5e1;
}

.top-defect-table {
    width: 100%;
}

/* ========== CSS cho bảng danh sách sản phẩm ========== */
.sub-products {
    margin: 5px;
    font-size: 13px;
    background-color: #ecf5fe;
    padding: 8px;
}



.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    /* luôn là flex */
    justify-content: center;
    align-items: flex-start;
}

/* Ẩn mặc định bằng 1 class riêng */
.popup-hidden {
    display: none !important;
}

.popup-box {
    background: #fff;
    color: #111;
    padding: 24px 30px;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    font-size: 16px;
    margin-top: 5vh;
    overflow-y: scroll;
    width: 40%;
    max-width: 560px;
    min-width: 320px;
    box-sizing: border-box;
    max-height: 90vh;
}

/* Tablet & mobile: full hơn */
@media (max-width: 1024px) {

    .popup-box {
        width: 80% !important;
    }
}

/* Mobile nhỏ */
@media (max-width: 600px) {

    .popup-box {
        width: 90% !important;
    }
}

.popup-box button {
    margin: 12px 6px 0;
    padding: 8px 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    border: none;
}

.popup-box .confirm-btn {
    background: #f87171;
    color: white;
}

.popup-box .confirm-btn:hover {
    background: #bb3333;
}

.popup-box .cancel-btn {
    background: #b8b8b8;
    color: white;
}

.popup-box .cancel-btn:hover {
    background: #656565;
}


#qrImage {
    opacity: 0;
    transition: opacity 0.4s ease;
}

#qrImage.loaded {
    opacity: 1;
}

.bgblue {
    background-color: #005c99 !important;
}


.bgwhite {
    background-color: #fff !important;
}


.bgxlightblue {
    background-color: #f0f7ff !important;
}


.bglightred {
    background-color: #fbf0f0 !important;
}


.bglightgreen {
    background-color: #e0ffe0 !important;
}


.bglightgray {
    background-color: #f1efef !important;
}


.bglightyellow {
    background-color: #fffceb !important;
}


.bglightblue {
    background-color: #ddefff !important;
}


.bggradientblue {
    background: linear-gradient(to bottom, #c5e1ff, #f5faff);
}


.bggradientorange {
    background: linear-gradient(to bottom, #ffe4c0, #fff3e5);
}


.bgorange {
    background-color: #ff8533;
}

.bggreen {
    background-color: #2a9d3b;
    color: #fff;
}


input::placeholder,
textarea::placeholder {
    color: #333;
    /* hoặc bất kỳ màu nào mày thích */
    opacity: 1;
    /* tránh bị mờ quá */
}


/* Style cho radio buttons */
.invoice-card input[type="radio"] {
    display: none;
}

.invoice-card label[for] {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #555;
    position: relative;
    padding-left: 24px;
}

.invoice-card label[for]:before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border: 1.5px solid #0077b6;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.invoice-card label[for]:hover {
    background: #e6f3ff;
    border-color: #0077b6;
}

.invoice-card input[type="radio"]:checked+label {
    background: #0077b6;
    border-color: #0077b6;
    color: white;
}

.invoice-card input[type="radio"]:checked+label:before {
    background: white;
    box-shadow: inset 0 0 0 2px #0077b6;
}

.editQty {
    cursor: pointer;
}

.editQty:hover,
.editQty:focus,
.editQty:active {
    background-color: #fbe1c2;
}

.qty-cell {
    position: relative;
    overflow: visible;
}

.edit-icon {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 8px;
    border: none;
    cursor: pointer;
    display: none;
}

.qty-cell:hover .edit-icon {
    display: block;
}

.product-code-cell {
    position: relative;
}

.product-code-cell:hover {
    background-color: #fbe1c2;
}

.delete-icon {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: none;
}

.product-code-cell:hover .delete-icon {
    display: block;
}

/* Dark mode */





/* Custom Radio Button Style */
.custom-radio input[type="radio"] {
    display: none;
}

.custom-radio label {
    display: inline-flex;
    align-items: center;
    padding: 3px 6px;
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #555;
    position: relative;
    padding-left: 24px;
}

.custom-radio label:before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border: 1.5px solid #0077b6;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.custom-radio label:hover {
    background: #e6f3ff;
    border-color: #0077b6;
}

.custom-radio input[type="radio"]:checked+label {
    background: #0077b6;
    border-color: #0077b6;
    color: white;
}

.custom-radio input[type="radio"]:checked+label:before {
    background: white;
    box-shadow: inset 0 0 0 2px #0077b6;
}

/* Dark mode */







/* CSS cho bài viết trên board */
.board-post {
    margin: 10px 0 10px 0;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 5px;
}

.post-content {
    padding: 10px;
    border-top: 1px solid #d0d0d0;
    word-wrap: break-word;
    /* cũ nhưng hỗ trợ rộng */
    overflow-wrap: anywhere;
    /* chuẩn hiện đại */
    word-break: break-word;
    /* backup cho iOS Safari */
}



.searchUsers {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;

    /* Default (desktop) */
    width: 100%;
    max-width: 450px;
    min-width: 300px;
}

/* Tablet */
@media (max-width: 1024px) {
    .searchUsers {
        max-width: 320px;
        min-width: 260px;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .searchUsers {
        position: relative;
        /* cho mobile không bị tràn khỏi màn */
        width: 100% !important;
        /* full width */
        max-width: 100% !important;
        min-width: 100% !important;
        left: 0 !important;
    }
}

.search-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 8px;
}

.search-item:hover {
    background-color: #66adff;
    color: #fff;
}

.search-item img.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}


.taggedUsers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding-top: 5px;
}


.tagged-box {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #d3e7ff;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.tagged-box .avatar {
    width: 28px;
    height: 28px;
}


.tagged-box span.remove-tag {
    margin-left: 6px;
    color: #d00;
    cursor: pointer;
}

.avatar-wrapper {
    margin: 0 auto;
    aspect-ratio: 1/1;
    width: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f0;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* ✅ không méo, crop gọn trong khung */
    object-position: center;
    display: block;
}

/* Các kích cỡ tùy chọn */
.avatar-wrapper.small {
    width: 28px;
}

.avatar-wrapper.medium {
    width: 36px;
}

.avatar-wrapper.large {
    width: 48px;
}

.avatar-wrapper.xlarge {
    width: 64px;
}

.avatar-wrapper.xxlarge {
    width: 80px;
}

.avatar-wrapper.superlarge {
    width: 100px;
}

.avatar-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.avatar-list .avatar-wrapper {
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
    margin: 0;
    display: inline-flex;
}

.avatar-list .avatar-wrapper:hover {
    transform: translateY(-2px) scale(1.05);
    z-index: 2;
}

.btn-remove-user {
    position: absolute;
    left: -2px;
    top: -5px;
    background: #fcb8b3;
    color: #fff;
    font-size: 20px;
    border-radius: 50%;
    padding: 5px 6px 4px 3px;
    text-decoration: none;
    display: none;
    /* ẩn mặc định */
}


.alert {
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.alert.success {
    background-color: #dff0d8;
    border-color: #d6e9c6;
    color: #3c763d;
}

.alert.error {
    background-color: #f2dede;
    border-color: #ebccd1;
    color: #a94442;
}

/* Ẩn trên mobile portrait */
@media screen and (max-width: 767px) and (orientation: portrait) {
    .hide-mobile-portrait {
        display: none;
    }
}

/* Ẩn trên tablet trở xuống */
@media screen and (max-width: 1024px) {
    .hide-tablet {
        display: none;
    }
}

/* ===============================
   SUMMARY AUTO GRID
================================*/
.summary-box-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0px;
}

/* Box co giãn hoàn toàn theo nội dung */
.summary-box {
    flex: 1 1 auto;
    /* co giãn linh hoạt */
    min-width: fit-content;
    /* đủ nội dung thì đứng 1 box */
    max-width: 100%;
    /* không vượt quá chiều rộng hàng */
    padding: 10px;
    background: #fff;
    box-sizing: border-box;
}

/* Box dài chiếm 2 cột tự động */
.summary-box.span-2 {
    flex: 2 1 auto;
}

/* Box chiếm full dòng */
.summary-box.full {
    flex: 0 0 100%;
}

/* MOBILE PORTRAIT: 2 cột */
@media (max-width: 600px) {
    .summary-box {
        flex: 1 1 calc(50% - 10px);
    }

    .summary-box.span-2 {
        flex: 1 1 100%;
    }
}

/* TABLET PORTRAIT: 3 cột */
@media (min-width: 600px) and (max-width: 900px) {
    .summary-box {
        flex: 1 1 calc(33.33% - 10px);
    }

    .summary-box.span-2 {
        flex: 1 1 calc(66.66% - 10px);
    }
}

/* TABLET LANDSCAPE: 4 cột */
@media (min-width: 900px) and (max-width: 1200px) {
    .summary-box {
        flex: 1 1 calc(25% - 10px);
    }

    .summary-box.span-2 {
        flex: 1 1 calc(50% - 10px);
    }
}

/* DARK MODE */

/* Bộ sưu tập (album) */
.collection-album {
    display: grid;
    gap: 10px;
}

.collection-album.small {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.collection-album.medium {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.collection-album.large {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.collection-item {
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    padding: 5px;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
    max-width: 250px;
    position: relative;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* hover card = đổi border + bóng đổ */
.collection-item:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: #006fe6;
}

/* ✅ khi hover card, ảnh phóng nhẹ */
.collection-item:hover .cover-photo-wrapper img {
    transform: scale(1.05);
}


.worker-grid {
    display: grid;
    gap: 10px;
    justify-content: flex-start !important;
}

.worker-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.worker-grid.medium {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.worker-grid.large {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}


/* ===========================
   📇 CUSTOMER CARD GRID VIEW
   =========================== */
.customer-card,
.worker-card {
    background: #fff;
    border-radius: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
    max-width: 250px;
}

/* hover card = đổi border + bóng đổ */
.worker-card:hover,
.customer-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: #006fe6;
}

/* ✅ khi hover card, ảnh phóng nhẹ */
.worker-card:hover .cover-photo-wrapper img,
.customer-card:hover .cover-photo-wrapper img {
    transform: scale(1.05);
}

/* --- Trường hợp không có ảnh --- */
.no-cover {
    font-size: 50px;
    color: #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

/* --- Thông tin chi tiết --- */
.customer-card .collection-info {
    padding: 10px 12px;
    flex-grow: 1;
}

.customer-card h4 {
    margin: 0 0 5px;
    font-size: 16px;
    color: #111;
}

.customer-card .sub {
    color: #666;
    font-size: 13px;
    margin-top: 3px;
}

.customer-card .sub.email {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* --- Nút hành động --- */
.customer-card .collection-actions {
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
}

.customer-card .collection-actions .button {
    flex: 1;
    text-align: center;
    margin: 0 3px;
}


.edit-cover-form .cover-input {
    display: none;
}

.edit-cover-form .edit-icon {
    position: absolute;
    top: 20px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: none;
    font-size: 14px;
    text-align: center;
}


.cover-photo-wrapper:hover .edit-icon {
    display: block;
}

.collection-info {
    padding: 0;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-top: 10px;
}

.collection-info .manage-btn {
    margin-top: auto;
    /* 👈 đẩy xuống đáy */
    align-self: flex-start;
    /* hoặc center nếu muốn căn giữa */
}

.collection-info h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}


.sub {
    color: #555;
    font-size: 13px;
    margin-bottom: 5px;
}


.note {
    font-size: 13px;
    color: #666;
    margin-top: 6px;
    margin-bottom: 6px;
}


.icon-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}

.icon-link i {
    width: 20px;
    /* 👈 fix width để thẳng hàng */
    text-align: center;
}


/* Chi phí */
.expense-detail-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 6px 12px;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

.expense-detail-grid div:nth-child(odd) {
    font-weight: 600;
    color: #555;
}


/* 👇 Responsive khi dưới 500px: chuyển thành 1 cột */
@media (max-width: 500px) {
    .expense-detail-grid {
        grid-template-columns: 1fr;
    }

    .expense-detail-grid div:nth-child(odd) {
        margin-top: 10px;
        color: #999;
    }
}

#expensesChart {
    width: auto !important;
    height: 320px !important;
}

.expense-stat-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
}

.expense-stat-half {
    flex: 1 1 calc(50% - 10px);
    box-sizing: border-box;
    min-width: 300px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .expense-stat-half {
        flex: 1 1 100%;
    }
}

/* Cài đặt hệ thống */
.system-settings-form {
    display: block;
    /* ✅ bỏ flex hoàn toàn */
    width: 100%;
    margin: 0 auto;
}

.system-settings-form fieldset {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px 16px 16px;
    margin-bottom: 20px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    height: auto;
    /* ✅ co theo nội dung */
    box-sizing: border-box;
}


.system-settings-form legend {
    font-weight: 700;
    color: #0077b6;
    font-size: 16px;
    padding: 0 8px;
}


.settings-table {
    width: 100%;
    border-collapse: collapse;
}

.settings-table td {
    border-bottom: 1px solid #eee;
    padding: 10px 6px;
    vertical-align: middle;
    font-size: 14px;
    white-space: normal !important;
    /* Ép cell cho phép xuống dòng */
    word-wrap: break-word;
    overflow: visible !important;
    /* Cho phép suggestions hiển thị ra ngoài td */
    position: relative;
    /* Tạo stacking context */
}

.settings-table input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.settings-table tr:last-child td {
    border-bottom: none;
}

.form-footer {
    text-align: right;
    margin-top: 15px;
}

/* ✅ responsive – auto fit mọi màn hình */
@media (max-width: 768px) {
    .settings-table td {
        display: block;
        width: 100%;
    }

    .settings-table tr {
        display: block;
    }

    .system-settings-form fieldset {
        margin-bottom: 15px;
        padding: 10px;
    }

    .settings-table input,
    .settings-table select {
        font-weight: bold;
    }
}

/* Suggestion box */
.orderSearchResults {
    position: absolute;
    background: #fcfcde;
    border: 1px solid #ddd;
    width: 30%;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

@media (max-width: 768px) {
    .orderSearchResults {
        inset: auto 20px auto 20px;
        /* tương đương top:auto; right:20px; bottom:auto; left:20px */
        width: auto !important;
    }
}

.order-item {
    padding: 10px;
    cursor: pointer;
}

.order-item:hover {
    background: rgb(181, 221, 253);
}



.notification-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    display: none;
    /* mặc định ẩn */
}

.notification {
    min-width: 280px;
    padding: 12px 18px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.3s ease;
}

.notification.success {
    background-color: #4caf50;
    /* xanh lá */
}

.notification.error {
    background-color: #e53935;
    /* đỏ lỗi */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== THREAD UNREAD STYLE ========== */

/* Bôi đậm và nổi bật thread chưa đọc */
.unread {
    transition: background-color 0.3s ease;
}

/* Badge nhỏ hiển thị số lượng tin mới */
#unreadmsg {
    color: #0b62d4;
}

.unread a {
    color: #0a58ca;
}

.badge {
    display: inline-block;
    background: #ff3b3b;
    color: white;
    font-size: 12px;
    border-radius: 10px;
    padding: 2px 6px;
    margin-left: 6px;
    min-width: 18px;
    text-align: center;
    font-weight: 400;
}

.tag-link {
    display: inline-block;
    text-decoration: none !important;
    color: #003049 !important;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
}

.tag-link:hover {
    color: #0077b6 !important;
    background-color: #f0f8ff;
    transform: translateY(-1px);
}

.thread-header {
    display: grid;
    grid-template-columns: 35% 40% 25%;
    align-items: start;
    padding: 10px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* 🔹 Các block con */
.thread-header>div {
    background: transparent;
    min-width: 0;
    overflow-wrap: break-word;
}

/* 🔹 Khi chỉ còn 1 cột hiển thị (mobile portrait) */
@media (max-width: 767px) and (orientation: portrait) {
    .thread-header {
        display: grid;
        grid-template-columns: 1fr;
        /* full 100% width cho block còn lại */
    }

    .hide-mobile-portrait {
        display: none !important;
    }
}

/* 🔹 Tablet portrait (800x1280 chẳng hạn) vẫn 3 cột mượt, không vỡ bố cục */
@media (min-width: 768px) and (max-width: 1023px) {
    .thread-header {
        grid-template-columns: 35% 40% 25%;
    }
}

/* ===== Reply form sticky bottom ===== */
.reply-form {
    position: sticky;
    bottom: 0;
    background: #f0f7ff;
    padding: 10px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* chỉ trên mobile (nơi có bottom-bar) => chừa 60px */
@media (max-width: 899px) {
    .reply-form {
        bottom: 52px;
    }
}

/* dark mode */

/* textarea cơ bản */
.reply-form textarea,
.edit-form textarea {
    width: 100%;
    height: 70px;
    min-height: 50px;
    resize: none;
    transition: height 0.25s ease;
    font-family: inherit;
    font-size: 16px;
    box-sizing: border-box;
}



.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.editor-toolbar button {
    margin-right: 2px;
    cursor: pointer;
    border: none;
    background: #eee;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
}


.editor-toolbar button:hover {
    background: #ddd;
}


.edit-history-list {
    display: none;
    margin-top: 8px;
    border-left: 3px solid #ccc;
    padding-left: 20px;
    margin-left: 20px;
}

.inline-user {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    /* ép chiều cao text */
    height: 20px;
    /* hoặc auto theo avatar */
    padding: 0 5px 0 0;
    /* có thể giảm padding để gọn hơn */
    /* bỏ padding trái để avatar sát mép */
    border-radius: 20px;
    background: #ff8533;
    margin-right: 6px;
    position: relative;
    overflow: visible;
    color: #fff;
    text-indent: 3px;
}



/* New order search customer */
.search-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    width: 280px;
    z-index: 10;
    display: none;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}


.search-dropdown div {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
}

.search-dropdown div:hover {
    background: #f0f7ff;
}


/* === GRID VIEW CHO PRODUCT LIST === */
.product-grid {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.product-grid.small {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
}

.product-grid.medium {
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)) !important;
}

.product-grid.large {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
}

.product-grid.xlarge {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
}

.product-grid.xxlarge {
    grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)) !important;
}

.product-grid.superlarge {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
}

.product-card {
    position: relative;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    padding: 4px;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* hover card = đổi border + bóng đổ */
.product-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border-color: #006fe6;
}

/* ✅ khi hover card, ảnh phóng nhẹ */
.product-card:hover .cover-photo-wrapper img {
    transform: scale(1.05);
}

/* ảnh có hiệu ứng chuyển động */
.cover-photo-wrapper img {
    transition: transform 0.3s ease;
}


.product-card .select-product {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 20 !important;
    /* tăng cao hơn ảnh */
    transform: scale(1.2);
    cursor: pointer;
    accent-color: #007bff;
}

.product-card form {
    margin-top: auto;
    /* đẩy form xuống đáy */
}

.cover-photo-wrapper,
.cover-photo,
.cover-photo img {
    position: relative;
    z-index: auto;
    background-color: #fff;
}

.cover-photo-wrapper {
    width: 100%;
    overflow: hidden;
}

.product-card .code {
    font-size: 15px;
    font-weight: 700;
    color: #0d6efd;
    margin-top: 10px;
}


.product-card .desc {
    font-size: 13px;
    margin-bottom: 10px;
    font-weight: 600;
}

.product-card .info {
    font-size: 13px;
    margin-bottom: 2px;
    font-weight: 500;
}

.product-card .finish {
    font-size: 12px;
    margin-bottom: 5px;
    color: #666;
}


.product-card .price {
    margin-top: auto;
    /* 👈 đẩy xuống đáy */
    align-self: flex-start;
    /* hoặc center nếu muốn căn giữa */
}

.view-toggle .active {
    background: #0d6efd;
    color: #fff;
}

.data-block-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    position: relative;
}

@media (max-width: 768px) {
    .data-block-grid {
        grid-template-columns: 1fr !important;
    }
}

/* responsive tweak */
@media (max-width: 600px) and (orientation: portrait) {
    .data-block-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* mỗi block riêng biệt */
.data-block {
    position: relative;
    border-radius: 5px;
    padding: 15px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.data-block.span-2,
.data-block.wide-block {
    grid-column: span 2;
}

.data-block.full {
    grid-column: span 3;
}

.data-block-blank {
    padding: 0;
    position: relative;
}

.data-block-blank.full {
    grid-column: span 3;
}

/* --- responsive fix --- */
@media (max-width: 899px) {

    .data-block.span-2,
    .data-block.wide-block,
    .data-block.full {
        grid-column: span 1 !important;
    }

    .data-block-blank.full {
        grid-column: span 1 !important;
    }
}



#productPhotoPreview {
    display: flex;
    justify-content: center;
    /* căn giữa ngang */
    align-items: center;
    /* căn giữa dọc */
    height: 100%;
    /* phải có chiều cao cố định hoặc auto theo parent */
    min-height: 200px;
    /* có thể tùy chọn */
    padding: 10px;
}

#productPhotoPreview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}



/* ảnh bên trong */
.cover-photo-wrapper img {
    display: block;
    transition: transform 0.3s ease;
}

/* option size (chỉ cần thêm class) */
.cover-photo-wrapper.small {
    width: 100%;
    height: 90px;
}

.cover-photo-wrapper.medium {
    width: 100%;
    height: 120px;
}

.cover-photo-wrapper.large {
    width: 100%;
    height: 200px;
}

.cover-photo-wrapper.xlarge {
    width: 100%;
    height: 300px;
}

/* option style cho ảnh */
.cover-photo-wrapper.cover-fill {
    overflow: hidden;
}

.cover-photo-wrapper.cover-fill img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* fill kín khung, crop nhẹ */
}

.cover-photo-wrapper.cover-contain {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.cover-photo-wrapper.cover-contain img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* giữ tỉ lệ thật, không crop */
}

.cover-photo-wrapper.small-image {
    width: 100%;
    height: 90px;
    /* Cùng height với .small để đồng nhất */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.cover-photo-wrapper.small-image img {
    width: 80%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* placeholder khi chưa có ảnh */
.cover-photo-wrapper.no-image {
    background: #eee;
    color: #666;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* =====================
   THREAD LIST LAYOUT
   ===================== */
.thread-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* ---- CARD ---- */
.thread-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 5px;
    padding: 12px 16px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    gap: 10px;
}

.thread-card:hover {
    border-color: #0078ff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.thread-card.highlight {
    background: #eaf5ff;
}

/* ---- LEFT: Avatar ---- */
.thread-left {
    flex: 0 0 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ---- INFO (title, poster, tags) ---- */
.thread-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.thread-title a {
    text-decoration: none;
    font-size: 16px;
    line-height: 1.3;
}

.thread-title a:hover {
    color: #0078ff;
}

.thread-meta {
    font-size: 14px;
    color: #444;
}

.thread-tags {
    margin-top: 2px;
}

.thread-tags a {
    font-size: 13px;
    text-decoration: none;
    margin-right: 6px;
    padding: 1px 5px;
}

.thread-tags a:hover {
    color: #0078ff;
}

/* ---- STATS (date, replies) ---- */
.thread-stats {
    flex: 0.1 0 160px;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* ---- USERS (avatars tagged) ---- */
.thread-users {
    flex: 0.2 0 160px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.thread-users .small-text {
    font-size: 13px;
}

.thread-users .avatar-list {
    justify-content: flex-end;
}

/* =====================
   RESPONSIVE MOBILE
   ===================== */
@media (max-width: 900px) {
    .thread-card {
        display: grid;
        grid-template-columns: 60px 1fr;
        /* Avatar + Info cùng hàng */
        grid-template-areas:
            "avatar info"
            "stats stats"
            "users users";
        gap: 8px 12px;
    }

    .thread-left {
        grid-area: avatar;
        justify-content: flex-start;
    }

    .thread-info {
        grid-area: info;
    }

    .thread-stats {
        grid-area: stats;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        font-size: 13px;
    }

    .thread-users {
        grid-area: users;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    .thread-users .avatar-list {
        justify-content: flex-start;
    }
}

/* =====================
   DARK MODE SUPPORT
   ===================== */





.op-info {
    padding: 5px;
    font-size: 15px;
}

/* Combined Profile & Stats Card */
.profile-card-container {
    display: flex;
    gap: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 10px;
    margin: 10px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    align-items: flex-start;
}

.pc-left {
    flex: 0 0 120px;
    /* Fixed width for avatar area */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pc-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #e0e0e0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.pc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.pc-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pc-info h2 {
    margin: 0 0 4px 0;
    font-size: 22px;
    color: #0050b3;
}

.pc-info p {
    margin: 0;
    color: #666;
    font-size: 15px;
}

/* Compact Stats Grid */
.compact-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.c-stat-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.c-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.c-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.c-stat-item.highlight {
    background: #e6f7ff;
    border-color: #91d5ff;
    grid-column: span 2;
}

.c-stat-item.highlight .c-stat-value {
    color: #0050b3;
    font-size: 20px;
}

/* Dark Mode */









/* Mobile Responsive for Profile Card */
@media (max-width: 600px) {
    .profile-card-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }

    .pc-left {
        flex: 0 0 auto;
        width: 100%;
    }

    .pc-right {
        width: 100%;
    }

    .compact-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Force 3 cols on mobile */
    .c-stat-item.highlight {
        grid-column: 1 / -1;
    }
}

/* =====================
   BẢO ÔN STATS - KILNLOAD PROFILE
   ===================== */
.bao-on-title {
    margin: 20px 0 15px 0;
}

.bao-on-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.bao-on-card {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
}

.bao-on-card-header {
    text-align: center;
    margin-bottom: 12px;
}

.bao-on-card-header-title {
    font-size: 24px;
    font-weight: bold;
    color: #0d6efd;
}

.bao-on-main-stat {
    text-align: center;
    margin-bottom: 15px;
    padding: 12px;
    background: #e7f5e7;
    border-radius: 6px;
}

.bao-on-main-stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 600;
}

.bao-on-main-stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #2ca02c;
}

.bao-on-main-stat-unit {
    font-size: 18px;
    color: #888;
}

.bao-on-secondary-stats {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.bao-on-stat-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
}

.bao-on-stat-item.count {
    background: #fff3cd;
}

.bao-on-stat-item.min {
    background: #ffe6e6;
}

.bao-on-stat-item.max {
    background: #e6f2ff;
}

.bao-on-stat-label {
    font-size: 11px;
    margin-bottom: 3px;
    font-weight: 600;
}

.bao-on-stat-item.count .bao-on-stat-label {
    color: #856404;
}

.bao-on-stat-item.min .bao-on-stat-label {
    color: #721c24;
}

.bao-on-stat-item.max .bao-on-stat-label {
    color: #004085;
}

.bao-on-stat-value {
    font-weight: bold;
}

.bao-on-stat-item.count .bao-on-stat-value {
    font-size: 18px;
    color: #d62728;
}

.bao-on-stat-item.min .bao-on-stat-value {
    font-size: 16px;
    color: #d62728;
}

.bao-on-stat-item.max .bao-on-stat-value {
    font-size: 16px;
    color: #1f77b4;
}

.bao-on-stat-unit-small {
    font-size: 12px;
}

/* Mobile First - Single Column */
@media (max-width: 600px) {
    .bao-on-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .bao-on-card {
        padding: 12px !important;
    }

    .bao-on-card-header-title {
        font-size: 20px !important;
    }

    .bao-on-main-stat-value {
        font-size: 28px !important;
    }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 900px) {
    .bao-on-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Utility Colors */
/* Utility Colors */
.text-danger {
    color: #d93025 !important;
}

.text-success {
    color: #188038 !important;
}

.text-warning {
    color: #f1c232 !important;
}




/* Attendance Monthly Table - New Responsive Design */
.attendance-monthly-table {
    width: 100%;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
    background: #fff;
}


/* Header (Desktop only) */
.attendance-header {
    display: none;
}

/* Row */
.attendance-row {
    display: grid;
    grid-template-columns: 10% 15% 10% 10% 10% 10% 1fr;
    gap: 8px;
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.attendance-row:last-child {
    border-bottom: none;
}


.attendance-row.is-weekend {
    background: #fcfcfc;
}


.attendance-row.has-flag {
    background: #fff5f5;
    border-left: 3px solid #d90429;
}


/* Columns */
.att-col-date {
    font-size: inherit;
}

.att-col-shift {
    font-size: inherit;
    line-height: 1.6;
    font-weight: 600;
}

/* Stats wrapper - chỉ dùng trên mobile */
.att-stats-wrapper {
    display: contents;
}

/* Leave row - chỉ hiển thị 2 cột: date và shift */
.attendance-leave-row {
    grid-template-columns: 10% 1fr !important;
}

.attendance-leave-row .att-col-date {
    grid-column: 1;
}

.attendance-leave-row .att-col-shift {
    grid-column: 2;
}

.shift-emoji {
    display: inline-block;
    width: 24px;
    text-align: center;
}

.shift-time {
    margin-left: 2px;
}

/* Red flag for check-in/check-out times */
.att-col-shift .text-red,
.shift-time .text-red,
.shift-time a .text-red,
span.text-red {
    color: #d90429 !important;
    font-weight: 600;
}

/* Link styling in shift time */
.shift-time a {
    text-decoration: none;
    color: inherit;
}

.shift-time a:hover .text-red {
    text-decoration: underline;
}

.shift-time a:hover span:not(.text-red) {
    text-decoration: underline;
    color: #0066cc;
}


.att-col-normal,
.att-col-ot,
.att-col-piece {
    text-align: center;
    font-size: inherit;
}

.att-col-wage {
    text-align: right;
    font-size: inherit;
    font-weight: 600;
}

.att-col-note {
    font-size: inherit;
    color: #666;
    white-space: normal;
}


/* Mobile */
@media (max-width: 768px) {
    .attendance-header {
        display: none;
    }

    .attendance-monthly-table {
        border: none;
        background: transparent;
    }

    .attendance-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        border: 1px solid #eee;
        border-radius: 8px;
        margin-bottom: 12px;
        background: #fff;
    }


    /* Leave row trên mobile - chỉ hiển thị date và shift */
    .attendance-leave-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .attendance-leave-row .att-col-date {
        order: 1;
        width: auto;
        flex-shrink: 0;
    }

    .attendance-leave-row .att-col-shift {
        order: 2;
        flex: 1;
        padding: 0;
        background: transparent;
    }

    .attendance-row:last-child {
        margin-bottom: 0;
    }


    /* Dòng 1: Ngày - 100% width */
    .att-col-date {
        grid-column: 1;
        grid-row: 1;
        font-weight: 600;
        font-size: inherit;
        width: 100%;
    }

    /* Dòng 2: Các ca làm việc có emoji - 100% width */
    .att-col-shift {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        padding: 8px;
        background: #f9f9f9;
        border-radius: 4px;
    }


    /* Dòng 3: Wrapper cho 3 block: Chính Thêm Khoán */
    .att-stats-wrapper {
        grid-column: 1;
        grid-row: 3;
        display: flex;
        gap: 6px;
        width: 100%;
    }

    .att-col-normal,
    .att-col-ot,
    .att-col-piece {
        flex: 1;
        padding: 8px;
        background: #fff;
        border-radius: 4px;
        text-align: center;
        font-size: inherit;
        font-weight: 600;
    }


    .att-col-normal::before {
        content: "🗓️ Chính";
        display: block;
        font-size: inherit;
        color: #666;
        margin-bottom: 4px;
        font-weight: 600;
    }


    .att-col-ot::before {
        content: "⏰ Thêm";
        display: block;
        font-size: inherit;
        color: #666;
        margin-bottom: 4px;
        font-weight: 600;
    }


    .att-col-piece::before {
        content: "🧩 Khoán";
        display: block;
        font-size: inherit;
        color: #666;
        margin-bottom: 4px;
        font-weight: 600;
    }


    .att-col-normal,
    .att-col-ot,
    .att-col-piece {
        font-weight: 600;
        text-align: center;
    }

    /* Dòng 4: Lương - 100% width */
    .att-col-wage {
        grid-column: 1;
        grid-row: 4;
        width: 100%;
        text-align: left;
        font-weight: 600;
        padding: 8px;
        background: #e3f2fd;
        border-radius: 4px;
        font-size: 1.1em;
    }



    .att-col-wage::before {
        content: "💰 Lương: ";
        display: block;
        font-size: 0.9em;
        color: #666;
        margin-bottom: 4px;
        font-weight: 600;
    }

    /* Dòng 5: Hiển thị nếu có note, ẩn nếu note = empty - 100% width */
    .att-col-note {
        grid-column: 1;
        grid-row: 5;
        width: 100%;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid #eee;
    }

    .att-col-note:empty {
        display: none;
    }

}

/* Desktop */
@media (min-width: 769px) {
    .attendance-header {
        display: grid;
        grid-template-columns: 10% 15% 10% 10% 10% 10% 1fr;
        gap: 8px;
        padding: 12px 8px;
        background: #e3f2fd;
        font-weight: 600;
        font-size: inherit;
        text-transform: uppercase;
        border-bottom: 2px solid #90caf9;
        position: sticky;
        top: 0;
        z-index: 10;
    }

}

/* OLD CSS - REMOVED - Responsive Table-like Divs */
.r-table {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #e0e0e0;
    margin-top: 20px;
}

.r-row {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    align-items: center;
    transition: background 0.3s ease, color 0.3s ease;
}

.r-row:last-child {
    border-bottom: none;
}

.r-row.header {
    font-weight: 700;
    color: #495057;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
    position: sticky;
    z-index: 100;
    top: 0;
}

/* Desktop Columns */
.r-cell {
    padding: 12px 8px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #333;
}

.r-cell.left {
    justify-content: flex-start;
    text-align: left;
}

.r-cell.right {
    justify-content: flex-end;
    text-align: right;
}

/* Column Widths (Desktop) */
.r-cell.w-date {
    flex: 0 0 120px;
}

.r-cell.w-shift {
    flex: 0 0 60px;
    font-size: 15px;
}

.r-cell.w-time {
    flex: 0 0 140px;
    flex-direction: column;
    gap: 2px;
    font-size: 15px;
    font-weight: 700;
}

/* Shift emoji alignment */
.shift-emoji {
    display: inline-block;
    width: 24px;
    text-align: center;
}

.r-cell.w-num {
    flex: 0 0 90px;
    font-weight: 500;
}

.r-cell.w-money {
    flex: 0 0 120px;
    font-weight: 700;
}

.r-cell.w-note {
    flex: 1;
    color: #666;
    font-size: 14px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dark Mode - Desktop & General */






/* Weekend Row Styles */
.r-row.is-weekend {
    background: #fcfcfc;
}

.r-row.is-weekend .w-date {
    color: #d93025;
}



/* Input/Select Dark Mode */

/* Mobile Optimization */
@media (max-width: 768px) {
    .r-table {
        border: none;
        background: transparent;
        gap: 12px;
    }

    .r-row.header {
        display: none;
    }

    /* Card Style for Mobile Row */
    .r-row {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "date shift income"
            "time time time"
            "stats stats stats"
            "note note note";
        gap: 8px 12px;
        padding: 16px;
        border: 1px solid #eee;
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        align-items: start;
    }

    /* Dark Mode Mobile Card */

    /* Reset Flex properties for Grid items */
    .r-cell {
        flex: unset;
        width: auto;
        padding: 0;
        border: none;
        justify-content: flex-start;
        text-align: left;
        min-height: 0;
    }

    /* Area Assignments & Larger Fonts */
    .r-cell.w-date {
        grid-area: date;
        font-weight: 700;
        font-size: 17px;
        color: #000;
    }


    .r-cell.w-shift {
        grid-area: shift;
        justify-content: center;
        font-size: 22px;
    }

    .r-cell.w-money {
        grid-area: income;
        justify-content: flex-end;
        font-size: 17px;
    }

    .r-cell.w-time {
        grid-area: time;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        background: #f9f9f9;
        padding: 10px 12px;
        border-radius: 6px;
        font-size: 15px;
        color: #444;
        font-weight: 500;
    }


    /* Group Stats (Normal, OT, Piece) */
    .mobile-stats-group {
        grid-area: stats;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
        background: #f0f5ff;
        padding: 10px 12px;
        border-radius: 6px;
    }

    /* Stats Cells Placement */
    .r-cell.w-num:nth-child(4) {
        grid-row: 3;
        grid-column: 1;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    /* Normal */
    .r-cell.w-num:nth-child(5) {
        grid-row: 3;
        grid-column: 2;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    /* OT */
    .r-cell.w-num:nth-child(6) {
        grid-row: 3;
        grid-column: 3;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    /* Piece */
    /* Labels for stats */
    .r-cell.w-num::before {
        content: attr(data-label);
        font-size: 11px;
        text-transform: uppercase;
        color: #777;
        font-weight: 700;
    }


    .r-cell.w-num {
        background: #f7f7f7;
        padding: 8px;
        border-radius: 6px;
        font-size: 15px;
        font-weight: 600;
    }


    .r-cell.w-note {
        grid-area: note;
        font-size: 14px;
        color: #666;
        margin-top: 6px;
        white-space: normal;
        font-style: normal;
    }


    .r-cell.w-note:empty {
        display: none;
    }

    .filter-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .filter-label {
        font-size: 13px;
        font-weight: 600;
        color: #555;
    }

    .filter-select {
        padding: 8px 12px;
        border: 1px solid #ddd;
    }

}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.badge-blue {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-orange {
    background: #fff3e0;
    color: #f57c00;
}

.badge-green {
    background: #05a62d;
    color: #fff;
}

.badge-red {
    background: #f8d7da;
    color: #721c24;
}

.badge-gray {
    background: #f0f0f0;
    color: #666;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4CAF50;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* ====================================
   .mobile-large - Mobile Responsive Input
   Reusable class for large inputs on mobile
   ==================================== */
/* Mobile: Large input for easy typing */
@media only screen and (max-width: 768px) {
    .mobile-large {
        width: 100% !important;
        height: 50px !important;
        font-size: 25px !important;
    }
}

/* PC/Tablet: Default system input style */
@media only screen and (min-width: 769px) {
    .mobile-large {
        /* Inherits default input styles:
           - padding: 5px 12px
           - height: 30px
           - border-radius: 6px
           - border: 1px solid #6cace4
        */
    }
}