@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #090a09;
  --bg-gradient: radial-gradient(ellipse at 50% 0%, rgba(240, 180, 41, 0.04), transparent 75%), #090a09;
  --surface: #11120f;
  --card: #161813;
  --card-hover: #1c1f18;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --muted: #959888;
  --text: #edeee6;
  --text-dim: #b5b7a8;
  --gold: #f0b429;
  --gold-glow: rgba(240, 180, 41, 0.25);
  --gold-gradient: linear-gradient(135deg, #f6c445, #dca729);
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.25);
  --red: #ef4444;
  --blue: #38bdf8;
  --purple: #c084fc;
  --side: 250px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

button, a, input, textarea, select {
  outline-offset: 3px;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  color: inherit;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 16px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.18s ease;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

button.primary {
  background: var(--gold-gradient);
  border-color: #f0b429;
  color: #0d0c04;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(240, 180, 41, 0.2);
}

button.primary:hover {
  background: linear-gradient(135deg, #ffd15d, #eab335);
  box-shadow: 0 6px 20px rgba(240, 180, 41, 0.35);
}

button.danger {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

button.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
}

button.small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 7px;
}

a {
  color: inherit;
  text-decoration: none;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* -------------------------------------------------------------
   SIDEBAR & BRAND
-------------------------------------------------------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  border-right: 1px solid var(--line);
  background: linear-gradient(175deg, rgba(28, 24, 13, 0.7), transparent 45%), #0c0d0a;
  display: flex;
  flex-direction: column;
  z-index: 40;
  backdrop-filter: blur(20px);
}

.brand {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 1px;
}

.brand-mark {
  width: 36px;
  height: 38px;
  color: var(--gold);
  border: 1px solid rgba(240, 180, 41, 0.4);
  background: rgba(240, 180, 41, 0.08);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 0 16px rgba(240, 180, 41, 0.15);
}

.brand small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 500;
}

.nav {
  padding: 16px 12px;
  overflow-y: auto;
  flex: 1;
}

.nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: #6a6e5f;
  margin: 22px 14px 8px;
}

.nav-label:first-child {
  margin-top: 0;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #a4a899;
  font-size: 13px;
  font-weight: 500;
  margin: 3px 0;
  transition: all 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav a.active {
  color: var(--gold);
  background: rgba(240, 180, 41, 0.09);
  border-color: rgba(240, 180, 41, 0.25);
}

.nav a.active::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-left: auto;
  box-shadow: 0 0 8px var(--gold);
}

.profile {
  padding: 14px 16px;
  margin: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 11px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: border-color 0.18s;
}

.profile:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.avatar {
  width: 38px;
  height: 38px;
  background: rgba(240, 180, 41, 0.12);
  color: var(--gold);
  border: 1px solid rgba(240, 180, 41, 0.3);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.profile strong {
  font-size: 12px;
  display: block;
}

.profile small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

/* -------------------------------------------------------------
   MAIN LAYOUT & TOPBAR
-------------------------------------------------------------- */
.main {
  margin-left: var(--side);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  background: rgba(9, 10, 9, 0.88);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(20px);
}

.breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
}

.breadcrumb span {
  color: #edeee6;
  font-weight: 500;
  margin-left: 10px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.business-selector {
  position: relative;
}

.business-btn {
  font-size: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.business-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
  display: none;
  z-index: 50;
}

.business-dropdown.show {
  display: block;
}

.business-dropdown-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  background: none;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.business-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
}

.mobile-toggle {
  display: none;
}

.content {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 36px 60px;
  flex: 1;
}

/* -------------------------------------------------------------
   PAGE HEADINGS & TYPOGRAPHY
-------------------------------------------------------------- */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

p {
  line-height: 1.65;
  margin: 0;
  color: var(--muted);
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}

.page-heading p {
  font-size: 12.5px;
}

.demo-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: #a0a490;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 500;
}

/* -------------------------------------------------------------
   TAGS & BADGES
-------------------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

.tag.gold {
  color: var(--gold);
  border-color: rgba(240, 180, 41, 0.35);
  background: rgba(240, 180, 41, 0.09);
}

.tag.gray {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
}

.tag.cyan {
  color: var(--blue);
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.25);
}

.tag.purple {
  color: var(--purple);
  background: rgba(192, 132, 252, 0.08);
  border-color: rgba(192, 132, 252, 0.25);
}

.tag.red {
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

/* -------------------------------------------------------------
   CARDS & GRIDS
-------------------------------------------------------------- */
.grid {
  display: grid;
  gap: 18px;
}

.stats {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
}

.two {
  grid-template-columns: 1.55fr 1fr;
}

.three {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), transparent 70%), var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  position: relative;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.stat-top .icon {
  color: var(--gold);
  background: rgba(240, 180, 41, 0.08);
  padding: 8px;
  box-sizing: content-box;
  border-radius: 8px;
  border: 1px solid rgba(240, 180, 41, 0.15);
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 28px;
  margin: 16px 0 6px;
  letter-spacing: -0.5px;
}

.stat-foot {
  font-size: 11px;
  color: var(--muted);
}

.stat-foot b {
  color: var(--green);
  font-weight: 500;
  margin-right: 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
}

.section-head p {
  font-size: 11.5px;
}

.section-head a {
  font-size: 12px;
  color: var(--gold);
  font-weight: 500;
}

.section-head a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------
   WELCOME BANNER (INICIO)
-------------------------------------------------------------- */
.welcome-banner {
  background: linear-gradient(115deg, rgba(48, 38, 16, 0.8), rgba(22, 23, 18, 0.95) 70%);
  border: 1px solid rgba(240, 180, 41, 0.25);
  padding: 28px;
  margin-bottom: 24px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.welcome-banner h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.welcome-banner p {
  font-size: 12.5px;
}

.steps {
  display: flex;
  gap: 24px;
  margin-top: 20px;
}

.step {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: #c8c9be;
  transition: color 0.15s;
}

.step:hover {
  color: var(--gold);
}

.step i {
  font-style: normal;
  border: 1px solid rgba(240, 180, 41, 0.5);
  background: rgba(240, 180, 41, 0.08);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}

/* -------------------------------------------------------------
   CHARTS & METRICS
-------------------------------------------------------------- */
.chart {
  height: 190px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 8px;
  padding: 15px 0 24px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0, transparent 40px, rgba(255, 255, 255, 0.025) 41px);
}

.bar-group {
  height: 100%;
  display: flex;
  gap: 4px;
  align-items: flex-end;
  position: relative;
  flex: 1;
  justify-content: center;
}

.bar {
  width: 14px;
  max-width: 28%;
  background: var(--gold-gradient);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  box-shadow: 0 0 12px rgba(240, 180, 41, 0.15);
  transition: height 0.4s ease;
}

.bar.secondary {
  background: #373e30;
  box-shadow: none;
}

.bar-group small {
  position: absolute;
  bottom: -22px;
  color: #727768;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
}

.legend {
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 18px;
}

.legend span {
  display: flex;
  align-items: center;
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--gold);
  margin-right: 6px;
}

.legend i.secondary {
  background: #4a543f;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 4px;
  margin: 22px 0 10px;
}

.heatmap i {
  height: 38px;
  border-radius: 4px;
  background: var(--gold);
  transition: transform 0.15s;
}

.heatmap i:hover {
  transform: scaleY(1.1);
}

.heat-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
}

.progress {
  height: 7px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  margin: 12px 0;
}

.progress > i {
  display: block;
  height: 100%;
  background: var(--gold-gradient);
  border-radius: 6px;
  transition: width 0.3s;
}

/* -------------------------------------------------------------
   CHANNEL ROWS & QUICK ACTIONS
-------------------------------------------------------------- */
.channel-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

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

.channel-logo {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 18px;
}

.channel-logo.tg {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.08);
}

.channel-logo.wa {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
}

.channel-logo.ig {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.3);
  background: rgba(244, 114, 182, 0.08);
}

.channel-row strong {
  display: block;
  font-size: 12.5px;
  margin-bottom: 4px;
}

.channel-row small {
  font-size: 10.5px;
  color: var(--muted);
}

.channel-row .tag {
  margin-left: auto;
}

.quick-actions {
  margin-top: 18px;
  grid-template-columns: repeat(4, 1fr);
}

.quick {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: all 0.18s ease;
}

.quick:hover {
  border-color: rgba(240, 180, 41, 0.35);
  background: rgba(240, 180, 41, 0.03);
  transform: translateY(-2px);
}

.quick > .icon {
  color: var(--gold);
}

.quick strong {
  font-size: 12px;
  display: block;
  margin-bottom: 2px;
}

.quick small {
  font-size: 10.5px;
  color: var(--muted);
  display: block;
}

/* -------------------------------------------------------------
   TABS, SEARCH & FORMS
-------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.tabs button {
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line);
  padding: 8px 14px;
}

.tabs button.active {
  color: var(--gold);
  border-color: rgba(240, 180, 41, 0.4);
  background: rgba(240, 180, 41, 0.1);
  font-weight: 600;
}

.search {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  min-width: 240px;
  transition: border-color 0.18s;
}

.search:focus {
  border-color: rgba(240, 180, 41, 0.5);
  outline: none;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  color: #c4c7b8;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}

.field input, .field textarea, .field select {
  width: 100%;
  background: #0d0f0c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  transition: border-color 0.18s;
}

.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--gold);
  outline: none;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.field small {
  color: var(--muted);
  font-size: 10.5px;
  display: block;
  margin-top: 6px;
}

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

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

/* -------------------------------------------------------------
   TABLES (CRM & ADMIN)
-------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #727768;
  text-align: left;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

td small {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 4px;
}

td select {
  background: #171b14;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 10px;
  color: #c5cca6;
  font-size: 11.5px;
  cursor: pointer;
}

.person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.person .avatar {
  font-size: 11px;
  width: 34px;
  height: 34px;
}

.wa-link {
  color: #22c55e;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.15s;
}

.wa-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* -------------------------------------------------------------
   UNIFIED INBOX (CONVERSACIONES)
-------------------------------------------------------------- */
.inbox {
  display: grid;
  grid-template-columns: 320px 1fr;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 600px;
  background: var(--surface);
}

.threads {
  border-right: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.threads .search {
  width: 100%;
  min-width: 0;
  margin-bottom: 14px;
}

.thread-list {
  overflow-y: auto;
  flex: 1;
}

.thread {
  width: 100%;
  padding: 14px 12px;
  text-align: left;
  display: flex;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  margin-bottom: 6px;
  background: transparent;
  transition: all 0.15s ease;
}

.thread:hover {
  background: rgba(255, 255, 255, 0.03);
}

.thread.active {
  border-color: rgba(240, 180, 41, 0.3);
  background: rgba(240, 180, 41, 0.08);
}

.thread strong {
  font-size: 12.5px;
  display: block;
}

.thread p {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
  margin-top: 3px;
}

.thread time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  float: right;
  margin-left: 8px;
}

.conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #0d0e0b;
}

.chat-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
}

.chat-head strong {
  font-size: 13px;
}

.chat-head small {
  font-size: 10.5px;
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.messages {
  flex: 1;
  min-height: 340px;
  max-height: 480px;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: radial-gradient(ellipse at 100% 0%, rgba(240, 180, 41, 0.03), transparent 60%);
}

.bubble {
  max-width: 78%;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 2px;
  background: #191b15;
  font-size: 12.5px;
  line-height: 1.6;
  align-self: flex-start;
  word-break: break-word;
}

.bubble.out {
  align-self: flex-end;
  background: var(--gold-gradient);
  color: #151306;
  border: 0;
  border-radius: 14px 14px 2px 14px;
  font-weight: 500;
}

.bubble.human {
  background: #252b1e;
  border-color: rgba(34, 197, 94, 0.3);
  color: #edeee6;
}

.message-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--muted);
  display: block;
  margin-top: 6px;
}

.bubble.out .message-time {
  color: #634f18;
}

.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 10px 14px;
  background: #191b15;
  border-radius: 12px;
  align-self: flex-start;
  border: 1px solid var(--line);
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.ai-notice {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #9ab48a;
  padding: 8px 14px;
  text-align: center;
  background: rgba(34, 197, 94, 0.04);
  border-top: 1px solid var(--line);
}

.chat-suggestions {
  display: flex;
  gap: 8px;
  padding: 8px 18px 0;
  overflow-x: auto;
  white-space: nowrap;
}

.suggestion-chip {
  padding: 5px 12px;
  font-size: 11px;
  border-radius: 20px;
  background: rgba(240, 180, 41, 0.06);
  border: 1px solid rgba(240, 180, 41, 0.25);
  color: #e5ca7d;
  cursor: pointer;
  transition: all 0.15s;
}

.suggestion-chip:hover {
  background: rgba(240, 180, 41, 0.15);
  border-color: var(--gold);
}

.chat-compose {
  padding: 16px 20px;
}

.compose-box {
  display: flex;
  gap: 10px;
  background: #151812;
  border: 1px solid var(--line-strong);
  padding: 6px 10px;
  border-radius: 10px;
  align-items: center;
}

.compose-box input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--text);
  padding: 8px 6px;
}

.compose-box input:focus {
  outline: none;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* -------------------------------------------------------------
   BOTS & CONEXIONES
-------------------------------------------------------------- */
.bot-visual {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--gold);
  background: rgba(240, 180, 41, 0.1);
  border: 1px solid rgba(240, 180, 41, 0.25);
  margin-bottom: 18px;
  box-shadow: 0 0 16px rgba(240, 180, 41, 0.12);
}

.mini-stats {
  display: flex;
  justify-content: space-between;
  margin: 20px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mini-stats strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  display: block;
}

.mini-stats small {
  font-size: 10.5px;
  color: var(--muted);
}

.connection {
  position: relative;
}

.connection .channel-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  font-size: 22px;
}

.connection p {
  font-size: 12px;
  min-height: 56px;
  margin: 8px 0 20px;
}

.connection .tag {
  position: absolute;
  top: 24px;
  right: 20px;
}

.notice {
  padding: 14px 18px;
  background: rgba(240, 180, 41, 0.06);
  border: 1px solid rgba(240, 180, 41, 0.22);
  border-radius: 9px;
  color: #c9bea0;
  font-size: 12px;
  line-height: 1.65;
  margin-bottom: 22px;
}

/* -------------------------------------------------------------
   MI AGENTE (CEREBRO) & MODEL SELECTOR
-------------------------------------------------------------- */
.model {
  display: block;
  text-align: left;
  width: 100%;
  padding: 20px;
  border-radius: 12px;
  transition: all 0.18s;
}

.model.active {
  border-color: rgba(240, 180, 41, 0.5);
  background: rgba(240, 180, 41, 0.08);
}

.model strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 8px;
}

.model p {
  font-size: 11.5px;
  line-height: 1.6;
}

.model small {
  display: block;
  color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  margin-top: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

.setting-row p {
  font-size: 11.5px;
  margin-top: 4px;
}

/* -------------------------------------------------------------
   PLANTILLAS & GUIONES
-------------------------------------------------------------- */
.template-icon {
  font-size: 26px;
  margin-bottom: 16px;
  color: var(--gold);
}

.template p {
  font-size: 12px;
  margin: 8px 0 22px;
  min-height: 52px;
}

.template button {
  width: 100%;
  font-size: 11.5px;
}

.result {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.85;
  padding: 20px;
  background: #0c0e0b;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: #e5e8dc;
}

.tutorial-cover {
  height: 140px;
  background: radial-gradient(ellipse at 50% 100%, rgba(240, 180, 41, 0.2), transparent 75%), #151811;
  display: grid;
  place-items: center;
  border-radius: 10px;
  margin-bottom: 18px;
  color: var(--gold);
}

.tutorial-cover .icon {
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: 50%;
  width: 48px;
  height: 48px;
}

/* -------------------------------------------------------------
   MODALS & TOASTS
-------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.15s ease;
}

.modal {
  width: 580px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  background: #141610;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
  animation: scaleUp 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-head h2 {
  margin: 0;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

#toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  background: #1e2417;
  border: 1px solid rgba(131, 214, 163, 0.35);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  padding: 12px 22px;
  border-radius: 8px;
  z-index: 200;
  font-size: 12.5px;
  pointer-events: none;
  color: #def2db;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------------------------------------------------------------
   LOGIN & REGISTER
-------------------------------------------------------------- */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

.login-art {
  background: radial-gradient(ellipse at 30% 40%, rgba(240, 180, 41, 0.12), transparent 70%), #0e0f0a;
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.login-art h1 {
  font-size: 50px;
  max-width: 480px;
  margin: 32px 0 18px;
  line-height: 1.15;
}

.login-art h1 em {
  color: var(--gold);
  font-style: normal;
}

.login-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: #090a09;
}

.login-inner {
  width: 380px;
  max-width: 100%;
}

.login-inner h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

.login-inner form {
  margin-top: 24px;
}

.footer-note {
  font-size: 11px;
  color: #6a705e;
  margin-top: 24px;
  text-align: center;
  line-height: 1.7;
}

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

/* -------------------------------------------------------------
   RESPONSIVE DESIGN (TABLETS & MOBILE)
-------------------------------------------------------------- */
@media (max-width: 1150px) {
  :root { --side: 220px; }
  .topbar { padding: 0 24px; }
  .content { padding: 26px 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .three { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .inbox { grid-template-columns: 270px 1fr; }
}

@media (max-width: 820px) {
  :root { --side: 0px; }
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.7);
  }
  .mobile-toggle {
    display: inline-flex;
    padding: 8px;
  }
  .topbar {
    height: 64px;
    padding: 0 16px;
  }
  .content {
    padding: 20px 16px;
  }
  .two, .three {
    grid-template-columns: 1fr;
  }
  h1 { font-size: 24px; }
  .card { padding: 18px; }
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .steps {
    flex-direction: column;
    gap: 12px;
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .inbox {
    grid-template-columns: 1fr;
  }
  .threads {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 250px;
  }
  .login {
    grid-template-columns: 1fr;
  }
  .login-art {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------
   AGREGAR UN BOT MODAL & HERMES VIEW
-------------------------------------------------------------- */
.bot-option-btn {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--text);
  margin-bottom: 12px;
  transition: all 0.18s ease;
}

.bot-option-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.bot-option-icon {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #0a0a0a;
}

.bot-option-title {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bot-option-desc {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.55;
}

.hermes-banner-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 18px 22px;
  border-radius: 16px;
  cursor: pointer;
  background: linear-gradient(120deg, rgba(37, 211, 102, 0.12), rgba(19, 18, 16, 0.95) 55%);
  border: 1px solid rgba(37, 211, 102, 0.35);
  color: #efe9dc;
  transition: all 0.2s ease;
  margin-top: 20px;
}

.hermes-banner-btn:hover {
  border-color: #25d366;
  background: linear-gradient(120deg, rgba(37, 211, 102, 0.18), rgba(19, 18, 16, 0.95) 55%);
}

.hermes-banner-icon {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: #25d366;
  color: #0a0a0a;
}

.hermes-step-card {
  padding: 22px 24px;
  border-radius: 18px;
  background: rgba(19, 18, 16, 0.92);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

.hermes-step-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.hermes-step-num {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 17px;
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.45);
  color: var(--gold);
}

.hermes-step-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 16.5px;
  text-transform: uppercase;
  margin: 6px 0 10px;
}

.hermes-code-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin: 10px 0 6px;
}

.hermes-code {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: #0a0a0a;
  border: 1px solid rgba(240, 180, 41, 0.3);
  color: #f6c445;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}

.hermes-cmp-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.hermes-cmp-card {
  flex: 1;
  min-width: 270px;
  padding: 22px;
  border-radius: 16px;
  border: 1px solid;
}

.hermes-faq details {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.hermes-faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.hermes-faq summary::-webkit-details-marker {
  display: none;
}

.hermes-faq summary span {
  color: var(--gold);
  font-size: 18px;
  transition: transform 0.2s;
}

.hermes-faq details[open] summary span {
  transform: rotate(45deg);
}

.hermes-faq p {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #a99f8c;
}
