/* ============================================================
   Digitis Feedback · estilos del widget standalone (WordPress)
   Adaptado de src/lab-origin/widget.css · prefijo dgts-fb-
   + launcher flotante y drawer contextual (reemplazan al sidebar del shell)
   ============================================================ */

.dgts-fb-launcher,
.dgts-fb-drawer,
.dgts-fb-composer,
.dgts-fb-thread,
.dgts-fb-identity,
.dgts-fb-mode-banner,
.dgts-fb-pin,
.dgts-fb-hoverbox {
  --fb-accent: #0B5394;            /* pines / composer / hilo (widget del lab) */
  --fb-chrome: #334155;            /* chrome: pestaña, Comentar, tabs (= --lab-accent del shell) */
  --fb-success: #2D7A3A;
  --fb-ink: #0d0d0d;
  --fb-muted: #6b7280;
  --fb-line: #e6e6e6;
  --fb-bg: #ffffff;
  box-sizing: border-box;
}

/* Aislamiento del tema del cliente: el widget va sobre la página (no en iframe
   como el lab), así que el CSS del tema se filtra en los controles (p.ej. fondo
   crema en textarea/inputs). Forzamos su aspecto para que se vea como el lab. */
.dgts-fb-composer textarea,
.dgts-fb-thread-reply textarea,
.dgts-fb-identity-card input {
  background: var(--fb-bg) !important;
  color: var(--fb-ink) !important;
  -webkit-appearance: none !important; appearance: none !important;
  box-shadow: none !important;
  margin: 0; max-width: 100%; min-width: 0; min-height: 60px;
}
.dgts-fb-identity-card input { min-height: 0; }
.dgts-fb-composer textarea, .dgts-fb-thread-reply textarea, .dgts-fb-identity-card input,
.dgts-fb-thread button, .dgts-fb-composer button, .dgts-fb-identity-card button {
  font-family: 'Inter', -apple-system, sans-serif;
  letter-spacing: normal; text-transform: none;
}

/* Cursor crosshair en modo comentario */
html.dgts-fb-mode, html.dgts-fb-mode body { cursor: crosshair !important; }
html.dgts-fb-mode .dgts-fb-pin,
html.dgts-fb-mode .dgts-fb-launcher,
html.dgts-fb-mode .dgts-fb-drawer { cursor: default !important; }

/* ---------- Launcher · pestaña vertical pegada al borde derecho ---------- */
.dgts-fb-launcher {
  position: fixed; right: 0; top: 50%;
  transform: translateY(-50%);
  z-index: 999996;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 13px 7px;
  border: none; border-radius: 6px 0 0 6px;
  background: var(--fb-chrome); color: #fff;
  cursor: pointer;
  box-shadow: -3px 3px 14px rgba(15, 23, 42, .28), -1px 0 2px rgba(0,0,0,.12);
  font-family: 'Inter', -apple-system, sans-serif;
  transition: padding-right .12s ease, background .12s ease;
}
.dgts-fb-launcher:hover { padding-right: 11px; }
.dgts-fb-launcher.is-active { background: var(--fb-ink); }
.dgts-fb-launcher-icon { display: flex; }
.dgts-fb-launcher-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dgts-fb-launcher-text {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-size: 12px; font-weight: 700; letter-spacing: .07em;
}
.dgts-fb-launcher-badge {
  min-width: 16px; height: 16px; padding: 0 4px;
  background: #e02424; color: #fff; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.5);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Drawer contextual ---------- */
.dgts-fb-drawer {
  position: fixed; right: 48px; bottom: 24px;
  z-index: 999996;
  width: 320px; max-height: 60vh;
  background: var(--fb-bg);
  border: 1px solid var(--fb-line);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.08);
  font-family: 'Inter', -apple-system, sans-serif;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.dgts-fb-drawer-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: #f9fafb; border-bottom: 1px solid var(--fb-line);
}
.dgts-fb-drawer-title { font-size: 13px; font-weight: 700; color: var(--fb-ink); flex: 1; }
.dgts-fb-drawer-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px;
  background: var(--fb-chrome); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.dgts-fb-drawer-x {
  width: 24px; height: 24px; border: none; background: transparent; cursor: pointer;
  color: var(--fb-muted); display: flex; align-items: center; justify-content: center;
}
.dgts-fb-drawer-x:hover { color: var(--fb-ink); }
.dgts-fb-drawer-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

.dgts-fb-drawer-tabs { display: flex; background: #f9fafb; border-bottom: 1px solid var(--fb-line); }
.dgts-fb-tab {
  flex: 1; padding: 8px 4px; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--fb-muted);
  border-bottom: 2px solid transparent;
}
.dgts-fb-tab:hover { color: var(--fb-ink); }
.dgts-fb-tab.is-on { color: var(--fb-chrome); border-bottom-color: var(--fb-chrome); }

.dgts-fb-drawer-vp { display: flex; gap: 6px; padding: 8px 12px; background: #f9fafb; border-bottom: 1px solid var(--fb-line); }
.dgts-fb-vp-btn {
  flex: 1; padding: 5px 4px; border: 1px solid var(--fb-line); border-radius: 999px;
  background: #fff; cursor: pointer; font-family: inherit; font-size: 11px;
  font-weight: 600; color: var(--fb-muted);
}
.dgts-fb-vp-btn:hover { color: var(--fb-ink); }
.dgts-fb-vp-btn.is-on { color: #fff; background: var(--fb-chrome); border-color: var(--fb-chrome); }

.dgts-fb-drawer-list { overflow-y: auto; flex: 1; padding: 6px; }
.dgts-fb-drawer-group {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  padding: 9px 10px 4px;
}
.dgts-fb-drawer-group .sc { font-size: 11px; font-weight: 700; color: var(--fb-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgts-fb-drawer-group .n { flex: none; font-size: 10px; color: var(--fb-muted); }
.dgts-fb-drawer-empty { padding: 24px 14px; text-align: center; color: var(--fb-muted); font-size: 12.5px; }
.dgts-fb-drawer-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px; border-radius: 7px; cursor: pointer;
  transition: background .1s;
}
.dgts-fb-drawer-item:hover { background: #f3f4f6; }
.dgts-fb-drawer-item .num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--fb-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.dgts-fb-drawer-item.is-resolved .num { background: var(--fb-success); }
.dgts-fb-drawer-item .txt { min-width: 0; flex: 1; }
.dgts-fb-drawer-item .body { font-size: 12.5px; color: var(--fb-ink); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgts-fb-drawer-item .by { font-size: 10.5px; color: var(--fb-muted); margin-top: 2px; }

.dgts-fb-drawer-foot { padding: 10px 12px; border-top: 1px solid var(--fb-line); background: #fafbfc; }
.dgts-fb-drawer-comment {
  display: flex; align-items: center; gap: 8px;
  width: 100%; height: 36px; padding: 0 12px;
  background: var(--fb-chrome); color: #fff; border: none; border-radius: 6px;
  font-family: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .01em; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px rgba(0, 0, 0, .04);
  transition: filter .12s;
}
.dgts-fb-drawer-comment:hover { filter: brightness(1.18); }
.dgts-fb-drawer-comment.is-on { background: #1e293b; }
.dgts-fb-drawer-comment .ic { display: flex; }
.dgts-fb-drawer-comment .ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dgts-fb-drawer-comment .lbl { flex: 1; text-align: left; }
.dgts-fb-drawer-comment .kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 4px; font-family: ui-monospace, monospace; font-size: 10px; font-weight: 600; color: #fff;
}

/* ---------- Capa de pins ---------- */
.dgts-fb-pin-layer {
  position: absolute; top: 0; left: 0; width: 100%;
  pointer-events: none; z-index: 999990;
}

/* Caja de resaltado del elemento bajo el cursor */
.dgts-fb-hoverbox {
  position: absolute; z-index: 999985; pointer-events: none; display: none;
  border: 1px solid rgba(45, 127, 249, .5);
  background: rgba(45, 127, 249, .05);
  border-radius: 2px;
  transition: left .05s linear, top .05s linear, width .05s linear, height .05s linear;
}
.dgts-fb-hoverbox.locked {
  border-color: var(--fb-accent); background: rgba(11, 83, 148, .07); transition: none;
}

/* Pin numerado */
.dgts-fb-pin {
  position: absolute; z-index: 999990;
  width: 28px; height: 28px;
  border-radius: 50% 50% 50% 4px;
  background: var(--fb-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', -apple-system, sans-serif; font-weight: 700; font-size: 12px;
  box-shadow: 0 4px 12px rgba(11, 83, 148, .4), 0 0 0 2px #fff;
  cursor: pointer;
  transform: translate(-6px, -28px) rotate(-45deg);
  transition: transform .12s ease, box-shadow .12s ease;
}
.dgts-fb-pin > span { transform: rotate(45deg); }
.dgts-fb-pin:hover { transform: translate(-6px, -28px) rotate(-45deg) scale(1.08); }
.dgts-fb-pin.is-resolved { background: var(--fb-success); box-shadow: 0 4px 12px rgba(45, 122, 58, .4), 0 0 0 2px #fff; }
.dgts-fb-pin.is-focused { box-shadow: 0 6px 18px rgba(11, 83, 148, .55), 0 0 0 3px #fff; transform: translate(-6px, -28px) rotate(-45deg) scale(1.12); }
/* Pin huérfano: el selector ya no existe, posicionado por fallback px */
.dgts-fb-pin.is-orphan { background: #b45309; box-shadow: 0 4px 12px rgba(180, 83, 9, .4), 0 0 0 2px #fff; opacity: .9; }

/* Banner de modo activo */
.dgts-fb-mode-banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 999997;
  background: var(--fb-ink); color: #fff;
  padding: 8px 14px; border-radius: 999px;
  font-family: 'Inter', -apple-system, sans-serif; font-size: 11.5px; font-weight: 500; letter-spacing: .02em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
  display: flex; align-items: center; gap: 8px;
}
.dgts-fb-mode-banner kbd {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; padding: 0 5px;
  background: rgba(255, 255, 255, .18); color: #fff;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 3px;
  font-family: ui-monospace, monospace; font-size: 10px; font-weight: 600;
}

/* Composer */
.dgts-fb-composer {
  position: absolute; z-index: 999999;
  width: 320px;
  background: var(--fb-bg); border: 1px solid var(--fb-line); border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .08);
  font-family: 'Inter', -apple-system, sans-serif; overflow: hidden;
}
.dgts-fb-composer-head {
  padding: 10px 12px; background: #f9fafb; border-bottom: 1px solid var(--fb-line);
  display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--fb-muted);
}
.dgts-fb-composer-head .meta { display: flex; gap: 8px; align-items: center; min-width: 0; }
.dgts-fb-composer-head .meta span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgts-fb-composer-head .badge {
  flex: none; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--fb-bg); border: 1px solid var(--fb-line); border-radius: 3px; padding: 1px 5px;
}
.dgts-fb-composer-head .x {
  margin-left: auto; width: 22px; height: 22px; border: none; background: transparent; cursor: pointer;
  color: var(--fb-muted); display: flex; align-items: center; justify-content: center;
}
.dgts-fb-composer-head .x:hover { color: var(--fb-ink); }
.dgts-fb-composer-head .x svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.dgts-fb-composer textarea {
  width: 100%; border: none; resize: none; padding: 12px;
  font-family: inherit; font-size: 13px; line-height: 1.5;
  background: var(--fb-bg); color: var(--fb-ink); outline: none; min-height: 84px;
}
.dgts-fb-composer textarea::placeholder { color: #b8bcc4; }
.dgts-fb-composer-foot {
  padding: 10px 12px; border-top: 1px solid var(--fb-line);
  display: flex; align-items: center; gap: 8px; background: #fafbfc;
}
.dgts-fb-composer-foot .author { font-size: 11px; color: var(--fb-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgts-fb-composer-foot .author b { color: var(--fb-ink); font-weight: 600; }
.dgts-fb-composer-foot button {
  padding: 6px 12px; font-family: inherit; font-size: 12px; font-weight: 600;
  border-radius: 5px; cursor: pointer; border: 1px solid var(--fb-line);
  background: var(--fb-bg); color: var(--fb-ink); transition: .12s;
}
.dgts-fb-composer-foot button:hover { border-color: var(--fb-ink); }
.dgts-fb-composer-foot .send { background: var(--fb-accent); color: #fff; border-color: var(--fb-accent); }
.dgts-fb-composer-foot .send:hover { opacity: .92; border-color: var(--fb-accent); }
.dgts-fb-composer-foot .send:disabled { opacity: .5; cursor: not-allowed; }

/* Modal de identidad */
.dgts-fb-identity {
  position: fixed; inset: 0; z-index: 999999;
  background: rgba(13, 13, 13, .5);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', -apple-system, sans-serif; backdrop-filter: blur(2px);
}
.dgts-fb-identity-card {
  background: var(--fb-bg); border-radius: 10px; padding: 24px;
  width: 380px; max-width: 92vw; box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.dgts-fb-identity-card h3 { font-size: 15px; font-weight: 700; margin: 0 0 6px; color: var(--fb-ink); }
.dgts-fb-identity-card p { font-size: 12.5px; color: var(--fb-muted); line-height: 1.55; margin: 0 0 16px; }
.dgts-fb-identity-card label {
  display: block; font-size: 11px; font-weight: 600; color: var(--fb-ink);
  margin-bottom: 4px; letter-spacing: .03em; text-transform: uppercase;
}
.dgts-fb-identity-card input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--fb-line); border-radius: 5px;
  font-family: inherit; font-size: 13px; color: var(--fb-ink); margin-bottom: 12px; outline: none;
  transition: border-color .12s;
}
.dgts-fb-identity-card input:focus { border-color: var(--fb-accent); }
.dgts-fb-identity-card .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.dgts-fb-identity-card .row button {
  padding: 8px 14px; font-family: inherit; font-size: 12.5px; font-weight: 600;
  border-radius: 5px; cursor: pointer; border: 1px solid var(--fb-line);
  background: var(--fb-bg); color: var(--fb-ink); transition: .12s;
}
.dgts-fb-identity-card .row button:hover { border-color: var(--fb-ink); }
.dgts-fb-identity-card .row .save { background: var(--fb-accent); color: #fff; border-color: var(--fb-accent); }

/* Thread */
.dgts-fb-thread {
  position: absolute; z-index: 999999;
  width: 360px; max-height: 70vh;
  background: var(--fb-bg); border: 1px solid var(--fb-line); border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .2), 0 2px 8px rgba(0, 0, 0, .08);
  font-family: 'Inter', -apple-system, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
.dgts-fb-thread-head {
  padding: 10px 12px; background: #f9fafb; border-bottom: 1px solid var(--fb-line);
  display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--fb-muted);
}
.dgts-fb-thread-head .pin-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--fb-accent); color: #fff; font-weight: 700; font-size: 11px;
}
.dgts-fb-thread.is-resolved .dgts-fb-thread-head .pin-num { background: var(--fb-success); }
.dgts-fb-thread-head .meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgts-fb-thread-head .vp { flex: none; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--fb-line); border-radius: 3px; padding: 1px 5px; }
.dgts-fb-thread-head .x { width: 22px; height: 22px; border: none; background: transparent; cursor: pointer; color: var(--fb-muted); display: flex; align-items: center; justify-content: center; }
.dgts-fb-thread-head .x:hover { color: var(--fb-ink); }
.dgts-fb-thread-head .x svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.dgts-fb-thread-body { padding: 8px 12px; overflow-y: auto; flex: 1; }
.dgts-fb-msg { padding: 9px 0; border-bottom: 1px dashed var(--fb-line); }
.dgts-fb-msg:last-child { border-bottom: none; }
.dgts-fb-msg-head { display: flex; align-items: baseline; gap: 8px; font-size: 11px; color: var(--fb-muted); margin-bottom: 4px; }
.dgts-fb-msg-head .author { font-weight: 600; color: var(--fb-ink); font-size: 12px; }
.dgts-fb-msg-head .digitis-tag {
  background: var(--fb-accent); color: #fff; font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 3px; padding: 1px 5px; font-weight: 700;
}
.dgts-fb-msg-head .when { margin-left: auto; font-size: 10.5px; }
.dgts-fb-msg-body { font-size: 13px; line-height: 1.5; color: var(--fb-ink); white-space: pre-wrap; word-wrap: break-word; }

/* Aviso de pin huérfano (el elemento ya no existe) */
.dgts-fb-orphan {
  margin: 4px 0 8px; padding: 8px 10px;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px;
  font-size: 11.5px; line-height: 1.45; color: #9a3412;
}
/* Miniatura de la captura del elemento */
.dgts-fb-shot { display: block; margin: 0 0 10px; border: 1px solid var(--fb-line); border-radius: 6px; overflow: hidden; }
.dgts-fb-shot img { display: block; width: 100%; height: auto; }

.dgts-fb-thread-actions {
  padding: 10px 12px; background: #fafbfc; border-top: 1px solid var(--fb-line);
  display: flex; gap: 6px; flex-wrap: wrap;
}
.dgts-fb-thread-actions:empty { display: none; }
.dgts-fb-thread-actions button {
  padding: 5px 10px; font-family: inherit; font-size: 11px; font-weight: 600;
  border-radius: 4px; cursor: pointer; border: 1px solid var(--fb-line);
  background: var(--fb-bg); color: var(--fb-ink); transition: .12s;
}
.dgts-fb-thread-actions button:hover { border-color: var(--fb-ink); }
.dgts-fb-thread-actions .resolve { background: var(--fb-success); color: #fff; border-color: var(--fb-success); }
.dgts-fb-thread-actions .reopen { background: var(--fb-bg); color: var(--fb-accent); border-color: var(--fb-accent); }
.dgts-fb-thread-actions .delete { color: #b91c1c; }
.dgts-fb-thread-actions .delete:hover { border-color: #b91c1c; }
.dgts-fb-thread-actions .spacer { flex: 1; }

.dgts-fb-thread-reply { padding: 10px 12px; border-top: 1px solid var(--fb-line); background: var(--fb-bg); }
.dgts-fb-thread-reply textarea {
  width: 100%; border: 1px solid var(--fb-line); border-radius: 5px; padding: 8px 10px;
  font-family: inherit; font-size: 12.5px; line-height: 1.5; resize: none; outline: none; min-height: 60px;
  transition: border-color .12s;
}
.dgts-fb-thread-reply textarea:focus { border-color: var(--fb-accent); }
.dgts-fb-thread-reply .row { margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.dgts-fb-thread-reply .author { flex: 1; font-size: 11px; color: var(--fb-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgts-fb-thread-reply .send {
  padding: 6px 12px; background: var(--fb-accent); color: #fff; border: none; border-radius: 4px;
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: .12s;
}
.dgts-fb-thread-reply .send:disabled { opacity: .5; cursor: not-allowed; }

/* Responsive: drawer a ancho casi completo en móvil */
@media (max-width: 480px) {
  .dgts-fb-drawer { right: 8px; left: 8px; width: auto; bottom: 16px; }
  .dgts-fb-thread { width: calc(100vw - 24px); left: 12px !important; }
  .dgts-fb-composer { width: calc(100vw - 24px); }
}
