/* Trang Thư viện tài liệu. Màu lấy từ biến của shell-v2.css nên đi theo nền sáng, tối. */
body.tl-page { margin: 0; background: var(--v2-bg); color: var(--v2-fg); font: 400 15px/1.5 var(--v2-font); }
.tl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tl-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--v2-surface); border-bottom: 1px solid var(--v2-line); }
.tl-brand { display: flex; align-items: center; gap: 10px; color: var(--v2-fg); text-decoration: none; flex: none; }
.tl-brand img { border-radius: 8px; }
.tl-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.tl-brand strong { font-size: 15px; }
.tl-brand small { color: var(--v2-muted); font-size: 12px; }
.tl-search { display: flex; gap: 8px; flex: 1; max-width: 640px; margin: 0 auto; }
.tl-search input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--v2-line-2); border-radius: 8px; background: var(--v2-card); color: var(--v2-fg); font: inherit; }
.tl-search input:focus-visible, .tl-page select:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 1px; }
.tl-top-right { display: flex; align-items: center; gap: 12px; flex: none; }
.tl-link { color: var(--v2-accent); font-weight: 500; text-decoration: none; }
.tl-link:hover { text-decoration: underline; }
.tl-back { flex: none; font-size: 14px; white-space: nowrap; }
.tl-account { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--v2-muted); max-width: 200px; }
.tl-account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tl-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; max-width: 1400px; margin: 0 auto; padding: 20px; align-items: start; }
.tl-side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; }
.tl-side-panel { display: flex; flex-direction: column; gap: 12px; }
#tlFilterToggle { display: none; width: 100%; }
.tl-box { padding: 14px; background: var(--v2-card); border: 1px solid var(--v2-line); border-radius: 10px; }
.tl-box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tl-box h2 { margin: 0; font-size: 15px; }
.tl-text-btn { padding: 4px; border: 0; background: none; color: var(--v2-accent); font: inherit; font-size: 13px; cursor: pointer; }
.tl-field { display: block; margin: 0 0 12px; padding: 0; border: 0; }
.tl-field:last-child { margin-bottom: 0; }
.tl-field > span, .tl-field legend { display: block; margin-bottom: 4px; padding: 0; font-size: 13px; font-weight: 500; color: var(--v2-fg-2); }
.tl-field select { width: 100%; }
.tl-seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--v2-line-2); border-radius: 8px; overflow: hidden; }
.tl-seg label { position: relative; cursor: pointer; }
.tl-seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tl-seg span { display: flex; align-items: center; justify-content: center; min-height: 38px; font-size: 13px; color: var(--v2-fg-2); border-left: 1px solid var(--v2-line-2); }
.tl-seg label:first-child span { border-left: 0; }
.tl-seg input:checked + span { background: var(--v2-accent); color: #fff; font-weight: 600; }
.tl-seg input:focus-visible + span { outline: 2px solid var(--v2-accent); outline-offset: -3px; }

.tl-tree, .tl-tree ul { list-style: none; margin: 0; padding: 0; }
.tl-tree ul { padding-left: 14px; }
.tl-node { display: flex; align-items: stretch; border-radius: 6px; }
.tl-node[aria-current="true"] { background: var(--v2-accent-soft); }
.tl-node:hover { background: var(--v2-card-2); }
.tl-node[aria-current="true"]:hover { background: var(--v2-accent-soft); }
.tl-twist { flex: none; width: 28px; border: 0; background: none; color: var(--v2-muted); cursor: pointer; font-size: 11px; }
.tl-twist[aria-expanded="true"] { transform: rotate(90deg); }
.tl-twist[disabled] { visibility: hidden; }
.tl-folder { display: flex; flex: 1; min-width: 0; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 0; border: 0; background: none; color: var(--v2-fg); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.tl-folder span:first-child { overflow-wrap: anywhere; }
.tl-node[aria-current="true"] .tl-folder { color: var(--v2-accent); font-weight: 600; }
.tl-count { flex: none; color: var(--v2-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.tl-main { min-width: 0; }
.tl-crumbs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--v2-muted); margin-bottom: 6px; }
.tl-crumbs button { padding: 2px 4px; border: 0; background: none; color: var(--v2-accent); font: inherit; cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.tl-crumbs [aria-current] { color: var(--v2-fg); font-weight: 500; padding: 2px 4px; overflow-wrap: anywhere; }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.tl-head h1 { margin: 0; font-size: 22px; line-height: 1.3; overflow-wrap: anywhere; }
.tl-head p { margin: 0; color: var(--v2-muted); font-size: 14px; }
.tl-children { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tl-child { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; border: 1px solid var(--v2-line-2); border-radius: 8px; background: var(--v2-card); color: var(--v2-fg); font: inherit; font-size: 14px; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.tl-child:hover { border-color: var(--v2-accent); }

.tl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tl-card { display: flex; flex-direction: column; min-width: 0; background: var(--v2-card); border: 1px solid var(--v2-line); border-radius: 10px; }
.tl-card:hover { border-color: var(--v2-line-2); }
.tl-card-open { display: flex; flex: 1; gap: 12px; padding: 14px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 10px 10px 0 0; min-width: 0; }
.tl-card-open:focus-visible, .tl-child:focus-visible, .tl-folder:focus-visible, .tl-twist:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: -2px; }
.tl-badge { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 54px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.tl-badge--pdf { background: #c62828; }
.tl-badge--word { background: #1f5fbf; }
.tl-badge--ppt { background: #c8501e; }
.tl-badge--excel { background: #1d7a46; }
.tl-badge--audio { background: #7342ad; }
.tl-badge--video { background: #af375d; }
.tl-badge--archive { background: #64748b; }
.tl-tags { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 14px 12px; }
.tl-tag { border: 1px solid var(--v2-line); border-radius: 14px; padding: 3px 8px; font: inherit; font-size: 11px; color: var(--v2-fg); background: var(--v2-card-2); cursor: pointer; overflow-wrap: anywhere; text-align: left; max-width: 100%; }
.tl-tag:hover { border-color: var(--v2-accent); }
.tl-dialog .tl-tags { padding: 0 0 16px; }
.tl-report form { margin: 12px 0; }
.tl-card-text { min-width: 0; }
.tl-card-text h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tl-card-text p { margin: 0; color: var(--v2-muted); font-size: 12.5px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tl-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--v2-line); }
.tl-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-price--free { color: #17803d; }
html[data-ui-theme="dark"] .tl-price--free { color: #5fd38d; }

.tl-empty, .tl-error { padding: 32px 20px; text-align: center; background: var(--v2-card); border: 1px solid var(--v2-line); border-radius: 10px; }
.tl-empty p, .tl-error p { margin: 0 0 10px; }
.tl-more { display: flex; justify-content: center; padding: 18px 0 32px; }
.tl-skel { height: 138px; border-radius: 10px; background: var(--v2-card-2); }
.tl-tree-msg { margin: 0; color: var(--v2-muted); font-size: 13px; }

.tl-dialog { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-card); color: var(--v2-fg); }
.tl-dialog::backdrop { background: rgba(10, 18, 34, .5); }
.tl-dialog-body { padding: 20px; }
.tl-dialog h2 { margin: 0 0 12px; font-size: 18px; line-height: 1.35; overflow-wrap: anywhere; }
.tl-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0 0 16px; font-size: 14px; }
.tl-meta dt { color: var(--v2-muted); }
.tl-meta dd { margin: 0; overflow-wrap: anywhere; }
.tl-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.tl-dialog-price { margin-right: auto; font-size: 18px; }
.tl-hint { margin: 12px 0 0; font-size: 13px; color: var(--v2-muted); }
.tl-err { margin: 12px 0 0; color: #c62828; font-size: 14px; }
html[data-ui-theme="dark"] .tl-err { color: #ff9c9c; }
.tl-report { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--v2-line); }
.tl-report .tl-field input, .tl-report .tl-field textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--v2-line-2); border-radius: 8px; background: var(--v2-card); color: var(--v2-fg); font: inherit; }
.tl-toast { position: fixed; inset: auto auto 20px 50%; margin: 0; border: 0; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 8px; background: #16213a; color: #fff; font-size: 14px; z-index: 40; }

@media (max-width: 900px) {
  .tl-top { flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; position: static; }
  .tl-back { order: -1; flex-basis: 100%; }
  .tl-search { order: 3; flex-basis: 100%; max-width: none; }
  .tl-top-right { margin-left: auto; }
  .tl-layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; gap: 12px; }
  .tl-side { position: static; max-height: none; overflow: visible; }
  #tlFilterToggle { display: block; margin-bottom: 8px; }
  .tl-side-panel { display: none; }
  .tl-side-panel.is-open { display: flex; }
  .tl-grid { grid-template-columns: minmax(0, 1fr); }
  .tl-account span { display: none; }
}
/* Nhãn "thuộc bộ" trên thẻ tài liệu */
/* Bộ tài liệu: một thẻ cho cả bộ */
.tl-card--bundle { border-color: color-mix(in srgb, var(--v2-accent) 45%, var(--v2-line)); box-shadow: 3px 3px 0 -1px var(--v2-card), 3px 3px 0 0 var(--v2-line); }
.tl-badge--bundle { flex-direction: column; gap: 1px; background: #0f766e; }
.tl-badge--bundle small { font-size: 12px; font-weight: 700; opacity: .9; }
.tl-kicker { display: block; margin: 0 0 2px; color: var(--v2-accent); font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.tl-card-text .tl-bundle-facts { color: var(--v2-text, inherit); }
.tl-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.tl-card--bundle .tl-card-actions .v2-btn { text-decoration: none; }
.tl-card--bundle .tl-card-foot { flex-wrap: wrap; }
.tl-card--bundle .tl-price { white-space: nowrap; }
.tl-card--bundle .tl-card-actions { margin-left: auto; }
