/* Contingencia WhatsApp — estilos de la bandeja, el login y el admin.
 * Estética de WhatsApp Web (tema claro). Móvil primero, sin fuentes externas
 * (Segoe UI / system-ui), CSP sin CSS inline: los colores de avatar van por
 * clase (.tone-1 … .tone-8) y los iconos son SVG inline con currentColor. */

:root {
  color-scheme: light;

  /* Paleta WhatsApp Web (tema claro). Todo color vive aquí o en el bloque
   * oscuro de abajo: en las reglas no hay colores «a pelo». */
  --wa-green: #00a884;
  --wa-green-dark: #008069;
  --wa-teal-header: #f0f2f5;
  --wa-sidebar-bg: #ffffff;
  --wa-hover: #f5f6f6;
  --wa-active: #f0f2f5;
  --wa-border: #e9edef;
  --wa-border-strong: #d1d7db;
  --wa-text: #111b21;
  --wa-secondary: #667781;
  --wa-icon: #54656f;
  --wa-title-soft: #41525d;
  --wa-unread: #25d366;
  --wa-unread-time: #1fa855;
  --wa-badge-text: #ffffff;
  --wa-bubble-in: #ffffff;
  --wa-bubble-out: #d9fdd3;
  --wa-chat-bg: #efeae2;
  --wa-chat-pattern: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27180%27 height=%27180%27 viewBox=%270 0 180 180%27%3E%3Cg fill=%27none%27 stroke=%27%23000%27 stroke-opacity=%270.055%27 stroke-width=%271.6%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Ccircle cx=%2726%27 cy=%2730%27 r=%277%27/%3E%3Cpath d=%27M78 20l9 9m0-9l-9 9%27/%3E%3Cpath d=%27M130 34c6-9 16-9 22 0%27/%3E%3Cpath d=%27M44 92h13M50.5 85.5v13%27/%3E%3Ccircle cx=%27108%27 cy=%2796%27 r=%2710%27/%3E%3Cpath d=%27M150 104l7 12h-14z%27/%3E%3Cpath d=%27M20 140c5 7 14 7 19 0%27/%3E%3Cpath d=%27M86 150l11-7 5 11z%27/%3E%3Ccircle cx=%27140%27 cy=%27150%27 r=%274.5%27/%3E%3Cpath d=%27M64 56a7 7 0 1 0 14 0a7 7 0 1 0-14 0%27/%3E%3Cpath d=%27M160 66c-4 4-4 10 0 14%27/%3E%3Cpath d=%27M14 104c4-4 10-4 14 0%27/%3E%3Cpath d=%27M120 130h-8m4-4v8%27/%3E%3C/g%3E%3C/svg%3E");
  --wa-placeholder-bg: #f0f2f5;
  --wa-time-in: #667781;
  --wa-time-out: #667781;
  --wa-tick: #8696a0;
  --wa-tick-read: #53bdeb;
  --wa-danger: #ea0038;
  --wa-danger-text: #ea0038;
  --wa-danger-line: rgba(234, 0, 56, 0.35);
  --wa-system-pill: #ffffff;
  --wa-system-text: #54656f;
  --wa-warn-pill: #fdf3c4;
  --wa-warn-text: #5c4a00;
  --wa-shadow-bubble: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --wa-frame-bg: #d1d7db;
  --wa-hover-overlay: rgba(11, 20, 26, 0.08);
  --wa-active-overlay: rgba(11, 20, 26, 0.14);
  --wa-inset-bg: rgba(11, 20, 26, 0.05);
  --wa-attachment-bg: rgba(11, 20, 26, 0.05);
  --wa-attachment-btn-bg: #ffffff;
  --wa-sticker-meta-bg: rgba(255, 255, 255, 0.85);
  --wa-spinner-track: rgba(11, 20, 26, 0.15);
  --wa-filter-active-bg: #e7fce3;
  --wa-filter-active-text: #008069;
  --wa-chip-bg: #ffffff;
  --wa-chip-border: #d1d7db;
  --wa-chip-hover: #f7fdf5;
  --wa-input-bg: #ffffff;
  --wa-input-disabled-bg: #f7f8f9;
  --wa-locked-bg: #e9edef;
  --wa-send-disabled: #aebac1;
  --wa-search-focus-bg: #ffffff;
  --wa-avatar-bg: #dfe5e7;
  --wa-avatar-fg: #ffffff;
  --wa-foot: #8696a0;
  --wa-art-surface: #ffffff;
  --wa-art-screen: #f0f2f5;
  --wa-art-line: #d1d7db;
  --wa-art-stroke: #8696a0;
  --wa-art-out: #d9fdd3;
  --wa-art-out-line: #a9d6a2;
  --wa-dialog-backdrop: rgba(11, 20, 26, 0.55);
  --wa-dialog-shadow: 0 12px 40px rgba(11, 20, 26, 0.28);

  /* Alias que usan el admin y los componentes compartidos */
  --bg: var(--wa-teal-header);
  --surface: #ffffff;
  --surface-2: #f5f6f6;
  --input-bg: #ffffff;
  --text: var(--wa-text);
  --muted: var(--wa-secondary);
  --border: var(--wa-border-strong);
  --primary: var(--wa-green-dark);
  --primary-hover: var(--wa-green-dark);
  --primary-dark: #006c58;
  --primary-contrast: #ffffff;
  --secondary: #e9edef;
  --secondary-text: var(--wa-text);
  --tag-muted-text: var(--wa-secondary);
  --danger: #c4183a;
  --danger-contrast: #ffffff;
  --danger-bg: #fde8ec;
  --danger-bg-soft: #fff7f6;
  --warn-bg: var(--wa-warn-pill);
  --warn-text: #5c4a00;
  --ok-bg: #e7fce3;
  --ok-text: var(--wa-green-dark);
  --info-bg: #e6f4ff;
  --info-text: #0b4a6f;
  --focus: var(--wa-green);
  --brand-text: #1c1a3f;
  --topbar-bg: var(--wa-green-dark);
  --topbar-fg: #ffffff;
  --topbar-muted: rgba(255, 255, 255, 0.85);
  --topbar-border: rgba(255, 255, 255, 0.5);
  --topbar-hover: rgba(255, 255, 255, 0.12);
  --auth-band: var(--wa-green);
  --auth-card-shadow: 0 6px 18px rgba(11, 20, 26, 0.18);
  --radius: 8px;
  --tap: 44px;
  --shadow: 0 1px 2px rgba(11, 20, 26, 0.08);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Helvetica, "Lucida Grande", Arial, sans-serif;
}

/* ── Tema oscuro (paleta de WhatsApp Web oscuro) ─────────────────────────
 * theme.js pone data-theme en <html> antes del primer pintado. Contrastes de
 * texto comprobados ≥ 4.5:1 sobre su fondo (#8696a0 sobre #202c33 = 4.6,
 * #00a884 sobre #0f3327 = 4.6, #e9edef sobre #005c4b = 6.8). */
:root[data-theme="dark"] {
  color-scheme: dark;

  --wa-green: #00a884;
  --wa-green-dark: #008069;
  --wa-teal-header: #202c33;
  --wa-sidebar-bg: #111b21;
  --wa-hover: #2a3942;
  --wa-active: #2a3942;
  --wa-border: #222d34;
  --wa-border-strong: #3b4a54;
  --wa-text: #e9edef;
  --wa-secondary: #8696a0;
  --wa-icon: #aebac1;
  --wa-title-soft: #e9edef;
  --wa-unread: #00a884;
  --wa-unread-time: #00a884;
  --wa-badge-text: #111b21;
  --wa-bubble-in: #202c33;
  --wa-bubble-out: #005c4b;
  --wa-chat-bg: #0b141a;
  --wa-chat-pattern: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27180%27 height=%27180%27 viewBox=%270 0 180 180%27%3E%3Cg fill=%27none%27 stroke=%27%23fff%27 stroke-opacity=%270.06%27 stroke-width=%271.6%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Ccircle cx=%2726%27 cy=%2730%27 r=%277%27/%3E%3Cpath d=%27M78 20l9 9m0-9l-9 9%27/%3E%3Cpath d=%27M130 34c6-9 16-9 22 0%27/%3E%3Cpath d=%27M44 92h13M50.5 85.5v13%27/%3E%3Ccircle cx=%27108%27 cy=%2796%27 r=%2710%27/%3E%3Cpath d=%27M150 104l7 12h-14z%27/%3E%3Cpath d=%27M20 140c5 7 14 7 19 0%27/%3E%3Cpath d=%27M86 150l11-7 5 11z%27/%3E%3Ccircle cx=%27140%27 cy=%27150%27 r=%274.5%27/%3E%3Cpath d=%27M64 56a7 7 0 1 0 14 0a7 7 0 1 0-14 0%27/%3E%3Cpath d=%27M160 66c-4 4-4 10 0 14%27/%3E%3Cpath d=%27M14 104c4-4 10-4 14 0%27/%3E%3Cpath d=%27M120 130h-8m4-4v8%27/%3E%3C/g%3E%3C/svg%3E");
  --wa-placeholder-bg: #222e35;
  --wa-time-in: #8696a0;
  --wa-time-out: #b3d3c8;
  --wa-tick: #8696a0;
  --wa-tick-read: #53bdeb;
  --wa-danger: #ff7b8f;
  --wa-danger-text: #ffb3bf;
  --wa-danger-line: rgba(255, 123, 143, 0.4);
  --wa-system-pill: #182229;
  --wa-system-text: #8696a0;
  --wa-warn-pill: #2b2a1e;
  --wa-warn-text: #e9c46a;
  --wa-shadow-bubble: 0 1px 0.5px rgba(0, 0, 0, 0.3);
  --wa-frame-bg: #0b141a;
  --wa-hover-overlay: rgba(255, 255, 255, 0.08);
  --wa-active-overlay: rgba(255, 255, 255, 0.14);
  --wa-inset-bg: rgba(255, 255, 255, 0.06);
  --wa-attachment-bg: #182229;
  --wa-attachment-btn-bg: #202c33;
  --wa-sticker-meta-bg: rgba(32, 44, 51, 0.9);
  --wa-spinner-track: rgba(255, 255, 255, 0.15);
  --wa-filter-active-bg: #0f3327;
  --wa-filter-active-text: #00a884;
  --wa-chip-bg: #202c33;
  --wa-chip-border: #2a3942;
  --wa-chip-hover: #2a3942;
  --wa-input-bg: #2a3942;
  --wa-input-disabled-bg: #202c33;
  --wa-locked-bg: #182229;
  --wa-send-disabled: #3b4a54;
  --wa-search-focus-bg: #2a3942;
  --wa-avatar-bg: #3b4a54;
  --wa-avatar-fg: #cfd4d6;
  --wa-foot: #8696a0;
  --wa-art-surface: #202c33;
  --wa-art-screen: #111b21;
  --wa-art-line: #3b4a54;
  --wa-art-stroke: #8696a0;
  --wa-art-out: #005c4b;
  --wa-art-out-line: #3f8b74;
  --wa-dialog-backdrop: rgba(0, 0, 0, 0.65);
  --wa-dialog-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);

  --bg: #111b21;
  --surface: #202c33;
  --surface-2: #2a3942;
  --input-bg: #2a3942;
  --border: #3b4a54;
  --primary: #00a884;
  --primary-hover: #06cf9c;
  --primary-dark: #06cf9c;
  --primary-contrast: #111b21;
  --secondary: #2a3942;
  --secondary-text: #e9edef;
  --tag-muted-text: #aebac1;
  --danger: #ff7b8f;
  --danger-contrast: #111b21;
  --danger-bg: #3a1f27;
  --danger-bg-soft: #2b1d21;
  --warn-text: #e9c46a;
  --ok-bg: #0f3327;
  --ok-text: #00a884;
  --info-bg: #10232e;
  --info-text: #7fc8f8;
  --brand-text: #3ee58a;
  --topbar-bg: #202c33;
  --topbar-fg: #e9edef;
  --topbar-muted: #8696a0;
  --topbar-border: #3b4a54;
  --topbar-hover: rgba(255, 255, 255, 0.08);
  --auth-band: #005c4b;
  --auth-card-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Transición suave al cambiar de tema: theme.js pone la clase 220 ms. */
@media (prefers-reduced-motion: no-preference) {
  html.theme-transition,
  html.theme-transition *,
  html.theme-transition *::before,
  html.theme-transition *::after {
    transition:
      background-color 0.15s ease,
      color 0.15s ease,
      border-color 0.15s ease,
      fill 0.15s ease,
      stroke 0.15s ease !important;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
  margin-top: 1rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  word-break: break-all;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

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

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  display: block;
}

/* ── Botones y campos (compartidos con el admin) ────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--tap);
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 24px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  color: var(--secondary-text);
  background: var(--secondary);
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--wa-green);
  color: var(--primary-contrast);
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-text);
}

.btn-secondary:not(:disabled):hover {
  background: var(--wa-border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}

.btn-ghost:not(:disabled):hover {
  background: var(--surface-2);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger-solid {
  background: var(--danger);
  color: var(--danger-contrast);
}

.btn-danger-solid:not(:disabled):hover {
  opacity: 0.88;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input:not([type="checkbox"]),
select,
textarea,
.select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: var(--wa-green);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.25);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--surface-2);
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.field > span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.field-check input {
  width: 1.25rem;
  height: 1.25rem;
}

/* ── Avisos y etiquetas ────────────────────────────────────────────────── */

.alert {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.92rem;
  background: var(--info-bg);
  color: var(--info-text);
  overflow-wrap: anywhere;
}

.alert-info {
  background: var(--info-bg);
  color: var(--info-text);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.alert-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
  background: var(--secondary);
  color: var(--secondary-text);
}

.tag:first-child {
  margin-left: 0;
}

.tag-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.tag-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.tag-muted {
  background: var(--secondary);
  color: var(--tag-muted-text);
}

.tag-error-text {
  color: var(--danger);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.empty p {
  margin: 0;
}

.empty-title {
  font-weight: 500;
  color: var(--text);
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--wa-border-strong);
  margin-bottom: 0.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--wa-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

/* ── Login ─────────────────────────────────────────────────────────────── */

.auth {
  position: relative;
  min-height: 100%;
  padding: 0 1rem 2rem;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 222px;
  background: var(--auth-band);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 92px 0 0;
  padding: 2rem 1.75rem 1.75rem;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--auth-card-shadow);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.auth-logo {
  width: 48px;
  height: 48px;
  align-self: center;
  margin-bottom: 0.75rem;
}

.auth-title {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 300;
  color: var(--wa-title-soft);
  margin-bottom: 0.15rem;
}

.auth-sub {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: 14px;
  color: var(--wa-secondary);
}

.field-line {
  gap: 0;
  margin-bottom: 1.1rem;
}

.field-line > span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wa-secondary);
}

.field-line input {
  border: 0;
  border-bottom: 2px solid var(--wa-border-strong);
  border-radius: 0;
  padding: 0.4rem 0;
  min-height: 40px;
  background: transparent;
  font-size: 16px;
  transition: border-color 0.15s;
}

.field-line input:focus {
  border-bottom-color: var(--wa-green);
  box-shadow: none;
}

.auth-card .alert {
  margin-bottom: 1rem;
}

.auth-card .btn-block {
  margin-top: 0.25rem;
  min-height: 46px;
  font-size: 16px;
}

/* ── Marco de la bandeja ───────────────────────────────────────────────── */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.inbox-app {
  background: var(--wa-teal-header);
}

.inbox {
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--wa-sidebar-bg);
  position: relative;
}

/* Móvil: una vista a la vez. */
.sidebar {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--wa-sidebar-bg);
}

.chat {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--wa-chat-bg);
}

.inbox.show-thread .sidebar {
  display: none;
}

.inbox.show-thread .chat {
  display: flex;
}

/* ── Avatares ──────────────────────────────────────────────────────────── */

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wa-avatar-bg);
  color: var(--wa-avatar-fg);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  user-select: none;
  overflow: hidden;
}

.avatar-40 {
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.avatar-49 {
  width: 49px;
  height: 49px;
  font-size: 18px;
}

.avatar-icon {
  width: 70%;
  height: 70%;
  color: var(--wa-avatar-fg);
}

.avatar.tone-1 { background: #ffd6a5; color: #7a3e00; }
.avatar.tone-2 { background: #caffbf; color: #1e5c22; }
.avatar.tone-3 { background: #9bf6ff; color: #0b5560; }
.avatar.tone-4 { background: #a0c4ff; color: #1a3d7a; }
.avatar.tone-5 { background: #bdb2ff; color: #3b2a80; }
.avatar.tone-6 { background: #ffc6ff; color: #6f1d6f; }
.avatar.tone-7 { background: #fdffb6; color: #5c5200; }
.avatar.tone-8 { background: #ffadad; color: #7a1f1f; }

/* ── Barra lateral ─────────────────────────────────────────────────────── */

.sidebar-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  box-sizing: content-box;
  height: 39px; /* 39 + 2×10 de padding = 59px, como WhatsApp Web */
  background: var(--wa-teal-header);
}

.sidebar-user {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--wa-icon);
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wa-icon);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--wa-hover-overlay);
}

.icon-btn:active {
  background: var(--wa-active-overlay);
}

.client-select {
  flex: none;
  margin: 8px 12px 0;
  width: auto;
  min-height: 36px;
  padding: 0.3rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: var(--wa-teal-header);
  color: var(--wa-text);
  font-size: 14px;
}

.search {
  flex: none;
  height: 49px;
  padding: 7px 12px;
  background: var(--wa-sidebar-bg);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 35px;
  padding: 0 12px 0 10px;
  border-radius: 8px;
  background: var(--wa-teal-header);
  color: var(--wa-icon);
}

.search-box:focus-within {
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.35);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--wa-icon);
}

.search-input {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 35px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  color: var(--wa-text);
}

.search-input:focus {
  outline: none;
  box-shadow: none;
}

.search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-input::placeholder {
  color: var(--wa-icon);
}

.filters {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 2px 12px 10px;
  background: var(--wa-sidebar-bg);
  border-bottom: 1px solid var(--wa-border);
}

.filter {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 16px;
  background: var(--wa-teal-header);
  color: var(--wa-icon);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.filter:hover {
  background: var(--wa-border);
}

.filter[aria-pressed="true"] {
  background: var(--wa-filter-active-bg);
  color: var(--wa-filter-active-text);
}

.sidebar .alert {
  margin: 8px 12px 0;
}

.list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--wa-sidebar-bg);
}

.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.conv-btn {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  min-height: 72px;
  padding: 0 15px 0 13px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.conv-btn:hover {
  background: var(--wa-hover);
}

.conv-btn:focus-visible {
  outline-offset: -2px;
}

.conv.active .conv-btn {
  background: var(--wa-active);
}

.conv-main {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--wa-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv:last-child .conv-main {
  border-bottom-color: transparent;
}

.conv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 21px;
}

.conv-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  line-height: 21px;
  color: var(--wa-text);
}

.conv-time {
  flex: none;
  font-size: 12px;
  line-height: 14px;
  color: var(--wa-secondary);
}

.conv-tenant {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
  color: var(--wa-secondary);
}

.conv-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 20px;
  color: var(--wa-secondary);
}

.conv-side {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.conv-attended {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.conv.unread .conv-name {
  font-weight: 600;
}

.conv.unread .conv-preview {
  color: var(--wa-text);
  font-weight: 500;
}

.conv.unread .conv-time {
  color: var(--wa-unread-time);
  font-weight: 500;
}

.badge {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--wa-unread);
  color: var(--wa-badge-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

/* ── Panel de chat: placeholder ────────────────────────────────────────── */

.chat-placeholder {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--wa-placeholder-bg);
  border-bottom: 6px solid var(--wa-unread);
  text-align: center;
  position: relative;
}

.placeholder-inner {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.placeholder-art {
  width: min(300px, 70vw);
  height: auto;
  margin-bottom: 28px;
}

.placeholder-title {
  font-size: 32px;
  font-weight: 300;
  color: var(--wa-title-soft);
  margin: 0 0 12px;
}

.placeholder-text {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--wa-secondary);
}

.placeholder-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: var(--wa-foot);
}

.placeholder-art .art-surface {
  fill: var(--wa-art-surface);
}

.placeholder-art .art-screen {
  fill: var(--wa-art-screen);
}

.placeholder-art .art-line {
  fill: var(--wa-art-line);
}

.placeholder-art .art-line-stroke {
  stroke: var(--wa-art-line);
}

.placeholder-art .art-stroke {
  stroke: var(--wa-art-stroke);
}

.placeholder-art .art-out {
  fill: var(--wa-art-out);
}

.placeholder-art .art-out-line {
  stroke: var(--wa-art-out-line);
}

.foot-icon {
  width: 16px;
  height: 16px;
}

/* ── Panel de chat: hilo ───────────────────────────────────────────────── */

.thread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 59px;
  padding: 10px 16px 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--wa-teal-header);
  border-bottom: 1px solid var(--wa-border);
}

.btn-back {
  margin-left: -6px;
  margin-right: -6px;
}

.chat-title {
  flex: 1;
  min-width: 0;
}

.chat-name {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 21px;
  color: var(--wa-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sub {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--wa-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--wa-border-strong);
  border-radius: 17px;
  background: transparent;
  color: var(--wa-icon);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-pill:hover:not(:disabled) {
  background: var(--wa-hover-overlay);
}

.btn-pill:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-pill.is-attended {
  border-color: var(--primary);
  color: var(--wa-filter-active-text);
  background: var(--wa-filter-active-bg);
}

.btn-pill .icon {
  width: 18px;
  height: 18px;
}

.thread > .alert {
  margin: 8px 12px 0;
}

.chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--wa-chat-bg);
  background-image: var(--wa-chat-pattern);
  background-size: 180px 180px;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 6% 8px;
  display: flex;
  flex-direction: column;
}

.day-sep,
.system-pill {
  align-self: center;
  max-width: 90%;
  margin: 12px 0 4px;
  padding: 5px 12px 6px;
  border-radius: 7.5px;
  background: var(--wa-system-pill);
  box-shadow: var(--wa-shadow-bubble);
  color: var(--wa-system-text);
  font-size: 12.5px;
  line-height: 21px;
  text-align: center;
}

.day-sep {
  text-transform: uppercase;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  text-transform: none;
}

.system-pill-warn {
  background: var(--wa-warn-pill);
  color: var(--wa-warn-text);
}

.chat-body > .system-pill {
  flex: none;
  margin: 6px auto 10px;
}

.pill-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Burbujas */

.msg {
  display: flex;
  margin-top: 2px;
  position: relative;
}

.msg.msg-first {
  margin-top: 12px;
}

.msg-in {
  justify-content: flex-start;
}

.msg-out {
  justify-content: flex-end;
}

.bubble {
  position: relative;
  max-width: 85%;
  min-width: 68px;
  padding: 6px 7px 8px 9px;
  border-radius: 7.5px;
  background: var(--wa-bubble-in);
  box-shadow: var(--wa-shadow-bubble);
  color: var(--wa-text);
  font-size: 14.2px;
  line-height: 19px;
  overflow-wrap: anywhere;
  display: flow-root;
}

.msg-out .bubble {
  background: var(--wa-bubble-out);
}

.msg-in.msg-first .bubble {
  border-top-left-radius: 0;
}

.msg-out.msg-first .bubble {
  border-top-right-radius: 0;
}

.msg-first .bubble::before {
  content: "";
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
}

.msg-in.msg-first .bubble::before {
  left: -8px;
  border-width: 0 8px 8px 0;
  border-color: transparent var(--wa-bubble-in) transparent transparent;
}

.msg-out.msg-first .bubble::before {
  right: -8px;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent transparent var(--wa-bubble-out);
}

.msg-failed .bubble {
  box-shadow: 0 0 0 1px var(--wa-danger), var(--wa-shadow-bubble);
}

.msg-text {
  margin: 0;
  white-space: pre-wrap;
}

.msg-caption {
  padding: 6px 4px 0;
}

.msg-unsupported {
  color: var(--wa-secondary);
  font-style: italic;
}

.msg-reaction {
  font-size: 1.1rem;
}

.msg-context {
  margin: 0 0 6px;
  padding: 5px 10px;
  border-left: 4px solid var(--wa-green);
  background: var(--wa-inset-bg);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--wa-secondary);
}

.msg-type {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--wa-secondary);
}

/* Hora y ticks: flotan tras el texto, como en WhatsApp. */
.msg-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 15px;
  font-size: 11px;
  line-height: 15px;
  color: var(--wa-time-in);
  white-space: nowrap;
  vertical-align: bottom;
}

.msg-out .msg-meta {
  color: var(--wa-time-out);
}

.msg-text .msg-meta {
  float: right;
  margin: 8px -4px -5px 10px;
  position: relative;
}

.msg-meta-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.msg-author {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 3px;
}

.ticks {
  display: inline-flex;
  align-items: center;
  color: var(--wa-tick);
}

.tick-icon {
  width: 16px;
  height: 16px;
}

.ticks-read {
  color: var(--wa-tick-read);
}

.ticks-failed {
  color: var(--wa-danger);
}

.ticks-pending .tick-icon {
  width: 14px;
  height: 14px;
}

.msg-error {
  clear: both;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--wa-danger-line);
  font-size: 12px;
  line-height: 16px;
  color: var(--wa-danger-text);
}

/* Adjuntos */

.bubble-media {
  padding: 4px;
}

.bubble-media .msg-context {
  margin: 2px 4px 6px;
}

.attachment {
  display: block;
  max-width: 100%;
}

.attachment-image {
  display: block;
  line-height: 0;
}

.attachment-image img,
.attachment-sticker img {
  display: block;
  max-width: min(330px, 100%);
  max-height: 330px;
  border-radius: 6px;
  object-fit: cover;
}

.msg-sticker .bubble {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.msg-sticker.msg-first .bubble::before {
  display: none;
}

.attachment-sticker img {
  max-width: 150px;
  max-height: 150px;
  border-radius: 0;
  object-fit: contain;
}

.msg-sticker .msg-meta-row .msg-meta {
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--wa-sticker-meta-bg);
  box-shadow: var(--wa-shadow-bubble);
}

.attachment-audio {
  display: block;
  width: min(100%, 330px);
  min-width: 240px;
  height: 40px;
  margin: 2px 0;
}

.attachment-video {
  display: block;
  width: min(100%, 330px);
  max-height: 330px;
  border-radius: 6px;
  background: #000;
}

.attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 330px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--wa-attachment-bg);
  color: var(--wa-text);
}

.attachment-card .icon {
  width: 30px;
  height: 30px;
  color: var(--wa-icon);
}

.attachment-location .icon {
  color: var(--wa-danger);
}

.attachment-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.attachment-name {
  font-size: 14px;
  line-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-detail {
  font-size: 12px;
  line-height: 16px;
  color: var(--wa-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 16px;
  border: 1px solid var(--wa-border-strong);
  background: var(--wa-attachment-btn-bg);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.attachment-link:hover {
  background: var(--wa-filter-active-bg);
}

.attachment-link .icon {
  width: 16px;
  height: 16px;
  color: inherit;
}

.attachment-location {
  flex-wrap: wrap;
}

/* El enlace a Maps va en su propia fila: así la dirección no se trunca. */
.attachment-location .attachment-link {
  flex: 1 0 100%;
  justify-content: center;
  margin-top: 6px;
}

.attachment-pending,
.attachment-failed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--wa-attachment-bg);
  color: var(--wa-secondary);
  font-size: 13px;
}

.attachment-failed {
  color: var(--wa-danger);
}

.attachment-failed .icon {
  width: 20px;
  height: 20px;
}

.spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--wa-spinner-track);
  border-top-color: var(--wa-green);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Composer ──────────────────────────────────────────────────────────── */

.composer {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 62px;
  padding: 5px 16px;
  padding-bottom: calc(5px + env(safe-area-inset-bottom));
  background: var(--wa-teal-header);
}

.composer .alert {
  margin: 4px 0 0;
  font-size: 13px;
  padding: 0.5rem 0.75rem;
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 2px;
  scrollbar-width: thin;
}

.chips:empty {
  display: none;
}

.composer.is-locked .chips {
  display: none;
}

.chip {
  flex: none;
  max-width: 280px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--wa-chip-border);
  border-radius: 15px;
  background: var(--wa-chip-bg);
  color: var(--wa-text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chip:hover:not(:disabled) {
  border-color: var(--wa-green);
  background: var(--wa-chip-hover);
}

.chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 2px 0 5px;
}

.composer-input {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  background: var(--wa-input-bg);
  border-radius: 8px;
  min-height: 42px;
}

.composer-input:focus-within {
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.35);
}

.composer-input textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 118px;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--wa-text);
  font-size: 15px;
  line-height: 20px;
  resize: none;
  overflow-y: auto;
}

.composer-input textarea:focus {
  outline: none;
  box-shadow: none;
}

.composer-input textarea::placeholder {
  color: var(--wa-icon);
}

.composer-input textarea:disabled {
  background: transparent;
  color: var(--wa-secondary);
}

.composer-form.is-disabled .composer-input {
  background: var(--wa-input-disabled-bg);
}

.char-count {
  flex: none;
  align-self: center;
  padding: 0 12px 0 4px;
  font-size: 12px;
  color: var(--wa-secondary);
}

.char-count.over {
  color: var(--wa-danger);
  font-weight: 600;
}

.composer-locked {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--wa-locked-bg);
  color: var(--wa-icon);
  font-size: 13.5px;
  line-height: 18px;
}

.composer.is-locked .send-btn {
  display: none;
}

.send-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--wa-green);
  color: var(--primary-contrast);
  cursor: pointer;
  transition: background 0.15s;
}

.send-btn .icon {
  width: 22px;
  height: 22px;
  margin-left: 2px;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.send-btn:disabled {
  background: var(--wa-send-disabled);
  cursor: not-allowed;
}

.send-btn.is-sending .icon {
  animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ── Admin ─────────────────────────────────────────────────────────────── */

.admin-app {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  padding-top: calc(0.5rem + env(safe-area-inset-top));
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  flex: none;
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.topbar .brand {
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
}

.topbar .muted,
.topbar-subtitle {
  color: var(--topbar-muted);
}

.topbar .select {
  max-width: 260px;
  min-height: 38px;
  padding: 0.3rem 0.6rem;
  border-color: var(--topbar-border);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}

.topbar-nav .btn-ghost {
  color: var(--topbar-fg);
  border-color: var(--topbar-border);
  min-height: 38px;
  padding: 0.3rem 0.9rem;
}

.topbar-nav .btn-ghost:not(:disabled):hover {
  background: var(--topbar-hover);
}

.topbar .theme-toggle {
  color: var(--topbar-fg);
}

.topbar .theme-toggle:hover {
  background: var(--topbar-hover);
}

.user-email {
  display: none;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Fluido: aprovecha el ancho de la ventana (tope 1800 px); en ≥1200 px las
 * tarjetas van en dos columnas y las tablas grandes (.card-wide) a lo ancho. */
.admin {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 1rem 0.75rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--wa-border);
  text-align: left;
  vertical-align: top;
}

.table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}

.table .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.row-disabled td {
  opacity: 0.6;
}

.row-form td {
  background: var(--surface-2);
}

.row-error td {
  background: var(--danger-bg-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
}

.form-span {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.form-inline input {
  flex: 1;
  min-width: 200px;
}

/* Resultado de la palanca masiva: resumen fijo + tabla paginada (admin.js). */
.result {
  margin-bottom: 1rem;
  padding: 0.75rem 0.75rem 0.25rem;
  border: 1px solid var(--wa-border);
  border-radius: var(--radius);
  background: var(--surface);
}

.result-head {
  margin-bottom: 0.25rem;
}

.result-head h3 {
  margin: 0;
}

.result-summary {
  margin: 0 0 0.6rem;
  font-weight: 500;
}

.qr-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.qr-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--wa-border);
}

.qr-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ── Escritorio: dos columnas ──────────────────────────────────────────── */

@media (min-width: 768px) {
  .user-email {
    display: inline-block;
  }

  .sidebar {
    flex: 0 0 30%;
    min-width: 300px;
    max-width: 480px;
    border-right: 1px solid var(--wa-border);
  }

  .chat {
    display: flex;
  }

  .inbox.show-thread .sidebar {
    display: flex;
  }

  .btn-back {
    display: none;
  }

  .sidebar-header,
  .chat-header {
    padding-top: 10px;
  }

  .composer {
    padding-bottom: 5px;
  }

  .bubble {
    max-width: 65%;
  }

  .section-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin {
    padding: 1.5rem 1.5rem 3rem;
  }
}

@media (min-width: 1200px) {
  .admin {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    padding: 1.5rem 2rem 3rem;
  }

  .admin > .card-wide,
  .admin > .alert {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1400px) {
  .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ── Pantallas grandes: marco centrado sobre la franja verde ──────────── */

/* Diseño fluido: la bandeja ocupa toda la ventana en cualquier ancho (sin marco
 * centrado como WhatsApp Web); el sidebar escala entre 320 y 480px. */

/* ── Móvil: objetivos táctiles y burbujas anchas ──────────────────────── */

@media (max-width: 767px) {
  .icon-btn,
  .send-btn {
    width: 44px;
    height: 44px;
  }

  .filter {
    flex: 1;
  }

  .messages {
    padding: 10px 12px 8px;
  }

  .sidebar-user {
    display: none;
  }

  /* Objetivos táctiles ≥ 44px: píldora de estado y respuestas rápidas. */
  .btn-pill {
    height: 44px;
    padding: 0 14px;
  }

  .chip {
    height: 44px;
    padding: 0 14px;
    border-radius: 22px;
  }

  .filter {
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Ajustes finales: auto-crecimiento del textarea y burbujas de media ─── */

/* El ::after replica el texto (attr) y fija la altura del grid; el textarea
 * ocupa la misma celda. Sin JS sobre `style`, que la CSP no permite. */
.composer-grow {
  flex: 1;
  min-width: 0;
  display: grid;
}

.composer-grow::after {
  content: attr(data-value) " ";
  visibility: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.composer-grow::after,
.composer-grow textarea {
  grid-area: 1 / 1 / 2 / 2;
  box-sizing: border-box;
  min-height: 42px;
  max-height: 118px;
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  line-height: 20px;
  overflow-y: auto;
}

.composer-grow textarea {
  width: 100%;
}

.bubble-media .msg-meta-row,
.bubble-media .msg-error {
  margin-left: 4px;
  margin-right: 4px;
}

.bubble-media .msg-meta-row {
  margin-top: 2px;
  margin-bottom: 1px;
}

/* ── Marca CLONAI y buscador ─────────────────────────────────────────────── */

.brand-tile {
  display: inline-flex;
  flex: none;
  width: 36px;
  height: 36px;
}

.brand-tile svg,
svg.brand-tile {
  width: 100%;
  height: 100%;
  display: block;
}

svg.brand-tile {
  width: 36px;
  height: 36px;
  flex: none;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin-right: 2px;
  border-radius: 10px;
  text-decoration: none;
}

.sidebar-brand:focus-visible {
  outline: 2px solid var(--wa-green);
  outline-offset: 2px;
}

.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topbar svg.brand-tile {
  width: 30px;
  height: 30px;
}

svg.auth-logo-tile {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  filter: drop-shadow(0 4px 10px rgba(28, 26, 63, 0.25));
}

.auth-sub strong {
  color: var(--brand-text);
  letter-spacing: 0.04em;
}

.placeholder-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 0;
  color: var(--wa-secondary);
  font-size: 14px;
}

.placeholder-brand svg.brand-tile {
  width: 40px;
  height: 40px;
}

.placeholder-brand strong {
  color: var(--brand-text);
  letter-spacing: 0.04em;
}

/* Buscador: una sola píldora con la lupa dentro y una × para limpiar. */
.search {
  height: auto;
  padding: 8px 12px;
}

.search-box {
  position: relative;
  gap: 10px;
  height: 38px;
  padding: 0 6px 0 14px;
  border-radius: 19px;
  background: var(--wa-teal-header);
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.search-box:focus-within {
  background: var(--wa-search-focus-bg);
  box-shadow: 0 0 0 1.5px var(--wa-green);
}

.search-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.search-input {
  height: 38px;
  font-size: 15px;
}

.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.search-clear {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wa-icon);
  cursor: pointer;
}

.search-clear .icon {
  width: 18px;
  height: 18px;
}

.search-clear:hover,
.search-clear:focus-visible {
  background: var(--wa-hover-overlay);
  outline: none;
}

.search-box.has-value .search-clear {
  display: inline-flex;
}

@media (max-width: 767px) {
  .search-clear {
    width: 36px;
    height: 36px;
  }
}

/* El input del buscador vive DENTRO de la píldora: sin caja propia ni borde,
 * gane quien gane en las reglas globales de formularios. */
.search-box .search-input,
.search-box .search-input:focus,
.search-box .search-input:focus-visible {
  height: 38px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  font-size: 15px;
  line-height: 38px;
}

/* ── Conmutador de tema ─────────────────────────────────────────────────── */

/* Luna en claro (invita al oscuro), sol en oscuro. */
.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.theme-toggle .icon {
  width: 22px;
  height: 22px;
}

/* Login: discreto, en la esquina de la tarjeta. */
.auth-card .theme-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  color: var(--wa-secondary);
}

.auth-card .theme-toggle .icon {
  width: 20px;
  height: 20px;
}

/* ── Respuestas rápidas: fila de chips + panel de edición ───────────────── */

.chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chips-row .chips {
  flex: 1;
  min-width: 0;
}

.composer.is-locked .chips-row {
  display: none;
}

.qr-edit-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--wa-chip-border);
  border-radius: 50%;
  background: var(--wa-chip-bg);
  color: var(--wa-icon);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.qr-edit-btn .icon {
  width: 16px;
  height: 16px;
}

.qr-edit-btn:hover:not(:disabled) {
  border-color: var(--wa-green);
  color: var(--primary);
  background: var(--wa-chip-hover);
}

.qr-edit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* El <dialog> nativo: modal, foco atrapado, Esc cierra. Sin padding propio,
 * así un click sobre el propio elemento solo puede venir del ::backdrop. */
.qr-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(640px, calc(100vw - 32px));
  max-width: 640px;
  max-height: min(85vh, 760px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--wa-dialog-shadow);
  overflow: hidden;
}

.qr-dialog[open] {
  display: flex;
  flex-direction: column;
}

.qr-dialog::backdrop {
  background: rgba(11, 20, 26, 0.55);
}

:root[data-theme="dark"] .qr-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.qr-dialog.is-busy {
  cursor: progress;
}

.qr-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 12px 12px 20px;
  background: var(--wa-teal-header);
  border-bottom: 1px solid var(--wa-border);
}

.qr-head-text {
  flex: 1;
  min-width: 0;
}

.qr-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 24px;
  color: var(--wa-text);
}

.qr-subtitle {
  margin: 4px 0 0;
  font-size: 13.5px;
  line-height: 18px;
  color: var(--wa-secondary);
}

.qr-dialog .qr-dialog-error {
  flex: none;
  margin: 12px 20px 0;
}

.qr-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 20px 8px;
}

.qr-defaults {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--info-bg);
  color: var(--info-text);
  font-size: 14px;
  line-height: 19px;
}

.qr-defaults p {
  flex: 1 1 220px;
  margin: 0;
}

.qr-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.qr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--wa-border);
}

.qr-row:last-child {
  border-bottom: 0;
}

/* Textarea de una línea que crece (mismo truco que el composer: el ::after
 * replica el texto con attr() y fija la altura; nada de style inline). */
.qr-grow {
  flex: 1 1 100%;
  min-width: 0;
  display: grid;
}

.qr-grow::after {
  content: attr(data-value) " ";
  visibility: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.qr-grow::after,
.qr-grow textarea {
  grid-area: 1 / 1 / 2 / 2;
  box-sizing: border-box;
  min-height: 42px;
  max-height: 160px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14.5px;
  line-height: 20px;
  overflow-y: auto;
}

.qr-grow textarea {
  width: 100%;
  resize: none;
  background: var(--input-bg);
  color: var(--text);
}

.qr-row-tools {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.qr-spacer {
  flex: 1;
}

.qr-order-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--wa-icon);
  cursor: pointer;
  transition: background 0.15s;
}

.qr-order-btn .icon {
  width: 18px;
  height: 18px;
}

.qr-order-btn:hover:not(:disabled) {
  background: var(--wa-hover-overlay);
}

.qr-order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* «Guardar» solo se pone verde cuando hay algo que guardar. */
.qr-save:disabled {
  background: var(--secondary);
  color: var(--tag-muted-text);
  opacity: 0.8;
}

/* Confirmación en dos pasos dentro de la fila: sustituye a los botones. */
.qr-confirm {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

.qr-confirm-text {
  margin-right: 4px;
}

.qr-row.is-confirming .qr-confirm {
  display: inline-flex;
}

.qr-row.is-confirming .qr-save,
.qr-row.is-confirming .qr-delete,
.qr-row.is-confirming .qr-order-btn {
  display: none;
}

.qr-new {
  flex: none;
  padding: 12px 20px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--wa-border);
  background: var(--wa-teal-header);
}

.qr-new-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--wa-secondary);
}

.qr-new-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-new-row input {
  flex: 1;
  min-width: 0;
}

@media (min-width: 768px) {
  .qr-row {
    flex-wrap: nowrap;
  }

  .qr-grow {
    flex: 1 1 auto;
  }

  .qr-row-tools {
    flex: none;
    padding-top: 3px;
  }

  .qr-spacer {
    display: none;
  }

  .qr-row-tools .qr-order-btn + .qr-order-btn {
    margin-right: 4px;
  }
}

/* Móvil: hoja inferior y objetivos táctiles ≥ 44px. */
@media (max-width: 767px) {
  .qr-dialog {
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    border-radius: 16px 16px 0 0;
  }

  .qr-head,
  .qr-body,
  .qr-new {
    padding-left: 16px;
    padding-right: 16px;
  }

  .qr-dialog .qr-dialog-error {
    margin-left: 16px;
    margin-right: 16px;
  }

  .qr-edit-btn,
  .qr-order-btn {
    width: 44px;
    height: 44px;
  }

  .qr-edit-btn {
    border-radius: 22px;
  }

  .qr-edit-btn .icon {
    width: 20px;
    height: 20px;
  }

  .qr-dialog .btn-sm {
    min-height: 44px;
    padding: 0.4rem 1rem;
  }
}

/* ── Admin: tablas largas (buscador, filtros, paginación, filas de 48 px) ──
 * Clientes y usuarios se filtran y paginan en el navegador (admin.js). El
 * lupa del buscador va como SVG en un token para poder cambiar de color en
 * el tema oscuro. */

:root {
  --admin-search-icon: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27%2354656f%27%3E%3Cpath d=%27M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z%27/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  --admin-search-icon: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27%23aebac1%27%3E%3Cpath d=%27M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z%27/%3E%3C/svg%3E");
}

.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
}

.table-search {
  flex: 1 1 260px;
  min-width: 0;
}

.table-select {
  flex: 0 1 320px;
  min-width: 0;
}

/* Más específico que input:not([type="checkbox"]), cuyo background corto
 * borraría la lupa. */
.table-search .table-search-input,
.table-search .table-search-input:focus {
  min-height: 38px;
  padding: 0.4rem 0.9rem 0.4rem 2.5rem;
  border-radius: 19px;
  background-color: var(--surface-2);
  background-image: var(--admin-search-icon);
  background-repeat: no-repeat;
  background-position: 0.85rem center;
  background-size: 18px 18px;
}

.table-search .table-search-input:focus {
  background-color: var(--input-bg);
}

.table-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.table-select .select {
  min-height: 38px;
  padding: 0.35rem 0.75rem;
  border-radius: 19px;
}

/* Chips: los mismos del filtro de la bandeja, pero sobre la tarjeta (en oscuro
 * el fondo del sidebar y el de la tarjeta coinciden, así que se usa surface-2). */
.table-filters {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.table-filters .filter {
  flex: 0 0 auto;
  min-height: 32px;
  background: var(--surface-2);
}

.table-filters .filter:hover {
  background: var(--wa-border-strong);
}

.table-filters .filter[aria-pressed="true"] {
  background: var(--wa-filter-active-bg);
  color: var(--wa-filter-active-text);
}

/* Filas compactas: celdas centradas verticalmente y acciones en una línea. */
.table-compact th,
.table-compact td {
  padding: 0.35rem 0.5rem;
  vertical-align: middle;
}

.table-compact td.nowrap {
  white-space: nowrap;
}

/* La columna de acciones mide lo que miden sus botones (width: 1% + nowrap)
 * para que el nombre del restaurante absorba el resto. */
.table-compact td.actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.table-compact .th-actions {
  text-align: right;
}

.table-compact .cell-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.table-compact .actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.btn-more {
  min-width: 36px;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 700;
}

/* Menú «⋯»: popover nativo (capa superior, no lo recorta el .table-wrap; cierra
 * con Esc y clic fuera) anclado bajo el botón que lo abre. */
.row-menu {
  min-width: 200px;
  margin: 0;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--wa-dialog-shadow);
}

.row-menu:popover-open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@supports (position-area: block-end) {
  .row-menu:popover-open {
    inset: auto;
    margin: 4px 0;
    position-area: block-end span-inline-start;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}

.row-menu-title {
  display: none;
  padding: 0.4rem 0.9rem 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sin anclaje el popover sale centrado: el título dice de qué restaurante es. */
@supports not (position-area: block-end) {
  .row-menu-title {
    display: block;
  }
}

.row-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.row-menu-item:hover {
  background: var(--surface-2);
}

/* Navegadores sin Popover API: las acciones se muestran en línea y sobra el «⋯». */
@supports not selector(:popover-open) {
  .btn-more,
  .row-menu-title {
    display: none;
  }

  .row-menu {
    display: contents;
  }

  .row-menu-item {
    width: auto;
    min-height: 36px;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--primary);
    font-size: 0.9rem;
  }
}

/* Confirmación en dos pasos de «Desactivar» usuario, dentro de la fila: la
 * pregunta arriba y los dos botones debajo, para no ensanchar la columna. */
.table-compact .confirm-inline {
  flex-wrap: wrap;
  align-items: center;
}

.confirm-text {
  flex: 1 1 100%;
  font-size: 0.85rem;
  color: var(--danger);
  white-space: normal;
  text-align: right;
}

/* Pie: contador y paginación. */
.table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 0.75rem;
}

.table-count {
  margin: 0;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.pager-size .select {
  width: auto;
  min-height: 36px;
  padding: 0.25rem 0.5rem;
}

.pager-btn {
  min-height: 36px;
}

.pager-info {
  min-width: 7.5rem;
  text-align: center;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.empty > .btn {
  margin-top: 0.5rem;
}

@media (max-width: 767px) {
  /* La tabla no se comprime a 390 px: conserva un ancho legible y .table-wrap
   * la desplaza en horizontal; la primera columna (nombre o correo) queda fija
   * para saber de qué fila son las acciones. */
  .table-compact {
    min-width: 860px;
  }

  .table-compact th:first-child,
  .table-compact td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 40vw;
    background: var(--surface);
    box-shadow: 1px 0 0 var(--wa-border);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .table-compact .row-form td {
    position: static;
    width: auto;
  }

  /* La fecha fija del historial no se parte: pin estrecho y una sola linea. */
  .table-compact td.nowrap:first-child {
    width: auto;
    white-space: nowrap;
  }

  /* La celda fija no puede ser translúcida (se vería lo que pasa debajo):
   * el deshabilitado va en gris ahí y difuminado en el resto de la fila. */
  .table-compact .row-disabled td:first-child {
    opacity: 1;
    color: var(--muted);
  }

  /* En móvil las acciones de usuarios se apilan; el «⋯» de clientes cabe en línea. */
  .table-compact .actions-stack {
    flex-direction: column;
    align-items: flex-end;
  }

  .table-compact .actions-stack .btn {
    min-width: 11.5rem;
    justify-content: center;
  }

  .table-filters .filter {
    min-height: 36px;
  }

  .table-select {
    flex-basis: 100%;
  }

  .pager {
    width: 100%;
    justify-content: space-between;
  }

  .pager-size {
    flex-basis: 100%;
    margin-right: 0;
  }

  .pager-info {
    min-width: 0;
  }
}

/* Celdas truncadas a una línea (error del historial y del resultado masivo):
 * el texto completo va en title y la fila se expande al hacer clic. */
.table-compact td.cell-clip {
  width: 28%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-toggle {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Columnas de texto libre en tablas de media anchura (historial): elipsis con
 * el texto completo en title; la fila expandida las muestra enteras. */
.table-compact td.cell-ellipsis {
  width: 25%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-compact tr.is-expandable {
  cursor: pointer;
}

.table-compact tr.is-expanded td.cell-clip,
.table-compact tr.is-expanded td.cell-ellipsis,
.table-compact tr.is-expanded .clip-toggle {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Textarea temporal del respaldo de «Copiar los fallidos». */
.clip-scratch {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
