.doc-tab, .doc-detail { color: var(--ink, #272822); }
.doc-tools, .doc-filters, .doc-text, .doc-subtitle, .doc-index-item > div { display: flex; }
.doc-tools { align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin: 24px 0 16px; }
.doc-tools h2, .doc-detail h2, .doc-empty h3 { margin: 0; font-size: 17px; line-height: 1.5; }
.doc-count { color: var(--muted, #66685c); font: 500 13px/1.5 ui-monospace, monospace; margin-left: 5px; }
.doc-filters { align-items: center; flex-wrap: wrap; gap: 8px; }
.doc-search { display: flex; align-items: center; gap: 6px; padding: 0 10px; min-height: 36px; border: 1px solid var(--line, #deded5); border-radius: 6px; background: var(--surface, #fff); }
.doc-search svg { width: 16px; height: 16px; color: var(--muted, #6b6d60); }
.doc-search input { width: 140px; min-width: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px; outline: none; }
.doc-search:focus-within { outline: 2px solid var(--accent, #b54b26); outline-offset: 1px; }
.doc-filters select { min-height: 36px; font-size: 13px; }
.doc-rows { overflow: hidden; border: 1px solid var(--line, #deded5); border-radius: 10px; background: var(--surface, #fff); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.doc-table thead { background: #f6f6f1; color: #686a5f; }
.doc-table th { font-size: 12px; font-weight: 500; white-space: nowrap; padding: 13px 16px; }
.doc-table td { border-top: 1px solid var(--line, #deded5); padding: 13px 16px; }
.doc-table td:first-child { width: 49%; }
.doc-table tr[data-document-id] { cursor: pointer; }
.doc-table .doc-row-selected td { background: #f8f2e8; }
.doc-table th:last-child, .doc-table td:last-child { text-align: right; }
.doc-table .doc-enabled { text-align: center; }
.doc-table td:last-child { width: 1%; }
.doc-row-actions { display: flex; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.doc-open { display: inline-flex; align-items: center; gap: 11px; text-align: left; max-width: 100%; color: inherit; font: inherit; border: 0; background: transparent; padding: 0; cursor: pointer; }
.doc-file-mark { display: inline-flex; align-items: flex-end; justify-content: center; position: relative; min-width: 35px; height: 39px; box-sizing: border-box; padding: 0 3px 6px; border: 1px solid #cdd4ca; border-radius: 5px; background: #edf2ea; color: #59704b; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .03em; }
.doc-file-mark::before { position: absolute; content: ''; top: 6px; left: 7px; width: 13px; height: 2px; background: currentColor; opacity: .4; box-shadow: 0 4px currentColor; }
.doc-file-mark.file-pdf { background: #fff1e9; color: #9d5039; border-color: #e8cebf; }
.doc-file-mark.file-docx { background: #edf1f6; color: #526c91; border-color: #ced7e3; }
.doc-file-mark.file-txt { background: #f4efe5; color: #7b684e; border-color: #dfd7c8; }
.doc-text { flex-direction: column; gap: 5px; min-width: 0; }
.doc-text strong { line-height: 1.4; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.doc-text small, .doc-date, .doc-library-name, .doc-index-item small { color: var(--muted, #66685c); font-size: 12px; }
.doc-text small { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.doc-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #5d645b; white-space: nowrap; }
.doc-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #9a9c90; }
.doc-state.is-ready { color: #37664c; }
.doc-state.is-ready::before { background: #55856a; }
.doc-state.is-partial { color: #8b5b24; }
.doc-state.is-partial::before { background: #c28339; }
.doc-switch { display: inline-flex; box-sizing: border-box; align-items: center; width: 30px; height: 17px; padding: 2px; border: 0; border-radius: 20px; vertical-align: middle; background: #9b9e93; cursor: pointer; }
.doc-switch > span { width: 13px; height: 13px; border-radius: 50%; background: #fff; }
.doc-switch[aria-checked="true"], .doc-switch[data-enabled-state="true"] { background: #4b715c; }
.doc-switch[aria-checked="true"] > span, .doc-switch[data-enabled-state="true"] > span { margin-left: auto; }
.doc-table button.doc-switch { position: relative; }
.doc-table button.doc-switch::after { content: ''; position: absolute; inset: -12px -6px; }
.doc-empty { text-align: center; padding: 44px 12px; color: var(--muted, #66685c); }
.doc-empty .btn { margin-top: 14px; }
.document-drawer { --drawer-width: 820px; }
.doc-detail { min-width: 0; padding: 18px 22px 24px; }
.doc-drawer-meta { display: flex; align-items: baseline; gap: 12px; margin-bottom: 15px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.doc-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.doc-info, .doc-index, .doc-reading { min-width: 0; padding: clamp(16px, 2.2vw, 28px); }
.doc-reading-head, .doc-subtitle, .doc-index-item > div { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.doc-reading-head { flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.doc-reading-head > span, .doc-pagination > span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.doc-pieces, .doc-parents, .doc-children { list-style: none; padding: 0; margin: 0; }
.doc-pieces li { padding: 17px 0; }
.doc-pieces li:last-child { padding-bottom: 0; }
.doc-pieces li + li { border-top: 1px solid var(--line); }
.doc-pieces h3 { color: var(--muted); font-size: 12px; font-weight: 600; }
.doc-pieces p, .doc-parent-body p, .doc-excerpt { max-width: 74ch; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.85; }
.doc-pieces p { margin-top: 7px; }
.doc-piece-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-piece-head > .btn, .doc-parent-row > .btn { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.doc-parent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; }
.doc-parent-row > .btn { margin-top: 11px; }
.doc-parents > li + li { border-top: 1px solid var(--line); }
.doc-parent > summary { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 54px; padding: 8px 4px; border-radius: 5px; cursor: pointer; }
.doc-parent > summary::-webkit-details-marker { display: none; }
.doc-parent > summary > .ic { width: 14px; color: var(--muted); }
.doc-parent[open] > summary > .ic { transform: rotate(90deg); color: var(--accent); }
.doc-parent > summary strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-parent > summary:hover strong { color: var(--accent); }
.doc-parent-number, .doc-parent-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.doc-parent-body { margin: 0 4px 20px; }
.doc-parent-body h3, .doc-children h4 { color: var(--muted); font-size: 12px; margin: 0 0 5px; }
.doc-parent-body > p { margin: 0; }
.doc-parent-body > .doc-no-children { margin-top: 12px; color: var(--muted); font-size: 13px; }
.doc-children { margin-top: 16px; border-inline-start: 2px solid #d3bfaf; padding-inline-start: 14px; }
.doc-children li + li { margin-top: 15px; }
.doc-excerpt { padding-top: 16px; }
.doc-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.doc-pagination .btn:disabled { cursor: default; }
.doc-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 12px 14px; margin: 18px 0 0; font-size: 13px; }
.doc-meta dt { color: var(--muted); }
.doc-meta dd { margin: 0; overflow-wrap: anywhere; }
.doc-index-item { margin: 13px 0 0; font-size: 13px; }
.doc-index-item progress { width: 100%; height: 5px; display: block; margin-top: 7px; appearance: none; background: #e8e9e2; border: 0; border-radius: 5px; overflow: hidden; }
.doc-index-item progress::-webkit-progress-bar { background: #e8e9e2; }
.doc-index-item progress::-webkit-progress-value { background: #69816b; }
.doc-index-item progress::-moz-progress-bar { background: #69816b; }
.doc-error { color: #963d25; font-size: 13px; }
.doc-demo { margin-top: 14px; color: var(--muted, #66685c); font-size: 12px; }
.doc-demo summary { cursor: pointer; width: fit-content; }
.doc-demo label { display: flex; gap: 6px; align-items: center; margin-top: 7px; }
.doc-tab :is(a, button):focus-visible, .doc-detail :is(a, button, summary, h2):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.doc-parent > summary:focus-visible { outline-offset: -2px; }

@media (max-width: 600px) {
    .doc-detail { padding-inline: 16px; }
    .doc-summary { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
}

@media (max-width: 420px) {
    .doc-parent > summary { gap: 5px; padding-inline: 0; }
}

@media (max-width: 760px) {
    .doc-table .doc-date { display: none; }
    .doc-table td, .doc-table th { padding: 12px 9px; }
    .doc-table td:first-child { width: auto; }
    .doc-table .doc-file-mark { min-width: 30px; }
    .doc-table .doc-open { gap: 7px; }
    .doc-search input { width: 114px; }
}

@media (max-width: 420px) {
    .doc-table :is(td, th) { padding-inline: 7px; }
    .doc-table .doc-state { white-space: normal; }
    .doc-table .doc-state::before { flex: none; }
    .doc-row-actions { gap: 4px; }
    .doc-row-actions > .btn { padding-inline: 5px; }
}

@media (max-width: 360px) {
    .doc-row-actions { flex-direction: column; }
    .doc-row-actions > .btn { min-height: 30px; }
}
