/* Low WhatsApp 360 — Flat design. Esmeralda + azul marino.
   Tipografías: Plus Jakarta Sans (títulos) + Inter (texto). Nada más. */

:root {
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-200: #a7f3d0;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;

  --navy-950: #071a2b;
  --navy-900: #0b2236;
  --navy-800: #12304a;
  --navy-700: #1b3a55;
  --navy-100: #e3eaf1;

  --ink: #0f1d2b;
  --ink-2: #4a5b6c;
  --ink-3: #6b7b8c;
  --line: #e4e9ee;
  --field: #c9d3dc;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f7f9f8;

  --amber-50: #fff8e6; --amber-700: #a15c00;
  --red-50: #fdeeee; --red-600: #d03b3b; --red-700: #b42323;
  --blue-50: #eaf2fd; --blue-700: #1d5fb4;

  --series-1: #059669; --series-2: #2a78d6; --series-3: #eb6834;

  --shadow-1: 0 1px 2px rgba(11, 34, 54, .05), 0 2px 10px rgba(11, 34, 54, .04);
  --shadow-2: 0 8px 30px rgba(11, 34, 54, .12);
  --radius: 14px;
  --radius-sm: 10px;

  --font-head: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.25; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15.5px; font-weight: 600; }
p { margin: 0; }
a { color: var(--emerald-700); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }
[hidden] { display: none !important; }

.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy-900); color: #c8d5e1; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--emerald-500); display: grid; place-items: center; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; line-height: 1.1; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 12px; color: #8fa6bb; }
.nav-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f879d; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #c8d5e1; font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--navy-800); color: #fff; }
.nav a.active { background: var(--emerald-600); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--navy-800); font-size: 13px; }
.sidebar-foot strong { color: #fff; font-weight: 600; display: block; }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 32px; background: var(--surface);
  box-shadow: 0 1px 0 var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.acting-banner { background: var(--amber-50); color: var(--amber-700); padding: 9px 32px; font-size: 13.5px; display: flex; gap: 12px; align-items: center; }
.content { padding: 28px 32px 64px; max-width: 1360px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: 4px; max-width: 640px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--emerald-100); color: var(--emerald-800);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .who { line-height: 1.2; }
.user-chip .who small { display: block; color: var(--ink-3); font-size: 12px; }

/* ---------- Superficies ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 22px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head p { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.span-2 { grid-column: span 2; }

/* ---------- Botones ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; line-height: 1.2; white-space: nowrap;
  transition: background .12s, color .12s;
  text-decoration: none !important;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--emerald-600); color: #fff; }
.btn-primary:hover { background: var(--emerald-700); }
.btn-secondary { background: var(--emerald-50); color: var(--emerald-800); }
.btn-secondary:hover { background: var(--emerald-100); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); }
.btn-danger-ghost { background: transparent; color: var(--red-700); }
.btn-danger-ghost:hover { background: var(--red-50); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-secondary.loading::after, .btn-ghost.loading::after { border-color: var(--emerald-200); border-top-color: var(--emerald-700); }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--emerald-700); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Formularios: cajas cerradas + ayuda gris ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.field .opt { font-weight: 400; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--field); border-radius: var(--radius-sm); padding: 10px 12px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder, .textarea::placeholder { color: #94a3b3; }
.input:hover, .select:hover, .textarea:hover { border-color: #aebbc7; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--emerald-600); box-shadow: 0 0 0 3px var(--emerald-100); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234a5b6c' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
.help { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea { border-color: var(--red-600); }
.field .err { font-size: 12.5px; color: var(--red-700); }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix { display: grid; place-items: center; padding: 0 12px; border: 1.5px solid var(--field); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); color: var(--ink-2); font-size: 13px; }
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--emerald-600); }

.search { position: relative; min-width: 300px; flex: 1; max-width: 460px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); }
.search .input { padding-left: 38px; }

/* ---------- Pestañas (subsecciones) ---------- */
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 5px; border-radius: 12px; box-shadow: var(--shadow-1); width: fit-content; }
.tab { border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-2); padding: 8px 14px; border-radius: 9px; cursor: pointer; display: flex; gap: 8px; align-items: center; text-decoration: none !important; }
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.active { background: var(--navy-900); color: #fff; }
.tab .count { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.tab.active .count { background: var(--navy-700); color: #fff; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- Insignias ---------- */
.badge { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.green { background: var(--emerald-50); color: var(--emerald-700); }
.badge.amber { background: var(--amber-50); color: var(--amber-700); }
.badge.red { background: var(--red-50); color: var(--red-700); }
.badge.blue { background: var(--blue-50); color: var(--blue-700); }
.badge.navy { background: var(--navy-100); color: var(--navy-800); }

/* ---------- KPIs ---------- */
.kpi { padding: 18px 20px; }
.kpi .label { font-size: 13px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--font-head); font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi .delta { font-size: 12.5px; margin-top: 4px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.kpi .delta.up { color: var(--emerald-700); }
.kpi .delta.down { color: var(--red-700); }
.kpi .delta.flat { color: var(--ink-3); }
.kpi .delta span { color: var(--ink-3); font-weight: 400; }
.kpi.hero { background: var(--navy-900); color: #fff; }
.kpi.hero .label { color: #9fb4c8; }
.kpi.hero .value { color: #fff; font-size: 34px; }
.kpi.hero .delta.up { color: #6ee7b7; }
.kpi.hero .delta.down { color: #fca5a5; }
.kpi.hero .delta span { color: #9fb4c8; }

/* ---------- Gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: #eef2f5; stroke-width: 1; }
.chart .axis-text { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font-body); }
.chart .crosshair { stroke: #b9c6d2; stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--navy-950); color: #fff; padding: 9px 12px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5; box-shadow: var(--shadow-2); white-space: nowrap; z-index: 5; transform: translate(-50%, calc(-100% - 12px));
}
.tooltip .t-title { color: #9fb4c8; font-size: 11.5px; margin-bottom: 2px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; }
.tooltip .t-row b { margin-left: auto; padding-left: 14px; font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }

.hbar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; gap: 6px 12px; align-items: center; }
.hbar .name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 12px; border-radius: 0 4px 4px 0; position: relative; }
.hbar .fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-step { display: grid; grid-template-columns: 120px 1fr 64px; gap: 12px; align-items: center; font-size: 13.5px; }
.funnel-step .bar { height: 30px; background: var(--emerald-600); border-radius: 0 4px 4px 0; display: flex; align-items: center; padding-left: 10px; color: #fff; font-weight: 600; font-size: 13px; min-width: 2px; }
.funnel-step:nth-child(2) .bar { background: var(--emerald-700); }
.funnel-step:nth-child(3) .bar { background: var(--emerald-800); }
.funnel-step .rate { color: var(--ink-3); font-size: 12.5px; text-align: right; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 0 12px 10px; }
.table td { padding: 12px; border-top: 1px solid #f0f3f5; vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Tarjetas de producto / oferta ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.p-card { display: flex; flex-direction: column; gap: 14px; }
.p-top { display: flex; gap: 14px; }
.thumb { width: 72px; height: 72px; border-radius: 12px; background: var(--emerald-50); flex: none; overflow: hidden; display: grid; place-items: center; color: var(--emerald-700); font-family: var(--font-head); font-weight: 700; font-size: 22px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-title { font-family: var(--font-head); font-weight: 600; font-size: 16px; line-height: 1.3; }
.p-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 12px; }
.stats div { font-size: 12px; color: var(--ink-3); }
.stats b { display: block; font-family: var(--font-head); color: var(--ink); font-size: 16px; font-weight: 700; }
.p-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.p-actions .spacer { flex: 1; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.score { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-family: var(--font-head); font-weight: 700; background: var(--emerald-50); color: var(--emerald-700); }
.score.mid { background: var(--amber-50); color: var(--amber-700); }
.score.low { background: var(--red-50); color: var(--red-700); }

/* ---------- Leer más ---------- */
.readmore-text { color: var(--ink-2); font-size: 13.5px; white-space: pre-line; }
.readmore-text.clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.readmore-btn { margin-top: 4px; font-size: 13px; }

/* ---------- Asistente por pasos ---------- */
.wizard-progress { margin: 4px 0 22px; }
.wizard-progress .bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.wizard-progress .bar i { display: block; height: 100%; background: var(--emerald-600); border-radius: 99px; transition: width .25s; }
.wizard-progress .steps { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12.5px; color: var(--ink-3); gap: 8px; }
.wizard-progress .steps span.done { color: var(--emerald-700); font-weight: 600; }
.wizard-progress .steps span.current { color: var(--ink); font-weight: 600; }
.wizard-step-head { margin-bottom: 18px; }
.wizard-step-head p { color: var(--ink-2); margin-top: 4px; font-size: 13.5px; }
.review { background: var(--surface-2); border-radius: 12px; padding: 16px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(7, 26, 43, .45); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-2); width: 100%; max-width: 620px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .18s; }
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 860px; }
.modal-head { padding: 22px 24px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.modal-foot .left { margin-right: auto; }
.icon-btn { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--navy-950); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-2); font-size: 14px; max-width: 380px; display: flex; gap: 10px; align-items: flex-start; animation: pop .2s; }
.toast.error { background: var(--red-700); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---------- Estados vacíos y avisos ---------- */
.empty { text-align: center; padding: 56px 20px; }
.empty .ic { width: 52px; height: 52px; border-radius: 16px; background: var(--emerald-50); color: var(--emerald-700); display: grid; place-items: center; margin: 0 auto 14px; }
.empty .ic svg { width: 24px; height: 24px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-2); max-width: 420px; margin: 0 auto 18px; }
.notice { border-radius: 12px; padding: 14px 16px; background: var(--blue-50); color: #1d3f6e; font-size: 13.5px; display: flex; gap: 10px; }
.notice.warn { background: var(--amber-50); color: #6b4300; }
.notice.ok { background: var(--emerald-50); color: var(--emerald-800); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.skeleton { background: linear-gradient(90deg, #eef2f4, #f6f8f9, #eef2f4); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Bloques de código / MCP ---------- */
.code-block { position: relative; background: var(--navy-950); color: #d6e3ee; border-radius: 12px; padding: 16px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.code-block .copy { position: absolute; top: 10px; right: 10px; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--surface-2); }
.client-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tool-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tool-item { padding: 12px 14px; background: var(--surface-2); border-radius: 10px; }
.tool-item code { color: var(--emerald-800); font-weight: 600; }
.tool-item p { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

/* ---------- Estudio IA ---------- */
.studio { display: grid; grid-template-columns: 420px 1fr; gap: 18px; align-items: start; }
.model-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.model-opt { text-align: left; border: 0; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; cursor: pointer; font: inherit; }
.model-opt:hover { background: var(--emerald-50); }
.model-opt.active { background: var(--emerald-600); color: #fff; }
.model-opt b { display: block; font-size: 13.5px; font-weight: 600; }
.model-opt small { font-size: 11.5px; color: var(--ink-3); }
.model-opt.active small { color: var(--emerald-100); }
.seg { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 10px; gap: 4px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px; padding: 7px 14px; border-radius: 8px; color: var(--ink-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.media-tile { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-1); overflow: hidden; display: flex; flex-direction: column; }
.media-tile .preview { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.media-tile .preview img, .media-tile .preview video { width: 100%; height: 100%; object-fit: cover; }
.media-tile .meta { padding: 10px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.media-tile .meta .prompt { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pulse { width: 34px; height: 34px; border-radius: 50%; background: var(--emerald-200); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(.7); opacity: .5; } }

/* ---------- Ajustes de widgets ---------- */
.widget-toggles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.filters .field { min-width: 160px; }

/* ---------- Pantallas de acceso / instalación ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--navy-900); color: #c8d5e1; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { color: #fff; font-size: 34px; max-width: 440px; margin-top: 40px; }
.auth-side h1 em { font-style: normal; color: var(--emerald-500); }
.auth-side p { max-width: 420px; margin-top: 14px; font-size: 15px; }
.auth-points { display: flex; flex-direction: column; gap: 12px; margin-top: 30px; }
.auth-points div { display: flex; gap: 10px; align-items: center; }
.auth-points i { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald-500); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h2 { font-size: 24px; font-weight: 700; }
.auth-card .lead { color: var(--ink-2); margin: 6px 0 26px; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 10px; }
  .sidebar .brand, .nav-label, .sidebar-foot { display: none; }
  .nav { display: flex; gap: 4px; }
  .nav a { white-space: nowrap; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .search { min-width: 0; }
}
@media (max-width: 860px) {
  .sidebar { scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
}
@media (max-width: 1100px) {
  .toolbar .search { flex: 1 1 100%; max-width: none; min-width: 0; }
}
.grid > * { min-width: 0; }
.card-head { flex-wrap: wrap; }
.funnel-step { grid-template-columns: minmax(90px, 120px) 1fr 56px; }
.table td:first-child { min-width: 180px; }

/* ---------- Ofertas del bot ---------- */
.bot-strip { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 18px; }
.bot-strip > div:first-child b { display: block; font-family: var(--font-head); }
.bot-flow { display: flex; align-items: center; gap: 12px; flex: 1; flex-wrap: wrap; }
.bot-flow div { display: flex; flex-direction: column; line-height: 1.25; }
.bot-flow b { font-family: var(--font-head); font-size: 17px; }
.bot-flow span { font-size: 12px; color: var(--ink-3); }
.bot-flow i { color: var(--ink-3); font-style: normal; }
.kw-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kw-row .subtle { margin-right: 4px; }
.chip { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.best { background: var(--emerald-50); color: var(--emerald-800); font-weight: 600; }
.chip.wa { background: var(--emerald-600); color: #fff; }
.chip.off { color: var(--ink-3); text-decoration: line-through; }
.detail-sec h3 { font-size: 14px; margin-bottom: 10px; color: var(--ink); }
.detail-sec + .detail-sec { padding-top: 4px; }
.copy-box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.copy-box + .copy-box { margin-top: 8px; }
.link-list { display: flex; flex-direction: column; gap: 6px; }
.link-list a { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }
.link-list svg { width: 14px; height: 14px; flex: none; }
.endpoint .method { display: grid; place-items: center; padding: 0 12px; border-radius: var(--radius-sm); background: var(--navy-900); color: #fff; font-weight: 600; font-size: 12.5px; }
.endpoint .help { margin-top: 6px; }
.err-item { background: var(--red-50); border-radius: 10px; padding: 12px 14px; }
.err-item.resolved { background: var(--surface-2); opacity: .75; }
.modal-foot .row.left { flex: 1; gap: 8px; }
@media (max-width: 860px) {
  .bot-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .bot-flow i { display: none; }
}
.copy-box .link-btn { align-self: flex-start; }

/* ---------- Prueba y registro de webhooks ---------- */
.json-view { max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
.events-table tbody tr { cursor: pointer; }
.events-table tr.row-new td { background: var(--emerald-50); transition: background 2s; }
.live-toggle { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.test-result { margin-top: 20px; }
.btn.copied { background: var(--emerald-600); color: #fff; }

details.advanced summary { cursor: pointer; list-style: none; }
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before { content: '▸ '; color: var(--ink-3); }
details.advanced[open] summary::before { content: '▾ '; }

.danger-zone { box-shadow: inset 0 0 0 1.5px #f3c9c9, var(--shadow-1); }

/* ---------- Banderas ---------- */
.country { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; margin-right: 10px; }
.country:last-child { margin-right: 0; }
.flag { width: 1.33em; height: 1em; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(11, 34, 54, .1); flex: none; }

.update-banner { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 150; display: flex; align-items: center; gap: 12px;
  background: var(--navy-950); color: #fff; padding: 12px 14px 12px 16px; border-radius: 14px; box-shadow: var(--shadow-2); font-size: 14px; max-width: calc(100vw - 32px); }
.update-banner svg { width: 18px; height: 18px; color: var(--emerald-500); flex: none; }
