/* v180 · Botones de opciones de mensaje (Responder, Reenviar) con el mismo estilo en WhatsApp y en el chat interno */
.chat-reply-action {
  display: inline-flex; align-items: center; min-height: 28px; margin: 10px 6px 0 0; padding: 3px 13px;
  border: 1px solid var(--line, #e7ddce); border-radius: 999px; background: #fffefa; color: #5d5144;
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chat-reply-action:hover:not(:disabled) { background: var(--gr-orange-soft, #fff0dc); border-color: #f0cba7; color: #8d4f0a; }
.chat-reply-action:focus-visible { outline: 2px solid var(--gr-orange-edge, #e08a2c); outline-offset: 2px; }

/* ======================================================================
   v183 · Chats con más aire y botones coherentes con el resto de GR Hub
   (WhatsApp y Chat interno). Mismo lenguaje que Presupuestos y Tareas:
   botones blancos con borde fino, esquinas de 10px, acción principal naranja.
   ====================================================================== */
:root { --grc-line: #e5e0d9; --grc-ink: #2f2b26; --grc-soft: #6d655b; --grc-hover: #faf6f0; --grc-orange: #f4a450; --grc-orange-hover: #e48f35; }

/* ---- Burbujas ---- */
#messages { gap: 14px; }
#messages .bubble { padding: 10px 14px 10px; border-radius: 14px 14px 14px 4px; line-height: 1.55; box-shadow: 0 1px 2px #3c32280f; }
#messages .bubble.out { border-radius: 14px 14px 4px 14px; }
#messages .bubble > small:first-child { margin-bottom: 4px; color: #7b7064; }
.message-date { margin: 14px auto 6px; padding: 5px 12px; font-weight: 600; }

/* ---- Opciones de un mensaje: barra flotante (ratón) ---- */
.msg-toolbar { gap: 2px !important; padding: 3px !important; border-color: var(--grc-line) !important; border-radius: 12px !important; box-shadow: 0 6px 18px #3c322824 !important; }
.msg-toolbar > button, .msg-toolbar .react-button, .msg-toolbar .message-more {
  min-height: 30px !important; padding: 0 11px !important; border: 0 !important; border-radius: 9px !important;
  background: transparent !important; color: #4f473e !important; font-size: 12.5px !important; font-weight: 600 !important; }
.msg-toolbar > button:hover:not(:disabled), .msg-toolbar .react-button:hover, .msg-toolbar .message-more:hover { background: #fdf0e0 !important; color: #8a4b0e !important; }

/* ---- Opciones de un mensaje: pantallas táctiles (siempre visibles, sin apretarse) ---- */
@media (hover: none) {
  .msg-toolbar { display: flex !important; flex-wrap: wrap; gap: 4px 6px !important; margin: 10px 0 0 !important; padding: 8px 0 0 !important;
    border: 0 !important; border-top: 1px solid #3c322814 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  .msg-toolbar > button, .msg-toolbar .react-button, .msg-toolbar .message-more { min-height: 32px !important; padding: 0 10px !important; margin: 0 !important; }
  .msg-toolbar > button:first-child { margin-left: -6px !important; }
}

/* ---- Cabeceras de la conversación ---- */
@media (min-width: 761px) {
  .conversation > header, .team .chat-header { min-height: 74px; padding: 14px 24px !important; gap: 14px; background: #fff; }
  .conversation > header #title, .team .chat-header h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
  .conversation > header #responsible, .team #person-status { margin-top: 3px; color: var(--grc-soft); font-size: 13px; }
  .conversation > header .chat-actions { gap: 8px; }
}
.conversation > header .chat-actions > .chat-shortcut, .conversation > header .chat-tasks > summary, .conversation > header .chat-more > summary,
.conversation > header .chat-actions > details > summary {
  width: 40px; min-height: 40px; height: 40px; border: 1px solid var(--grc-line); border-radius: 10px; background: #fff; color: var(--grc-ink); box-shadow: 0 1px 2px #3c32280a; }
.conversation > header .chat-actions > .chat-shortcut:hover:not(:disabled), .conversation > header .chat-actions > details > summary:hover { background: var(--grc-hover); border-color: #e9c9a3; }
.conversation > header .chat-actions > .chat-shortcut svg, .conversation > header .chat-actions > details > summary svg { width: 19px; height: 19px; }
.conversation > header #intervention { background: #1f6b4f; border-color: #1f6b4f; color: #fff; }
.conversation > header #intervention:hover:not(:disabled) { background: #175644; border-color: #175644; }
.conversation > header #status { display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.team .team-clear { min-height: 40px; padding: 0 14px; border-color: var(--grc-line); border-radius: 10px; font-size: 13.5px; box-shadow: 0 1px 2px #3c32280a; }
.team .chat-header .channel { padding: 5px 11px; border-radius: 999px; background: #f3efe8; color: #6d5a3f; font-size: 12px; font-weight: 700; }

/* ---- Redactar ---- */
#composer, #team-form { border-color: var(--grc-line) !important; border-radius: 14px !important; box-shadow: 0 2px 10px #3c32280d; }
@media (min-width: 761px) {
  #composer { margin: 12px 24px 66px !important; padding: 12px 14px !important; }
  #team-form { margin: 0 24px 66px !important; padding: 12px 14px !important; gap: 8px !important; }
  #draft { min-height: 56px; padding: 6px 4px; }
  #team-draft { min-height: 56px; padding: 10px 12px; border-color: var(--grc-line); border-radius: 10px; }
  #team-draft:focus { border-color: #e9c9a3; outline: none; box-shadow: 0 0 0 3px #f4a45026; }
  #draft-label { color: var(--grc-soft) !important; font-size: 13px; font-weight: 600; }
  #composer .actions, .team-compose-actions { gap: 8px !important; padding-top: 10px; }
  .team-compose-actions { border-top: 1px solid #f0ebe4; }
  #composer .actions > button:not(#send), #composer .actions select, .team-compose-actions > button:not(#team-send) {
    min-height: 36px; padding: 0 13px; border: 1px solid var(--grc-line); border-radius: 10px; background: #fff; color: var(--grc-ink);
    font-size: 13px; font-weight: 600; box-shadow: 0 1px 2px #3c32280a; }
  #composer .actions select { padding-right: 30px; }
  #composer .actions > button:not(#send):hover:not(:disabled), .team-compose-actions > button:not(#team-send):hover { background: var(--grc-hover); border-color: #e9c9a3; }
  #composer .actions #emojis, #team-emoji { width: 38px; padding: 0 !important; font-size: 17px !important; }
  .actions .chat-lang { min-height: 36px; border-color: var(--grc-line) !important; border-radius: 10px !important; overflow: hidden; background: #fff; }
  .actions .chat-lang button { min-height: 34px; }
  #send, #team-send { min-height: 40px !important; padding: 0 20px !important; border: 0 !important; border-radius: 10px !important;
    background: var(--grc-orange) !important; color: #2e2620 !important; font-size: 14px !important; font-weight: 700 !important; box-shadow: 0 2px 6px #f4a45040; }
  #send:hover:not(:disabled), #team-send:hover:not(:disabled) { background: var(--grc-orange-hover) !important; }
  #team-keyboard-hint { color: #8a8178; }
}

/* ---- Listas de conversaciones ---- */
@media (min-width: 761px) {
  #list .chat-row { margin: 3px 8px; border-radius: 12px; }
  #list .chat-row .chat-row-main { gap: 12px; padding: 12px 10px 12px 12px; }
  #list .chat-row .chat-icon { flex: none; }
  #list .chat-row-preview { margin-top: 2px; }
  #list .chat-metadata { margin-top: 5px; }
  /* Con ratón, los accesos rápidos aparecen al pasar por encima (o en el chat abierto) y el nombre tiene sitio. */
  @media (hover: hover) {
    #list .chat-row { position: relative; grid-template-columns: minmax(0,1fr); }
    #list .chat-row-shortcuts { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); gap: 2px; padding: 3px;
      border: 1px solid var(--grc-line); border-radius: 11px; background: #fff; box-shadow: 0 4px 14px #3c32281f; opacity: 0; pointer-events: none; transition: opacity .12s; }
    #list .chat-row:hover .chat-row-shortcuts, #list .chat-row:focus-within .chat-row-shortcuts { opacity: 1; pointer-events: auto; }
    #list .chat-row .chat-shortcut { width: 32px; min-height: 32px; border-radius: 8px; }
  }
  .team #people .person { padding: 11px 12px; margin-bottom: 4px; gap: 12px; border-radius: 12px; }
  .team #people .person:hover { background: var(--grc-hover); }
}

/* ---- Aviso de notificaciones: el desplegable «¿Cómo activar…?» va debajo del texto ---- */
.grp-card { flex-wrap: wrap; }
.grp-card > div { flex: 1 1 0; min-width: 0; }
.grp-card details { flex-basis: 100%; }
.conversation > header #chatMore > summary, .conversation > header #chatTasks > summary {
  display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 1px solid var(--grc-line) !important;
  border-radius: 10px !important; background: #fff !important; color: var(--grc-ink); font-size: 18px; list-style: none; cursor: pointer; }
.conversation > header #chatMore > summary:hover, .conversation > header #chatTasks > summary:hover { background: var(--grc-hover) !important; border-color: #e9c9a3 !important; }
.conversation > header #chatMore > summary::-webkit-details-marker, .conversation > header #chatTasks > summary::-webkit-details-marker { display: none; }
#selectChats, #selectVisible, #manageSelected { min-height: 36px; padding: 0 14px; border: 1px solid var(--grc-line); border-radius: 10px; background: #fff; color: var(--grc-ink); font-size: 13px; font-weight: 600; }
#selectChats:hover, #selectVisible:hover { background: var(--grc-hover); border-color: #e9c9a3; }
.msg-toolbar .react-button { font-size: 16px !important; color: #6d655b !important; }
@media (max-width: 760px) {
  .conversation > header .chat-actions > .chat-shortcut { width: auto; min-width: 40px; padding: 0 10px; }
}
/* Pantallas táctiles grandes: los accesos rápidos de la lista van debajo para que el nombre se lea entero. */
@media (hover: none) and (min-width: 761px) {
  #list .chat-row { grid-template-columns: minmax(0,1fr); }
  #list .chat-row-shortcuts { justify-content: flex-end; margin-top: -8px; padding: 0 8px 8px; }
}
/* v185 · Menú «⋯» del chat: todas las opciones con el mismo ancho y estilo. */
.chat-more-actions { display: grid; gap: 4px; min-width: 240px; padding: 6px !important; }
.chat-more-actions > button, .chat-more-actions > a { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 40px; height: auto; padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; color: #2f2b26; font: inherit; font-size: 14px; text-align: left; white-space: normal; }
.chat-more-actions > button:hover:not(:disabled), .chat-more-actions > a:hover { background: #fdf0e0; }
.chat-more-actions > button .shortcut-tooltip { position: static; display: inline; visibility: visible; opacity: 1; transform: none; padding: 0; background: none; box-shadow: none; color: inherit; font: inherit; white-space: normal; pointer-events: none; }
.chat-more-actions > button svg { flex: none; width: 18px; height: 18px; }
/* v226 · El número de tareas del cliente es una insignia en la esquina del icono (antes quedaba debajo y estiraba el botón). */
.conversation > header #chatTasks > summary { position: relative; }
.conversation > header #chatTasksCount { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: #d97a2b; color: #fff; font: 700 11px/18px system-ui, sans-serif; text-align: center; pointer-events: none; }
.conversation > header #chatTasksCount:empty { display: none; }
