/* ============================================================
   Hub by Virtualia — Design tokens & base styles
   Aligned with brand/BRAND.md v1.0
   ============================================================ */

:root {
  /* ----- Brand neutrals (Virtualia Hub · navy/canvas) ----- */
  --brand-ink:    #091735;
  --brand-stone:  #4E5A77;
  --brand-paper:  #F8FAFF;

  /* Surface — cool, clean per BRAND.md v1.0 */
  --bg: #F8FAFF;             /* canvas */
  --bg-soft: #F3F6FE;
  --surface: #FFFFFF;
  --surface-2: #F3F6FE;      /* surface-inset for inputs */
  --border: #DDE4F2;         /* line */
  --border-strong: #C7D2E6;

  /* Text */
  --text: #091735;           /* ink — navy oscuro, no negro puro */
  --text-muted: #4E5A77;
  --text-subtle: #8A95AE;

  /* Brand violet — Hub canonical scale built around #7C3AED */
  --violet-50:  #F5EFFE;   /* tint */
  --violet-100: #EDE1FE;   /* soft */
  --violet-200: #D2B6FD;
  --violet-300: #B591FA;
  --violet-400: #9869F4;
  --violet-500: #8B4DF0;
  --violet-600: #7C3AED;   /* primary · canonical Hub accent */
  --violet-700: #6326C7;
  --violet-800: #4C1D95;   /* deep */

  /* Pastels for icon chips & badges */
  --mint-50:   #E6F8EF;
  --mint-600:  #13977F;    /* PMS teal — also used as success-mint */
  --green-50:  #DCFCE7;
  --green-600: #16A164;    /* success */
  --rose-50:   #FFE4F0;
  --rose-600:  #D64550;    /* danger */
  --peach-50:  #FFEDE0;
  --peach-600: #F58A23;    /* warning */
  --amber-50:  #FFF4D6;
  --amber-600: #C68A0E;
  --sky-50:    #E6F0FF;
  --sky-600:   #1688F0;    /* messenger blue */
  --slate-50:  #EEF0F4;
  --slate-600: #4E5A77;

  /* Shadow per DESIGN.md — cards 0 8px 24px rgba(24,35,76,0.06) */
  --shadow-xs: 0 1px 2px rgba(24, 35, 76, 0.04);
  --shadow-sm: 0 2px 6px rgba(24, 35, 76, 0.05);
  --shadow-md: 0 8px 24px rgba(24, 35, 76, 0.06);
  --shadow-lg: 0 16px 36px rgba(76, 29, 149, 0.10), 0 4px 12px rgba(24, 35, 76, 0.05);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;

  /* Type */
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-byline: "Familjen Grotesk", "Manrope", serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html, body, #root {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  color: inherit;
}

::selection { background: var(--violet-100); color: var(--violet-800); }

/* ============================================================
   App shell
   ============================================================ */

.app {
  display: grid;
  grid-template-columns: 224px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px;
}

.sidebar__brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--violet-600);
  box-shadow: 0 6px 14px rgba(124, 58, 237, 0.28);
  flex-shrink: 0;
}

.sidebar__brand-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  gap: 3px;
}

.sidebar__brand-name {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--brand-ink);
  line-height: 1;
}

.sidebar__brand-byline {
  font-family: var(--font-byline);
  font-style: italic;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0;
  line-height: 1;
}

.sidebar__brand-byline strong {
  font-style: normal;
  font-weight: 600;
  color: var(--brand-ink);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item--active {
  background: var(--violet-50);
  color: var(--violet-700);
}

.nav-item--active:hover {
  background: var(--violet-50);
  color: var(--violet-700);
}

.nav-item__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-card:hover {
  background: var(--surface-2);
}

.user-card__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--violet-600);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user-card__name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.user-card__role {
  font-size: 12px;
  color: var(--text-muted);
}

.user-card__chevron {
  margin-left: auto;
  color: var(--text-subtle);
}

/* Main column */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.topbar {
  display: grid;
  grid-template-columns: 280px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px 32px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.tenant-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tenant-selector:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.tenant-selector__icon-wrap {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--mint-50);
  color: var(--mint-600);
  display: grid;
  place-items: center;
}
.tenant-selector__chevron {
  margin-left: auto;
  color: var(--text-subtle);
}

.search {
  position: relative;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.search input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--text-subtle); }
.search input:focus {
  outline: none;
  border-color: var(--violet-300);
  box-shadow: 0 0 0 3px var(--violet-100);
}
.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
}
.search__kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
}
.icon-btn__dot {
  position: absolute;
  top: 8px;
  right: 9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--violet-600);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
}
.icon-btn__dot--rose { background: #EC4899; }

/* Demo visual badge — discreet, in topbar only */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--violet-50);
  color: var(--violet-700);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--violet-100);
  margin-right: 6px;
  white-space: nowrap;
}
.demo-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--violet-600);
}

.top-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--violet-600);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  position: relative;
  margin-left: 6px;
  cursor: pointer;
}
.top-avatar::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16A34A;
  border: 2px solid var(--bg);
}

/* Page content */
.page {
  padding: 8px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0;
}
.page-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card__title {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card__body {
  padding: 18px 20px;
}

/* KPI */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.kpi__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.kpi__label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.kpi__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--violet-50);
  color: var(--violet-600);
}
.kpi__value {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-top: 4px;
}
.kpi__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.kpi__delta {
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi__delta--up { color: #16A34A; }
.kpi__delta--down { color: #DC2626; }
.kpi__delta--flat { color: #EA7A2C; }
.kpi__sub { color: var(--text-muted); font-weight: 400; margin-left: 4px; }

.kpi__spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
}
.kpi__spark span {
  width: 3px;
  background: var(--violet-200);
  border-radius: 2px;
}
.kpi__spark span.tall { background: var(--violet-500); }

/* ============================================================
   Status badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge--violet { background: var(--violet-50); color: var(--violet-700); }
.badge--green { background: var(--green-50); color: #15803D; }
.badge--amber { background: var(--amber-50); color: var(--amber-600); }
.badge--peach { background: var(--peach-50); color: var(--peach-600); }
.badge--rose { background: var(--rose-50); color: var(--rose-600); }
.badge--sky { background: var(--sky-50); color: var(--sky-600); }
.badge--slate { background: var(--slate-50); color: var(--slate-600); }

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Status check dot */
.status-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-50);
  color: #15803D;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.status-pending {
  background: var(--peach-50);
  color: var(--peach-600);
}

/* Canonical status chip — vocabulario honesto de integración/acción (BRAND.md + DESIGN.md Phase 4.1).
   Verde SOLO para estados verificados; violeta = diseño/IA; naranja = pendiente; gris = sin runtime. */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-chip--design  { background: var(--violet-50); color: var(--violet-700); border-color: var(--violet-100); }
.status-chip--demo    { background: #F5EFFE;          color: var(--violet-700); border-color: var(--violet-100); }
.status-chip--next    { background: var(--bg-soft);   color: var(--text-muted); border-color: var(--border); }
.status-chip--off     { background: var(--slate-50);  color: var(--slate-600);  border-color: var(--border); }
.status-chip--pending { background: var(--peach-50);  color: var(--peach-600);  border-color: #FED7AA; }
.status-chip--ok      { background: var(--green-50);  color: #15803D;           border-color: #BBF7D0; }

/* Token técnico / ID · JetBrains Mono per BRAND.md */
.mono-token {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Tabla de auditoría (Agentes › Auditoría) */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.audit-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.audit-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table .badge { font-size: 11px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn--primary {
  background: var(--violet-600);
  color: #fff;
  box-shadow: 0 6px 14px rgba(124, 58, 237, 0.25);
}
.btn--primary:hover { background: var(--violet-700); }
.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--secondary:hover { background: var(--surface-2); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--violet-soft {
  background: var(--violet-50);
  color: var(--violet-700);
  border-color: var(--violet-100);
}
.btn--violet-soft:hover { background: var(--violet-100); }

.btn--lg { padding: 12px 18px; font-size: 14px; }
.btn--sm { padding: 7px 12px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ============================================================
   Inbox / conversation pieces
   ============================================================ */

.tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.tab {
  position: relative;
  padding: 12px 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tab--active { color: var(--violet-700); }
.tab--active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--violet-600);
  border-radius: 1px;
}
.tab__count {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
}
.tab--active .tab__count { color: var(--violet-700); }

.conv-list { display: flex; flex-direction: column; }
.conv-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  align-items: flex-start;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item--active { background: var(--violet-50); }
.conv-item--active:hover { background: var(--violet-50); }
.conv-item:last-child { border-bottom: none; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  position: relative;
  background: var(--violet-500);
  flex-shrink: 0;
}
.avatar__channel {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1.5px solid #fff;
}

.conv-item__name {
  font-weight: 600;
  font-size: 13.5px;
}
.conv-item__preview {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.conv-item__time {
  font-size: 11.5px;
  color: var(--text-subtle);
  white-space: nowrap;
}
.conv-item__unread {
  margin-top: 6px;
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--violet-600);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  padding: 0 6px;
}

/* Channel colors */
.channel-whatsapp { background: #25D366; }
.channel-messenger { background: #0084FF; }
.channel-instagram { background: linear-gradient(135deg, #F58529, #DD2A7B, #8134AF); }
.channel-email { background: var(--slate-600); }
.channel-webchat { background: var(--violet-500); }

/* Conversation thread */
.thread {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.thread__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.thread__contact {
  display: flex;
  align-items: center;
  gap: 12px;
}
.thread__contact-name {
  font-weight: 600;
  font-size: 14.5px;
}
.thread__messages {
  flex: 1;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.day-divider {
  text-align: center;
  font-size: 12px;
  color: var(--text-subtle);
  margin: 4px 0;
}
.bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  position: relative;
}
.bubble__time {
  font-size: 10.5px;
  color: var(--text-subtle);
  margin-top: 4px;
  display: block;
  text-align: right;
}
.bubble--in {
  background: var(--surface-2);
  align-self: flex-start;
  border: 1px solid var(--border);
}
.bubble--out {
  background: var(--violet-50);
  align-self: flex-end;
  color: var(--text);
  border: 1px solid var(--violet-100);
}
.bubble--out .bubble__time { color: var(--violet-600); }

.ai-suggestion-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--violet-600);
  align-self: flex-end;
  margin-top: 4px;
  margin-bottom: -4px;
}

.composer {
  border-top: 1px solid var(--border);
}
.composer__tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px 0;
}
.composer__tabs .tab { padding: 8px 0; }
.composer__inner {
  padding: 8px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.composer__input {
  width: 100%;
  padding: 10px 4px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--text);
  resize: none;
}
.composer__input::placeholder { color: var(--text-subtle); }
.composer__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.composer__send {
  margin-left: auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--violet-600);
  color: #fff;
  border-radius: 10px;
  transition: background 0.15s;
}
.composer__send:hover { background: var(--violet-700); }

/* ============================================================
   Lists w/ icon-circle
   ============================================================ */

.icon-chip {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.icon-chip--violet { background: var(--violet-50); color: var(--violet-600); }
.icon-chip--green { background: var(--green-50); color: #15803D; }
.icon-chip--mint { background: var(--mint-50); color: var(--mint-600); }
.icon-chip--rose { background: var(--rose-50); color: var(--rose-600); }
.icon-chip--peach { background: var(--peach-50); color: var(--peach-600); }
.icon-chip--amber { background: var(--amber-50); color: var(--amber-600); }
.icon-chip--sky { background: var(--sky-50); color: var(--sky-600); }
.icon-chip--slate { background: var(--slate-50); color: var(--slate-600); }
.icon-chip--lg { width: 38px; height: 38px; border-radius: 10px; }
.icon-chip--xl { width: 48px; height: 48px; border-radius: 12px; }

/* Action / tool list */
.action-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-row {
  display: grid;
  grid-template-columns: 16px 32px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 4px;
}
.action-row__bullet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--violet-600);
  border: 3px solid var(--violet-100);
  margin-left: 3px;
}
.action-row__title {
  font-size: 13.5px;
  font-weight: 500;
}
.action-row__title b { font-weight: 600; }

/* Numbered list */
.numbered {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.numbered__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.numbered__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--violet-50);
  color: var(--violet-700);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.numbered__text {
  font-size: 13.5px;
  line-height: 1.5;
  padding-top: 3px;
}

/* Detail key/value rows */
.kv-list { display: flex; flex-direction: column; gap: 12px; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.kv-row__k { color: var(--text-muted); font-size: 13px; }
.kv-row__v { font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }

/* Integration card */
.integration-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.integration-card__title {
  font-size: 13.5px;
  font-weight: 600;
}
.integration-card__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}
.integration-card__sub--green { color: #15803D; }
.integration-card__sub--peach { color: var(--peach-600); }

/* Sparkline simple */
.dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  position: relative;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* Page-header with right-side actions */
.page-header__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.page-header__actions {
  display: flex;
  gap: 10px;
}

/* ============================================================
   Leads — Kanban board
   ============================================================ */

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.board__col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 480px;
}
.board__col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.board__col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.board__col-count {
  font-size: 11.5px;
  color: var(--text-subtle);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lead-card:hover {
  border-color: var(--violet-200);
  box-shadow: var(--shadow-md);
}
.lead-card--selected {
  border-color: var(--violet-500);
  box-shadow: 0 0 0 3px var(--violet-50), var(--shadow-md);
}
.lead-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lead-card__name {
  font-weight: 600;
  font-size: 13.5px;
}
.lead-card__interest {
  font-size: 12.5px;
  color: var(--text-muted);
}
.lead-card__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  gap: 8px;
}
.lead-card__channel {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.lead-card__time {
  font-size: 11.5px;
  color: var(--text-subtle);
}
.lead-card__ai {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--violet-700);
  background: var(--violet-50);
  padding: 6px 8px;
  border-radius: 8px;
  margin-top: 2px;
}

/* ============================================================
   Campaigns
   ============================================================ */
.campaign-row {
  display: grid;
  grid-template-columns: 38px 1fr auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.campaign-row:last-child { border-bottom: none; }
.campaign-row:hover { background: var(--surface-2); }
.campaign-row--active { background: var(--violet-50); }
.campaign-row--active:hover { background: var(--violet-50); }

.campaign-row__title {
  font-weight: 600;
  font-size: 13.5px;
}
.campaign-row__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   Configuración — switches & toolbox
   ============================================================ */

.switch {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.18s;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.switch--on { background: var(--violet-600); }
.switch--on::after { transform: translateX(16px); }

.tool-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.tool-row:last-child { border-bottom: none; }
.tool-row__title { font-weight: 500; font-size: 13.5px; }
.tool-row__sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.section-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--amber-50);
  color: #7C5A0A;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid #FCE5A1;
}
.banner--violet {
  background: var(--violet-50);
  color: var(--violet-800);
  border-color: var(--violet-100);
}
.banner__icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================================
   Architecture map — Pantalla 3
   ============================================================ */

.arch-map {
  position: relative;
  height: 540px;
  background:
    radial-gradient(circle at 50% 50%, rgba(110,86,247,0.04) 0%, transparent 60%),
    linear-gradient(var(--surface-2), var(--surface-2));
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.arch-map svg.lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.arch-node {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  width: 220px;
}
.arch-node__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}
.arch-node__list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.arch-node__list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.arch-node__list li::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet-400);
}
.arch-node--center {
  background: var(--surface);
  border-color: var(--violet-200);
  box-shadow: 0 8px 24px rgba(110,86,247,0.12), 0 1px 2px rgba(0,0,0,0.04);
  text-align: center;
  width: 240px;
  padding: 22px 16px;
}
.arch-node__center-mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--violet-600);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  box-shadow: 0 8px 16px rgba(110,86,247,0.35);
}
.arch-node__center-title {
  font-weight: 600;
  font-size: 17px;
}
.arch-node__center-sub {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.arch-node__center-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  margin-top: 12px;
  color: var(--violet-700);
  font-weight: 500;
}

/* ============================================================
   Clientes — contacts table
   ============================================================ */
.contacts-table { display: flex; flex-direction: column; }
.contacts-table__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  font-weight: 600;
}
.contacts-table__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.contacts-table__row:hover { background: var(--surface-2); }
.contacts-table__row--active { background: var(--violet-50); }
.contacts-table__row--active:hover { background: var(--violet-50); }
.contacts-table__row:last-child { border-bottom: none; }
.contacts-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--violet-600);
  cursor: pointer;
}

/* ============================================================
   Misc helpers
   ============================================================ */
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; }

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.text-sm { font-size: 12.5px; }
.text-md { font-size: 13.5px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.32s ease-out both; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeUp 0.25s ease-out both;
}

/* ============================================================
   Inbox shell (3-column)
   ============================================================ */
.inbox-shell {
  display: grid;
  grid-template-columns: 240px 400px 1fr 340px;
  gap: 16px;
  align-items: stretch;
  min-height: calc(100vh - 160px);
}

.inbox-folders {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: flex-start;
}
.folder-group-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  font-weight: 600;
  padding: 4px 10px 8px;
}
.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-align: left;
  width: 100%;
}
.folder-item:hover { background: var(--surface-2); color: var(--text); }
.folder-item--active { background: var(--violet-50); color: var(--violet-700); }
.folder-item__count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-subtle);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 999px;
}
.folder-item--active .folder-item__count { background: #fff; color: var(--violet-700); }
.folder-tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.inbox-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.inbox-list__header {
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.inbox-list__items {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.inbox-thread {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.inbox-context {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  align-self: flex-start;
  display: flex;
  flex-direction: column;
}
.context-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.context-section:last-child { border-bottom: none; }
.context-section__title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  font-weight: 600;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.pill--violet { background: var(--violet-50); border-color: var(--violet-100); color: var(--violet-700); }
.pill--green { background: var(--green-50); border-color: #BBF7D0; color: #15803D; }
.pill--rose { background: var(--rose-50); border-color: #FBCFE8; color: var(--rose-600); }
.pill--peach { background: var(--peach-50); border-color: #FED7AA; color: var(--peach-600); }
.pill--sky { background: var(--sky-50); border-color: #BAE6FD; color: var(--sky-600); }

/* ============================================================
   Reportes — charts
   ============================================================ */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chart-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.chart-card__title {
  font-size: 15px;
  font-weight: 600;
}
.chart-card__sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.chart-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.chart-legend__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.report-tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.report-tab {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
}
.report-tab--active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 28px 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row__rank {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-subtle);
  text-align: center;
}
.leaderboard-row__rank--1 { color: #C68A0E; }
.leaderboard-row__rank--2 { color: #6B7280; }
.leaderboard-row__rank--3 { color: #C2733E; }

.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
}

.funnel-step {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}
.funnel-step:last-child { border-bottom: none; }
.funnel-bar {
  position: relative;
  height: 36px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
}
.funnel-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 8px;
}

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: 56px repeat(24, 1fr);
  gap: 3px;
}
.heatmap__hour {
  font-size: 10px;
  color: var(--text-subtle);
  text-align: center;
  padding-top: 6px;
}
.heatmap__day {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  padding-right: 8px;
}
.heatmap__cell {
  height: 18px;
  border-radius: 3px;
}

/* ============================================================
   Campañas detalle expandido
   ============================================================ */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar__weekday {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  font-weight: 600;
  padding-bottom: 8px;
  text-align: left;
}
.calendar__day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 86px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.calendar__day--outside { opacity: 0.4; }
.calendar__day--today { border-color: var(--violet-300); background: var(--violet-50); }
.calendar__day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.calendar__day--today .calendar__day-num { color: var(--violet-700); }
.calendar__post {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.calendar__post--violet { background: var(--violet-50); border-color: var(--violet-100); color: var(--violet-700); }
.calendar__post--rose { background: var(--rose-50); border-color: #FBCFE8; color: var(--rose-600); }
.calendar__post--green { background: var(--green-50); border-color: #BBF7D0; color: #15803D; }
.calendar__post--peach { background: var(--peach-50); border-color: #FED7AA; color: var(--peach-600); }
.calendar__post--sky { background: var(--sky-50); border-color: #BAE6FD; color: var(--sky-600); }

.preview-frame {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.preview-message {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: 14px;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: var(--shadow-xs);
}
.preview-message__time {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 6px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}
.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.donut-legend__row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

/* Variants (A/B) */
.variant-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.variant-card--winner {
  border-color: var(--violet-300);
  box-shadow: 0 0 0 3px var(--violet-50);
}
.variant-card__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.variant-card__pill {
  background: var(--violet-100);
  color: var(--violet-700);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.variant-card__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.variant-card__stat-label {
  font-size: 11px;
  color: var(--text-muted);
}
.variant-card__stat-value {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #E2E2EC;
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #C8C8D6; }
::-webkit-scrollbar-track { background: transparent; }
