/* ── Shared file upload — drop zone + filed record ──────────────────────────
   One upload treatment for every surface that takes a document. Before a file
   is chosen the zone invites a drop; after, it collapses into a quiet filed
   record with an explicit way back out.

   The border is a solid hairline, not dashed: a dashed rule reads as a draft
   placeholder, and this control is neither draft nor placeholder.
   ────────────────────────────────────────────────────────────────────────── */

.fu-field {
  display: block;
}

.fu-drop {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  padding: 40px 28px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: color-mix(in srgb, var(--paper-2) 30%, transparent);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.fu-drop[hidden] { display: none; }

.fu-drop:hover,
.fu-drop.is-dragging {
  border-color: color-mix(in srgb, var(--ink) 36%, var(--paper));
  background: color-mix(in srgb, var(--paper-2) 58%, transparent);
}

.fu-drop-icon {
  width: 30px;
  height: 30px;
  color: var(--muted);
}

.fu-drop-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.fu-drop-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.fu-drop-action {
  color: var(--link);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

/* The real input stays in the DOM and in the tab order — the drop zone is a
   <label> for it, so keyboard and no-JS clients are unaffected. Targeted by
   element rather than by class so any widget can be dropped in unchanged.

   !important is deliberate. Host pages style their own form controls (several
   set `input { width: 100% }`), and those rules load after this file and win
   on document order — leaving a full-width invisible input able to intercept
   clicks. Containment here is correctness, not taste, so it does not
   negotiate. clip-path is the belt to that braces. */
.fu-field input[type="file"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Filed record ── */
.fu-filed {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 2px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: color-mix(in srgb, var(--paper-2) 34%, transparent);
}

.fu-filed[hidden] { display: none; }

.fu-filed-glyph { width: 36px; height: 44px; flex: none; }
.fu-filed-glyph-body { stroke: var(--muted); stroke-width: 1.4; fill: none; }
.fu-filed-glyph-ext {
  font-family: "DM Sans", sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  fill: var(--muted);
}

.fu-filed-body { flex: 1; min-width: 0; }

.fu-filed-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fu-filed-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.fu-filed-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--status-complete);
  font-weight: 600;
}

.fu-filed-ok svg { width: 13px; height: 13px; }

.fu-filed-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 34%, var(--paper));
  flex: none;
}

/* Replace and remove sit together as one composed pair, centred on the record's
   axis — never a button with a loose control drifting beside it. */
.fu-filed-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
}

.fu-filed-replace {
  font-family: inherit;
  font-size: 13px;
  color: var(--link);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 0 1px;
  cursor: pointer;
}

.fu-filed-replace:hover {
  color: var(--link-hover);
  border-bottom-color: var(--ink);
}

/* The way back out. Quiet until reached for, then unmistakable. */
.fu-filed-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  flex: none;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.fu-filed-remove svg { width: 13px; height: 13px; }

.fu-filed-remove:hover,
.fu-filed-remove:focus-visible {
  color: var(--danger);
  border-color: var(--line);
  background: color-mix(in srgb, var(--paper) 60%, transparent);
}

.fu-helper {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.fu-helper[hidden] { display: none; }

@media (max-width: 600px) {
  .fu-drop { padding: 32px 20px; }
  .fu-filed { gap: 12px; padding: 14px; }
  .fu-filed-actions { gap: 10px; }
}
