.table td,
.table th {
    padding: 5px;
    vertical-align: middle;
}

.table th {
    text-align: center;
}

/* Nền header bảng đậm hơn một chút để phân biệt rõ với phần thân */
.table thead th {
    background-color: #e2e8f0;
    font-weight: 600;
    border-bottom: 2px solid #cbd5e1;
}

/* ===== Mobile: hamburger + sidebar overlay =====
   Theme gốc ẩn cả #navigation lẫn .left-side-menu dưới 992px mà không có nút
   toggle nào -> mobile không điều hướng được. Nút #mobileMenuBtn (header.php)
   toggle class .sidebar-open trên <body> để mở sidebar dạng overlay. */
.mobile-menu-btn { display: none; }

@media screen and (max-width: 991.98px) {
    /* Bảng tự cuộn ngang trên mobile — lưới an toàn cho những bảng
       không được bọc .table-responsive (orders, loading, invoices...) */
    .content table.table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .content .table-responsive > table.table { display: table; }

    .mobile-menu-btn {
        display: inline-block;
        float: left;
        padding: 0 14px;
        line-height: 70px;
        font-size: 26px;
        color: #323a46;
    }

    body.sidebar-open .left-side-menu {
        display: block !important;
        position: fixed;
        top: 70px;
        left: 0;
        bottom: 0;
        width: 250px;
        z-index: 1050;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #ffffff;
        box-shadow: 0 0 24px rgba(0, 0, 0, .2);
    }

    .mobile-sidebar-overlay { display: none; }

    body.sidebar-open .mobile-sidebar-overlay {
        display: block;
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, .4);
        z-index: 1049;
    }
}

/* ===== Ticket: dropzone đính kèm ảnh (kéo-thả / dán / chọn) ===== */
.tk-dropzone {
    border: 2px dashed #b6c2cf;
    border-radius: 8px;
    background: #f8fafc;
    padding: 18px;
    text-align: center;
    color: #64748b;
    cursor: pointer;
    transition: all .15s ease;
    font-size: 14px;
}
.tk-dropzone:hover { border-color: #3b82f6; color: #3b82f6; background: #f0f7ff; }
.tk-dropzone.dragover { border-color: #2563eb; background: #e6f0ff; color: #2563eb; }
.tk-dropzone i { font-size: 22px; display: block; margin-bottom: 4px; }

.tk-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tk-thumb {
    position: relative;
    width: 90px; height: 90px;
    border: 1px solid #dee2e6; border-radius: 6px; overflow: hidden; background: #fff;
}
.tk-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tk-thumb-x {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px; line-height: 18px;
    border: none; border-radius: 50%;
    background: rgba(220,53,69,.92); color: #fff;
    font-size: 15px; cursor: pointer; padding: 0;
}
.tk-thumb-x:hover { background: #dc3545; }

/* Ảnh đã lưu (gallery) trong chi tiết ticket */
.tk-gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-gallery .tk-img {
    position: relative;
    width: 110px; height: 110px;
    border: 1px solid #dee2e6; border-radius: 6px; overflow: hidden; background: #fff;
}
.tk-gallery .tk-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.tk-gallery .tk-img-del {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px; line-height: 18px;
    border: none; border-radius: 50%;
    background: rgba(0,0,0,.55); color: #fff; font-size: 14px; cursor: pointer; padding: 0;
}
.tk-gallery .tk-img-del:hover { background: #dc3545; }

/* Dòng trao đổi ticket */
.tk-comment { border-bottom: 1px solid #eef1f4; padding: 12px 0; }
.tk-comment:last-child { border-bottom: none; }
.tk-comment .tk-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: #3b82f6; color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    flex: 0 0 36px; /* flex-item: không cho co ngang khi comment dài (tránh méo hình tròn) */
    align-self: flex-start;
}
.tk-system-note {
    background: #f1f5f9; border-radius: 6px; padding: 6px 12px;
    color: #64748b; font-size: 13px; font-style: italic;
}

#wrapper {
    width: 100% !important;
}

.bangdonhang {
    font-size: 14px;
}

.toast-container {
    top: 20px;
    /* Cách mép trên màn hình 20px */
    right: 20px;
    /* Cách mép phải màn hình 20px */
    z-index: 1055;
    /* Hiển thị nổi trên các phần tử khác */
}

.cart-icon {
    position: relative;
}

.cart-icon .badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
    font-size: 0.75rem;
}

.navigation-menu>li>a {
    color: #458bc4 !important;
}

/* Override theme app.min.css: bỏ margin-bottom mặc định 24px của .card/.card-box.
   Card sẽ căn khoảng cách theo utility Bootstrap (mb-2/mb-3...) trên cột/hàng
   -> layout đều, không bị lệch do double-spacing. */
.card,
.card-box {
    margin-bottom: 0;
}/* ===== Roboto tự host (không phụ thuộc Google Fonts — tránh bị chặn ở Trung Quốc) ===== */
/* vietnamese */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto/roboto-400-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto/roboto-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/roboto/roboto-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* vietnamese */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/roboto/roboto-500-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/roboto/roboto-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/roboto/roboto-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* vietnamese */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/roboto/roboto-700-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/roboto/roboto-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/roboto/roboto-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Thống nhất toàn hệ thống dùng Roboto =====
   Trước đây body dùng "Noto Sans" (bootstrap.min.css) còn a/p/b/strong/h1-h5/label
   bị ép 'Arial' !important trong layout -> cùng 1 bảng lẫn 2 font.
   custom.css nạp sau app.min.css nên chỉ cần cùng độ ưu tiên là đè được. */
:root {
    --app-font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

body {
    font-family: var(--app-font);
}

/* Vài thành phần của theme khai báo font riêng — kéo hết về Roboto */
.swal2-modal,
.daterangepicker,
.font-family-secondary,
.legend tr,
.notification-list .notify-item .notify-details,
.morris-hover.morris-default-style,
.morris-hover.morris-default-style .morris-hover-row-label,
.fc-ltr .fc-basic-view .fc-day-top .fc-day-number {
    font-family: var(--app-font);
}

.morris-chart text {
    font-family: var(--app-font) !important;
}

/* Nút/ô nhập/bảng kế thừa từ body thay vì font riêng của trình duyệt */
button,
input,
select,
textarea,
.btn,
.form-control,
table,
th,
td {
    font-family: inherit;
}

/* ===== Sửa lệch chữ trong badge =====
   Bootstrap đặt .badge { line-height: 1 } — bằng đúng font-size, nên hộp dòng
   chật hơn metric tự nhiên của font. Với Roboto (ascent lớn hơn Noto Sans cũ)
   chữ bị đẩy sát lề trên ~1.5px. Dùng line-height:normal để trình duyệt tự căn
   theo metric của font (đúng với mọi font sau này), bù padding dọc để giữ
   nguyên chiều cao badge. */
.badge {
    line-height: normal;
    padding-top: .15em;
    padding-bottom: .15em;
}

/* ===== Ô mã vận đơn dùng chung cho /orders và /orders/zero-price ===== */
    /* ===== Ô mã vận đơn: 🐭 góc trên trái, nút kho VN góc trên phải, nội dung ở giữa ===== */
    .tracking-cell {
        position: relative;
        padding: 6px 24px !important;
        vertical-align: middle;
    }
    /* Giữ ngày nhập kho trên 1 dòng, không bị vỡ khi ô mã vận đơn rộng ra */
    .stock-date-cell {
        white-space: nowrap;
    }
    .tracking-cell .food-flag {
        position: absolute;
        top: 1px;
        left: 3px;
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
        transition: opacity .15s;
    }
    .tracking-cell .food-flag:hover {
        transform: scale(1.1);
    }
    /* Đã bấm bỏ đánh dấu — làm mờ để biết còn bấm lại được */
    .tracking-cell .food-flag.is-off {
        opacity: .25;
        filter: grayscale(100%);
    }

    /* ===== Dòng hàng thực phẩm: nền cam nhạt để kho dễ nhận ra ===== */
    .table tbody tr.food-row > td,
    .table-striped tbody tr.food-row:nth-of-type(odd) > td,
    .table-striped tbody tr.food-row:nth-of-type(even) > td {
        background-color: #ffe8c2 !important;
    }
    .table tbody tr.food-row:hover > td,
    .table-striped tbody tr.food-row:hover > td {
        background-color: #ffdca3 !important;
    }
    .table tbody tr.food-row > td:first-child {
        box-shadow: inset 4px 0 0 0 #fd7e14;
    }
    .tracking-cell .vn-corner-btn {
        position: absolute;
        top: 2px;
        right: 4px;
        padding: 0 4px;
        line-height: 1.5;
    }
    .tracking-cell .tracking-code {
        white-space: nowrap;
        font-weight: 500;
    }
    .tracking-cell .tracking-name {
        font-size: 11px;
        line-height: 1.3;
        color: #7a7d84;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

/* ===== Timeline trạng thái đơn hàng (trang chi tiết đơn) ===== */
.order-timeline {
    list-style: none;
    margin: 0;
    padding: 4px 0 0 0;
    position: relative;
}
.order-timeline .otl-item {
    position: relative;
    padding: 0 0 20px 42px;
}
/* Đường nối dọc giữa các mốc — mốc cuối không kẻ tiếp */
.order-timeline .otl-item::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 26px;
    bottom: 0;
    width: 2px;
    background: #e6e8ec;
}
.order-timeline .otl-item:last-child {
    padding-bottom: 0;
}
.order-timeline .otl-item:last-child::before {
    display: none;
}
.order-timeline .otl-dot {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 0 0 3px #fff;
}
.order-timeline .otl-title {
    font-weight: 600;
    line-height: 1.3;
    color: #3b3f45;
}
.order-timeline .otl-meta {
    font-size: 12px;
    color: #8a8d94;
    margin-top: 2px;
}
.order-timeline .otl-sep {
    margin: 0 4px;
}
/* Mốc mới nhất được làm nổi */
.order-timeline .otl-current .otl-title {
    color: #1f2329;
}
.order-timeline .otl-current .otl-dot {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(0, 0, 0, .06);
}

/* ===== Bảng sát mép card (trang chi tiết đơn hàng) =====
   Bỏ viền ngoài của bảng để không bị "khung trong khung" với viền card:
   chỉ giữ đường kẻ ngang phân cách các dòng. */
.flush-table > thead > tr > th,
.flush-table > tbody > tr > th,
.flush-table > tbody > tr > td {
    border-left: 0;
    border-right: 0;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
/* Dòng đầu không cần kẻ trên vì đã có viền dưới của card-header
   (khi có thead thì phần thân vẫn được ngăn cách bằng viền dưới của thead) */
.flush-table > thead > tr:first-child > th,
.flush-table > tbody > tr:first-child > th,
.flush-table > tbody > tr:first-child > td {
    border-top: 0;
}
/* .table-responsive bọc ngoài không được tạo thêm khung */
.card-body.p-0 > .table-responsive {
    border: 0;
}

/* Ô bảng giữ 1 dòng, chữ dài cắt bằng dấu ... (hover xem đủ qua title) */
.cell-ellipsis {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Ticket: tài liệu đính kèm ===== */
.tk-files { display: flex; flex-direction: column; gap: 6px; }
.tk-file {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid #e6e8ec; border-radius: 6px;
    padding: 6px 10px; background: #fbfcfd;
}
.tk-file-icon { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.tk-file-name {
    flex: 1 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 13px; font-weight: 500;
}
.tk-file-size { flex: 0 0 auto; font-size: 11px; color: #8a8d94; }
.tk-file-del {
    flex: 0 0 auto; width: 20px; height: 20px; line-height: 18px; padding: 0;
    border: none; border-radius: 50%; cursor: pointer;
    background: rgba(0, 0, 0, .35); color: #fff; font-size: 14px;
}
.tk-file-del:hover { background: #dc3545; }

/* Danh sách tên file vừa chọn ở input */
.tk-file-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tk-file-chip {
    font-size: 12px; color: #475569;
    background: #f1f5f9; border-radius: 4px; padding: 3px 8px;
}
.tk-file-chip.over { background: #fdecea; color: #b42318; }

/* ===== Nội dung ticket / trao đổi (rich_text helper) =====
   Trước đây view dùng đồng thời white-space:pre-wrap và nl2br() nên mỗi lần
   xuống dòng bị nhân đôi, nhìn rất thưa. Nay nội dung được dựng thành đoạn văn
   và danh sách thật, khoảng cách do CSS quyết định. */
.rich-text {
    word-break: break-word;
}
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p {
    margin: 0 0 .6rem;
    line-height: 1.6;
}
.rich-text ul.rt-list,
.rich-text ol.rt-list {
    margin: 0 0 .6rem;
    padding-left: 1.35rem;
}
.rich-text ul.rt-list li,
.rich-text ol.rt-list li {
    margin-bottom: .25rem;
    line-height: 1.6;
}
.rich-text code {
    background: #f1f3f5;
    border-radius: 3px;
    padding: .1em .35em;
    font-size: .875em;
    color: #c7254e;
}
.rich-text a { word-break: break-all; }

/* Nội dung HTML trong ticket: bảng, tiêu đề, trích dẫn.
   Comment trả lời dài dùng bảng đối chiếu dễ đọc hơn hẳn chữ chay. */
.rich-text table {
    width: auto;
    max-width: 100%;
    margin: 0 0 .7rem;
    border-collapse: collapse;
    font-size: .9375rem;
}
.rich-text table th,
.rich-text table td {
    border: 1px solid #dfe3e8;
    padding: .35rem .6rem;
    vertical-align: top;
    text-align: left;
}
.rich-text table th {
    background: #f1f3f5;
    font-weight: 600;
}
/* Trong bảng thì KHÔNG cắt chữ giữa từ: .rich-text đặt word-break: break-word
   cho văn bản dài, nhưng áp vào ô bảng hẹp sẽ vỡ cả "KHOTM" thành "KHOT M". */
.rich-text table,
.rich-text table th,
.rich-text table td {
    word-break: normal;
    overflow-wrap: normal;
    white-space: nowrap;
}
.rich-text table a,
.rich-text table code { word-break: normal; }
/* Bảng rộng hơn cột trao đổi thì cuộn ngang thay vì bóp méo */
.rich-text .rt-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: .7rem;
}
.rich-text .rt-table-wrap > table { margin-bottom: 0; }
.rich-text table tr:nth-child(even) td { background: #fafbfc; }

.rich-text h1, .rich-text h2, .rich-text h3,
.rich-text h4, .rich-text h5, .rich-text h6 {
    margin: .9rem 0 .4rem;
    font-weight: 600;
    line-height: 1.35;
}
.rich-text h1 { font-size: 1.15rem; }
.rich-text h2 { font-size: 1.1rem; }
.rich-text h3 { font-size: 1.05rem; }
.rich-text h4, .rich-text h5, .rich-text h6 { font-size: 1rem; }

.rich-text ul, .rich-text ol {
    margin: 0 0 .6rem;
    padding-left: 1.35rem;
}
.rich-text li { margin-bottom: .25rem; line-height: 1.6; }

.rich-text blockquote {
    margin: 0 0 .6rem;
    padding: .35rem .8rem;
    border-left: 3px solid #cbd5e1;
    color: #52606d;
    background: #f8fafc;
}
.rich-text pre {
    background: #f6f8fa;
    border: 1px solid #e5e9ee;
    border-radius: 5px;
    padding: .6rem .8rem;
    margin: 0 0 .6rem;
    overflow-x: auto;
    font-size: .875rem;
}
.rich-text pre code {
    background: none;
    color: inherit;
    padding: 0;
}
.rich-text hr {
    margin: .8rem 0;
    border: 0;
    border-top: 1px solid #e5e9ee;
}
.rich-text img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}
.rich-text mark {
    background: #fff3bf;
    padding: 0 .15em;
}

/* ===== Ô soạn thảo có định dạng (Quill, tự host) ===== */
.rich-editor { margin-bottom: .25rem; }
.rich-editor .ql-toolbar.ql-snow {
    border: 1px solid #ced4da;
    border-bottom: 0;
    border-radius: .25rem .25rem 0 0;
    background: #f8f9fa;
    padding: 5px 8px;
}
.rich-editor .ql-container.ql-snow {
    border: 1px solid #ced4da;
    border-radius: 0 0 .25rem .25rem;
    font-family: inherit;
    font-size: .9375rem;
}
.rich-editor .ql-editor {
    min-height: 130px;
    line-height: 1.6;
    padding: 10px 12px;
}
.rich-editor .ql-editor.ql-blank::before {
    font-style: normal;
    color: #9aa5b1;
    left: 12px;
    right: 12px;
}
/* Quill đặt margin 0 cho p; trả lại khoảng cách đoạn cho giống lúc hiển thị */
.rich-editor .ql-editor p { margin-bottom: .5rem; }
.rich-editor .ql-editor p:last-child { margin-bottom: 0; }
.rich-editor .ql-editor blockquote {
    border-left: 3px solid #cbd5e1;
    padding-left: .8rem;
    color: #52606d;
}
