/* ─── Table ── Pro Data Grid ──────────────────────────────── */
.tblwrap { flex: 1; overflow: auto; }

table { width: 100%; border-collapse: collapse; font-size: 11px; min-width: 1900px; }
thead { position: sticky; top: 0; z-index: 5; }
thead tr { background: var(--bg1); border-bottom: 1px solid var(--line); }

th {
  padding: 8px 10px;
  text-align: left;
  font-family: var(--sans); font-size: 10px;
  color: var(--text3); letter-spacing: .02em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap; user-select: none;
  border-right: none;
  transition: color .18s; font-weight: 600;
}
th:last-child { border-right: none; }
th:hover { color: var(--text2); }
th.ths { color: var(--accent) !important; }
th.th-check { width: 30px; cursor: default; }
th.th-check:hover { color: var(--text3); }

tbody tr {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s ease;
}
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr.rsel { background: rgba(232,168,0,.04) !important; border-left: 2px solid var(--accent); }
tbody tr.imp { border-left: 2px solid rgba(168,85,247,.3); }
tbody tr.checked-row { background: rgba(59,130,246,.03); }

td {
  padding: 7px 10px;
  vertical-align: middle;
  white-space: nowrap;
  border-right: none;
  font-size: 11px;
}
td:last-child { border-right: none; }
td.td-check { width: 30px; text-align: center; }

/* Channel cell */
.chcell { display: flex; align-items: center; gap: 5px; min-width: 140px; }
.chav {
  width: 24px; height: 24px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.chav img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.chnm { font-weight: 600; font-size: 11px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.chhd { font-family: var(--mono); font-size: 7px; color: var(--text3); }
.kolnm { font-size: 9px; color: var(--accent); font-weight: 500; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges */
.bdg {
  display: inline-flex; align-items: center;
  padding: 1px 5px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 7px; font-weight: 500;
}
.bg { background: rgba(34,197,94,.08); color: var(--green); border: 1px solid rgba(34,197,94,.18); }
.br { background: rgba(239,68,68,.08); color: var(--red); border: 1px solid rgba(239,68,68,.18); }
.ba { background: rgba(232,168,0,.08); color: var(--accent); border: 1px solid rgba(232,168,0,.18); }
.bb { background: rgba(59,130,246,.08); color: var(--a2); border: 1px solid rgba(59,130,246,.18); }
.bp { background: rgba(168,85,247,.08); color: var(--purple); border: 1px solid rgba(168,85,247,.18); }

/* Check/link cells */
.ck { font-size: 10px; display: block; text-align: center; text-decoration: none; }
.ck.y { color: var(--green); }
.ck.n { color: var(--text3); }
.ck.y:hover { color: var(--accent); }

/* Quality label */
.ql { display: inline-flex; align-items: center; padding: 1px 5px; border-radius: var(--radius); font-family: var(--mono); font-size: 7px; }
.q-ok { background: rgba(34,197,94,.06); color: var(--green); border: 1px solid rgba(34,197,94,.12); }
.q-warn { background: rgba(232,168,0,.06); color: var(--accent); border: 1px solid rgba(232,168,0,.12); }
.q-bad { background: rgba(239,68,68,.06); color: var(--red); border: 1px solid rgba(239,68,68,.12); }

/* Status pill */
.stpill { font-size: 8px; font-family: var(--mono); padding: 1px 5px; border-radius: var(--radius); white-space: nowrap; }

/* Pipeline view — flat card design */
.pipeline { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; background: var(--bg0); gap: 0; }
.pstage {
  flex-shrink: 0; width: 240px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg1); transition: background .18s;
}
.pstage:last-child { border-right: none; }
.psh { padding: 12px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.psh-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.psh-nm { font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 5px; font-family: var(--sans); }
.psh-dot { width: 6px; height: 6px; border-radius: 50%; }
.psh-cnt {
  font-family: var(--mono); font-size: 9px;
  background: transparent; border: none;
  border-radius: 10px; padding: 0; color: var(--text3);
}
.psh-desc { font-family: var(--sans); font-size: 9px; color: var(--text3); }
.pcards { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; }
.pcard {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 11px;
  cursor: grab; user-select: none;
  transition: opacity .15s, border-color .15s, box-shadow .15s;
  animation: fadeIn .2s ease;
}
.pcard:hover { border-color: var(--line2); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.pcard.dragging { opacity: .35; }
.pcard.selected { outline: 2px solid var(--accent); background: rgba(240,180,41,.08); }
.pcard.has-note { border-left: 2px solid rgba(168,85,247,.35); }
.pcard-nm { font-size: 11px; font-weight: 600; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--sans); }
.pcard-kol { font-size: 9px; color: var(--accent); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmeta { font-family: var(--mono); font-size: 8px; color: var(--text3); }
.pcard-xref { font-family: var(--mono); font-size: 8px; padding: 1px 6px; border-radius: 8px; background: rgba(59,130,246,.12); color: #60a5fa; border: 1px solid rgba(59,130,246,.25); white-space: nowrap; cursor: help; }
.pcard-xref-conflict { background: rgba(239,68,68,.18); color: #fca5a5; border-color: rgba(239,68,68,.45); font-weight: 600; }
.pct { font-size: 7px; padding: 1px 5px; border-radius: var(--radius); background: var(--bg3); color: var(--text3); border: none; }
.pct.has { background: rgba(34,197,94,.06); color: var(--green); }
.pct.info { background: rgba(232,168,0,.06); color: var(--accent); }
/* Per-stage sort button — sits inside the column header (.psh-top).
   Was previously inline-styled in pipeline.js; extracted here so mobile rules
   can override it via mobile.css with the canonical 32px button rhythm. */
.psh-sort {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text3);
  border-radius: var(--radius);
  padding: 2px 6px;
  font-size: 9px;
  cursor: pointer;
  margin-left: auto;
  line-height: 1;
  font-family: var(--mono);
}

/* Platform picker — single dropdown trigger that replaces 3 separate
   YT/IG/X buttons. Click opens an inline checkbox menu with all 3 networks. */
.kb-plat-picker {
  position: relative;
  display: inline-block;
}
.kb-plat-picker > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text);
  user-select: none;
  white-space: nowrap;
}
.kb-plat-picker > summary::-webkit-details-marker { display: none; }
.kb-plat-picker > summary:hover { border-color: var(--text3); }
.kb-plat-picker[open] > summary { border-color: var(--accent); color: var(--accent); }
.kb-plat-picker .kb-plat-icons { font-size: 11px; letter-spacing: 1px; }
.kb-plat-picker .kb-plat-label { font-weight: 600; }
.kb-plat-picker .kb-plat-chev { opacity: .55; font-size: 9px; transition: transform .15s; }
.kb-plat-picker[open] .kb-plat-chev { transform: rotate(180deg); }

.kb-plat-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 180px;
  max-width: calc(100vw - 16px);
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kb-plat-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  transition: background .12s;
}
.kb-plat-opt:hover { background: var(--bg2); }
.kb-plat-opt input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}
.kb-plat-opt span { flex: 1; user-select: none; }
.psh-sort.has-override { border-color: var(--accent); color: var(--accent); }
.psh-sort:hover { background: var(--bg3); color: var(--text2); }

.pstage.drag-over { background: rgba(232,168,0,.02); }
.pstage.drag-over .pcards { border: 1px dashed rgba(232,168,0,.2); border-radius: var(--radius); }
/* Blocked kanban drag-over */
#blockedKanban > div.drag-over { outline: 2px dashed rgba(232,168,0,.35); outline-offset: -2px; background: rgba(232,168,0,.03); }
.dragging { opacity: .5; }
.pempty { padding: 24px; text-align: center; font-size: 10px; color: var(--text3); font-family: var(--sans); }

/* Semáforo contacto */
.sem {
  font-family: var(--mono); font-size: 7px; font-weight: 700;
  padding: 2px 5px; border-radius: 10px; flex-shrink: 0;
  min-width: 22px; text-align: center;
}
.sem-green { background: rgba(34,197,94,.08); color: var(--green); border: 1px solid rgba(34,197,94,.18); }
.sem-yellow { background: rgba(232,168,0,.08); color: var(--accent); border: 1px solid rgba(232,168,0,.18); }
.sem-red { background: rgba(239,68,68,.08); color: var(--red); border: 1px solid rgba(239,68,68,.18); animation: pulse 2s infinite; }
.sem-grey { background: var(--bg3); color: var(--text3); border: 1px solid var(--line); }

/* Responsive table */
@media (max-width: 900px) {
  table { min-width: 1200px; }
  .pipeline { flex-direction: column; overflow-y: auto; overflow-x: hidden; }
  .pstage { width: 100%; flex-shrink: unset; border-right: none; border-bottom: 1px solid var(--line); }
  .pcards { max-height: 300px; }
}

/* Quick-message strip below the channel handle.
   Appears in every row when ch.telegram / .whatsapp / .email exist.
   Tapping opens the corresponding app on mobile. Designed at 14px so it
   feels like a separate row of actions, not a duplicated check column. */
.row-msg-strip { line-height: 1; }
.row-msg-strip .row-msg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--bg2);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: transform .12s ease, border-color .12s ease;
}
.row-msg-strip .row-msg:hover { transform: translateY(-1px); border-color: currentColor; }
.row-msg-strip .row-msg svg { display: block; }
@media (max-width: 768px) {
  .row-msg-strip .row-msg { width: 26px; height: 26px; }
}
