/* Files (B16) — page layout only. Components, tokens, icons and themes come from lifeos.css («مِحْوَر»). */

.fl-page [hidden], .fl-upload [hidden] { display: none !important; }

/* screen-reader-only text and the real (focusable) file input inside its label */
.fl-sr, .fl-file-input {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; opacity: 0;
}

/* upload: dropzone, chooser, progress */
.fl-upload { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fl-drop { position: relative; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.fl-drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-soft-ink); }
.fl-drop .ic-24 { color: var(--ink-3); }
.fl-pick { position: relative; min-height: 0; padding: 0 4px; border: 0; background: none; color: var(--accent-soft-ink);
  text-decoration: underline; text-underline-offset: 3px; font-weight: 500; vertical-align: baseline; }
.fl-pick .ic { display: none; }
.fl-pick:hover { background: none; color: var(--accent); }
.fl-pick:focus-within, .fl-upload label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.fl-drop-row { margin-top: 6px; }
.fl-chosen { overflow-wrap: anywhere; }
.fl-upload-row { justify-content: flex-start; }
.fl-upload-row .field { flex: 1 1 240px; max-width: 520px; }
.fl-upload.compact { padding-top: 10px; border-top: 1px dashed var(--line); }
.fl-progress-name { font-weight: 500; font-size: 14px; }
.fl-upload-status:empty { display: none; }
.fl-upload-status { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fl-issues { margin-top: 4px; padding-inline-start: 18px; list-style: disc; }

/* one file line (also used inside notes and work items) */
.fl-line { align-items: center; }
.fl-line .t { font-size: 14.5px; }
.fl-line-acts { flex: none; }
.fl-kind { flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }

/* toolbar */
.fl-toolbar { gap: 10px 12px; }
.fl-search { max-width: 420px; }
.fl-usage { margin: 0; }

/* list ↔ selected file */
.fl-split { grid-template-columns: minmax(0, 1fr) 420px; }
.fl-tbl { min-width: 700px; }
.fl-name { display: inline; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: start; cursor: pointer; overflow-wrap: anywhere; }
.fl-name:hover { color: var(--accent-soft-ink); text-decoration: underline; text-underline-offset: 3px; }
.fl-grid .card { gap: 10px; }
.fl-aside { position: sticky; top: 16px; gap: 14px; }
.fl-aside .panel-h .h3 { min-width: 0; }
.fl-linked { display: flex; flex-direction: column; gap: 4px; }
.fl-linked li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: space-between; }
.btn.is-off { opacity: .5; pointer-events: none; }

/* preview from the file's own bytes */
.fl-preview { aspect-ratio: 4 / 3; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; text-align: center; color: var(--ink-3); padding: 12px; overflow: hidden; min-width: 0; }
.fl-preview-msg { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 32ch; }
.fl-preview-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.fl-preview audio { width: 100%; }
.fl-preview:has(.fl-preview-text) { aspect-ratio: auto; place-items: stretch; text-align: start; }
.fl-preview-text { max-height: 340px; overflow: auto; margin: 0; unicode-bidi: plaintext; text-align: start; }

/* light/detailed folds (open in «مفصّل», one click away in «خفيف») */
.w4b-fold > summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 6px 0; }
.w4b-fold[open] > summary { margin-bottom: 6px; }

@media (max-width: 1023px) {
  .fl-split { grid-template-columns: 1fr; }
  .fl-split[data-view="detail"] .fl-aside { order: -1; position: static; }
}
@media (max-width: 640px) {
  .fl-page .btn, .fl-page .seg button, .fl-page .chip-btn, .fl-upload .btn, .fl-line .btn { min-height: 44px; }
  .fl-page .btn-icon.btn-sm { width: 44px; }
  .fl-page .input, .fl-page .select, .fl-page .search input { font-size: 16px; }
  .fl-search { max-width: none; flex: 1 1 100%; }
  .fl-line { flex-wrap: wrap; }
  .fl-line-acts { width: 100%; justify-content: flex-start; }
  .w4b-fold > summary { min-height: 44px; display: flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .fl-drop { transition: none; }
}
