/* =====================================================================
   Bảo Hành & Hậu Mãi — giao diện
   Máy tính: sidebar tối + thanh trên. Điện thoại: thanh tab dưới kiểu app.
   ===================================================================== */
:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff4ff;
    --ink: #0f172a;
    --text: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --ok: #16a34a;
    --warn: #d97706;
    --bad: #dc2626;
    --radius: 14px;
    --side-w: 256px;
    --top-h: 60px;
    --tab-h: 62px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);

    --bs-primary: var(--brand);
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-color: var(--text);
    --bs-border-color: var(--line);
    --bs-secondary-color: var(--muted);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 37, 99, 235;
    --bs-link-hover-color: var(--brand-dark);
    --bs-border-radius: 10px;
    --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-size: .9375rem;
}

* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg) !important; color: var(--text); font-feature-settings: "tnum"; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -4px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace; letter-spacing: .3px; }
.text-secondary { color: var(--muted) !important; }

/* ---------- Khung ứng dụng ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.app-main { margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.content { flex: 1; padding: 24px 28px 40px; width: 100%; max-width: 1480px; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--ink); color: #cbd5e1; display: flex; flex-direction: column; padding: 14px 12px; overflow-y: auto; z-index: 1030; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; color: #fff; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 18px 12px 6px; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #cbd5e1; font-weight: 500; font-size: .92rem; transition: background .15s, color .15s; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.side-link.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }
.side-foot { margin-top: 12px; color: #94a3b8; font-size: .85rem; border-top: 1px solid rgba(255, 255, 255, .08); border-radius: 0 0 10px 10px; padding-top: 14px; }

.topbar { position: sticky; top: 0; z-index: 1020; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: rgba(255, 255, 255, .88); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-search { margin-right: auto; position: relative; width: min(420px, 100%); }
.topbar-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.topbar-search input { width: 100%; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px 0 38px; font-size: .88rem; outline: 0; }
.topbar-search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.topbar-title { display: none; font-weight: 700; font-size: 1.05rem; color: var(--ink); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.shop-switch, .shop-chip { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px 0 12px; height: 38px; color: var(--muted); font-size: .88rem; }
.shop-chip { padding-right: 14px; color: var(--text); font-weight: 600; }
.shop-switch select { border: 0; background: transparent; font-weight: 600; color: var(--text); font-size: .88rem; max-width: 180px; height: 36px; outline: 0; cursor: pointer; padding-right: 4px; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 6px; border-radius: 12px; text-align: left; }
.user-btn:hover { background: var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-meta b { font-size: .88rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabbar, .sheet { display: none; }

/* ---------- Thành phần ---------- */
.content h1.h4 { font-size: 1.35rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); overflow: hidden; }
.card-header { background: var(--surface) !important; border-bottom: 1px solid var(--line); padding: 14px 18px; font-weight: 600; color: var(--ink); }
.card-body { padding: 18px; }
.list-group-item { border-color: var(--line); padding: 12px 18px; }
.list-group-item-action:hover { background: #f8fafc; text-decoration: none; }

.btn { border-radius: 10px; font-weight: 600; padding: .5rem 1rem; }
.btn-sm { border-radius: 8px; padding: .32rem .7rem; font-size: .82rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); box-shadow: 0 2px 8px rgba(37, 99, 235, .25); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: #bfd2fb; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.btn-success { --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d; }
.btn-outline-secondary { --bs-btn-color: var(--muted); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--bg); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line); background: var(--surface); }
.btn-check:checked + .btn-outline-primary { background: var(--brand); border-color: var(--brand); }

.form-label { font-size: .82rem; font-weight: 600; color: #475569; margin-bottom: .3rem; }
.form-control, .form-select { border-color: #cbd5e1; border-radius: 10px; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.form-control-lg { font-size: 1.05rem; }
.form-text { color: var(--muted); }
.input-group > .btn { border-radius: 10px; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

.badge { font-weight: 600; border-radius: 999px; padding: .38em .7em; font-size: .74rem; letter-spacing: .01em; }
.badge.fs-6 { font-size: .8rem !important; }
.text-bg-success { background: #dcfce7 !important; color: #166534 !important; }
.text-bg-danger { background: #fee2e2 !important; color: #991b1b !important; }
.text-bg-warning { background: #fef3c7 !important; color: #92400e !important; }
.text-bg-primary { background: #dbeafe !important; color: #1e40af !important; }
.text-bg-info { background: #cffafe !important; color: #155e75 !important; }
.text-bg-secondary { background: #e2e8f0 !important; color: #475569 !important; }
.text-bg-dark { background: #1e293b !important; color: #f1f5f9 !important; }
.text-bg-light { background: #f8fafc !important; color: #475569 !important; }

.table { --bs-table-bg: transparent; margin: 0; }
.table > thead > tr > th { background: #f8fafc; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table > tbody > tr > td { padding: 13px 16px; vertical-align: middle; border-color: var(--line); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8fafc; }

.nav-pills { background: #e2e8f0; border-radius: 12px; padding: 4px; gap: 2px; display: inline-flex; }
.nav-pills .nav-link { border-radius: 9px; color: var(--muted); font-weight: 600; padding: .4rem 1rem; font-size: .88rem; }
.nav-pills .nav-link:hover { text-decoration: none; color: var(--ink); }
.nav-pills .nav-link.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }

.pagination { --bs-pagination-border-radius: 10px; --bs-pagination-color: var(--text); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); margin: 0; }
.dropdown-item .ic { width: 18px; height: 18px; }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; border: 1px solid; transition: opacity .4s, margin .4s, padding .4s, max-height .4s; max-height: 400px; overflow: hidden; }
.flash .ic { margin-top: 1px; }
.flash-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.flash-err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info { background: var(--brand-soft); border-color: #c7d9fd; color: #1e40af; font-weight: 400; font-size: .88rem; }
.flash-hide { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin-bottom: 0; border-width: 0; }
.alert { border-radius: 12px; }

/* Thẻ số liệu & lối tắt (Tổng quan) */
.stat { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 16px; height: 100%; color: inherit; transition: transform .15s, box-shadow .15s; }
.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, .09); }
.stat-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-ic .ic { width: 22px; height: 22px; }
.stat .num { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--ink); letter-spacing: -.02em; }
.stat .lbl { font-size: .8rem; color: var(--muted); line-height: 1.25; }
.tone-success { background: #dcfce7; color: #15803d; }
.tone-warning { background: #fef3c7; color: #b45309; }
.tone-secondary { background: #e2e8f0; color: #475569; }
.tone-primary { background: #dbeafe; color: #1d4ed8; }
.tone-danger { background: #fee2e2; color: #b91c1c; }
.tone-dark { background: #e0e7ff; color: #4338ca; }
.quick { display: none; }

/* Thẻ kết quả tem */
.result-ok, .result-warn, .result-bad, .result-new { position: relative; }
.result-ok::before, .result-warn::before, .result-bad::before, .result-new::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; }
.result-ok::before { background: var(--ok); }
.result-warn::before { background: var(--warn); }
.result-bad::before { background: var(--bad); }
.result-new::before { background: #94a3b8; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: .45rem 1rem; margin: 0; font-size: .92rem; }
dl.kv dt { font-weight: 500; color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }

/* Trang quét */
.scan-input { font-size: 1.25rem; padding: .75rem 1rem; }
#reader { max-width: 480px; border-radius: 12px; overflow: hidden; }
#reader video { border-radius: 12px; }
#history .list-group-item { font-size: .8rem; }

/* ---------- Trang đăng nhập & trang công khai ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #1d4ed8 0%, transparent 55%), var(--ink); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 32px 28px; box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.auth-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--brand); color: #fff; display: grid; place-items: center; margin: 0 auto 14px; }
.auth-logo .ic { width: 30px; height: 30px; }
.auth-foot { text-align: center; margin-top: 18px; }
.auth-foot a { color: #bfdbfe; font-size: .9rem; }

.pub-head { background: var(--ink); color: #fff; padding: calc(28px + var(--safe-t)) 16px 64px; text-align: center; }
.pub-head h1 { font-size: 1.35rem; font-weight: 700; margin: 10px 0 2px; }
.pub-head p { color: #94a3b8; margin: 0; font-size: .9rem; }
.pub-body { max-width: 640px; margin: -40px auto 0; padding: 0 16px 40px; }
.pub-search { background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .12); margin-bottom: 16px; }

/* =====================================================================
   Điện thoại & máy tính bảng dọc: kiểu app
   ===================================================================== */
@media (max-width: 991.98px) {
    :root { --top-h: 54px; }
    .sidebar { display: none; }
    .app-main { margin-left: 0; }
    .content { padding: 14px 14px calc(var(--tab-h) + var(--safe-b) + 24px); }
    .topbar { padding: var(--safe-t) 14px 0; height: calc(var(--top-h) + var(--safe-t)); background: var(--ink); border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .topbar-title { display: block; color: #fff; font-size: 1.08rem; }
    .topbar-search { display: none; }
    .shop-switch, .shop-chip { background: rgba(255, 255, 255, .1); border-color: transparent; color: #cbd5e1; height: 34px; }
    .shop-chip { color: #fff; }
    .shop-switch select { color: #fff; max-width: 132px; height: 32px; }
    .shop-switch select option { color: var(--text); }

    /* Tiêu đề trang đã nằm trên thanh trên → chỉ giữ hàng nút thao tác */
    .content > .d-flex:first-child > h1.h4, .content > h1.h4:first-child,
    .flash + .d-flex > h1.h4, .flash + h1.h4 { display: none; }
    .content > .d-flex:first-child, .flash + .d-flex { justify-content: flex-end; }

    .tabbar { display: flex; position: fixed; inset: auto 0 0 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 1035; }
    .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: #94a3b8; font-size: .68rem; font-weight: 600; padding: 0; min-width: 0; }
    .tab:hover { text-decoration: none; color: #94a3b8; }
    .tab .ic { width: 23px; height: 23px; }
    .tab.active { color: var(--brand); }
    .tab-scan { position: relative; color: var(--muted); }
    .fab { width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; margin-top: -30px; box-shadow: 0 6px 18px rgba(37, 99, 235, .45), 0 0 0 5px var(--bg); }
    .fab .ic { width: 26px; height: 26px; stroke-width: 2; }
    .tab-scan.active .fab { background: var(--brand-dark); }

    .sheet { display: flex; height: auto !important; max-height: 82vh; border-radius: 22px 22px 0 0; border: 0; padding-bottom: var(--safe-b); z-index: 1050; }
    .sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: #cbd5e1; margin: 10px auto 4px; flex-shrink: 0; }
    .sheet-user { display: flex; align-items: center; gap: 12px; padding: 12px 18px 14px; border-bottom: 1px solid var(--line); }
    .sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 14px 10px; overflow-y: auto; }
    .sheet-item { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: .76rem; font-weight: 600; color: var(--text); padding: 10px 4px; border-radius: 14px; line-height: 1.25; }
    .sheet-item:hover { text-decoration: none; }
    .sheet-item.active { background: var(--brand-soft); color: var(--brand); }
    .sheet-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--bg); display: grid; place-items: center; color: var(--brand); }
    .sheet-item.active .sheet-ic { background: #fff; }
    .offcanvas-backdrop { z-index: 1045; }

    /* Chạm dễ hơn, không bị iOS tự phóng to khi nhập */
    .form-control, .form-select { font-size: 16px; min-height: 46px; }
    .form-control-sm, .form-select-sm { font-size: 15px; min-height: 40px; }
    .btn:not(.btn-sm) { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; }
    .btn-sm { min-height: 36px; display: inline-flex; align-items: center; }
    .card-body { padding: 14px; }
    .card-header { padding: 12px 14px; }
    .list-group-item { padding: 12px 14px; }
    dl.kv { grid-template-columns: 108px 1fr; }
    .nav-pills { display: flex; width: 100%; }
    .nav-pills .nav-item { flex: 1; }
    .nav-pills .nav-link { text-align: center; padding: .5rem .3rem; }

    .stat { padding: 12px; gap: 10px; }
    .stat-ic { width: 38px; height: 38px; border-radius: 10px; }
    .stat .num { font-size: 1.35rem; }
    .quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
    .quick a { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .72rem; font-weight: 600; color: var(--text); text-align: center; line-height: 1.2; }
    .quick a:hover { text-decoration: none; }
    .quick span { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--brand); box-shadow: var(--shadow); }
    .quick .ic { width: 24px; height: 24px; }
    .hide-mobile { display: none !important; }

    .scan-input { font-size: 1.1rem; }
    #reader { max-width: none; }
}

/* Bảng → thẻ trên điện thoại (nhãn lấy từ tiêu đề cột, gán bằng assets/js/app.js) */
@media (max-width: 767.98px) {
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody { display: block; }
    .table-cards tbody tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .table-cards tbody tr:last-child { border-bottom: 0; }
    .table-cards tbody td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 3px 0 !important; border: 0 !important; }
    .table-cards tbody td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 500; flex-shrink: 0; padding-top: 2px; }
    .table-cards tbody td > .cell { text-align: right; min-width: 0; overflow-wrap: anywhere; }
    .table-cards tbody td:not([data-label]) > .cell { text-align: left; }
    .table-cards tbody td:first-child > .cell, .table-cards tbody td.cell-main > .cell { font-weight: 600; color: var(--ink); }
    .table-cards tbody td.cell-form { display: block; padding-top: 8px !important; }
    .table-cards tbody td.cell-form::before { display: block; margin-bottom: 4px; }
    .table-cards tbody td.cell-form > .cell { text-align: left; }
    .table-cards tbody td.cell-empty { display: none; }
    .table-cards tbody tr.row-plain td { display: block; text-align: center; }
    .pagination { flex-wrap: wrap; }
    nav[role=navigation] .d-none.flex-sm-fill { display: none !important; }
}

@media print {
    .app-main { margin: 0; }
    .content { padding: 0; }
}

/* Ô tích rõ hơn, dễ chạm hơn */
.form-check-input { border-color: #94a3b8; }
@media (max-width: 991.98px) {
    .form-check-input { width: 1.3em; height: 1.3em; }
    #camBtn { width: 100%; }
}

/* Ô tìm khách hàng hiện có (form kích hoạt bảo hành) */
.cust-results { position: absolute; inset: calc(100% + 4px) 0 auto 0; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); max-height: 320px; overflow-y: auto; padding: 4px; }
.cust-row { display: flex; flex-direction: column; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 9px; line-height: 1.3; }
.cust-row:hover, .cust-row:focus { background: var(--brand-soft); outline: 0; }
.cust-row b { font-weight: 600; color: var(--ink); font-size: .92rem; }
.cust-row small { color: var(--muted); font-size: .8rem; }
.cust-new b { color: var(--brand); }
.cust-new { border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 2px; }
.cust-empty { padding: 10px 12px; color: var(--muted); font-size: .88rem; }
.cust-chip { align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #bfd2fb; background: var(--brand-soft); border-radius: 12px; }
.cust-chip .avatar { background: #fff; }
.cust-chip .btn { white-space: nowrap; flex-shrink: 0; padding-left: .55rem; padding-right: .55rem; }

/* Dịch vụ đang làm (kết quả quét) */
.svc-box { border: 1px solid #bfd2fb; background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; }
.svc-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .86rem; color: #1e40af; margin-bottom: 6px; }
.svc-title .ic { width: 18px; height: 18px; }
.svc-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid #d6e2fd; }
.svc-list > .svc-row:first-child { border-top: 0; padding-top: 2px; }
.min-w-0 { min-width: 0; flex: 1; }

/* Trang theo dõi phiếu của khách */
.track-status { border-radius: 14px; padding: 14px 16px; text-align: center; }
.track-now { font-size: 1.25rem; font-weight: 700; line-height: 1.3; margin: 2px 0; }
.track-run { background: #dbeafe; color: #1e40af; }
.track-ok { background: #dcfce7; color: #166534; }
.track-warn { background: #fef3c7; color: #92400e; }
.track-bad { background: #fee2e2; color: #991b1b; }
.track-steps { list-style: none; display: flex; padding: 0; margin: 16px 0 4px; }
.track-steps li { flex: 1; text-align: center; position: relative; font-size: .7rem; color: var(--muted); }
.track-steps li::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.track-steps li:first-child::before { display: none; }
.track-steps .dot { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; background: #e2e8f0; color: var(--muted); display: grid; place-items: center; margin: 0 auto 4px; font-weight: 700; font-size: .78rem; }
.track-steps .dot .ic { width: 16px; height: 16px; stroke-width: 2.5; }
.track-steps .is-done .dot, .track-steps .is-now .dot { background: var(--brand); color: #fff; }
.track-steps .is-now .dot { box-shadow: 0 0 0 4px rgba(37, 99, 235, .2); }
.track-steps .is-done::before, .track-steps .is-now::before { background: var(--brand); }
.track-steps .is-now .nm { color: var(--ink); font-weight: 700; }
.track-steps .nm { display: block; line-height: 1.2; }

/* ================= Ô chọn có tìm kiếm ================= */
.ss { position: relative; display: block; }
.ss.ss-auto { display: inline-block; vertical-align: middle; }
.ss-btn { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; width: 100%; }
.ss-auto .ss-btn { min-width: 150px; max-width: 280px; }
.ss-btn.ss-placeholder { color: var(--muted); }
.ss-btn:disabled { background-color: #e9ecef; cursor: not-allowed; opacity: 1; }
.ss-btn.is-invalid { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.ss-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; min-height: 0 !important; opacity: 0; pointer-events: none; }
.ss-panel, .dp-panel { position: fixed; z-index: 1080; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(15, 23, 42, .18); }
.ss-panel { display: flex; flex-direction: column; padding: 6px; overflow: hidden; }
.ss-q { border: 1px solid #cbd5e1; border-radius: 9px; padding: .45rem .7rem; font-size: 16px; outline: 0; margin-bottom: 6px; width: 100%; flex-shrink: 0; }
.ss-q:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.ss-list { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.ss-opt { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: .92rem; line-height: 1.3; }
.ss-opt.is-active { background: var(--brand-soft); }
.ss-opt.is-selected { font-weight: 600; color: var(--brand); }
.ss-opt-empty { color: var(--muted); }
.ss-opt-off { color: #94a3b8; cursor: not-allowed; }
.ss-none { padding: 12px; color: var(--muted); font-size: .88rem; text-align: center; }

/* ================= Ô chọn ngày ================= */
.dp { position: relative; }
.dp-input { padding-right: 2.4rem !important; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='2'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E") no-repeat right .7rem center / 18px; font-variant-numeric: tabular-nums; }
.dp-input:disabled { background-color: #e9ecef; }
.dp-panel { padding: 10px; overflow: auto; }
.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dp-nav { width: 34px; height: 34px; border: 0; background: var(--bg); border-radius: 9px; font-size: 1.2rem; line-height: 1; color: var(--text); flex-shrink: 0; }
.dp-nav:hover { background: #e2e8f0; }
.dp-sel { border: 1px solid var(--line); border-radius: 9px; padding: .3rem .4rem; font-size: .88rem; font-weight: 600; background: var(--surface); color: var(--ink); flex: 1; min-width: 0; height: 34px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: .7rem; font-weight: 600; color: var(--muted); padding: 4px 0; }
.dp-day { aspect-ratio: 1; border: 0; background: transparent; border-radius: 9px; font-size: .88rem; color: var(--text); font-variant-numeric: tabular-nums; padding: 0; }
.dp-day:hover { background: var(--brand-soft); }
.dp-day.is-out { color: #cbd5e1; }
.dp-day.is-today { box-shadow: inset 0 0 0 1.5px var(--brand); font-weight: 700; }
.dp-day.is-picked, .dp-day.is-picked:hover { background: var(--brand); color: #fff; font-weight: 700; }
.dp-time { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.dp-time .dp-sel { flex: 0 0 68px; text-align: center; }
.dp-time-lbl { font-size: .82rem; font-weight: 600; color: var(--muted); margin-right: auto; }
.dp-foot { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.dp-link { border: 0; background: transparent; color: var(--brand); font-weight: 600; font-size: .86rem; padding: 6px 10px; border-radius: 8px; }
.dp-link:hover { background: var(--brand-soft); }
.dp-done { margin-left: auto; border: 0; background: var(--brand); color: #fff; font-weight: 600; font-size: .86rem; padding: 6px 16px; border-radius: 8px; }
@media (max-width: 991.98px) {
    .dp-day { font-size: .95rem; }
    .dp-nav, .dp-sel { height: 40px; }
    .dp-nav { width: 40px; }
    .ss-opt { padding: 11px 12px; }
}

/* Bảng nhiều cột (Super Admin): ô hẹp hơn để nút thao tác không bị đẩy ra ngoài */
.table-tight > thead > tr > th, .table-tight > tbody > tr > td { padding-left: 10px; padding-right: 10px; }
.table-tight > thead > tr > th:first-child, .table-tight > tbody > tr > td:first-child { padding-left: 16px; }

/* ================= Khu Super Admin (tách khỏi phần mềm của cửa hàng) ================= */
.sa { background: var(--bg) !important; }
.sa-bar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 14px; background: var(--ink); padding: calc(10px + var(--safe-t)) 20px 10px; }
.sa-bar .brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.sa-bar .brand-name small { font-weight: 400; font-size: .72rem; color: #94a3b8; }
.sa-content { margin: 0 auto; padding-bottom: 40px !important; }
.support-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: #fef3c7; color: #92400e; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; }
.support-bar .btn { margin-left: auto; }

/* ---------- Lịch sử bảo hành / sửa chữa ---------- */
.hist { border: 1px solid var(--bs-border-color, #e2e8f0); border-radius: 12px; padding: 10px 12px; background: #f8fafc; }
.hist-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hist-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .86rem; margin-right: 4px; }
.hist-title .ic { width: 17px; height: 17px; }
.hist-list { margin-top: 8px; }
.hist-list > summary { cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--muted, #64748b); }
.hist-row { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid #e2e8f0; }
.hist-list > summary + .hist-row { margin-top: 6px; }
.hist-date { flex: 0 0 78px; font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 2px; }
.hist-row.is-cancelled { opacity: .55; }
.hist-row.is-current { background: #eff6ff; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.card-body > .hist, .hist + .hist { margin-top: 12px; }

/* ---------- Hướng dẫn sử dụng ---------- */
.guide-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 40px; width: 100%; max-width: 340px; }
.guide-search .ic { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.guide-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: .9rem; }
.guide-check-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.guide-check-row:first-child { border-top: 0; }
.guide-check-row.is-done > span.me-auto { color: var(--muted); text-decoration: line-through; }
.guide-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cbd5e1; display: grid; place-items: center; flex-shrink: 0; }
.guide-check-row.is-done .guide-tick { background: #16a34a; border-color: #16a34a; color: #fff; }
.guide-tick .ic { width: 14px; height: 14px; }
.guide-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.guide-toc { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; max-height: calc(100vh - 96px); overflow: auto; }
.guide-toc-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 8px 6px; }
.guide-toc a { display: flex; align-items: flex-start; gap: 8px; padding: 7px 8px; border-radius: 9px; color: var(--text); font-size: .86rem; line-height: 1.3; }
.guide-toc a:hover { background: var(--bg); text-decoration: none; }
.guide-toc a.active { background: var(--brand-soft); color: #1e40af; font-weight: 600; }
.guide-toc a .ic { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.guide-topic { scroll-margin-top: 76px; overflow: hidden; }
.guide-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; background: transparent; border: 0; text-align: left; color: inherit; }
.guide-head:hover { background: var(--bg); }
.guide-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.guide-ic .ic { width: 21px; height: 21px; }
.guide-title { display: block; font-weight: 700; color: var(--ink); }
.guide-intro { display: block; font-size: .85rem; color: var(--muted); }
.guide-count { flex-shrink: 0; font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.guide-count.is-done { background: #dcfce7; color: #166534; }
.guide-steps { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.guide-steps ol { list-style: none; margin: 0; padding: 0; }
.guide-steps li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px dashed var(--line); line-height: 1.5; }
.guide-steps li:first-child { border-top: 0; }
.guide-num { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--brand); background: var(--surface); color: var(--brand); font-weight: 700; font-size: .88rem; flex-shrink: 0; padding: 0; line-height: 1; }
.guide-steps li.is-done .guide-num { background: #16a34a; border-color: #16a34a; color: #fff; }
.guide-steps li.is-done > div { color: var(--muted); }
.guide-tips { margin-top: 6px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 12px; font-size: .86rem; display: grid; gap: 6px; }
.help-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.help-btn:hover { color: var(--brand); border-color: var(--brand); text-decoration: none; }
.help-btn .ic { width: 20px; height: 20px; }
@media (max-width: 991.98px) {
    .guide-layout { grid-template-columns: minmax(0, 1fr); }
    .guide-toc { position: static; max-height: none; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 8px; }
    .guide-toc-title, .guide-toc button { display: none; }
    .guide-toc a { flex-shrink: 0; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; align-items: center; }
    .guide-search { max-width: none; }
    .guide-intro { display: none; }
    .guide-head[aria-expanded="true"] .guide-intro { display: block; }
}
@media print {
    .guide-layout { display: block; } .guide-topic { break-inside: avoid; border: 0; box-shadow: none; }
    .guide-search, #gStart .btn { display: none !important; } .guide-count { display: none; }
}
.guide-check-row .btn { white-space: nowrap; flex-shrink: 0; }

/* Bộ lọc tự chạy: làm mờ nhẹ danh sách trong lúc tải */
.auto-loading { opacity: .55; transition: opacity .15s; pointer-events: none; }

/* Logo thương hiệu */
.brand-logo, .auth-logo-img { background: transparent !important; border-radius: 50%; overflow: hidden; }
.brand-logo img, .auth-logo-img img { width: 100%; height: 100%; display: block; object-fit: cover; }
.auth-logo-img { width: 72px; height: 72px; }
.brand-name small { display: block; font-size: .68rem; font-weight: 500; color: #94a3b8; letter-spacing: .02em; }

/* ---------- Rule bảo hành theo thông số đo ---------- */
.rule-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 96px 34px; gap: 6px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); align-items: center; }
.rule-row > :nth-child(1) { grid-column: 1 / 3; }            /* tên thông số */
.rule-row > :nth-child(2) { grid-column: 3; }                /* đơn vị */
.rule-row > :nth-child(6) { grid-column: 4; grid-row: 1; height: 31px; padding: 0; } /* nút xóa */
.rule-row > :nth-child(3) { grid-column: 1; grid-row: 2; }   /* loại rule */
.rule-row > :nth-child(4) { grid-column: 2; grid-row: 2; }   /* so sánh */
.rule-row > :nth-child(5) { grid-column: 3 / 5; grid-row: 2; } /* ngưỡng */
.measure-box { border: 1px solid #bfd2fb; background: var(--brand-soft); border-radius: 12px; padding: 12px; }
.measure-box .input-group-text { min-width: 92px; justify-content: center; font-size: .82rem; background: #fff; }
