*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

/* the [hidden] attribute loses to any author rule of equal specificity that
   sets display (e.g. .field{display:flex}), since author styles come after
   the UA stylesheet in the cascade — force it to actually hide. */
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--pri); }

:focus-visible {
  outline: 2px solid var(--pri);
  outline-offset: 2px;
}

.jt td, .jt th, .jf, .btn { outline-offset: 1px; }

h1, h2, h3 { margin: 0; font-weight: 700; }

/* ---------- shell ---------- */

.shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.page {
  flex: 1;
  padding: 24px 32px;
}

.narrow {
  max-width: 680px;
  margin-inline: auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head .subtitle { margin-top: 4px; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-shrink: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--ink); }

/* ---------- sidebar ---------- */

.side {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--side-bg);
  color: var(--side-muted);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  z-index: 20;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  color: var(--side-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.side-brand img { width: 28px; height: 28px; display: block; }

.side-nav { flex: 1; padding: 4px 10px; }

.side-group { margin-bottom: 2px; border-radius: var(--r-sm); }
.side-group.is-active { background: var(--side-active-bg); }

.side-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
}
.side-group.is-active > .side-group-head { color: var(--side-active); font-weight: 700; }
.side-group-head:hover { background: var(--side-hover); }
.side-group-head i.icon { width: 16px; text-align: center; }
.side-group-head .chev { margin-left: auto; transition: transform .15s; font-size: 12px; }
.side-group.is-open .side-group-head .chev { transform: rotate(90deg); }

.side-sub { list-style: none; margin: 0; padding: 2px 0 6px 22px; display: none; }
.side-group.is-open .side-sub { display: block; }

.side-sub li { border-left: 2px solid var(--side-line); }
.side-sub a {
  display: block;
  padding: 7px 10px;
  color: var(--side-muted);
  text-decoration: none;
  font-size: 13px;
  margin-left: -1px;
}
.side-sub a:hover { color: var(--side-ink); }
.side-sub li.is-active { border-left-color: var(--side-active); }
.side-sub li.is-active a { color: var(--side-active); font-weight: 700; }

.side-foot {
  position: sticky;
  bottom: 0;
  background: var(--side-bg);
  border-top: 1px solid var(--side-line);
  padding: 12px 16px;
  flex-shrink: 0;
}
.side-foot .who { color: var(--side-ink); font-size: 13px; margin-bottom: 6px; overflow-wrap: anywhere; }
.side-foot form { margin: 0; }
.side-foot button {
  border: 0;
  background: none;
  color: var(--side-muted);
  font: inherit;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}
.side-foot button:hover { color: var(--side-ink); }
.side-foot .side-foot-link {
  display: block;
  color: var(--side-muted);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 6px;
}
.side-foot .side-foot-link:hover { color: var(--side-ink); }
.side-foot .side-version { color: var(--side-muted); font-family: var(--mono); font-size: 12px; margin-top: 8px; }

/* ---------- topbar (mobile) ---------- */

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 15;
}
.topbar .menu-btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: var(--r-sm);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 26, 32, .45);
  z-index: 19;
}

@media (max-width: 900px) {
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .shell.is-drawer-open .side { transform: translateX(0); }
  .shell.is-drawer-open .scrim { display: block; }
  .topbar { display: flex; }
  .page { padding: 16px; }
  .page-head { flex-direction: column; align-items: stretch; }
}

/* ---------- card ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh);
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 700;
}
.card-body { padding: 18px 20px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.25;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-pri { background: var(--pri); color: var(--pri-ink); }
.btn-pri:hover:not(:disabled) { background: var(--pri-hover); }

.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- badge ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-pri { background: var(--pri-soft); color: var(--pri-soft-ink); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-neutral { background: var(--line); color: var(--muted); }

/* ---------- messages / toasts ---------- */

.msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.msg-success { background: var(--ok-soft); color: var(--ok); }
.msg-danger { background: var(--danger-soft); color: var(--danger); }
.msg-warning { background: var(--warn-soft); color: var(--warn); }
.msg-info { background: var(--pri-soft); color: var(--pri-soft-ink); }

.toast-region {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 60;
  width: 100%;
  max-width: 420px;
  padding: 0 16px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--sh-lg);
  background: var(--card);
  border: 1px solid var(--line);
  pointer-events: auto;
  animation: toast-in .25s ease-out;
}
.toast i { font-size: 16px; flex-shrink: 0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast-success { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.toast-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.toast-warning { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ---------- notificaciones de chat pendientes (persistente, no un toast) ---------- */

/* abajo a la derecha, no arriba — ahí arriba ya vive el botón de acción
   de cada página (ej. "Nuevo ticket") y se pisaban. */
.chat-notif {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 55;
}
.chat-notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--sh);
  color: var(--ink);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.chat-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.chat-notif-panel {
  position: absolute;
  bottom: 48px;
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: 60vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
}
.chat-notif-head {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.chat-notif-list { list-style: none; margin: 0; padding: 0; }
.chat-notif-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  cursor: pointer;
  color: inherit;
}
.chat-notif-item:hover { background: var(--bg); }
.chat-notif-item:last-child { border-bottom: none; }
.chat-notif-item .who { font-size: 12px; font-weight: 600; color: var(--pri); }
.chat-notif-item .subject { font-size: 13px; font-weight: 600; margin-top: 2px; }
.chat-notif-item .body { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-notif-empty { padding: 16px 14px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- table ---------- */

.jt-wrap { overflow-x: auto; }
.jt { width: 100%; border-collapse: collapse; }
.jt th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.jt td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.jt tbody tr:hover { background: var(--bg); }
.jt .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.jt a.row-link { color: var(--ink); text-decoration: none; font-weight: 500; }
.jt a.row-link:hover { color: var(--pri); }
.jt a.id-link { color: var(--ok); text-decoration: none; font-weight: 700; }
.jt a.id-link:hover { text-decoration: underline; }

.jt-empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label { font-size: 13px; font-weight: 500; }

.jf {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 12px;
}
.jf:focus-visible {
  outline: none;
  border-color: var(--pri);
  box-shadow: 0 0 0 3px var(--pri-soft);
}

.field .help { font-size: 12px; color: var(--muted); }
.field .errors { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--danger); }

/* interruptor sobre un checkbox nativo, sin librería — .field > label (0,1,1)
   le gana en especificidad a .toggle (0,1,0) si no se escribe así. */
.field > label.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle .track {
  display: block;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background .15s ease;
}
.toggle .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--card);
  transition: transform .15s ease;
}
.toggle input:checked + .track { background: var(--pri); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px var(--pri-soft); }

/* asunto/descripción son lo que más importa al crear un ticket; el resto de
   campos (solicitante, buzones, categoría...) es metadata de apoyo y vive en
   el sidebar de .ticket-layout, más chico. */
.field-primary > label { font-size: 15px; font-weight: 700; }
.jf-lg { font-size: 16px; padding: 12px 14px; }
textarea.jf-lg { resize: vertical; line-height: 1.5; }

.form-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.password-field { position: relative; }
.password-field .jf { padding-right: 44px; }

.filters-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pri);
  color: var(--pri-ink);
  font-size: 11px;
  font-weight: 600;
}

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--pri-soft);
  color: var(--pri-soft-ink);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  max-width: 260px;
}
.filter-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 10px;
}
.filter-chip-remove:hover { background: rgba(8, 102, 112, .15); }

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px 20px;
}
.filters-grid .field { margin-bottom: 0; }

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 26, 32, .45);
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-dialog {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 880px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
}
.password-toggle:hover { color: var(--ink); }

/* ---------- login ---------- */

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 16px;
}
.login-box { width: 100%; max-width: 360px; }
.login-version { margin: 12px 0 0; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}
.login-brand img { width: 32px; height: 32px; }
.login-brand span { font-weight: 700; font-size: 18px; }

/* ---------- ticket detail ---------- */

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.timeline li { display: flex; gap: 10px; }
.timeline .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pri); margin-top: 6px; flex-shrink: 0;
}
.timeline .who { font-weight: 500; }
.timeline .when { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.timeline .comment { margin-top: 2px; white-space: pre-wrap; }

/* ---------- chat en vivo ---------- */

.chat-thread {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-message {
  max-width: 82%;
  padding: 8px 12px;
  border-radius: var(--r);
  background: var(--bg);
  align-self: flex-start;
}
.chat-message.is-mine { align-self: flex-end; background: var(--pri-soft); color: var(--pri-soft-ink); }
.chat-message .who { font-size: 11px; font-weight: 600; color: var(--muted); }
.chat-message.is-mine .who { color: var(--pri-soft-ink); }
.chat-message .when { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chat-unread-divider {
  display: flex;
  align-items: center;
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.chat-unread-divider::before,
.chat-unread-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--danger-soft);
}
.chat-unread-divider span { padding: 0 8px; }
/* dos check de FontAwesome superpuestos, como WhatsApp: sin leer se ve
   uno solo (el segundo, .check-2), leído los dos encimados y en color. */
.read-check { display: inline-flex; align-items: center; margin-left: 4px; color: var(--muted); }
.read-check i { font-size: 11px; }
.read-check .check-1 { display: none; }
.read-check.is-read .check-1 { display: inline-block; margin-right: -6px; }
.read-check.is-read { color: var(--pri); }
.chat-composer { display: flex; gap: 8px; align-items: stretch; }
.chat-composer textarea { flex: 1; resize: none; }
/* misma altura que el textarea (align-items:stretch del padre) — los
   botones se separan a las puntas en vez de apilarse pegados arriba. */
.composer-actions { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }

.chat-attachments { display: flex; flex-direction: column; gap: 4px; }
.chat-attachment-img { max-width: 100%; max-height: 220px; border-radius: var(--r-sm); display: block; }
.chat-attachment-file { display: flex; align-items: center; gap: 6px; color: inherit; text-decoration: underline; }

/* cubre la tarjeta del chat completa, no solo el textarea */
.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pri-soft);
  border: 3px dashed var(--pri);
  border-radius: var(--r);
  pointer-events: none;
}
.drop-overlay-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r);
  background: var(--card);
  color: var(--pri);
  font-weight: 600;
  box-shadow: var(--sh);
}

/* usado tanto en el widget del cliente como en el panel del agente */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 0;
}
.typing-dots { display: inline-flex; gap: 2px; }
.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .3;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- archivos adjuntos ---------- */

.attachment-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  max-width: 100%;
}
.attachment-link:hover { border-color: var(--pri); color: var(--pri); }
.attachment-link i { color: var(--muted); flex-shrink: 0; }
.attachment-link span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { color: var(--muted); font-size: 12px; flex-shrink: 0; margin-left: auto; padding-left: 8px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--pri); background: var(--pri-soft); }
.dropzone.is-dragover { border-color: var(--pri); background: var(--pri-soft); color: var(--pri-soft-ink); }
.dropzone.is-disabled { opacity: .6; pointer-events: none; }
.dropzone i { font-size: 22px; color: var(--pri); }
.dropzone p { margin: 0; font-size: 13px; }
.dropzone .dropzone-link { color: var(--pri); font-weight: 600; text-decoration: underline; }

.attachment-picks { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attachment-picks:empty { margin: 0; }
.attachment-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  font-size: 13px;
}
.attachment-pick i.fa-file { color: var(--muted); flex-shrink: 0; }
.attachment-pick .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-pick .size { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.attachment-pick .remove-btn {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
}
.attachment-pick .remove-btn:hover { color: var(--danger); }
.attachment-pick .pick-spinner { display: none; flex-shrink: 0; }
.attachment-pick.is-uploading .remove-btn { display: none; }
.attachment-pick.is-uploading .pick-spinner { display: inline-block; }
.attachment-pick.is-uploading .name { color: var(--muted); }

.action-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.action-bar:not(:empty) ~ .field { margin-top: 16px; }

.ticket-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.ticket-side { position: sticky; top: 20px; }

@media (max-width: 900px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-side { position: static; }
}

.ticket-side .card-body { padding: 14px 18px; }
.meta-list { display: flex; flex-direction: column; }
.meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.meta-row:last-child { border-bottom: 0; padding-bottom: 0; }
.meta-row:first-child { padding-top: 0; }
.meta-row .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  flex-shrink: 0;
  padding-top: 1px;
}
.meta-row .value { text-align: right; overflow-wrap: anywhere; }
.meta-row .value .when { color: var(--muted); font-size: 12px; }

.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* logo de un canal externo (imagen), del tamaño del texto */
.channel-icon { height: 1.15em; width: auto; vertical-align: -0.2em; }

/* tooltip instantáneo (ver shell.js): cualquier elemento con data-tip */
.tip {
  position: fixed; z-index: 300; top: 0; left: 0;
  background: #1f2937; color: #fff; font-size: 12px; line-height: 1.3;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .08s;
}
.tip.is-visible { opacity: 1; }
.channel-mark { display: inline-block; cursor: default; }
/* la columna Canal (solo ícono) va centrada, encabezado incluido */
.jt th.channel-cell, .jt td.channel-cell { text-align: center; }

/* ---------- análisis ---------- */
.an-filters { margin-bottom: 16px; }
.an-filter-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: start; }
.an-filter-row .field { margin-bottom: 0; min-width: 180px; }
.an-filter-row .field:first-child { flex: 1 1 320px; }
.an-filter-row .field[hidden] { display: none; }
#an-content { transition: opacity .15s; }
#an-content.is-loading { opacity: .5; pointer-events: none; }
.an-range { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.an-kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 14px 16px; }
.an-kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.an-kpi .value { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.an-kpi .delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.an-kpi .delta.good { color: var(--ok); }
.an-kpi .delta.bad { color: var(--danger); }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.an-block { margin-top: 16px; }
.an-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.an-chart { position: relative; height: 260px; }
.an-mode { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.an-mode button { border: 0; background: var(--card); color: var(--muted); font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; }
.an-mode button[aria-pressed="true"] { background: var(--pri-soft); color: var(--pri-soft-ink); font-weight: 600; }
.an-details { margin-top: 12px; font-size: 13px; }
.an-details summary { cursor: pointer; color: var(--muted); }
.an-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
/* enlace suelto de la barra lateral (sin submenú), mismo aspecto que un grupo */
.side-link { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: var(--r-sm); color: inherit; text-decoration: none; font-weight: 500; }
.side-link:hover { background: var(--side-hover); }
.side-link i.icon { width: 16px; text-align: center; }
.side-link.is-active { color: var(--side-active); font-weight: 700; background: var(--side-active-bg); }

/* ---------- encuesta de satisfacción ---------- */
.sv-faces { border: 0; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sv-faces legend { font-weight: 700; margin-bottom: 10px; }
.sv-faces label { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; font-size: 13px; }
.sv-faces label span { font-size: 28px; line-height: 1; }
.sv-faces input { position: absolute; opacity: 0; pointer-events: none; }
.sv-faces label:has(input:checked) { border-color: var(--pri); background: var(--pri-soft); color: var(--pri-soft-ink); font-weight: 600; }
.sv-faces label:has(input:focus-visible) { outline: 2px solid var(--pri); outline-offset: 2px; }
.sv-emoji { font-size: 22px; vertical-align: -3px; }
.sv-answer { margin: 12px 0; }
.survey-ask { align-self: center; font-size: 13px; color: var(--muted); }
.action-bar [data-survey][aria-pressed="true"] { border-color: var(--pri); background: var(--pri-soft); color: var(--pri-soft-ink); }
