/* Khu quản trị — dùng chung token màu với trang công khai nhưng bố cục dày đặc
   hơn: đây là bàn làm việc, không phải trang giới thiệu. */

body.admin { background: var(--muc-900); }

.ad-shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

/* ---------------------------------------------------------------- sidebar */
.ad-side {
  background: var(--muc-850);
  border-right: 1px solid var(--line-soft);
  padding: 22px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.ad-nav { display: flex; flex-direction: column; gap: 2px; }
.ad-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: var(--r-sm);
  color: var(--diep-mid); text-decoration: none;
  font-size: 14.5px; font-weight: 500; transition: background .15s, color .15s;
}
.ad-nav a:hover { background: var(--raise); color: var(--diep); }
.ad-nav a.on { background: var(--son-ink); color: var(--son-hi); font-weight: 600; }
.ad-nav .ico { font-size: 13px; opacity: .8; width: 15px; text-align: center; }

.ad-side-foot {
  margin-top: auto; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--diep-dim);
}
.ad-side-foot .who { font-weight: 600; color: var(--diep-mid); margin-bottom: 5px; }
.ad-side-foot a { color: var(--diep-dim); }

/* ---------------------------------------------------------------- main */
.ad-main { min-width: 0; }
.ad-head {
  padding: 22px 32px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--muc-900) 88%, transparent);
  backdrop-filter: blur(12px);
}
.ad-head h1 { font-size: 25px; letter-spacing: -.035em; }
.ad-body { padding: 26px 32px 70px; max-width: 940px; }

/* ---------------------------------------------------------------- khối */
.box {
  background: var(--muc-800); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 24px; margin-bottom: 18px;
}
.box > h2 {
  font-size: 17px; margin-bottom: 4px; letter-spacing: -.02em;
}
.box > .box-note {
  color: var(--diep-dim); font-size: 13.5px; margin: 0 0 20px; line-height: 1.65;
}
.box-note code { background: var(--muc-850); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; color: var(--nghe); }

.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 20px; }

/* ---------------------------------------------------------------- thống kê */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--muc-800); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 17px 19px;
}
.stat b {
  display: block; font-family: var(--ff-display); font-size: 27px;
  letter-spacing: -.04em; line-height: 1.1; margin-bottom: 2px;
}
.stat span { font-size: 12.5px; color: var(--diep-dim); }
.stat.son b { color: var(--son-hi); }
.stat.nghe b { color: var(--nghe); }
.stat.moc b { color: var(--moc); }

/* ---------------------------------------------------------------- bảng */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 10px 12px;
  font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--diep-dim); font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.tbl td { padding: 13px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--muc-850); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-ready   { background: rgba(87,216,154,.14); color: var(--moc); }
.badge-indexing{ background: rgba(242,179,61,.14); color: var(--nghe); }
.badge-pending { background: var(--raise); color: var(--diep-dim); }
.badge-error   { background: rgba(255,107,90,.14); color: var(--hoa); }
.badge-disabled{ background: var(--raise); color: var(--diep-dim); }

/* ---------------------------------------------------------------- upload */
.drop {
  border: 2px dashed var(--line); border-radius: var(--r-lg);
  padding: 40px 24px; text-align: center; cursor: pointer;
  transition: border-color .18s, background .18s;
  background: var(--muc-850);
}
.drop:hover, .drop.over { border-color: var(--son); background: var(--son-ink); }
.drop .big { font-size: 34px; margin-bottom: 12px; }
.drop b { display: block; font-size: 16px; margin-bottom: 6px; }
.drop span { color: var(--diep-dim); font-size: 13.5px; }

.prog {
  height: 7px; border-radius: 99px; background: var(--raise);
  overflow: hidden; margin: 14px 0 8px;
}
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--son), var(--nghe)); width: 0; transition: width .3s; }

.up-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--muc-850);
  border-radius: var(--r-sm); margin-bottom: 8px; font-size: 14px;
}
.up-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- form phụ */
.f-row { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: start; padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.f-row:last-of-type { border-bottom: 0; }
.f-row > .lbl { padding-top: 12px; }
.f-row > .lbl label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 3px; }
.f-row > .lbl small { color: var(--diep-dim); font-size: 12.5px; line-height: 1.55; display: block; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }

.test-out {
  margin-top: 12px; padding: 12px 15px; border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.6; display: none;
}
.test-out.show { display: block; }
.test-out.ok  { background: rgba(87,216,154,.1); color: #B9F0D3; border: 1px solid rgba(87,216,154,.3); }
.test-out.bad { background: rgba(255,107,90,.1); color: #FFC4BC; border: 1px solid rgba(255,107,90,.3); }

/* ---------------------------------------------------------------- đăng nhập */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card { width: 100%; max-width: 400px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .ad-shell { grid-template-columns: 1fr; }
  .ad-side {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 14px; overflow-x: auto; padding: 12px 16px;
    border-right: 0; border-bottom: 1px solid var(--line-soft);
  }
  .ad-side .brand { margin: 0 !important; flex-shrink: 0; }
  .ad-nav { flex-direction: row; gap: 4px; }
  .ad-nav a { white-space: nowrap; padding: 8px 12px; font-size: 13.5px; }
  .ad-side-foot { margin: 0 0 0 auto; border: 0; padding: 0; white-space: nowrap; }
  .ad-side-foot .who { display: none; }
  .ad-head, .ad-body { padding-inline: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .f-row { grid-template-columns: 1fr; gap: 8px; }
  .f-row > .lbl { padding-top: 0; }
  .tbl-wrap { margin-inline: -18px; padding-inline: 18px; }
}
