/* Trang Theo dõi hạn mức — theo ProviderLimits / QuotaTable (compact) của 9router. Tiền tố .qt- */
.qt-page { display: flex; flex-direction: column; gap: 24px; }
.qt-page [hidden] { display: none !important; }

/* ---------- thanh công cụ: nút cao 32px, chữ 12px, viền black/10 · white/10 ---------- */
.qt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.qt-select, .qt-tbtn { height: 32px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .1); background-color: rgba(0, 0, 0, .02);
  color: var(--text); font-size: 12px; line-height: 16px; padding: 0 8px; transition: background-color .15s, color .15s; }
.qt-select { appearance: none; -webkit-appearance: none; outline: none; max-width: 220px; padding-right: 26px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 14px; }
.qt-select:hover { background-color: rgba(0, 0, 0, .05); }
.qt-select:focus-visible { border-color: rgba(229, 106, 74, .5); }
.qt-tbtn { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.qt-tbtn:hover:not(:disabled) { background-color: rgba(0, 0, 0, .05); }
.qt-tbtn:disabled { opacity: .5; }
.qt-tbtn.sq { width: 32px; padding: 0; justify-content: center; }
.qt-tbtn .ms { font-size: 14px; color: var(--text-muted); }
.qt-tbtn .ms.on { color: var(--primary); }
.qt-tbtn .cd { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.qt-live { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 500;
  border: 1px solid rgba(229, 106, 74, .3); background: var(--primary-soft); color: var(--primary); }
.qt-live .ms { font-size: 14px; }
[data-theme="dark"] .qt-select, [data-theme="dark"] .qt-tbtn { border-color: rgba(255, 255, 255, .1); background-color: rgba(255, 255, 255, .03); }
[data-theme="dark"] .qt-select:hover { background-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .qt-tbtn:hover:not(:disabled) { background-color: rgba(255, 255, 255, .05); }
[data-theme="dark"] select.qt-select option { background: var(--surface); color: var(--text); }

/* ---------- lưới thẻ: 1 cột, ≥768px 2 cột, cách 12px ---------- */
.qt-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 768px) { .qt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qt-grid.single { grid-template-columns: minmax(0, 1fr); }
.qt-grid > .card { margin: 0; }
.qt-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; transition: border-color .2s, box-shadow .2s, opacity .2s; }
.qt-card.off { opacity: .6; }
.qt-card.on { border-color: rgba(229, 106, 74, .45); box-shadow: var(--shadow-warm); }

/* header thẻ: px-3 py-2, viền dưới black/10 · white/10 */
.qt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid rgba(0, 0, 0, .1); }
[data-theme="dark"] .qt-head { border-bottom-color: rgba(255, 255, 255, .1); }
.qt-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qt-logo { width: 32px; height: 32px; flex: none; border-radius: 6px; display: grid; place-items: center; overflow: hidden;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.qt-logo.web .ms { font-size: 28px; background: linear-gradient(135deg, #4285f4 15%, #9b72cb 55%, #d96570 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.qt-names { min-width: 0; }
.qt-trunc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-prov { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); }
.qt-prov > .qt-trunc { flex: 0 1 auto; }
.qt-tier { flex: 0 100000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px;
  border-radius: 9999px; font-size: 10px; line-height: 16px; font-weight: 600; background: rgba(59, 130, 246, .1); color: var(--c-blue); }
.qt-acct { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--text-muted); }
.qt-linked { display: inline-flex; flex: none; }
.qt-linked .ms { font-size: 13px; color: var(--text-subtle); }
.qt-sub { font-size: 11px; line-height: 15px; color: color-mix(in srgb, var(--text-muted) 80%, transparent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-sub.warn { color: var(--c-yellow); }
.qt-sub.bad { color: var(--c-red); }
.qt-sub.live { color: var(--primary); }
.qt-pulse { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--primary);
  vertical-align: 1px; animation: qt-pulse 1.2s ease-in-out infinite; }
@keyframes qt-pulse { 50% { opacity: .25; transform: scale(.8); } }

/* nút icon 32x32 trên header (refresh · sửa · xoá) + toggle nhỏ */
.qt-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.qt-ibtn { width: 32px; height: 32px; display: inline-grid; place-items: center; flex: none; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted); transition: background-color .15s, color .15s; }
.qt-ibtn .ms { font-size: 18px; }
.qt-ibtn:hover:not(:disabled) { background: rgba(0, 0, 0, .05); }
.qt-ibtn.edit:hover, .qt-ibtn.prim { color: var(--primary); }
.qt-ibtn.red { color: #ef4444; }
.qt-ibtn.red:hover:not(:disabled) { background: rgba(239, 68, 68, .1); }
.qt-ibtn:disabled { opacity: .5; }
[data-theme="dark"] .qt-ibtn:hover:not(:disabled) { background: rgba(255, 255, 255, .05); }
[data-theme="dark"] .qt-ibtn.red:hover:not(:disabled) { background: rgba(239, 68, 68, .1); }
.qt-tog { display: inline-flex; align-items: center; padding-left: 2px; }

/* ---------- thân thẻ: px-2 py-1.5 ---------- */
.qt-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 6px 8px; min-width: 0; }
.qt-count { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0;
  font-size: 10px; line-height: 14px; color: var(--text-muted); }
.qt-count > span:first-child { flex: none; }
.qt-sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-sum b { font-weight: 500; color: var(--c-red); }
.qt-rows { display: flex; flex-direction: column; gap: 1px; }

/* 1 dòng hạn mức: chấm màu · tên (144px) · thanh + số lượt · thời gian mở lại · nút ẩn */
.qt-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-bottom: 1px solid rgba(0, 0, 0, .05); transition: background-color .15s; }
.qt-row:hover { background: rgba(0, 0, 0, .02); }
[data-theme="dark"] .qt-row { border-bottom-color: rgba(255, 255, 255, .05); }
[data-theme="dark"] .qt-row:hover { background: rgba(255, 255, 255, .02); }
.qt-name { display: flex; align-items: center; gap: 6px; width: 144px; min-width: 0; flex: none; }
.qt-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #6b7280; }
.qt-dot.ok { background: var(--c-green); }
.qt-dot.warn { background: var(--c-yellow); }
.qt-dot.bad { background: var(--c-red); }
.qt-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 16px; font-weight: 500; color: var(--text); }
.qt-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.qt-bar { height: 4px; border-radius: 9999px; overflow: hidden; border: 1px solid transparent; background: rgba(107, 114, 128, .12); }
.qt-bar > i { display: block; height: 100%; background: #6b7280; transition: width .3s; }
.qt-bar.ok { background: rgba(34, 197, 94, .1); } .qt-bar.ok > i { background: #22c55e; }
.qt-bar.warn { background: rgba(234, 179, 8, .1); } .qt-bar.warn > i { background: #eab308; }
.qt-bar.bad { background: rgba(239, 68, 68, .1); } .qt-bar.bad > i { background: #ef4444; }
.qt-bar.zero { border-color: rgba(0, 0, 0, .1); }
[data-theme="dark"] .qt-bar.zero { border-color: rgba(255, 255, 255, .1); }
.qt-line { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; font-size: 10px; line-height: 14px; }
.qt-used { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.qt-state { flex: none; font-weight: 500; color: var(--text-muted); }
.qt-state.ok { color: var(--c-green); }
.qt-state.warn { color: var(--c-yellow); }
.qt-state.bad { color: var(--c-red); }
.qt-reset { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; line-height: 16px; font-weight: 500; color: var(--text); }
.qt-reset .na { font-weight: 400; font-style: italic; color: var(--text-muted); }
.qt-hide { width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-muted); transition: background-color .15s, color .15s; }
.qt-hide .ms { font-size: 15px; }
.qt-hide:hover { background: rgba(0, 0, 0, .05); color: var(--text); }
[data-theme="dark"] .qt-hide:hover { background: rgba(255, 255, 255, .05); }
.qt-err { padding: 0 4px; font-size: 11px; line-height: 15px; color: var(--c-red); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* dòng đã ẩn (hiện lại được) */
.qt-hidden { display: flex; align-items: center; gap: 4px; min-width: 0; padding-top: 8px; border-top: 1px solid rgba(0, 0, 0, .05);
  font-size: 10px; line-height: 14px; color: var(--text-muted); }
[data-theme="dark"] .qt-hidden { border-top-color: rgba(255, 255, 255, .05); }
.qt-hidden > .ms { font-size: 14px; }
.qt-hidden .lbl { flex: none; }
.qt-hidden-list { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding-bottom: 4px; }
.qt-hidden-list button { flex: none; padding: 2px 6px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .1); background: transparent;
  color: inherit; font-size: 10px; line-height: 14px; transition: background-color .15s, color .15s; }
.qt-hidden-list button:hover { background: rgba(0, 0, 0, .05); color: var(--text); }
[data-theme="dark"] .qt-hidden-list button { border-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .qt-hidden-list button:hover { background: rgba(255, 255, 255, .05); }

/* trạng thái giữa thẻ: đang tải (spinner) / cần đăng nhập */
.qt-msg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px 8px; flex: 1;
  text-align: center; font-size: 12px; line-height: 16px; color: var(--text-muted); }
.qt-msg > .ms { font-size: 28px; }
.qt-msg > .ms.bad { color: #ef4444; }
.qt-msg .btn { margin-top: 4px; }
.qt-ghost .sk { height: 10px; border-radius: 4px; background: var(--hover); animation: qt-pulse 1.4s ease-in-out infinite; }
.qt-ghost .qt-logo.sk { height: 32px; }
.qt-ghost .sk.w1 { width: 96px; margin-bottom: 6px; }
.qt-ghost .sk.w2 { width: 160px; }
.qt-ghost .qt-msg { min-height: 132px; }

/* thẻ rỗng / lỗi (Card padding lg, icon 64px mờ) */
.qt-empty { padding: 32px; text-align: center; }
.qt-empty > .ms { font-size: 64px; color: var(--text-muted); opacity: .2; margin-top: 24px; }
.qt-empty > .ms.bad { color: #ef4444; opacity: .6; }
.qt-empty h3 { margin-top: 16px; font-size: 18px; line-height: 28px; font-weight: 600; color: var(--text); }
.qt-empty p { max-width: 448px; margin: 8px auto 24px; font-size: 14px; line-height: 20px; color: var(--text-muted); overflow-wrap: anywhere; }

/* chân trang: rounded-xl, viền black/10 · white/10 */
.qt-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, .1); background: rgba(0, 0, 0, .02); font-size: 12px; line-height: 16px; color: var(--text-muted); }
[data-theme="dark"] .qt-foot { border-color: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .03); }
.qt-foot-r { min-width: 0; overflow-wrap: anywhere; }
.qt-foot b { font-weight: 500; color: var(--c-red); }

/* ---------- điện thoại ---------- */
@media (max-width: 639px) {
  .qt-page { gap: 16px; }
  .qt-toolbar { justify-content: flex-start; }
  .qt-select { max-width: 170px; }
  .qt-tbtn .lbl { display: none; }
  .qt-foot { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .qt-head { padding: 8px 10px; }
  .qt-actions { gap: 0; }
  .qt-ibtn { width: 30px; }
  .qt-name { width: 104px; }
  .qt-row { gap: 6px; padding: 4px; }
}
