.wb-files .page-heading { align-items: center; }
.file-page-actions, .file-list-actions, .file-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-panel { overflow: hidden; }
.file-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
}
.file-list-heading h2 { font-size: 1.04rem; line-height: 1.35; }
.file-count { margin-top: 3px; color: var(--muted); font-size: .83rem; font-variant-numeric: tabular-nums; }
.file-count:empty { display: none; }
.file-search {
  display: flex;
  align-items: center;
  position: relative;
  width: min(100%, 250px);
  color: var(--muted);
}
.file-search > svg { position: absolute; left: 11px; pointer-events: none; }
.file-search input { width: 100%; padding: 7px 10px 7px 35px; min-height: 38px; font-size: .9rem; }
.file-reload { height: 38px; width: 38px; flex: 0 0 38px; }
.file-feedback {
  padding: 9px 12px;
  border: 1px solid #c6e8d9;
  border-radius: 8px;
  margin: 0 0 12px;
  background: #eefaf4;
  color: #156148;
  font-size: .89rem;
  overflow-wrap: anywhere;
}
.file-feedback-error { background: #fff4e4; border-color: #f4ddbc; color: #874719; }
.file-table-scroll { overflow: auto; }
.file-table tbody :is(th, td) { border-top: 1px solid #e9edf4; }
.file-table .file-actions-cell { text-align: right; }
.file-name-stack {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  text-align: left;
  min-width: 0;
}
.file-name-link, .file-name-static {
  display: block;
  max-width: min(32ch, 33vw);
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: .89rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.file-name-link { background: none; border: 0; color: var(--brand); }
.file-name-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.file-type-icon, .file-empty-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 8px;
  background: #eef0f6;
  color: #526581;
}
.file-type-icon.image { background: #eaf0ff; color: #405cc3; }
.file-type-icon.pdf { background: #fff0f1; color: #a33650; }
.file-type-icon.text { background: #e9f6f1; color: #087a61; }
.file-kind { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; font-weight: 500; line-height: 1.3; }
.file-mobile-size { display: none; }
.file-row-actions { justify-content: flex-end; gap: 6px; }
.file-action-button { min-height: 32px; gap: 5px; padding: 4px 8px; font-size: .81rem; }
.file-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 180px;
  padding: 18px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.file-empty-icon { width: 43px; height: 43px; border-radius: 10px; color: var(--brand); background: #efedff; }
.file-empty p { color: var(--muted); font-size: .87rem; line-height: 1.5; overflow-wrap: anywhere; }
.file-preview-dialog {
  width: min(60rem, calc(100% - 26px));
  max-width: none;
  max-height: 92dvh;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 25px 70px #10172e45;
}
.file-preview-dialog::backdrop { background: #171c36a3; }
.file-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.file-preview-header h2 { font-size: 1.1rem; overflow-wrap: anywhere; }
.file-preview-header p { margin-top: 4px; color: var(--muted); font-size: .82rem; }
.file-preview-content { min-width: 0; padding: 12px; background: #f6f8fc; }
.file-preview-content img {
  display: block;
  max-width: 100%;
  max-height: min(67dvh, 54rem);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}
.file-preview-content iframe {
  display: block;
  width: 100%;
  height: min(68dvh, 56rem);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.file-preview-content pre {
  max-height: min(64dvh, 48rem);
  min-height: 110px;
  margin: 0;
  padding: 13px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font: .9rem / 1.6 var(--font-mono, ui-monospace, "SFMono-Regular", Consolas, monospace);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.file-preview-content .file-empty { border: 0; }
.file-preview-note { margin: 0 0 8px; color: var(--muted); font-size: .82rem; }
.file-preview-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.file-preview-footer:empty { display: none; }
@media (max-width: 860px) {
  .file-table .file-wide-col { display: none; }
  .file-mobile-size { display: inline; }
  .file-name-link, .file-name-static { max-width: min(38ch, 36vw); }
}
@media (max-width: 480px) {
  .wb-files .page-heading { align-items: flex-start; gap: 8px; }
  .file-page-actions > .button { min-height: 34px; padding: 5px 8px; font-size: .83rem; }
  .file-list-heading { align-items: flex-start; flex-direction: column; padding: 12px; }
  .file-list-actions { width: 100%; }
  .file-search { width: auto; flex: 1; }
  .file-table :is(th, td):first-child { padding-left: 11px; }
  .file-table :is(th, td):last-child { padding-right: 11px; }
  .file-name-link, .file-name-static { max-width: min(38ch, 43vw); }
  .file-row-actions .file-action-button { width: 32px; padding: 3px; }
  .file-row-actions .file-action-button span { display: none; }
  .file-preview-header, .file-preview-footer { padding-inline: 11px; }
}
