.workspace-files {
  --file-line: #e1e3ec;
  --file-ink: #242636;
  --file-muted: #55596d;
  color: var(--file-ink);
}
.workspace-files .file-toolbar { margin: 14px 0 12px; }
.file-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.file-controls input[type="search"] { min-inline-size: min(100%, 220px); max-inline-size: 380px; flex: 1 1 235px; }
.file-controls select, .file-selected select { width: auto; max-width: 100%; }
.file-controls :is(select, input), .file-selected :is(select, button) { min-height: 36px; }
.workspace-files .file-table { border: 1px solid var(--file-line); border-radius: 9px; background: #fff; }
.file-grid { display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(95px, .29fr) minmax(100px, .23fr) minmax(65px, .14fr) 34px; align-items: center; gap: 12px; min-height: 60px; padding: 0 14px; }
.file-grid + .file-grid { border-top: 1px solid var(--file-line, #e1e3ec); }
.file-grid-head { min-height: 43px; color: var(--file-muted); font-size: 12px; background: #f6f6fb; border-radius: 9px 9px 0 0; }
.file-grid input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: #4f3be5; cursor: pointer; }
.file-grid:not(.file-grid-head):hover { background: #faf9ff; }
.file-grid:has(input:checked):not(.file-grid-head) { background: #f0edff; }
.file-grid.drop-ready, .file-grid.is-drop-target { background: #e9e4ff; }
.file-entry { display: flex; gap: 10px; min-width: 0; min-height: 48px; align-items: center; color: #282644; }
.file-entry > span { min-width: 0; }
.file-entry strong { display: block; overflow-wrap: anywhere; line-height: 1.35; font-weight: 650; font-size: 14px; }
.file-entry small, .file-owner small { display: block; color: var(--file-muted); font-size: 12px; line-height: 1.4; margin-top: 3px; }
.file-entry .workspace-icon { color: #5144b0; }
.workspace-icon { flex: none; vertical-align: middle; }
.file-grid time, .file-grid > span:nth-child(5) { color: var(--file-muted, #55596d); font-variant-numeric: tabular-nums; font-size: 12px; }
.file-row-action, .file-close { display: inline-grid; place-items: center; min-width: 34px; min-height: 36px; color: #3c3a56; background: transparent; border: 1px solid transparent; border-radius: 7px; font: inherit; text-decoration: none; cursor: pointer; }
.file-row-action:hover, .file-close:not(:disabled):not(.is-disabled):hover { background: #ebebf6; color: #3525a8; }
.file-close:disabled, .file-close.is-disabled { color: #777b8e; opacity: .42; cursor: default; }
.file-selected { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: #f4f1ff; border: 1px solid #ded7fa; border-radius: 9px; margin-bottom: 10px; padding: 8px 12px; }
.file-selected strong { padding-right: 8px; }
.file-pages { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 12px; color: #55596d; }
.file-empty { padding: 58px 18px; text-align: center; background: #fff; border: 1px solid #e1e3ec; border-radius: 9px; }
.file-empty h2 { font-size: 16px; margin: 0 0 5px; }
.file-empty p { margin: 0; color: #55596d; }
.file-empty a { text-decoration: underline; text-underline-offset: 2px; }
.file-drop-indicator { position: fixed; z-index: 60; pointer-events: none; inset: 14px; display: grid; place-content: end center; color: #3525a8; border: 2px dashed #786bc9; border-radius: 12px; background: #eeebfa55; font-weight: 700; padding: 20px; }
.file-upload-dialog { display: block; position: fixed; inset: 0; width: min(100% - 26px, 680px); max-height: min(85dvh, 770px); overflow: auto; border: 1px solid #dedee8; border-radius: 12px; padding: 0; color: #242636; background: #fff; }
.file-upload-dialog:not([open]) { display: none; }
.file-upload-dialog::backdrop { background: #17132454; }
.file-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e1e3ec; }
.file-dialog-head h2 { margin: 0; font-size: 18px; }
.workspace-upload-page { max-width: 740px; }
.upload-panel { padding: 16px 20px 12px; }
.upload-destination { margin: 0 0 12px; color: #55596d; }
.upload-choices { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.upload-choices label { display: grid; gap: 4px; }
.upload-choices select { width: auto; }
.upload-target { display: grid; gap: 6px; padding: 25px 12px; text-align: center; border: 1px dashed #9187ca; border-radius: 8px; margin-top: 14px; background: #f6f4fd; }
.upload-target small, .upload-guidance, .upload-item small { color: #55596d; }
.upload-guidance { font-size: 13px; margin: 9px 0 12px; }
.upload-items { list-style: none; padding: 0; margin: 0; max-height: min(35dvh, 310px); overflow: auto; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; padding: 8px 0; gap: 5px 9px; border-bottom: 1px solid #e1e3ec; overflow-wrap: anywhere; }
.upload-item strong { font-size: 13px; }
.upload-item progress { width: 100%; grid-column: 1 / -1; height: 7px; accent-color: #4f3be5; }
.upload-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 12px 0 0; }
.upload-controls p { margin: 0; }
.file-upload-mini { position: fixed; bottom: 80px; right: 18px; z-index: 50; }
.file-preview-page { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #f0f0f6; color: #242636; }
.file-preview-page, .file-preview-page *, .workspace-files *, .workspace-editor * { box-sizing: border-box; }
.file-view-header { position: relative; z-index: 3; display: flex; flex: 0 0 auto; gap: 10px; align-items: center; min-width: 0; padding: 9px 15px; background: #fff; border-bottom: 1px solid #dcdeea; }
.file-view-title { min-width: 0; flex: 1 1 auto; }
.file-view-title h1 { font-size: 16px; line-height: 1.25; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #242636; }
.file-view-title small { margin-top: 2px; display: block; color: #55596d; font-size: 12px; }
.file-view-nav, .file-view-actions { display: flex; gap: 4px; flex: 0 0 auto; align-items: center; }
.file-view-actions .button { min-height: 36px; }
.file-download-top { display: inline-flex; align-items: center; gap: 5px; }
.file-info-menu summary { list-style: none; cursor: pointer; }
.file-info-menu summary::-webkit-details-marker { display: none; }
.file-info-panel { position: absolute; top: calc(100% + 8px); right: 14px; width: min(100% - 28px, 335px); max-height: calc(100dvh - 108px); overflow: auto; padding: 18px; color: #242636; background: #fff; border: 1px solid #dcdce8; border-radius: 12px; box-shadow: 0 12px 28px #20194b1d; }
.file-info-panel h2 { font-size: 16px; margin: 0 0 8px; }
.file-info-panel dl { display: grid; grid-template-columns: 70px 1fr; gap: 8px; margin: 0 0 12px; }
.file-info-panel dt { color: #55596d; }
.file-info-panel dd { margin: 0; overflow-wrap: anywhere; }
.file-info-panel form { display: grid; gap: 8px; padding-top: 12px; margin-top: 12px; border-top: 1px solid #e1e3ec; }
.file-info-panel label { display: grid; gap: 4px; }
.preview-notice { flex: none; margin: 5px 12px; padding: 7px 10px; }
.file-view-mode { display: flex; justify-content: center; gap: 18px; background: #fff; border-bottom: 1px solid #e1e3ec; padding: 7px; flex: none; }
.file-view-mode [aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; font-weight: 700; }
.file-preview-canvas, .file-full-reader, .pdf-shell { flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%; }
.file-full-reader { display: block; border: 0; background: #fff; }
.file-preview-canvas { display: grid; place-items: center; padding: 16px; overflow: auto; }
.file-preview-canvas :is(img, video) { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-preview-canvas audio { width: min(100%, 580px); }
.file-text { width: min(100%, 920px); align-self: start; background: #fff; border: 1px solid #e1e3ec; padding: 16px; }
.file-text pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.pdf-shell { display: flex; flex-direction: column; }
.file-pdf-tools { position: relative; z-index: 2; display: flex; flex-wrap: wrap; flex: 0 0 auto; gap: 8px; justify-content: center; align-items: center; padding: 6px 12px; background: #fbfbff; border-bottom: 1px solid #dcdeea; }
.pdf-tool-group { display: flex; align-items: center; gap: 5px; margin: 0; }
.pdf-page-control { display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.file-pdf-tools input[data-page-number] { width: 69px; min-width: 0; }
.file-pdf-tools :is(input, select) { padding: 6px 8px; min-height: 35px; width: auto; }
.file-pdf-tools input[type="search"] { width: clamp(115px, 17vw, 200px); }
.file-pdf-tools output { min-width: 45px; color: #55596d; font-size: 12px; text-align: center; }
.pdf-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.pdf-scroll { position: absolute; inset: 0; overflow: auto; background: #eeeef5; }
.pdf-scroll .pdfViewer { padding: 10px 0 18px; }
.pdf-scroll .pdfViewer .page { border: 0; outline: 1px solid #dbdce5; margin: 0 auto 12px; }
.pdf-loading { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 6px; background: #eeeef5; text-align: center; padding: 14px; }
.pdf-loading p { color: #55596d; margin: 0; }
.version-panel { max-width: 740px; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-bottom: 1px solid #e1e3ec; }
.version-row small { display: block; margin-top: 3px; color: #55596d; }
.version-upload { display: grid; gap: 8px; padding: 16px; }
.version-upload button { justify-self: start; }
.file-trash-row { grid-template-columns: 20px minmax(0, 1fr) minmax(80px, .35fr) minmax(100px, .35fr); }
.workspace-editor { margin: 0 0 22px; padding: 16px; max-width: 1020px; }
.workspace-editor :is(input, textarea) { width: 100%; }
.workspace-editor label { display: block; margin-bottom: 4px; }
.workspace-editor textarea { min-height: 300px; resize: vertical; line-height: 1.65; }
.editor-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.editor-groups [aria-current="page"] { color: #382e9d; background: #f1edff; }
.editor-fields { display: grid; gap: 6px; }
.editor-fields label { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: center; gap: 8px; }
.editor-fields input[readonly] { color: #55596d; background: #f4f5f8; }
.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; position: sticky; bottom: 0; padding: 9px 0; background: #fff; }
.file-preview-page :focus-visible, .workspace-files :focus-visible, .file-upload-dialog :focus-visible, .workspace-editor :focus-visible { outline: 2px solid #4f3be5; outline-offset: 2px; }
.workspace-files [hidden], .upload-panel [hidden], .file-preview-page [hidden] { display: none !important; }

@media (max-width: 760px) {
  .workspace-files .file-toolbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .file-controls input[type="search"] { min-inline-size: 100%; max-inline-size: none; }
  .file-grid { grid-template-columns: 20px minmax(0, 1fr) 64px 32px; padding-inline: 8px; gap: 6px; }
  .file-grid > :is(:nth-child(3), :nth-child(4)) { display: none; }
  .file-trash-row { grid-template-columns: 20px minmax(0, 1fr); }
  .file-view-header { flex-wrap: wrap; gap: 5px; padding: 7px 8px; }
  .file-view-title { flex-basis: calc(100% - 46px); }
  .file-view-nav { margin-inline-start: 3px; }
  .file-view-actions { margin-inline-start: auto; }
  .file-pdf-tools { gap: 4px; padding: 4px; }
  .file-pdf-tools input[type="search"] { width: 125px; }
  .upload-panel { padding: 13px; }
  .upload-item { grid-template-columns: minmax(0, 1fr) auto; }
  .upload-item button { grid-column: 2; grid-row: 1; }
  .upload-item small { grid-column: 1 / -1; }
  .version-row { flex-wrap: wrap; }
}

@media (min-width: 1024px) {
  .pdf-scroll { inset-inline: max(0px, calc((100vw - 1170px) / 2)); }
}

@view-transition { navigation: none; }

.knowledge-nav a[aria-current="page"] {
  color: #4931d8;
  border-bottom-color: #4931d8;
  font-weight: 650;
}
