/* Trang Cây thư mục (BRIEF-07B) — chỉ bố cục riêng; màu/token lấy từ app.css. */

.sect { margin-bottom: 14px; padding: 0; overflow: hidden; }

.ch {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--tk);
}
.ch b { font-size: 12.5px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); }
.ch .n { margin-left: auto; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- banner ---------- */
.banner {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; margin-bottom: 14px;
  border: 1px solid rgba(178, 80, 0, .35); border-radius: 10px;
  background: rgba(178, 80, 0, .08);
  font-size: 12.5px; line-height: 1.45; color: var(--ink-2);
}
.banner b { color: var(--warn); font-weight: 600; }
.banner.muted { background: var(--fill); border-color: var(--line); color: var(--ink-3); }
.banner.muted b { color: var(--ink-3); }
@media (prefers-color-scheme: dark) {
  .banner { border-color: rgba(255, 159, 10, .40); background: rgba(255, 159, 10, .10); }
  .banner.muted { border-color: var(--line); background: var(--fill); }
}

/* ---------- một dòng đề xuất ---------- */
.p { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line); }
.p:first-child { border-top: 0; }
.pbody { min-width: 0; flex: 1 1 auto; }
.pname { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.pmeta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.pmeta .dot { margin: 0 5px; }
.psamples { font-size: 11px; color: var(--ink-3); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; }
.psamples code { font: inherit; color: var(--ink-2); margin-left: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border: 0; border-radius: 7px;
  background: var(--accent-soft); color: var(--ink);
  font: inherit; font-size: 11.5px; line-height: 1.3; cursor: pointer;
  transition: background 160ms var(--ease), transform 120ms var(--ease);
}
.chip:hover { background: var(--fill-2); }
.chip:active { transform: scale(.97); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip .cx { color: var(--ink-3); font-size: 13px; line-height: 1; }
.chip.add { border: 1px dashed var(--line-strong); background: transparent; color: var(--ink-3); }
.chip.add:hover { color: var(--ink); background: var(--fill); }
.addi {
  height: 26px; width: 132px; max-width: 100%;
  padding: 0 8px; border: 1px solid var(--accent); border-radius: 7px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 11.5px; outline: none;
}

.asg { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 11.5px; line-height: 1.4; color: var(--ink-2); cursor: pointer; }
.asg input { width: 15px; height: 15px; accent-color: var(--accent); flex: none; }
.asg b { color: var(--ink); font-weight: 600; }

.pacts { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }
.perr { font-size: 11.5px; line-height: 1.35; color: var(--down); max-width: 180px; }

/* nút "Gán N domain vào Parent › Sub" dài hơn "Tạo nhóm": xuống dòng thay vì tràn ngang */
.p[data-kind="assign"] .btn.pri {
  height: auto; min-height: 34px; padding-top: 7px; padding-bottom: 7px;
  max-width: 360px; white-space: normal; text-align: left; line-height: 1.3;
}

/* nút chính: chiều rộng tối thiểu + spinner tuyệt đối nên lúc chờ không đẩy layout */
.btn.pri { position: relative; min-width: 116px; padding-right: 26px; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; right: 9px; top: 50%;
  width: 11px; height: 11px; margin-top: -5.5px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: m-spin 700ms linear infinite;
}
@keyframes m-spin { to { transform: rotate(360deg); } }
.p.gone { opacity: 0; transform: translateY(-4px); transition: opacity 220ms var(--ease); }

/* ---------- cây hiện tại ---------- */
.tree { padding: 2px 14px 10px; }
.trow { border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.tbig { display: flex; align-items: center; gap: 8px; padding: 9px 0; font-size: 13.5px; font-weight: 600; }
.tbig .c { font-size: 11px; font-weight: 400; color: var(--ink-3); }
.tagnew {
  margin-left: auto; padding: 2px 6px; border-radius: 5px;
  background: var(--up-soft); color: var(--up);
  font-size: 10px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.del { padding: 0 2px; border: 0; background: none; font: inherit; font-size: 11.5px; color: var(--down); cursor: pointer; }
.del:hover { text-decoration: underline; }
.del:focus-visible, .chipdel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.subs { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 0 10px; }
.subs .chip { background: var(--fill); color: var(--ink-2); cursor: default; }
.subs .chip.custom { background: var(--accent-soft); color: var(--ink); }
.chipdel { padding: 0; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.chipdel:hover { color: var(--down); }

/* ---------- cài đặt ---------- */
.set { padding: 12px 14px 14px; }
.sel {
  height: 34px; max-width: 100%; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; cursor: pointer;
}
.sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.set .note b { color: var(--ink); font-weight: 600; }

.note { font-size: 12px; line-height: 1.5; color: var(--ink-3); margin: 8px 2px 0; }
.pe { margin: 12px 14px 14px; }
.state { font-size: 12px; line-height: 1.45; color: var(--ink-2); margin: 8px 2px 0; }
.state.bad { color: var(--down); }

/* ---------- máy hẹp: vùng chạm ≥ 44px (BRIEF-07B §Motion) ---------- */
@media (max-width: 560px) {
  .p { flex-wrap: wrap; }
  .pbody { flex: 1 1 100%; }
  .pacts { width: 100%; justify-content: flex-end; margin-top: 10px; }
  .perr { flex: 1 1 100%; max-width: none; text-align: right; }
  .p[data-kind="assign"] .btn.pri { max-width: 100%; }
}
@media (max-width: 520px) {
  .btn { height: 44px; padding: 0 14px; }
  .btn.pri { padding-right: 28px; }
  .chip { min-height: 44px; padding: 0 10px; font-size: 12px; }
  .addi { height: 44px; font-size: 12.5px; }
  .asg { min-height: 44px; font-size: 12px; }
  .asg input { width: 20px; height: 20px; }
  .del { min-height: 44px; min-width: 44px; padding: 0 8px; font-size: 12px; }
  .chipdel { width: 44px; height: 44px; font-size: 18px; }
  .sel { height: 44px; font-size: 13px; width: 100%; }
  .chips { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"]::after { animation: none; border-right-color: currentColor; opacity: .5; }
  .p.gone { transition: none; }
}
