/* Danh sách Directory trên điện thoại: KPI + chip lọc + thẻ. Bảng desktop ẩn ở <=760px. */
.m-kpis, .m-chips, .m-cards { display: none; }
@media (max-width: 760px) {
    .m-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
    .m-kpi { background: #fff; border: 1px solid #e5eaf3; border-radius: 12px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 1px 4px rgba(15,37,82,.05); }
    .m-kpi b { font-size: 20px; color: #1a2d5a; line-height: 1.1; } .m-kpi b.red { color: #dc2626; }
    .m-kpi small { font-size: 11px; color: #6b7280; }
    .m-kpi-ico { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
    .k-blue { background: #e0ecff; color: #2563eb; } .k-green { background: #dcfce7; color: #16a34a; } .k-orange { background: #ffedd5; color: #ea580c; }
    .m-chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
    .m-chips button { flex: 0 0 auto; border: 1px solid #d6e0f0; background: #fff; color: #4a6080; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; font-family: inherit; }
    .m-chips button.on { background: #2563eb; border-color: #2563eb; color: #fff; }
    .m-cards ~ .table-wrap { display: none; }
    .m-cards { display: flex; flex-direction: column; gap: 12px; }
    .m-card { background: #fff; border: 1px solid #e5eaf3; border-radius: 14px; padding: 14px; box-shadow: 0 1px 6px rgba(15,37,82,.06); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
    .m-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; width: 100%; }
    .m-card-name { font-size: 15px; font-weight: 700; color: #1a2d5a; min-width: 0; }
    .m-card-code { font-size: 12.5px; color: #6b7280; }
    .m-card-rows { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #374151; width: 100%; }
    .m-card-rows div { display: flex; align-items: center; gap: 8px; } .m-card-rows svg { color: #6b7280; flex-shrink: 0; }
    .m-card-actions { display: flex; gap: 10px; width: 100%; margin-top: 4px; }
    .m-card-actions button { flex: 1; height: 42px; border-radius: 9px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; }
    .m-btn-outline { background: #fff; border: 1.5px solid #2563eb; color: #2563eb; } .m-btn-fill { background: #2563eb; border: 1.5px solid #2563eb; color: #fff; }
    .m-card-top { display: flex; gap: 12px; align-items: flex-start; width: 100%; }
    .m-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
    .m-card-sub { font-size: 13.5px; color: #1a2d5a; font-weight: 600; }
    .m-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #eef3fb; flex-shrink: 0; }
    .m-thumb.round { border-radius: 50%; }
    .m-initials { display: flex; align-items: center; justify-content: center; color: #1d4ed8; font-weight: 700; font-size: 18px; }
    .m-cat { display: inline-block; padding: 3px 10px; border-radius: 8px; background: #e0ecff; color: #1d4ed8; font-size: 12px; font-weight: 600; }
    .m-status { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
    .m-status.ok { background: #eaf3de; color: #3b6d11; } .m-status.off { background: #fef2f2; color: #dc2626; }
    .top-bar .tb-divider, .top-bar .sep { display: none; }

    /* ── Nền sáng + thanh tiêu đề/tìm kiếm kiểu app (chỉ trang có danh sách thẻ) ── */
    body:has(.m-cards) { background: #f3f6fb !important; color: #1a2d5a; }
    body:has(.m-cards) .main-wrap .main-content { background: #f3f6fb; }
    body:has(.m-cards) .page-title { color: #1a2d5a; font-size: 22px; }
    body:has(.m-cards) .page-sub, body:has(.m-cards) .total-count { color: #6b7280; }
    body:has(.m-cards) .total-count { display: none; }
    body:has(.m-cards) .top-bar { gap: 10px; margin-bottom: 12px; }
    body:has(.m-cards) .title-block { flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; }
    body:has(.m-cards) .search-wrap { background: #fff; border: 1px solid #dde4ef; color: #6b7280; box-shadow: 0 1px 3px rgba(15,37,82,.05); }
    body:has(.m-cards) .search-input { color: #1a2d5a; }
    body:has(.m-cards) .search-input::placeholder { color: #9aa7bd; }
    body:has(.m-cards) .filter-select, body:has(.m-cards) .status-filter { background-color: #fff; color: #1a2d5a; border: 1px solid #dde4ef; }
    body:has(.m-cards) .filter-select option, body:has(.m-cards) .status-filter option { color: #1a2d5a; background: #fff; }
    body:has(.m-cards) .ie-wrap { display: none; }
    body:has(.m-cards) .btn-new, body:has(.m-cards) .btn-add { width: 100%; justify-content: center; height: 42px; border-radius: 10px; background: #2563eb; }

    /* KPI ngang: icon trái, số + nhãn phải */
    .m-kpis:not(.m-kpis4) .m-kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; justify-items: start; padding: 10px; }
    .m-kpis:not(.m-kpis4) .m-kpi-ico { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 10px; }
    .m-kpis:not(.m-kpis4) .m-kpi b { font-size: 20px; align-self: end; }
    .m-kpis:not(.m-kpis4) .m-kpi small { align-self: start; }

    .m-card .status-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
    .m-card .status-badge.active, .m-card .status-active { background: #eaf3de; color: #3b6d11; border: 1px solid #c0dd97; }
    .m-card .status-badge.inactive, .m-card .status-inactive { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
    .m-card .status-badge.suspended, .m-card .status-suspended { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
    body:has(.m-cards) .search-wrap svg { color: #9aa7bd; }
    body:has(.m-cards) .top-bar .filter-select, body:has(.m-cards) .top-bar .status-filter { flex: 1 1 45%; width: auto; min-width: 0; height: 40px; }
    body:has(.m-cards) .top-bar .status-filter { display: none; }
    body:has(.m-cards) .top-bar { flex-direction: row !important; flex-wrap: wrap; align-items: center !important; }
    body:has(.m-cards) .top-bar .search-wrap { flex: 1 1 100%; }
    body:has(.m-cards) .top-bar .btn-new, body:has(.m-cards) .top-bar .btn-add { flex: 1 1 100%; }
    body:has(.m-cards) .top-bar .filter-date { flex: 1 1 45%; min-width: 0; height: 40px; background: #fff; color: #1a2d5a; border: 1px solid #dde4ef; border-radius: 8px; padding: 0 10px; }
    body:has(.m-cards) .top-bar .btn-clear-date { color: #dc2626; background: #fff; border: 1px solid #fecaca; }
    .m-kpis.m-kpis-4 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .m-kpis.m-kpis-4 .m-kpi { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; }
    .m-kpis.m-kpis-4 .m-kpi-ico { width: 30px; height: 30px; border-radius: 50%; }
    .m-kpis.m-kpis-4 .m-kpi b { font-size: 18px; }
    .m-kpis.m-kpis-4 .m-kpi small { font-size: 10.5px; text-align: center; }
}
