/* ============================================================
   VexAI · Quản trị
   ============================================================ */

@property --p {            /* phần trăm của vòng tròn — khai báo để transition được */
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

:root {
  --bg: #f4f3fb;
  --surface: #ffffff;
  --surface-2: #f2f0fa;
  --border: #e6e3f3;
  --text: #1b1830;
  --muted: #6c6884;
  --primary: #6d4aff;
  --primary-2: #22b8e6;
  --primary-soft: rgba(109, 74, 255, 0.12);
  --grad: linear-gradient(135deg, #7c5cff 0%, #5b8cff 55%, #22c1ee 100%);
  --ok: #16a36b;
  --ok-soft: rgba(22, 163, 107, 0.13);
  --warn: #c27400;
  --warn-soft: rgba(194, 116, 0, 0.14);
  --danger: #d6293a;
  --danger-soft: rgba(214, 41, 58, 0.12);
  --shadow: 0 1px 2px rgba(27, 24, 48, 0.04), 0 8px 24px -12px rgba(27, 24, 48, 0.12);
  --shadow-hover: 0 2px 4px rgba(27, 24, 48, 0.05), 0 18px 40px -16px rgba(109, 74, 255, 0.35);
  --radius: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0d16;
    --surface: #17151f;
    --surface-2: #211e2d;
    --border: #2c2939;
    --text: #eeecf6;
    --muted: #9d99b3;
    --primary: #9b85ff;
    --primary-2: #45cff5;
    --primary-soft: rgba(155, 133, 255, 0.16);
    --ok: #3ccf93;
    --ok-soft: rgba(60, 207, 147, 0.15);
    --warn: #f3ad45;
    --warn-soft: rgba(243, 173, 69, 0.15);
    --danger: #ff6f7d;
    --danger-soft: rgba(255, 111, 125, 0.15);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 20px 44px -16px rgba(124, 92, 255, 0.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
h3 { font-size: 14.5px; margin: 0; letter-spacing: -0.01em; }
a { color: var(--primary); }
.link { font-size: 13px; font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
svg { display: block; }

/* ---------- nền: mảng màu trôi chậm ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(90px); opacity: 0.32; animation: drift 26s ease-in-out infinite alternate;
}
.blob--1 { background: #8b6bff; top: -18vmax; left: -12vmax; }
.blob--2 { background: #2cc6f0; bottom: -22vmax; right: -14vmax; animation-duration: 32s; animation-delay: -8s; }
.blob--3 { background: #ff7bb5; top: 30%; left: 55%; width: 30vmax; height: 30vmax; opacity: 0.16; animation-duration: 38s; }
@media (prefers-color-scheme: dark) { .blob { opacity: 0.2; } .blob--3 { opacity: 0.1; } }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vmax, 4vmax, 0) scale(1.15); }
}

/* ---------- logo / thương hiệu ---------- */
.logo {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 18px -6px rgba(109, 74, 255, 0.7); position: relative; overflow: hidden;
}
.logo::after {          /* vệt sáng lướt qua */
  content: ""; position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.55) 50%, transparent 60%);
  transform: translateX(-60%); animation: shine 6s var(--ease) infinite;
}
@keyframes shine { 0%, 70% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
.logo--lg { width: 52px; height: 52px; border-radius: 15px; font-size: 24px; margin: 0 auto 14px; }
.brand { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.brand span {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700;
}
.brand--lg { font-size: 22px; }

/* ---------- đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__card {
  width: 100%; max-width: 390px; text-align: center; padding: 34px 26px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-hover);
  animation: rise 0.6s var(--ease) both;
}
.login__button { display: flex; justify-content: center; margin: 22px 0 6px; min-height: 44px; }

/* ---------- header dính trên cùng ---------- */
.header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(170%) blur(16px); -webkit-backdrop-filter: saturate(170%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 16px; max-width: 1240px; margin: 0 auto;
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge {
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .06em;
  background: var(--surface-2); color: var(--muted); text-transform: uppercase;
}
.badge--prod { background: var(--danger-soft); color: var(--danger); }
.updated { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; }
.live-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok);
  animation: ping 2s var(--ease) infinite;
}
.live-dot.is-stale { background: var(--warn); }
.live-dot.is-stale::after { background: var(--warn); }

.refresh-bar { height: 2px; background: transparent; }
.refresh-bar__fill { height: 100%; width: 0; background: var(--grad); opacity: .8; }
.refresh-bar__fill.is-running { animation: countdown linear forwards; }
@keyframes countdown { from { width: 0; } to { width: 100%; } }

/* ---------- nút ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 13px; padding: 7px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), border-color .2s, background .2s;
}
.btn:hover { border-color: var(--primary); box-shadow: 0 6px 16px -10px var(--primary); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn--primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -10px rgba(109,74,255,.9); }
.btn--primary:hover { box-shadow: 0 12px 24px -10px rgba(109,74,255,.9); filter: brightness(1.06); }
.btn--soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn--ghost { background: transparent; }
.btn:disabled { opacity: .7; cursor: default; transform: none; }
.btn__icon { width: 15px; height: 15px; display: inline-grid; place-items: center; }
.btn__icon svg { width: 15px; height: 15px; }
.btn.is-loading .btn__icon svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tab ---------- */
.tabs-wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.tabs-wrap::-webkit-scrollbar { display: none; }
.tabs {
  position: relative; display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.tabs__indicator {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 10px;
  background: var(--grad); box-shadow: 0 8px 20px -8px rgba(109, 74, 255, .8);
  transition: transform .45s var(--spring), width .45s var(--spring);
}
.tab {
  position: relative; z-index: 1; font: inherit; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 8px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  cursor: pointer; transition: color .25s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: #fff; }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tab__icon svg { width: 16px; height: 16px; }
.tab__badge:empty { display: none; }
.tab__badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; line-height: 18px;
  text-align: center; background: var(--danger); color: #fff; animation: pop .4s var(--spring);
}
.tab__badge.is-warn { background: var(--warn); }
.tab[aria-selected="true"] .tab__badge { background: rgba(255,255,255,.28); }

/* ---------- vùng nội dung ---------- */
.main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 48px; }
.tabpanel { display: flex; flex-direction: column; gap: 14px; }
.tabpanel[hidden] { display: none; }
#stats { display: flex; flex-direction: column; gap: 14px; }

/* Hiệu ứng vào: chỉ khi mở tab / lần tải đầu (class is-entering), không lặp mỗi lần tự làm mới */
.is-entering .enter { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 80%, 100% { transform: scale(2.6); opacity: 0; } }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; min-width: 0; box-shadow: var(--shadow);
}
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.two-col { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.notice { padding: 10px 12px; border-radius: 10px; margin: 0 0 12px; font-size: 13px; text-align: left; }
.notice--danger { background: var(--danger-soft); color: var(--danger); }
.notice--warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- hero (Tổng quan) ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 22px 22px 20px; color: #fff;
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap; min-height: 118px;
  box-shadow: 0 20px 44px -22px rgba(0,0,0,.45);
}
.hero--ok { background: linear-gradient(125deg, #0fa36a 0%, #14b8a6 55%, #22c1ee 100%); }
.hero--warn { background: linear-gradient(125deg, #e08a00 0%, #f06a3a 100%); }
.hero--danger { background: linear-gradient(125deg, #d6293a 0%, #b5287a 60%, #7c3aed 100%); }
.hero--loading { background: var(--surface); box-shadow: var(--shadow); }
.hero::before {         /* vòng sáng mờ trang trí */
  content: ""; position: absolute; width: 320px; height: 320px; right: -80px; top: -140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.35), transparent 65%); animation: drift 14s ease-in-out infinite alternate;
}
.hero--loading::before { display: none; }
.hero__icon {
  position: relative; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); animation: float 4s ease-in-out infinite;
}
.hero__icon svg { width: 34px; height: 34px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.hero__body { position: relative; flex: 1; min-width: 220px; }
.hero__title { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.hero__sub { margin: 2px 0 0; opacity: .9; }
.hero__chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.hero__chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: rgba(255,255,255,.2); color: #fff; text-decoration: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
  transition: background .2s, transform .2s var(--ease);
}
.hero__chip:hover { background: rgba(255,255,255,.32); transform: translateY(-1px); }

/* ---------- ô số liệu ---------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tile {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
a.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.tile__icon {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.tile__icon svg { width: 19px; height: 19px; }
.tile--ok .tile__icon { background: var(--ok-soft); color: var(--ok); }
.tile--warn .tile__icon { background: var(--warn-soft); color: var(--warn); }
.tile--danger .tile__icon { background: var(--danger-soft); color: var(--danger); }
.tile__body { min-width: 0; }
.tile__label { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile__value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.tile--warn .tile__value { color: var(--warn); }
.tile--danger .tile__value { color: var(--danger); }
.tile__hint { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.flash { animation: flash 1.4s var(--ease); border-radius: 6px; }
@keyframes flash { 0% { background: var(--primary-soft); box-shadow: 0 0 0 4px var(--primary-soft); } 100% { background: transparent; box-shadow: 0 0 0 4px transparent; } }

/* ---------- thẻ nhà cung cấp ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); }
.card {
  --accent: var(--grad);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 9px; min-width: 0; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card--ok { --accent: linear-gradient(90deg, var(--ok), #22c1ee); }
.card--warn { --accent: linear-gradient(90deg, var(--warn), #f06a3a); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.card--danger { --accent: linear-gradient(90deg, var(--danger), #b5287a); border-color: var(--danger); animation: dangerGlow 2.2s ease-in-out infinite; }
@keyframes dangerGlow { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 var(--danger-soft); } 50% { box-shadow: var(--shadow), 0 0 0 6px var(--danger-soft); } }
.card__head { display: flex; align-items: center; gap: 10px; }
.card__title { flex: 1; min-width: 0; }
.card__title h3 { overflow-wrap: anywhere; line-height: 1.3; }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  font-weight: 800; font-size: 12.5px; letter-spacing: .02em; box-shadow: 0 6px 14px -8px rgba(0,0,0,.6);
}
.tag { font-size: 11px; padding: 2px 8px; border-radius: 7px; background: var(--surface-2); color: var(--muted); white-space: nowrap; font-weight: 600; }
.balance { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.balance small { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.card__sub, .card__uses, .card__note { font-size: 12.5px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.card__sub strong { color: var(--text); }
.card__note {
  padding: 8px 10px; border-radius: 10px; background: var(--surface-2);
}
.card__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }

.pill {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- service phụ ---------- */
.deps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dep {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid transparent; transition: border-color .25s, transform .25s var(--ease);
}
.dep:hover { transform: translateY(-2px); border-color: var(--border); }
.dep--down { background: var(--danger-soft); }
.dep__name { font-weight: 700; }
.dep__meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.dep--down .dep__meta { color: var(--danger); }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; position: relative; background: var(--muted); }
.dot--ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot--danger { background: var(--danger); }
.dot--danger::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--danger); animation: ping 1.4s var(--ease) infinite; }

/* ---------- bảng ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 10px; border-top: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; border-top: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-bad td { background: var(--danger-soft); }
.table code { font-size: 12px; }
.rate { display: flex; align-items: center; gap: 8px; min-width: 120px; font-variant-numeric: tabular-nums; }
.rate__bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rate__fill { height: 100%; width: 0; border-radius: inherit; background: var(--ok); transition: width .8s var(--ease); }
.rate__fill--warn { background: var(--warn); }
.rate__fill--danger { background: var(--danger); }

/* ---------- dòng thời gian cảnh báo ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 14px 0; }
.timeline li:not(:last-child)::before {
  content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border);
}
.timeline__node {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted);
}
.timeline__node svg { width: 15px; height: 15px; }
.timeline__node--critical { background: var(--danger-soft); color: var(--danger); }
.timeline__node--warning { background: var(--warn-soft); color: var(--warn); }
.timeline__node--ok { background: var(--ok-soft); color: var(--ok); }
.timeline__body { flex: 1; min-width: 0; padding-top: 3px; }
.timeline__title { font-weight: 600; overflow-wrap: anywhere; }
.timeline__meta { font-size: 12px; color: var(--muted); }
.timeline__empty { color: var(--muted); padding: 6px 0; }
.timeline--full { max-height: none; }

/* ---------- biểu đồ cột ---------- */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 170px; padding-top: 20px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; cursor: default; }
.bar__fill {
  width: 100%; max-width: 30px; min-height: 3px; border-radius: 7px 7px 3px 3px; background: var(--grad);
  transform-origin: bottom; transition: filter .2s, transform .2s var(--ease);
}
.is-entering .bar__fill { animation: grow .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar:hover .bar__fill { filter: brightness(1.15) saturate(1.2); }
.bar__value { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; font-variant-numeric: tabular-nums; opacity: .8; transition: opacity .2s, color .2s; }
.bar:hover .bar__value { opacity: 1; color: var(--text); font-weight: 700; }
.bar__label { font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.bar--today .bar__label { color: var(--primary); font-weight: 700; }

.bars--dense { gap: 3px; }
.bars--dense .bar__value { opacity: 0; }
.bars--dense .bar:hover .bar__value { opacity: 1; }

/* ---------- tiêu đề nhóm trong tab ---------- */
.section-title {
  display: flex; align-items: center; gap: 9px; margin: 10px 0 -2px;
  font-size: 15.5px; font-weight: 800; letter-spacing: -0.01em;
}
.section-title::before { content: ""; flex: none; width: 4px; height: 17px; border-radius: 4px; background: var(--grad); }
.section-title .muted { font-weight: 500; font-size: 13px; }
.tile__hint--up { color: var(--ok); font-weight: 600; }
.tile__hint--down { color: var(--danger); font-weight: 600; }

/* ---------- danh sách thanh ngang (tính năng, gói, top user) ---------- */
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: baseline; }
.hbars__label { font-weight: 650; overflow-wrap: anywhere; }
.hbars__meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.hbars .meter { grid-column: 1 / -1; height: 8px; margin: 0; }

/* Thanh & vòng: giá trị thật gán sẵn, keyframes chỉ làm chúng "mọc ra" khi mở tab */
.is-entering .meter__fill,
.is-entering .rate__fill { animation: fillIn .9s var(--ease) both; transform-origin: left; }
@keyframes fillIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.is-entering .ring { animation: ringIn 1.2s var(--ease) both; }
@keyframes ringIn { from { --p: 0; } }

/* ---------- vòng dung lượng DB ---------- */
.db { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.ring {
  --p: 0; --c: var(--primary);
  flex: none; width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0);
  transition: --p 1.2s var(--ease);
}
.ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.ring__label { position: relative; text-align: center; line-height: 1.2; }
.ring__value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring--warn { --c: var(--warn); }
.ring--danger { --c: var(--danger); }
.db__tables { flex: 1; min-width: 200px; list-style: none; margin: 0; padding: 0; }
.db__tables li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12.5px; padding: 5px 0; }
.db__tables .meter { grid-column: 1 / -1; }
.meter { height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter__fill { height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width 1s var(--ease); }

/* ---------- máy chủ (tab Hệ thống) ---------- */
.vms { display: grid; gap: 14px; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.vm { gap: 12px; }
.vm:hover { transform: none; }
.vm__meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.vm__meters { display: grid; gap: 11px; }
.vm-meter__top { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.vm-meter__label { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 44px; }
.vm-meter__pct { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.vm-meter__pct--warn { color: var(--warn); }
.vm-meter__pct--danger { color: var(--danger); }
.vm-meter__value { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.vm-meter__bar { height: 7px; margin-top: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.vm-meter__fill { height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 1s var(--ease); }
.vm-meter__fill--warn { background: linear-gradient(90deg, var(--warn), #f06a3a); }
.vm-meter__fill--danger { background: linear-gradient(90deg, var(--danger), #b5287a); }
.vm-meter__sub { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.vm__chart { border-top: 1px solid var(--border); padding-top: 10px; }
.spark { display: block; width: 100%; height: 72px; overflow: visible; }
.spark polyline { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark__cpu { stroke: var(--primary); }
.spark__mem { stroke: var(--primary-2); }
.spark__grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark__limit { stroke: var(--danger); stroke-width: 1; stroke-dasharray: 4 4; opacity: .55; vector-effect: non-scaling-stroke; }
.vm__legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.vm__legend .muted { margin-left: auto; }
.vm__key { display: inline-flex; align-items: center; gap: 6px; }
.vm__key::before { content: ""; width: 14px; height: 0; border-top: 2px solid currentColor; }
.vm__key--cpu { color: var(--primary); }
.vm__key--mem { color: var(--primary-2); }
.vm__key--limit { color: var(--danger); }
.vm__key--limit::before { border-top-style: dashed; }

/* ---------- skeleton & toast ---------- */
.skeleton {
  border-radius: 14px; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
.skeleton--hero { width: 100%; height: 76px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 50; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; color: #fff;
  background: color-mix(in srgb, #1b1830 88%, transparent); backdrop-filter: blur(10px);
  box-shadow: 0 14px 30px -12px rgba(0,0,0,.5); transition: opacity .3s var(--ease), transform .3s var(--spring);
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast--danger { background: var(--danger); }

/* ---------- màn hình nhỏ ---------- */
@media (max-width: 640px) {
  .topbar__email, .updated, .btn__label { display: none; }
  .tab { padding: 8px 11px; }
  /* mép phải mờ dần = còn tab để vuốt tới */
  .tabs-wrap { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { flex-direction: column; gap: 8px; padding: 12px; }
  .tile__value { font-size: 19px; }
  .balance { font-size: 26px; }
  .hero { padding: 18px; }
  .hero__title { font-size: 20px; }
  .two-col { grid-template-columns: 1fr; }
  .hbars li { grid-template-columns: 1fr; }
  .hbars__meta { text-align: left; }
}

/* ---------- người dùng tắt chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
