/* Files widget (js/files.js) — content-adaptive upload / list / download / version surface mounted
 * into CRM detail panes (clients / subs / vendors). Prefix fu-. Tokens only — no raw hex. */

.fu-widget { margin-top: 4px; }

/* header — mirrors the shared .sect section-heading rhythm, plus the view toggle + Upload action */
.fu-head { display: flex; align-items: center; gap: 10px; margin: 16px 0 7px; }
.fu-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--color-text-tertiary); font-weight: 600; }
.fu-count { color: var(--color-text-tertiary); font-weight: 400; }
.fu-upload-btn { margin-left: auto; }

/* list/grid segmented toggle */
.fu-viewtoggle { display: inline-flex; border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-md); overflow: hidden; }
.fu-vt { background: transparent; border: 0; color: var(--color-text-tertiary); font-family: inherit; font-size: 10px; padding: 2px 8px; cursor: pointer; transition: background .12s, color .12s; }
.fu-vt + .fu-vt { border-left: 1px solid var(--color-border-secondary); }
.fu-vt:hover { color: var(--color-text-secondary); }
.fu-vt.active { background: var(--accent-dim); color: var(--color-text-primary); }

/* body doubles as the drag-and-drop zone */
.fu-body { border: 1px dashed var(--color-border-tertiary); border-radius: var(--border-radius-md); padding: 4px 6px; transition: border-color .12s, background .12s; }
.fu-widget.fu-dragover .fu-body { border-color: var(--accent); background: var(--accent-dim); }

.fu-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 12px; border-bottom: 1px solid var(--color-border-tertiary); }
.fu-row:last-child { border-bottom: 0; }
.fu-row.open { border-bottom: 0; }

/* left-side type icon / image thumbnail. The inline SVG sits at 16px; when a thumbnail resolves
 * (.has-img) the <img> covers it. Fixed 24px box keeps rows aligned regardless of type. */
.fu-icon { position: relative; flex: 0 0 auto; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--color-text-tertiary); border-radius: var(--border-radius-md); background: var(--surface-2); overflow: hidden; }
.fu-icon svg { width: 15px; height: 15px; }
.fu-icon[data-type="pdf"] { color: var(--color-text-danger); }
.fu-icon[data-type="xls"] { color: var(--color-text-success); }
.fu-icon[data-type="doc"] { color: var(--color-text-info); }
.fu-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .18s; }
.fu-icon.has-img { background: var(--surface-3); }
.fu-icon.has-img .fu-thumb { opacity: 1; }

.fu-name { background: transparent; border: 0; padding: 2px 0; color: var(--color-text-primary); font-family: inherit; font-size: 12px; cursor: pointer; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.fu-name:hover { color: var(--accent); text-decoration: underline; }
.fu-name-static { color: var(--color-text-secondary); font-size: 12px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fu-meta { color: var(--color-text-tertiary); font-size: 11px; white-space: nowrap; }

.fu-act { background: transparent; border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-md); color: var(--color-text-secondary); font-family: inherit; font-size: 10px; padding: 2px 8px; cursor: pointer; transition: background .12s, color .12s; }
.fu-act:hover { background: var(--hover-bg); color: var(--color-text-primary); }

.fu-vbadge { background: var(--st-next-bg); border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius-md); color: var(--color-text-info); font-family: var(--font-mono); font-size: 10px; padding: 1px 7px; cursor: pointer; }
.fu-vbadge:hover { background: var(--hover-bg); }

/* quiet inline status label (document affordance) — 12px, muted/semantic, never loud */
.fu-status { font-size: 12px; color: var(--color-text-tertiary); }
.fu-status[data-s="current"] { color: var(--color-text-success); }
.fu-status[data-s="superseded"] { color: var(--color-text-tertiary); }
.fu-status[data-s="approved"], .fu-status[data-s="final"] { color: var(--color-text-success); }
.fu-status[data-s="draft"], .fu-status[data-s="prepared"] { color: var(--color-text-warn); }

/* expanded version history */
.fu-versions { margin: 0 0 6px 32px; padding: 3px 8px; border-left: 2px solid var(--color-border-secondary); }
.fu-vrow { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 11px; color: var(--color-text-secondary); }
.fu-vrow.cur { color: var(--color-text-primary); }
.fu-vno { font-family: var(--font-mono); font-size: 10px; color: var(--color-text-info); min-width: 24px; }
.fu-vmeta { color: var(--color-text-tertiary); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* grid view (design-C thumbnail cards) */
.fu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; padding: 4px 2px; }
.fu-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; background: var(--surface-1); border: 1px solid var(--color-border-tertiary); border-radius: var(--border-radius-md); cursor: pointer; font-family: inherit; transition: border-color .12s, background .12s; }
.fu-card:hover { border-color: var(--color-border-secondary); background: var(--surface-2); }
.fu-card .fu-icon { width: 48px; height: 48px; }
.fu-card .fu-icon svg { width: 26px; height: 26px; }
.fu-card-name { font-size: 11px; color: var(--color-text-primary); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fu-card-foot { display: flex; align-items: center; gap: 6px; min-height: 16px; }

/* optimistic upload rows + inline failure */
.fu-up .fu-meta { color: var(--color-text-info); }
.fu-up.fu-failed .fu-meta { color: var(--color-text-danger); }

/* states */
.fu-empty, .fu-muted { color: var(--color-text-tertiary); font-size: 12px; padding: 6px 2px; }

@media (max-width: 640px) {
  .fu-grid { grid-template-columns: repeat(2, 1fr); }
}
