/* ===========================================================
   Aura Wellness — admin.css
   Back-office: desktop, mật độ dữ liệu cao.
   Trung tính, không thương hiệu hoá. Bảng · bộ lọc · biểu đồ.
   =========================================================== */

body.admin {
  background: #F4F2ED;
  font-family: var(--font-ui);
  min-height: 100vh;
}
body.admin .display { font-family: var(--font-ui); }

.alayout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  max-width: var(--maxw-admin);
  margin: 0 auto;
  background: var(--surface);
}
@media (max-width: 980px) {
  .alayout { grid-template-columns: 1fr; }
}

/* ---------- Sidebar ---------- */
.aside {
  background: var(--forest-deep);
  color: var(--cream);
  padding: var(--s-5) 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (max-width: 980px) {
  .aside { position: static; height: auto; }
}
.aside .brand {
  padding: 0 var(--s-5) var(--s-5);
  border-bottom: 1px solid rgba(201,169,97,.2);
  margin-bottom: var(--s-4);
}
.aside .brand b { display: block; font-size: var(--fs-md); font-weight: var(--fw-sem); }
.aside .brand small { display: block; font-size: var(--fs-2xs); color: rgba(247,243,234,.55); margin-top: 2px; letter-spacing: .06em; text-transform: uppercase; }

.aside nav { flex: 1; }
.aside .navlink {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px var(--s-5);
  color: rgba(247,243,234,.72);
  text-decoration: none;
  font-size: var(--fs-sm);
  border-left: 3px solid transparent;
  min-height: 42px;
}
.aside .navlink:hover { background: rgba(247,243,234,.06); color: var(--cream); }
.aside .navlink[aria-current="page"] {
  background: rgba(201,169,97,.14);
  border-left-color: var(--gold);
  color: var(--cream);
  font-weight: var(--fw-sem);
}
.aside .navlink .ic { width: 18px; text-align: center; font-size: 15px; color: var(--gold); flex: none; }
.aside .navlink .n {
  margin-left: auto; background: var(--risk); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: var(--r-full);
  padding: 1px 6px; font-variant-numeric: tabular-nums;
}
.aside .sect {
  padding: var(--s-4) var(--s-5) var(--s-2);
  font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .1em;
  color: rgba(247,243,234,.4); font-weight: var(--fw-sem);
}
.aside .foot { padding: var(--s-4) var(--s-5) 0; border-top: 1px solid rgba(201,169,97,.2); }
.aside .foot a, .aside .foot button {
  display: block; width: 100%; text-align: left;
  font-size: var(--fs-xs); color: rgba(247,243,234,.6);
  padding: 7px 0; text-decoration: none;
}
.aside .foot a:hover, .aside .foot button:hover { color: var(--gold); }

/* ---------- Vùng nội dung ---------- */
.amain { min-width: 0; background: #F4F2ED; }
.ahead {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: var(--s-5) var(--s-6);
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap;
}
.ahead h1 { font-size: var(--fs-xl); font-weight: var(--fw-sem); line-height: 1.2; }
.ahead p { font-size: var(--fs-xs); color: var(--ink-soft); margin-top: 3px; }
.abody { padding: var(--s-6); }
.abody > * + * { margin-top: var(--s-5); }

/* ---------- Thẻ số liệu ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-4); }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--s-4);
}
.kpi .k { font-size: var(--fs-2xs); color: var(--ink-soft); font-weight: var(--fw-med); text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 1.75rem; font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 6px; }
.kpi .d { font-size: var(--fs-2xs); color: var(--ink-soft); margin-top: 3px; }
.kpi.accent { background: var(--forest); color: var(--cream); border-color: var(--forest); }
.kpi.accent .k { color: rgba(247,243,234,.7); }
.kpi.accent .v { color: var(--gold); }
.kpi.accent .d { color: rgba(247,243,234,.6); }

/* ---------- Card ---------- */
.acard-a {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
}
.acard-a > header {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap;
}
.acard-a > header h2 { font-size: var(--fs-sm); font-weight: var(--fw-sem); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.acard-a .inner { padding: var(--s-5); overflow-x: auto; }
.acard-a .inner.flush { padding: 0; }

/* ---------- Bảng ---------- */
.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.dtable th, .dtable td { padding: 11px var(--s-4); text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.dtable thead th {
  font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); font-weight: var(--fw-sem); background: #FAF8F3;
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.dtable td.n, .dtable th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable tbody tr:hover { background: #FCFAF5; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable .sub { font-size: var(--fs-2xs); color: var(--ink-soft); margin-top: 2px; display: block; }
.scrollbox { overflow: auto; max-height: 620px; }

/* ---------- Bộ lọc ---------- */
.filters { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.filters .input, .filters .select { min-height: 38px; width: auto; min-width: 180px; }

/* ---------- Cây phân tầng (B4) ---------- */
.tier { font-size: var(--fs-sm); }
.tier-node {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); padding: var(--s-4);
}
.tier-node + .tier-node { margin-top: var(--s-3); }
.tier-level-1 { margin-left: var(--s-6); border-left: 3px solid var(--gold-soft); }
.tier-level-2 { margin-left: calc(var(--s-6) * 2); border-left: 3px solid var(--sand); }
.tier-node .th { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.tier-node .th b { font-size: var(--fs-sm); font-weight: var(--fw-sem); }
.tier-vals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-3); }
.tier-val {
  font-size: var(--fs-2xs); font-family: var(--font-num);
  padding: 3px 9px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.tier-val.over { background: #FBF6E9; border-color: var(--gold); color: #6A5322; font-weight: var(--fw-sem); }

/* ---------- Kiểm duyệt (B3) ---------- */
.mod-item {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); padding: var(--s-4);
}
.mod-item + .mod-item { margin-top: var(--s-3); }
.mod-item.flagged { border-color: var(--risk); background: #FDF7F5; }
.mod-text {
  font-size: var(--fs-sm); line-height: 1.6; margin: var(--s-3) 0;
  padding: var(--s-3); background: var(--surface-2); border-radius: var(--r-sm);
}
mark.ban {
  background: var(--risk); color: #fff; padding: 0 4px; border-radius: 3px; font-weight: var(--fw-sem);
}
.mod-acts { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.tester {
  border: 2px dashed var(--gold); border-radius: var(--r-md);
  padding: var(--s-5); background: #FDFBF5;
}

/* ---------- Nhật ký (B5) ---------- */
.logrow-flagged { background: #FDF7F5 !important; }

/* ---------- Cohort (B6) ---------- */
.cohort-grid { overflow-x: auto; }
.cohort-cell {
  display: inline-block; min-width: 46px; text-align: center;
  padding: 5px 4px; border-radius: var(--r-xs);
  font-size: var(--fs-2xs); font-variant-numeric: tabular-nums; font-weight: var(--fw-sem);
}

/* ---------- Chip trạng thái commit ---------- */
.commit-bar { width: 110px; }

/* ---------- Trên mobile: xếp dọc ---------- */
@media (max-width: 980px) {
  .aside { padding: var(--s-4) 0; height: auto; }
  .aside nav { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 var(--s-3); }
  .aside .navlink { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; min-height: 40px; }
  .aside .navlink[aria-current="page"] { border-left: 0; border-bottom-color: var(--gold); }
  .aside .sect { display: none; }
  .abody { padding: var(--s-4); }
  .ahead { padding: var(--s-4); position: static; }
  .aside .navlink .n { margin-left: 4px; }
}
