/* ─── PowerUp Ops · Mission control · dark default ───────────────── */

:root {
  --bg:           #07090D;
  --bg-2:         #0B0E14;
  --panel:        #11151D;
  --panel-2:      #161B25;
  --panel-3:      #1C222E;
  --border:       #232936;
  --border-2:     #2E3543;
  --border-3:     #3A4151;

  --text:         #E8EAEE;
  --text-2:       #B5BAC4;
  --text-mute:    #7A818F;
  --text-faint:   #525864;
  --text-dim:     #3D424C;

  --red:          #F0535C;
  --red-soft:     #C8424A;
  --red-dim:      rgba(240,83,92,0.13);
  --red-border:   rgba(240,83,92,0.35);

  --amber:        #E8A848;
  --amber-soft:   #D08C30;
  --amber-dim:    rgba(232,168,72,0.13);
  --amber-border: rgba(232,168,72,0.35);

  --purple:       #8B5CF6;
  --purple-soft:  #7B4AE3;
  --purple-dim:   rgba(139,92,246,0.14);
  --purple-border:rgba(139,92,246,0.4);

  --green:        #4DAB6D;
  --green-soft:   #3D9A5D;
  --green-dim:    rgba(77,171,109,0.13);
  --green-border: rgba(77,171,109,0.35);

  --blue:         #4F8EF7;
  --blue-dim:     rgba(79,142,247,0.12);
  --blue-border:  rgba(79,142,247,0.32);

  --st-registered: #7A818F;
  --st-onboarding: #E8A848;
  --st-activated:  #4DAB6D;
  --st-at_risk:    #F0535C;
  --st-churned:    #5A5A5A;

  --shadow-md: 0 8px 24px -12px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.02) inset;
  --shadow-sm: 0 1px 0 rgba(255,255,255,0.02) inset, 0 1px 2px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse 1200px 600px at 50% -200px, rgba(79,142,247,0.04), transparent 60%),
    radial-gradient(ellipse 800px 400px at 0% 100%, rgba(139,92,246,0.03), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  font-feature-settings: 'ss01', 'ss02', 'cv11';
  letter-spacing: -0.005em;
}

.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-feature-settings: 'zero', 'ss01'; }
.eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
}

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

/* ─── App shell ──────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

aside.nav {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 80%);
  padding: 20px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 8px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background:
    conic-gradient(from 220deg, var(--amber), var(--red), var(--purple), var(--blue), var(--green), var(--amber));
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute; inset: 3px;
  background: var(--bg);
  border-radius: 3px;
}
.brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.018em;
}
.brand-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-left: auto;
}

.nav-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 10px 6px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  width: 3px; height: 16px;
  background: var(--blue);
  border-radius: 2px;
  margin-left: -13px;
}
.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-link .count {
  margin-left: auto;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  padding: 1px 6px;
  background: var(--bg-2);
  border-radius: 3px;
  border: 1px solid var(--border);
}
.nav-link.active .count {
  background: var(--blue-dim);
  color: var(--blue);
  border-color: var(--blue-border);
}

.nav-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pack-status {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pack-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--green-dim);
}

/* ─── Main ───────────────────────────────────────────────────────── */
main.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.origin-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 22px;
  font-size: 11.5px;
  background: linear-gradient(90deg, rgba(77,171,109,0.05), rgba(79,142,247,0.05));
  border-bottom: 1px solid var(--border);
  color: var(--text-mute);
}
.origin-banner .ob-tag {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid;
}
.origin-banner .ob-tag.platform {
  color: var(--green);
  background: var(--green-dim);
  border-color: var(--green-border);
}
.origin-banner .ob-tag.chat {
  color: var(--blue);
  background: var(--blue-dim);
  border-color: var(--blue-border);
}
.origin-banner .ob-label { color: var(--text-2); }
.origin-banner .ob-sep   { color: var(--text-faint); margin: 0 4px; }
.origin-banner .ob-snap  { font-size: 10.5px; color: var(--text-faint); }

@media (max-width: 920px) {
  .origin-banner { font-size: 10.5px; padding: 8px 14px; flex-wrap: wrap; gap: 6px; }
  .origin-banner .ob-snap { margin-left: 0; width: 100%; }
}

.global-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.gkpi {
  padding: 14px 22px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.gkpi:last-child { border-right: 0; }
.gkpi .label {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.gkpi .value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.028em;
  font-variant-numeric: tabular-nums;
}
.gkpi.warn .value { color: var(--amber); }
.gkpi.bad .value { color: var(--red); }
.gkpi .sub {
  font-size: 11px;
  color: var(--text-mute);
}

.view {
  padding: 28px 32px 64px;
  max-width: 1400px;
  width: 100%;
}

.page-head {
  margin-bottom: 22px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
}
.page-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.028em;
  margin: 4px 0 0;
}
.page-sub {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 4px;
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab {
  padding: 8px 16px 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex; align-items: center; gap: 7px;
}
.tab .count {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  padding: 1px 6px;
  background: var(--panel-2);
  border-radius: 3px;
  color: var(--text-mute);
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--blue); }
.tab.active .count { background: var(--blue-dim); color: var(--blue); }

/* ─── Exception table (Torre) ────────────────────────────────────── */
.ex-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.ex-table thead th {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
  font-weight: 500;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}
.ex-table tbody tr {
  cursor: pointer;
  transition: background .1s;
}
.ex-table tbody tr:hover { background: var(--panel-2); }
.ex-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}
.ex-table tbody tr:last-child td { border-bottom: 0; }

.pri {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 3px;
}
.pri::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.pri.urgente { color: var(--red); background: var(--red-dim); border: 1px solid var(--red-border); }
.pri.urgente::before { background: var(--red); box-shadow: 0 0 6px var(--red); animation: pulse 1.8s ease-in-out infinite; }
.pri.alta { color: var(--amber); background: var(--amber-dim); border: 1px solid var(--amber-border); }
.pri.alta::before { background: var(--amber); }
.pri.media { color: var(--blue); background: var(--blue-dim); border: 1px solid var(--blue-border); }
.pri.media::before { background: var(--blue); }
.pri.baja { color: var(--text-mute); background: var(--panel-2); border: 1px solid var(--border); }
.pri.baja::before { background: var(--text-mute); }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .35; }
}

.rest-cell { font-weight: 500; }
.rest-cell .place { font-size: 11px; color: var(--text-faint); margin-top: 1px; font-family: 'Geist Mono', monospace; }

.exc-cell { color: var(--text-2); }
.exc-cell .exc-label {
  font-weight: 500;
  color: var(--text);
  font-size: 13.5px;
}
.exc-cell .exc-sublabel {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-top: 2px;
}

/* Trial badge (UI Glossary §5) */
.trial-badge {
  display: inline-flex; align-items: center;
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  border: 1px solid;
  letter-spacing: -0.002em;
}
.trial-badge.t-ok      { color: var(--green); background: var(--green-dim); border-color: var(--green-border); }
.trial-badge.t-warn    { color: var(--amber); background: var(--amber-dim); border-color: var(--amber-border); }
.trial-badge.t-urgent  { color: #E07A2C; background: rgba(224,122,44,0.13); border-color: rgba(224,122,44,0.4); }
.trial-badge.t-expired { color: var(--red); background: var(--red-dim); border-color: var(--red-border); }
.trial-badge.t-pro     { color: var(--purple); background: var(--purple-dim); border-color: var(--purple-border); }
.trial-badge.t-free    { color: var(--text-mute); background: var(--panel-2); border-color: var(--border); }

/* "simulado" chip en KPI header */
.sim-chip {
  display: inline-block;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  padding: 1px 5px;
  margin-left: 6px;
  border-radius: 2px;
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid var(--blue-border);
  vertical-align: middle;
}
.since-cell {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--text-mute);
  white-space: nowrap;
}
.action-cell {
  color: var(--text);
  font-size: 12.5px;
  font-style: italic;
}

.owner-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  font-family: 'Geist Mono', monospace;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid;
  letter-spacing: 0.04em;
}
.owner-chip.bot     { color: var(--text-mute); border-color: var(--border-2); background: var(--bg-2); }
.owner-chip.human   { color: var(--green); border-color: var(--green-border); background: var(--green-dim); }
.owner-chip.maestro { color: var(--purple); border-color: var(--purple-border); background: var(--purple-dim); }

/* ─── Dual status badge (for tables / inline) ────────────────────── */
.dual-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.dual-badge .platform-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  border-radius: 3px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text);
}
.dual-badge .platform-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
}
.platform-pill.registered  { background: rgba(122,129,143,0.12); color: var(--st-registered); border: 1px solid rgba(122,129,143,0.3); }
.platform-pill.registered::before { background: var(--st-registered); }
.platform-pill.onboarding  { background: var(--amber-dim); color: var(--amber); border: 1px solid var(--amber-border); }
.platform-pill.onboarding::before { background: var(--amber); }
.platform-pill.activated   { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-border); }
.platform-pill.activated::before { background: var(--green); }
.platform-pill.at_risk     { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-border); }
.platform-pill.at_risk::before { background: var(--red); }
.platform-pill.churned     { background: rgba(90,90,90,0.13); color: var(--text-mute); border: 1px solid var(--border-2); }
.platform-pill.churned::before { background: var(--st-churned); }

.dual-badge .divider {
  width: 1px; height: 11px; background: var(--border-2);
}

.chat-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-2);
  background: var(--panel-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chat-pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--text-faint); }
.chat-pill.unqualified::before        { background: var(--text-faint); }
.chat-pill.qualified::before          { background: var(--text-mute); }
.chat-pill.enrichment::before         { background: var(--blue); }
.chat-pill.playbook_active::before    { background: var(--blue); }
.chat-pill.micro_commit_pending::before { background: var(--amber); }
.chat-pill.stalled::before            { background: var(--red); }
.chat-pill.handoff_pending::before    { background: var(--purple); }
.chat-pill.human_owned::before        { background: var(--purple); }
.chat-pill.closed::before             { background: var(--text-dim); }

/* ─── SLA ────────────────────────────────────────────────────────── */
.sla {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
}
.sla.normal   { color: var(--text-mute); background: var(--panel-2); border: 1px solid var(--border); }
.sla.warn     { color: var(--amber); background: var(--amber-dim); border: 1px solid var(--amber-border); }
.sla.critical { color: var(--red); background: var(--red-dim); border: 1px solid var(--red-border); }
.sla.critical::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--red); animation: pulse 1.6s ease-in-out infinite; }
.sla.overdue {
  color: var(--bg);
  background: var(--red);
  border: 1px solid var(--red);
  font-weight: 600;
}

/* ─── Page primitives ───────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.012em;
}
.panel-sub { font-size: 11px; color: var(--text-mute); }

/* ─── /reports ──────────────────────────────────────────────────── */
.tickets-list { display: flex; flex-direction: column; gap: 8px; }
.ticket {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 13px 16px;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.ticket:hover { border-color: var(--border-3); transform: translateY(-1px); }
.ticket .row1 {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.ticket .tid {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
}
.ticket .hcode {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  background: var(--purple-dim);
  color: var(--purple);
  border-radius: 3px;
  border: 1px solid var(--purple-border);
  font-weight: 600;
}
.ticket .rest { font-weight: 500; font-size: 13.5px; }
.ticket .status {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  margin-left: auto;
}
.ticket .status.abierto { color: var(--amber); background: var(--amber-dim); border: 1px solid var(--amber-border); }
.ticket .status.ack { color: var(--blue); background: var(--blue-dim); border: 1px solid var(--blue-border); }
.ticket .status.resuelto { color: var(--green); background: var(--green-dim); border: 1px solid var(--green-border); }
.ticket .summary {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 6px 0;
  max-width: 760px;
}
.ticket .evidence {
  font-size: 12px;
  color: var(--text-mute);
  font-style: italic;
  padding: 7px 10px;
  background: var(--bg-2);
  border-left: 2px solid var(--border-2);
  border-radius: 0 3px 3px 0;
  margin: 8px 0 6px;
  max-width: 760px;
}
.ticket .meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: 'Geist Mono', monospace;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.report-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  cursor: default;
}
.report-card .kind {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.report-card .title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin-bottom: 10px;
}
.report-card .body {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 12px;
}
.report-card ul { margin: 0 0 10px; padding-left: 18px; }
.report-card ul li { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.report-card .patterns {
  display: flex; flex-direction: column; gap: 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  margin-top: 8px;
}
.report-card .patterns .row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.report-card .patterns .row:last-child { border-bottom: 0; }
.report-card .patterns .num { color: var(--amber); font-weight: 600; }

.btn-disabled {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-faint);
  border: 1px dashed var(--border-2);
  border-radius: 4px;
  cursor: not-allowed;
}

/* ─── /pipeline funnel ───────────────────────────────────────────── */
.funnel {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin: 12px 0 28px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 8px;
}
.funnel-stage {
  flex: 1;
  min-width: 130px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 12px 14px;
  position: relative;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.funnel-stage:first-child { border-radius: 6px 0 0 6px; }
.funnel-stage:last-child { border-radius: 0 6px 6px 0; }
.funnel-stage:hover { background: var(--panel-2); }
.funnel-stage.trap {
  background: var(--amber-dim);
  border-color: var(--amber-border);
}
.funnel-stage.leak {
  background: var(--red-dim);
  border-color: var(--red-border);
}
.funnel-stage .lbl {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: 'Geist Mono', monospace;
}
.funnel-stage .num {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.funnel-stage.trap .num { color: var(--amber); }
.funnel-stage.leak .num { color: var(--red); }
.funnel-stage .pct {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: var(--text-mute);
  margin-top: 2px;
}
.funnel-stage .pct.up { color: var(--green); }
.funnel-stage .pct.dn { color: var(--red); }

.funnel-flow {
  position: relative;
  display: flex;
  align-items: stretch;
  margin: 28px 0;
}

/* Kanban platform (read-only) */
.plat-kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.plat-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 10px;
}
.plat-col .head {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 4px 10px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 10px;
}
.plat-col .head .dot { width: 7px; height: 7px; border-radius: 50%; }
.plat-col .head .count { margin-left: auto; color: var(--text-mute); }

.mini-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 9px 10px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.mini-card:hover { border-color: var(--border-3); transform: translateY(-1px); }
.mini-card .name { font-size: 12.5px; font-weight: 500; margin-bottom: 4px; }
.mini-card .missing {
  font-size: 11px;
  color: var(--amber);
  font-family: 'Geist Mono', monospace;
  margin-top: 4px;
}
.mini-card .row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
}

/* ─── /crm ───────────────────────────────────────────────────────── */
.crm-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}

.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 12px;
  margin-bottom: 14px;
}
.search-bar input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-bar input::placeholder { color: var(--text-faint); }
.search-bar svg { width: 14px; height: 14px; color: var(--text-faint); }

.crm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.crm-table thead th {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  text-align: left;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}
.crm-table tbody tr { cursor: pointer; transition: background .1s; }
.crm-table tbody tr:hover { background: var(--panel-2); }
.crm-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  vertical-align: top;
}
.crm-table tbody tr:last-child td { border-bottom: 0; }
.utm-chip {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: var(--blue);
  background: var(--blue-dim);
  border: 1px solid var(--blue-border);
  padding: 1px 6px;
  border-radius: 3px;
}

/* Enrichment panel */
.enrich-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--panel);
}
.metric-cell {
  padding: 11px 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.metric-cell:nth-child(2n) { border-right: 0; }
.metric-cell:nth-last-child(-n+2) { border-bottom: 0; }
.metric-cell .lbl {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.metric-cell .val {
  font-size: 17px;
  font-weight: 600;
  margin-top: 3px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric-cell .val.ok { color: var(--green); }
.metric-cell .val.warn { color: var(--amber); }
.metric-cell .val.bad { color: var(--red); }
.metric-cell .val.ok::before { content: '● '; }

.enrich-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
}
.enrich-table thead th {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 10px;
  text-align: left;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.enrich-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.enrich-table tbody tr:last-child td { border-bottom: 0; }
.enrich-table .ok { color: var(--green); }
.enrich-table .failed { color: var(--red); }
.btn-replay {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 13px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  cursor: pointer;
  margin-top: 12px;
  transition: background .12s, border-color .12s;
}
.btn-replay:hover { background: var(--panel-2); border-color: var(--border-3); }

/* ─── /ops ───────────────────────────────────────────────────────── */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.ops-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
}
.ops-card .lbl {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.ops-card .val {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.ops-card .breakdown {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 6px;
}
.ops-card .breakdown .in { color: var(--blue); }
.ops-card .breakdown .out { color: var(--green); }

.ops-card.pack {
  display: flex; flex-direction: column;
  gap: 6px;
}
.ops-card.pack .v {
  font-family: 'Geist Mono', monospace;
  font-size: 14px;
  color: var(--green);
  display: flex; align-items: center; gap: 6px;
}
.ops-card.pack .v::after { content: '✓'; color: var(--green); }
.ops-card.pack .ck { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--text-faint); }
.ops-card.pack .editlink {
  font-size: 11.5px;
  color: var(--blue);
  margin-top: auto;
  display: inline-flex; align-items: center; gap: 4px;
}

.spark-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
}
.spark {
  width: 100%;
  height: 120px;
}

/* ─── Contact ficha ──────────────────────────────────────────────── */
.contact-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--text-mute);
  margin-bottom: 8px;
  cursor: pointer;
}
.back-link:hover { color: var(--text); }
.contact-name {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.contact-sub {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 4px;
  display: flex; align-items: center; gap: 10px;
}
.jid-chip {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.merge-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple);
  border: 1px solid var(--purple-border);
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--purple-dim);
}

.action-hero {
  background:
    linear-gradient(90deg, var(--amber-dim), transparent 60%),
    var(--panel);
  border: 1px solid var(--amber-border);
  border-left: 3px solid var(--amber);
  border-radius: 6px;
  padding: 20px 24px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.action-hero.critical {
  background:
    linear-gradient(90deg, var(--red-dim), transparent 60%),
    var(--panel);
  border-color: var(--red-border);
  border-left-color: var(--red);
}
.action-hero .eyebrow {
  display: block;
  margin-bottom: 6px;
}
.action-hero.critical .eyebrow { color: var(--red); }
.action-hero.warn .eyebrow { color: var(--amber); }
.action-hero .text {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.35;
  max-width: 720px;
}
.action-hero .sub {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 6px;
}

.dual-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 22px;
}
.dual-block .col {
  padding: 18px 22px 22px;
}
.dual-block .col + .col { border-left: 1px solid var(--border); }
.dual-block .col-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.dual-block .col-label::before {
  content: '';
  width: 14px; height: 1px; background: var(--border-2);
}
.dual-block .field { margin-bottom: 14px; }
.dual-block .field:last-child { margin-bottom: 0; }
.dual-block .field-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 5px;
}
.dual-block .field-value {
  font-size: 15px;
  font-weight: 500;
}

.checklist {
  display: flex; flex-direction: column; gap: 4px;
}
.check-item {
  display: flex; align-items: center; gap: 9px;
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--text-2);
}
.check-item .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.check-item.done .dot { background: var(--green); border-color: var(--green); }
.check-item.done .dot::after {
  content: '';
  width: 5px; height: 2.5px;
  border-left: 1.4px solid var(--bg);
  border-bottom: 1.4px solid var(--bg);
  transform: rotate(-45deg) translate(0,-1px);
}
.check-item.done .lbl { text-decoration: line-through; text-decoration-color: var(--border-2); color: var(--text-mute); }
.check-item.warn .dot { border-color: var(--amber); background: var(--amber-dim); }
.check-item.warn .dot::after {
  content: '!'; color: var(--amber); font-weight: 600; font-size: 10px;
}

.gmb-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px 14px;
}
.gmb-rating { font-size: 22px; font-weight: 600; }
.gmb-rating::after { content: ' ★'; color: var(--amber); font-size: 16px; }
.gmb-reviews { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--text-mute); }
.gmb-status {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  margin-top: 8px;
  display: inline-block;
}
.gmb-status.present { color: var(--green); background: var(--green-dim); }
.gmb-status.missing { color: var(--red); background: var(--red-dim); }
.gmb-status.broken { color: var(--red); background: var(--red-dim); }
.gmb-status.unknown { color: var(--text-mute); background: var(--panel-2); }
.gmb-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px;
  color: var(--blue);
  margin-top: 8px;
}

.relations-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 6px;
}
.relations-list .rel {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 22px;
  border-left: 1px solid var(--border);
  margin-left: 6px;
}
.timeline-item {
  position: relative;
  padding: 10px 0 14px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  width: 9px; height: 9px;
  left: -27px; top: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--text-mute);
}
.timeline-item.t-message_in::before  { background: var(--amber); border-color: var(--amber); }
.timeline-item.t-message_out::before { background: var(--blue); border-color: var(--blue); }
.timeline-item.t-message_agent::before { background: var(--green); border-color: var(--green); }
.timeline-item.t-state_change::before { background: var(--bg); border-color: var(--text-mute); }
.timeline-item.t-handoff::before { background: var(--red); border-color: var(--red); }
.timeline-item.t-enrichment::before { background: var(--purple); border-color: var(--purple); }

.timeline-item .ts {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.timeline-item .author {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 500;
  margin: 2px 0 4px;
}
.timeline-item .author.agent { color: var(--green); }
.timeline-item .author.maestro { color: var(--purple); }
.timeline-item.t-message_in .text {
  background: var(--panel-2);
  padding: 9px 13px;
  border-radius: 3px 11px 11px 11px;
  display: inline-block;
  font-size: 13px;
  max-width: 620px;
}
.timeline-item.t-message_out .text {
  background: var(--blue-dim);
  border: 1px solid var(--blue-border);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 11px 3px 11px 11px;
  display: inline-block;
  font-size: 13px;
  max-width: 620px;
}
.timeline-item.t-message_agent .text {
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 11px 3px 11px 11px;
  display: inline-block;
  font-size: 13px;
  max-width: 620px;
}
.timeline-item.t-state_change .text,
.timeline-item.t-handoff .text,
.timeline-item.t-enrichment .text {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  color: var(--text-mute);
}
.timeline-item.t-handoff .text strong { color: var(--red); font-weight: 600; }
.timeline-item.t-enrichment .text strong { color: var(--purple); font-weight: 600; }

/* ─── Page transition ────────────────────────────────────────────── */
.view-enter { animation: enter .3s ease both; }
@keyframes enter { from { opacity:0; transform: translateY(4px);} to { opacity:1; transform: none; } }

/* ─── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  aside.nav {
    position: relative; height: auto; flex-direction: row; align-items: center;
    padding: 10px 14px; overflow-x: auto;
  }
  .brand { padding: 0; margin: 0 16px 0 0; border: 0; }
  .nav-label, .nav-footer { display: none; }
  .nav-link { white-space: nowrap; padding: 6px 10px; }
  .nav-link.active::before { display: none; }
  .global-header { grid-template-columns: repeat(2, 1fr); }
  .gkpi { padding: 11px 14px; }
  .gkpi:nth-child(2n) { border-right: 0; }
  .gkpi:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .view { padding: 18px 14px 48px; }
  .ex-table thead { display: none; }
  .ex-table tbody tr { display: block; padding: 12px 14px; }
  .ex-table tbody td { display: block; border: 0; padding: 3px 0; }
  .crm-layout { grid-template-columns: 1fr; }
  .dual-block { grid-template-columns: 1fr; }
  .dual-block .col + .col { border-left: 0; border-top: 1px solid var(--border); }
  .plat-kanban { grid-template-columns: repeat(2, 1fr); }
  .funnel { flex-wrap: nowrap; overflow-x: auto; }
}
