/* Layout compartido de los mockups. CSS puro sobre los tokens de tokens.css.
   Namespacing por componente; nada de Tailwind.
   Los estilos alternativos (premium moderno y vintage premium) viven en
   styles.css y se activan con <html data-ui="...">. */
@import url("styles.css");

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; cursor: pointer; }
/* hidden gana siempre: si no, un display:flex de componente lo anula */
[hidden] { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }
.ic { width: 18px; height: 18px; flex: none; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar.mini { grid-template-columns: 72px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
}
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 800;
}
.brand small { display: block; font-weight: 500; color: var(--muted-foreground); font-size: 11px; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 14px 10px 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground);
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 11px; border-radius: 10px; color: var(--muted-foreground);
  font-weight: 500; position: relative;
}
.nav-item:hover { background: var(--muted); color: var(--foreground); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active .ic { color: var(--primary); }
.nav-item .badge-count {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px;
}
.nav-item.active .badge-count { background: var(--primary); }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); }
.client-sidebar-foot { border-top: 0; }
.client-space-link { display: flex; align-items: center; gap: 7px; padding: 12px; font-size: 11px; color: var(--muted-foreground); white-space: nowrap; }
.client-space-link:hover { color: var(--foreground); }
.client-space-link:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
.client-sidebar-foot .user-chip { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding-top: 16px; }
@media (max-width: 900px) {
  [data-premium] .client-sidebar-foot { display: flex; align-items: center; gap: 5px; }
  .client-space-link { padding: 8px 4px; font-size: 10px; min-height: 40px; }
  .client-sidebar-foot .user-chip { border-top: 0; padding: 4px; }
}
.view-switch { margin-bottom: 10px; }
.view-switch .seg { display: flex; width: 100%; }
.view-switch .seg button { flex: 1; font-size: 11px; padding: 0 4px; height: 30px; white-space: nowrap; letter-spacing: -0.01em; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px;
}
.user-chip:hover { background: var(--muted); }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 82%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted-foreground);
  display: grid; place-items: center; position: relative;
}
.icon-btn:hover { color: var(--foreground); border-color: var(--border-strong); }
.icon-btn .dot-alert {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--destructive); border: 2px solid var(--card);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.searchbox {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  color: var(--muted-foreground); min-width: 240px;
}
.searchbox input { border: 0; background: transparent; outline: none; color: var(--foreground); width: 100%; font-size: 13px; }

/* Switcher de contexto (agencia) */
.ctx-switch {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px;
  border: 1px solid var(--primary); background: var(--primary-soft);
  border-radius: 10px; color: var(--primary); font-weight: 600; font-size: 13px;
}
.ctx-switch .ic { color: var(--primary); }

/* ---------- Page ---------- */
.page { padding: 24px; max-width: 1240px; width: 100%; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head .spacer { flex: 1; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--muted-foreground); margin-top: 3px; font-size: 13.5px; }
.section-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted-foreground); margin: 4px 0 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--card);
  color: var(--foreground); font-weight: 550; font-size: 13.5px; white-space: nowrap;
}
.btn:hover { background: var(--muted); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }
.btn-danger { background: var(--destructive); border-color: var(--destructive); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--destructive) 86%, #000); border-color: color-mix(in srgb, var(--destructive) 86%, #000); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--muted-foreground); }
.input, .select, textarea.input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--card); color: var(--foreground); font-size: 14px; outline: none; width: 100%;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.hint { font-size: 12px; color: var(--muted-foreground); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--sh-card); }
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 16px; font-weight: 650; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-sidebar { grid-template-columns: 1fr 320px; align-items: start; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.gap-6 { gap: 6px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* ---------- Metric cards ---------- */
.metric { padding: 18px; }
.metric .mlabel { color: var(--muted-foreground); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.metric .mval { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; margin-top: 8px; }
.metric .mfoot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 12.5px; padding: 2px 7px; border-radius: 999px; }
.delta.up { color: var(--success-strong); background: var(--success-soft); }
.delta.down { color: var(--destructive-strong); background: var(--destructive-soft); }
.spark { height: 34px; width: 100%; margin-top: 12px; color: var(--primary); }
.info-i { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--subtle); color: var(--muted-foreground); display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; cursor: help; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--muted); color: var(--muted-foreground);
}
/* Punto de estado: estático a propósito. No animar: nada de esto es dato en vivo. */
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { background: var(--success-soft); color: var(--success-strong); }
.badge.warning { background: var(--warning-soft); color: var(--warning-strong); }
.badge.danger { background: var(--destructive-soft); color: var(--destructive-strong); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.accent { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
/* plataformas */
.plat { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 650; }
.plat .pmark { width: 15px; height: 15px; border-radius: 4px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; }
.plat.meta .pmark { background: var(--plat-meta); }
.plat.google .pmark { background: var(--plat-google); }
.plat.tiktok .pmark { background: var(--plat-tiktok); color: #fff; }
.plat { background: var(--muted); color: var(--foreground); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted-foreground); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td, .table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--muted); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tree-toggle { color: var(--subtle); display: inline-flex; width: 16px; }
.indent-1 { padding-left: 30px; }
.indent-2 { padding-left: 52px; }
.cell-strong { font-weight: 600; }
.cell-sub { color: var(--muted-foreground); font-size: 12px; }

/* ---------- Segmented / pills ---------- */
.seg { display: inline-flex; padding: 3px; background: var(--muted); border-radius: 10px; gap: 2px; }
.seg button { height: 30px; padding: 0 13px; border: 0; background: transparent; border-radius: 8px; color: var(--muted-foreground); font-weight: 550; font-size: 13px; }
.seg button.active { background: var(--card); color: var(--foreground); box-shadow: var(--sh-card); }

/* ---------- Tabs ---------- */
.tabs-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
[data-tab] { padding: 10px 14px; border: 0; background: transparent; color: var(--muted-foreground); font-weight: 550; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
[data-tab].active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
[data-tab]:hover { color: var(--foreground); }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 60px); }
.thread { flex: 1; overflow-y: auto; padding: 26px 0; }
.thread-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; padding: 0 20px; }
.msg { display: flex; gap: 12px; max-width: 100%; }
.msg .bubble { padding: 12px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.55; }
.msg-agent .bubble { background: var(--card); border: 1px solid var(--border); border-top-left-radius: 4px; }
.msg-user { flex-direction: row-reverse; }
.msg-user .bubble { background: var(--primary); color: var(--primary-foreground); border-top-right-radius: 4px; }
.agent-av { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; background: var(--dep-acquisition); }
.msg .meta { font-size: 11.5px; color: var(--muted-foreground); margin-bottom: 5px; font-weight: 500; }
.composer { border-top: 1px solid var(--border); padding: 14px 20px; background: var(--surface-2); }
.composer-inner { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; padding: 8px 8px 8px 14px; }
.composer-inner textarea { flex: 1; border: 0; background: transparent; outline: none; resize: none; color: var(--foreground); font-size: 14.5px; padding: 6px 0; max-height: 120px; }
.typing { display: inline-flex; gap: 3px; }
/* Tres puntos estáticos: en un mockup nadie está escribiendo de verdad */
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--subtle); opacity: .45; }
.typing span:nth-child(2){ opacity:.7 } .typing span:nth-child(3){ opacity:1 }

/* Approval / embedded cards en el chat */
.approval { border: 1px solid var(--primary); border-radius: 14px; overflow: hidden; margin-top: 6px; max-width: 560px; }
.approval-head { display: flex; align-items: center; gap: 9px; padding: 12px 15px; background: var(--primary-soft); color: var(--primary); font-weight: 650; font-size: 14px; }
.approval-body { padding: 15px; }
.approval-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.approval-row:last-of-type { border-bottom: 0; }
.approval-foot { display: flex; gap: 10px; padding: 0 15px 15px; }
.embed-card { border: 1px solid var(--border); border-radius: 14px; padding: 15px; margin-top: 6px; max-width: 560px; background: var(--surface-2); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 288px; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 650; font-size: 13.5px; position: sticky; top: 0; }
.kcol-head .count { color: var(--muted-foreground); font-weight: 600; }
.kcol-head .kdot { width: 8px; height: 8px; border-radius: 50%; }
.kcards { padding: 0 10px 12px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.kcard { background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 12px; box-shadow: var(--sh-card); }
.kcard h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.kcard .kmeta { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted-foreground); font-size: 12px; }

/* ---------- Agents grid ---------- */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.agent-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--sh-card); }
.agent-card:hover { border-color: var(--border-strong); }
.agent-av-lg { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 750; font-size: 16px; }
.dep-acq { background: var(--dep-acquisition); }
.dep-conv { background: var(--dep-conversion); }
.dep-ctrl { background: var(--dep-control); }
.dep-text-acq { color: var(--dep-acquisition); }
.dep-text-conv { color: var(--dep-conversion); }
.dep-text-ctrl { color: var(--dep-control); }
.dep-brand { background: var(--dep-brand); }
.dep-text-brand { color: var(--dep-brand); }

/* ---------- Empty & skeleton ---------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted-foreground); }
.empty .eicon { width: 52px; height: 52px; border-radius: 14px; background: var(--muted); display: grid; place-items: center; margin: 0 auto 14px; color: var(--subtle); }
.empty h3 { font-size: 16px; font-weight: 650; color: var(--foreground); margin-bottom: 5px; }
.skel { background: linear-gradient(90deg, var(--muted) 25%, var(--border) 37%, var(--muted) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:0 0} }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.cal .cal-h { padding: 10px; font-size: 12px; font-weight: 650; color: var(--muted-foreground); text-transform: uppercase; text-align: center; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .cal-d { min-height: 104px; min-width: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px; font-size: 12px; overflow: hidden; }
.cal.cal-week .cal-d { min-height: 220px; }
.cal-list { display: flex; flex-direction: column; gap: 10px; }
.cal-list .clrow { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.cal-list .cldate { flex: none; width: 52px; text-align: center; }
.cal-list .cldate .dd { font-size: 19px; font-weight: 750; line-height: 1.1; }
.cal-list .cldate .mm { font-size: 11px; color: var(--muted-foreground); text-transform: uppercase; font-weight: 650; }
.cal-list .clbody { flex: 1; min-width: 0; }
.cal-list .cltitle { font-weight: 600; font-size: 13.5px; }
.cal .cal-d .dnum { color: var(--muted-foreground); font-weight: 600; }
.cal .cal-d.out .dnum { color: var(--subtle); opacity: .5; }
.cal-ev { margin-top: 5px; padding: 3px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 550; background: var(--primary-soft); color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.conv { background: color-mix(in srgb, var(--dep-conversion) 16%, transparent); color: var(--dep-conversion); }
.cal-ev.ctrl { background: var(--warning-soft); color: var(--warning-strong); }

/* ---------- Diff (editor de prompts) ---------- */
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; }
.diff .dcol { border-right: 1px solid var(--border); }
.diff .dcol:last-child { border-right: 0; }
.diff .dhead { padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-family: "Inter", sans-serif; font-weight: 650; font-size: 12.5px; }
.diff .dline { padding: 2px 12px; white-space: pre-wrap; }
.diff .dline.add { background: var(--success-soft); }
.diff .dline.del { background: var(--destructive-soft); }

/* ---------- Assumption badges (onboarding/perfil) ---------- */
.assump { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px dashed var(--warning); color: var(--warning-strong); background: var(--warning-soft); }
.assump.ok { border-style: solid; border-color: var(--success); color: var(--success-strong); background: var(--success-soft); }

/* ---------- Auth / onboarding split ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.split .aside { background: linear-gradient(150deg, var(--primary), var(--accent)); color: #fff; padding: 48px; display: flex; flex-direction: column; }
.split .aside .quote { margin-top: auto; font-size: 18px; font-weight: 600; line-height: 1.5; }
.split .form-side { display: grid; place-items: center; padding: 32px; }
.split .form-box { width: 100%; max-width: 400px; }

/* ---------- Portal ---------- */
.portal { min-height: 100vh; display: grid; place-items: center; padding: 40px; }
.portal-inner { max-width: 1000px; width: 100%; text-align: center; }
.portal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 34px; text-align: left; }
.portal-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--sh-card); display: flex; flex-direction: column; gap: 12px; }
.portal-card:hover { border-color: var(--primary); box-shadow: var(--sh-pop); transform: translateY(-2px); transition: .16s; }
.portal-card .picon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.portal-card ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted-foreground); font-size: 13px; }
.portal-card ul li { margin: 3px 0; }

/* ---------- Vista simple: shell de 3 columnas con chat del CEO fijo a la derecha ---------- */
.app-simple { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.cochat { border-left: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.cochat-head { display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.cochat-head .ceo-name { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; }
.cochat-head .ceo-role { font-size: 12px; color: var(--muted-foreground); }
.cochat-body { flex: 1; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 15px; }
.cochat-body .msg { max-width: 100%; }
.cochat-body .msg .bubble { font-size: 13.5px; padding: 10px 13px; line-height: 1.5; }
.cochat-body .msg .meta { font-size: 11px; }
.cochat-body .agent-av { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
.cochat-foot { border-top: 1px solid var(--border); padding: 12px 14px; background: var(--surface-2); }
.cochat-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cochat-suggest button { font-size: 12px; padding: 5px 10px; border: 1px solid var(--border-strong); background: var(--card); border-radius: 999px; color: var(--muted-foreground); }
.cochat-suggest button:hover { border-color: var(--primary); color: var(--primary); }
.cochat-composer { display: flex; align-items: flex-end; gap: 8px; background: var(--card); border: 1px solid var(--border-strong); border-radius: 12px; padding: 6px 6px 6px 12px; }
.cochat-composer textarea { flex: 1; border: 0; background: transparent; outline: none; resize: none; color: var(--foreground); font-size: 13.5px; padding: 5px 0; max-height: 96px; }

/* Bloques editables tipo ficha (Mi negocio) */
.field-row { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.field-row:last-child { border-bottom: 0; }
.field-row .k { width: 168px; flex: none; color: var(--muted-foreground); font-size: 13px; }
.field-row .v { font-weight: 550; }
.bullet-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bullet-list li { display: flex; gap: 10px; align-items: flex-start; }
.bullet-list li .bi { width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.persona { display: flex; gap: 13px; align-items: flex-start; }
.persona .pav { width: 46px; height: 46px; border-radius: 12px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; }

/* ---------- Redes sociales (únicas plataformas: Facebook, Instagram, WhatsApp, TikTok) ---------- */
.plat.facebook .pmark { background: #1877f2; }
.plat.instagram .pmark { background: radial-gradient(circle at 30% 108%, #fdf497 0%, #fd5949 45%, #d6249f 70%, #285aeb 100%); }
.plat.whatsapp .pmark { background: #25d366; }
.plat.tiktok .pmark { background: #010101; }

/* ---------- Chat del CEO: ocultar / reabrir ---------- */
.cochat-toggle { margin-left: 4px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); display: grid; place-items: center; flex: none; }
.cochat-toggle:hover { color: var(--foreground); border-color: var(--border-strong); }
.cochat-off .app-simple { grid-template-columns: 244px 1fr; }
.cochat-off .cochat { display: none; }
.cochat-fab { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: none; align-items: center; gap: 10px; height: 52px; padding: 0 18px 0 8px; border-radius: 999px; border: 0; background: var(--card); box-shadow: var(--sh-pop); color: var(--foreground); font-weight: 600; font-size: 13.5px; }
.cochat-fab:hover { background: var(--muted); }
.cochat-fab .agent-av { width: 36px; height: 36px; border-radius: 50%; }
.cochat-off .cochat-fab { display: flex; }

/* ---------- Calificación numérica (Mis Redes Sociales) ---------- */
.net-score { display: flex; align-items: baseline; justify-content: center; gap: 5px; margin: 6px 0 2px; }
.net-score .ns-val { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.net-score .ns-max { font-size: 12.5px; color: var(--muted-foreground); font-weight: 600; }
.net-score.success .ns-val { color: var(--success-strong); }
.net-score.warning .ns-val { color: var(--warning-strong); }
.net-score.danger .ns-val { color: var(--destructive-strong); }
.net-metrics { display: flex; gap: 8px; margin-top: 12px; }
.net-metrics .nm { flex: 1; background: var(--muted); border-radius: 10px; padding: 9px 11px; }
.net-metrics .nm .k { font-size: 11px; color: var(--muted-foreground); }
.net-metrics .nm .v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.net-detail { margin-top: 12px; font-size: 13px; color: var(--muted-foreground); line-height: 1.5; }
.net-card { display: flex; flex-direction: column; }
.net-connect { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.net-connect .btn { flex: none; }
.integration-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.integration-row:last-child { border-bottom: 0; }
.integration-row .net-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; flex: none; }

/* El logo llena el recuadro, centrado, y blanco sobre el color de cada marca (claro y oscuro) */
.net-ico { color: #fff; display: grid; place-items: center; }
.net-ico svg { width: 66%; height: 66%; display: block; }

/* ---------- Anuncios como publicación de red social (Mis anuncios): 4 por fila ---------- */
.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---- Breadcrumb: jerarquia dentro de la pagina (estrategia > campana > anuncio) ---- */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--muted-foreground); margin-bottom: 12px; }
.crumbs a { color: var(--muted-foreground); text-decoration: none; padding: 3px 7px; border-radius: 8px; }
.crumbs a:hover { background: var(--muted); color: var(--foreground); }
.crumbs .sep { color: var(--subtle); }
.crumbs .cur { color: var(--foreground); font-weight: 600; padding: 3px 7px; }
.table tr.row-link { cursor: pointer; }
.select.select-sm { height: 34px; padding: 0 30px 0 11px; font-size: 13px; width: auto; }
.ad-feed { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ad-post { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: var(--sh-card); display: flex; flex-direction: column; }
.ad-post-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; }
.ad-post-head .pav { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.ad-post-head .pav svg { width: 58%; height: 58%; }
.ad-post-head .who { flex: 1; min-width: 0; }
.ad-post-head .handle { font-weight: 650; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-post-head .sponsored { font-size: 9.5px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-post-head .sponsored.badge-pay { color: var(--primary); font-weight: 650; }
.ad-post-head .sponsored.badge-organic { color: var(--success-strong); font-weight: 650; }
.ad-post-head .badge { font-size: 10px; height: 18px; padding: 0 6px; flex: none; }
.ad-post-media { position: relative; width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 14px; text-align: center; color: #fff; }
.ad-format { position: absolute; top: 8px; right: 8px; background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 999px; letter-spacing: 0.01em; }
.ad-post-media .cap { font-weight: 700; font-size: 13px; line-height: 1.3; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.28); }
.ad-post-actions { display: flex; align-items: center; gap: 9px; padding: 8px 10px 0; color: var(--foreground); }
.ad-post-actions svg { width: 15px; height: 15px; }
.ad-post-actions .spacer { flex: 1; }
.ad-post-caption { padding: 6px 10px 2px; font-size: 11px; line-height: 1.4; }
.ad-post-caption b { font-weight: 650; }
.ad-post-stats { display: flex; gap: 12px; padding: 8px 10px 0; margin: 4px 10px 0; border-top: 1px solid var(--border); }
.ad-post-stats .cell-sub { font-size: 10px; }
.ad-post-stats .tnum { font-size: 12.5px !important; }
.ad-post-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 10px; }
.ad-post-foot .cell-sub { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-post-foot .btn { flex: none; }
@media (max-width: 1100px) { .ad-feed { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Modal genérico ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--sh-pop); width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head .net-ico { width: 34px; height: 34px; border-radius: 9px; }
.modal-head h3 { font-size: 16px; font-weight: 650; }
.modal-close { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); display: grid; place-items: center; flex: none; }
.modal-close:hover { color: var(--foreground); border-color: var(--border-strong); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); justify-content: flex-end; }
body.modal-open { overflow: hidden; }

/* ---------- Pantalla de evaluación (Inicio) ---------- */
.eval-hero { max-width: 540px; margin: 5vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.eval-hero .eicon { width: 72px; height: 72px; border-radius: 20px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: grid; place-items: center; }
.eval-hero h2 { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.eval-hero .eval-lead { color: var(--muted-foreground); font-size: 15px; line-height: 1.55; }
.eval-topics { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.eval-topics .badge { font-weight: 550; }
.eval-progress { width: 100%; height: 10px; border-radius: 99px; background: var(--muted); overflow: hidden; }
.eval-progress > div { height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------- Onboarding: asistente de pasos (Inicio) ---------- */
.onboard { max-width: 680px; margin: 4vh auto 0; }
.wiz-steps { display: flex; gap: 9px; margin: 16px 0 20px; }
.wiz-step { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; font-size: 12.5px; font-weight: 550; color: var(--muted-foreground); background: var(--surface-2); }
.wiz-step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--muted); color: var(--muted-foreground); flex: none; }
.wiz-step.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.wiz-step.active .n { background: var(--primary); color: #fff; }
.wiz-step.done { color: var(--success-strong); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.wiz-step.done .n { background: var(--success); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .app-simple { grid-template-columns: 244px 1fr; }
  .cochat { display: none; }
}
@media (max-width: 900px) {
  .app, .app-simple { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid-2, .grid-3, .grid-4, .grid-sidebar, .portal-grid, .split, .diff { grid-template-columns: 1fr; }
  .field-row .k { width: 120px; }
}

/* ---- Organigrama de agentes (web-client/agents.html) ---- */
.org-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .org-layout { grid-template-columns: 1fr; } }
.org { position: relative; padding: 4px 0 8px; }
.org-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.org-ceo { display: flex; justify-content: center; margin-bottom: 46px; position: relative; z-index: 1; }
.org-ceo .org-node { min-width: 280px; }
.org-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; align-items: start; position: relative; z-index: 1; }
.org-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.org-dep { padding: 9px 12px; border-radius: 10px; color: #fff; font-weight: 650; font-size: 13px; line-height: 1.2; margin-bottom: 4px; }
.org-dep small { display: block; font-weight: 500; font-size: 11.5px; opacity: .88; margin-top: 2px; }
.org-node { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 10px; min-width: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--sh-card); cursor: pointer;
  transition: opacity .15s, border-color .15s, box-shadow .15s; }
.org-node:hover { border-color: var(--border-strong); }
.org-node.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.org-node.related { border-color: var(--border-strong); }
.org.focus .org-node:not(.selected):not(.related) { opacity: .3; }
.org-node .agent-av { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.org-node .cell-strong { font-size: 13px; line-height: 1.2; }
.org-node .cell-sub { font-size: 11.5px; line-height: 1.25; }
.org-node .org-link { margin-left: auto; color: var(--subtle); opacity: 0; transition: opacity .15s; flex: none; }
.org-node:hover .org-link, .org-node.selected .org-link { opacity: 1; }
.org-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.3; opacity: .45; transition: opacity .15s, stroke .15s; }
.org-edge.tree { stroke-width: 1.5; opacity: .9; }
.org.focus .org-edge:not(.out):not(.in):not(.tree):not(.on) { opacity: .06; }
.org-edge.flow { stroke-dasharray: 4 3; }
.org-edge.rep { stroke: var(--foreground); stroke-width: 1.6; opacity: .55; }
.org-edge.rep.on { opacity: 1; stroke-width: 2.2; }
.org-edge.out { stroke: var(--primary); stroke-width: 2; opacity: 1; }
.org-edge.in { stroke: var(--dep-control); stroke-width: 2; opacity: 1; }
.org-panel { position: sticky; top: 16px; }
.org-panel .card-body { display: flex; flex-direction: column; gap: 14px; }
.org-legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--muted-foreground); }
.org-legend .ln { display: inline-block; width: 26px; border-top: 2px solid var(--border-strong); vertical-align: middle; margin-right: 8px; }
.org-legend .ln.dash { border-top-style: dashed; }
.org-legend .ln.out { border-color: var(--primary); }
.org-legend .ln.in { border-color: var(--dep-control); }
.org-flow { display: flex; flex-direction: column; gap: 8px; }
.org-flow a { display: flex; gap: 10px; align-items: flex-start; }
.org-flow .agent-av { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.org-flow .cell-sub { font-size: 12px; }

/* ---- Edición en la pestaña "Su trabajo" (web-client/agent-detail.html) ---- */
.edit-row { display: flex; gap: 8px; align-items: center; }
.edit-row .input, .edit-row .select { height: 34px; font-size: 13px; }
.edit-row .btn-sm { height: 34px; padding: 0 8px; flex: none; }
.edit-row a { display: flex; gap: 10px; align-items: center; }
.edit-actions { display: flex; gap: 8px; margin-top: 4px; }
