/* =====================================================================
   Giao diện mới — tải SAU app.css, chỉ ghi đè màu / bo góc / bóng đổ, không đổi bố cục.
   Đồng bộ với trang đăng nhập: xanh chàm gradient, bo góc mềm, bóng nhẹ.
   ===================================================================== */
:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-2: #4f46e5;
    --brand-soft: #eef3ff;
    --bg: #f4f6fb;
    --line: #e6eaf2;
    --radius: 16px;
    --bs-border-radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .05);
    --shadow-lg: 0 18px 48px rgba(15, 23, 42, .14);
    --grad: linear-gradient(135deg, #2563eb, #4f46e5);
}
::selection { background: #c7d7fe; }
body { background: var(--bg) !important; }
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }

/* ---------- Thanh bên ---------- */
.sidebar { background: radial-gradient(420px 260px at 0% 0%, rgba(37, 99, 235, .55), transparent 70%), radial-gradient(360px 300px at 100% 100%, rgba(124, 58, 237, .35), transparent 70%), #0b1224; }
.brand { padding-bottom: 20px; }
.brand-mark, .brand-logo { box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); }
.side-title { color: #7184a3; letter-spacing: .1em; }
.side-link { border-radius: 12px; color: #c3cde0; }
.side-link:hover { background: rgba(255, 255, 255, .08); }
.side-link.active { background: var(--grad); box-shadow: 0 8px 20px rgba(37, 99, 235, .4); }
.side-foot { border-top-color: rgba(255, 255, 255, .1); }

/* ---------- Thanh trên ---------- */
.topbar { background: rgba(255, 255, 255, .82); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15, 23, 42, .02); }
.topbar-search input { background: #f1f4fa; border-color: transparent; height: 40px; }
.topbar-search input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
.shop-switch, .shop-chip { background: #f1f4fa; border-color: transparent; }
.avatar { background: var(--grad); color: #fff; box-shadow: 0 4px 10px rgba(79, 70, 229, .3); }
.user-btn:hover { background: #f1f4fa; }
.dropdown-menu { border-radius: 14px; box-shadow: var(--shadow-lg) !important; padding: 8px !important; }
.dropdown-item { border-radius: 10px; padding: 8px 12px; }

/* ---------- Nội dung ---------- */
.content h1.h4, .content h1.h5 { letter-spacing: -.02em; }
.card { border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 15px 20px; background: #fff !important; }
.card-body { padding: 20px; }
.stat { border-radius: var(--radius); }
.stat:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.stat-ic { border-radius: 14px; }

/* ---------- Nút ---------- */
.btn { border-radius: 12px; transition: transform .12s, box-shadow .15s, background-color .15s, border-color .15s; }
.btn-sm { border-radius: 10px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px rgba(37, 99, 235, .28); --bs-btn-hover-bg: #1d4ed8; --bs-btn-hover-border-color: transparent; --bs-btn-active-bg: #1d4ed8; --bs-btn-active-border-color: transparent; }
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #4338ca); box-shadow: 0 10px 22px rgba(37, 99, 235, .36); transform: translateY(-1px); }
.btn-primary.btn-sm { box-shadow: 0 4px 10px rgba(37, 99, 235, .24); }
.btn-primary:disabled, .btn-primary.disabled { box-shadow: none; opacity: .6; }
.btn-success { box-shadow: 0 6px 16px rgba(22, 163, 74, .24); }
.btn-success.btn-sm { box-shadow: 0 4px 10px rgba(22, 163, 74, .2); }
.btn-outline-primary { --bs-btn-border-color: #c3d4fb; --bs-btn-hover-bg: var(--brand); }
.btn-outline-secondary, .btn-outline-danger, .btn-outline-success { background: #fff; }
.btn-outline-success { --bs-btn-border-color: #a7e3bd; }
.btn-outline-danger { --bs-btn-border-color: #f8c4c4; }
.btn-link { box-shadow: none; }

/* ---------- Form ---------- */
.form-label { color: #3b4a63; }
.form-control, .form-select { border-color: #d5deea; border-radius: 12px; background-color: #fbfdff; padding: .6rem .85rem; }
.form-control-sm, .form-select-sm { border-radius: 10px; padding: .35rem .65rem; }
.form-control:focus, .form-select:focus { background-color: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
.form-check-input { border-color: #b8c4d8; }
.form-check-input:focus { box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); border-color: var(--brand); }

/* ---------- Bảng ---------- */
.table > thead > tr > th { background: #f6f8fc; color: #6b7a93; font-size: .72rem; letter-spacing: .07em; padding: 13px 16px; }
.table > tbody > tr > td { padding: 14px 16px; border-color: #edf0f6; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f5f8ff; }
.card > .table-responsive:first-child, .card > .table:first-child { border-radius: var(--radius); }

/* ---------- Huy hiệu, cảnh báo, nav ---------- */
.badge { letter-spacing: .02em; }
.flash { border-radius: 14px; box-shadow: 0 2px 8px rgba(15, 23, 42, .04); }
.alert { border-radius: 14px; }
.nav-pills { background: #e8edf6; border-radius: 14px; }
.nav-pills .nav-link { border-radius: 11px; }
.nav-pills .nav-link.active { box-shadow: 0 2px 6px rgba(15, 23, 42, .1); }
.pagination { --bs-pagination-border-radius: 12px; --bs-pagination-active-bg: var(--brand-2); --bs-pagination-active-border-color: var(--brand-2); }
.page-link { border-color: var(--line); }
.list-group-item-action:hover { background: #f5f8ff; }
.result-ok::before, .result-warn::before, .result-bad::before, .result-new::before { width: 6px; }

/* ---------- Modal ---------- */
.modal-content { border: 0; border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--line); padding: 16px 22px; background: #fff; flex-wrap: wrap; gap: 6px 0; }
.modal-title { font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.modal-body { padding: 22px; background: #fbfcfe; }
.modal-footer { border-top: 1px solid var(--line); background: #fff; padding: 12px 22px; box-shadow: 0 -6px 18px rgba(15, 23, 42, .04); }
.modal-backdrop.show { --bs-backdrop-opacity: .5; }
.btn-close:focus { box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }

/* ---------- Trang công khai ---------- */
.pub-head { background: radial-gradient(600px 300px at 0% 0%, rgba(37, 99, 235, .6), transparent 70%), radial-gradient(500px 300px at 100% 100%, rgba(124, 58, 237, .4), transparent 70%), #0b1224; }
.pub-search { border-radius: 20px; box-shadow: var(--shadow-lg); }

/* ---------- Điện thoại ---------- */
@media (max-width: 991.98px) {
    .tabbar { box-shadow: 0 -8px 24px rgba(15, 23, 42, .08); border-top-color: var(--line); }
    .card-body { padding: 16px; }
    .modal-body { padding: 16px; }
    .modal-footer, .modal-header { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { .btn, .stat { transition: none; } }

/* =====================================================================
   Điện thoại — nâng cấp kiểu app
   ===================================================================== */
@media (max-width: 991.98px) {
    body { background: var(--bg) !important; }
    .content { padding-top: 16px; }

    /* Thanh trên gradient, bo đáy */
    .topbar { background: radial-gradient(260px 120px at 0% 0%, rgba(37, 99, 235, .7), transparent 70%), radial-gradient(240px 140px at 100% 100%, rgba(124, 58, 237, .45), transparent 70%), #0b1224; border-radius: 0 0 20px 20px; box-shadow: 0 8px 24px rgba(11, 18, 36, .22); }
    .topbar-title { font-weight: 800; letter-spacing: -.01em; }
    .topbar .avatar { width: 34px; height: 34px; }

    /* Thanh tab dưới: bo góc trên, vạch nhấn ở tab đang chọn */
    .tabbar { border-radius: 22px 22px 0 0; border-top: 0; background: rgba(255, 255, 255, .97); box-shadow: 0 -10px 30px rgba(15, 23, 42, .1); }
    .tab { position: relative; color: #8a97ad; transition: color .15s; }
    .tab.active { color: var(--brand); }
    .tab.active:not(.tab-scan)::before { content: ""; position: absolute; top: 0; left: 50%; width: 26px; height: 3px; margin-left: -13px; border-radius: 0 0 4px 4px; background: var(--grad); }
    .tab:active .ic { transform: scale(.9); }
    .fab { background: var(--grad); box-shadow: 0 10px 24px rgba(79, 70, 229, .45), 0 0 0 6px var(--bg); }
    .tab-scan.active .fab { background: linear-gradient(135deg, #1d4ed8, #4338ca); }

    /* Bảng "Thêm" */
    .sheet { border-radius: 28px 28px 0 0; box-shadow: 0 -16px 48px rgba(15, 23, 42, .25); }
    .sheet-user { background: linear-gradient(180deg, #f6f8ff, #fff); }
    .sheet-item { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 4px; }
    .sheet-item.active { background: var(--brand-soft); border-color: #c3d4fb; }
    .sheet-ic { background: var(--brand-soft); border-radius: 15px; }

    /* Thẻ, ô nhập, nút: to, dễ chạm */
    .card { border-radius: 18px; }
    .btn:not(.btn-sm) { border-radius: 14px; min-height: 48px; }
    .form-control, .form-select { border-radius: 14px; min-height: 48px; }
    .flash { border-radius: 16px; }
    .stat { border-radius: 18px; padding: 14px; }
    .stat-ic { border-radius: 13px; }
    .quick span { width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(180deg, #fff, #f3f6ff); }
    .nav-pills { border-radius: 16px; }

    /* Bảng → thẻ: mỗi dòng là một thẻ riêng */
    .card > .table-responsive, .card > .table { background: transparent; }
    .table-cards tbody tr { background: #fff; margin: 10px; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; }
    .table-cards tbody tr:last-child { border-bottom: 1px solid var(--line); }
    .card:has(> .table-cards), .card:has(> .table-responsive > .table-cards) { background: transparent; border: 0; box-shadow: none; overflow: visible; }

    /* Modal thành tấm trượt từ đáy, gần toàn màn hình */
    .modal-dialog { margin: 0 !important; max-width: 100% !important; width: 100% !important; height: 100% !important; align-items: flex-end !important; }
    .modal-dialog-scrollable .modal-content { max-height: calc(100% - 20px); border-radius: 24px 24px 0 0; width: 100%; }
    .modal.fade .modal-dialog { transform: translateY(40px); }
    .modal.show .modal-dialog { transform: none; }
    .modal-header::before { content: ""; flex-basis: 100%; height: 4px; max-width: 40px; margin: -6px auto 8px; border-radius: 4px; background: #d3dbe8; }
    .modal-header { padding-top: 14px; }
    .modal-footer { padding-bottom: calc(12px + var(--safe-b)); }
    .modal-footer .btn { min-width: 96px; }
}
.sheet-close { margin-left: auto; padding: 10px; }
.offcanvas-backdrop { z-index: 1045 !important; }
@media (max-width: 991.98px) { .sheet { z-index: 1060 !important; } .sheet-grip { height: 5px; width: 44px; } }
