/* Catapaz Operation Panel — negro cálido, cian, fucsia y naranja del logo original. */
:root {
  --bg: #0b0b10;
  --bg-2: #131218;
  --surface: #1a1820;
  --surface-2: #24212c;
  --line: #35303f;
  --line-2: #51465d;
  --text: #f5f1f7;
  --muted: #b6adbf;
  --faint: #998da5;
  --teal: #22dde0;
  --teal-600: #18bec5;
  --teal-ink: #052124;
  --teal-soft: rgba(34, 221, 224, 0.12);
  --amber: #ffb84a;
  --amber-soft: rgba(255, 184, 74, 0.13);
  --rose: #f07a8a;
  --rose-soft: rgba(240, 122, 138, 0.12);
  --sky: #f45bb1;
  --sky-soft: rgba(244, 91, 177, 0.12);
  --violet: #c19afa;
  --green: #6be39b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", var(--font);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14.5px/1.5 var(--font);
  color: var(--text);
  background:
    radial-gradient(800px 260px at 4% 0%, rgba(244, 91, 177, .065), transparent 65%),
    radial-gradient(900px 280px at 95% 0%, rgba(34, 221, 224, .04), transparent 65%);
  background-color: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; flex: none; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
::selection { background: rgba(34, 221, 224, 0.3); }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font: 500 13.5px/1 var(--font); padding: 10px 14px; border-radius: 10px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, color .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--line-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); font-weight: 600; }
.btn-primary:hover { background: #6ce9ec; border-color: #6ce9ec; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-amber { background: var(--amber-soft); border-color: rgba(255, 184, 74, .4); color: var(--amber); }
.btn-wa { background: rgba(107, 227, 155, .1); border-color: rgba(107, 227, 155, .35); color: var(--green); }
.btn-sm { padding: 8px 11px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn.is-done { background: var(--teal-soft); border-color: rgba(34, 221, 224, .45); color: var(--teal); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Campos ── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.field > span { font-weight: 500; letter-spacing: .01em; }
input, select, textarea {
  font: 14.5px/1.45 var(--font); color: var(--text);
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(34, 221, 224, .15); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-error { color: var(--rose); min-height: 1.2em; margin: 0; font-size: 13px; }

/* ── Marca ── */
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo { position: relative; display: block; width: 180px; height: 72px; overflow: hidden; flex: none; }
.brand-logo img { position: absolute; width: 220px; height: 220px; max-width: none; top: -66px; left: -24px; }
.brand-copy { padding-left: 16px; border-left: 1px solid var(--line); }
.brand-name { font: 600 13px/1.4 var(--display); letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-lg { flex-direction: column; align-items: flex-start; gap: 18px; }
.brand-lg .brand-copy { padding-left: 0; border-left: 0; }
.brand-lg .brand-name { font-size: 22px; }
.brand-lg .brand-sub { font-size: 13px; }

/* ── Login ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px;
  background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 28px 22px; box-shadow: var(--shadow);
}
.login-copy { margin: 0; color: var(--muted); }

/* ── Layout app ── */
.app { max-width: 1440px; margin: 0 auto; padding: 0 28px 32px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 0; margin-bottom: 22px; border-bottom: 1px solid var(--line); background: rgba(11, 11, 16, .96);
  backdrop-filter: blur(6px);
}
.tabs { display: flex; gap: 4px; margin-left: auto; background: var(--bg); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.tab {
  border: 0; background: transparent; color: var(--muted); font: 500 13.5px/1 var(--font);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; gap: 7px; align-items: center;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }
.tab-badge:empty { display: none; }
.tab-badge { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 99px; background: var(--amber); color: #2a1a02; font: 600 11px/19px var(--font); text-align: center; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.sync { font-size: 12px; color: var(--faint); margin-right: 4px; white-space: nowrap; }
.sync.is-error { color: var(--rose); }

/* ── KPIs ── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 6px 0 22px; }
.kpi {
  position: relative; overflow: hidden; display: grid; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 13px;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent, var(--teal)); }
.kpi-send { --accent: var(--teal); }
.kpi-reply { --accent: var(--amber); }
.kpi-wait { --accent: var(--sky); }
.kpi-act { --accent: var(--violet); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font: 600 30px/1.15 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 12px; color: var(--faint); }
.kpi.is-hot .kpi-value { color: var(--accent); }

/* ── Carriles (cola) ── */
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.lane { background: rgba(26, 24, 32, .55); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.lane-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.lane-head h2 { margin: 0 0 3px; font: 600 15.5px/1.3 var(--display); display: flex; align-items: center; gap: 8px; }
.lane-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-teal { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.dot-amber { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.count { font: 600 13px/1 var(--mono); color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.lane-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 11px; box-shadow: var(--shadow); min-width: 0;
}
.card.is-leaving { opacity: 0; transform: translateX(14px); transition: opacity .25s, transform .25s; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-title { font: 600 14.5px/1.3 var(--display); margin: 0; cursor: pointer; }
.card-title:hover { color: var(--teal); }
.card-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card-sub .mono { font-family: var(--mono); font-size: 12px; }
.phone-missing { color: var(--amber); }
.msg-box {
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px;
  font-size: 14px; line-height: 1.55; max-height: 260px; overflow: auto;
}
.msg-box.is-collapsed { max-height: 120px; mask-image: linear-gradient(180deg, #000 70%, transparent); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions .spacer { flex: 1; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); }
.last-msg { font-size: 13px; color: var(--muted); border-left: 2px solid var(--line-2); padding: 2px 0 2px 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.last-msg.is-inbound { border-left-color: var(--amber); color: var(--text); }
.waiting-monedina { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--amber); }
.waiting-monedina::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.paste-area { display: flex; flex-direction: column; gap: 8px; }
.paste-area textarea { min-height: 70px; }

.empty { text-align: center; color: var(--faint); padding: 28px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); font-size: 13.5px; }
.empty strong { display: block; color: var(--muted); font: 600 14px/1.4 var(--display); margin-bottom: 3px; }

/* ── Cola: detalle fijo arriba + resúmenes abajo ── */
.lane-stick {
  position: sticky;
  top: 64px;
  z-index: 8;
  background: #0b1526;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
}
.lane-tools { padding: 8px 2px 0; }
.lane-tools input, .toolbar-search { padding: 8px 11px; font-size: 13.5px; border-radius: 9px; }
.toolbar-search { width: min(260px, 100%); margin-left: auto; }
.lane-detail {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  max-height: min(52vh, 440px); overflow: auto; box-shadow: var(--shadow);
}
.lane-detail.is-send { border-color: rgba(34, 221, 224, .4); }
.lane-detail.is-paste { border-color: rgba(255, 184, 74, .42); }
.lane-detail.is-needs { border-left: 3px solid var(--amber); }
.lane-detail.is-empty {
  align-items: center; text-align: center; color: var(--faint); padding: 22px 14px;
  max-height: none; border-style: dashed; box-shadow: none;
}
.lane-detail.is-empty strong { display: block; color: var(--muted); font: 600 14px/1.4 var(--display); margin-bottom: 3px; }
.lane-detail.is-leaving { opacity: 0; transition: opacity .2s; }
.lane-detail .flag-warn { margin: 0; }
.lane-detail .msg-box { max-height: none; }
.detail-id { display: flex; gap: 11px; align-items: center; min-width: 0; }
.detail-id-text { min-width: 0; }
.detail-name { font: 600 16px/1.25 var(--display); }
.detail-sub { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.detail-sub .mono { font-family: var(--mono); font-size: 12px; }
.lane-body.qlist { gap: 6px; padding: 10px; }
.qrow {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 10px 9px 11px;
  transition: border-color .15s, background .15s, opacity .25s, transform .25s;
}
.qrow:hover { border-color: var(--line-2); }
.qrow:focus-visible { outline: 2px solid var(--teal-600); outline-offset: 2px; }
.qrow.is-selected { border-color: rgba(34, 221, 224, .55); background: rgba(34, 221, 224, .07); box-shadow: 0 0 0 1px rgba(34, 221, 224, .2); }
.qrow-paste.is-selected { border-color: rgba(255, 184, 74, .55); background: rgba(255, 184, 74, .07); box-shadow: 0 0 0 1px rgba(255, 184, 74, .2); }
.qrow.is-needs { border-left: 3px solid var(--amber); }
.qrow.is-leaving { opacity: 0; transform: translateX(14px); }
.qrow .avatar { width: 30px; height: 30px; border-radius: 8px; }
.qrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qrow-top { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.qrow-name { font: 600 14px/1.3 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.qrow-time { margin-left: auto; flex: none; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.qrow-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.qrow-sub .phone-inline, .qrow-sub .phone-missing { flex: none; }
.qrow-sub .mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.qrow-sub .badge-flag { display: none; }
.qrow-preview { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--faint); }
.qrow-preview b { color: var(--muted); font-weight: 600; }
.qrow.is-selected .qrow-preview { color: var(--muted); }
.qrow-chips { display: flex; align-items: center; gap: 6px; flex: none; }
.qrow-chips .pill { font-size: 11px; padding: 2px 8px 2px 7px; }
.qtag { display: inline-flex; align-items: center; gap: 4px; font: 600 11px/1 var(--font); padding: 4px 7px; border-radius: 99px; white-space: nowrap; }
.qtag svg { width: 12px; height: 12px; }
.qtag-done { color: var(--teal); background: var(--teal-soft); }
.qrow-meta { font-size: 12px; color: var(--faint); }
.last-msg.is-full { display: block; -webkit-line-clamp: unset; max-height: 160px; overflow: auto; }
.more-wrap { display: flex; justify-content: center; margin-top: 12px; max-width: 820px; }

/* ── Pills de estado ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 8px; border-radius: 99px;
  font: 500 11.5px/1.5 var(--font); white-space: nowrap; border: 1px solid transparent;
  color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 13%, transparent); border-color: color-mix(in srgb, var(--c, var(--muted)) 30%, transparent);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-new { --c: #a9b6cc; }
.st-queued { --c: var(--teal); }
.st-sent { --c: #8fd0ff; }
.st-awaiting_reply { --c: var(--sky); }
.st-needs_reply { --c: var(--amber); }
.st-warm { --c: #ff9f6b; }
.st-won { --c: var(--green); }
.st-lost { --c: var(--rose); }
.st-paused { --c: #7b88a0; }
.zone { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }

/* ── Contactos ── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 99px;
  font: 500 12.5px/1 var(--font); padding: 7px 11px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.chip:hover { color: var(--text); }
.chip.is-active { background: var(--teal-soft); border-color: rgba(34, 221, 224, .5); color: var(--teal); }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .75; }
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.contact { cursor: pointer; transition: border-color .15s, transform .15s; }
.contact:hover { border-color: var(--line-2); transform: translateY(-1px); }
.contact .notes { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Actividad ── */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; max-width: 820px; }
.timeline li { position: relative; display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 10px 0 10px 18px; border-left: 1px solid var(--line); }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 16px; width: 9px; height: 9px; border-radius: 50%; background: var(--k, var(--faint)); box-shadow: 0 0 0 3px var(--bg); }
.timeline li.is-new .summary { color: var(--text); font-weight: 500; }
.timeline .when { font-size: 12px; color: var(--faint); font-family: var(--mono); padding-top: 2px; }
.timeline .summary { color: var(--muted); }
.timeline .who { cursor: pointer; color: var(--teal); }
.k-inbound_received { --k: var(--amber); }
.k-outbound_drafted { --k: var(--teal); }
.k-message_sent { --k: var(--sky); }
.k-status_changed { --k: var(--violet); }
.k-contact_created, .k-seed { --k: var(--green); }

/* ── Chat ── */
.chat { flex: 1; overflow-y: auto; padding: 16px 18px; min-height: 260px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 88%; display: flex; flex-direction: column; gap: 6px; }
.bubble.out { align-self: flex-end; align-items: flex-end; }
.bubble.in { align-self: flex-start; }
.bubble-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.bubble.out .bubble-body { background: #0f3b3a; border: 1px solid #165a55; border-bottom-right-radius: 4px; }
.bubble.in .bubble-body { background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }
.bubble.is-archived { opacity: .45; }
.bubble.is-ready .bubble-body { border-style: dashed; border-color: var(--teal-600); }
.bubble-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 11.5px; color: var(--faint); }
.bubble-meta .tag { color: var(--muted); }
.bubble-meta .tag.ready { color: var(--teal); }
.bubble-meta button { border: 0; background: none; color: var(--muted); font: 500 11.5px var(--font); cursor: pointer; padding: 2px 4px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; }
.bubble-meta button:hover { color: var(--text); background: var(--surface-2); }
.bubble-meta button svg { width: 13px; height: 13px; }
.composer { border-top: 1px solid var(--line); padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 9px; background: var(--bg-2); border-radius: 0 0 16px 16px; }
.composer-mode { display: flex; flex-wrap: wrap; gap: 6px; }
.composer-mode label { cursor: pointer; position: relative; }
.composer-mode input { position: absolute; opacity: 0; pointer-events: none; }
.composer-mode span { display: inline-block; font-size: 12.5px; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); }
.composer-mode input:checked + span { color: var(--amber); border-color: rgba(255, 184, 74, .5); background: var(--amber-soft); }
.composer-mode input[value="outbound"]:checked + span { color: var(--teal); border-color: rgba(34, 221, 224, .5); background: var(--teal-soft); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hint { font-size: 12px; color: var(--faint); }

/* ── Modal ── */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); width: min(560px, calc(100% - 24px)); }
.modal::backdrop { background: rgba(3, 8, 16, .65); backdrop-filter: blur(2px); }
.modal-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font: 600 17px/1.3 var(--display); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 .field-wide { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }


/* ── Avatares ── */
.card-id { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 10px; overflow: hidden; display: grid; place-items: center;
  background: #f4f7fb; border: 1px solid var(--line-2);
}
.avatar img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.avatar-txt { background: var(--surface-2); color: var(--teal); font: 600 12.5px/1 var(--display); }
.avatar-lg { width: 42px; height: 42px; border-radius: 12px; }
.avatar-xl { width: 76px; height: 76px; border-radius: 18px; font-size: 22px; }
.avatar-xl img { padding: 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.foot-links { display: inline-flex; gap: 12px; align-items: center; }
.foot-links svg, .contact .notes svg { width: 13px; height: 13px; vertical-align: -2px; }

/* Pills de servicio */
.eg-prospect { --c: #a9b6cc; }
.eg-contracted { --c: var(--sky); }
.eg-active { --c: var(--green); }
.eg-past_due { --c: var(--rose); }
.eg-paused { --c: #7b88a0; }
.eg-ended { --c: #6b7890; }

/* ── Ficha (space) ── */
.space-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.space-hero {
  background: linear-gradient(135deg, rgba(34, 221, 224, .08), rgba(26, 24, 32, .6) 55%); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px;
}
.hero-id { display: flex; gap: 16px; align-items: center; min-width: 0; }
.hero-text { min-width: 0; }
.hero-text h1 { margin: 0 0 6px; font: 600 22px/1.2 var(--display); letter-spacing: -.01em; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; color: var(--muted); }
.hero-meta a { display: inline-flex; align-items: center; gap: 5px; }
.hero-meta svg { width: 15px; height: 15px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 8px; }
.link-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text); max-width: 100%;
}
.link-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-chip svg { width: 16px; height: 16px; color: var(--teal); }
.link-chip:hover { border-color: var(--teal-600); text-decoration: none; }
.link-chip.is-muted { color: var(--faint); border-style: dashed; }
.link-chip.is-muted svg { color: var(--faint); }

.space-tabs { display: none; }
.space-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.space-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.space-col-chat { position: sticky; top: 76px; }
.panel { background: rgba(26, 24, 32, .55); border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.panel-head h2 { margin: 0; font: 600 15px/1.3 var(--display); display: flex; align-items: center; gap: 8px; }
.chat-panel { display: flex; flex-direction: column; max-height: calc(100vh - 100px); }
.chat-panel .panel-head { border-bottom: 1px solid var(--line); }
.chat-panel .chat { background: rgba(11, 11, 16, .35); }

.facts { margin: 0; padding: 0 16px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: 2px; }
.facts dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.facts .is-offer dd { background: var(--teal-soft); border: 1px solid rgba(34, 221, 224, .25); border-radius: 10px; padding: 9px 11px; }
.muted { color: var(--faint); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; padding: 0 16px 14px; }
.gallery > .empty { grid-column: 1 / -1; }
.shot { margin: 0; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.shot-img { all: unset; cursor: zoom-in; display: block; aspect-ratio: 1; border-radius: 11px; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg); }
.shot-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.shot-img:hover img { transform: scale(1.04); }
.shot-logo .shot-img { background: #f4f7fb; }
.shot-logo .shot-img img { object-fit: contain; padding: 10px; }
.shot-doc { display: grid; place-items: center; aspect-ratio: 1; border: 1px dashed var(--line-2); border-radius: 11px; font-size: 12.5px; }
.shot figcaption { font-size: 11.5px; color: var(--muted); line-height: 1.35; position: relative; padding-right: 18px; }
.shot .kind { display: inline-block; font: 500 10px/1 var(--mono); text-transform: uppercase; color: var(--teal); margin-right: 5px; }
.shot-del { position: absolute; right: 0; top: -1px; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0; opacity: 0; }
.shot:hover .shot-del, .shot-del:focus { opacity: 1; }
.shot-del svg { width: 13px; height: 13px; }
.mini-form { border-top: 1px solid var(--line); }
.mini-form > summary { cursor: pointer; padding: 10px 16px; font-size: 12.5px; color: var(--muted); list-style: none; }
.mini-form > summary::-webkit-details-marker { display: none; }
.mini-form > summary:hover { color: var(--text); }
.asset-form { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; padding: 0 16px 14px; }
.asset-form input[name=caption] { grid-column: 1 / 2; }
.asset-form input, .asset-form select { padding: 8px 10px; font-size: 13.5px; }

#space-service { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.card.is-embedded { box-shadow: none; background: var(--bg-2); }
.payments h3 { margin: 0 0 6px; font: 600 13px/1.3 var(--display); color: var(--muted); }
.payments ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.payments li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.payments .mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.payments p { margin: 0; font-size: 13px; }
.empty-actions { margin-top: 12px; display: flex; justify-content: center; gap: 8px; }

.panel-edit > summary { cursor: pointer; list-style: none; }
.panel-edit > summary::-webkit-details-marker { display: none; }
.panel-edit > summary h2::after { content: "▾"; font-size: 12px; color: var(--muted); margin-left: 4px; }
.panel-edit[open] > summary h2::after { content: "▴"; }
.space-edit { padding: 0 16px 16px; }
.form-actions { display: flex; justify-content: flex-end; }

/* ── Clientes ── */
.kpi-danger { --accent: var(--rose); }
.kpi-money { font-size: 24px; }
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.client.is-due_soon { border-color: rgba(255, 184, 74, .55); box-shadow: 0 0 0 1px rgba(255, 184, 74, .25), var(--shadow); }
.client.is-past_due { border-color: rgba(240, 122, 138, .6); box-shadow: 0 0 0 1px rgba(240, 122, 138, .3), var(--shadow); }
.client .card-head { flex-wrap: wrap; }
.client .card-head .pills { margin-left: auto; }
.client .notes { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; }
.alert-tag { font: 600 11.5px/1.5 var(--font); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.alert-soon { color: var(--amber); background: var(--amber-soft); }
.alert-late { color: var(--rose); background: var(--rose-soft); }
.kv { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; }
.kv dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.kv dd { margin: 2px 0 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.kv small { color: var(--faint); }
.btn-danger:hover { color: var(--rose); border-color: rgba(240, 122, 138, .5); }
.empty-lg { padding: 40px 24px; max-width: 640px; margin: 10px auto; line-height: 1.6; }

/* ── Teléfonos de la ficha ── */
.phones { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 10px; }
.phones > .empty { padding: 18px 12px; }
.phone-row { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.phone-row.is-primary { border-color: rgba(107, 227, 155, .35); }
.phone-row.is-flagged { border-color: rgba(255, 184, 74, .55); background: linear-gradient(0deg, var(--amber-soft), var(--amber-soft)), var(--bg); }
.phone-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.phone-num { font: 600 15px/1.2 var(--mono); letter-spacing: .01em; }
.phone-row.is-flagged .phone-num { text-decoration: line-through dotted rgba(255, 184, 74, .8); }
.phone-tag { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px/1 var(--font); padding: 5px 8px; border-radius: 99px; color: var(--sky); background: var(--sky-soft); text-transform: uppercase; letter-spacing: .04em; }
.phone-tag svg { width: 13px; height: 13px; }
.phone-tag.pt-whatsapp { color: var(--green); background: rgba(107, 227, 155, .1); }
.phone-tag.pt-call { color: var(--violet); background: rgba(183, 162, 255, .12); }
.phone-tag.is-primary { box-shadow: 0 0 0 1px rgba(107, 227, 155, .45) inset; }
.phone-note { font-size: 12.5px; color: var(--muted); }
.phone-flag-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--amber); }
.phone-flag-note svg { width: 14px; height: 14px; margin-top: 2px; }
.phone-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.phone-actions .spacer { flex: 1; }
.phones-hint { margin: 0; padding: 0 16px 14px; }
.btn-xs { padding: 6px 9px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-xs svg { width: 14px; height: 14px; }
.btn-flag:hover { color: var(--amber); border-color: rgba(255, 184, 74, .5); }
.badge-flag { display: inline-flex; align-items: center; gap: 4px; font: 600 11px/1 var(--font); color: #2a1a02; background: var(--amber); padding: 4px 7px; border-radius: 99px; white-space: nowrap; }
.badge-flag svg { width: 12px; height: 12px; }
.phone-inline { display: inline-flex; align-items: center; gap: 6px; }
.flag-warn { display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(255, 184, 74, .35); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.flag-warn svg { width: 15px; height: 15px; margin-top: 1px; }
.hero-phone { display: inline-flex; align-items: center; gap: 6px; }
.hero-phone small { font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.hero-phone.is-flagged a { color: var(--amber); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { width: 16px; height: 16px; padding: 0; flex: none; accent-color: var(--teal); }

/* ── Visor ── */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 980px); max-height: 92vh; color: var(--text); text-align: center; }
.lightbox::backdrop { background: rgba(3, 8, 16, .85); }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 12px; display: block; margin: 0 auto; background: #fff; }
.lightbox p { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.lightbox form { position: absolute; right: 4px; top: 4px; }
.lightbox-close { background: rgba(11, 11, 16, .7); color: #fff; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #eaf3ff; color: #0b0b10; font-weight: 500; font-size: 13.5px; padding: 10px 16px; border-radius: 11px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 80; max-width: calc(100% - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--rose); color: #2a0509; }

/* ── Responsive ── */
@media (max-width: 980px) {
  .lanes { grid-template-columns: 1fr; }
  .space-grid { grid-template-columns: 1fr; }
  .space-col-chat { position: static; }
  .chat-panel { max-height: none; }
  .chat-panel .chat { max-height: 60vh; }
  .space-tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); padding: 4px; border-radius: 12px; margin-bottom: 12px; position: sticky; top: 64px; z-index: 10; }
  .space-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font: 500 13.5px/1 var(--font); padding: 9px 10px; border-radius: 9px; cursor: pointer; }
  .space-tabs button.is-active { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }
  .space-grid[data-active="chat"] [data-pane]:not([data-pane="chat"]),
  .space-grid[data-active="ficha"] [data-pane]:not([data-pane="ficha"]),
  .space-grid[data-active="servicio"] [data-pane]:not([data-pane="servicio"]) { display: none; }
  .space-grid:not([data-active="chat"]) .space-col-chat { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app { padding: 0 12px 90px; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 0 8px; }
  .brand-sub { display: none; }
  .topbar-actions { margin-left: auto; }
  .tabs { order: 3; width: 100%; margin: 0; }
  .tab { flex: 1; justify-content: center; padding: 9px 4px; gap: 4px; font-size: 13px; }
  .sync { display: none; }
  .kpis { gap: 8px; margin-bottom: 14px; }
  .kpi { padding: 11px 12px; }
  .kpi-value { font-size: 24px; }
  .kpi-hint { display: none; }
  .lane { border: 0; background: transparent; }
  .lane-head { padding: 6px 2px 10px; }
  .lane-body { padding: 0; }
  .card-actions .btn { flex: 1 1 auto; }
  .lane-stick { top: 108px; padding: 8px 0; background: var(--bg); }
  .lane-tools { padding: 8px 0 0; }
  .lane-body.qlist { padding: 8px 0 0; }
  .lane-detail { max-height: min(58vh, 480px); }
  .qrow { padding: 10px; gap: 9px; }
  .qrow-sub { flex-wrap: wrap; row-gap: 1px; }
  .qrow-preview { flex-basis: 100%; }
  .qrow-chips .pill { display: none; }
  .toolbar-search { width: 100%; margin-left: 0; order: 3; }
    .grid-2 { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .contacts { grid-template-columns: 1fr; }
  .clients { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: 1fr; }
  .space-hero { padding: 14px; }
  .hero-text h1 { font-size: 18px; }
  .avatar-xl { width: 58px; height: 58px; }
  .space-tabs { top: 104px; }
  .asset-form { grid-template-columns: 1fr; }
}

/* ── Observaciones (notas por contacto) ── */
.qtag-note { color: var(--amber); background: var(--amber-soft); }
.obs { --obs: var(--amber); border: 1px solid rgba(255, 184, 74, .32); background: linear-gradient(180deg, rgba(255, 184, 74, .06), rgba(255, 184, 74, .02)); border-radius: 12px; min-width: 0; }
.obs > summary, .obs-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 44px; box-sizing: border-box; }
.obs > summary { cursor: pointer; list-style: none; user-select: none; }
.obs > summary::-webkit-details-marker { display: none; }
.obs > summary > svg, .obs-head > svg { width: 18px; height: 18px; color: var(--obs); flex: none; }
.obs > summary > svg:last-child { margin-left: auto; color: var(--faint); transition: transform .15s; }
.obs[open] > summary > svg:last-child { transform: rotate(180deg); }
.obs-title { font: 600 14px/1.2 var(--display); margin: 0; color: var(--text); }
.obs-count { font: 600 11.5px/1 var(--font); color: var(--muted); background: var(--surface-2); padding: 4px 8px; border-radius: 99px; white-space: nowrap; }
.obs-count.is-hot { color: var(--amber); background: var(--amber-soft); }
.obs-hint { margin-left: auto; font-size: 12px; color: var(--faint); text-align: right; }
.obs-inner { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.obs-form { display: flex; gap: 8px; align-items: stretch; }
.obs-form textarea { flex: 1; min-height: 64px; font-size: 14.5px; line-height: 1.45; }
.obs-form .btn { min-height: 44px; flex: none; align-self: flex-end; }
.obs-empty { margin: 0; font-size: 12.5px; color: var(--faint); }
.obs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.obs-item { display: flex; gap: 8px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 10px; padding: 6px 4px 8px 6px; }
.obs-item.is-done { border-left-color: var(--teal); opacity: .78; }
.obs-item.is-done .obs-body { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(142, 160, 187, .5); }
.obs-toggle {
  all: unset; box-sizing: border-box; cursor: pointer; flex: none;
  min-width: 44px; min-height: 44px; padding: 4px 6px; border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font: 600 10.5px/1 var(--font); color: var(--amber);
}
.obs-toggle svg { width: 20px; height: 20px; }
.obs-toggle:hover { background: var(--surface-2); }
.obs-toggle:focus-visible, .obs-del:focus-visible { outline: 2px solid var(--teal-600); outline-offset: 1px; }
.obs-item.is-done .obs-toggle { color: var(--teal); }
.obs-toggle:disabled { opacity: .5; cursor: progress; }
.obs-main { flex: 1; min-width: 0; padding-top: 5px; }
.obs-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 11.5px; color: var(--faint); }
.obs-meta b { color: var(--muted); font-weight: 600; }
.obs-body { margin-top: 3px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.obs-reply { margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--teal); background: var(--teal-soft); padding: 6px 8px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.obs-reply svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.obs-del { all: unset; box-sizing: border-box; cursor: pointer; flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 9px; color: var(--faint); }
.obs-del svg { width: 15px; height: 15px; }
.obs-del:hover { color: var(--rose); background: var(--rose-soft); }
.obs-panel { margin: 0 0 14px; }
.obs-panel:empty { display: none; }
.obs-panel .obs { background: linear-gradient(180deg, rgba(255, 184, 74, .07), rgba(255, 184, 74, .02)), var(--surface); box-shadow: var(--shadow); }
.obs-panel .obs-head { padding: 12px 14px; }
.obs-panel .obs-inner { padding: 0 14px 14px; }
.obs-panel .obs-title { font-size: 15px; }
.lane-detail > * { flex-shrink: 0; } /* el detalle hace scroll; el mensaje nunca se aplasta */
@media (max-width: 720px) {
  .obs-hint { display: none; }
  .obs-form { flex-direction: column; }
  .obs-form .btn { align-self: stretch; justify-content: center; }
  .obs-form textarea { font-size: 16px; } /* evita el zoom de iOS */
  .obs-list { max-height: none; }
  .obs-panel .obs-head, .obs-panel .obs-inner { padding-left: 12px; padding-right: 12px; }
}

/* ── WhatsApp propio de Catapaz (topbar, copiar con 1 toque) ── */
.own-wa { display: inline-flex; align-items: stretch; border: 1px solid rgba(107, 227, 155, .35); background: rgba(107, 227, 155, .08); border-radius: 10px; overflow: hidden; margin-right: 4px; }
.own-wa-copy { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--text); padding: 5px 9px 5px 10px; cursor: pointer; text-align: left; min-height: 36px; }
.own-wa-copy:hover { background: rgba(107, 227, 155, .12); }
.own-wa-text { display: grid; line-height: 1.15; }
.own-wa-label { font: 600 10px/1.2 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--green); white-space: nowrap; }
.own-wa-num { font: 500 12.5px/1.25 var(--mono); color: var(--text); white-space: nowrap; }
.own-wa-ico { width: 16px; height: 16px; color: var(--green); flex: none; }
.own-wa-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; border-left: 1px solid rgba(107, 227, 155, .25); color: var(--green); }
.own-wa-link:hover { background: rgba(107, 227, 155, .12); }
.own-wa-link svg { width: 17px; height: 17px; }
.own-wa.is-copied { border-color: var(--green); background: rgba(107, 227, 155, .18); }
.own-wa.is-copied .own-wa-label { color: var(--text); }
@media (max-width: 720px) {
  .own-wa { margin-right: 0; }
  .own-wa-copy { padding: 4px 8px; gap: 6px; min-height: 40px; }
  .own-wa-label { font-size: 9.5px; }
  .own-wa-num { font-size: 12px; }
  .own-wa-link { width: 32px; }
}
@media (max-width: 430px) {
  .topbar .brand > div { display: none; }
  .own-wa-link { display: none; }
}

/* ── Demo + repositorio (ficha y detalle de cola) ── */
.proj-links { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.hero-links .proj-links { width: auto; display: contents; }
.lane-detail .proj-links { margin: 2px 0 10px; }
.link-chip.proj-repo svg { color: var(--text); }
.link-chip.proj-repo { background: var(--surface-2); }
@media (max-width: 720px) {
  .proj-links .link-chip { flex: 1 1 0; min-width: 0; justify-content: center; min-height: 40px; }
  .hero-links .proj-links { display: flex; width: 100%; }
}
.proj-links .pl-short { display: none; }
@media (max-width: 720px) {
  .proj-links .pl-full { display: none; }
  .proj-links .pl-short { display: inline; }
}

/* ── Versión 1 (antes) / Versión 2 (rediseño) ── */
.link-chip.proj-ver { align-items: center; }
.proj-ver .ver-txt { display: flex; flex-direction: column; line-height: 1.1; text-align: left; overflow: visible; }
.proj-ver .ver-txt b { font-weight: 700; font-size: 13px; }
.proj-ver .ver-txt small { font-size: 11px; opacity: .8; }
.link-chip.proj-v1 { background: var(--surface-2); border-style: dashed; }
.link-chip.proj-v1 svg { color: var(--faint); }
.link-chip.proj-v2 { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
@media (max-width: 720px) {
  .proj-links .link-chip.proj-ver { flex: 1 1 calc(50% - 4px); min-height: 44px; }
  .proj-links:has(.proj-ver) .link-chip.proj-repo { flex: 1 1 100%; }
}

/* ── Rubro (categoría) y "Ya tiene web" ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cat-chip { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px/1 var(--font); color: var(--violet); background: rgba(183, 162, 255, .12); border: 1px solid rgba(183, 162, 255, .3); padding: 4px 8px; border-radius: 99px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.cat-chip svg { width: 12px; height: 12px; flex: none; }
.cat-chip.is-empty { color: var(--faint); background: transparent; border-style: dashed; border-color: var(--line-2); }
.web-badge { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px/1 var(--font); color: var(--sky); background: var(--sky-soft); border: 1px solid rgba(244, 91, 177, .35); padding: 4px 8px; border-radius: 99px; white-space: nowrap; }
.web-badge svg { width: 12px; height: 12px; }
a.web-badge:hover { text-decoration: none; border-color: var(--sky); }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dot-sky { background: var(--sky); box-shadow: 0 0 0 4px var(--sky-soft); }

/* ── Contactos: filtros de rubro / web y selección múltiple ── */
.toolbar-sub { justify-content: flex-start; margin-top: -4px; }
.sel-inline { position: relative; display: inline-flex; align-items: center; }
.sel-inline > svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.sel-inline select { padding: 8px 32px 8px 33px; font-size: 13px; border-radius: 99px; width: auto; max-width: 280px; background-color: transparent; }
.sel-inline.is-active select { border-color: rgba(183, 162, 255, .6); color: var(--violet); background-color: rgba(183, 162, 255, .08); }
.sel-inline.is-active > svg { color: var(--violet); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: 99px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font: 500 12.5px/1 var(--font); padding: 7px 11px; border-radius: 99px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--sky-soft); color: var(--sky); box-shadow: 0 0 0 1px rgba(244, 91, 177, .45) inset; }
.seg-btn .n { font-family: var(--mono); font-size: 11px; opacity: .75; }
#btn-bulk { margin-left: auto; }
.bulkbar {
  position: sticky; top: 64px; z-index: 9; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: #0b1526; border: 1px solid rgba(240, 122, 138, .35); border-radius: 12px; padding: 8px 10px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.bulkbar .spacer { flex: 1; }
.bulk-count { font: 600 13px/1 var(--display); padding: 0 4px; }
.btn-delete { background: var(--rose-soft); border-color: rgba(240, 122, 138, .5); color: var(--rose); }
.btn-delete:hover { background: rgba(240, 122, 138, .2); border-color: var(--rose); }
.btn-delete:disabled { opacity: .45; cursor: not-allowed; }
.contacts.is-bulk .contact { cursor: pointer; user-select: none; }
.contact.is-selected { border-color: rgba(240, 122, 138, .6); background: linear-gradient(0deg, rgba(240, 122, 138, .06), rgba(240, 122, 138, .06)), var(--surface); }
.contact:focus-visible { outline: 2px solid var(--teal-600); outline-offset: 2px; }
.contact.is-dup .card-title { color: var(--amber); }
.sel-box { flex: none; width: 22px; height: 22px; margin-top: 10px; border-radius: 7px; border: 2px solid var(--line-2); display: grid; place-items: center; background: var(--bg); }
.sel-box.is-on { background: var(--rose); border-color: var(--rose); color: #2a0509; }
.sel-box svg { width: 14px; height: 14px; }
.space-del { margin-left: auto; }

/* ── Eliminar (diálogo) ── */
.delete-body { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.delete-body p { margin: 0; }
.delete-list { margin: 0; padding: 8px 12px 8px 28px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; max-height: 220px; overflow: auto; font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; }
.delete-list .muted { font-size: 12px; }
.delete-warn { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--rose); background: var(--rose-soft); border: 1px solid rgba(240, 122, 138, .35); border-radius: 10px; padding: 8px 10px; }
.delete-warn svg { width: 15px; height: 15px; margin-top: 1px; }
.delete-blocked { font-size: 13px; color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(255, 184, 74, .35); border-radius: 10px; padding: 8px 10px; }

/* ── Cola: pestañas manuales + grilla de conversaciones ── */
.queue-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 4px 0 24px; }
.queue-eyebrow { margin: 0 0 6px; font: 600 10px/1.4 var(--font); text-transform: uppercase; letter-spacing: .18em; color: var(--teal); }
.queue-heading h1 { margin: 0; font: 600 28px/1.25 var(--display); letter-spacing: -.045em; }
.queue-intro { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.queue-search { display: flex; align-items: center; gap: 10px; width: min(340px, 38%); padding: 0 13px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.queue-search:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.queue-search input { border: 0; box-shadow: none; background: transparent; padding: 12px 0; min-width: 0; }
.queue-search input:focus { box-shadow: none; }
.queue-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.queue-tab { --queue-accent: var(--teal); display: flex; align-items: center; gap: 9px; background: transparent; border: 1px solid transparent; border-radius: 10px; color: var(--muted); font: 600 13px/1.3 var(--font); padding: 12px 16px; min-height: 48px; cursor: pointer; transition: border-color .2s, background .2s, color .2s; }
.queue-tab-wait { --queue-accent: var(--sky); }
.queue-tab-reply { --queue-accent: var(--amber); }
.queue-tab:hover { background: var(--surface); color: var(--text); }
.queue-tab[aria-selected="true"] { border-color: color-mix(in srgb, var(--queue-accent) 45%, var(--line)); background: color-mix(in srgb, var(--queue-accent) 9%, var(--bg-2)); color: var(--text); }
.queue-tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--queue-accent); flex: none; }
.queue-tab-count { margin-left: 4px; padding: 3px 7px; min-width: 26px; color: var(--queue-accent); background: var(--bg); border-radius: 5px; font: 600 11px/1.2 var(--mono); text-align: center; }
.kcol { min-width: 0; }
.kcol-head { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 14px; padding: 22px 0 18px; }
.kcol-head h2 { margin: 0; font: 500 15px/1.4 var(--display); letter-spacing: -.02em; }
.kcol-head p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.queue-results { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kcol-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.kcol-body > .empty { grid-column: 1 / -1; padding: 64px 16px; background: var(--bg-2); }
.kcard {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px; cursor: pointer; min-width: 0;
  transition: border-color .15s, transform .15s, opacity .25s;
}
.kcard:hover { border-color: var(--teal-600); background: var(--surface-2); transform: translateY(-2px); }
.kcard:focus-visible { outline: 2px solid var(--teal-600); outline-offset: 2px; }
.kcard-send { border-left: 3px solid var(--teal); }
.kcard-wait { border-left: 3px solid var(--sky); }
.kcard-reply { border-left: 3px solid var(--amber); }
.kcard.is-leaving { opacity: 0; transform: translateX(14px); }
.kcard-head { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.kcard-head .avatar { width: 46px; height: 46px; border-radius: 12px; }
.kcard-id { flex: 1; min-width: 0; }
.kcard-name { margin: 0; font: 600 15px/1.3 var(--display); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.kcard-phone { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.kcard-phone .mono { font-family: var(--mono); font-size: 12px; }
.kcard-time { font-size: 11px; color: var(--faint); }
.kcard-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kcard-tags:empty { display: none; }
.kcard-preview { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.kcard-preview b { color: var(--text); font-weight: 600; }
.kcard-reply .kcard-preview { color: var(--text); }
.kcard-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding-top: 14px; margin-top: auto; border-top: 1px solid var(--line); }
.klinks { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.klinks.is-empty { font-size: 12px; color: var(--faint); }
.klink { display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1 var(--font); color: var(--text); background: var(--surface-2); border: 1px solid var(--line-2); padding: 6px 9px; border-radius: 8px; }
.klink svg { width: 13px; height: 13px; color: var(--muted); }
.klink:hover { text-decoration: none; border-color: var(--teal-600); }
.klink.is-v2 { border-color: rgba(34, 221, 224, .5); color: var(--teal); }
.klink.is-v2 svg { color: var(--teal); }
.klink.is-v1 { border-style: dashed; }
.kcopy { border: 1px solid rgba(34, 221, 224, .45); background: var(--teal-soft); color: var(--teal); border-radius: 9px; width: 44px; height: 44px; display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.kcopy:hover { background: rgba(34, 221, 224, .2); }
.kcopy svg { width: 16px; height: 16px; }
.qtag-count { color: var(--teal); background: var(--teal-soft); }

/* ── Cola: modal de detalle ── */
body.qm-open { overflow: hidden; }
.qmodal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; }
.qmodal-backdrop { position: absolute; inset: 0; background: rgba(3, 8, 16, .7); backdrop-filter: blur(2px); animation: qm-fade .15s ease-out; }
.qmodal-card {
  position: relative; width: min(1080px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
  outline: none; animation: qm-in .18s ease-out;
}
@keyframes qm-fade { from { opacity: 0; } }
@keyframes qm-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.qmodal-x { position: absolute; top: 12px; right: 12px; z-index: 2; background: var(--surface-2); border-color: var(--line); width: 40px; height: 40px; }
.qmodal-scroll { overflow: auto; padding: 20px 22px 22px; overscroll-behavior: contain; }
.qm-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 20px 4px; font-size: 13.5px; }
.qm-loading svg { animation: spin .9s linear infinite; }
.qm-head { display: flex; gap: 14px; align-items: center; padding-right: 48px; margin-bottom: 14px; }
.qm-head-text { min-width: 0; }
.qm-head h2 { margin: 0 0 6px; font: 700 21px/1.25 var(--display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.qm-tags { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.qm-col { font: 700 11px/1 var(--font); text-transform: uppercase; letter-spacing: .06em; padding: 5px 8px; border-radius: 6px; }
.qm-col-send { color: var(--teal-ink); background: var(--teal); }
.qm-col-wait { color: #2d071d; background: var(--sky); }
.qm-col-reply { color: #2a1a02; background: var(--amber); }
.qm-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.qm-main, .qm-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.qm-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.qm-sec h3 { margin: 0; font: 600 14.5px/1.3 var(--display); display: flex; align-items: center; gap: 8px; }
.qm-sec h3 small { color: var(--faint); font: 500 12px/1 var(--mono); }
.qm-sec-send { border-color: rgba(34, 221, 224, .45); }
.qm-sec-paste { border-color: rgba(255, 184, 74, .42); }
.qm-pending { display: flex; flex-direction: column; gap: 9px; transition: opacity .2s; }
.qm-pending + .qm-pending { border-top: 1px dashed var(--line-2); padding-top: 12px; }
.qm-pending.is-leaving { opacity: .3; }
.qm-pending .msg-box { max-height: none; font-size: 14.5px; }
.qm-history { max-height: 420px; overflow: auto; display: flex; flex-direction: column; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.qm-phones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qm-phones li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 7px 9px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.qm-phones li.is-flagged { border-color: rgba(255, 184, 74, .55); }
.qm-phones .mono { font: 600 14px/1.2 var(--mono); }
.qm-phones small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.qm-phone-one { font-size: 14px; }
.qm-phone-one .mono { font-family: var(--mono); }
.qm-facts { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.qm-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.qm-facts dd { margin: 2px 0 0; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.qm-links { display: flex; flex-wrap: wrap; gap: 8px; }
.qm-links:empty { display: none; }
.qm-side .obs { background: linear-gradient(180deg, rgba(255, 184, 74, .07), rgba(255, 184, 74, .02)), var(--surface); }
.qm-side .obs-hint { display: none; }
.qm-side .obs-form { flex-direction: column; }
.qm-side .obs-form .btn { align-self: stretch; justify-content: center; }
.qm-open-ficha { justify-content: center; }

@media (max-width: 1100px) {
  .qm-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .kcol-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .brand-copy { display: none; }
}
@media (max-width: 720px) {
  .queue-heading { flex-direction: column; align-items: stretch; gap: 18px; margin-bottom: 18px; }
  .queue-heading h1 { font-size: 24px; }
  .queue-search { width: 100%; }
  .queue-search input { font-size: 16px; }
  .queue-tabs { gap: 4px; padding-bottom: 10px; }
  .queue-tab { flex: 1; min-width: 0; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 10px 5px; font-size: 11px; text-align: center; }
  .queue-tab-dot { display: none; }
  .queue-tab-count { margin-left: 0; }
  .kcol-head { padding: 18px 0 14px; }
  .kcol-head h2 { font-size: 13px; }
  .kcol-head p { font-size: 11.5px; }
  .kcol-body { grid-template-columns: 1fr; gap: 12px; }
  .kcard { padding: 16px; }
  .klink { padding: 8px 10px; min-height: 36px; }
  .kcopy { width: 44px; height: 40px; }
  .qmodal { padding: 0; place-items: stretch; }
  .qmodal-card { width: 100%; max-height: none; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .qmodal-scroll { padding: calc(14px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom)); }
  .qmodal-x { top: calc(8px + env(safe-area-inset-top)); right: 8px; width: 44px; height: 44px; }
  .qm-head { gap: 10px; padding-right: 50px; }
  .qm-head h2 { font-size: 18px; }
  .qm-head .avatar-xl { width: 54px; height: 54px; border-radius: 14px; }
  .qm-sec { padding: 12px; }
  .qm-sec .card-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .qm-sec textarea { font-size: 16px; }
  .qm-history { max-height: 55vh; }
  .toolbar-sub { gap: 8px; }
  .sel-inline, .sel-inline select { width: 100%; max-width: none; }
  .seg { width: 100%; }
  .seg-btn { flex: 1; justify-content: center; padding: 9px 6px; }
  #btn-bulk { margin-left: 0; width: 100%; }
  .bulkbar { top: 108px; }
  .space-top .hint { display: none; }
}

.queue-tab:focus-visible, .tab:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .kcopy:focus-visible, .klink:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 3px;
}
.klink { min-height: 40px; }
.app-footer {
  --catapaz-label: var(--muted);
  --catapaz-name: var(--text);
  --catapaz-accent: var(--sky);
  --catapaz-name-hover: #fff;
  --catapaz-accent-hover: var(--teal);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-top: 1px solid var(--line); margin-top: 38px; padding-top: 22px; color: var(--muted); font-size: 11px;
}
.catapaz-signature { display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: .25rem; width: fit-content; max-width: 100%; min-height: 44px; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; text-decoration: none; border-radius: 2px; }
.catapaz-signature__label { color: var(--catapaz-label); font-size: .5625rem; font-weight: 600; line-height: 1.5; letter-spacing: .25em; text-transform: uppercase; }
.catapaz-signature__name { color: var(--catapaz-name); font-size: 1.125rem; font-weight: 800; line-height: 1; letter-spacing: -.025em; white-space: nowrap; transition: color 160ms; }
.catapaz-signature__dot { color: var(--catapaz-accent); transition: color 160ms; }
.catapaz-signature:hover { text-decoration: none; }
.catapaz-signature:hover .catapaz-signature__name, .catapaz-signature:focus-visible .catapaz-signature__name { color: var(--catapaz-name-hover); }
.catapaz-signature:hover .catapaz-signature__dot, .catapaz-signature:focus-visible .catapaz-signature__dot { color: var(--catapaz-accent-hover); }
.catapaz-signature:focus-visible { outline: 2px solid var(--text); outline-offset: 6px; }
@media (max-width: 1200px) { .topbar .brand-copy { display: none; } }
@media (max-width: 720px) {
  .app { padding-bottom: 28px; }
  .topbar { gap: 8px; margin-bottom: 22px; }
  .topbar .brand-logo { width: 130px; height: 54px; }
  .topbar .brand-logo img { width: 160px; height: 160px; left: -18px; top: -48px; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .icon-btn { width: 32px; height: 40px; }
  .topbar-actions .btn { font-size: 12px; padding: 8px; min-height: 40px; }
  .own-wa-copy { padding: 4px 6px; gap: 5px; }
  .own-wa-num { font-size: 11px; }
  .own-wa-label { font-size: 8px; }
  .app-footer { align-items: flex-start; gap: 18px; }
  .app-footer > span { max-width: 150px; }
}
@media (max-width: 380px) {
  .topbar .brand-logo { width: 114px; height: 48px; }
  .topbar .brand-logo img { width: 140px; height: 140px; left: -16px; top: -42px; }
  .tab { min-width: 0; flex-wrap: wrap; font-size: 12px; gap: 3px; padding: 8px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .kcard, .queue-tab, .btn, .catapaz-signature__name, .catapaz-signature__dot { transition: none; }
  .kcard:hover { transform: none; }
}
