@import url('/fonts/font.css');

/* ==========================================================================
   Hệ thống thiết kế — tông hoàng hôn trên biển
   ========================================================================== */
:root {
  /* Màu thương hiệu */
  --coral: #ff6b4a;
  --coral-deep: #f0432f;
  --rose: #ff4d6d;
  --amber: #ffb547;
  --teal: #0eaba8;
  --ocean: #0b6a8f;

  --grad-sunset: linear-gradient(135deg, #ff9d4d 0%, #ff6b4a 45%, #f0435f 100%);
  --grad-ocean: linear-gradient(135deg, #12b0a6 0%, #0b6a8f 100%);
  --grad-dusk: linear-gradient(160deg, #2b2a5e 0%, #7a3d7a 45%, #ff7a59 100%);

  /* Nền và chữ */
  --bg: #f6f4f0;
  --bg-tint: #efece6;
  --surface: #fffefc;
  --surface-2: #faf8f5;
  --border: #e7e2da;
  --border-strong: #d9d2c7;
  --text: #1b1a18;
  --text-2: #55504a;
  --muted: #8b847b;

  --ok: #0f9960;
  --danger: #e03131;
  --warn: #d68a0c;

  --accent: var(--coral);
  --accent-tint: #fff0eb;
  --ring: rgba(255, 107, 74, .32);

  /* Đổ bóng nhiều lớp cho cảm giác có chiều sâu */
  --sh-sm: 0 1px 2px rgba(37, 28, 20, .05), 0 1px 3px rgba(37, 28, 20, .04);
  --sh-md: 0 2px 4px rgba(37, 28, 20, .04), 0 6px 16px rgba(37, 28, 20, .07);
  --sh-lg: 0 4px 8px rgba(37, 28, 20, .05), 0 16px 40px rgba(37, 28, 20, .11);
  --sh-glow: 0 8px 28px rgba(255, 107, 74, .3);

  --r-sm: 9px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --sidebar-w: 252px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

:root[data-theme="dark"], html:not([data-theme="light"]) body.dark-auto {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1116;
    --bg-tint: #0a0e13;
    --surface: #151b22;
    --surface-2: #1b222b;
    --border: #262f3a;
    --border-strong: #35404d;
    --text: #eceef1;
    --text-2: #b3bcc6;
    --muted: #7e8996;

    --accent: #ff7d5c;
    --accent-tint: #2a1a17;
    --ring: rgba(255, 125, 92, .3);
    --ok: #35c88a;
    --danger: #ff6b6b;

    --sh-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-md: 0 2px 6px rgba(0, 0, 0, .38), 0 8px 22px rgba(0, 0, 0, .3);
    --sh-lg: 0 6px 14px rgba(0, 0, 0, .4), 0 22px 50px rgba(0, 0, 0, .45);
    --sh-glow: 0 8px 30px rgba(255, 125, 92, .26);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Be Vietnam Pro', system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv01", "ss01";
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.hide { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.right { margin-left: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* ==========================================================================
   Chuyển động
   ========================================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: 200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(3%, -4%) scale(1.08); }
  66%  { transform: translate(-3%, 3%) scale(.96); }
  100% { transform: translate(0, 0) scale(1); }
}

.rise { animation: rise .5s var(--ease) both; }
.rise-1 { animation-delay: .04s; }
.rise-2 { animation-delay: .09s; }
.rise-3 { animation-delay: .14s; }
.rise-4 { animation-delay: .19s; }
.rise-5 { animation-delay: .24s; }

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

/* ==========================================================================
   Nút và form
   ========================================================================== */
button, .btn {
  font: inherit;
  font-weight: 550;
  padding: 9px 17px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease),
              background .16s, border-color .16s, opacity .16s;
  box-shadow: var(--sh-sm);
}
button:hover, .btn:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--sh-md);
  border-color: var(--muted);
  text-decoration: none;
}
button:active, .btn:active { transform: translateY(0); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

button.primary, .btn.primary {
  background: var(--grad-sunset);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--sh-glow);
}
button.primary:hover { box-shadow: 0 10px 34px rgba(255, 107, 74, .42); }

button.ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
}
button.ghost:hover { background: var(--surface-2); box-shadow: none; color: var(--text); }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

button.sm, .btn.sm { padding: 6px 13px; font-size: 13px; }
button.icon {
  padding: 0;
  width: 34px; height: 34px;
  justify-content: center;
  border-radius: 50%;
}

input, select, textarea {
  font: inherit;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--ring);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b847b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.field { margin-bottom: 15px; }

/* ==========================================================================
   Bố cục
   ========================================================================== */
#shell { display: flex; min-height: 100vh; }

#sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  padding: 20px 18px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--grad-sunset);
  display: grid; place-items: center;
  font-size: 20px;
  box-shadow: var(--sh-glow);
  flex: 0 0 auto;
}
.brand h1 {
  font-size: 15.5px;
  font-weight: 750;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -.015em;
}
.brand p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); font-weight: 500; }

nav { padding: 6px 12px; flex: 1; overflow-y: auto; }
nav .group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 16px 12px 7px;
  font-weight: 700;
}
nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 11px;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 550;
  margin-bottom: 3px;
  position: relative;
  transition: background .16s, color .16s, transform .16s var(--ease);
}
nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; transform: translateX(2px); }
nav a.active {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 700;
}
nav a.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3.5px; height: 20px;
  border-radius: 0 4px 4px 0;
  background: var(--grad-sunset);
}
nav a .ico { font-size: 17px; width: 22px; text-align: center; }

.side-foot { padding: 14px; border-top: 1px solid var(--border); }
.side-user {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 12px;
  background: var(--surface-2);
  margin-bottom: 9px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad-ocean);
  color: #fff;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
  flex: 0 0 auto;
}
.side-user .nm {
  font-size: 13.5px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 1px 8px; border-radius: 999px;
  background: var(--grad-sunset); color: #fff;
  letter-spacing: .03em; text-transform: uppercase;
}

#main { flex: 1; min-width: 0; }
.page { padding: 30px 34px 80px; max-width: 1240px; animation: fade .35s var(--ease); }

.page-head { margin-bottom: 26px; }
.page-head h2 {
  margin: 0 0 4px;
  font-size: 27px; font-weight: 800;
  letter-spacing: -.03em;
}
.page-head .sub { margin: 0; color: var(--muted); font-size: 14.5px; }

#topbar {
  display: none;
  align-items: center; gap: 12px;
  padding: 11px 16px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
#topbar strong { font-weight: 700; letter-spacing: -.01em; }

/* ==========================================================================
   Thẻ
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: box-shadow .22s var(--ease), transform .22s var(--ease);
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.015em; }
.card-body { padding: 20px; }

/* ---------- Hero trang chủ ---------- */
.hero {
  position: relative;
  border-radius: var(--r-xl);
  padding: 34px 36px;
  margin-bottom: 26px;
  overflow: hidden;
  background: var(--grad-dusk);
  color: #fff;
  box-shadow: var(--sh-lg);
  isolation: isolate;
}
.hero::before, .hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(52px);
  opacity: .55;
  z-index: -1;
}
.hero::before {
  width: 340px; height: 340px;
  background: #ffbe5c;
  top: -140px; right: -60px;
  animation: drift 17s ease-in-out infinite;
}
.hero::after {
  width: 300px; height: 300px;
  background: #21d4c4;
  bottom: -160px; left: 8%;
  animation: drift 21s ease-in-out infinite reverse;
}
.hero > *:not(.bokeh):not(.wave) { position: relative; z-index: 1; }
.hero .eyebrow {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  opacity: .85; margin: 0 0 8px;
}
.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.1;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .18);
}
.hero p.lede { margin: 0; opacity: .9; font-size: 15px; max-width: 46ch; }

/* Bốn ô luôn nằm trên một hàng, kể cả màn hình hẹp */
.countdown { display: flex; gap: 10px; margin-top: 22px; max-width: 400px; }
.cd-box {
  flex: 1 1 0;
  min-width: 0;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: var(--r);
  padding: 10px 8px;
  text-align: center;
}
.cd-box .n { font-size: 25px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd-box .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-weight: 600; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 20px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px; font-weight: 600;
  backdrop-filter: blur(10px);
}

/* ---------- Ô số liệu ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 15px;
  margin-bottom: 26px;
}
.stat {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 19px;
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.stat::after {
  content: '';
  position: absolute; inset: 0 auto 0 0;
  width: 3.5px;
  background: var(--grad-sunset);
  opacity: .9;
}
.stat.teal::after { background: var(--grad-ocean); }
.stat.ok::after { background: linear-gradient(180deg, #35c88a, #0f9960); }
.stat.danger::after { background: linear-gradient(180deg, #ff8a8a, #e03131); }

.stat .ico {
  font-size: 19px;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--surface-2);
  display: grid; place-items: center;
  margin-bottom: 11px;
}
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.stat .v {
  font-size: 25px; font-weight: 800;
  letter-spacing: -.032em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat .v.ok { color: var(--ok); }
.stat .v.danger { color: var(--danger); }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 20px; border-bottom: 1px solid var(--border); }
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700; white-space: nowrap;
  background: var(--surface-2);
}
tbody tr { transition: background .13s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.money { font-weight: 650; }
td.act { text-align: right; white-space: nowrap; }
td.act button { opacity: .35; transition: opacity .16s; }
tbody tr:hover td.act button { opacity: 1; }

.tag {
  display: inline-block;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.empty { padding: 54px 24px; text-align: center; color: var(--muted); }
.empty .big {
  font-size: 46px; display: block; margin-bottom: 12px;
  animation: float 3.6s ease-in-out infinite;
}
.empty .t { font-weight: 650; color: var(--text-2); font-size: 15px; }

/* ---------- Thanh tiến trình ---------- */
.bar-track { height: 9px; background: var(--bg-tint); border-radius: 999px; overflow: hidden; }
.bar-track > i {
  display: block; height: 100%;
  background: var(--grad-sunset);
  border-radius: 999px;
  transition: width .7s var(--ease);
}
.bar-track.teal > i { background: var(--grad-ocean); }

/* ==========================================================================
   Album
   ========================================================================== */
.uploader {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-xl);
  padding: 34px 24px;
  text-align: center;
  background: var(--surface);
  margin-bottom: 22px;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.uploader:hover { border-color: var(--accent); background: var(--accent-tint); }
.uploader.over {
  border-color: var(--accent);
  background: var(--accent-tint);
  transform: scale(1.012);
}
.uploader .big {
  font-size: 40px; display: block; margin-bottom: 10px;
  transition: transform .25s var(--ease);
}
.uploader:hover .big { transform: translateY(-4px) scale(1.06); }
.uploader .t { font-weight: 700; font-size: 16px; letter-spacing: -.015em; }
.uploader .s { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.up-progress {
  margin-top: 18px;
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 13px 16px;
  text-align: left;
}
.up-progress .lbl {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 600; margin-bottom: 8px;
}

/* Lưới masonry: ô thường gần vuông, ảnh dọc cao thêm một hàng cho khỏi bị cắt cụt */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  grid-auto-rows: 86px;
  gap: 11px;
}
.tile {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  grid-row: span 2;
  box-shadow: var(--sh-sm);
  transition: transform .26s var(--ease), box-shadow .26s var(--ease);
  animation: pop .4s var(--ease) both;
}
.tile.tall { grid-row: span 3; }
.tile:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); z-index: 2; }
.tile img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .5s var(--ease);
}
.tile:hover img { transform: scale(1.07); }
.tile .noimg {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-size: 34px; opacity: .4;
  background: var(--bg-tint);
}
.tile .meta {
  position: absolute; inset: auto 0 0 0;
  padding: 26px 11px 9px;
  font-size: 11.5px; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .24s, transform .24s var(--ease);
}
.tile:hover .meta { opacity: 1; transform: none; }
.tile .play {
  position: absolute; top: 9px; right: 9px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px; font-weight: 600;
}

/* Khung xương lúc đang tải */
.skel {
  border-radius: var(--r);
  grid-row: span 2;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-tint) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ---------- Xem ảnh phóng to ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 6, 5, .93);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  display: grid; grid-template-rows: auto 1fr;
  animation: fade .22s var(--ease);
}
#lightbox .lb-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px; color: #fff;
}
#lightbox .lb-bar .name {
  font-size: 14.5px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#lightbox .lb-bar .sub { font-size: 12.5px; opacity: .68; }
#lightbox .lb-bar button {
  background: rgba(255, 255, 255, .13);
  border-color: rgba(255, 255, 255, .16);
  color: #fff;
  box-shadow: none;
}
#lightbox .lb-bar button:hover { background: rgba(255, 255, 255, .26); border-color: rgba(255, 255, 255, .3); }
#lightbox .lb-body {
  display: grid; place-items: center;
  overflow: hidden; padding: 0 16px 22px;
}
#lightbox img, #lightbox video {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: var(--r);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  animation: pop .3s var(--ease);
}
#lightbox .nav {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(10px);
  color: #fff; border: none;
  width: 48px; height: 76px;
  font-size: 26px; cursor: pointer;
  box-shadow: none;
  border-radius: 0;
  justify-content: center;
}
#lightbox .nav:hover { background: rgba(255, 255, 255, .26); transform: translateY(-50%); }
#lightbox .nav.prev { left: 0; border-radius: 0 var(--r) var(--r) 0; }
#lightbox .nav.next { right: 0; border-radius: var(--r) 0 0 var(--r); }

/* ==========================================================================
   Biểu đồ tròn danh mục
   ========================================================================== */
.donut-wrap { display: flex; gap: 30px; align-items: center; flex-wrap: wrap; }
.donut { position: relative; flex: 0 0 auto; }
.donut svg { transform: rotate(-90deg); display: block; }
.donut circle { transition: stroke-dasharray .9s var(--ease); }
.donut .center {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
}
.donut .center .n { font-size: 19px; font-weight: 800; letter-spacing: -.03em; }
.donut .center .l { font-size: 11px; color: var(--muted); font-weight: 600; }

.legend { flex: 1; min-width: 210px; display: flex; flex-direction: column; gap: 11px; }
.legend-row { display: flex; align-items: center; gap: 11px; font-size: 14px; }
.legend-dot { width: 11px; height: 11px; border-radius: 4px; flex: 0 0 auto; }
.legend-row .nm { font-weight: 600; }
.legend-row .val { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; }
.legend-row .pct { color: var(--muted); font-size: 12.5px; width: 42px; text-align: right; }

/* ==========================================================================
   Đăng nhập
   ========================================================================== */
#login {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 22px;
  position: relative;
  overflow: hidden;
  background: var(--grad-dusk);
}
#login::before, #login::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .5;
}
#login::before {
  width: 480px; height: 480px;
  background: #ffb547;
  top: -180px; left: -120px;
  animation: drift 19s ease-in-out infinite;
}
#login::after {
  width: 430px; height: 430px;
  background: #16c8bd;
  bottom: -190px; right: -110px;
  animation: drift 24s ease-in-out infinite reverse;
}

.login-card {
  position: relative;
  width: 100%; max-width: 408px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: var(--r-xl);
  padding: 34px 32px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .32);
  animation: rise .55s var(--ease) both;
}
.login-mark {
  width: 58px; height: 58px;
  border-radius: 17px;
  background: var(--grad-sunset);
  display: grid; place-items: center;
  font-size: 29px;
  box-shadow: var(--sh-glow);
  margin-bottom: 18px;
}
.login-card h1 {
  font-size: 25px; font-weight: 800;
  margin: 0 0 5px; letter-spacing: -.032em;
}
.login-card .lede { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.login-card button[type=submit] { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.login-note {
  margin: 18px 0 0; font-size: 12.5px; color: var(--muted);
  text-align: center; line-height: 1.5;
}

/* ==========================================================================
   Thông báo và hộp thoại
   ========================================================================== */
#toast {
  position: fixed; left: 50%; bottom: 30px;
  transform: translateX(-50%) translateY(14px);
  background: #16181d; color: #fff;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
  max-width: 92vw; z-index: 200;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .34);
  display: flex; align-items: center; gap: 9px;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: linear-gradient(135deg, #f0435f, #d12030); }
#toast.ok { background: linear-gradient(135deg, #16b978, #0d8f5c); }

#modal {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(12, 9, 7, .58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .2s var(--ease);
}
#modal .card {
  width: 100%; max-width: 460px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sh-lg);
  animation: rise .3s var(--ease) both;
}

#scrim {
  position: fixed; inset: 0;
  background: rgba(12, 9, 7, .5);
  backdrop-filter: blur(3px);
  z-index: 35;
  animation: fade .2s;
}

/* ==========================================================================
   Hiệu ứng
   ========================================================================== */

/* ---------- Chữ bay lên từng ký tự ---------- */
@keyframes chIn {
  from { opacity: 0; transform: translateY(70%) rotate(6deg); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.split { display: inline-block; }
.split .ch {
  display: inline-block;
  white-space: pre;
  animation: chIn .62s var(--ease) both;
}

/* ---------- Sóng đáy hero ---------- */
@keyframes wave {
  from { transform: translateX(-2.5%) scaleY(1); }
  to   { transform: translateX(2.5%) scaleY(1.14); }
}
.wave {
  position: absolute;
  left: -4%; right: -4%; bottom: -1px;
  width: 108%; height: 90px;
  color: var(--bg);
  pointer-events: none;
}

/* ---------- Đốm sáng bokeh ---------- */
.bokeh {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Hạt nhiễu mịn phủ lên gradient cho đỡ bị "phẳng như file PNG" */
.grain::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Vệt sáng theo con trỏ ---------- */
.spotlight { position: relative; }
.spotlight::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
  background: radial-gradient(
    240px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 15%, transparent),
    transparent 68%
  );
}
.spotlight:hover::before { opacity: 1; }

/* ---------- Nghiêng theo con trỏ ---------- */
.tilt {
  transform-style: preserve-3d;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.tilt:hover { box-shadow: var(--sh-lg); }

/* ---------- Hiện dần khi cuộn tới ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Ảnh tan dần độ mờ ---------- */
.blur-up {
  opacity: 0;
  filter: blur(12px);
  transform: scale(1.04);
  transition: opacity .5s var(--ease), filter .5s var(--ease), transform .5s var(--ease);
}
.blur-up.loaded { opacity: 1; filter: none; transform: none; }
/* Đè lại quy tắc phóng to khi rê chuột ở lưới ảnh */
.tile:hover img.blur-up.loaded { transform: scale(1.07); }

/* ---------- Nút có ánh sáng quét qua ---------- */
button.primary, .btn.primary { position: relative; overflow: hidden; }
button.primary::after, .btn.primary::after {
  content: '';
  position: absolute; top: 0; bottom: 0;
  left: -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .42), transparent);
  transform: skewX(-18deg);
  transition: left .6s var(--ease);
}
button.primary:hover::after, .btn.primary:hover::after { left: 125%; }

/* ==========================================================================
   Màn hình nhỏ
   ========================================================================== */
@media (max-width: 860px) {
  #sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
    box-shadow: 0 0 40px rgba(0, 0, 0, .3);
  }
  #sidebar.open { transform: none; }
  #topbar { display: flex; }
  .page { padding: 18px 16px 72px; }
  .page-head h2 { font-size: 22px; }
  .hero { padding: 26px 22px; border-radius: var(--r-lg); }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 11px; }
  .stat { padding: 15px; border-radius: var(--r); }
  .stat .v { font-size: 21px; }
  .stat .ico { width: 31px; height: 31px; font-size: 16px; margin-bottom: 9px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); grid-auto-rows: 54px; gap: 7px; }
  .wave { height: 56px; }
  .cd-box { padding: 9px 4px; }
  .cd-box .n { font-size: 21px; }
  .cd-box .l { font-size: 9.5px; letter-spacing: .04em; }
  .tile .meta { opacity: 1; transform: none; font-size: 10.5px; padding: 18px 7px 6px; }
  th, td { padding: 11px 14px; }
  .uploader { padding: 26px 18px; }
  .donut-wrap { gap: 20px; justify-content: center; }
  #lightbox .nav { width: 40px; height: 62px; font-size: 21px; }
}
