:root {
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --surface-raised: #FFFFFF;
  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-faint: #64748B;
  --line: #DCE3EA;
  --line-soft: #E8EDF2;

  --brand: #0F766E;
  --brand-dark: #0B5F59;
  --brand-darker: #0B3D39;
  --brand-soft: #E5F5F2;
  --brand-soft-hover: #D2ECE7;
  --on-brand: #FFFFFF;

  --accent: #E8A33D;
  --accent-ink: #92600F;
  --accent-soft: #FDF1E0;

  --info: #2F6FA8;
  --info-soft: #E7F1FA;

  --success: #1F6F5C;
  --success-soft: #E4F1EC;

  --danger: #C1443C;
  --danger-hover: #A8362F;
  --danger-soft: #FBEAE9;

  --sidebar-bg: #0F1F1C;
  --sidebar-bg-2: #0B1715;
  --sidebar-ink: #D8E5E1;
  --sidebar-ink-dim: #8DA69E;
  --sidebar-active: #0F766E;

  /* Bảng màu dành riêng cho biểu đồ — charts.js đọc trực tiếp các biến này để
     màu đồ thị luôn khớp với chủ đề sáng/tối đang bật. */
  --chart-1: #1F6F5C;
  --chart-2: #E8A33D;
  --chart-3: #2F6FA8;
  --chart-4: #C1443C;
  --chart-5: #7C5CBF;
  --chart-6: #4FA88B;
  --chart-grid: #ECEFF1;
  --chart-ink: #8C97A0;
  --chart-tooltip-bg: #14201C;
  --chart-tooltip-ink: #FFFFFF;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --nav-h: 62px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px -10px rgba(15, 23, 42, 0.22);
  --shadow-lg: 0 22px 55px -18px rgba(15, 23, 42, 0.32);

  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ===================================================================
   CHẾ ĐỘ TỐI
   Bật bằng thuộc tính data-theme="dark" trên thẻ <html> (app.js đặt, lưu vào
   localStorage). Đặt trên <html> chứ không phải <body> vì mỗi lần điều hướng
   PJAX là toàn bộ <body> bị thay mới — để trên <html> thì lựa chọn của người
   dùng không bị mất sau mỗi lần chuyển trang.
   =================================================================== */
:root[data-theme="dark"] {
  --bg: #0B1220;
  --surface: #111827;
  --surface-alt: #172033;
  --surface-raised: #1B263A;
  --ink: #F8FAFC;
  --ink-soft: #CBD5E1;
  --ink-faint: #94A3B8;
  --line: #2A374B;
  --line-soft: #202C3E;

  --brand: #2DD4BF;
  --brand-dark: #5EEAD4;
  --brand-darker: #071C1A;
  --brand-soft: #123B39;
  --brand-soft-hover: #184A46;
  --on-brand: #05201D;

  --accent: #E8A33D;
  --accent-ink: #EBB865;
  --accent-soft: #352915;

  --info: #6BAAE0;
  --info-soft: #172C3D;

  --success: #4FBF9F;
  --success-soft: #16332B;

  --danger: #E8746B;
  --danger-hover: #F08A82;
  --danger-soft: #37201E;

  --sidebar-bg: #080F1A;
  --sidebar-bg-2: #060B13;
  --sidebar-ink: #D7E0EA;
  --sidebar-ink-dim: #8A9AAD;
  --sidebar-active: #115E59;

  --chart-1: #4FBF9F;
  --chart-2: #EBB865;
  --chart-3: #6BAAE0;
  --chart-4: #E8746B;
  --chart-5: #A48BE0;
  --chart-6: #79D2B8;
  --chart-grid: #26332F;
  --chart-ink: #7C8F88;
  --chart-tooltip-bg: #E8EFEC;
  --chart-tooltip-ink: #101A16;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 45px -12px rgba(0, 0, 0, 0.65);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  font-size: 14.5px;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
button, input, textarea, select { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

h1, h2, h3, h4 { margin: 0; }

/* ===================================================================
   APP SHELL (sidebar + main column)
   =================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform .22s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #d98c1f);
  color: #17251f;
  font-weight: 800;
  font-size: 13.5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 14.5px; color: #fff; letter-spacing: 0.1px; }
.brand-sub { font-size: 11px; color: var(--sidebar-ink-dim); margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav .nav-item,
.sidebar-footer .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-ink);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav-item .nav-ic { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.9; display: flex; align-items: center; justify-content: center; }
.nav-ic svg, .menu-toggle svg { display: block; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item-danger:hover { background: rgba(193,68,60,0.22); color: #ffb4ae; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 4px;
  margin-top: 6px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-ink-dim); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 15, 0.5);
  z-index: 39;
  opacity: 0;
  transition: opacity .2s ease;
}

/* ---------- MAIN COLUMN ---------- */
.main-col {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
}
.topbar-title { font-size: 16px; font-weight: 800; color: var(--ink); letter-spacing: -0.1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.role-pill {
  font-size: 11.5px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 5px 11px;
  border-radius: 999px;
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, transform .15s ease;
}
.icon-btn svg { display: block; }
.icon-btn:hover { background: var(--brand-soft-hover); }
.icon-btn:active { transform: scale(0.94); }
.menu-toggle {
  display: none;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ===================================================================
   BOTTOM NAV (mobile) — khôi phục theo đúng phong cách bản gốc: các nút
   cố định ở chân màn hình, icon + nhãn, gạch nhấn mục đang chọn. Vì hệ
   thống hiện có nhiều mục hơn bản gốc (đã thêm Nhật ký/Thùng rác/Thống
   kê...) nên cho cuộn ngang thay vì flex đều — vẫn giữ đúng tinh thần
   "toàn bộ là các nút bấm ở chân trang", chỉ khác là vuốt ngang khi
   không đủ chỗ, thay vì bị bóp nhỏ hết cỡ.
   =================================================================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--line);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px -8px rgba(20,32,28,0.12);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.bottom-nav-inner { display: flex; height: 100%; min-width: 100%; width: max-content; }
.bottom-nav a {
  flex: 0 0 auto;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 10px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  position: relative;
  transition: color .15s ease;
}
.bottom-nav a .nav-ic { width: 21px; height: 21px; display: flex; align-items: center; justify-content: center; opacity: 0.85; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a.active .nav-ic { opacity: 1; }
.bottom-nav a.active::before {
  content: '';
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 3px;
  border-radius: 999px;
  background: var(--brand);
}

.container {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 24px 40px;
}

/* ===================================================================
   PAGE HEADER / SECTION TITLES
   =================================================================== */
.page-header { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--ink); letter-spacing: -0.3px; }
.page-sub { font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }

.section-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-soft);
  padding: 2px 9px;
  border-radius: 999px;
}
.section-title .desc { font-weight: 500; color: var(--ink-faint); font-size: 12.5px; }

/* ===================================================================
   CARD
   =================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  margin: 0 0 16px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.card-grid .field { grid-column: span 1; }
.card-grid .field.full { grid-column: 1 / -1; }

/* Panel gấp gọn cho form "Thêm mới" — dùng <details> để không chiếm chỗ mặc định */
.add-panel { padding: 0; overflow: hidden; }
.add-panel > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--brand-dark);
}
.add-panel > summary::-webkit-details-marker { display: none; }
.add-panel > summary .plus-ic {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: transform .15s ease;
}
.add-panel[open] > summary .plus-ic { transform: rotate(45deg); }
.add-panel .add-panel-body {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
}

/* ===================================================================
   FORMS
   =================================================================== */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field .hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 5px; line-height: 1.4; }
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface-alt);
  color: var(--ink);
  font-family: inherit;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field textarea { resize: vertical; min-height: 64px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: var(--on-brand);
  transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn.btn-block { width: 100%; }
.btn.btn-secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn.btn-secondary:hover { background: var(--brand-soft-hover); }
.btn.btn-outline { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.btn-outline:hover { background: var(--brand-soft); }
.btn.btn-danger { background: var(--danger); }
.btn.btn-danger:hover { background: var(--danger-hover); }
.btn.btn-danger.btn-outline { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn.btn-danger.btn-outline:hover { background: var(--danger-soft); }
.btn.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.65; cursor: not-allowed; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: none; background: transparent;
  font-size: 16px; color: var(--ink-soft); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pw-toggle.shown { color: var(--brand); }
.pw-toggle svg { display: block; }

.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; margin-bottom: 0; }

.form-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* ===================================================================
   STAT GRID (dashboard)
   =================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
/* Lưới cố định 3 cột — dùng khi chỉ có đúng 3 thẻ và muốn chúng chia đều */
.stat-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: block;
  color: inherit;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--stat-color, var(--brand));
}
/* Thẻ bấm được (dẫn tới trang danh sách đã lọc sẵn) — có phản hồi khi rê chuột */
.stat-card.is-link { transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease; }
.stat-card.is-link:hover { border-color: var(--stat-color, var(--brand)); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card .stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stat-card .stat-ic {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--stat-soft, var(--brand-soft));
  color: var(--stat-color, var(--brand-dark));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-value { font-size: 25px; font-weight: 800; color: var(--ink); letter-spacing: -0.4px; line-height: 1.15; }
.stat-card .stat-label { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; font-weight: 600; }
.stat-card .stat-hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }

/* Nhãn xu hướng so với kỳ trước — xanh = diễn biến tốt, đỏ = xấu, xám = không đổi.
   "Tốt/xấu" do PHP quyết định theo ngữ cảnh (doanh thu tăng là tốt, SĐT hết hạn tăng là xấu). */
.stat-card .stat-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: var(--line-soft); color: var(--ink-soft);
  white-space: nowrap;
}
.stat-card .stat-trend.good { background: var(--success-soft); color: var(--success); }
.stat-card .stat-trend.bad { background: var(--danger-soft); color: var(--danger); }
.stat-card .stat-trend svg { flex-shrink: 0; }

/* Biểu đồ mini trong thẻ — charts.js vẽ, chiều cao cố định để thẻ không nhảy khi tải xong */
.stat-card .stat-spark { height: 34px; margin-top: 10px; margin-bottom: -4px; }
.stat-card .stat-spark canvas { display: block; }

.stat-card.c-danger { --stat-color: var(--danger); --stat-soft: var(--danger-soft); }
.stat-card.c-warn { --stat-color: var(--accent-ink); --stat-soft: var(--accent-soft); }
.stat-card.c-info { --stat-color: var(--info); --stat-soft: var(--info-soft); }
.stat-card.c-success { --stat-color: var(--success); --stat-soft: var(--success-soft); }
.stat-card.c-neutral { --stat-color: var(--ink-faint); --stat-soft: var(--line-soft); }

/* ===================================================================
   CTV COMMISSION CARDS (admin/hoahong.php)
   =================================================================== */
.ctv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.ctv-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, border-color .15s ease, transform .1s ease;
}
.ctv-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.ctv-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ctv-avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.ctv-card-name { font-weight: 700; font-size: 14.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctv-card-money { font-size: 22px; font-weight: 800; color: var(--brand-dark); letter-spacing: -0.3px; margin-bottom: 10px; }
.ctv-card-stats { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.ctv-card-stats span { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.ctv-card-stats svg { color: var(--ink-faint); }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row .bar-row-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-row .bar-row-top .lbl { font-weight: 600; color: var(--ink); }
.bar-row .bar-row-top .val { color: var(--ink-soft); font-weight: 700; }
.bar-track { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--accent)); }

/* ===================================================================
   CHART WIDGET (biểu đồ JS động, dashboard + trang Thống kê)
   =================================================================== */
.chart-widget { margin-bottom: 4px; }
.chart-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.chart-controls select, .chart-controls input[type="month"] {
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface-alt);
  color: var(--ink);
}
/* Vùng vẽ: chiều cao cố định qua --chart-h để Chart.js (responsive, maintainAspectRatio:false)
   có khung tham chiếu và trang không bị "giật" chiều cao lúc biểu đồ tải xong. */
.chart-canvas { position: relative; height: var(--chart-h, 260px); }
.chart-canvas canvas { display: block; }
.chart-canvas .chart-msg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ink-faint); text-align: center; padding: 0 12px;
}
.chart-canvas.is-loading::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--line-soft), transparent);
  background-size: 200% 100%;
  animation: chart-shimmer 1.1s linear infinite;
  border-radius: var(--radius-sm);
  opacity: .7;
}
@keyframes chart-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.chart-legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.chart-totals { display: flex; gap: 22px; margin: 0 0 14px; flex-wrap: wrap; }
.chart-totals .ct-item { display: flex; flex-direction: column; gap: 2px; }
.chart-totals .ct-label { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.chart-totals .ct-value { font-size: 17px; font-weight: 800; color: var(--ink); }
.chart-totals .ct-item.is-cost .ct-value { color: var(--danger); }

/* Chú giải bên phải biểu đồ tròn: mỗi dòng là 1 trạng thái + số lượng + tỉ lệ,
   đọc nhanh hơn nhiều so với legend mặc định nằm ngang của Chart.js. */
.donut-layout { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 20px; align-items: center; }
.donut-legend { display: flex; flex-direction: column; gap: 2px; }
.donut-legend .dl-row {
  display: grid; grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: 9px;
  padding: 7px 8px; border-radius: 8px;
  font-size: 13px;
  transition: background .15s ease;
}
.donut-legend a.dl-row:hover { background: var(--surface-alt); }
.donut-legend .dl-row .dl-name { color: var(--ink); font-weight: 600; }
.donut-legend .dl-row .dl-val { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.donut-legend .dl-row .dl-pct { color: var(--ink-faint); font-size: 11.5px; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ===================================================================
   TOOLBAR / SEARCH / TABS / BULK ACTIONS
   =================================================================== */
.toolbar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.toolbar .searchbox { flex: 1; min-width: 200px; margin-bottom: 0; position: relative; }
.toolbar .searchbox input { padding-left: 38px; }
/* Icon kính lúp: SVG đặt trong markup (span.search-ic) thay cho emoji qua CSS content
   — emoji hiển thị khác nhau tuỳ hệ điều hành và không ăn theo màu chữ. */
.searchbox .search-ic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none; display: flex;
}
.toolbar .tabs { margin: 0; }

.tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tabs a:hover { border-color: var(--brand); color: var(--brand-dark); }
.tabs a.active { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }

.bulk-bar {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--brand-darker);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bulk-bar.active { display: flex; }
.bulk-bar .bulk-count { font-size: 13px; font-weight: 700; }
.bulk-bar .field { margin: 0; }
.bulk-bar .field input { padding: 8px 10px; font-size: 13px; width: auto; background: var(--surface); color: var(--ink); border-color: transparent; }
.bulk-bar .btn { padding: 8px 14px; font-size: 12.5px; }

/* ===================================================================
   DATA TABLE (chuyển thành thẻ xếp dọc trên mobile)
   =================================================================== */
/* overflow-x: auto (KHÔNG phải hidden) — tiêu đề cột và badge đều white-space:nowrap nên
   một bảng nhiều cột có thể rộng hơn khung chứa. Với 'hidden' thì phần thừa bị CẮT MẤT
   HẲN, không có thanh cuộn: cột cuối (vd "Chi phí tháng") biến mất mà không có dấu hiệu
   gì cho biết là còn dữ liệu ở bên phải. overflow-y: hidden để border-radius vẫn được
   bo gọn và không sinh thanh cuộn dọc thừa. */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 16px;
}
table.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ink-faint);
  background: var(--surface-alt);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
  color: var(--ink);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-alt); }
.data-table td.col-actions { text-align: right; white-space: nowrap; }
.data-table td .cell-title { font-weight: 700; color: var(--ink); }
.data-table td .cell-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.data-table th.col-check, .data-table td.col-check { width: 34px; padding-right: 0; }
.row-actions { display: inline-flex; gap: 6px; }
.icon-action {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-action:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.icon-action.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

/* ===================================================================
   DETAIL / EXPANDABLE ROW (chi tiết sổ theo dòng)
   =================================================================== */
.detail-row td { background: var(--surface-alt); padding: 18px 20px; border-bottom: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* ===================================================================
   ACCORDION (giữ lại cho các nơi hợp lý — vd chi tiết SĐT trong 1 khách hàng)
   =================================================================== */
.accordion-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.accordion-item[open] { border-color: var(--brand); box-shadow: var(--shadow-md); }
.accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-summary .sum-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.accordion-summary .sum-title { font-weight: 700; font-size: 14.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accordion-summary .sum-sub { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accordion-summary .chevron {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  transition: transform .15s ease;
}
.accordion-item[open] .chevron { transform: rotate(180deg); }
.accordion-body { padding: 0 14px 16px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ===================================================================
   BADGES / KV / EMPTY / ALERT
   =================================================================== */
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.badge.warn { background: var(--accent-soft); color: var(--accent-ink); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--line-soft); color: var(--ink-soft); }

.kv { display: grid; grid-template-columns: 120px 1fr; font-size: 13px; margin-top: 5px; gap: 4px; }
.kv span.k { color: var(--ink-soft); }
.kv span.v { color: var(--ink); font-weight: 600; word-break: break-word; }

.empty-state { text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 14px; color: var(--ink-soft); }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }
.empty-state .empty-title { font-weight: 700; color: var(--ink); margin-bottom: 4px; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(193,68,60,0.18); }
.alert-success { background: var(--brand-soft); color: var(--brand-dark); border-color: rgba(31,111,92,0.16); }
.alert-warn { background: var(--accent-soft); color: var(--accent-ink); border-color: rgba(232,163,61,0.3); }
.alert a { color: inherit; text-decoration: underline; }

/* ===================================================================
   PAGINATION
   =================================================================== */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 16px 0 6px; flex-wrap: wrap;
}
.pagination .page-summary { font-size: 12.5px; color: var(--ink-soft); }
.pagination .page-summary strong { color: var(--ink); }
.pagination .page-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination .page-btn {
  min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
  padding: 0 9px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.pagination .page-btn:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.pagination .page-btn.current { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.pagination .page-btn.disabled { pointer-events: none; opacity: 0.35; }
.pagination .page-btn.icon-only { padding: 0; }
.pagination .page-gap { color: var(--ink-faint); padding: 0 2px; font-size: 13px; }
.pagination .page-size { display: flex; align-items: center; gap: 7px; margin: 0; }
.pagination .page-size label { font-size: 12.5px; color: var(--ink-soft); }
.pagination .page-size select {
  padding: 6px 8px; border-radius: 8px; font-size: 12.5px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}

/* ===================================================================
   LOGIN
   =================================================================== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(180deg, var(--brand-dark) 0%, var(--brand) 45%, var(--bg) 45%); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 18px; padding: 28px 24px; box-shadow: 0 20px 40px rgba(20,40,32,0.18); }
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo .mark { width: 52px; height: 52px; border-radius: 14px; background: var(--brand); color: var(--on-brand); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; margin: 0 auto 10px; }
.login-logo h1 { font-size: 17px; margin: 0; color: var(--ink); }
.login-logo p { font-size: 12.5px; color: var(--ink-soft); margin: 2px 0 0; }

/* ===================================================================
   UTILITIES
   =================================================================== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.small { font-size: 12.5px; color: var(--ink-soft); }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: none; }
.fab-link { display: block; text-align: center; margin-bottom: 16px; }
.text-muted { color: var(--ink-faint); }
.checkbox-cell { display: flex; align-items: center; justify-content: center; }
input[type="checkbox"].row-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); }

/* ===================================================================
   Ô NHẬP NGÀY dd/mm/yyyy (xem render_date_input trong functions.php)
   Ô text lo phần hiển thị; ô type=date trong suốt nằm đè lên icon lịch để bấm vào là
   bật bộ chọn ngày gốc — không dùng thư viện ngoài, trên mobile vẫn ra lịch của máy.
   =================================================================== */
.date-field { position: relative; display: block; width: 100%; }
.date-field .date-vi { width: 100%; padding-right: 42px !important; }
.date-field .date-vi.is-invalid { border-color: var(--danger); }
.date-field .date-pick-wrap {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow: hidden;
}
/* Ô ngày gốc: trong suốt, phủ kín vùng icon. Phải ép lại mọi thuộc tính hình thức vì
   .field input ở trên đã gán viền/nền/padding cho mọi input trong .field. */
.date-field .date-pick {
  position: absolute; inset: 0;
  width: 100% !important; height: 100%;
  margin: 0; padding: 0 !important;
  border: none !important; background: transparent !important;
  opacity: 0; cursor: pointer;
  color: transparent;
}
.date-field .date-pick:focus { outline: none; box-shadow: none !important; }
.date-field .date-pick::-webkit-calendar-picker-indicator { width: 100%; height: 100%; cursor: pointer; }
.date-field .date-ic { pointer-events: none; display: flex; color: var(--ink-faint); }
.date-field:hover .date-ic { color: var(--brand); }
.date-field .date-vi:disabled ~ .date-pick-wrap { opacity: 0.45; pointer-events: none; }
/* .bulk-bar .field input đặt width:auto (cho các ô khác), phải kéo lại cho ô ngày lấp đầy
   khung .date-field — nếu không icon lịch sẽ lệch ra ngoài mép ô text. */
.bulk-bar .field .date-field .date-vi { width: 100%; }

/* ===================================================================
   ROUTE PROGRESS BAR
   =================================================================== */
.route-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0%; background: linear-gradient(90deg, var(--accent), var(--brand)); z-index: 999; transition: width .25s ease, opacity .3s ease; opacity: 1; }
.route-progress.done { opacity: 0; }

/* ===================================================================
   TOAST
   =================================================================== */
.toast-host { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius-sm); padding: 12px 12px 12px 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600; color: var(--ink); opacity: 0; transform: translateY(-10px) scale(.98); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-error { border-left-color: var(--danger); }
.toast-ic { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; font-size: 13px; margin-top: 1px; }
.toast-error .toast-ic { background: var(--danger-soft); color: var(--danger); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close { flex-shrink: 0; border: none; background: transparent; color: var(--ink-faint); font-size: 17px; line-height: 1; cursor: pointer; padding: 2px; }
.toast-close:hover { color: var(--ink-soft); }

/* ===================================================================
   CONFIRM MODAL
   =================================================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 25, 22, 0.46); backdrop-filter: blur(1px); z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .18s ease; }
.modal-overlay.show { opacity: 1; }
.modal-box { width: 100%; max-width: 360px; background: var(--surface); border-radius: var(--radius-lg); padding: 24px 22px 20px; box-shadow: var(--shadow-lg); text-align: center; transform: translateY(8px) scale(.97); transition: transform .18s ease; }
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-ic { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; font-size: 21px; }
.modal-ic.danger { background: var(--danger-soft); color: var(--danger); }
.modal-title { font-size: 16px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.modal-msg { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { margin: 0; flex: 1; }

/* ===================================================================
   NÚT ĐỔI SÁNG / TỐI
   =================================================================== */
.theme-toggle {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.theme-toggle:hover { background: var(--brand-soft); color: var(--brand-dark); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle span { display: flex; }
/* Chỉ hiện icon tương ứng với chủ đề đang bật (mặt trăng khi đang sáng = "bấm để sang tối") */
.theme-toggle .ic-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-dark { display: flex; }
:root[data-theme="dark"] .theme-toggle .ic-light { display: none; }

/* ===================================================================
   TIÊU ĐỀ THẺ CÓ HÀNH ĐỘNG BÊN PHẢI
   =================================================================== */
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head .ch-title { font-size: 14.5px; font-weight: 700; color: var(--brand-dark); display: flex; align-items: center; gap: 8px; }
.card-head .ch-title svg { color: var(--brand); flex-shrink: 0; }
.card-head .ch-sub { font-size: 12px; color: var(--ink-faint); font-weight: 500; margin-top: 2px; }
.card-head .ch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Khi dùng .card-head thì phần <h3> mặc định của .card không còn cần đường kẻ riêng */
.card > .card-head + .chart-widget { margin-top: 2px; }

/* ===================================================================
   CỘT BẢNG SẮP XẾP ĐƯỢC
   =================================================================== */
.data-table thead th.sortable { padding: 0; }
.data-table thead th.sortable > a {
  display: flex; align-items: center; gap: 5px;
  padding: 12px 14px;
  color: inherit; font: inherit;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.data-table thead th.sortable > a:hover { color: var(--brand); background: var(--brand-soft); }
.data-table thead th.sortable .sort-ic { display: inline-flex; opacity: 0.4; }
.data-table thead th.sortable:hover .sort-ic { opacity: 0.75; }
.data-table thead th.sorted > a { color: var(--brand); }
.data-table thead th.sorted .sort-ic { opacity: 1; }

/* ===================================================================
   BỘ LỌC NÂNG CAO
   =================================================================== */
/* .explain-panel dùng chung bộ style này cho các khối văn bản THAM KHẢO dài (vd "Cách
   tính" ở trang Thống kê): mặc định gập lại để không đẩy nội dung chính xuống dưới màn
   hình — trên mobile một khối giải thích vài nghìn ký tự luôn mở là cả trang phải cuộn. */
.filter-panel, .explain-panel { padding: 0; overflow: visible; }
.filter-panel > summary, .explain-panel > summary {
  list-style: none; cursor: pointer;
  padding: 13px 16px;
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 13.5px; color: var(--ink);
}
.filter-panel > summary::-webkit-details-marker,
.explain-panel > summary::-webkit-details-marker { display: none; }
.filter-panel > summary svg, .explain-panel > summary svg { color: var(--ink-soft); }
.filter-panel > summary .fp-count {
  font-size: 11px; font-weight: 700;
  background: var(--brand); color: var(--on-brand);
  padding: 2px 8px; border-radius: 999px;
}
.filter-panel > summary .fp-chevron,
.explain-panel > summary .fp-chevron { margin-left: auto; color: var(--ink-faint); transition: transform .15s ease; display: flex; }
.filter-panel[open] > summary .fp-chevron,
.explain-panel[open] > summary .fp-chevron { transform: rotate(90deg); }
.filter-panel .fp-body, .explain-panel .fp-body { padding: 4px 16px 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }

/* Hàng tab đứng riêng (không nằm trong .toolbar): dùng khi tab thuộc về một bảng ở giữa
   trang chứ không phải bộ lọc đầu trang — bọc thêm một khung .toolbar nữa chỉ để chứa
   3 cái tab là thừa một lớp viền + nền, trên mobile càng chiếm chỗ vô ích. */
.tabs.tabs-standalone { margin: -2px 0 12px; padding-bottom: 2px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; }
.filter-grid .field { margin-bottom: 0; }

/* Các bộ lọc đang áp dụng — hiện thành chip có nút X để gỡ nhanh từng cái */
.active-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.active-filters .af-label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-dark);
  border: 1px solid transparent;
  padding: 4px 6px 4px 10px; border-radius: 999px;
}
.filter-chip .fc-x {
  display: flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(0,0,0,0.07); color: inherit;
}
.filter-chip .fc-x:hover { background: var(--danger); color: #fff; }
.active-filters .af-clear { font-size: 12px; font-weight: 700; color: var(--danger); }

/* ===================================================================
   DÒNG BẢNG MỞ RỘNG ĐƯỢC (gộp bảng + form sửa làm một)
   Trước đây trang danh sách SĐT in bảng rồi lặp lại y hệt dữ liệu đó dưới dạng
   accordion để sửa — dài gấp đôi. Nay bấm thẳng vào dòng để mở form ngay dưới nó.
   =================================================================== */
.data-table tbody tr.expandable { cursor: pointer; }
.data-table td.col-expand { width: 34px; padding-right: 0; }
.data-table .expand-btn {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .15s ease, background .15s ease, color .15s ease;
}
.data-table .expand-btn:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.data-table tr.is-open .expand-btn { transform: rotate(90deg); background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.data-table tr.is-open > td { background: var(--surface-alt); }
.data-table tr.row-detail { display: none; }
.data-table tr.row-detail.show { display: table-row; }
.data-table tr.row-detail > td {
  background: var(--surface-alt);
  padding: 16px 18px 20px;
  border-bottom: 2px solid var(--line);
}
.row-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.row-detail-head .rd-title { font-weight: 700; font-size: 14px; color: var(--ink); }

/* ===================================================================
   TRUY CẬP NHANH (thẻ có icon thay cho dãy nút xám)
   =================================================================== */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.quick-item {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.quick-item:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.quick-item .qi-ic {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
}
.quick-item .qi-text { min-width: 0; }
.quick-item .qi-title { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.quick-item .qi-sub { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }

/* ===================================================================
   KHỐI CẢNH BÁO NỔI BẬT (dashboard)
   Việc cần xử lý gấp phải đập vào mắt ngay, không nằm lẫn giữa các thẻ trắng.
   =================================================================== */
.attention-panel {
  border: 1px solid var(--danger);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
}
.attention-panel.tone-ok { border-color: var(--success); }
.attention-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--danger-soft);
}
.attention-panel.tone-ok .attention-head { background: var(--success-soft); }
.attention-head .ah-ic { display: flex; color: var(--danger); flex-shrink: 0; }
.attention-panel.tone-ok .attention-head .ah-ic { color: var(--success); }
.attention-head .ah-title { font-weight: 800; font-size: 14px; color: var(--ink); }
.attention-head .ah-sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.attention-head .ah-action { margin-left: auto; }
.attention-body { padding: 0; }
.attention-body .table-wrap { border: none; border-radius: 0; box-shadow: none; margin: 0; }

/* Chấm trạng thái đứng trước nội dung dòng — quét bằng mắt nhanh hơn đọc chữ */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--ink-faint); }
.status-dot.s-danger { background: var(--danger); }
.status-dot.s-warn { background: var(--accent); }
.status-dot.s-ok { background: var(--success); }
.status-dot.s-none { background: var(--ink-faint); }
.cell-with-dot { display: flex; align-items: center; gap: 8px; }

/* Thanh tỉ lệ mảnh nằm trong ô bảng (vd: tỉ trọng khách hàng của từng CTV) */
.inline-bar { height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; min-width: 60px; }
.inline-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

/* ===================================================================
   BADGE / TAB CÓ ICON
   =================================================================== */
.badge { display: inline-flex; align-items: center; gap: 5px; }
.badge svg { flex-shrink: 0; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; }
.tabs a .tab-count {
  font-size: 11px; font-weight: 800;
  background: var(--line-soft); color: var(--ink-soft);
  padding: 1px 7px; border-radius: 999px;
}
.tabs a.active .tab-count { background: rgba(255,255,255,0.22); color: var(--on-brand); }
:root[data-theme="dark"] .tabs a.active .tab-count { background: rgba(0,0,0,0.25); }

/* Icon trong khối trống & cảnh báo — thay cho emoji */
.empty-state .icon {
  width: 46px; height: 46px; margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--surface-alt); color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 0;
}
.alert svg { flex-shrink: 0; }

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 980px) {
  :root { --sidebar-w: 240px; }
  .sidebar, .sidebar-overlay, .menu-toggle { display: none !important; }
  .main-col { margin-left: 0; }
  .container { padding: 16px 14px 32px; }
  body { padding-bottom: calc(var(--nav-h) + 14px); }
  .bottom-nav { display: block; }
  .stat-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
  .stat-card .stat-ic { margin-bottom: 0; flex-shrink: 0; }
  .stat-card .stat-value { font-size: 20px; line-height: 1.2; }
  .stat-card .stat-label { margin-top: 1px; }

  /* ===============================================================
     BẢNG -> THẺ (CARD) — mỗi dòng là 1 thẻ riêng biệt, gọn và dễ quét
     thay vì danh sách "nhãn: giá trị" dồn dài như trước.
     =============================================================== */
  .table-wrap { background: transparent; border: none; box-shadow: none; overflow: visible; margin-bottom: 4px; }
  .data-table thead { display: none; }
  table.data-table, .data-table tbody { display: block; width: 100%; }
  .data-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 14px;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 14px 12px;
    margin-bottom: 10px;
  }
  .data-table tbody tr:hover { background: var(--surface); }
  .data-table td { display: block; width: 100%; border: none; padding: 5px 0; font-size: 13px; }

  /* Ô chính (tên khách hàng / SĐT) — nổi bật, chiếm trọn hàng đầu, không lặp lại nhãn */
  .data-table td.col-primary { grid-column: 1 / -1; padding: 0 0 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
  .data-table td.col-primary[data-label]::before { content: none; }
  .data-table td.col-primary .cell-title,
  .data-table td.col-primary.cell-title { font-size: 15px; }

  /* Checkbox chọn dòng — góc trên phải, không đè lên nội dung */
  .data-table td.col-check { grid-column: 1 / -1; position: absolute; top: 12px; right: 12px; width: auto; padding: 0; z-index: 1; }
  .data-table.has-select tbody tr { padding-top: 14px; }
  .data-table.has-select td.col-primary { padding-right: 30px; }

  /* Các trường phụ (IP VPS, domain, hạn dùng...) xếp lưới 2 cột nhỏ gọn */
  .data-table td[data-label]:not(.col-primary):not(.col-check):not(.col-actions)::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--ink-faint);
    margin-bottom: 2px;
  }

  /* Thao tác — full chiều rộng, tách hẳn khỏi phần dữ liệu bằng đường kẻ */
  .data-table td.col-actions {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
  }
  .data-table td.col-actions::before { content: none; }
  .data-table td.col-actions .row-actions { display: flex; width: 100%; gap: 8px; }
  .data-table td.col-actions .row-actions .btn,
  .data-table td.col-actions .row-actions form { flex: 1; }
  .data-table td.col-actions .row-actions .btn { width: 100%; text-align: center; }

  .card-grid { grid-template-columns: 1fr; }
  .ctv-grid { grid-template-columns: 1fr; }

  /* --- Các thành phần mới trên màn hình nhỏ --- */
  .stat-grid, .stat-grid.cols-3, .stat-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 12px 13px 14px; display: block; }
  .stat-card .stat-top { margin-bottom: 9px; }
  .stat-card .stat-ic { width: 28px; height: 28px; border-radius: 8px; }
  .stat-card .stat-trend { font-size: 10.5px; padding: 2px 6px; }
  .stat-card .stat-spark { height: 26px; }
  .stat-card .stat-label { font-size: 11.5px; }

  .chart-canvas { height: var(--chart-h-mobile, 220px); }
  .donut-layout { grid-template-columns: 1fr; gap: 6px; }
  .donut-layout .chart-canvas { height: 190px; }

  .pagination { justify-content: center; gap: 10px; }
  .pagination .page-summary, .pagination .page-size { width: 100%; justify-content: center; text-align: center; }
  .pagination .page-size { justify-content: center; }

  /* Dòng mở rộng: ở mobile mỗi dòng đã là 1 thẻ, nút mở nằm góc dưới phải của thẻ.
     Phải chừa chỗ ở đáy thẻ, nếu không nút sẽ đè lên ô dữ liệu cuối cùng. */
  .data-table.has-expand tbody tr { padding-bottom: 46px; }
  .data-table td.col-expand { grid-column: 1 / -1; position: absolute; bottom: 12px; right: 12px; width: auto; padding: 0; }
  .data-table tr.is-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }

  /* Dòng chi tiết trên mobile: tự nó KHÔNG phải một thẻ riêng — nó là phần thân nối
     tiếp bên dưới thẻ vừa mở, nên phải gỡ hết viền/nền/lề mà quy tắc "mỗi dòng là 1
     thẻ" ở trên đã gán cho mọi tbody tr. */
  .data-table tr.row-detail { display: none !important; }
  .data-table tr.row-detail.show {
    display: block !important;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0 0 10px;
  }
  .data-table tr.row-detail > td {
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--line);
    border-top: none;
    padding: 14px;
  }

  .quick-grid { grid-template-columns: 1fr; }
  .attention-head .ah-action { margin-left: 0; width: 100%; }
  .attention-head .ah-action .btn { width: 100%; }
  .attention-body .table-wrap { padding: 12px 12px 2px; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-title { font-size: 14.5px; }
  .topbar .role-pill { display: none; }

  /* Hạ sàn bề rộng mỗi mục nav để thấy được nhiều mục hơn trên máy hẹp. Mục thứ 6-7 lộ
     ra một phần chính là tín hiệu "còn nữa, cuộn ngang đi" — thanh này ẩn scrollbar nên
     nếu mọi mục vừa khít màn hình thì không còn dấu hiệu nào cho biết là cuộn được. */
  .bottom-nav a { min-width: 62px; padding: 0 7px; }
  .bottom-nav a > span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .data-table tbody tr { grid-template-columns: 1fr; }
  .stat-grid, .stat-grid.cols-3, .stat-grid.cols-4 { grid-template-columns: 1fr; }
  .stat-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0 12px; padding: 13px 14px; }
  .stat-card .stat-top { display: contents; }
  .stat-card .stat-ic { grid-row: 1 / 3; grid-column: 1; }
  .stat-card .stat-value { grid-row: 1; grid-column: 2; font-size: 20px; }
  .stat-card .stat-label { grid-row: 2; grid-column: 2; margin-top: 0; }
  .stat-card .stat-trend { grid-row: 1 / 3; grid-column: 3; }
  .stat-card .stat-hint, .stat-card .stat-spark { grid-column: 1 / -1; }
  .stat-card .stat-spark { margin-top: 8px; }
}

/* ===================================================================
   DASHBOARD SAAS — hệ thống phân cấp riêng, không ảnh hưởng các trang CRUD
   =================================================================== */
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background:
    radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--brand) 12%, transparent) 0, transparent 34%),
    linear-gradient(135deg, var(--surface), var(--surface-alt));
  box-shadow: var(--shadow-sm);
}
.dashboard-eyebrow {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.dashboard-hero .page-title { max-width: 760px; font-size: clamp(20px, 2vw, 27px); line-height: 1.25; }
.health-pill {
  min-width: 230px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--success);
  border-radius: 12px;
  background: var(--success-soft);
  color: var(--ink);
}
.health-pill.needs-action { border-color: var(--accent); background: var(--accent-soft); }
.health-pill__icon { display: flex; color: var(--success); }
.health-pill.needs-action .health-pill__icon { color: var(--accent-ink); }
.health-pill strong, .health-pill small { display: block; }
.health-pill strong { font-size: 13px; }
.health-pill small { margin-top: 2px; color: var(--ink-soft); font-size: 11.5px; }

.dashboard-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 11px;
}
.dashboard-section-head--compact { margin-top: 26px; }
.dashboard-section-title { color: var(--ink); font-size: 15px; font-weight: 800; }
.dashboard-section-sub { margin-top: 2px; color: var(--ink-faint); font-size: 12px; }
.dashboard-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dashboard-kpis .stat-card { min-height: 142px; }
.dashboard-kpis .stat-value { font-variant-numeric: tabular-nums; }

.dashboard-insights {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 16px;
  align-items: stretch;
}
.dashboard-insights > .card { margin-bottom: 0; min-width: 0; }
.dashboard-insights > .insight-wide { grid-column: 1 / -1; }
.dashboard-insights > :only-child { grid-column: 1 / -1; }
.insight-card { padding: 20px 22px; }
.insight-card .card-head { min-height: 44px; }
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.dashboard-chart-totals { margin: 0 0 0 auto; }
.dashboard-chart-totals .ct-item { min-width: 126px; padding-left: 14px; border-left: 1px solid var(--line); }
.status-card .donut-layout { min-height: 270px; }
.growth-card .chart-canvas { --chart-h: 270px !important; }
.ctv-distribution-card .bar-list { padding-top: 4px; }
.quick-access-card { padding: 14px; }
.quick-access-card .card-head { display: none; }
.quick-access-card .quick-item { min-height: 66px; }

@media (max-width: 1180px) {
  .dashboard-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .dashboard-hero { align-items: flex-start; padding: 18px; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-insights { grid-template-columns: 1fr; }
  .dashboard-insights > .insight-wide { grid-column: auto; }
  .dashboard-chart-totals { width: 100%; margin-left: 0; }
  .attention-body .data-table tbody tr:nth-child(n + 3) { display: none; }
}
@media (max-width: 700px) {
  .dashboard-hero { flex-direction: column; gap: 14px; }
  .health-pill { width: 100%; min-width: 0; }
  .dashboard-section-sub { line-height: 1.45; }
  .insight-card { padding: 16px; }
  .insight-card .card-head { align-items: flex-start; }
  .card-link { width: 100%; margin-top: 8px; }
  .dashboard-chart-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .dashboard-chart-totals .ct-item { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; }
}
@media (max-width: 560px) {
  .dashboard-kpis { grid-template-columns: 1fr; }
  .dashboard-kpis .stat-card { min-height: auto; }
  .dashboard-hero .page-title { font-size: 20px; }
  .dashboard-chart-totals { grid-template-columns: 1fr; }
}

/* ===================================================================
   AUTOZALO DESIGN SYSTEM 2026 — lớp hoàn thiện dùng chung toàn hệ thống
   =================================================================== */
body { font-size: 14px; letter-spacing: -.005em; }
.container { max-width: 1440px; padding: 28px 32px 48px; }
.topbar {
  height: 56px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}
.topbar-title { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.topbar-title::before { content: 'AutoZalo  /  '; color: var(--ink-faint); font-weight: 600; }
.role-pill { border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line)); }
.icon-btn, .theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); }
.icon-btn:hover, .theme-toggle:hover { border-color: var(--brand); color: var(--brand-dark); }

.sidebar-brand { padding: 18px 16px; }
.brand-mark { box-shadow: 0 7px 18px -10px rgba(232,163,61,.75); }
.sidebar-nav { padding: 14px 10px; gap: 4px; }
.sidebar-nav .nav-item, .sidebar-footer .nav-item { min-height: 42px; padding: 10px 12px; }
.nav-item.active { position: relative; background: color-mix(in srgb, var(--sidebar-active) 76%, transparent); box-shadow: none; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: #5EEAD4; }

.page-header:not(.dashboard-hero) { margin: 2px 0 20px; }
.page-title { font-size: clamp(22px, 2vw, 28px); letter-spacing: -.55px; line-height: 1.25; }
.page-sub { max-width: 760px; color: var(--ink-soft); }
.section-title { margin-top: 24px; }

.card, .toolbar, .filter-panel, .explain-panel, .table-wrap {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.card { padding: 22px; }
.toolbar { padding: 14px 16px; }
.toolbar .searchbox input[type="text"],
.toolbar .searchbox input[type="search"] { width: min(100%, 480px); }
.card-head { gap: 16px; }
.card-head .ch-title { color: var(--ink); font-size: 15px; }
.card-head .ch-sub { color: var(--ink-soft); }

.btn { min-height: 40px; padding: 9px 16px; border-radius: 8px; }
.btn.btn-sm { min-height: 34px; }
.btn.btn-outline { border-width: 1px; background: var(--surface); }
.field input, .field textarea, .field select,
.chart-controls select, .chart-controls input[type="month"] {
  min-height: 40px;
  border-width: 1px;
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); opacity: 1; }

.table-wrap { border-radius: 12px; }
.data-table thead th {
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: .045em;
}
.data-table tbody tr { transition: background .14s ease; }
.data-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-alt) 48%, transparent); }
.data-table tbody tr:hover { background: var(--brand-soft); }
.data-table td { border-bottom-color: var(--line-soft); }
.cell-title { color: var(--ink); }
.cell-sub { color: var(--ink-soft); }
.badge { border: 1px solid color-mix(in srgb, currentColor 16%, transparent); }

.dashboard-page { display: flex; flex-direction: column; }
.dashboard-kpi-head { order: 1; }
.dashboard-kpis { order: 2; }
.dashboard-page > .attention-panel { order: 3; margin-top: 8px; }
.dashboard-analysis-head { order: 4; }
.dashboard-insights { order: 5; }
.dashboard-hero {
  margin-bottom: 0;
  border-color: color-mix(in srgb, var(--brand) 20%, var(--line));
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
}
.dashboard-kpis .stat-card { min-height: 132px; }
.stat-card { border-top: 0; }
.stat-card::before { height: 2px; }
.stat-card .stat-value { letter-spacing: -.65px; }
.attention-panel { border-left-width: 3px; }
.attention-head { background: color-mix(in srgb, var(--danger-soft) 82%, var(--surface)); }
.insight-card { box-shadow: var(--shadow-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 1180px) {
  .container { padding: 22px 20px 40px; }
}

@media (max-width: 980px) {
  .sidebar {
    display: flex !important;
    width: min(82vw, 300px);
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block !important; pointer-events: none; }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-flex !important; }
  .topbar { padding: 0 16px; }
  .topbar-title::before { content: ''; }
  .bottom-nav { overflow: hidden; }
  .bottom-nav-inner { width: 100%; min-width: 0; }
  .bottom-nav a, .bottom-nav button {
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 5px;
    font-size: 10.5px;
    font-weight: 700;
  }
  .bottom-nav button .nav-ic { width: 21px; height: 21px; display: flex; align-items: center; justify-content: center; }
  .container { padding: 18px 14px 32px; }
}

@media (max-width: 560px) {
  .topbar .icon-btn { display: none; }
  .page-title { font-size: 22px; }
  .page-sub { font-size: 13px; }
  .card { padding: 16px; }
  .dashboard-hero { padding: 18px; }
  .dashboard-page > .attention-panel { margin-top: 2px; }
}
