/* ══════════════════════════════════════════════════════════════════
   MIZEN CRM — layout kế thừa admin-layout.css của Xtravel (sidebar navy
   thu gọn được, topbar trắng 50px, nền xám nhạt, font 13px), viết lại cho
   Bootstrap 5. Khác Xtravel: trên mobile menu trượt ra đủ chữ (230px) thay
   vì chỉ icon, vì nhân viên thị trường dùng chủ yếu trên điện thoại.
   ══════════════════════════════════════════════════════════════════ */
:root {
  --sb-width:   230px;
  --sb-sm:       52px;
  --sb-bg:      #1e2d3d;
  --sb-txt:     #c8d6e5;
  --sb-hover:   #253547;
  --topbar-h:    50px;
  --brand:      #2c5f8a;
  --brand-dark: #1f4868;
  --thead:      #46607c;
  --page-bg:    #f4f6f9;
  --trans:      .22s ease;
  --bs-body-font-size: 13px;
  --bs-primary: #2c5f8a;
  --bs-primary-rgb: 44, 95, 138;
  --bs-link-color: #2c5f8a;
  --bs-link-color-rgb: 44, 95, 138;
  --bs-link-hover-color: #1f4868;
}

html { font-size: 13px; }
body { margin: 0; background: var(--page-bg); font-size: 13px; color: #333; }
small, .small { font-size: 12px; }               /* không nhỏ hơn 12px — chữ phụ */
.form-control, .form-select, .btn, .input-group-text, .dropdown-item { font-size: 13px; }
.form-label { font-weight: 600; margin-bottom: 4px; color: #444; }
.req::after { content: ' *'; color: #e74c3c; }

.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-active-border-color: var(--brand-dark); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }

/* ══ LEFT SIDEBAR ═══════════════════════════════════════════════════ */
.left_col {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sb-sm);
  background: var(--sb-bg);
  z-index: 1050; overflow: hidden;
  transition: width var(--trans), left var(--trans);
  box-shadow: 2px 0 10px rgba(0,0,0,.2);
}
body.nav-md .left_col { width: var(--sb-width); }

.nav_title {
  height: var(--topbar-h);
  background: rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  gap: 0; overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none !important;
}
body.nav-md .nav_title { justify-content: flex-start; padding: 0 14px; gap: 10px; }
.nav_title .logo-mark {
  width: 30px; height: 30px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, #e67e22, #2c5f8a);
  color: #fff; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name {
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap; opacity: 0; width: 0; overflow: hidden;
  transition: opacity var(--trans);
}
body.nav-md .brand-name { opacity: 1; width: auto; }

.sidebar-scroll { height: calc(100vh - var(--topbar-h)); overflow-y: auto; overflow-x: hidden; }
.sidebar-scroll::-webkit-scrollbar { width: 3px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.side-nav { list-style: none; margin: 4px 0; padding: 0; }
.side-nav a.nav-item {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 42px; color: var(--sb-txt);
  text-decoration: none !important; font-size: 13px;
  border-left: 3px solid transparent; white-space: nowrap; overflow: hidden;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}
body.nav-md .side-nav a.nav-item { justify-content: flex-start; }
.side-nav a.nav-item:hover { background: var(--sb-hover); color: #fff; }
.side-nav li.active-item a.nav-item { background: rgba(44,95,138,.3); border-left-color: #5b9bd5; color: #fff; }
.side-nav .nav-icon { font-size: 15px; width: var(--sb-sm); text-align: center; flex-shrink: 0; }
body.nav-md .side-nav .nav-icon { width: 40px; }
.side-nav .nav-txt { flex: 1; opacity: 0; max-width: 0; overflow: hidden; transition: opacity var(--trans); }
body.nav-md .side-nav .nav-txt { opacity: 1; max-width: 170px; }

.nav-sep { height: 1px; background: rgba(255,255,255,.07); margin: 4px 8px; }
.nav-section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(200,214,229,.45); padding: 10px 14px 3px;
  white-space: nowrap; overflow: hidden; opacity: 0; max-height: 0;
  transition: opacity var(--trans), max-height var(--trans);
}
body.nav-md .nav-section-label { opacity: 1; max-height: 30px; }

/* Tooltip CSS khi sidebar thu gọn (không dùng JS) */
body:not(.nav-md) .side-nav a.nav-item[data-tip]:hover::after {
  content: attr(data-tip);
  position: fixed; left: calc(var(--sb-sm) + 8px);
  background: #2d3e50; color: #fff; padding: 6px 12px; border-radius: 5px;
  font-size: 13px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.28);
  margin-top: 0; z-index: 99999; pointer-events: none;
}

/* ══ TOP NAVBAR ══════════════════════════════════════════════════════ */
.top_nav {
  position: fixed; top: 0; left: var(--sb-sm); right: 0;
  height: var(--topbar-h);
  background: #fff; border-bottom: 1px solid #e4e8ec;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  z-index: 1040; display: flex; align-items: center;
  padding: 0 12px; gap: 6px;
  transition: left var(--trans);
}
body.nav-md .top_nav { left: var(--sb-width); }

.btn-hamburger {
  background: none; border: none; cursor: pointer; padding: 7px 10px;
  color: #555; font-size: 17px; line-height: 1; border-radius: 4px; flex-shrink: 0;
}
.btn-hamburger:hover { background: #f0f2f5; color: #333; }
.topnav-title { font-size: 14px; color: #555; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.topnav-right { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.topnav-btn {
  position: relative; padding: 7px 10px; color: #555; border-radius: 4px;
  border: none; background: none; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; font-size: 13px;
}
.topnav-btn:hover, .topnav-btn[aria-expanded="true"] { background: #f0f2f5; color: #333; }
.topnav-btn .fa-bell { font-size: 16px; }
.noti-badge {
  position: absolute; top: 1px; right: 0;
  background: #e74c3c; color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 700; padding: 0 5px; min-width: 17px;
  line-height: 17px; height: 17px; text-align: center;
}
.avatar-sm {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Dropdown thông báo */
.noti-menu { width: 360px; max-width: calc(100vw - 16px); padding: 0; }
.noti-menu .noti-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #eee; font-weight: 700; }
.noti-menu .noti-list { max-height: 420px; overflow-y: auto; }
.noti-menu .noti-foot { text-align: center; border-top: 1px solid #eee; padding: 8px; }
.noti-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f3f3f3; color: #333; text-decoration: none; }
.noti-item:hover { background: #f5f7fa; color: #333; }
.noti-item.unread { background: #eef5fc; }
.noti-item.unread:hover { background: #e3eef9; }
.noti-item .noti-msg { flex: 1; min-width: 0; line-height: 1.4; }
.noti-item .noti-time { font-size: 12px; color: #888; margin-top: 2px; }
.noti-item .noti-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex-shrink: 0; }
.noti-empty { padding: 26px 14px; text-align: center; color: #999; }

/* ══ MAIN CONTENT ════════════════════════════════════════════════════ */
.right_col {
  margin-left: var(--sb-sm);
  padding: calc(var(--topbar-h) + 14px) 18px 20px;
  min-height: calc(100vh - 40px);
  transition: margin-left var(--trans);
}
body.nav-md .right_col { margin-left: var(--sb-width); }
.site-footer {
  margin-left: var(--sb-sm); padding: 10px 18px; text-align: center;
  font-size: 12px; color: #999; border-top: 1px solid #e4e8ec;
  transition: margin-left var(--trans);
}
body.nav-md .site-footer { margin-left: var(--sb-width); }

/* Banner thông báo chung (đầu trang) */
.sys-banner { border-radius: 6px; padding: 9px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.sys-banner .fa { margin-top: 2px; }
.sys-banner.info    { background: #e8f4fd; border-color: #b9dcf5; color: #1b5a87; }
.sys-banner.warning { background: #fff3e0; border-color: #f5d29c; color: #8a5300; }
.sys-banner.danger  { background: #fff0f0; border-color: #f3b9b4; color: #a12a1f; }
.sys-banner.success { background: #e8f8e8; border-color: #b5e2b5; color: #1d6b32; }

/* ══ CARD / PAGE ═════════════════════════════════════════════════════ */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.page-head h1 { font-size: 18px; font-weight: 700; margin: 0; color: #2d3e50; flex: 1; min-width: 180px; }
.crm-card { background: #fff; border: 1px solid #e4e8ec; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.04); margin-bottom: 14px; }
.crm-card > .crm-card-head { padding: 10px 14px; border-bottom: 1px solid #eef0f2; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.crm-card > .crm-card-body { padding: 14px; }
.stat-tile { background: #fff; border: 1px solid #e4e8ec; border-left: 4px solid var(--brand); border-radius: 6px; padding: 12px 14px; height: 100%; }
.stat-tile .stat-num { font-size: 22px; font-weight: 700; color: #2d3e50; }
.stat-tile .stat-lbl { color: #777; }

.list-group { --bs-list-group-active-bg: var(--brand); --bs-list-group-active-border-color: var(--brand); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand); }
.nav-pills .nav-link { color: #46607c; }
.page-link { color: var(--brand); }
.active > .page-link { background-color: var(--brand); border-color: var(--brand); }

/* ══ TABLE — header xanh như Xtravel ════════════════════════════════ */
.table { --bs-table-hover-bg: #f5f8fb; margin-bottom: 0; }
.table > thead > tr > th { background: var(--thead); color: #fff; border-color: #3a5269; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.table > tbody > tr > td { vertical-align: middle; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid #e4e8ec; border-radius: 6px; background: #fff; }
tr.row-muted td { color: #999; }
.badge-soft { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.badge-soft.green { background: #e8f8e8; color: #1d6b32; }
.badge-soft.gray  { background: #eee; color: #777; }
.badge-soft.blue  { background: #e8f4fd; color: #1b5a87; }
.badge-soft.red   { background: #fff0f0; color: #a12a1f; }
.badge-soft.orange{ background: #fff3e0; color: #8a5300; }

/* Ma trận phân quyền */
.perm-matrix td, .perm-matrix th { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.perm-seg { display: inline-flex; border: 1px solid #cfd6dd; border-radius: 5px; overflow: hidden; }
.perm-seg input { display: none; }
.perm-seg label { padding: 4px 10px; cursor: pointer; font-size: 13px; color: #555; border-right: 1px solid #cfd6dd; user-select: none; }
.perm-seg label:last-of-type { border-right: none; }
.perm-seg input:checked + label.lv0 { background: #eee; color: #666; font-weight: 600; }
.perm-seg input:checked + label.lv1 { background: #e8f4fd; color: #1b5a87; font-weight: 600; }
.perm-seg input:checked + label.lv2 { background: var(--brand); color: #fff; font-weight: 600; }
.perm-seg.disabled { opacity: .6; pointer-events: none; }

/* Tooltip CSS (không dùng title/JS) — <span class="tip" data-tip="...">
   Mặc định: phía trên, canh giữa. Tooltip là ::after position:absolute nên nếu thò ra ngoài mép phải/dưới
   của khung có overflow (bảng cuộn ngang, trang) sẽ sinh thanh cuộn → các biến thể bên dưới tránh việc đó. */
.tip { position: relative; cursor: help; }
.tip:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: #2d3e50; color: #fff; padding: 6px 10px; border-radius: 5px; font-size: 13px; font-weight: 400; line-height: 1.4;
  white-space: normal; width: max-content; max-width: 260px; z-index: 2000; text-transform: none; letter-spacing: 0;
  pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
/* Nút sát mép phải (ngoài bảng): canh theo mép phải nút, mở sang trái. */
.tip.tip-left:hover::after { left: auto; right: 0; transform: none; }
/* Trong bảng (khung cuộn ngang): hiện bên TRÁI phần tử, 1 dòng, nằm gọn trong chiều cao hàng — không thò
   ra mép phải/dưới của khung nên không làm xuất hiện thanh cuộn (lỗi ở cột Thao tác trang Người dùng). */
.table-wrap .tip:hover::after {
  left: auto; bottom: auto; right: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; max-width: none;
}
/* 2 cột đầu sát mép TRÁI khung bảng → hiện bên PHẢI (bên trái sẽ bị khung cắt mất). */
.table-wrap td:nth-child(-n+2) .tip:hover::after { right: auto; left: calc(100% + 6px); }
/* Chốt chặn: tooltip không bao giờ làm cả trang cuộn ngang (clip không tạo vùng cuộn, sticky vẫn chạy). */
.right_col { overflow-x: clip; }

/* Toast */
.crm-toast-wrap { position: fixed; top: calc(var(--topbar-h) + 10px); right: 12px; z-index: 11000; display: flex; flex-direction: column; gap: 8px; }
.crm-toast { min-width: 240px; max-width: 360px; padding: 10px 14px; border-radius: 6px; color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.18); display: flex; gap: 8px; align-items: flex-start; animation: toastIn .2s ease; }
.crm-toast.success { background: #27ae60; } .crm-toast.error { background: #e74c3c; }
.crm-toast.info { background: var(--brand); } .crm-toast.warning { background: #e67e22; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ══ MULTI-SELECT (js-ms) ═══════════════════════════════════════════ */
.ms-box { position: relative; }
.ms-chips { min-height: 36px; border: 1px solid #ced4da; border-radius: 6px; padding: 4px 30px 4px 6px; display: flex; flex-wrap: wrap; gap: 4px; cursor: pointer; background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") no-repeat right 10px center / 12px; }
.ms-ph { color: #888; padding: 3px 4px; }
.ms-chip { background: #e8f4fd; color: #1b5a87; border-radius: 12px; padding: 2px 8px; display: inline-flex; align-items: center; gap: 6px; }
.ms-chip .fa { cursor: pointer; opacity: .7; }
.ms-drop { display: none; position: absolute; z-index: 1060; left: 0; right: 0; top: calc(100% + 2px); background: #fff; border: 1px solid #d6dce2; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 6px; }
.ms-box.open .ms-drop { display: block; }
.ms-list { max-height: 260px; overflow-y: auto; margin-top: 6px; }
.ms-group { font-weight: 700; color: #46607c; padding: 6px 6px 2px; font-size: 12px; text-transform: uppercase; }
.ms-opt { display: flex; align-items: center; padding: 6px; border-radius: 4px; cursor: pointer; margin: 0; }
.ms-opt:hover { background: #f5f8fb; }

/* ══ DATEPICKER (flatpickr) ══════════════════════════════════════════ */
.flatpickr-input[readonly], input.flatpickr-input.form-control:not(:disabled) { background-color: #fff; cursor: pointer; }
.flatpickr-calendar { font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.flatpickr-current-month { display: flex; align-items: center; justify-content: center; gap: 6px; padding-top: 6px; font-size: 14px; }
.flatpickr-current-month .flatpickr-monthDropdown-months { font-size: 14px; font-weight: 600; padding: 2px 4px; border-radius: 4px; }
.flatpickr-current-month .crm-year-select { width: auto; min-width: 70px; }
.flatpickr-current-month .flatpickr-monthDropdown-months:hover { background: #eef3f8; }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.startRange, .flatpickr-day.endRange { background: var(--brand); border-color: var(--brand); }
.flatpickr-day.today { border-color: #e67e22; }
.flatpickr-day.today:hover { background: #e67e22; border-color: #e67e22; color: #fff; }
.flatpickr-time input, .flatpickr-time .flatpickr-am-pm { font-size: 14px; }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--brand); }

/* ══ Ô CHỌN CÓ TÌM KIẾM (js-ss) ══════════════════════════════════════ */
.ss-box { position: relative; }
.ss-btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background-color: #fff; }
.ss-btn.ss-empty { color: #666; }
.ss-drop { display: none; position: absolute; z-index: 1060; left: 0; top: calc(100% + 2px); min-width: 100%; width: max-content; max-width: 320px;
  background: #fff; border: 1px solid #d6dce2; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 6px; }
.ss-box.open .ss-drop { display: block; }
.ss-list { max-height: 280px; overflow-y: auto; margin-top: 6px; }
.ss-opt { padding: 6px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.ss-opt.active { background: #e8f4fd; }
.ss-opt.selected { font-weight: 700; color: var(--brand); }
.ss-opt.ss-placeholder { color: #666; }
.ss-hint { color: #888; font-weight: 400; }
.ss-none { padding: 8px 10px; color: #999; }

/* ══ MENTION ═════════════════════════════════════════════════════════ */
.mention-menu { display: none; position: absolute; z-index: 1070; background: #fff; border: 1px solid #d6dce2; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); min-width: 220px; max-width: 320px; margin-top: 2px; }
.mention-item { padding: 7px 12px; cursor: pointer; }
.mention-item.active, .mention-item:hover { background: #e8f4fd; }
.mention { color: #1b5a87; font-weight: 600; background: #e8f4fd; border-radius: 3px; padding: 0 2px; }

/* ══ KHÁCH HÀNG ══════════════════════════════════════════════════════ */
.stage-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.brand-tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.brand-tag.xp { background: #fdecea; color: #c0392b; }
.brand-tag.mz { background: #e6f4f1; color: #138d75; }
.pot-tag { display: inline-block; width: 20px; text-align: center; border-radius: 4px; font-size: 12px; font-weight: 700; color: #fff; }
.pot-tag.A { background: #e74c3c; } .pot-tag.B { background: #e67e22; } .pot-tag.C { background: #95a5a6; }
.care-due { font-size: 12px; white-space: nowrap; }
.care-due.overdue { color: #c0392b; font-weight: 700; }
.care-due.today { color: #d35400; font-weight: 700; }
.filter-bar .form-select, .filter-bar .form-control { min-width: 0; }
.quick-scope .btn { white-space: nowrap; }
.date-range input.form-control { width: 128px; }
@media (max-width: 767.98px) { .date-range { width: 100%; } .date-range input.form-control { flex: 1; width: auto; } }
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 14px; background: #fff3e0; color: #8a5300; border: 1px solid #f5d29c; font-weight: 600; text-decoration: none; }
.filter-chip:hover { background: #ffe5bf; color: #6b4000; }
.filter-chip .fa { opacity: .7; }
.dup-box { border: 1px solid #f5d29c; background: #fff8ec; border-radius: 6px; padding: 10px 12px; margin-top: 6px; }
.dup-box.hard { border-color: #f3b9b4; background: #fff0f0; }

/* Thanh bước bán hàng */
.stage-bar { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.stage-step { flex: 1 0 auto; min-width: 92px; text-align: center; padding: 7px 8px; font-size: 12px; font-weight: 600; color: #6b7c8c; background: #eef1f4; border: none;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); white-space: nowrap; }
.stage-step:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); }
.stage-step.done { background: #cfe2f3; color: #1f4868; }
.stage-step.current { background: var(--brand); color: #fff; }
button.stage-step:hover:not(.current) { filter: brightness(.95); cursor: pointer; }
.stage-final { display: inline-flex; gap: 6px; align-items: center; }

/* Dòng thời gian */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: #e4e8ec; }
.tl-item { position: relative; margin-bottom: 12px; }
.tl-dot { position: absolute; left: -26px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: #46607c; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; box-shadow: 0 0 0 3px var(--page-bg); }
.tl-card { background: #fff; border: 1px solid #e4e8ec; border-radius: 6px; padding: 10px 12px; }
.tl-card.tl-muted { background: #f9fafb; color: #555; padding: 6px 12px; }
.tl-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-bottom: 4px; }
.tl-head .tl-who { font-weight: 700; }
.tl-head .tl-when { color: #888; font-size: 12px; }
.tl-body { white-space: pre-line; word-break: break-word; }
.tl-field { color: #666; font-weight: 600; }
.tl-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-file { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #e4e8ec; border-radius: 5px; padding: 4px 8px; background: #fafbfc; color: #333; text-decoration: none; max-width: 100%; }
.tl-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.tl-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 5px; border: 1px solid #e4e8ec; }
.tl-replies { border-top: 1px dashed #e4e8ec; margin-top: 8px; padding-top: 6px; }
.tl-reply { padding: 4px 0 4px 10px; border-left: 2px solid #e4e8ec; margin-bottom: 4px; }
.checkin-geo { font-size: 12px; color: #555; }
.checkin-geo.far { color: #c0392b; font-weight: 700; }

.info-list { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; }
.info-list dt { color: #888; font-weight: 600; }
.info-list dd { margin: 0; word-break: break-word; }
.member-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.label-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #fff; line-height: 1.5; white-space: nowrap; }
.label-chip .fa { font-size: 11px; opacity: .75; }
a:hover > .label-chip { filter: brightness(.92); }
.label-pick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.label-pick:hover { background: #f5f8fb; }

/* ══ LOGIN ═══════════════════════════════════════════════════════════ */
body.login-page { background: linear-gradient(135deg, #1e2d3d 0%, #2c5f8a 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: #fff; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.3); width: 100%; max-width: 380px; padding: 28px 26px; }
.login-box .logo-mark { width: 48px; height: 48px; border-radius: 10px; background: linear-gradient(135deg, #e67e22, #2c5f8a); color: #fff; font-weight: 800; font-size: 22px; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.login-box h1 { font-size: 18px; text-align: center; font-weight: 700; margin-bottom: 2px; color: #2d3e50; }
.login-box .sub { text-align: center; color: #888; margin-bottom: 20px; }

/* ══ MOBILE ══════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  .left_col { left: calc(-1 * var(--sb-width)); width: var(--sb-width) !important; box-shadow: none; }
  body.mob-open .left_col { left: 0; box-shadow: 2px 0 10px rgba(0,0,0,.2); }
  body.mob-open .left_col .brand-name,
  body.mob-open .left_col .nav-txt { opacity: 1; max-width: 170px; width: auto; }
  body.mob-open .left_col .nav-section-label { opacity: 1; max-height: 30px; }
  body.mob-open .left_col .nav_title { justify-content: flex-start; padding: 0 14px; gap: 10px; }
  body.mob-open .left_col .side-nav a.nav-item { justify-content: flex-start; }
  body.mob-open .left_col .nav-icon { width: 40px; }
  .mob-overlay { display: none; }
  body.mob-open .mob-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1049; }

  .top_nav, body.nav-md .top_nav { left: 0; }
  .right_col, body.nav-md .right_col, .site-footer, body.nav-md .site-footer { margin-left: 0; }
  .right_col { padding: calc(var(--topbar-h) + 10px) 10px 16px; }
  .topnav-label { display: none; }
  .noti-menu { position: fixed !important; left: 8px !important; right: 8px !important; width: auto; transform: none !important; top: var(--topbar-h) !important; }
  .page-head h1 { font-size: 16px; }
  .page-head .btn { flex: 1 1 auto; }

  /* Bảng → thẻ trên điện thoại: <table class="table table-cards"> + data-label trên từng td */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border: 1px solid #e4e8ec; border-radius: 6px; margin: 0 0 8px; background: #fff; padding: 6px 0; }
  .table-cards td { border: none !important; padding: 4px 12px !important; display: flex; gap: 10px; }
  .table-cards td[data-label]:empty { display: none; }
  .table-cards td[data-label]::before { content: attr(data-label); flex: 0 0 110px; color: #888; font-weight: 600; }
  .table-cards td.td-actions { justify-content: flex-end; }
  .table-wrap:has(.table-cards) { border: none; background: transparent; }
}

/* ── PWA: nút cài ứng dụng + hộp thoại (wwwroot/js/pwa.js) ── */
.topnav-btn.topnav-install { color: #e67e22; border: 1px solid #f3c79c; gap: 6px; }
.topnav-btn.topnav-install:hover { background: #fdf2e7; color: #c0651a; }
.pwa-modal-body { font-size: 14px; }
.pwa-modal-icon { width: 56px; height: 56px; border-radius: 12px; display: block; margin: 0 auto 12px; }
.pwa-steps { padding-left: 20px; margin-bottom: 10px; }
.pwa-steps li { margin-bottom: 6px; }
