/* =============================================================
   Theme: Xanh Lục Tài Chính (finance_emerald)
   Dùng CSS variables để dễ đổi theme sau này
   ============================================================= */
:root {
    /* Màu chủ đạo — xanh lục tài chính */
    --primary:          #059669;
    --primary-hover:    #047857;
    --primary-light:    rgba(5, 150, 105, 0.12);
    --primary-text:     #fff;

    /* Sidebar */
    --sidebar-bg:       #1E293B;
    --sidebar-width:    240px;
    --sidebar-text:     rgba(255, 255, 255, 0.65);
    --sidebar-text-active: #fff;
    --sidebar-border:   rgba(255, 255, 255, 0.08);
    --sidebar-hover:    rgba(255, 255, 255, 0.07);
    --sidebar-active:   rgba(5, 150, 105, 0.2);

    /* Topbar */
    --topbar-bg:        #fff;
    --topbar-border:    #e2e8f0;
    --topbar-text:      #1E293B;

    /* Nội dung */
    --content-bg:       #F1F5F9;
    --card-bg:          #fff;
    --card-border:      #e2e8f0;
    --card-shadow:      0 1px 6px rgba(0,0,0,0.07);
    --card-radius:      12px;

    /* Chữ */
    --text-dark:        #1E293B;
    --text-muted:       #64748B;
    --text-light:       #94A3B8;

    /* Trạng thái */
    --success:          #16A34A;
    --danger:           #DC2626;
    --warning:          #D97706;
    --info:             #0284C7;
}

/* ── Reset & Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--content-bg);
    color: var(--text-dark);
    font-size: 14px;
}

/* ── Sidebar ── */
.admin-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.sidebar-brand .brand-icon {
    width: 30px; height: 28px;
    flex-shrink: 0;
}
.sidebar-brand .brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}
.sidebar-brand .brand-sub {
    color: var(--sidebar-text);
    font-size: 11px;
}

/* Menu nhóm */
.sidebar-group-label {
    padding: 16px 20px 6px;
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Từng menu item */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}
.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar-nav a i { width: 18px; font-size: 15px; flex-shrink: 0; }

/* Badge thông báo trên sidebar (số đăng ký khách hàng mới) */
.sidebar-badge {
    margin-left: auto;
    background: #EF4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Item cha của submenu — cùng style với a thông thường */
.sidebar-nav .sidebar-parent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    border-left: 3px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}
.sidebar-nav .sidebar-parent:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sidebar-nav .sidebar-parent.open  { color: var(--sidebar-text-active); }
.sidebar-nav .sidebar-parent i     { width: 18px; font-size: 15px; flex-shrink: 0; }
.sidebar-parent .chevron           { margin-left: auto; font-size: 12px; transition: transform 0.2s; }
.sidebar-parent.open .chevron      { transform: rotate(90deg); }

/* Danh sách submenu — ẩn mặc định, thụt lề nhẹ */
.sidebar-submenu { display: none; flex-direction: column; background: rgba(0,0,0,0.12); }
.sidebar-submenu.open { display: flex; }
.sidebar-submenu a {
    padding: 8px 20px 8px 34px;
    font-size: 13px;
    border-left: 3px solid transparent;
    color: var(--sidebar-text);
}
.sidebar-submenu a:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sidebar-submenu a.active {
    background: var(--sidebar-active);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

/* Phần footer sidebar (đăng xuất) */
/* ── Vùng nội dung chính ── */
.admin-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.admin-topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-title { font-weight: 600; color: var(--text-muted); font-size: 14px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }

/* Chuông thông báo trên topbar */
.notif-wrap { position: relative; }
.notif-btn {
    position: relative;
    width: 38px; height: 38px;
    border: none; background: none;
    border-radius: 50%;
    color: var(--text-dark);
    font-size: 17px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.notif-btn:hover, .notif-btn.open { background: var(--content-bg); }
.notif-badge {
    position: absolute;
    top: 1px; right: -1px;
    background: #EF4444;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5.5px;
    border-radius: 10px;
    border: 2px solid #fff;
}
@keyframes bellRing {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-12deg); }
    45% { transform: rotate(9deg); }
    60% { transform: rotate(-7deg); }
    75% { transform: rotate(4deg); }
}
.notif-btn.ring i { display: inline-block; transform-origin: top center; animation: bellRing 0.9s ease; }

/* Panel danh sách thông báo */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    z-index: 200;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.notif-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.notif-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--card-border);
    font-weight: 700;
    font-size: 14px;
    color: var(--text-dark);
}
.notif-count {
    font-size: 12px; font-weight: 600;
    color: var(--danger);
    background: #fef2f2;
    padding: 2px 8px;
    border-radius: 10px;
}
/* Hàng bật/tắt tiếng chuông với nút gạt kiểu iOS */
.notif-sound-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid var(--card-border);
    font-size: 13px;
    color: var(--text-dark);
    background: var(--content-bg);
}
.notif-sound-row > span { display: flex; align-items: center; gap: 7px; }
.notif-sound-row i { color: var(--text-muted); font-size: 14px; }
.ios-switch {
    position: relative;
    display: inline-block;
    width: 44px; height: 26px;
    flex-shrink: 0;
}
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-slider {
    position: absolute;
    inset: 0;
    background: #D1D5DB;
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.25s;
}
.ios-slider::before {
    content: '';
    position: absolute;
    width: 22px; height: 22px;
    left: 2px; top: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s;
}
.ios-switch input:checked + .ios-slider { background: #34C759; }
.ios-switch input:checked + .ios-slider::before { transform: translateX(18px); }

.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 11px 14px;
    text-decoration: none;
    border-bottom: 1px solid var(--card-border);
    transition: background 0.12s;
}
.notif-item:hover { background: var(--content-bg); }
.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #F59E0B;
    margin-top: 5px;
    flex-shrink: 0;
}
.notif-body { min-width: 0; }
.notif-text { display: block; font-size: 13px; color: var(--text-dark); }
.notif-meta { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-empty {
    padding: 32px 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.notif-empty i { display: block; font-size: 28px; margin-bottom: 6px; color: var(--text-light); }
.notif-footer {
    display: block;
    text-align: center;
    padding: 11px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.notif-footer:hover { background: var(--content-bg); }

.topbar-user-wrap { position: relative; }
.topbar-user {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-dark);
    font-size: 13.5px;
    font-weight: 500;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.15s;
}
.topbar-user:hover, .topbar-user.open { background: var(--content-bg); }
.topbar-user .avatar {
    width: 32px; height: 32px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
}
/* Ảnh đại diện thật (nếu có) phủ kín khung tròn thay cho chữ cái */
.topbar-user .avatar img,
.user-dd-header .avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.topbar-user .avatar, .user-dd-header .avatar { overflow: hidden; }

.user-caret { font-size: 11px; color: var(--text-muted); transition: transform 0.2s; }
.topbar-user.open .user-caret { transform: rotate(180deg); }

/* Dropdown tài khoản — xổ xuống dưới nút tên admin */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    padding: 6px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.user-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.user-dd-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 10px 12px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 6px;
}
.user-dd-header .avatar {
    width: 38px; height: 38px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.user-dd-name { font-size: 13.5px; font-weight: 700; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-dd-role { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.12s;
}
.user-dropdown a:hover { background: var(--content-bg); }
.user-dropdown a i { width: 18px; font-size: 14px; color: var(--text-muted); }
.user-dropdown a.danger { color: var(--danger); }
.user-dropdown a.danger i { color: var(--danger); }
.user-dropdown a.danger:hover { background: #fef2f2; }
.user-dd-divider { height: 1px; background: var(--card-border); margin: 6px 0; }

/* Nội dung trang */
.admin-content { padding: 28px 24px; flex: 1; }

/* ── Card ── */
.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
}
/* Tiêu đề bên trong card (vd: "Giao dịch gần đây") — to & rõ hơn cỡ h6 mặc định */
.admin-card h6 { font-size: 16px; line-height: 1.3; }

/* ── Stat card (dashboard) ── */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-icon.primary   { background: var(--primary-light);         color: var(--primary); }
.stat-icon.success   { background: rgba(22,163,74,0.1);          color: var(--success); }
.stat-icon.warning   { background: rgba(217,119,6,0.1);          color: var(--warning); }
.stat-icon.danger    { background: rgba(220,38,38,0.1);          color: var(--danger); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-dark); }

/* ── Nút chủ đạo ── */
.btn-primary-custom {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: inline-flex; align-items: center; gap: 6px;
    text-decoration: none;
}
.btn-primary-custom:hover  { background: var(--primary-hover); color: #fff; }
.btn-primary-custom:active { transform: scale(0.98); }

/* ── Alert ── */
.alert-custom {
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13.5px;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 20px;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }

/* ── Table ── */
/* Đặt background trực tiếp trên <th> thay vì <tr> vì CSS table model vẽ cell đè lên row */
.admin-card table thead th {
    background: var(--card-bg);
}

/* =============================================================
   COMPONENTS bổ sung cho các trang quản lý thu chi
   (ví, giao dịch, xe, vay nợ, báo cáo)
   ============================================================= */

/* ── Header trang: tiêu đề bên trái, nút thao tác bên phải ── */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head h5 { font-weight: 700; margin: 0; font-size: 18px; }
.page-head .page-sub { color: var(--text-muted); font-size: 13px; margin: 2px 0 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Nút phụ ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    font-weight: 600; font-size: 13.5px; font-family: inherit;
    cursor: pointer; border: 1.5px solid transparent;
    text-decoration: none; transition: all 0.15s; background: none;
}
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-outline { border-color: var(--card-border); color: var(--text-dark); background: #fff; }
.btn-outline:hover { background: var(--content-bg); color: var(--text-dark); }
.btn-outline.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-danger-soft { color: var(--danger); background: #fef2f2; }
.btn-danger-soft:hover { background: #fee2e2; }
.btn-icon {
    /* inline-flex để dùng được cho cả <button> lẫn <a> (thẻ inline sẽ bỏ qua
       width/height nếu không có display flex/inline-block) */
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0;
    border-radius: 8px; cursor: pointer; border: 1px solid transparent;
    text-decoration: none; line-height: 1; vertical-align: middle;
    /* Nền màu nhạt để nút luôn nổi trên nền trắng lẫn nền xám khi hover hàng */
    background: var(--primary-light); color: var(--primary);
    transition: filter 0.12s, background 0.12s;
}
.btn-icon + .btn-icon, .btn-icon + form, form + .btn-icon, form + form { margin-left: 4px; }
.btn-icon:hover { filter: brightness(0.95); }
.btn-icon.danger { background: #fef2f2; color: var(--danger); }
.btn-icon.danger:hover { background: #fde0e0; filter: none; }
.btn-icon.neutral { background: var(--content-bg); color: var(--text-muted); border-color: var(--card-border); }
.btn-icon.neutral:hover { background: #fff; color: var(--text-dark); }

/* ── Bảng dữ liệu ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
    text-align: left; font-weight: 600; color: var(--text-muted);
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em;
    padding: 10px 12px; border-bottom: 2px solid var(--card-border); background: var(--card-bg);
    white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--card-border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--content-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
tfoot.table-foot td { padding: 11px 12px; border-top: 2px solid var(--card-border); font-weight: 700; }

/* ── Badge nhãn trạng thái ── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 1.4;
}
.badge-success { background: #f0fdf4; color: #15803d; }
.badge-danger  { background: #fef2f2; color: #dc2626; }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-info    { background: #eff6ff; color: #1d4ed8; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-muted   { background: var(--content-bg); color: var(--text-muted); }

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-group { margin-bottom: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-label .req { color: var(--danger); }
.form-control {
    width: 100%; padding: 9px 12px; font-size: 13.5px; font-family: inherit;
    border: 1.5px solid var(--card-border); border-radius: 8px; outline: none;
    background: #fff; color: var(--text-dark); transition: border-color 0.15s;
}
.form-control:focus { border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 70px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Bộ lọc ── */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .form-control { width: auto; min-width: 150px; }

/* ── Tab phụ (theo phạm vi/trạng thái) ── */
.sub-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.sub-tabs a {
    padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
    text-decoration: none; color: var(--text-muted); background: #fff; border: 1.5px solid var(--card-border);
}
.sub-tabs a:hover { color: var(--text-dark); }
.sub-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
    display: none; align-items: flex-start; justify-content: center;
    z-index: 2000; padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25); margin: auto;
}
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--card-border);
}
.modal-title { font-weight: 700; font-size: 16px; margin: 0; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text-dark); }
.modal-body { padding: 20px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px; border-top: 1px solid var(--card-border);
}

/* ── Trạng thái rỗng ── */
.empty-state { text-align: center; padding: 48px 0; color: var(--text-muted); }
.empty-state i { font-size: 42px; display: block; margin-bottom: 12px; color: var(--text-light); }

/* ── Tiện ích chữ ── */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0 !important; }
.nowrap { white-space: nowrap; }

/* ── Lưới thẻ KPI co giãn ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-icon.info { background: rgba(2,132,199,0.1); color: var(--info); }

/* ── Lưới 2 cột dùng chung (dashboard, chi tiết xe/nợ, tài khoản).
   Đặt thành class để media query gộp về 1 cột trên mobile — inline style
   không thể bị media query ghi đè nên buộc phải tách ra class. ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ── Bảng tóm tắt 2 cột (chi tiết xe, tiến độ nợ) ── */
.kv-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13.5px; }
.kv-list dt { color: var(--text-muted); }
.kv-list dd { margin: 0; font-weight: 600; }

/* ── Fix: khi nút có cả .btn lẫn .btn-primary-custom thì .btn (khai báo sau)
   vô tình xóa nền xanh, khiến nút chỉ nổi màu lúc hover. Tăng độ ưu tiên để
   nền xanh hiện thường trực. ── */
.btn.btn-primary-custom { background: var(--primary); color: #fff; border-color: transparent; }
.btn.btn-primary-custom:hover { background: var(--primary-hover); color: #fff; }

/* ── Cột thao tác: căn giữa cả tiêu đề lẫn nội dung; các nút/biểu mẫu
   thẳng hàng theo trục giữa và cách đều nhau ── */
.data-table th.col-act, .data-table td.col-act { text-align: center; vertical-align: middle; }
.data-table td.col-act form { display: inline-flex; margin: 0; vertical-align: middle; }
.data-table td.col-act .btn,
.data-table td.col-act .btn-icon { vertical-align: middle; }
.data-table td.col-act > * + * { margin-left: 6px; }

/* ── Dòng được nhảy tới qua neo (#cp-.. / #thu-..): chừa chỗ cho topbar dính
   và nháy nền vàng để dễ nhận ra ── */
.data-table tr[id]:target { scroll-margin-top: 76px; animation: rowHighlight 2.2s ease; }
@keyframes rowHighlight {
    0%   { background: #fde68a; }
    65%  { background: #fef3c7; }
    100% { background: transparent; }
}

/* ── Bảng căn giữa: mọi cột (tiêu đề + giá trị) căn giữa, riêng cột đầu
   (vd: tên Xe) giữ căn trái ── */
.data-table.table-center th,
.data-table.table-center td { text-align: center; }
.data-table.table-center th:first-child,
.data-table.table-center td:first-child { text-align: left; }

/* =============================================================
   RESPONSIVE — tương thích máy tính bảng & điện thoại
   Trên màn nhỏ: sidebar biến thành ngăn kéo (drawer) trượt từ trái,
   mở bằng nút hamburger trên topbar, có lớp nền mờ để bấm đóng.
   ============================================================= */

/* Nút mở menu (hamburger) và lớp nền mờ: ẩn trên desktop, chỉ hiện ở mobile */
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }

/* ── Máy tính bảng nhỏ & điện thoại (≤ 992px): sidebar thành drawer ── */
@media (max-width: 992px) {
    /* Sidebar trượt khỏi màn hình, chỉ hiện khi thêm class .open */
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
    }
    .admin-sidebar.open { transform: translateX(0); }

    /* Nội dung chính chiếm toàn bộ chiều rộng (không chừa chỗ cho sidebar) */
    .admin-main { margin-left: 0; }

    /* Nút hamburger hiện ra ở mép trái topbar */
    .sidebar-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 38px; height: 38px; margin-right: 6px;
        border: none; background: none; border-radius: 8px;
        color: var(--text-dark); font-size: 22px; cursor: pointer;
        flex-shrink: 0;
    }
    .sidebar-toggle:hover { background: var(--content-bg); }

    /* Lớp nền mờ phủ toàn màn khi mở sidebar — bấm vào để đóng */
    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 999; /* dưới sidebar (1000), trên nội dung */
        display: block;
        opacity: 0; visibility: hidden;
        transition: opacity 0.25s, visibility 0.25s;
    }
    .sidebar-backdrop.open { opacity: 1; visibility: visible; }

    /* Khóa cuộn nền khi drawer đang mở */
    body.sidebar-open { overflow: hidden; }
}

/* ── Điện thoại (≤ 768px): tinh chỉnh khoảng cách & lưới cho gọn ── */
@media (max-width: 768px) {
    /* Topbar gọn lại; ẩn tên + mũi tên của nút tài khoản, chỉ giữ avatar */
    .admin-topbar { padding: 0 12px; }
    .topbar-title { font-size: 13px; }
    .topbar-user { padding: 5px; gap: 0; }
    .topbar-user > span,
    .topbar-user .user-caret { display: none; }

    /* Giảm padding vùng nội dung trên màn nhỏ */
    .admin-content { padding: 16px 12px; }

    /* Form 2 cột trong modal và lưới 2 cột dùng chung -> gộp 1 cột */
    .form-grid { grid-template-columns: 1fr; }
    .two-col   { grid-template-columns: 1fr; }

    /* Bộ lọc: mỗi ô input giãn full hàng cho dễ chạm */
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-control { width: 100%; min-width: 0; }

    /* Header trang: nút thao tác xuống hàng và giãn đều */
    .page-actions { width: 100%; }
    .page-actions > .btn,
    .page-actions > .btn-primary-custom { flex: 1; justify-content: center; }

    /* Modal sát mép màn hình hơn để có thêm chỗ */
    .modal-overlay { padding: 16px 10px; }

    /* Dropdown tài khoản/thông báo không tràn mép phải màn hình */
    .user-dropdown { width: min(240px, calc(100vw - 24px)); }
    .notif-dropdown { width: min(320px, calc(100vw - 24px)); }
}

/* ── Điện thoại nhỏ (≤ 480px): bảng KPI 1 cột, dropdown bám mép trái ── */
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
    .stat-card { padding: 16px; gap: 12px; }
    .stat-icon { width: 44px; height: 44px; font-size: 18px; }
    .stat-value { font-size: 19px; }
    .admin-card { padding: 16px; }
}
