/* =====================================================================
   COURIER EXPRESS – THEME (giao diện chung cho Quản trị & Cổng Shop)
   Đổi màu thương hiệu: sửa các biến --brand* ở :root (Cổng Shop ghi đè trong shop.css)
   ===================================================================== */
:root {
    --brand: #2563eb;
    --brand-600: #1d4ed8;
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-rgb: 37, 99, 235;

    --sidebar-bg: #0f172a;
    --sidebar-bg-2: #111c33;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-title: #64748b;
    --sidebar-border: rgba(148, 163, 184, .12);

    --body-bg: #f4f6fb;
    --surface: #ffffff;
    --border: #e6eaf1;
    --border-strong: #d5dbe5;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .04);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
    --topbar-h: 60px;
    --sidebar-w: 264px;

    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color: var(--brand-600);
    --bs-border-color: var(--border);
    --bs-body-color: var(--text-2);
}

body { font-family: var(--bs-body-font-family); background: var(--body-bg); color: var(--text-2); font-size: .9rem;
       -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
::selection { background: var(--brand-100); }

/* ---------------- KHUNG ỨNG DỤNG ---------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 22px 26px 40px; flex: 1 1 auto; }
@media (max-width: 767.98px) { .app-content { padding: 16px 14px 32px; } }

/* Sidebar tối */
.app-sidebar, .app-sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-w); --bs-offcanvas-bg: var(--sidebar-bg); background: var(--sidebar-bg) !important; color: var(--sidebar-text); }
@media (min-width: 992px) {
    .app-sidebar { flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); position: sticky; top: 0; height: 100vh;
                   display: flex !important; flex-direction: column; border-right: 1px solid var(--sidebar-border); }
}
@media (max-width: 991.98px) { .app-sidebar { display: flex; flex-direction: column; } }
.app-sidebar .sidebar-brand { height: var(--topbar-h); flex: 0 0 var(--topbar-h); display: flex; align-items: center; gap: .65rem;
    padding: 0 1.1rem; border-bottom: 1px solid var(--sidebar-border); color: #fff; }
.app-sidebar .sidebar-brand .brand-logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 34px;
    background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; font-size: 1.05rem; box-shadow: 0 4px 12px rgba(var(--brand-rgb), .35); }
.app-sidebar .sidebar-brand img.brand-logo { background: #fff; object-fit: contain; padding: 3px; }
.app-sidebar .sidebar-brand .brand-name { font-weight: 700; font-size: .98rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-sidebar .sidebar-brand .brand-sub { font-size: .7rem; color: var(--sidebar-title); font-weight: 500; letter-spacing: .02em; }
.app-sidebar .btn-close { filter: invert(1) grayscale(1) brightness(2); margin-left: auto; }
.app-sidebar .sidebar-scroll { flex: 1 1 auto; overflow-y: auto !important; overflow-x: hidden; padding: .5rem 0 1rem; display: block !important;
    scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.25) transparent; }
.app-sidebar .sidebar-scroll::-webkit-scrollbar { width: 6px; }
.app-sidebar .sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(148,163,184,.25); border-radius: 3px; }
.app-sidebar .sidebar-footer { flex: 0 0 auto; border-top: 1px solid var(--sidebar-border); padding: .75rem 1.1rem; font-size: .78rem; color: var(--sidebar-text); }
.app-sidebar .sidebar-footer b { color: #e2e8f0; font-weight: 600; }

.app-sidebar .side-menu .nav-link { display: flex; align-items: center; gap: .7rem; margin: 1px .7rem; padding: .5rem .75rem;
    border-radius: 8px; border-left: 0; color: var(--sidebar-text); font-size: .86rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .15s, color .15s; }
.app-sidebar .side-menu .nav-link i { width: 18px; flex: 0 0 18px; text-align: center; font-size: 1rem; color: #64748b; transition: color .15s; }
.app-sidebar .side-menu .nav-link:hover { background: rgba(148, 163, 184, .08); color: var(--sidebar-text-hover); }
.app-sidebar .side-menu .nav-link:hover i { color: #cbd5e1; }
.app-sidebar .side-menu .nav-link.active { background: rgba(var(--brand-rgb), .18); color: #fff; font-weight: 600;
    box-shadow: inset 3px 0 0 var(--brand); }
.app-sidebar .side-menu .nav-link.active i { color: #fff; }
.app-sidebar .menu-group { margin-top: .35rem; }
.app-sidebar .menu-group-title { font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
    color: var(--sidebar-title); padding: .9rem 1.45rem .35rem; white-space: nowrap; }

/* Topbar */
.app-topbar { position: sticky; top: 0; z-index: 1020; height: var(--topbar-h); background: rgba(255,255,255,.92);
    backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: .75rem; padding: 0 26px; }
@media (max-width: 767.98px) { .app-topbar { padding: 0 12px; } }
.app-topbar .topbar-toggle { border: 0; background: transparent; color: var(--text); font-size: 1.4rem; padding: .25rem .4rem; border-radius: 8px; }
.app-topbar .topbar-toggle:hover { background: #f1f5f9; }
.topbar-search { position: relative; max-width: 380px; width: 100%; }
.topbar-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topbar-search input { padding-left: 2.2rem; border-radius: 999px; background: #f1f5f9; border-color: transparent; height: 38px; font-size: .86rem; }
.topbar-search input:focus { background: #fff; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center;
    color: var(--text-2); background: transparent; border: 1px solid transparent; font-size: 1.1rem; }
.icon-btn:hover { background: #f1f5f9; color: var(--text); }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: #ef4444; color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: .55rem; padding: .25rem .5rem .25rem .25rem; border-radius: 999px;
    border: 1px solid var(--border); background: #fff; color: var(--text); font-weight: 500; font-size: .85rem; }
.user-chip:hover, .user-chip[aria-expanded="true"] { border-color: var(--border-strong); background: #f8fafc; }
.user-chip::after { display: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .78rem;
    color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-600)); flex: 0 0 30px; }
.dropdown-menu { border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: .4rem; font-size: .87rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .7rem; }
.dropdown-item i { width: 18px; display: inline-block; color: var(--muted); }
.dropdown-header-user { padding: .5rem .7rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; }

/* ---------------- TIÊU ĐỀ TRANG ---------------- */
.page-title { font-size: 1.35rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; margin-bottom: 1.1rem; }
.page-title .badge { font-size: .72rem; vertical-align: middle; }
h1, h2, h3, h4, h5, h6 { color: var(--text); }

/* ---------------- CARD ---------------- */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--surface); }
.card > .card-header:first-child { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text);
    padding: .85rem 1.1rem; font-size: .9rem; }
.card-header i { color: var(--muted); }
.card-body { padding: 1.1rem; }
.card-footer { background: #fafbfd; border-top: 1px solid var(--border); }
.card.rounded-top-0 { border-top-left-radius: 0; border-top-right-radius: 0; }

/* Thẻ số liệu (dashboard) */
.stat-card, .kpi { transition: box-shadow .15s, transform .15s, border-color .15s; }
a > .stat-card:hover, .kpi:has(.stretched-link):hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.stat-card .label, .kpi .kpi-label { color: var(--muted); font-size: .78rem; font-weight: 500; }
.stat-card .value, .kpi .kpi-value { font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1.25; }
.stat-card .value { font-size: 1.55rem; margin-top: .35rem; }
.kpi .kpi-value { font-size: 1.5rem; margin-top: .3rem; }
.kpi-money .kpi-value { font-size: 1.2rem; }
.kpi .kpi-sub { color: #94a3b8; font-size: .74rem; margin-top: .15rem; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; flex: 0 0 38px; }
.stat-icon.primary { background: var(--brand-50); color: var(--brand); }
.stat-icon.info { background: #ecfeff; color: #0891b2; }
.stat-icon.success { background: #ecfdf5; color: #059669; }
.stat-icon.warning { background: #fffbeb; color: #d97706; }
.stat-icon.danger { background: #fef2f2; color: #dc2626; }
.stat-icon.secondary, .stat-icon.dark { background: #f1f5f9; color: #475569; }

/* ---------------- BẢNG ---------------- */
.table { --bs-table-hover-bg: #f8fafc; font-size: .855rem; color: var(--text-2); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .62rem .75rem; border-bottom-color: #eef1f6; }
.table-sm > :not(caption) > * > * { padding: .5rem .65rem; }
.table > thead th, .table th { background: #f8fafc; color: var(--muted); font-size: .7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .05em; white-space: nowrap; border-bottom: 1px solid var(--border) !important; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table tfoot td { background: #f8fafc; }
.card-body.p-0 > .table:first-child thead th:first-child, .card-body.p-0 > .table thead th:first-child { padding-left: 1.1rem; }
.card-body.p-0 > .table td:first-child { padding-left: 1.1rem; }
.fee-table td { border-bottom: 1px dashed #e8ecf2; }
.fee-table .table-primary td { background: var(--brand-50) !important; color: var(--text); border-bottom: 0; }

/* ---------------- NÚT & FORM ---------------- */
.btn { white-space: nowrap; border-radius: var(--radius-sm); font-weight: 500; font-size: .87rem; padding: .45rem .9rem; }
.btn-sm { border-radius: 7px; font-size: .8rem; padding: .3rem .65rem; }
.btn-lg { border-radius: 10px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
    box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: rgba(var(--brand-rgb), .45); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--border-strong); --bs-btn-hover-bg: #f8fafc; --bs-btn-hover-border-color: #c7cfdb; --bs-btn-color: var(--text-2); }
.btn-link { text-decoration: none; }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border-strong); font-size: .87rem; color: var(--text); }
.form-control-sm, .form-select-sm { border-radius: 7px; font-size: .82rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--brand-rgb), .6); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .15); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 500; color: var(--text-2); font-size: .82rem; margin-bottom: .3rem; }
.input-group-text { background: #f8fafc; border-color: var(--border-strong); color: var(--muted); }

/* ---------------- BADGE mềm ---------------- */
.badge { font-weight: 600; font-size: .72rem; padding: .36em .6em; border-radius: 6px; letter-spacing: .01em; }
.badge.bg-primary { background: var(--brand-100) !important; color: var(--brand-600) !important; }
.badge.bg-info { background: #cffafe !important; color: #0e7490 !important; }
.badge.bg-success { background: #dcfce7 !important; color: #15803d !important; }
.badge.bg-danger { background: #fee2e2 !important; color: #b91c1c !important; }
.badge.bg-warning { background: #fef3c7 !important; color: #b45309 !important; }
.badge.bg-secondary { background: #e2e8f0 !important; color: #475569 !important; }
.badge.bg-dark { background: #1e293b !important; color: #f1f5f9 !important; }
.badge.bg-light { background: #f1f5f9 !important; color: #475569 !important; border-color: var(--border) !important; }
.badge.rounded-pill.bg-danger { background: #ef4444 !important; color: #fff !important; }

/* ---------------- ALERT ---------------- */
.alert { border-radius: 10px; border: 1px solid transparent; border-left-width: 4px; font-size: .86rem; }
.alert-info { background: #f0f9ff; border-color: #bae6fd; border-left-color: #0ea5e9; color: #075985; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; border-left-color: #22c55e; color: #166534; }
.alert-warning { background: #fffbeb; border-color: #fde68a; border-left-color: #f59e0b; color: #92400e; }
.alert-danger { background: #fef2f2; border-color: #fecaca; border-left-color: #ef4444; color: #991b1b; }
.alert-light { background: #fff; border-color: var(--border); border-left-color: var(--border-strong); color: var(--text-2); }

/* ---------------- TABS / PHÂN TRANG / LIST ---------------- */
.nav-tabs { border-bottom: 1px solid var(--border); gap: .15rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; font-size: .85rem;
    padding: .6rem .85rem; margin-bottom: -1px; white-space: nowrap; background: transparent; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: transparent; font-weight: 600; }
.nav-tabs + .card { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }
.tabs-scroll { overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; scrollbar-width: none; background: var(--surface);
    border: 1px solid var(--border); border-bottom-color: var(--border); border-radius: var(--radius) var(--radius) 0 0; padding: 0 .5rem; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.pagination { --bs-pagination-border-radius: 8px; --bs-pagination-color: var(--text-2); --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand); --bs-pagination-border-color: var(--border); gap: .2rem; }
.pagination .page-link { border-radius: 8px !important; min-width: 32px; text-align: center; }
.list-group-item { border-color: #eef1f6; padding: .7rem 1.1rem; }
.progress { background: #eef1f6; border-radius: 99px; }

/* ---------------- TIMELINE ---------------- */
.timeline li { border-left-color: #e2e8f0; padding-bottom: 1.1rem; }
.timeline li::before { background: #cbd5e1; box-shadow: 0 0 0 3px #fff; }
.timeline li:first-child::before { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }

/* ---------------- TRANG ĐĂNG NHẬP ---------------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
@media (max-width: 991.98px) { .auth-page { grid-template-columns: 1fr; } .auth-hero { display: none !important; } }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
    background: radial-gradient(1200px 600px at -10% -10%, rgba(255,255,255,.12), transparent 60%),
                linear-gradient(145deg, var(--sidebar-bg) 0%, var(--brand-600) 100%); }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%;
    background: rgba(255,255,255,.06); }
.auth-hero .hero-brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; font-size: 1.1rem; }
.auth-hero .hero-brand .brand-logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,255,255,.15); font-size: 1.2rem; }
.auth-hero h1 { color: #fff; font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: auto 0 1rem; max-width: 460px; }
.auth-hero p.lead { color: rgba(255,255,255,.78); font-size: 1rem; max-width: 460px; }
.auth-hero .hero-features { list-style: none; padding: 0; margin: 1.5rem 0 auto; display: grid; gap: .7rem; }
.auth-hero .hero-features li { display: flex; align-items: center; gap: .6rem; color: rgba(255,255,255,.9); font-size: .92rem; }
.auth-hero .hero-features i { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.14); }
.auth-hero .hero-foot { color: rgba(255,255,255,.55); font-size: .78rem; position: relative; z-index: 1; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-form { width: 100%; max-width: 400px; }
.auth-form h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .3rem; }
.auth-form .sub { color: var(--muted); margin-bottom: 1.8rem; }
.auth-form .form-control { height: 44px; }
.auth-form .input-group-text { width: 44px; justify-content: center; }
.auth-form .btn-primary { height: 46px; font-weight: 600; }
.auth-form .demo-box { background: #f8fafc; border: 1px dashed var(--border-strong); border-radius: 10px; padding: .75rem .9rem; font-size: .8rem; color: var(--muted); }
.auth-form .switch-link { font-size: .85rem; }

/* ---------------- TIỆN ÍCH ---------------- */
.text-muted { color: var(--muted) !important; }
.border { border-color: var(--border) !important; }
.bg-light { background-color: #f8fafc !important; }
.small, small { font-size: .82em; }
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty-state i { font-size: 2rem; color: #cbd5e1; display: block; margin-bottom: .5rem; }

@media print {
    .app-sidebar, .app-topbar { display: none !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff; }
}
.min-w-0 { min-width: 0; }
