:root {
  --canvas: #f3f4f6;
  --paper: #ffffff;
  --ink: #12151a;
  --muted: #5b6370;
  --faint: #8b929c;
  --line: #e4e6ea;
  --line-strong: #cfd3da;
  --sidebar: #0a0c10;
  --sidebar-text: #9aa3b0;
  --sidebar-active: #f4f7fb;
  --accent: #1b8fff;
  --accent-soft: rgba(27, 143, 255, 0.12);
  --user-bubble: #e8f1fb;
  --listeza-bubble: #ffffff;
  --danger: #9a3b32;
  --ok: #2c5f48;
  --silver: #4a5160;
  --shadow: 0 10px 28px rgba(16, 18, 22, 0.07);
  --radius: 10px;
  --nav-w: 248px;
  --context-w: 320px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  letter-spacing: 0.01em;
  overflow-x: clip;
}

h1, h2, h3, .brand strong {
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.error { color: var(--danger); min-height: 1.2em; font-size: 14px; }

.gate {
  height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(720px 340px at 50% 8%, rgba(27, 143, 255, 0.16), transparent 55%),
    #07080b;
}

.gate-panel { width: min(420px, 100%); }
.gate .eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.gate-brand { display: flex; margin-bottom: 16px; }
.gate-logo { width: min(280px, 100%); height: auto; display: block; mix-blend-mode: screen; }
.gate h1 { margin: 0; font-size: 42px; color: #f3f6fa; }
.gate h1 em { font-style: normal; color: var(--accent); }
.lede { margin: 10px 0 28px; color: #9aa3b0; line-height: 1.5; }
.gate { color: #e8ecf2; }
.gate .eyebrow { color: #8d94a0; }
.gate label { color: #9aa3b0; }

label { display: block; margin: 16px 0 6px; font-size: 13px; color: var(--muted); }

input, textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  border-radius: 2px;
  padding: 12px 13px;
}

input:focus, textarea:focus {
  outline: 2px solid rgba(27, 143, 255, 0.28);
  border-color: var(--accent);
}

button[type="submit"], #login-btn {
  margin-top: 22px;
  background: var(--accent);
  color: #061018;
  border: 0;
  border-radius: 2px;
  padding: 12px 18px;
  font-weight: 600;
  flex: 0 0 auto;
}

.app {
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  overflow: hidden;
}

.app.nav-collapsed {
  --nav-w: 64px;
}

.app.nav-collapsed .sidebar {
  overflow: hidden;
  padding: 20px 10px;
  visibility: visible;
}

.app.nav-collapsed .brand-horizontal,
.app.nav-collapsed .brand small,
.app.nav-collapsed .nav a span,
.app.nav-collapsed .nav-label,
.app.nav-collapsed .sidebar-foot {
  display: none;
}

.app.nav-collapsed .brand-isotipo { display: block; }
.app.nav-collapsed .nav a { justify-content: center; padding: 10px 0; }

.sidebar {
  min-width: 0;
  min-height: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 28px 18px 20px;
  overflow: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: #fff;
  margin-bottom: 24px;
  padding: 2px 2px 18px;
  min-width: 0;
  border-bottom: 1px solid #1b2028;
}

.brand-horizontal {
  display: block;
  width: 100%;
  max-width: 228px;
  height: auto;
  min-height: 48px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: screen;
}

.brand-isotipo {
  display: none;
  width: 44px;
  height: 44px;
  object-fit: contain;
  mix-blend-mode: screen;
}

.brand small, .sidebar-foot small {
  display: block;
  color: #8d94a0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav { display: grid; gap: 2px; }
.nav-label {
  margin: 14px 10px 6px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #66707c;
}
.nav-label:first-child { margin-top: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  min-width: 0;
}
.nav-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.nav a:hover { color: #fff; background: #12161c; }
.nav a.active {
  color: var(--sidebar-active);
  background: var(--accent-soft);
}
.nav a.active::after {
  content: "";
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.sidebar-foot {
  margin-top: auto;
  padding: 18px 10px 0;
  border-top: 1px solid #2a2f38;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  min-width: 0;
}

.sidebar-foot strong { color: #fff; font-size: 14px; display: block; }
.text-btn {
  background: none;
  border: 0;
  color: #9aa1ab;
  padding: 0;
  font-size: 13px;
}
.text-btn:hover { color: #fff; }

.workspace {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
}

.app[data-view="asistente"] .workspace { background: #ffffff; }

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 24px;
  min-width: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar-title { flex: 1 1 auto; min-width: 0; }
.topbar h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  width: 36px;
  height: 36px;
}

.project-chip {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 420px;
  padding: 8px 12px;
  border: 1px solid #e3e6eb;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 18, 22, 0.04);
}
.project-chip-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #5c6370;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.project-chip-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
}
.project-status-label {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  color: #8b919a;
}
.project-chip strong {
  font-size: 13px;
  color: #1f2328;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.project-chip-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}
.project-chip[data-empty="1"] { background: #ffffff; border-color: #e3e6eb; }
.project-chip[data-empty="1"] .project-status-label { color: #8b919a; }
.project-chip[data-empty="1"] .project-chip-dot { background: #c5cad1; }

.context-toggle {
  display: none;
  flex: 0 0 auto;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 10px;
}
.context-toggle:hover { color: var(--accent); }
.app[data-view="asistente"] .context-toggle { display: inline-block; }

.stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 24px 24px;
}

.view {
  max-width: 1180px;
  min-width: 0;
}

.ask-bar { margin-bottom: 28px; min-width: 0; }
.ask-bar label {
  margin-top: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}
.ask-row { display: flex; gap: 10px; min-width: 0; }
.ask-row input { flex: 1 1 auto; }
.ask-row button { margin-top: 0; white-space: nowrap; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.metric {
  min-width: 0;
  padding: 18px 18px 18px 0;
  border-right: 1px solid var(--line);
}
.metric:last-child { border-right: 0; padding-right: 0; }
.metric b { display: block; font-size: 28px; line-height: 1.1; }
.metric span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.focus {
  padding: 8px 0 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  min-width: 0;
}
.focus h3 { margin: 0 0 8px; font-size: 22px; overflow-wrap: anywhere; }
.focus p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.focus-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 16px;
  font-size: 14px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 48px;
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}
.section-head h3 { margin: 0; font-size: 20px; }
.section-head a { font-size: 13px; flex: 0 0 auto; }

.table-wrap { overflow: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
th {
  color: var(--faint);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
td a { color: inherit; font-weight: 600; }

.activity-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.activity-item strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
}
.activity-item p {
  margin: 6px 0 0;
  color: var(--ink);
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.quick a { color: var(--ink); border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; }

.module-lede, .module-shell p { color: var(--muted); max-width: 62ch; line-height: 1.55; overflow-wrap: anywhere; }
.module-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.module-shell h3 { margin: 0 0 10px; font-size: 28px; }
.project-detail { margin-top: 20px; }
.project-detail:empty { display: none; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.project-grid div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.project-grid small { display: block; color: var(--faint); margin-bottom: 4px; }
.persisted-output { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; line-height: 1.55; }
.module-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.module-switch button { border: 1px solid var(--line-strong); background: #fff; border-radius: 7px; padding: 7px 10px; }
.module-switch button.active { border-color: var(--accent); background: var(--accent-soft); }
.document-list { display: grid; gap: 10px; }
.document-list a { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.document-list small { display: block; margin-top: 4px; color: var(--faint); }
.result-sheet { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.result-heading { padding: 10px 14px; background: #f1f4f7; color: var(--ink); font-weight: 700; border-top: 1px solid var(--line); }
.result-heading:first-child { border-top: 0; }
.result-line, .result-bullet { padding: 8px 14px; border-top: 1px solid #eef0f3; line-height: 1.45; overflow-wrap: anywhere; }
.result-bullet { padding-left: 28px; position: relative; }
.result-bullet::before { content: "•"; position: absolute; left: 14px; color: var(--accent); }
@media (max-width: 760px) { .project-grid { grid-template-columns: 1fr; } }
.link-action {
  display: inline-block;
  margin-top: 18px;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}

#view-asistente {
  max-width: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.chat-layout {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  background: var(--paper);
}

.conversation {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.thread {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 28px 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background: #ffffff;
}

.turn {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: min-content;
  padding: 16px 4px 18px;
  border-bottom: 1px solid #efece6;
}

.turn:last-child { border-bottom: 0; }

.turn.user {
  align-self: flex-end;
  width: auto;
  max-width: min(640px, 100%);
  border-bottom: 0;
  padding-bottom: 12px;
}

.turn .who {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}

.turn .body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.65;
  font-size: 15.5px;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
}

.turn.user .who { text-align: right; color: #3d6ea8; }
.turn.user .body {
  background: var(--user-bubble);
  border: 1px solid #d5e4f4;
  padding: 14px 16px;
}

.turn.assistant .who { color: #3a404a; letter-spacing: 0.14em; }
.turn.assistant .body {
  background: #ffffff;
  border: 1px solid #eceae4;
  border-left: 2px solid var(--accent);
  padding: 14px 16px 14px 18px;
}
.typing-body { display: flex; align-items: center; min-height: 36px; }
.typing-dots { display: flex; align-items: center; gap: 5px; }
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b93a1;
  animation: listeza-typing 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes listeza-typing {
  0%, 70%, 100% { transform: translateY(0); opacity: 0.35; }
  35% { transform: translateY(-4px); opacity: 1; }
}

.files { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; }
.files a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.composer {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  min-width: 0;
  padding: 14px 0 8px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}
.composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 64px;
  max-width: 100%;
  resize: vertical;
  background: #ffffff;
  color: var(--ink);
}
.composer button { margin-top: 0; align-self: end; }
.composer textarea:disabled,
.composer button:disabled { opacity: 0.6; cursor: not-allowed; }

.context-scrim {
  display: none;
}

.context-panel {
  flex: 0 0 var(--context-w);
  width: var(--context-w);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #f3f2ee;
}

.app.context-collapsed .context-panel {
  flex-basis: 0;
  width: 0;
  border-left-width: 0;
  overflow: hidden;
  visibility: hidden;
}

.context-toolbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 8px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.context-toolbar .text-btn { color: var(--muted); }

.context {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 8px 16px 20px;
}

.context h3 { margin: 0 0 6px; font-size: 20px; overflow-wrap: anywhere; }
.context .muted { color: var(--muted); margin: 0 0 18px; font-size: 14px; overflow-wrap: anywhere; }
.context dl { margin: 0; }
.context dt {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 14px;
}
.context dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.context .links { display: grid; gap: 8px; margin-top: 22px; }
.context .links a { color: var(--silver); font-size: 14px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.context .links a:hover { color: var(--accent); }

.empty { color: var(--muted); padding: 18px 0; overflow-wrap: anywhere; }

.app[data-view="conversaciones"] .stage { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.app[data-view="conversaciones"] .context-toggle { display: none; }
.wa-connect-btn { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0; padding: 7px 12px 7px 10px; border: 1px solid var(--line); background: #fff; color: var(--accent); border-radius: 10px; box-shadow: 0 1px 2px rgba(16, 18, 22, 0.04); }
.wa-connect-btn:hover { border-color: #c9d4e0; }
.wa-connect-btn svg { width: 18px; height: 18px; fill: #25d366; flex: 0 0 auto; }
.wa-connect-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.wa-connect-copy strong { font-size: 13px; font-weight: 600; line-height: 1.2; color: var(--accent); }
.wa-connect-copy small { font-size: 10px; color: #8b919a; font-weight: 500; }
.wa-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c5cad1; flex: 0 0 auto; }
#view-conversaciones { max-width: none; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: #f4f6f8; }
.wa-shell { flex: 1 1 auto; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(280px, 340px); overflow: hidden; }
.wa-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.wa-list { border-right: 1px solid var(--line); }
.wa-chat { background: #f7f8fa; }
.wa-rail { border-left: 1px solid var(--line); background: #f6f7f9; }
.wa-col-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.wa-col-head h3 { margin: 0; font-size: 15px; }
.wa-col-head p { margin: 2px 0 0; font-size: 11px; color: var(--faint); }
.wa-head-actions { display: flex; gap: 6px; }
.wa-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; border-radius: 8px; color: var(--muted); }
.wa-search { flex: 0 0 auto; padding: 10px 14px 8px; }
.wa-search input { background: #f4f6f8; border-color: var(--line); padding: 9px 12px; }
.wa-tabs { flex: 0 0 auto; display: flex; gap: 6px; padding: 0 14px 10px; overflow: auto; }
.wa-tab { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 5px 10px; font-size: 12px; }
.wa-tab.active { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.wa-convs { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 8px 12px; }
.wa-conv { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; }
.wa-conv.preview { opacity: 0.78; cursor: default; }
.wa-conv.active { background: #eef6ff; }
.wa-avatar { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #e8eef5; color: #4d5b6b; font-size: 11px; font-weight: 700; }
.wa-conv strong { display: block; font-size: 13px; }
.wa-conv p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.wa-conv-meta { margin-left: auto; text-align: right; flex: 0 0 auto; }
.wa-list-foot { flex: 0 0 auto; padding: 8px 14px 12px; font-size: 11px; color: var(--faint); border-top: 1px solid var(--line); }
.wa-chat-thread { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 20px 18px; display: flex; flex-direction: column; }
.wa-empty { margin: auto; max-width: 360px; text-align: center; color: var(--muted); }
.wa-empty h3 { margin: 0 0 8px; font-size: 18px; color: var(--ink); }
.wa-empty p { margin: 0; line-height: 1.55; font-size: 13px; }
.wa-chat-compose { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.wa-chat-compose input { flex: 1 1 auto; min-width: 0; background: #f4f6f8; }
.wa-chat-compose button { margin-top: 0; }
.wa-chat-compose input:disabled, .wa-chat-compose button:disabled { opacity: 0.55; cursor: not-allowed; }
.wa-sync { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; font-size: 11px; color: var(--faint); background: #eef1f4; border-top: 1px solid var(--line); }
.wa-rail-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.wa-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.wa-card h4 { margin: 0 0 8px; font-size: 13px; }
.wa-mini-thread { display: flex; flex-direction: column; gap: 8px; min-height: 88px; }
.wa-mini-turn { font-size: 12px; line-height: 1.45; }
.wa-mini-turn strong { display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px; }
.wa-mini-turn p { margin: 0; }
.wa-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.wa-quick a { display: block; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; color: var(--ink); font-size: 11px; text-align: center; }
.wa-context dt { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.wa-context dd { margin: 2px 0 0; font-size: 13px; }
.wa-pill { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: #e8f8ee; color: #1f7a46; font-size: 10px; font-weight: 600; }
.wa-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; }
.wa-modal[hidden] { display: none !important; }
.wa-modal-scrim { position: absolute; inset: 0; background: rgba(12, 16, 22, 0.45); }
.wa-modal-card { position: relative; width: min(460px, 100%); background: #fff; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px; }
.wa-modal-card h3 { margin: 0 0 8px; font-size: 20px; }
.wa-modal-card p { margin: 0 0 10px; color: var(--muted); line-height: 1.55; font-size: 14px; }
.wa-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.wa-modal-actions button { margin-top: 0; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 14px; }
.wa-rail-toggle, .wa-list-toggle, #wa-rail-close { display: none; }
.wa-rail-scrim { display: none; }

@media (max-width: 1279px) {
  .context-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 24;
    flex: none;
    width: min(340px, 92vw);
    max-width: 92vw;
    visibility: visible;
    transform: translateX(110%);
    transition: transform 0.2s ease;
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(20, 22, 27, 0.08);
  }

  .app.context-collapsed .context-panel {
    flex-basis: auto;
    width: min(340px, 92vw);
    visibility: visible;
    transform: translateX(110%);
  }

  .app.context-open .context-panel {
    transform: none;
  }

  .context-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 23;
    background: rgba(20, 22, 27, 0.35);
  }

  .context-scrim[hidden] { display: none; }
  .wa-shell { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .wa-rail { position: fixed; top: 0; right: 0; bottom: 0; z-index: 24; width: min(340px, 92vw); transform: translateX(110%); transition: transform 0.2s ease; }
  .app.wa-rail-open .wa-rail { transform: none; }
  .wa-rail-toggle, #wa-rail-close { display: inline-flex; }
  .wa-rail-scrim { display: block; position: fixed; inset: 0; z-index: 23; background: rgba(20, 22, 27, 0.35); }
  .wa-rail-scrim[hidden] { display: none; }
}

@media (max-width: 1099px) {
  .app,
  .app.nav-collapsed {
    --nav-w: 0px;
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .app.nav-collapsed .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 88vw);
    height: 100%;
    z-index: 20;
    visibility: visible;
    padding: 28px 18px 20px;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    overflow: auto;
  }

  .app.nav-open .sidebar,
  .sidebar.open {
    transform: none;
  }

  .nav-scrim {
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 27, 0.35);
    z-index: 15;
  }

  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; padding-right: 0; }
  .split { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .topbar, .stage { padding-left: 16px; padding-right: 16px; }
  .app[data-view="conversaciones"] .stage { padding: 0; }
  .wa-shell { grid-template-columns: minmax(0, 1fr); }
  .wa-list { position: fixed; top: 0; left: 0; bottom: 0; z-index: 22; width: min(300px, 88vw); transform: translateX(-105%); transition: transform 0.2s ease; }
  .app.wa-list-open .wa-list { transform: none; }
  .wa-list-toggle { display: inline-flex; }
}

@media (max-width: 767px) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .metric { border-right: 0; padding-right: 0; }
  .ask-row { flex-direction: column; }
  .ask-row button { width: 100%; }
  .composer { flex-direction: column; }
  .composer button { align-self: stretch; }
  .topbar h2 { font-size: 22px; }
  .turn.user { max-width: 100%; }
  .wa-connect-copy { display: none; }
}
