.document-directory { container-type: inline-size; }
.document-breadcrumb { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-bottom: 11px; color: var(--quiet); font-size: 13px; overflow-wrap: anywhere; }
.document-breadcrumb span[aria-current] { color: var(--ink); font-weight: 650; }
.document-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.document-query { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; flex: 1; }
.document-query select { min-width: 112px; }
.document-search { display: flex; gap: 6px; align-items: end; }
.document-search input { width: min(280px, 100%); }
.document-search .btn { min-height: 38px; }
.document-folder-section > h2,.document-file-section > h2 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.document-folder-section + .document-file-section { margin-top: 23px; }
.document-cards,.document-folder-grid { grid-template-columns: minmax(0,1fr); }
.document-folder-grid { display: grid; gap: 11px; }
@container (min-width: 570px) {
  .document-cards,.document-folder-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container (min-width: 890px) {
  .document-cards,.document-folder-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
.document-folder-grid.is-list { grid-template-columns: minmax(0,1fr); gap: 6px; }
.document-folder-card { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px;
  min-height: 79px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease); }
.document-folder-open { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 12px; color: inherit; }
.document-folder-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.document-folder-card:hover,.document-folder-card:focus-within { border-color: #8bc4e1; background: #f3faff; }
.document-folder-grid.is-list .document-folder-card { min-height: 53px; padding-block: 7px; border-radius: 9px; }
.document-folder-label { min-width: 0; overflow-wrap: anywhere; }
.document-folder-label strong,.document-folder-label small { display: block; }
.document-folder-label strong { font-weight: 650; }
.document-folder-label small { margin-top: 2px; font-size: 12px; }
.document-folder-icon { display: grid; place-items: center; width: 43px; aspect-ratio: 1; flex: none; border-radius: 11px; background: #e8f4fb; color: #167aad; }
.document-folder-icon svg { width: 24px; height: 24px; fill: #b7e1f4; stroke-width: 1.4; }
.document-folder-grid.is-list .document-folder-icon { width: 34px; border-radius: 9px; }
.document-folder-grid.is-list .document-folder-icon svg { width: 20px; height: 20px; }

.document-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; cursor: default; }
.document-card h2 { margin: 1px 0 0; font-size: 19px; font-weight: 650; line-height: 1.35; }
.document-card h2 a { color: inherit; }
.document-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.document-card:focus-within { border-color: var(--case-mark); }
.document-card .data { margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.document-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.document-card-footer small { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.document-card-footer .btn { position: relative; min-height: 32px; padding: 5px 8px; flex-shrink: 0; }
.document-card-footer svg { width: 14px; height: 14px; }
.document-item-actions { display: flex; position: relative; gap: 5px; z-index: 1; }
.document-menu-trigger { position: relative; z-index: 1; min-width: 30px; min-height: 30px; padding: 4px 7px; }
.document-menu-trigger[aria-expanded="true"] { background: var(--ice); border-color: #8bc4e1; }
.document-context { position: fixed; z-index: 8; min-width: 164px; display: grid; gap: 2px; padding: 5px; border-radius: 11px;
  border: 1px solid #cddfe9; background: #fff; box-shadow: 0 12px 30px -12px #1f476866; }
.document-context [role="menuitem"] { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink); text-align: start; font-size: 13px; }
.document-context [role="menuitem"]:hover,.document-context [role="menuitem"]:focus-visible { outline: none; background: var(--ice); }
.document-context [role="menuitem"].is-danger { color: #913749; }
.document-context svg { width: 16px; height: 16px; }
.document-drop-hint { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 58px; margin-top: 16px;
  padding: 10px 14px; border: 1px dashed #a9c9da; border-radius: 12px; color: var(--quiet); font-size: 13px; text-align: center; }
.document-drop-hint svg { width: 16px; height: 16px; rotate: 180deg; }
.document-directory[data-drop-active] .document-drop-hint,.document-folder-card[data-drop-active] { background: #dff3ff;
  outline: 2px dashed #198ec3; outline-offset: -2px; color: var(--blue-dark); }
.document-icon { display: grid; place-items: center; width: 36px; aspect-ratio: 1; border-radius: 10px; color: #176895; background: #e6f3fa; flex: none; }
.document-icon[data-category="template"] { color: #4b5e91; background: #edf0fb; }
.document-icon[data-category="brand"] { color: #3e6b54; background: #e7f1e8; }
.document-icon[data-category="team"] { color: #835c32; background: #f6eee3; }
.document-current-row { background: var(--ice); }
.document-result-path { display: block; overflow-wrap: anywhere; }

.document-side { min-width: 0; }
.document-side-head { margin-bottom: 12px; }
.document-side-top { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-bottom: 13px; }
.document-title { display: flex; gap: 12px; align-items: start; }
.document-title .document-icon { width: 42px; }
.document-title h2 { margin-bottom: 3px; font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.folder-details-title { margin-bottom: 15px; }
.folder-details-title > .document-menu-trigger { margin-inline-start: auto; flex-shrink: 0; }
.document-location { display: flex; align-items: flex-start; gap: 6px; margin-top: 11px; font-size: 12px; overflow-wrap: anywhere; }
.document-location svg { width: 15px; height: 15px; }
.document-side .block { background: #f7fafc; padding: 14px; }
.document-side .block h2 { font-size: 16px; }
.document-tabs { gap: 3px; }
.document-tabs a { font-size: 13px; }
.document-actions { margin-top: 14px; }
.document-source { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; border-top: 1px solid var(--line); margin-top: 17px; padding-top: 14px; }
.document-source small,.document-source strong { display: block; }
.document-source strong { font-size: 13px; font-weight: 620; overflow-wrap: anywhere; }
.document-file-actions { justify-content: flex-end; gap: 6px; }
.document-file-actions .btn { white-space: nowrap; padding-inline: 8px; }
.document-file-actions svg { width: 14px; height: 14px; }
.document-viewer { width: min(970px, calc(100vw - 36px)); max-width: none;
  max-height: calc(100dvh - 36px); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: #fff; color: var(--ink); box-shadow: 0 24px 80px #163c5460; overflow: hidden; }
.document-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.document-viewer::backdrop { background: #102b40a3; }
.document-viewer-header { display: flex; justify-content: space-between; align-items: center; gap: 12px 18px;
  flex-wrap: wrap; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.document-viewer-header > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.document-viewer-body { overflow: auto; min-height: 0; background: #f4f8fb; }
.document-viewer-body > .empty { text-align: center; min-height: 120px; padding: 42px 16px; }
.document-viewer-body > img { display: block; max-width: 100%; max-height: 69dvh; object-fit: contain; margin: 0 auto; }
.document-viewer-body > iframe { display: block; width: 100%; height: 70dvh; border: 0; }
.document-viewer-text { min-height: 170px; max-height: 65dvh; overflow: auto; margin: 0; padding: 20px;
  background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.7 ui-monospace, monospace; }
.document-viewer-note { padding: 8px 20px; border-bottom: 1px solid var(--line); }
.project-files > .section-head { flex-wrap: wrap; }
.project-file-upload { display: grid; grid-template-columns: minmax(0,1fr) minmax(230px,.9fr); align-items: end;
  gap: 12px; margin-bottom: 10px; }
.project-file-destination { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 7px; }
.project-file-destination .document-menu-trigger { min-width: 37px; min-height: 38px; }
.project-file-drop { min-height: 47px; justify-content: space-between; margin: 0; text-align: left; }
.project-file-drop > span { flex: 1; }
.project-file-pick { position: relative; min-height: 31px; padding-block: 4px; cursor: pointer; }
.project-file-pick input { position: absolute; inset: 0; height: 100%; opacity: 0; cursor: pointer; }
.project-file-pick:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.project-file-row { grid-template-columns: minmax(0,1fr) auto; }
.project-file-info { display: flex; align-items: center; gap: 10px; }
.project-file-info strong,.project-file-info small { overflow-wrap: anywhere; }
.project-file-picker .section-head { margin-bottom: 15px; }
.project-file-choices { display: grid; gap: 5px; max-height: min(52vh,480px); overflow: auto; padding: 3px; }
.project-file-option { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: start;
  gap: 8px; padding: 10px 9px; background: #f7fafc; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.project-file-option:has(input:checked) { background: #eaf6fc; border-color: #acd6ed; }
.project-file-option input { width: auto; margin: 3px 0 0; accent-color: var(--blue); }
.project-file-option strong,.project-file-option small { display: block; overflow-wrap: anywhere; }
.project-file-choices [hidden] { display: none; }
.document-preview-note { margin-bottom: 14px; }
.document-form { gap: 12px; }
.document-form .document-actions { margin-top: 2px; }
.document-form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.document-file-source { display: grid; min-width: 0; margin: 0; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #f5f9fc; }
.document-file-source legend { color: var(--ink); font-size: 13px; font-weight: 650; padding: 0 5px; }
.document-file-source [hidden] { display: none; }
.document-source-options { display: flex; gap: 6px 13px; flex-wrap: wrap; }
.document-source-options label { display: flex; align-items: center; }
.document-source-options input { width: auto; accent-color: var(--blue); }
.document-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 951px) {
  .layout:has(.document-directory) .detail { position: sticky; top: 19px; }
}
@media (max-width: 950px) {
  .sidebar nav { min-width: 0; overflow-x: auto; }
  .sidebar nav a { white-space: nowrap; }
}
@media (max-width: 670px) {
  .document-search { flex-basis: 100%; }
  .document-search label { flex: 1; }
  .document-search input { width: 100%; }
  .layout:has(.document-directory) .top { flex-wrap: wrap; }
}
@media (max-width: 1200px) {
  .project-file-upload,.project-file-row { grid-template-columns: minmax(0,1fr); }
  .project-file-row .document-file-actions { justify-content: flex-start; }
}
