/* Aerial panel — the "Reportar un problema" widget.
   Everything here is namespaced `fb-` and reads the tokens declared in
   styles.css (--brand, --surface-*, --line…). Nothing in this file overrides a
   panel class, so it cannot collide with the panel's own styling — the one
   exception is the bottom padding below, which is additive and scoped to the
   .fb-on marker the widget puts on <html>. */

/* ---------- the floating button
   Bottom-RIGHT, deliberately:
    - the primary action (+ Entregar acceso) lives top-right in .page-head, so
      the two can never overlap at any width;
    - desktop toasts are bottom-CENTRE and phone toasts are pinned to the top,
      so neither covers this;
    - z-index sits UNDER .toasts (90) and under any open <dialog>, so a modal's
      backdrop dims it and its buttons always win the tap. */
.fb-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 16px 10px 12px;
  border-radius: 999px; border: 1px solid var(--line-strong, #2c3450);
  background: var(--surface-2, #141a2b); color: var(--ink, #eaeef7);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-md, 0 6px 20px rgba(0, 0, 0, .4));
}
.fb-fab:hover { background: var(--surface-3, #171c2b); border-color: var(--brand, #4fd8ff); }
.fb-fab:focus-visible { outline: 3px solid var(--brand, #4fd8ff); outline-offset: 2px; }
.fb-fab-i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex: none; border-radius: 7px;
  background: var(--grad-signal, linear-gradient(90deg, #4fd8ff, #8b6bff));
  color: var(--brand-ink, #041016); font-weight: 800; font-size: 13px;
}
/* Under 800px the panel becomes a card list one thumb wide; the label is
   dropped so the button is a 48px puck instead of a bar across the content. */
@media (max-width: 800px) {
  /* 🚨 Must clear the bottom tab bar (56px + the home-indicator inset), or it
     sits on top of the nav and steals taps meant for Solicitudes. */
  .fb-fab {
    right: 14px; bottom: calc(70px + env(safe-area-inset-bottom));
    padding: 0; width: 48px; height: 48px; justify-content: center;
  }
  .fb-fab-t { display: none; }
  .fb-fab-i { width: 24px; height: 24px; font-size: 14px; }
  /* Room under the last card so its always-visible row actions never end up
     beneath the puck at maximum scroll. Additive: the panel sets 60px here. */
  /* Tab bar (56) + FAB above it + breathing room, plus the home indicator.
     A flat 96px predated the tab bar and now hides the last row. */
  .fb-on .main { padding-bottom: calc(132px + env(safe-area-inset-bottom)); }
}

/* ---------- the dialog. Native <dialog>, so focus trap / ESC / focus return
   are the platform's job, exactly like every other dialog in this panel. */
.fb-dlg {
  background: var(--surface-1, #0f1320); color: var(--ink, #eaeef7);
  border: 1px solid var(--line, #20263a); border-radius: 14px; padding: 0;
  width: min(520px, 94vw); max-height: 88vh; overflow: auto;
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(0, 0, 0, .55));
}
.fb-dlg::backdrop { background: rgba(4, 6, 12, .62); backdrop-filter: blur(2px); }
.fb-form header { padding: 15px 18px 13px; border-bottom: 1px solid var(--line, #20263a); }
.fb-form header h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.fb-form header p { margin: 6px 0 0; color: var(--muted, #8791a8); font-size: 12.5px; line-height: 1.5; }
.fb-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 15px; }
.fb-form footer {
  padding: 12px 18px; border-top: 1px solid var(--line, #20263a);
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
}
.fb-form footer button {
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 9px 14px; border-radius: 8px; min-height: 40px;
  border: 1px solid var(--line, #20263a); background: var(--surface-2, #141a2b);
  color: var(--ink, #eaeef7);
}
.fb-form footer .fb-go {
  background: var(--brand, #4fd8ff); color: var(--brand-ink, #041016);
  border-color: transparent; font-weight: 700;
}
.fb-form footer button:disabled { opacity: .5; cursor: not-allowed; }

/* tap-don't-type: both pickers are chips, never a <select> */
.fb-set { border: none; margin: 0; padding: 0; }
.fb-set legend {
  padding: 0 0 7px; font-size: 12px; font-weight: 600; color: var(--muted, #8791a8);
}
.fb-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.fb-chip { position: relative; flex: 1 1 150px; }
.fb-chip input { position: absolute; opacity: 0; pointer-events: none; }
.fb-chip span {
  display: flex; flex-direction: column; gap: 2px; justify-content: center;
  min-height: 44px; padding: 7px 13px; cursor: pointer;
  border: 1px solid var(--line, #20263a); border-radius: 9px;
  background: var(--surface-2, #141a2b);
  font-size: 13px; font-weight: 600; color: var(--ink, #eaeef7);
}
.fb-chip small { font-size: 11px; font-weight: 400; color: var(--muted, #8791a8); }
.fb-chip span:hover { border-color: var(--line-strong, #2c3450); }
.fb-chip input:checked + span {
  background: var(--brand, #4fd8ff); border-color: transparent; color: var(--brand-ink, #041016);
}
.fb-chip input:checked + span small { color: rgba(4, 16, 22, .72); }
.fb-chip input:focus-visible + span { outline: 3px solid var(--brand-soft, rgba(79, 216, 255, .13)); outline-offset: 1px; }
.fb-chips-sm .fb-chip { flex: 1 1 105px; }
.fb-chips-sm .fb-chip span { min-height: 40px; }

.fb-field { display: flex; flex-direction: column; gap: 5px; }
.fb-field label { font-size: 12px; font-weight: 600; color: var(--muted, #8791a8); }
.fb-field textarea {
  font: inherit; font-size: 16px; /* 16px or iOS Safari zooms the whole page on focus */
  padding: 9px 11px; border-radius: 8px; resize: vertical;
  border: 1px solid var(--line, #20263a); background: var(--surface-2, #141a2b);
  color: var(--ink, #eaeef7);
}
.fb-field textarea::placeholder { color: var(--soft, #5c657d); }
.fb-field textarea:focus {
  outline: 3px solid var(--brand-soft, rgba(79, 216, 255, .13));
  border-color: var(--brand, #4fd8ff);
}

/* candor: the exact payload is one tap away, always */
.fb-what summary {
  cursor: pointer; font-size: 12px; color: var(--muted, #8791a8);
  padding: 4px 0; min-height: 24px;
}
.fb-what summary:hover { color: var(--ink, #eaeef7); }
.fb-note { margin: 6px 0; font-size: 12px; color: var(--soft, #5c657d); line-height: 1.55; }
.fb-note code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.fb-json {
  max-height: 190px; overflow: auto; margin: 0;
  background: var(--surface-2, #141a2b); border: 1px solid var(--line, #20263a);
  border-radius: 9px; padding: 10px 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px;
  line-height: 1.45; color: var(--muted, #8791a8); white-space: pre-wrap; word-break: break-word;
}
.fb-err {
  color: #ff8389; background: rgba(226, 68, 92, .14);
  border-radius: 8px; padding: 8px 12px; font-size: 12.5px; line-height: 1.45;
}
.fb-err[hidden] { display: none; }
.fb-ok { margin: 0; color: var(--ok, #00c875); font-size: 14px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .fb-fab { transition: none; }
}
