/* ================================================================
   TAB "TỔNG QUAN NGÀY" (admin-only) — Daily Overview
   ------------------------------------------------------------
   Giao diện tổng quan 1 ngày cho quản lý:
     - Header + bộ chọn ngày
     - Dải KPI tổng (so sánh hôm trước)
     - 6 nhóm dữ liệu: Bán hàng & Tiền, Bàn giao ca,
       Công việc & KPI, CTV, Marketing, Zalo
     - Mỗi nhóm có nút "Xem chi tiết" để bấm sâu (drill-down)

   Bố cục:
     DESKTOP  → mỗi section là 1 hàng: cột trái = số liệu chính
                (hero, to/đập), cột phải = lưới số liệu phụ + bảng.
     MOBILE   → hero gộp lên đầu, số liệu phụ 2 cột, bảng biến
                thành danh sách card, nút drill-down xếp 2 cột.

   Tất cả màu đều dùng token --ghz-* ⇒ tự đổi theo theme
   (classic / midnight / mint-fresh / …) không cần viết thêm.
   Tiền tố: mọi class bắt đầu bằng "do-" (daily overview) để
   không đụng với class khác của app.
   ================================================================ */

/* ---------- Khung chung ---------- */
.do-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Header ---------- */
.do-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.do-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.do-date-label {
  display: block;
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}
.do-date-label i { margin-right: 4px; }

.do-date-input {
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--ghz-card-border, #2a2e35);
  color: var(--ghz-text-primary, #fff);
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  padding: 7px 11px;
  outline: none;
  color-scheme: dark;
}
.do-date-input:focus {
  border-color: var(--ghz-brand-color, #00c37a);
}

.do-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--ghz-card-border, #2a2e35);
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-secondary, #9ca3af);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.do-btn:hover {
  border-color: var(--ghz-brand-color, #00c37a);
  color: var(--ghz-brand-color, #00c37a);
}
.do-btn i { font-size: 11px; }
.do-btn.is-primary {
  background: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 16%, transparent);
  border-color: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 40%, transparent);
  color: var(--ghz-brand-color, #00c37a);
}
.do-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ================================================================
   DẢI KPI TỔNG
   ================================================================ */
.do-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1280px) { .do-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .do-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; } }

/* ---------- Thẻ số ---------- */
.do-stat {
  position: relative;
  overflow: hidden;
  background: var(--ghz-card-bg, #181b20);
  border: 1px solid var(--ghz-card-border, #2a2e35);
  border-radius: 14px;
  padding: 13px 13px 11px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.do-stat:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 45%, transparent);
}

/* Thẻ KPI đầu tiên (số liệu quan trọng nhất) — nổi bật hơn */
.do-stat.is-hero {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--ghz-brand-color, #00c37a) 16%, transparent) 0%,
      color-mix(in srgb, var(--ghz-brand-color, #00c37a) 4%, transparent) 100%),
    var(--ghz-card-bg, #181b20);
  border-color: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 40%, transparent);
}
.do-stat.is-hero .do-stat-value { font-size: 24px; }

.do-stat-label {
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-right: 36px;
  line-height: 1.35;
}
.do-stat-label i { margin-right: 4px; }

.do-stat-icon {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--ghz-input-bg, rgba(255, 255, 255, 0.06));
  color: var(--ghz-text-muted, #9ca3af);
}
.do-stat.is-hero .do-stat-icon {
  background: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 22%, transparent);
  color: var(--ghz-brand-color, #00c37a);
}

.do-stat-value {
  color: var(--ghz-text-primary, #fff);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 7px;
  line-height: 1.2;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.do-stat-value.is-brand   { color: var(--ghz-brand-color, #00c37a); }
.do-stat-value.is-success { color: var(--ghz-success, #22c55e); }
.do-stat-value.is-danger  { color: var(--ghz-danger, #ef4444); }
.do-stat-value.is-warning { color: var(--ghz-warning, #f59e0b); }
.do-stat-value.is-info    { color: var(--ghz-info, #3b82f6); }

.do-stat-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 11px;
  min-height: 16px;
}

/* ---------- Badge so sánh hôm trước ---------- */
.do-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-muted, #9ca3af);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.do-delta i { font-size: 9px; }
.do-delta.up   { background: var(--ghz-success-bg, rgba(34, 197, 94, 0.14)); color: var(--ghz-success, #22c55e); }
.do-delta.down { background: var(--ghz-danger-bg, rgba(239, 68, 68, 0.14));  color: var(--ghz-danger, #ef4444); }
/* Metric mà TĂNG là xấu (công nợ, lỗi Zalo, chi phí…) */
.do-delta.up.is-inverted   { background: var(--ghz-danger-bg, rgba(239, 68, 68, 0.14));  color: var(--ghz-danger, #ef4444); }
.do-delta.down.is-inverted { background: var(--ghz-success-bg, rgba(34, 197, 94, 0.14)); color: var(--ghz-success, #22c55e); }

/* ================================================================
   KHỐI DỮ LIỆU (SECTION)
   ================================================================ */
.do-section {
  background: var(--ghz-card-bg, #181b20);
  border: 1px solid var(--ghz-card-border, #2a2e35);
  border-radius: 18px;
  overflow: hidden;
}

.do-sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--ghz-card-border, #2a2e35) 70%, transparent);
  flex-wrap: wrap;
}
.do-sec-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 14%, transparent);
  color: var(--ghz-brand-color, #00c37a);
}
.do-sec-icon.is-info    { background: var(--ghz-info-bg, rgba(59, 130, 246, 0.14));    color: var(--ghz-info, #3b82f6); }
.do-sec-icon.is-warning { background: var(--ghz-warning-bg, rgba(245, 158, 11, 0.14)); color: var(--ghz-warning, #f59e0b); }
.do-sec-icon.is-danger  { background: var(--ghz-danger-bg, rgba(239, 68, 68, 0.14));  color: var(--ghz-danger, #ef4444); }
.do-sec-icon.is-success { background: var(--ghz-success-bg, rgba(34, 197, 94, 0.14)); color: var(--ghz-success, #22c55e); }

.do-sec-titles { min-width: 0; }
.do-sec-title {
  color: var(--ghz-text-primary, #fff);
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.do-sec-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 11px;
  font-weight: 700;
}
.do-sec-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.do-sec-body { padding: 14px 16px 16px; }

/* Bố cục 2 cột: hero (trái) | số liệu phụ (phải) */
.do-sec-layout {
  display: grid;
  grid-template-columns: minmax(230px, 270px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
/* Section không có hero (vd "Bàn giao ca") → metrics chiếm hết bề rộng. */
.do-sec-layout.is-full { grid-template-columns: minmax(0, 1fr); }

/* ---------- Hero: số liệu chính của section ---------- */
.do-hero {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--ghz-brand-color, #00c37a) 26%, transparent);
}
.do-hero.is-info    { background: color-mix(in srgb, var(--ghz-info, #3b82f6) 10%, transparent);    border-color: color-mix(in srgb, var(--ghz-info, #3b82f6) 30%, transparent); }
.do-hero.is-warning { background: color-mix(in srgb, var(--ghz-warning, #f59e0b) 10%, transparent); border-color: color-mix(in srgb, var(--ghz-warning, #f59e0b) 30%, transparent); }
.do-hero.is-danger  { background: color-mix(in srgb, var(--ghz-danger, #ef4444) 10%, transparent);  border-color: color-mix(in srgb, var(--ghz-danger, #ef4444) 30%, transparent); }
.do-hero.is-success { background: color-mix(in srgb, var(--ghz-success, #22c55e) 10%, transparent); border-color: color-mix(in srgb, var(--ghz-success, #22c55e) 30%, transparent); }

.do-hero-label {
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.do-hero-label i { font-size: 11px; }

.do-hero-value {
  color: var(--ghz-text-primary, #fff);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 7px;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}
.do-hero-value.is-brand   { color: var(--ghz-brand-color, #00c37a); }
.do-hero-value.is-success { color: var(--ghz-success, #22c55e); }
.do-hero-value.is-danger  { color: var(--ghz-danger, #ef4444); }
.do-hero-value.is-warning { color: var(--ghz-warning, #f59e0b); }
.do-hero-value.is-info    { color: var(--ghz-info, #3b82f6); }

.do-hero-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 10px;
}
.do-hero-note {
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 11.5px;
  line-height: 1.45;
}

/* ---------- Tiêu đề nhỏ trong section ---------- */
.do-sub-title {
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 14px 0 8px;
}
.do-sub-title:first-child { margin-top: 0; }

/* ---------- Lưới số liệu phụ ---------- */
/* auto-fill (không auto-fit) để mọi section có cùng độ rộng thẻ,
   kể cả section chỉ có 3 số liệu — tránh thẻ bị "phình" to lệch với nhau. */
.do-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.do-grid.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Chip kênh thanh toán / trạng thái ---------- */
.do-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.do-chips.is-spaced { margin-top: 12px; }
.do-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--ghz-card-border, #2a2e35);
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-secondary, #9ca3af);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.do-chip i { font-size: 10px; opacity: 0.85; }
.do-chip b {
  color: var(--ghz-text-primary, #fff);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.do-chip.is-ok   { border-color: color-mix(in srgb, var(--ghz-success, #22c55e) 40%, transparent); color: var(--ghz-success, #22c55e); }
.do-chip.is-warn { border-color: color-mix(in srgb, var(--ghz-warning, #f59e0b) 40%, transparent); color: var(--ghz-warning, #f59e0b); }
.do-chip.is-bad  { border-color: color-mix(in srgb, var(--ghz-danger, #ef4444) 40%, transparent);  color: var(--ghz-danger, #ef4444); }
.do-chip.is-ok b, .do-chip.is-warn b, .do-chip.is-bad b { color: inherit; }

/* ---------- Bảng chi tiết ---------- */
.do-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ghz-card-border, #2a2e35);
  border-radius: 12px;
}
.do-sec-metrics > .do-table-wrap { margin-top: 12px; }

.do-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  color: var(--ghz-text-secondary, #9ca3af);
  min-width: 520px;
}
.do-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 9px 11px;
  white-space: nowrap;
  border-bottom: 1px solid var(--ghz-card-border, #2a2e35);
}
.do-table tbody td {
  padding: 9px 11px;
  border-bottom: 1px solid color-mix(in srgb, var(--ghz-card-border, #2a2e35) 55%, transparent);
  vertical-align: top;
}
.do-table tbody tr:last-child td { border-bottom: 0; }
.do-table tbody tr:hover { background: color-mix(in srgb, var(--ghz-card-border, #2a2e35) 18%, transparent); }
.do-table td.is-strong { color: var(--ghz-text-primary, #fff); font-weight: 700; }
.do-table td.is-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.do-table .do-sub { display: block; color: var(--ghz-text-muted, #9ca3af); font-size: 11px; margin-top: 2px; }

/* ---------- Huy hiệu thứ hạng ---------- */
.do-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 11px;
  font-weight: 800;
}
.do-rank.is-1 { background: var(--ghz-warning-bg, rgba(245, 158, 11, 0.16)); color: var(--ghz-warning, #f59e0b); }
.do-rank.is-2 { background: var(--ghz-info-bg, rgba(59, 130, 246, 0.16));    color: var(--ghz-info, #3b82f6); }
.do-rank.is-3 { background: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 15%, transparent); color: var(--ghz-brand-color, #00c37a); }

/* Huy hiệu thứ hạng — chỉ hiện ở bảng xếp hạng */
.do-rank.is-mobile-only { display: none; }

/* ---------- Badge trạng thái ---------- */
.do-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-muted, #9ca3af);
}
.do-badge.ok    { background: var(--ghz-success-bg, rgba(34, 197, 94, 0.14)); color: var(--ghz-success, #22c55e); }
.do-badge.warn  { background: var(--ghz-warning-bg, rgba(245, 158, 11, 0.14)); color: var(--ghz-warning, #f59e0b); }
.do-badge.bad   { background: var(--ghz-danger-bg, rgba(239, 68, 68, 0.14));  color: var(--ghz-danger, #ef4444); }
.do-badge.info  { background: var(--ghz-info-bg, rgba(59, 130, 246, 0.14));    color: var(--ghz-info, #3b82f6); }
.do-badge.brand { background: color-mix(in srgb, var(--ghz-brand-color, #00c37a) 15%, transparent); color: var(--ghz-brand-color, #00c37a); }

/* ---------- Empty / loading ---------- */
.do-empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 12.5px;
}
.do-empty i { display: block; font-size: 22px; margin-bottom: 8px; opacity: 0.6; }
.do-empty > span {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  opacity: 0.75;
  font-style: italic;
}
.do-skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
  gap: 10px;
}
.do-skeleton > div {
  height: 74px;
  border-radius: 14px;
  background: linear-gradient(100deg,
    var(--ghz-input-bg, rgba(255, 255, 255, 0.05)) 30%,
    color-mix(in srgb, var(--ghz-text-muted, #9ca3af) 14%, transparent) 50%,
    var(--ghz-input-bg, rgba(255, 255, 255, 0.05)) 70%);
  background-size: 220% 100%;
  animation: doShimmer 1.3s linear infinite;
}
@keyframes doShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -20% 0; }
}

/* ================================================================
   MODAL DRILL-DOWN
   ================================================================ */
.do-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Chừa lề đều 4 phía → vẫn thấy app phía sau */
  padding: clamp(20px, 4vh, 48px) clamp(16px, 4vw, 40px);
  background: rgba(4, 7, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: do-modal-fade 0.16s ease-out;
}
.do-modal[hidden] { display: none; }

@keyframes do-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes do-modal-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes do-sheet-rise {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

.do-modal-card {
  width: 100%;
  /* Bảng drill-down có nhiều cột → rộng hơn trên desktop, nhưng KHÔNG kín view */
  max-width: min(880px, 100%);
  /* Chừa khoảng trống trên/dưới → vẫn thấy app phía sau */
  max-height: min(76dvh, 680px);
  display: flex;
  flex-direction: column;
  background: var(--ghz-card-bg, #181b20);
  border: 1px solid var(--ghz-card-border, #2a2e35);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  animation: do-modal-rise 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Header: dày hơn, tách mạch, tiêu đề cắt gọn 1 dòng */
.do-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--ghz-card-border, #2a2e35) 70%, transparent);
  background: color-mix(in srgb, var(--ghz-card-bg, #181b20) 92%, var(--ghz-brand-color, #00c37a) 8%);
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
}
.do-modal-title {
  margin: 0;
  color: var(--ghz-text-primary, #fff);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 0;
  flex: 1 1 auto;
  /* Tiêu đề dài không được đẩy nút đóng ra ngoài */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.do-modal-title span {
  display: block;
  color: var(--ghz-text-muted, #9ca3af);
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 3px;
  /* Subtitle cũng cắt gọn nếu dài */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.do-modal-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--ghz-card-border, #2a2e35);
  background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
  color: var(--ghz-text-muted, #9ca3af);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.do-modal-close:hover,
.do-modal-close:focus-visible {
  color: var(--ghz-danger, #ef4444);
  border-color: var(--ghz-danger, #ef4444);
  background: color-mix(in srgb, var(--ghz-danger, #ef4444) 12%, transparent);
}
.do-modal-close:active { transform: scale(0.94); }

.do-modal-body {
  overflow: auto;
  padding: 0;
  flex: 1 1 auto;
  /* Cuộn mượt trên mobile */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Bảng trong modal: viền bo góc riêng, không viền kép với card */
.do-modal-body .do-table-wrap {
  margin-top: 0;
  border: 0;
  border-radius: 0;
}
/* Nội dung không phải bảng (loading / empty / lỗi) cần padding riêng */
.do-modal-body > .do-empty { padding: 40px 20px; }
/* Ô đầu tiên (tên máy / ca) cố định khi cuộn ngang trên desktop */
.do-modal-body .do-table tbody td.is-primary-cell,
.do-modal-body .do-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--ghz-card-bg, #181b20);
}
.do-modal-body .do-table tbody tr:hover td.is-primary-cell,
.do-modal-body .do-table tbody tr:hover td:first-child {
  background: color-mix(in srgb, var(--ghz-card-border, #2a2e35) 18%, var(--ghz-card-bg, #181b20));
}
.do-modal-body .do-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--ghz-input-bg, rgba(0, 0, 0, 0.04)), var(--ghz-card-bg, #181b20) 88%);
}
/* Thanh cuộn mảnh */
.do-modal-body::-webkit-scrollbar { width: 9px; height: 9px; }
.do-modal-body::-webkit-scrollbar-track { background: transparent; }
.do-modal-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ghz-text-muted, #9ca3af) 30%, transparent);
  border-radius: 9px;
}
.do-modal-body::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ghz-text-muted, #9ca3af) 50%, transparent);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Tablet: section 1 cột, hero nằm ngang */
@media (max-width: 980px) {
  .do-sec-layout { grid-template-columns: 1fr; gap: 12px; }
  .do-hero {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
  }
  .do-hero-label { flex: 0 0 100%; }
  .do-hero-value { margin-top: 0; font-size: 24px; }
  .do-hero-foot {
    margin-top: 0;
    padding-top: 0;
    flex: 1 1 100%;
  }
}

/* Mobile */
@media (max-width: 720px) {
  .do-wrap { gap: 12px; }

  .do-header { align-items: stretch; }
  .do-header-meta { width: 100%; }
  .do-date-label { flex: 0 0 100%; }
  .do-date-input { flex: 1 1 140px; min-width: 0; }
  .do-header-meta .do-btn { flex: 1 1 calc(33% - 6px); }

  .do-sec-head { padding: 11px 13px; gap: 9px; }
  .do-sec-icon { width: 28px; height: 28px; flex: 0 0 28px; font-size: 12.5px; }
  .do-sec-title { font-size: 13.5px; }
  .do-sec-count { margin-left: 0; margin-top: 2px; }
  .do-sec-titles { flex: 1 1 140px; }

  /* Nút drill-down: 2 cột, full width */
  .do-sec-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .do-sec-actions .do-btn { width: 100%; }

  .do-sec-body { padding: 11px 13px 13px; }

  .do-hero { padding: 12px; }
  .do-hero-value { font-size: 22px; }

  /* Số liệu phụ: 2 cột cố định */
  .do-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .do-grid.is-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .do-stat { padding: 11px 11px 9px; border-radius: 12px; }
  .do-stat.is-hero .do-stat-value { font-size: 21px; }
  .do-stat-value { font-size: 17px; }
  .do-stat-icon { width: 25px; height: 25px; top: 9px; right: 9px; font-size: 11px; }
  .do-stat-label { font-size: 9.5px; padding-right: 30px; }

  .do-chip { font-size: 11px; padding: 3px 9px; }

  /* Bảng → danh sách card */
  .do-table-wrap { border: 0; border-radius: 0; overflow: visible; }
  .do-table { min-width: 0; display: block; }
  .do-table thead { display: none; }
  .do-table tbody { display: block; }
  .do-table tbody tr {
    display: block;
    border: 1px solid var(--ghz-card-border, #2a2e35);
    border-radius: 12px;
    background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04));
    padding: 9px 11px;
    margin-bottom: 8px;
  }
  .do-table tbody tr:last-child { margin-bottom: 0; }
  .do-table tbody tr:hover { background: var(--ghz-input-bg, rgba(0, 0, 0, 0.04)); }
  .do-table tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 3px 0;
    border: 0;
    text-align: right;
  }
  .do-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--ghz-text-muted, #9ca3af);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
  }
  .do-table tbody td:first-child,
  .do-table tbody td.is-primary-cell {
    display: block;
    text-align: left;
    font-size: 13px;
    padding-bottom: 6px;
    margin-bottom: 5px;
    border-bottom: 1px solid color-mix(in srgb, var(--ghz-card-border, #2a2e35) 55%, transparent);
  }
  .do-table tbody td:first-child::before,
  .do-table tbody td.is-primary-cell::before { content: none; }
  .do-table tbody td.is-num { text-align: right; }
  /* Cột thứ tự chỉ để đọc nhanh — ẩn trên mobile, thứ tự đã thể hiện bằng vị trí */
  .do-table tbody td.is-index { display: none; }
  .do-rank.is-mobile-only {
    display: inline-flex;
    margin-right: 7px;
    vertical-align: middle;
  }

  /* ---- Modal: dialog căn giữa, chừa lề 4 phía (mobile) ---- */
  .do-modal {
    padding: 16px;
    align-items: center;
    justify-content: center;
    background: rgba(4, 7, 10, 0.66);
  }
  .do-modal-card {
    width: 100%;
    max-width: 100%;
    /* Chừa lề trên + dưới để vẫn thấy app phía sau */
    max-height: min(78dvh, 640px);
    border-radius: 16px;
    border-bottom: 1px solid var(--ghz-card-border, #2a2e35);
    /* Sheet trượt lên thay vì fade */
    animation: do-sheet-rise 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .do-modal-head {
    padding: 10px 12px 12px;
    /* Vùng kéo (grabber) để người dùng biết có thể vuốt */
    position: relative;
  }
  .do-modal-head::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 4px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--ghz-text-muted, #9ca3af) 40%, transparent);
  }
  .do-modal-title { font-size: 14px; }
  .do-modal-title span { font-size: 11px; margin-top: 2px; }
  /* Nút đóng to hơn cho chạm tay */
  .do-modal-close { width: 38px; height: 38px; font-size: 15px; }
  .do-modal-body {
    padding: 0 0 calc(14px + env(safe-area-inset-bottom));
  }
  /* Bảng → danh sách card: bỏ sticky cột đầu (không cuộn ngang nữa) */
  .do-modal-body .do-table tbody td.is-primary-cell,
  .do-modal-body .do-table tbody td:first-child,
  .do-modal-body .do-table thead th:first-child {
    position: static;
  }
  .do-modal-body .do-table tbody td.is-primary-cell,
  .do-modal-body .do-table tbody td:first-child {
    background: transparent;
  }
  .do-modal-body .do-table tbody tr:hover td.is-primary-cell,
  .do-modal-body .do-table tbody tr:hover td:first-child {
    background: transparent;
  }
  /* Card trong modal có padding riêng cho thoáng */
  .do-modal-body .do-table tbody tr {
    margin: 0 12px 8px;
    padding: 10px 12px;
  }
  .do-modal-body .do-table tbody tr:last-child { margin-bottom: 6px; }
}

/* Màn hình rất nhỏ (iPhone SE) */
@media (max-width: 380px) {
  .do-modal-card { max-height: min(74dvh, 560px); }
  .do-modal-title { font-size: 13px; }
  .do-grid { grid-template-columns: 1fr; }
}
