/* Mesa de Ayuda — in-app bug reporter. Flat, dense, Bloomberg-consistent:
   thin borders, no tinted fills, color only in the accent. Uses the shared
   design tokens from style.css with safe fallbacks. */

.bug-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  padding: 0;
  background: #1565C0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.24);
  transition: background 120ms ease, transform 120ms ease;
}
.bug-fab:hover { background: #1976D2; transform: translateY(-1px); }
.bug-fab-mark { width: auto; height: 66%; object-fit: contain; display: block; pointer-events: none; }

/* On phones, slightly smaller so it doesn't cover content. */
@media (max-width: 768px) {
  .bug-fab { right: 14px; bottom: 14px; width: 48px; height: 48px; }
}

.bug-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 14px;
}
.bug-modal[hidden] { display: none; }
.bug-modal-backdrop { position: absolute; inset: 0; background: rgba(20, 24, 16, 0.45); }
.bug-modal-panel {
  position: relative;
  width: min(480px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--gray-300, #d7dbd2);
  border-radius: 5px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
}
.bug-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200, #e7e9e3);
}
.bug-modal-head h3 {
  margin: 0;
  font: 600 14px/1.2 var(--font-ui, sans-serif);
  color: var(--gray-900, #1d2118);
}
.bug-modal-x {
  border: none; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--gray-500, #7b8273);
}
.bug-modal-x:hover { color: var(--gray-900, #1d2118); }

.bug-form { padding: 14px 16px 16px; }
.bug-field { display: block; margin-bottom: 12px; }
.bug-field--inline { max-width: 160px; }
.bug-field-label {
  display: block;
  margin-bottom: 4px;
  font: 600 11px/1.3 var(--font-ui, sans-serif);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-600, #5f665a);
}
.bug-field-label em { font-style: normal; font-weight: 500; color: var(--gray-400, #9aa090); text-transform: none; }
.bug-field input,
.bug-field textarea,
.bug-field select {
  width: 100%;
  padding: 7px 9px;
  font: 400 13px/1.4 var(--font-ui, sans-serif);
  color: var(--gray-900, #1d2118);
  border: 1px solid var(--gray-300, #d7dbd2);
  border-radius: 3px;
  background: #fff;
}
.bug-field textarea { resize: vertical; min-height: 84px; }
.bug-field input:focus,
.bug-field textarea:focus,
.bug-field select:focus {
  outline: none;
  border-color: var(--green-primary, #3D4630);
  box-shadow: 0 0 0 2px rgba(61, 70, 48, 0.12);
}

/* ── Screenshot attachment ─────────────────────────────────────────────────
   The drop zone is a <label> wrapping a hidden file input, so a click, the
   keyboard and a drop all reach the same control with no JS to open the
   picker. */
.bug-drop {
  display: block; cursor: pointer; text-align: center;
  padding: 12px 10px; margin-top: 2px;
  border: 1px dashed var(--gray-300, #d7dbd2); border-radius: 3px;
  background: var(--gray-050, #f7f8f5);
  transition: border-color .12s, background .12s;
}
.bug-drop:hover,
.bug-drop:focus-within,
.bug-drop.is-over {
  border-color: var(--green-primary, #3D4630);
  background: rgba(61, 70, 48, 0.05);
}
.bug-drop[hidden] { display: none; }
.bug-drop-text {
  font: 400 11px/1.4 var(--font-ui, sans-serif);
  color: var(--gray-500, #7b8273);
}
.bug-drop-text b { font-weight: 600; color: var(--green-primary, #3D4630); }

.bug-thumbs {
  display: flex; flex-wrap: wrap; gap: 6px;
  list-style: none; margin: 6px 0 0; padding: 0;
}
.bug-thumb { position: relative; width: 72px; height: 54px; }
.bug-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border: 1px solid var(--gray-300, #d7dbd2); border-radius: 3px;
  background: var(--white, #fff);
}
/* Sits half outside the thumbnail so it never covers the part of the capture
   somebody is looking at to confirm they picked the right one. */
.bug-thumb-x {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; padding: 0;
  border: 1px solid var(--gray-300, #d7dbd2); border-radius: 50%;
  background: var(--white, #fff); color: var(--gray-600, #5f665a);
  font: 600 13px/16px var(--font-ui, sans-serif); cursor: pointer;
}
.bug-thumb-x:hover { color: var(--red, #d32f2f); border-color: var(--red, #d32f2f); }

/* On the triage board the thumbnail has a different job: in the modal it only
   confirms "yes, that's the file I picked", but here an operator has to
   recognise WHICH screen it is. So it is bigger and `contain` — a cover-crop of
   a 900px-wide capture shows nothing but a slice of the header. */
.bug-thumbs--triage { margin-top: 5px; }
.bug-thumbs--triage .bug-thumb { width: 190px; height: 96px; }
.bug-thumbs--triage .bug-thumb img {
  object-fit: contain; background: var(--gray-050, #f7f8f5);
}
.bug-thumbs--triage .bug-thumb a { display: block; width: 100%; height: 100%; }
.bug-thumbs--triage .bug-thumb:hover img { border-color: var(--green-primary, #3D4630); }

.bug-context-note {
  margin: 2px 0 10px;
  font: 400 11px/1.4 var(--font-ui, sans-serif);
  color: var(--gray-500, #7b8273);
}

/* Self-help note above the form. Reads as an aside, not as an obstacle: nobody
   should feel talked out of reporting, so it is quiet — no warning colour, no
   icon — and ends by inviting the report anyway. */
.bug-firstaid {
  margin: 0 0 14px;
  padding: 9px 11px;
  background: var(--gray-50, #F0F1EE);
  border-left: 2px solid var(--green-primary, #3D4630);
  border-radius: 0 3px 3px 0;
  font: 400 12px/1.5 var(--font-ui, sans-serif);
  color: var(--gray-600, #5f6657);
}
.bug-firstaid b { font-weight: 600; color: var(--gray-800, #2f342a); }
.bug-firstaid kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--white, #fff);
  border: 1px solid var(--gray-200, #d9ddd2);
  border-bottom-width: 2px;
  border-radius: 3px;
  font: 600 11px/1.5 var(--font-mono, ui-monospace, monospace);
  color: var(--gray-800, #2f342a);
  white-space: nowrap;
}

.bug-form-msg {
  margin: 0 0 10px;
  padding: 7px 10px;
  font: 500 12px/1.4 var(--font-ui, sans-serif);
  border-radius: 3px;
  border: 1px solid var(--gray-300, #d7dbd2);
  color: var(--gray-700, #474d40);
}
.bug-form-msg[hidden] { display: none; }
.bug-form-msg--ok { border-color: #3D4630; color: #2B3122; }
.bug-form-msg--error { border-color: #c0492f; color: #9a2f1c; }

.bug-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

body.bug-modal-open { overflow: hidden; }

/* ── Triage board (/admin/bugs) ─────────────────────────────────────── */
.bug-tabs { gap: 6px; margin-bottom: 12px; }
.bug-count {
  display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 4px;
  font: 700 10px/16px var(--font-mono, monospace);
  text-align: center; border-radius: 8px; background: rgba(0, 0, 0, 0.12);
}
.btn-xs {
  padding: 2px 7px; font-size: 11px; line-height: 1.4;
  font-family: var(--font-ui, sans-serif);
}
/* Seven dense columns do not fit a phone. Without a floor the browser crushes
   them until "Reportado por" renders one letter per line and the report text is
   unreadable — so hold the natural width and let .table-scroll scroll, the same
   way the browse tables do. */
.table-scroll .bug-table { min-width: 820px; }
.bug-table .bug-body { color: var(--gray-700, #474d40); }
.bug-table .bug-page { font-size: 10px; color: var(--gray-500, #7b8273); word-break: break-all; }

.sev {
  display: inline-block; width: 18px; height: 18px; line-height: 18px;
  text-align: center; border-radius: 3px; font: 700 10px/18px var(--font-mono, monospace);
  color: #fff;
}
.sev--baja { background: #6b7280; }
.sev--media { background: #b58a26; }
.sev--alta { background: #c0492f; }

.bug-status {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  font: 600 10px/1.6 var(--font-ui, sans-serif); text-transform: uppercase; letter-spacing: 0.03em;
  border: 1px solid;
}
.bug-status--abierto { color: #9a2f1c; border-color: #d8a99e; }
.bug-status--en_curso { color: #7a5a10; border-color: #d8c48a; }
.bug-status--resuelto { color: #2B3122; border-color: #9bbf8a; }

.bug-actions { white-space: nowrap; }
.bug-act-form { display: inline-block; margin: 0 2px 0 0; }
.bug-note { display: inline-block; vertical-align: top; }
.bug-note > summary { list-style: none; cursor: pointer; display: inline-block; }
.bug-note > summary::-webkit-details-marker { display: none; }
.bug-note-form { margin-top: 5px; display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.bug-note-form textarea {
  font: 400 12px/1.4 var(--font-ui, sans-serif); padding: 5px 7px;
  border: 1px solid var(--gray-300, #d7dbd2); border-radius: 3px; resize: vertical;
}
.bug-thread { margin-top: 5px; }
.bug-thread > summary { cursor: pointer; font-size: 11px; color: var(--green-primary, #3D4630); }
/* Wraps rather than compresses: below ~230px of free space the note text drops
   to its own full-width line instead of being squeezed into a one-word column.
   No breakpoint needed — it reacts to the space actually left by the timestamp,
   the author and the controls. */
.bug-thread-row {
  display: flex; flex-wrap: wrap; gap: 2px 7px;
  font-size: 11px; padding: 2px 0; align-items: baseline;
}
.bug-thread-when { color: var(--gray-400, #9aa090); flex: 0 0 auto; }
.bug-thread-who { font-weight: 600; color: var(--gray-700, #474d40); flex: 0 0 auto; }
.bug-thread-body {
  color: var(--gray-600, #5f665a);
  flex: 1 1 230px; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Per-note edit / delete. Kept out of the way until the row is hovered so the
   bitácora still reads as a log rather than a row of buttons. */
.bug-thread-acts { display: flex; gap: 6px; flex: 0 0 auto; margin-left: auto; opacity: 0; transition: opacity .12s; }
.bug-thread-row:hover .bug-thread-acts,
.bug-thread-acts:focus-within { opacity: 1; }
.bug-thread-act {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 11px; color: var(--green-primary, #3D4630);
  list-style: none; white-space: nowrap;
}
.bug-thread-act::-webkit-details-marker { display: none; }
.bug-thread-act:hover { text-decoration: underline; }
.bug-thread-act--danger { color: var(--red, #d32f2f); }
/* Float the edit panel instead of letting it stretch the log row. */
.bug-thread-edit { position: relative; }
.bug-thread-edit[open] > .bug-note-form {
  position: absolute; right: 0; top: 16px; z-index: 5; width: min(260px, 72vw);
  min-width: 0; background: var(--white, #fff); padding: 7px;
  border: 1px solid var(--gray-300, #d7dbd2); border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .10);
}
/* Touch devices never hover — the controls would be unreachable. */
@media (hover: none), (max-width: 768px) {
  .bug-thread-acts { opacity: 1; }
}
