/* ===== Integraciones ===== */
.ig-sec { margin-bottom: 26px; }
.ig-sec-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ig-sec-h h3 { margin: 0; font-size: 17px; }
.ig-sec-h small { color: var(--muted); font-size: 12.5px; }
.ig-sec-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--c); box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 45%, transparent); }
.ig-count { font-size: 12px; color: var(--muted); }
.ig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ig-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); transition: border-color .15s, transform .15s, box-shadow .15s; }
.ig-card.dashed { border-style: dashed; border-color: color-mix(in srgb, var(--c) 55%, var(--border)); }
.ig-card[data-open] { cursor: pointer; }
.ig-card:hover { border-color: var(--c); transform: translateY(-1px); box-shadow: 0 8px 24px color-mix(in srgb, var(--c) 16%, transparent); }
.ig-card-h { display: flex; align-items: center; gap: 10px; }
.ig-card-h b { display: block; font-size: 14.5px; }
.ig-card-h small { display: block; font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ig-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; flex: 1; }
.ig-card p code { font-size: 11px; }
.ig-card-f { display: flex; align-items: center; gap: 8px; }
.ig-logo { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--c, #3b82f6), color-mix(in srgb, var(--c, #3b82f6) 60%, #000)); }
.ig-logo.ok { --c: #22c55e; }
.ig-st { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 3px 9px; border-radius: 999px; background: var(--panel2); }
.ig-st i { width: 7px; height: 7px; border-radius: 50%; background: #64748b; }
.ig-st.on { color: #22c55e; background: rgba(34,197,94,.12); }
.ig-st.on i { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.ig-free { font-size: 11px; font-weight: 800; letter-spacing: .5px; color: #052e16; background: #4ade80; padding: 3px 10px; border-radius: 999px; }

/* IA incluida */
.ai-grid { grid-template-columns: minmax(300px, 1.4fr) repeat(auto-fill, minmax(220px, 1fr)); }
.ai-included { --c: #22c55e; border: 1.5px solid rgba(34,197,94,.45); background: linear-gradient(160deg, rgba(34,197,94,.10), var(--panel) 55%); grid-row: span 2; }
.ai-included.active { box-shadow: 0 0 0 1px rgba(34,197,94,.5), 0 10px 30px rgba(34,197,94,.14); }
.ai-models { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-model { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; transition: border-color .15s, box-shadow .15s; }
.ai-model:hover { border-color: var(--c); }
.ai-model.sel { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.ai-model.off { opacity: .6; }
.am-h { display: flex; align-items: center; gap: 6px; color: var(--c); }
.am-h b { color: var(--text); font-size: 13.5px; }
.am-ck { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; }
.ai-model small { color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; }
.ai-model em { font-style: normal; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px; background: rgba(127,127,127,.12); }
.ai-model em.warn { color: #f59e0b; background: rgba(245,158,11,.12); }
.ai-mode { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.ev-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-chips .chip { cursor: pointer; }

/* Medición de anuncios (CAPI) */
.ig-measure { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.ms-card { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 14px; display: flex; flex-direction: column; gap: 8px; --c: #0ea5e9; }
.ms-skel { height: 220px; border-radius: 12px; background: linear-gradient(90deg, var(--panel2), color-mix(in srgb, var(--panel2) 60%, var(--panel)), var(--panel2)); background-size: 200% 100%; animation: skel 1.2s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.ms-h { display: flex; align-items: center; gap: 10px; }
.ms-h b { display: block; font-size: 15px; }
.ms-h small { color: var(--muted); font-size: 11.5px; }
.ms-h .danger { color: var(--danger); }
.ms-ranges { display: flex; gap: 4px; flex-wrap: wrap; }
.ms-ranges button { border: 1px solid var(--border); background: var(--panel2); color: var(--muted); padding: 5px 11px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12px; }
.ms-ranges button.on { background: #2563eb; border-color: #2563eb; color: #fff; }
.ms-hero { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(34,197,94,.10); border: 1px solid rgba(34,197,94,.3); }
.ms-hero b { display: block; color: #4ade80; font-size: 13.5px; }
.ms-hero small { color: var(--muted); font-size: 11.5px; }
.ms-hero > span { margin-left: auto; font-size: 26px; font-weight: 800; color: #4ade80; }
.ms-card h5 { margin: 4px 0 0; font-size: 13px; }
.ms-line { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; background: var(--panel2); }
.ms-line.sub { margin-left: 14px; }
.ms-line i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.ms-line.c-ok i { background: #22c55e; }
.ms-line.c-info i { background: #3b82f6; }
.ms-line.c-warn i { background: #f59e0b; }
.ms-line.c-warn { background: rgba(245,158,11,.08); }
.ms-line b { display: block; font-size: 12.5px; }
.ms-line small { color: var(--muted); font-size: 11px; }
.ms-line > span { margin-left: auto; font-weight: 800; }
.ms-line.c-ok > span { color: #4ade80; }
.ms-line.c-info > span { color: #60a5fa; }
.ms-line.c-warn > span { color: #fbbf24; }
.ms-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 4px 0; }
.ms-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.ms-grid div { padding: 8px; border-radius: 9px; background: var(--panel2); }
.ms-grid small { display: block; color: var(--muted); font-size: 10.5px; }
.ms-grid b.bad { color: var(--danger); }
.ms-f { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.ms-f small { color: var(--muted); font-size: 11px; }

/* Meta Ads */
.ads-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.ads-acc { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 14px; margin-bottom: 12px; }
.ads-acc-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ads-acc-h small { color: var(--muted); }
.ad-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ad-kpi { padding: 10px; border-radius: 11px; background: var(--panel2); display: flex; flex-direction: column; gap: 2px; }
.ad-kpi small { color: var(--muted); font-size: 11px; }
.ad-kpi b { font-size: 17px; }
.ad-kpi em { font-style: normal; font-size: 11px; color: var(--muted); }
.table-wrap { overflow: auto; }
.ads-t td small { color: var(--muted); }
.acc-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }

/* Lista de flujos */
.flow-row { cursor: pointer; }
.flow-row .status-dot { cursor: pointer; }

@media (max-width: 700px) {
  .ig-measure, .ai-grid { grid-template-columns: 1fr; }
  .ms-grid { grid-template-columns: 1fr 1fr; }
  .ai-included { grid-row: auto; }
  .ai-models { grid-template-columns: 1fr; }
}

/* IA de fábrica y motor activo */
.ai-now { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: linear-gradient(90deg, rgba(20,184,166,.14), rgba(34,197,94,.06)); border: 1px solid rgba(20,184,166,.35); }
.ai-now .ic { color: #2dd4bf; }
.ai-now small { color: var(--muted); margin-left: auto; font-size: 11.5px; }
.ai-now code { font-size: 11px; }
.ai-factory { border: 1.5px solid rgba(20,184,166,.45); background: linear-gradient(160deg, rgba(20,184,166,.12), var(--panel) 60%); }
.ai-factory.active { box-shadow: 0 0 0 1px rgba(20,184,166,.45), 0 10px 28px rgba(20,184,166,.14); }

/* ===== Equipo ===== */
.team-quota { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; }
.team-quota small { color: var(--muted); font-size: 12px; }
.tq-bar { height: 7px; border-radius: 6px; background: var(--panel2); overflow: hidden; }
.tq-bar i { display: block; height: 100%; background: linear-gradient(90deg, #22d3ee, #a855f7); }
.team-form { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 10px; align-items: end; }
.team-form .field { margin: 0; }
.team-form.off { opacity: .55; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 14px; }
.role-card { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--border); }
.role-card > span { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.role-card b { display: block; font-size: 13px; }
.role-card small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.invite-out { margin-top: 14px; padding: 14px; border-radius: 12px; border: 1px solid rgba(34,197,94,.4); background: rgba(34,197,94,.08); display: flex; flex-direction: column; gap: 6px; }
.invite-out b { display: flex; align-items: center; gap: 6px; color: #4ade80; }
.invite-out small { color: var(--muted); }
.team-list { display: flex; flex-direction: column; gap: 8px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel2); flex-wrap: wrap; }
.team-row .grow { min-width: 160px; }
.team-row b { display: block; font-size: 13.5px; }
.team-row small { color: var(--muted); font-size: 11.5px; }
.team-row select { width: auto; }
.tr-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: var(--muted); }
.ws-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid rgba(45,212,191,.5); box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: 12.5px; backdrop-filter: blur(8px); max-width: calc(100vw - 24px); }
.ws-bar .ic { color: #2dd4bf; }
.ws-list { display: flex; flex-direction: column; gap: 8px; }
.ws-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.ws-item.on, .ws-item:hover { border-color: var(--accent); }
.ws-item div { flex: 1; }
.ws-item b { display: block; }
.ws-item small { color: var(--muted); }
/* Colaboradores de solo lectura: se ocultan las acciones de edición (el servidor también las bloquea) */
body.ro .page-head .btn-grad, body.ro .page-head .btn-primary, body.ro #saveSettings, body.ro .ed-fab, body.ro #edSave, body.ro #edRename, body.ro [data-menu] { display: none !important; }
.invite-note { margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; background: rgba(45,212,191,.12); border: 1px solid rgba(45,212,191,.35); font-size: 12.5px; }
@media (max-width: 700px) { .team-form { grid-template-columns: 1fr; } }

/* Agente IA: tolerancia de montos por camino */
.route .tol { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.route .tol .input { width: 76px; padding: 4px 8px; }
.master-card textarea { font-size: 12.5px; line-height: 1.5; }

/* ===== Sonido de venta ===== */
.snd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 12px 0; }
.snd-opt { position: relative; display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; transition: border-color .15s, transform .15s; }
.snd-opt:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.snd-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.snd-opt b { font-size: 13.5px; }
.snd-opt small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.snd-opt em { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.snd-wave { display: flex; align-items: flex-end; gap: 3px; height: 18px; margin-bottom: 4px; }
.snd-wave i { width: 4px; border-radius: 2px; background: var(--accent); opacity: .55; height: 30%; }
.snd-wave i:nth-child(2) { height: 70%; } .snd-wave i:nth-child(3) { height: 100%; } .snd-wave i:nth-child(4) { height: 55%; } .snd-wave i:nth-child(5) { height: 35%; }
.snd-opt.playing .snd-wave i { animation: sndBar .5s ease-in-out 3 alternate; opacity: 1; }
.snd-opt.playing .snd-wave i:nth-child(2n) { animation-delay: .12s; }
@keyframes sndBar { from { transform: scaleY(.35); } to { transform: scaleY(1.15); } }
.snd-vol input[type=range] { width: 100%; accent-color: var(--accent); }

/* ===== Planeta 3D ===== */
.globe-wrap.globe3d { height: 380px; overflow: hidden; border-radius: 18px; background: radial-gradient(circle at 50% 50%, rgba(30,58,138,.18), transparent 70%); }
.globe-wrap.globe3d canvas { cursor: grab; touch-action: none; }
.globe-wrap.globe3d.grabbing canvas { cursor: grabbing; }
.globe-pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.gpin { position: absolute; left: 0; top: 0; will-change: transform, opacity; transition: opacity .25s; }
.gpin i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 10px #34d399, 0 0 22px rgba(52,211,153,.7); }
.gpin.home i { background: #38bdf8; box-shadow: 0 0 12px #38bdf8, 0 0 26px rgba(56,189,248,.8); animation: gHome 1.8s ease-out infinite; }
@keyframes gHome { 0% { box-shadow: 0 0 0 0 rgba(56,189,248,.8), 0 0 12px #38bdf8; } 100% { box-shadow: 0 0 0 16px rgba(56,189,248,0), 0 0 12px #38bdf8; } }
.gpin span { position: absolute; left: 10px; top: -30px; display: grid; grid-template-columns: auto auto; column-gap: 6px; align-items: center; padding: 4px 8px 4px 5px; border-radius: 9px; white-space: nowrap;
  background: rgba(8,12,28,.78); border: 1px solid rgba(52,211,153,.45); box-shadow: 0 6px 18px rgba(0,0,0,.45); backdrop-filter: blur(6px); animation: gFloat 3.2s ease-in-out infinite; }
.gpin.home span { border-color: rgba(56,189,248,.6); }
.gpin img { grid-row: span 2; width: 22px; height: 16px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.gpin b { font-size: 11px; color: #ecfeff; line-height: 1.1; }
.gpin small { font-size: 10px; color: #a7f3d0; line-height: 1.1; }
.gpin.home small { color: #bae6fd; }
@keyframes gFloat { 50% { transform: translateY(-3px); } }
.globe-reset { position: absolute; right: 10px; bottom: 10px; z-index: 2; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: #e0f2fe;
  background: rgba(8,12,28,.7); border: 1px solid rgba(148,163,184,.35); backdrop-filter: blur(6px); }
.globe-reset:hover { border-color: #38bdf8; }
.globe-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-size: 11px; color: rgba(226,232,240,.7); padding: 3px 9px; border-radius: 99px; background: rgba(8,12,28,.55); pointer-events: none; transition: opacity .6s; }
.globe-hint.gone { opacity: 0; }
