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

:root {
  --bg: #050816;
  --bg-soft: #0b1020;
  --bg-softer: #111827;
  --accent: #f472b6;
  --accent-soft: #f9a8d4;
  --accent-strong: #ec4899;
  --border: #1f2937;
  --text: #f9fafb;
  --text-soft: #9ca3af;
  --danger: #ef4444;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 40px rgba(0,0,0,0.45);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.crm-body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at top left, #111827 0, #020617 45%, #000 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */

.crm-header {
  height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(15,23,42,0.98), rgba(24,24,27,0.96));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55);
  position: relative;
  z-index: 10;
}

.crm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-logo-circle {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #f97316, #ec4899 45%, #6366f1 100%);
  box-shadow: 0 0 0 3px rgba(236,72,153,0.18);
}

.crm-logo-title {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.crm-logo-sub {
  font-size: 11px;
  color: var(--text-soft);
}

/* Core pill */

.crm-core {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(148,163,184,0.35);
}

.core-pill-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-soft);
}

.core-pill-value {
  font-size: 12px;
  font-weight: 700;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.core-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #6b7280;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.8);
}

.chat-core-pill { padding:4px 8px; border-radius:8px; background: rgba(255,255,255,0.02); font-size:12px; font-weight:600 }
.core-session-dot { width:10px;height:10px;border-radius:999px;display:inline-block;margin-right:8px;vertical-align:middle }
.core-session-online { background:#10b981 }
.core-session-offline { background:#ef4444 }

.core-status-ok {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.25);
}
.core-status-error {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,0.25);
}
.core-status-pending {
  background: #eab308;
  box-shadow: 0 0 0 4px rgba(234,179,8,0.22);
}

.core-status-text {
  font-size: 11px;
  color: var(--text-soft);
}

/* Small stat boxes near user profile */
.core-stat-box {
  display:inline-flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  padding:6px 10px;
  margin-left:8px;
  border-radius:8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(148,163,184,0.06);
  cursor: pointer;
  min-width:64px;
}
.core-stat-box small { font-size:10px; color:var(--text-soft); display:block }
.core-stat-box strong { font-size:13px; font-weight:700 }

.core-clock {
  font-size: 12px;
  color: #f3f4f6;
  margin-left: 10px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

/* Toast notifications bottom-right */
.toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display:flex; flex-direction:column; gap:8px; align-items:flex-end }
.toast { background: rgba(17,24,39,0.95); color: #fff; padding:8px 12px; border-radius:8px; box-shadow: 0 8px 24px rgba(0,0,0,0.6); opacity: 1; transition: opacity 0.6s ease, transform 0.3s ease; transform: translateY(0); }
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast small { display:block; color:#9ca3af; font-size:12px }

/* User box */

.crm-userbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-user-name {
  font-size: 13px;
  color: var(--text-soft);
}

/* Toggle switch para auto-leer */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #4b5563;
  transition: .3s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #10b981;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* Main layout: 3 zonas con scroll independiente */

.crm-main {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 10px;
  gap: 10px;
}

/* Izquierda: lista de chats (más ancha) */

.crm-sidebar {
  flex: 0 0 34%;
  max-width: 420px;
  min-width: 240px;
  background: radial-gradient(circle at top left, #020617 0, #020617 40%, #020617 100%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: var(--shadow-soft);
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Ensure the inner wrapper inside the sidebar is a column and allows the chat list to flex and scroll
   This makes the left conversation list scroll vertically and stay bounded to the sidebar height. */
.crm-sidebar > div {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin: 8px 0 4px;
}

/* Centro + derecha */

.crm-chat {
  flex: 1;
  background: radial-gradient(circle at top right, #020617 0, #030712 40%, #020617 100%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148,163,184,0.30);
  box-shadow: var(--shadow-soft);
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.chat-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-soft);
}

.chat-empty-icon {
  font-size: 32px;
}

.chat-empty-title {
  font-size: 15px;
  font-weight: 600;
}

.chat-empty-sub {
  font-size: 13px;
}

/* Vista del chat */

.chat-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, rgba(15,23,42,0.95), rgba(12,10,38,0.95));
  border: 1px solid rgba(148,163,184,0.35);
  margin-bottom: 8px;
}

/* ensure title area can host inline actions and allow header actions to wrap when narrow */
.chat-view-header > div:first-child { display:flex; align-items:center; gap:10px }
.chat-header-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap }

/* Make sidebar counters and bulk toolbar wrap so buttons don't overflow */
.status-counters { display:flex; gap:8px; align-items:center; flex-wrap:wrap }
.status-counters button { min-width:72px; padding:6px 8px; font-size:12px }
.profile-form .bulkToolbar { flex-wrap:wrap }
#bulkToolbar { display:flex; gap:6px; align-items:center; flex-wrap:wrap }
#bulkToolbar button { padding:5px 8px; font-size:12px }

.chat-derived-banner {
  margin-top:6px;
  padding:6px 8px;
  border-radius:8px;
  background: linear-gradient(90deg,#f97316,#ef4444);
  color: #fff;
  font-size:12px;
  font-weight:600;
}

.chat-derived-tag {
  display:inline-block;
  margin-top:6px;
  background:#2563eb;
  color:#fff;
  padding:3px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:600;
}

/* small tag shown inside the system 'derived' message bubble */
.msg-derived-tag {
  display:inline-block;
  margin-left:8px;
  background:#2563eb;
  color:#fff;
  padding:2px 6px;
  border-radius:999px;
  font-size:10px;
  font-weight:600;
  vertical-align:middle;
}

.chat-title {
  font-size: 15px;
  font-weight: 600;
}

.chat-meta {
  font-size: 11px;
  color: var(--text-soft);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Zona centro+derecha principal: se divide en 2 columnas internas */

.chat-view-main {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 8px;
}

/* Centro: mensajes + input (más angosto, como querías) */

.chat-center {
  flex: 0 0 44%;
  max-width: 46%;
  background: rgba(15,23,42,0.9);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(31,41,55,0.9);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
}

/* Derecha: panel para cosas futuras (scroll) */

.chat-side {
  flex: 0 0 22%;
  max-width: 26%;
  background: rgba(15,23,42,0.85);
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(55,65,81,0.9);
  min-height: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Counters / status pills improved */
.status-counters { display:flex; gap:8px; align-items:center }
.status-counters button { background: linear-gradient(90deg,#0ea5e9,#6366f1); border:none; color:#fff; padding:6px 10px; border-radius:10px; font-size:12px; cursor:pointer; box-shadow:0 8px 18px rgba(2,6,23,0.6)}
.status-counters button[data-status="archived"] { background: linear-gradient(90deg,#6b7280,#374151); color:#e5e7eb }
.status-counters button:hover { transform: translateY(-2px) }

/* transfer button near title */
.chat-inline-actions { display:flex; align-items:center; gap:8px; margin-left:10px }
.btn-transfer { margin-left:0; background: linear-gradient(90deg,#06b6d4,#3b82f6); color:#fff; padding:6px 10px; border-radius:8px; cursor:pointer; border:none; font-weight:600; box-shadow:0 8px 18px rgba(2,6,23,0.6) }
.btn-transfer:hover { filter:brightness(1.05) }
.btn-take { background: linear-gradient(90deg,#10b981,#06b6d4); padding:6px 10px; border-radius:8px; cursor:pointer; border:none; color:#fff; font-weight:700; box-shadow:0 8px 18px rgba(4,120,87,0.25) }
.btn-take:hover { filter:brightness(1.03) }
.btn-take.small, .btn-transfer.small { padding:5px 8px; font-size:13px }
.agent-online { background:#10b981; display:inline-block; width:10px; height:10px; border-radius:999px }
.agent-offline { background:#ef4444; display:inline-block; width:10px; height:10px; border-radius:999px }
.btn-solve { background: linear-gradient(90deg,#f59e0b,#ef4444); color:#fff; padding:6px 10px; border-radius:8px; cursor:pointer; border:none; font-weight:600 }
.btn-solve.small { padding:5px 8px; font-size:13px }

/* Scrollbar customization */
.chat-list::-webkit-scrollbar, .message-list::-webkit-scrollbar, .chat-side::-webkit-scrollbar { width:10px }
.chat-list::-webkit-scrollbar-track, .message-list::-webkit-scrollbar-track, .chat-side::-webkit-scrollbar-track { background: transparent }
.chat-list::-webkit-scrollbar-thumb, .message-list::-webkit-scrollbar-thumb, .chat-side::-webkit-scrollbar-thumb { background: linear-gradient(180deg,#3b82f6,#8b5cf6); border-radius:8px }
.chat-list::-webkit-scrollbar-thumb:hover, .message-list::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg,#60a5fa,#a78bfa) }

/* Transfer modal */
.transfer-modal { position:fixed; inset:0; background:rgba(2,6,23,0.6); display:flex; align-items:center; justify-content:center; z-index:60 }
.transfer-modal .inner { background:linear-gradient(180deg,#08112a,#071029); border-radius:12px; padding:12px; width:420px; max-width:90%; box-shadow:0 20px 40px rgba(0,0,0,0.6); border:1px solid rgba(148,163,184,0.06) }
.agent-list-item { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px; border-bottom:1px solid rgba(255,255,255,0.03) }
.agent-name { font-size:13px }
.agent-status { font-size:11px; color:#9ca3af }
.agent-status.online { color: #10b981; font-weight:600 }
.agent-status.offline { color: #ef4444; font-weight:600 }

/* Lista de chats (scroll independiente) */

.chat-list {
  flex: 1;
  min-height: 0;
  margin-top: 6px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(15,23,42,0.8), rgba(15,23,42,0.55));
  border: 1px solid rgba(31,41,55,0.95);
  overflow-y: auto;
  padding: 4px;
}

.chat-item {
  border-radius: 12px;
  padding: 7px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.chat-item:hover {
  background: rgba(30,64,175,0.18);
  border-color: rgba(129,140,248,0.45);
  transform: translateY(-1px);
}

.chat-item-active {
  background: linear-gradient(90deg, rgba(236,72,153,0.18), rgba(96,165,250,0.18));
  border-color: rgba(236,72,153,0.80);
}

.chat-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.chat-item-name {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.blocked-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  flex-shrink: 0;
}

.chat-item-time {
  font-size: 10px;
  color: var(--text-soft);
}

.chat-item-body {
  font-size: 11px;
  color: var(--text-soft);
  max-height: 32px;
  overflow: hidden;
}

.chat-item-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.chat-badge-status {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.35);
}

.chat-badge-unread {
  font-size: 10px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
}

/* Checkbox for multiselect */
.chat-item-checkbox {
  margin-right: 8px;
}

/* Mensajes centro: scroll independiente */

.message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg {
  max-width: 92%;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 14px;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
}

.msg-client {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(30,64,175,0.95), rgba(59,130,246,1));
  border-bottom-left-radius: 4px;
}

.msg-agent {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(82,92,70,0.92), rgba(107,118,92,0.95));
  border-bottom-right-radius: 4px;
}

/* Burbujas transparentes cuando solo contienen audio (sin texto) */
.msg-audio-only.msg-client,
.msg-audio-only.msg-agent {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.msg-system {
  align-self: center;
  background: rgba(255,255,255,0.04);
  color: var(--text-soft);
  font-size: 12px;
}

.msg-body {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg-meta {
  font-size: 9px;
  opacity: 0.7;
  text-align: right;
}

/* Visor de archivos / PDF / imágenes */

.msg-media {
  margin-top: 4px;
  border-radius: 10px;
  overflow: visible;
  background: transparent;
  max-width: 100%;
}

.msg-media img {
  max-width: 320px;
  max-height: 400px;
  display: block;
  cursor: zoom-in;
  border-radius: 10px;
  object-fit: contain;
}

.msg-media video,
.msg-media audio {
  max-width: 320px;
  max-width: 360px;
  outline: none;
  border-radius: 10px;
}

.msg-media .pdf,
.msg-media object[type="application/pdf"],
.msg-media embed[type="application/pdf"] {
  width: 420px;
  max-width: 100%;
  height: 520px;
  border: 1px solid #22365e;
  border-radius: 10px;
  display: block;
}

.msg-pdf-frame {
  width: 100%;
  height: 220px;
  border: none;
  background: #111827;
}

.msg-media-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  text-decoration: none;
  color: var(--accent-soft);
  margin-top: 4px;
}

/* Form de envío (pegado abajo del centro) */

.send-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.send-form input.field-input {
  flex: 1;
}

/* Inputs / botones genéricos */

.field-label {
  font-size: 11px;
  margin: 4px 0 2px;
  color: var(--text-soft);
}

.field-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(55,65,81,0.95);
  background: rgba(15,23,42,0.9);
  color: var(--text);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
}

.field-input.full {
  width: 100%;
}

.field-input.small {
  font-size: 11px;
  padding: 4px 8px;
}

.field-input.xs {
  font-size: 11px;
  padding: 4px 7px;
}

.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(236,72,153,0.35);
}

.btn-primary,
.btn-danger,
.btn-ghost {
  border-radius: 999px;
  border: none;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(90deg, #ec4899, #f97316);
  color: #fff;
  box-shadow: 0 10px 25px rgba(236,72,153,0.45);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid rgba(75,85,99,0.8);
}

.btn-ghost.small,
.btn-primary.small,
.btn-danger.small {
  font-size: 11px;
  padding: 4px 9px;
}

/* Login */

.login-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: radial-gradient(circle at top, rgba(15,23,42,0.98), rgba(15,23,42,0.96));
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,0.45);
  padding: 20px 22px 18px;
  box-shadow: var(--shadow-soft);
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-error {
  background: rgba(239,68,68,0.12);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  color: #fecaca;
  border: 1px solid rgba(239,68,68,0.4);
  margin-top: 4px;
}

.login-sub {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-soft);
}

/* Profile / Ajustes / Agenda */

.profile-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-card {
  width: 100%;
  max-width: 540px;
  background: rgba(15,23,42,0.98);
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,0.45);
  padding: 18px 22px 18px;
  box-shadow: var(--shadow-soft);
}

.profile-card.wide {
  max-width: 900px;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-form.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.profile-note {
  font-size: 11px;
  color: var(--text-soft);
  margin: 4px 0 6px;
}

.alert-ok {
  background: rgba(34,197,94,0.12);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid rgba(34,197,94,0.4);
  color: #bbf7d0;
  margin-bottom: 8px;
}

.alert-err {
  background: rgba(239,68,68,0.12);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid rgba(239,68,68,0.4);
  color: #fecaca;
  margin-bottom: 8px;
}

.alert-err.small {
  border-radius: 12px;
  padding: 4px 6px;
}

/* Tabla usuarios / agenda */

.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 11px;
}

.users-table thead {
  background: rgba(15,23,42,0.9);
}

.users-table th,
.users-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(31,41,55,0.9);
}

.users-table tbody tr:nth-child(even) {
  background: rgba(15,23,42,0.65);
}

/* Modal sesiones CORE */

.core-modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.core-modal-inner {
  width: 100%;
  max-width: 520px;
  background: rgba(15,23,42,0.98);
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.5);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px 12px;
}

.core-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.core-modal-body {
  max-height: 320px;
  overflow-y: auto;
  font-size: 12px;
}

.derived-day {
  position: relative;
  display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-radius:8px;margin-bottom:8px;background:rgba(255,255,255,0.02);min-height:44px
}
.derived-badge {background:#2563eb;color:#fff;border-radius:12px;padding:2px 8px;font-size:11px}
.derived-small-badge { position:absolute; right:8px; bottom:6px; background:#2563eb; color:#fff; font-size:11px; padding:2px 6px; border-radius:10px }
.derived-item {display:flex;gap:8px;align-items:center;padding:8px;border-bottom:1px solid rgba(148,163,184,0.04);cursor:pointer}
.derived-item:hover{background:rgba(255,255,255,0.02)}
.derived-col {font-size:12px;color:#9ca3af}
.derived-month-count {font-size:11px;color:#cbd5e1;margin-top:4px}

/* Utilidades */

.hidden {
  display: none !important;
}

.mt16 {
  margin-top: 16px;
}

/* Image Editor Tools */
.editor-tool-btn {
  background: rgba(255,255,255,0.1);
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.editor-tool-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.05);
}

.editor-tool-btn.active {
  background: rgba(59,130,246,0.3);
  border-color: #3b82f6;
  box-shadow: 0 0 8px rgba(59,130,246,0.5);
}

/* Responsive mínimo */

@media (max-width: 900px) {
  .crm-main {
    flex-direction: column;
  }
  .crm-sidebar {
    max-width: 100%;
    flex: 0 0 auto;
  }
  .chat-view-main {
    flex-direction: column;
  }
  .chat-center {
    max-width: 100%;
    flex: 0 0 auto;
  }
  .chat-side {
    flex: 0 0 auto;
    max-height: 220px;
  }
}
